2,040 Posted Topics
Re: Also, why are you using [] instead of real dynamic array like ArrayList? This "Arrays.copyOf(collection, capacity); collection = newCollection;" is an inefficient way of implementing dynamic collection (too much of trouble). Is it in your requirement to do so? Also, why do you have to multiply the capacity by 2 … | |
Re: Please use "code" tag around your code... Not easy to read your code right now :( For applet samples, you may look at this link [URL="http://oreilly.com/catalog/javanut/examples/"]http://oreilly.com/catalog/javanut/examples/[/URL] (especially the 2nd applet example code). | |
Re: You are adding it wrong... I can't remember whether Matlab has a built-in function for factorial. If not, you need to implement it yourself. Shouldn't be that difficult. Actually x^1/1! is not always equal to 1. If it is wrong, you may need to do it differently as... Let see … | |
![]() | Re: As Stevanity said, the syntax of printf is [CODE] printf(String format, Object... args) // for example, with 1 argument System.out.printf("My print out string %s", "one"); // result is to display "My print ouf string one" on the console // with 2 arguments System.out.printf("And here is %s with another %s"), "one … |
Re: You are on the right track. However, why do you need to print white space afterward? You just need to go to the next line after you finish printing out the * for each row... You need to start the row from 1, not right at Max. Also, you should … | |
Re: Hmm... No, I don't think you are on the right track. Do you remember the diagram of number? Something like... [CODE] Number | +------------------+-----------+ | | | Real Integer Imaginary / \ | rational irrational | ---+--- / | \ neg 0 pos [/CODE] That's just from the top of … | |
Re: The reason is that the "Cd" class is not a String class. the next() method return a String if I remember correctly. What is your Cd constructor? Possible solution (depending on your Cd constructor) is as follows... [CODE] liste.add(new Cd(input.next())); [/CODE] | |
![]() | Re: Does makeStr() append the existing list or it just creates a new list over the existing list? What you are doing now is none of the above but create nodes with links... Then the created list is discarded and becomes memory leak after the function ends. |
Re: I understand that JQuery is a nice library. Though I could use pure JavaScript to do the same job even though it would be longer due to JQuery hides most of the code for you. However, it seems that your code has a flaw. What do you think if I … | |
Re: I'm confused a bit... Could you actually give a sample input that you did? And what the value displayed? To me, the "terms" looks fine, but why do you need to input the value of error? Is the value something like + or - 0.000001??? Because if it is, you … | |
Re: You may, but it would be easier to find the bug because the GUI part is extracted from the core. :) | |
Re: Does it need to be in Java? Anyway, what's the problem with specify a URL for the crawler? Can you obtain the content from the crawler? If so, there is no need to worry about. You can easily parse all the links in a page content, save them somewhere in … | |
Re: A couple questions... How does the hosting company analytic counts a page visit? Does it count via HTTP request or else? Do you have an authority to change the rule of visited page counter? | |
Re: No one would know how you create the page. There could be too many images, image files loaded on the page are big, using a lot of JavaScript to write document instead of use HTML, etc. There are also many factors besides the page implementation: server is slow, the Internet … | |
Re: It means that if you randomly pick a number from 1~7, you should get a different binary tree when you do an insertion. For example, if you draw a number from 1~7 and the result of the order is 1, 2, 3, 4, 5, 6, 7, you will get a … | |
Re: I believe when you talk about "travelling distance" means "Dijkstra's algorithm"? If so, this will depend on application and how you apply an algorithm to it. | |
Re: Watch out if you hard-code your String parsing... If the file contain even an empty line in the middle or something else, it could easily screw up your code. You need to first define how each data you are expecting should look like before you do that type of parsing. | |
Re: What content in the 'geojavascript.php' file? If it is the page itself, you would have a problem. You need a HTML portion/page that should not be its own page because you may create multiple same div id/name when the page calls itself. | |
Re: Hmm... Actually it is how you place the "div" in your HTML. When I look at it, the hidden "div" of each list item is in another "li" tag. I believe you are supposed to put the "div" in the same "li" similarly to the "share/save" one. | |
Re: I am not sure what output you want here. You have duplicated computation in your loop. If you put [CODE]System.out.println(i+" and "+j+" is checked");[/CODE] under line 7, you will see what I mean about duplicated value (for i). Also, your line 28 can be reduced to return n(a)==n(b); because n(b) … | |
Re: 1)You keep changing the value of "val" variable which is set to the number of loop you want to go through. As a result, your loop is likely to be be unstable. You need to create another variable and use it inside the loop. Don't be too thrifty to create … | |
Re: You aren't following the for-loop format... for(initial; upper bound; step) You have initial correct but not your upper bound. Get rid of ";" before && and see what happen. PS: You shouldn't use "for" loop in this case. You should use "while" loop instead... | |
Re: The code portion below is showing how to access a 2 dimension array... [CODE] // assume that your "grid" variable is type int for (int row=0; row<grid.length; row++) { for (int column=0; column<grid[row].length; column++) { // could simply use grid[0].length int value = grid[row][column] // accessing the "grid" variable at … | |
Re: Don't know what you mean by "not working"? There are tons of possibility... Anyway, have you checked that "rowsubtotals" variable consists of HTML elements you are looking for? That may be the starting point for your debugging. | |
Re: Even using label is not a proper way to do because the code is very inconsistence. You should construct your code to be properly nested or not nested loop. [CODE] // for example if(!done){ main:for(int x = 1; x <= 3; x++){ int same = 0; for(int y = 1; … | |
Re: Actually the solution is very simple. You need to think out of the box... What you need to do is the "key" of the Hash, not its value. Use arithmetic in computation and you get the result. [CODE] For example. Let a = [1, 6, 7, 9, 11] (length n) … | |
Re: Function name crashing? You should give meaningful function names instead of a, b, c, etc. Then you will have the same function name when you try to include all pages together. | |
Re: When you run, how did you run it? If you use IDE (not command line execution), you may not pass the argument in the command to the method. As a result, your args[] array is size 0. [CODE] // correct command line java ClientForNoDupCollection myfile.ext // if the myfile.ext exists, … | |
Re: The alert() function does nothing to check whether your xmlhttp is working. Is your xmlhttp variable global? In other words, do you declare it somewhere and is being used somewhere else too? The reason is that I do not see you declare the object inside your function at all. In … | |
Re: You may search the Google for keylogger virus, and key listener... They are somewhat similar in functionality (capture user's key stroke), but they have different purposes in use. | |
Re: [QUOTE]if SideAB + SideBC > SideAC.. it's invalid.[/QUOTE] Where did you get that from? That's wrong. It should be that all of the below is true, it is a triangle. AB+AC > BC AB+BC > AC BC+AC > AB | |
Re: They are likely to be wrong because you are not supposed to have 2 "where" clauses in the same query (without grouping or certain keywords) I don't know the syntax from the top of my head here. But I will tell you what should be done... #1 - You may … | |
Re: Hmm... Do you know the keyword 'volatile' in C++? In Java, static is very similar... To align your printout, this is a part of your design. You could try to arrange by programmatically add a correct number of white spaces. Using \t is a simple way but could screw your … | |
Re: Start from i=[COLOR="Red"]0[/COLOR], end with i[COLOR="Red"]<[/COLOR]colors.length, increased i by 1 each step... Not Start from i=[COLOR="Red"]1[/COLOR], end with i[COLOR="Red"]<=[/COLOR]colors.length, increased i by 1 each step. | |
Re: You can't access the speed value that way. Also, those variables are local to the Fan class. You need to make them public and be static if you are going to use it that way... [CODE] public static final int SLOW = 1; public static final int MEDIUM = 2; … | |
Re: As Aviras said, there is no real clear screen in Java. Supposed you are doing it on a console, if you want, you could try... [CODE] System.out.println("\u001b[2J"); [/CODE] That should have an effect similar to clear() but not exactly the same. | |
Re: What do you mean by "not working"? I tried your code and it returned false and added "M" to the grid when it is missed. Though, I only tried once. There are reasons I don't try again because... 1)I have to redo the whole set up again if the program … | |
Re: Hmm... How about you keep 3 shortest path values. Each time you get to the end of the search, check with them. If it is shorter than any of the values, replace the value. At the end of all search, you print out these values? Sorry that I can't help … | |
Re: You are calling another function which removes only the "head" node (so called "start") and that's it? The destructor is supposed to remove "all" nodes created in the list. It shouldn't throw any error if your "head" is null in the first place. It simply goes through each node and … ![]() | |
Re: You need to think about what to do here. Your loop does not extend to cover the whole requirement -- program keeps accepting and counting user's input until a "0" is entered. What you are doing now is to keep accepting until it is not "0" which results in 0 … | |
Re: In the real world, codes are different compared to academic codes. There are many reasons for that. 1)Academic projects are often much smaller than real world projects. Expecting a huge codes to be well designed would take a long time to finish. I mean, you wouldn't start coding right away. … | |
Re: If you want to print something without adding a new line at the end, use System.out.print() instead (notice it is print, not println). Also, you could add a comma or white space as many as you want in the print. That's your decision of formatting the print out. | |
Re: If you want it that way, then you need to modify the page you are displaying, not Ajax part. You just load the "Recent" data to the page and remove the "Select Album" option from the list. | |
Re: You cannot access obj.approxipi because it is "private" variable to the object. If you want, you need to either change it to public or implement a method that returns the variable value. | |
Re: Not sure if the "iterator" is the problem for you. How about modify your code to use a simple loop instead of the "iterator"? You want the index of "or" which is the same as iterating through a loop using real integer. [CODE] // from for(or_data or : counts.or_gates) { … | |
Re: Watch out for numOfChar value. You could create segmentation fault while running. Anyway, you should not simply cast a char array to an int array (if you can do... can't remember C++ syntax). You need to go through each value in the char array and convert to int. Also, there … | |
Re: OK, if you want help... Why do you think that using Integer.parseInt() will verify that the input is a string? When do you think that Integer.parseInt() would throw an exception? Would an input "Mimi" is an acceptable string name for you? If it is, then you are off the track … | |
Re: The script is way too many hard-coded. As a result, it is very lengthy and redundant. How about an easier approach? Using the same HTML input field you have... [CODE] <script type="text/javascript"> function bin2dec() { var elem = document.getElementById("text") if (elem) { // ensure the element exists var a = … | |
Re: Could you please stop pulling old threads back up? This one is over 3 years old already... | |
Re: What do you mean by "words"??? If you are talking about A-Za-z, then you may use [^A-Za-z]... It means "not" A-Za-z in the reqex. Remember that the "^" must be inside []. If it is outside, it means "start with"... |
The End.