104 Posted Topics
Re: You could do something like this. pseudocode... num = random double from 0 to 1 if (num < 0.7) num = random int from 0 to 75/2 else num = random int from 75/2-75 70% of the time it will generate a uniformly distributed random number from 0 to 75/2, … | |
Hi! I am using a vpn connection to connect to my work network, which I use for remote desktop, which is working fine. I now want to be able to access the same stuff at home that I can access at work. I can for instance write "wiki" in the … | |
Hi! A small SVN problem? I have an online svn server that I have had for some time that I used for a software project. I want to close that account so I don't have to pay the monthly fee. But before I do that I want to download the … | |
Hi! I want to make a python program that runs different simple command line scripts. Right now I use os.system which works fine for running the scripts, but the problem is that the scripts sometimes halt and wait for input from the user. So my question is, how do i … | |
Re: OpengGL gives you the means to create any visual effect that you want. HL2 use OpenGL as well as DirectX since it is avaliable for Mac. How your graphics look depends on mainly three things. Geometry, textures, and lighting. But the really main thing is lighting. I would recommend not … | |
Hello all! I'm having problems with running c++ on iOS. I have a iOS openGL project in Xcode 4 and an external library written in c++ that has to be a dependency to the iOS target so it can run on an Ipad. right now I'm testing with the iPad … | |
Re: Try to find out on exactly which line the segfault occurs. Then check if the variables on that line have been initialized properly before the function is called. | |
Re: You could just store the url of the image in the DB, which would just be a string and would not create so much overhead. I don't have much info on if its good or bad to store images or other large files in DBs, probably has its ups and … | |
Re: You don't really need to push the elements onto another stack. I'm assuming that you use a linked list to implement the stack. In that case you can just loop through the stack until you find the element you want to remove, delete it, and then point the previous element … | |
Re: That is the taylor series for sin(x) i.e. sin(x) is approximately x- (x3/3!)+ (x5/5!)- (x7/7!)+....... What do you want to solve? | |
Re: You should probably not use built in types like doubles, ints and longs for these kind of calculations that require high precision and big numbers. Use GMP or something similar. [url]http://gmplib.org/[/url] | |
Re: googling "facebook api" gives you the answer. [url]http://developers.facebook.com/docs/api[/url] | |
Re: Segfaults are memory access violations. Try to find on exactly which row the segfault occurs by printing stuff before and after a row that you suspect may be causing the segfault, that would narrow the search down quite a bit. | |
| |
Re: This can be solved analytically, why pseudocode? The pseudocode in this case is almost like the mathematical expressions needed to solve it. s2*t = s1*t + s1*h <=> t(s2-s1) = s1*h <=> t = s1*h/(s2-s1) which is the pseudocode and the real code for that matter. | |
Re: Why are you using getch() there? So the console doesn't close? Your compiler must support it. Use std::cin.get() instead. Would be good if you gave and example of how the file is formatted exactly so it will be easier to help. What is wrong with length()? length() is an alias … | |
Re: table is a pointer to a ListNode so you can't write table[hash(val)], you need to dereference the pointer first like this, (*table)[hash(val)]. I think that might be the issue. | |
Re: What kind of data do you have in the array now? RGB values maybe? What language do you use? | |
Re: Yes netbeans can be a pain in situations like this. Save yourself some headache and create a new project. | |
Re: Do you want to move the mouse programatically to fix the sound issue? It sound more like a hardware problem to me. Does the same thing happen with a regular mouse connected? Mouse events in C++ are a lot more complicated that in java. I'm no expert on that but … | |
Re: An avl tree is a self balancing tree which means that there is a mathematical relationship between the number of elements in the tree and the height. Since a lookup in a AVL tree takes O(log(n)) time, the height should also be O(log(n)) i.e. ceiling(log2(n)). Read about avl trees here... … | |
Re: Its because of the numerical errors you get when you repeatedly divide i by 10. You should multiply i by 10 and use 1/i instead. You will still get numerical errors and there will be 16 decimals because you are working with doubles and it will prob. not end with … | |
Re: Ok! When do you want it delivered? But first. Define even array. | |
Re: Could you give some more details? What code are you calling and how are you selecting? | |
Re: Could you be more specific about what you need help with? What isn't working, and so on. | |
Re: Since you either should use a 2D array or 3 "parallel" arrays that must mean that you use 3 1D arrays to store each column of seats. One array would then contain [ [C.Lindbergh 1A], [H.Quimby 2A], ..., [] ] etc. I would go with a 2D array since that … | |
Re: I assume you are talking about classical AI. I took a classical AI course a long time ago which was mostly about logical and statistical reasoning. We had a project in that course where we in groups of four made a minesweeper playing bot, which is a good example of … | |
Re: I think your question is a little poorly stated. You should give some more background on what you are doing. Like how are you connection to the DB, what DB are you using etc. but heres a link which should be helpful. [url]http://en.wikipedia.org/wiki/Java_Database_Connectivity[/url] | |
Re: I wrote something that works fairly. Linear time Does not handle if the last character is a dupe. That is left for you to fix. [code] public static void main(String [] args) { System.out.println( dupe("assdeegfddaa") ); } public static String dupe(String str) { return dupeHelper( str, "", "" ); } … | |
Re: Are you trying to return all three values in that method? If that is the case, it is not possible. And why are you setting the values to 1 that your are returning? Please explain a little more what you are doing or give some more code. If you want … | |
Re: I think imshow displays grayscale images. You have to call imshow(RGB) first or something like that. Read up on imshow here... [url]http://www.mathworks.com/help/toolbox/images/ref/imshow.html[/url] And I believe that method you are using to pixelate the image just resizes the image down to some scale and then up again. Read about resize here... … | |
Hi, Im kind of new to prolog and would like som help. I want to write a rule that only takes integers as input like the following example. rule( X, [] ). rule( X "is integer", [Heat|Tail] ) :- rule(X, Tail). rule( X "is anything else", [Heat|Tail] ) :- rule(X, … | |
Re: You can override the paint method of your canvas, which you have already done and then call g.drawLine(x1,y1,x2,y2). where x1 y1 etc. are the points which the line is drawn between. Look at the Graphics and Graphics2D api for more info. [url]http://java.sun.com/javase/6/docs/api/java/awt/Graphics.html[/url] | |
Re: Well i don't think it looks so bad, but if you would like the buttons to be closer to each other, i.e. no gap between them you could try to set the vgap and hgap for the your layout. I suppose you are using gridlayout for the calendar, just class … | |
Re: Since the try statement might fail your variables will not be initialized, just as the compiler states. either you can place the code that uses firstArg and secondArg in the try statement or you can initialize the variables to something. You could also set firstArg and secondArg to some default … | |
Re: just iterate through the list and print the value when you have reached the index that is to be printed. i = 0 n = 0 for each value in list if i == index[n] print list[i] n = n+1 end i = i+1 end this should work since the … | |
Re: hmm I dont se why this shouldn't work, try changing the "=" to "is" in the query and see if it helps. | |
Re: You need to be more specific about your problem. | |
Re: What I know there is no super easy way to write your hashtable to a database, since you want to store a java object. The most common tool/framework to do stuff like this is hibernate which lets you define java objects to database mapping and then you can simply retrieve … | |
Re: Parsing the text with space and dot delimiters isn't enought, java is more complex than that. You should maybe check out recursive descent. There might be easier ways to do it but I would define the java grammar and write a recursive descent parser for it. Check out the link … | |
Hi! I'm having some problems with gridbaglayout trying to get functionality that maybe isn't even there. The problem is the following I have 3 Jpanels with differend contents. I want panel 1 to be displayed to the left of the screen filling the y-axis, panel 2 in the middle filling … | |
Re: I don't see the problem, the code works fine for me. | |
Re: I aswell as a professional pro can verify that the answer you are looking for is made very avaliable in the first post that was posted by "BestJewSinceJC". And I did not find his or anyones comments patronizing in any way. You would normaly hear infinitely more patronizing stuff coming … | |
Re: use code tags so your code is more readable [*code*][*/code*] without the stars And could you tell a little more about the problem, i'm not sure if I get what youre trying to do. | |
Hi, I have really weird layout problem. I have a class VerticalGridPanel, which uses GridBagLayout to place components top to bottom, left to right, nothing special. Then I have a List of components, which i want to add a part of to a VerticalGridPanel. I then want to add another … | |
Hi, Im writing a java app that uses hibernate for DB stuff. The thing is that it takes some time to start hibernate, and I would like to have a progress bar to show the loading procedure, and maybe print what hibernate is outputting [code] public class HibernateUtil { private … | |
Re: GMP has a c++ wrapper, you could use that if you really want to code in c++ style. | |
Hi! I'm writing a java app with a swing gui. The problem is the following. I am developing on a mac, where it runs fine. but when I run it on Windows Posready09 (Windows XP), which is the platform the app is intended for, or Windows7, half of the window … | |
Re: there are a few things that are pretty wrong here. From line 270-298 you write TempStudent::something. TempStudent is an array so you should use [] to access some element. I seems like you would want to write TempStudent[N]::something And Im not sure if :: will work either. You have setters … |
The End.