2,040 Posted Topics
Re: >insisting that the rating supplied by the user be valid This part is somewhat not sure for me (the language). Does it mean your program has to also validate the validity of the user input, or the user will always enter a valid input??? | |
Re: >1.take input It means your program should prompt users for an input. The input means a user type in whatever value you expected using keyboard. >2.calculate average After you obtain all needed values (all grades/scores of a student), you calculate using mathematic equation to get the result. In this case, … | |
Re: The variable *i* in your first script is out of scope. As a result, the function attached to the onclick does not correctly access to the variable value. The second one is a closure and is properly use. You need to read more on variable scope and closure... | |
Re: You may try to replace symbols... Not sure but please try //After line 41 in handleResponse(), add this... strResponse = strResponse.replace(/</g, "<").replace(/>/g, ">"); | |
Re: There are a lot of ways to do what you are explaining. It depends on how you design & layout... Some may use JQuery, but I prefer primitive JavaScript. :P Below is a simple example... <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> div.hideContent { display: none; visibility: hidden; … | |
Re: Hmm... Have you implemented an ajax call yet? I mean just one ajax call to replace certain data on the page. If you could do it even once, then it is easy to implement the auto-call using setTimeout() at the end of the success call portion. An example of ajax … | |
Re: What is line 28??? If you want to use the onchange event, you need to put/attach the event to the *select* tag. To me, it looks like the code line is hanging inside, not one of the property of the *select* tag... //i.e. <select id="blah" name="dbl_blah" onchange="ChangIt('arg1')"> ... </select> | |
Re: Don't think the OP is adding an iframe element to the form, but adding it to the form's parent element. But your suggestion is valid that using getElementById() function to obtain the element from the DOM. Anyway, back to the OP... Do you have a form tag name "form"? | |
Re: Or... irb(main):001:0> (Array('A'..'Z')|Array('a'..'z')|Array('0'..'9')).each do |letter| irb(main):002:1* puts "#{letter}\t\t#{letter[0]}" irb(main):003:1> end Or... irb(main):001:0> (Array('A'..'Z')|Array('a'..'z')|Array('0'..'9')).each { |letter| puts "#{letter}\t\t#{letter[0]}" } | |
Re: How about adding `beforeThat = beforeLast;` between line 5 & 6? | |
Re: Huh? This is JavaScript forum. You should go to [this forum](http://www.daniweb.com/software-development/java/9) instead. To answer your question, it said that you to create 2 String variables. Assign the value "COMPUTER PROGRAMMING" to the first one, and then iterate through a loop using the first variable length in reverse order. Inside the … | |
Re: The nested loop is used as others said (to traveral through a 2D array). Outside of the loop should be a variable holding the total number you are going to change inside the array (and should be greater than 0). Also (one way to exit a nested loop), have a … | |
Re: I would say check if the value is a number using isNaN(something) -- is Not a Number. If it is a number, it would return false; otherwise (including null), it will return true. | |
Re: If you want it to be done locally (client), Cookies is the way to go. Though, I don't prefer to use it because it is manipulatable by the client unless I don't care for securities. Preferably, server side work is appropriate for most cases. | |
Re: How about update your `System.out.println(title);` to `System.out.print(title+" ");` instead? Also, just insert `System.out.println();` wherever you want to have a new line. | |
Re: There are couple mistakes in your code... 1) When you said first 2 rows, in array data type, it means 0 & 1 indices because array uses 0 index (value from 0 up to array_length-1). In your code, line 17 for example, is going through 0, 1, and 2 which … | |
Re: You are on the right track. You attempt to check for digit number using indexOf() method which is wrong. In your loop, get rid of indexOf() method but use charAt(i) instead. The returned value of the charAt() method is a char which could directly be compared (using == symbol) with … | |
Re: >But what if I've included the same "file.js" in many html files? >Will it do the same stuff independently to each of the html files? > >And one more question : >How right is it put all the javascript code in the <script> tags of the html file? >Is it … | |
Re: The requirement needs to be clarified first. What is the expiry date if the end date is July 31? Would it be September 30? Or would it be October 1? | |
Re: If you want to keep asking for playing again, you need another loop around it. Either let users get out of the loop by saying 'n' or not equal to 'y' is your choice. You already know how to use while-loop in your case. You could simply add another while-loop … | |
Re: Do you know the value of the current rotation angle of the image when space is being pressed? If you could obtain such value, you can simply compute the point by doing the [point rotation](http://en.wikipedia.org/wiki/Rotation_%28mathematics%29) using the center of the image as the origin point. | |
Re: I see no problem with adding unlimited button to a panel and let it extend down the display while you can still scroll down. However, too many buttons may cause you problem, so you may need to redesign the layout of what you are doing. So could you please show … | |
Re: Wouldn't this part ry=Math.floor(Math.random()*myimages.length) if (ry==0) { ry=1 } is equivalent to... ry=Math.ceil(Math.random()*myimages.length) *Edit:* Wait... My bad... The former gives higher propability (twice as high as others) to the first image (1) and not select the last image (6), but the latter gives equal propability to each image including the … | |
Re: Are you attempting to create your own customized binary file? This is the freedom of binary file format because it could be different from one to others. Usually, a binary file contains header information, and it could be anything depending on what format it is and who creates it. Is … | |
Re: What do you mean? Where do you apply javascript to this table? | |
Re: What do you mean by knowing if it is done? Didn't you also send your packet with the length of the packet itself (using DatagramSocket)? If not, could you post the code portion of server & client? | |
Re: You could try to catch all Exception, but in your case you should try NumberFormatException because it is direct to the exception thrown when a string is not a number is being parsed. PS: If a user enters "+123" as an input, do you consider it as a number or … | |
Re: Line 12, shouldn't it be... stage = new Stage(canvas); | |
Re: >is there any way to allow third party on safari even if privacy setting set to block third party If a user sets to not allow third party cookies on the browser, why should there be a way to work around that? The only way I can think of is … | |
Re: Not going to look at your code. Will answer from the header... To do that, you just need to check whether or not the new element (text field) has been added to the page. If it already exists, don't add a new one. A simple way to check is to … | |
Re: Line 34, you are returning *roll* variable but you didn't have anything to do with the variable inside the method. The method is supposed to build up a String and return it? | |
Re: You will have a hard time finding all of them. You have both missing and extra curly bracket. The first one is inside your scene2() method. if(choice2.equalsIgnoreCase("FIGHT")) { //User fights if(sword == true || axe == true) { //If the user has a weapon System.out.println("It seems that you have a … | |
Re: \#1 You are correct if and only if the question is not about writing a program. In other words, true && true is the same as (true || false OR false || true) in programming. The question ask which expression is true and that is ambiguous to me. \#2 Two … | |
Re: If you are using an array already, you could do a sort and get the index in the middle for splitting as well. The algorithm has bigger Big O and a bit more complex but requires less space use in the process. | |
Re: Did you implement ActionListener? Is the code inside actionPerformed() method? | |
Re: 1)I don't know what Stock Span algorithm is. Don't dump the psudo code and ask me to understand it. 2)This is your assignment to implement an algorithm to do it. There is no afford from your side shown here. Please work on it first, not just dump the original question … | |
Re: If the data shown in your post is what it read in, the region checker should return true because it is valid (there is no duplicated number in the 3x3 sub array in the example)... | |
Re: Just remember, programming & managing are two different skill sets. One is to be able to follow requirements and do it right, and the other is to control and make it work. Some may have only one of the skill sets, and some may be capable of acquiring both skills. … | |
Re: There are a couple problems in your code. 1) Line 19, you do NOT need a for loop to check the existence of a substring inside a string. The only occasion you need a loop is when you check each character of a string one by one. 2) Line 21, … | |
Re: How did you enter when the question shows up? Do you understand what nextInt() mean? When you use nextInt(), the input is expected to be an integer (i.e. 234, 123), not a decimal number (i.e. 25.45, 100.0). If your input is not followed the integer format, you will get an … | |
Re: Develop something in AI field? It is really heavy in algorithm, maths, and statistics. The future of this field is quite well. | |
Re: >Having some trouble And what is your trouble with it??? By the way, you should keep everything inside one *try* and have multiple *catch* instead. Something similar to below (adjusted from your original code). import java.util.*; // import scanner import java.io.*; public class Homeworkhelp3 { public static void main(String[] arg){ … | |
Re: If you want to create your own autocomplete from scratch using javascript (and using backend), look for *observefield* and *Ajax* to do the work. The ajax part will return proper (sorted) data to create a selection list. I did the same thing at work. | |
Re: >I want to have option multiple select to remove the data from list box Please clarify this sentence. Do you mean you want the select box to become multiple selection, and then remove all of those selected options? Or else??? | |
Re: Try `window.referrer`. That may be what you are looking for. | |
Re: >symbol : class ArrayList >location: class DynamicArrayOfInts >ArrayList list3 = new ArrayList(); Right there. You need to import ArrayList to your program. At the top of the program where you have `import java....;` lines in your DynamicArrayOfInts class, add one more line as `import java.util.ArrayList;` to the import... | |
Re: >cents = (int) (((change - dollars)\*100) + 0.5); How about change this line to... cents = (int) ((change*100.0) - (dollars*100)); and see what happen? | |
Re: 2 months old thread and there are already 2 accepted answers... | |
Re: >means lowest substring should be at the top most point. So how to do that ? string can be of large length. How to do this thing ? can you please give hint or link ? So you want to know how to sort String in the way to use … |
The End.