2,040 Posted Topics
Re: Nice snippet. One note for practicality, doing white-list sanitization is better than black-list when it comes down to security. In other words, reject any thing if found any value that is not in expected values rather than attempt to remove unwanted values which may or may not be foreseen. It … | |
Re: Many people think that setTimeout() is a sleep for the caller. No, it is not. To me, it likely works as a fork (threading) but not quite. Looking at the script in the post above, the function will fire each process for each i value. Then each process will wait … | |
Re: @degasdad Isn't line 14 reading the value of shirt volume? Also, line 18-20 are the computation including the volume of the price already? By the way, in the computation of line 18-23, I believe that you do not need 'parseFloat()' because the variables are already declared as 'float' inside the … | |
Re: If the only resource that are using to run the app is CPU %, not mem %, you may need to check "paging" activity as well. See if the paging occurs and how high it is. Because you said there seems to be no memory leak but the app increasingly … | |
Re: 1.function gID(name) { 2. name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 3. var regexS = "[\\?&]"+name+"=([^&#]*)"; 4. var regex = new RegExp( regexS ); 5. var results = regex.exec( window.location.search ); 6. if( results == null ) 7. return ""; 8. else 9. return results[1]; } Line 1, declare function prototype (name & arguments) … | |
Re: Look at NathanOliver algorithm and I have two questions... Is string "*+0.5*" a float? Or Is string "*+.7*" a float? That may clear up a bit for the algorithm... | |
Re: Ok, given assumptions as... 1) A user enters a correct identifier number. 2) The same user enters correct column numbers needed to find the minimum value in the data. 3) The csv file contains correct data format & number of identifier. Lines 13~17, you are asking a user to enter … | |
Re: The advantage of closure is to capture variable scope. Below is a use of closure in order to pass keyboard event which is the only way to pass in or the argument value is wrong. This is the prototype style I do by the way. // The acceptKeyBoard() function is … ![]() | |
Re: Sort them? I mean, read them into your class objects and sort them? | |
Re: You have no idea what NormR1 said, haven't you? If you literally copy what NormR1 said, you will get an error. What you need to apply is the number range to all of your for-loop condition (lines 58, 64, 60, 75, etc)... For example... for(iMonth=0; iMonth<lbl1.length; iMonth++) { ... } | |
Re: If it is only to receive an input from a user via a system (which does both input and output), then yes it would have 2 arrows going going to and from the same system. It is just a flow of data, so a loop-liked is still fine as long … | |
Re: It will depends on how you define *controller*... To me, a controller is a layer between model and view. Model deals purely with database calls (read & write). View deals with data that does not call for database but display what the data is (its data structure may be completely … | |
Re: You need a JOIN for sure. The only different is how to use your JOIN. This is from the top of my head... You may try... SELECT user.USERNAME, user.FIRSTNAME, user.LASTNAME, user.LOCKED, user.EMAILADDRESS, role.ROLENAME FROM user INNER JOIN userrole ON user.id=userrole.user_id INNER JOIN role ON role.id=userrole.role_id | |
Re: There are a few reasons why it does not go to 0. 1. You are displaying 361 months instead of 360. You have already computed the interest, capital, and remaining balance before you go into the loop. That's the first month but you did not display it. 2. The payment … | |
Re: Use alert(string) box to pop up messages at any time you want inside javascript. It is one of the easiest way to debug. Though, do not attempt to use the alert() inside a loop without a condition for it, or you would keep getting the pop up that easily annoys … | |
Re: The program is not useful at all. There are only 4 of 3-digit numbers that are Armstrong numbers -- 153, 370, 371, and 407. Besides, if a user does not pass an argument or passing in an argument which is not an integer, the program breaks. | |
Re: Deep copy means you need to recreate a new object for each item in the list before you add to the new list. In other words, create a new empty ArrayList, copy the object from the old list, and add the new copy object to the new list. In your … | |
Re: NormR1, I am not sure that the port number 8880 is a typo? Shouldn't it be 8080 which is a very common port number? | |
Re: How it does not work? One thing I can tell you right now is that your variables *stob*, *rob*, and *swop* should be declared with **var** outside any function. PS: I tested the script and it ran. Not sure what the result you are looking for though. By the way, … | |
Re: On another forum [here](http://stackoverflow.com/questions/5757233/find-s-algorithm-simple-question), the person who asked gives a good example (which is very simple) and the person who answered gives a very clear explanation. You should be able to apply to your problem from looking at what he did. If not, I would like to see all the … | |
Re: Assuming that the *field* argument is a HTML object. Try $(field).css instead? If it is still not working, you may need to pass in the field name instead of the object but still need the $() thing. | |
Re: JorgeM has already given you the correct answer. You seems to miss certain things here. Where do you place `function showQuantity1(...)`? It looks like you did not place it inside a tag `<script type="text/javascript">...</script>` or you did not include the correct Javascript file to the HTML file. If you have … | |
Re: Why are you making it so complicated? Also, what you really only need is **translate** and some **rotate** point using the angle from a center point in order to get the location of the draw string. Why do you use AffineTransform? Here is a method I implemented that returns an … | |
Re: I think you may need to look into packet sniffing... Though, there would be even more interesting detail you may like to read. | |
Re: What are you using to do the fading? What you may need to do is to create a script in object oriented fashion. Then create an object of the script to handle each spot where you displays images. | |
Re: >The printBackward method should be written **recursive** in a singly list backward. That's the keyword, **recursive**. :) Your implementation is not recursive but rather iterative. Do you know what recursive is? | |
Re: Also, using javascript to do all the work (generate a random value and use it as the final result) is very bad. Why? I could override your function or just manipulate certain values and I will always win prizes. ;) | |
Re: Using James's explanation, you should be able to see why the second statement is invalid. //Second statement: int[][] it2 = new int[]{0}[0][0]; //Invalid Statement //This means the initial value of 'new int[]' is {0} //The [0] is to access the first element of {0} which is 0 //The 0 is … | |
Re: You could use document.getElementById() as fpsasm said; however, I would not use *eval* function. It is not a really good way to learn a language with eval; besides, it is more of hard-coding, not easy to maintain, and no error checking. From your HTML, you may do your JS as … | |
Re: You didn't give much information at all... The function you gave is simply switching a supposedly an image from one source to another. If you want to generate a new div, where are you going to attach/append the newly element to? You can generate but you need to tie it … | |
Re: Your current design doesn't allow what you want to do (add multiple itenerary) because the JQuery script is being tied (hard-coded) to a specific HTML element (select tag with ID "it"). I am not an expert in JQuery because I don't use it. I can understand the code from reading … | |
Re: Hmm... To keep running a script behind (using observefield of ajax) is OK but I would rather run a script when an event is fired. What I would do instead is to add onchange() or onfocus() event to all of the input fields and whatever in each function may be … | |
Re: >window.onerror=processErrors(); I don't think it is correct because the function takes 3 arguments but the assignment takes none. It could be `window.onerror = function(...) { ... }` but the homework said to create a function called processErrors. To explain what you need to do, I will break everything down into … | |
Re: 1)Did you forget to initilise *tmp*? Where does it start from? 2)You need to check whether or not your linked list is empty. If it is empty, what would you do? 3)If it is not empty, is the given index within the range? If it is out of range, what … | |
Re: So you are asking for an algorithm to detect it? Hmm... On the top of my head, the way I would do is to find whether there is an intersection between those 4 line segments of the rectangle and the ellipse. If there is an intersection (or even touch), it … | |
Re: An example/tutorial of generic programming is [here](http://www.tutorialspoint.com/java/java_generics.htm). From there, you should be able to implement a non-generic programming. | |
Re: Well, lines 21~24 will increment the tab number for you before it changes the value. Why do you need to increment the id value (id2)? | |
Re: Port 443 is normally used for SSL connection. Are you attempting to connect using SSL? | |
Re: > id="mac-wow-full-EU-es_ES-320" Looking at the id above, you would get ["mac", "wow", "full", "EU", "es_ES", "320"] as a result from splitting the ID string. Now go back to your code... var rel = target.split('-'), region = rel[3], game = rel[1], client = rel[2], lang = rel[4], ver = rel[1], //not … | |
![]() | Re: To generate a random fully filled sudoku table is easy, but the challenge is to eliminate certain numbers until it becomes a puzzle. In other words, you need to have an algorithm to solve a sudoku puzzle before you can randomly generate a new one. If you have no good … |
Re: 1)What ArrayList data type are you creating in order to keep BankAccount data? Currently, you are using String which is incorrect. You need another class that can hold BankAccount data. 2)You have a loop up to *n* tims to collect bank account data. Once you have all information (name, number, … | |
Re: What you did only to prevent if there is an error message. If there is no error message (length==0), what would you do next? Redirect or display something else? In other words, what are statements for *else* condition? | |
Re: From glancing, why does Infix has size of 1 but you attempt to use a for loop on it? That doesn't make sense... | |
Re: Not sure what you mean... How about this... var monthName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; Would that be simplier? | |
Re: Just for a quick look, you have mismatch call for function. The DNFUNCTION is returning 8 values at once, but you attempt to put them all in 2 variables when you call. > function [x1,y1,x2,y2,x3,y3,x4,y4]=DNFUNCTION(a,b,d,t); > ... > [x1, y1]=DNFUNCTION(a,b,d,t); Try to add variables to accept all return values. PS: … | |
Re: I don't know C# but I looked it up on the Internet to see how split() works. Anyway, I think you should use Regex class instead to do the split. The reason is that it might not read in the way you want. Though, I am not sure whether all … | |
Re: If you are storing number up to the total you need (i.e. need to store 42 numbers which is from 1 to 42), how about creating an array of size 42 and stores number 1 to 42 in order. Then, randomly swap 2 number each time up to *m* times. … | |
Re: You can look at this [link](http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html) or this [link](http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/otherFeatures/nimbus_laf.html) for how to enable Nimbus look and feel... | |
Re: NormR1, I don't think the data type is necessary because it will be an empty file. However, I believe that it would be a simple ASCII storage. The file name should be *data.dat* and the way to create an empty file is depended on what OS you have. On Linux, … | |
Re: Also, when you say distribute data, how do you handle duplicated item in these lists? Do you want to clone the list items? For example, an array of {1,2,3} is the smaller list and {1,4,7,8,9} is the larger one. What would be the result? |
The End.