Make the changes as below: while ((characterInt = fr.read()) != -1) { //characterInt = fr.read(); str += "" + (char) characterInt; } Read the char and compare it with -1 as EOF. You were appending the end of file char in string and then while loop condition was getting failed....

First of all I noticed in your last method gradeMessage you create a String variable message and try to print it out rather than trying to print out the result parameter passed into your method. For example your last method should look like this: public static void gradeMessage(String result) {...

You haven't defined any of the getMy... methods. (You have a getTopLeft(), but not getMyTopLeft(), etc.) Since this is a method in the class, you might as well just use field references: myTopLeft, myWidth, and myHeight....

A || B evaluates A first. If it is true, A is returned, and B never needs to be looked at. If A is false, B is evaluated and returned. For example, if you write function (x) { x = x || 50 ... This would make x=50, if x...

You need to change the function definition in playsound.cpp void soundBox() To void Sounds::soundBox() This is because the function exists within the scope of the Sounds class, so you have to define it as such. Otherwise it would be a free function, and the version of the function in your...

I believe you are looking for the number_format function in PHP, Which can be used like this: $cartTotal = number_format(12555.120000000, 2, '.', ','); The function takes 4 parameters: number - The number you wish to format decimal places - the number of decimal places to show decimal point character -...

They seem to be aliases for the same thing. From the documentation you can see that the sample code of intern uses to_sym: intern → symbol Returns the Symbol corresponding to str, creating the symbol if it did not previously exist. See Symbol#id2name. "Koala".intern #=> :Koala s = 'cat'.to_sym #=>...

Luc It seems that you have some errors in your code. The syntax for gscatter should include at least 3 parameters : x, y and group. It seems that group is missing. Furthermore the definition of color and sym may be wrong. Try col = 'kkkkkkkk'; instead of lincol =...

You can't assign variables in the class body. Try this instead: public class Test1 { int i; { i = 4; } } As an alternative, you could assign i in the constructor, or in a setter method: public class Test1 { int i; public Test1(int i) { this.i =...

Other answers argue correctly that :"foo bar" is superior to "foo bar".to_sym because it is clearer, better expresses your intention, is more readable, faster etc. But there is one more reason: "foo bar".to_sym relies on String#to_sym method, and there is a possibility (although remote) that this method might be redefined....

After reading the documentation and playing a little bit with this Symbol type in chrome, it appears that a Symbol is a way to define a name -- not a value --, and the fact that properties defined using symbols are not visible using for..in, Object.getOwnPropertyNames() or JSON.stringify() makes symbols...

The dot symbol is displayed when you build a cons-pair or a list which is not proper (meaning: it doesn't end with the empty list). For example: (cons 1 2) => (1 . 2) ; a cons-pair (cons 1 (cons 2 (cons 3 4))) => '(1 2 3 . 4)...

I believe the problem is that you remove all the children from rainlayer with the line rainlayer.removeChildren(i). You only want the line item.remove() - that removes the item from the project so it is no longer in the layer. There is no need to remove children from the layer. rainlayer.removeChildren(from...

Error #1023 means that you have a stack overflow in your code. See this link for more explanations : http://curtismorley.com/2007/08/19/flashflex-as3-error-1023-stack-overflow-occurred/ Regarding your code, you created a SuspectSimulatorDesktop class which instantiates a Tools object which instantiates itself a SuspectSimulatorDesktop object and so on... Each class calls the other one indefinitely and...

The σ-symbol doesn't exist in Helvetica, so you need to use the Symbol font. This is demonstrated in the StandardDeviation. See standard_deviation.pdf: This is how it's done: public void createPdf(String dest) throws IOException, DocumentException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(dest)); document.open(); document.add(new Paragraph("The standard deviation symbol doesn't...

Using U+0302 COMBINING CIRCUMFLEX ACCENT after the sigma character is the correct way. In Unicode, a combining mark appears after the base character in the data stream. And there is no other combining mark that could be conceivably used instead. However, the result depends on the font(s) and on the...

You cannot instantiate a new object this way. builder is a Class object. Try instead the following: return builder.getConstructors()[0].newInstance(anInput); Note: this assumes you are using the first constructor. You may be able to use getConstructor() but I'm not sure how it would behave with the generic type....

Although you claim to have compiled with cc -g on your executable myfilesys, GDB does not see any, as evidenced in your attempt to use GDB's file command: (gdb) file myfilesys Reading symbols from /.../myfilesys...(no debugging symbols found)...done. Taking you at your word that you have actually used cc -g...

You have to add std:: in front of list<...>. I assume wherever else you are using it you have using namespace std or something equivalent at the top of the file. void update(const unsigned int width, const unsigned int height, std::list<Ball>::iterator *it);...

When you include the c function, in your .mm file you need to use extern "C", something like this extern "C" { # include "c-header.h" } or, you can just add the extern "C" to the function declaration. The reason to do this is name mangling which is used in...

This rule is just wrong: main.o: *.cpp *.h g++ -c main.cpp Graph.cpp What this rule says is that if any file *.cpp or *.h changes, then make should rebuild a file main.o using the recipe command line g++ -c main.cpp Graph.cpp. So first, that's not what that compile line does:...

The length operator is a lua 5.1 addition. It did not exist in lua 5.0. Similarly the default string metatable appears to be a lua 5.1 addition. Compare the lua 5.0 implementation of luaopen_string to the lua 5.1 implementation of luaopen_string. Similarly (again) the modulo operation is also a 5.1...

i is declared in main, private final int VERSION is outside of main. Move it inside main or declare i as a global. static int i=0; public static void main(String[] args) { String strFilePath = "./version.txt"; try { FileInputStream fin = new FileInputStream(strFilePath); DataInputStream din = new DataInputStream(fin); i =...

Use %% to print a single %: print "Completed: %s %%" % (100*loops/totalLoops) or use the new format: print "Completed: {0} %".format(100. * loops / totalLoops) which even allows you to print float as percents (without multiplying them with 100): print "Completed: {0:.0%}".format(1. * loops / totalLoops) For loops =...

You should rename your class to another name, perhaps call it "IntegerMachine" and not "Integer". Java already has a native class with the name "Integer", and by naming your own class the same would mean that instead of calling java.lang.Integer.parseInt(string), which you intended, you are calling .Integer.parseInt(), for which the...

Try copy-pasting in the unicode alpha character to your script, and adjust the font to whatever you like: set terminal pdfcairo enhanced font "Arial,14" set output "test.pdf" set key font "Times,14" plot -x title "α β γ" The Symbol font is just another font, and the "strange" alpha is just...

The notation &#8962; (which should really include the semicolon) is just a reference to the character with Unicode code number 8962 in decimal. You can use similar notations for all Unicode characters, so the ultimate reference would be the Unicode Standard, and in practice you might want to look at...

Cannot find symbol means that you have a class/object type you are declaring, and the compiler does not know where to look for the class. The class must either be in the same package, or imported. When you do: import some.pkge.MyClass; It will tell the compiler that any type of...

It's true that within string interpolation, a single symbol will be stringified. >> s = :hello => :hello >> "#{s}" => "hello" But you have to remember that the entire expression inside the brackets is evaluated before it is stringified. This is why you see: >> "#{s.gsub('u','e')}" NoMethodError: undefined method...

That's because you havent defined r1 in your method changeRecL. Perhaps you wanted to pass that r1 from main to your method like below: case 1: changeRecL(r1); And accept R1 as below in the same: public static void changeRecL(Rectangle r1) ...

There's a few things that look like they're missing. First of all, are you importing the Color and Pixel classes, or are they included in the same package as your ChromaKey class? Second, you need to define backgroundImage and backgroundDelete as a class variable in order to call it in...

This has nothing to do with inheritance. You need to understand the difference between parameters and arguments. The parameters nam, rat, cred, and cit exist only within the Tourist constructor. In the addMemberCard() method, nam, rat, cred, and cit don't exist; markspace indirectly pointed this out. Now you need to...