Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

James Kerruish

Greenhorn
+ Follow
since Aug 22, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by James Kerruish

I need to compute the factorial of a set of large numbers. What is the best way to do this? Bearing in mind I need it done as quickly as possible. Should I use the gamma function and if so how do I accomplish this in Java.
Thanks
James
[ October 28, 2002: Message edited by: James Kerruish ]
17 years ago
This is perhaps a very general question but only considering performance how does Java 1.4.1 compare to C++? I've heard mixed reports and generally that Java is still behind but how far behind? I had a quick look on the internet but couldn't come up with any good articles.
Thanks
James
17 years ago
Yeah my manifest file is set up fine. I know this because the program runs when I type in the command prompt. I've also just tried the jar file on another machine and it works fine.
The problem seems to be somethings wrong with windows not associating the jar file with the specific program that is required to run it and therefore won't work when I double click on it.
Thanks for your help.
James
18 years ago
I've managed to construct a jar file and things work fine from the command prompt when I type:
java -jar GraphNet.jar
I want to be able to run the jar file when I double click on it from within Windows NT. When I do so a box pops up requesting a program to open the jar file with. I select javaw.exe and the Java Virtual Machine comes up with an error saying:
Could not find the main class. Program will exit!
What am I doing wrong?
Thanks
James
18 years ago
There are two problems with just painting around the cursor. Firstly, in my application, the display of the mouse is a crosshair that goes right across the JPanel with the intersect at the current position of the mouse so redrawing just a rectangle would be similar to a complete repaint.
Secondly because I paint the crosshair over the data I would have to repaint the data underneath because this is constantly changing I would find it difficult to know what this was. This is why I've been looking at XORMode or layering.
I've tried XORing and it works but as the crosshair goes over some of the displayed data is goes strange colours, which I don't like. The question I want to know is: is it worth trying layering? I would implement it so the data is on the underlying layer and the crosshair is on a higher layer so when I repaint the crosshair there is no problem having to repaint the underlying data. Would this run smoothly or is there a better mehtod?
Thanks
18 years ago
I have a Jpanel linked to a data class, which is constantly being updated so the JPanel gets redrawn about every couple of seconds. The problem is that I need a mouse crosshair on the display, which needs to follow the mouse around at all times. Repainting the whole Jpanel, every time the mouse moves is a waste so I'm looking for a solution.
One method I've been looking at is using the XORMode in the graphics object. I've read this can have problems when painting over different colours but seems to run smoothly.
Another method I've thought about is layering. The mouse could be put on a different layer so can be freely repainted on top of the JPanel. I'm not sure if this is possible or how effective the result will be.
So which is the best method and what are the problems with each? There might even be a better approach that I haven't thought of.
Thanks,
James Kerruish
18 years ago
Firstly thanks for your help although I seem no closer to an answer. I've tried the two suggestions you gave but no luck. I've put the page on a website although the page is all a bit rough at the moment and the code isn't very easy to follow. The key area you need to look at in the code is the function Display() this is the function that is activated when the user presses the display button after filling in the form and it writes the data to a new window.
Note that I having problems with netscape and I'm using version 4.7(I think), it works ok with version 6 and explorer(to my knowledge).
ok well the link is http://www.kerruish.co.uk/PopUp/entryform3.htm
like I say it's not that easy to follow so please ask any questions if you don't follow anything.
Thanks
What happens is that a user enter some details about themselves in a form and when they press a button this opens a new window called DispWin which displays all the data the user has entered. This works fine but when I try to print the contents of the new window (by pressing print on the toolbar of the DispWin) it prints the orignal window with the form in it and not the contents of DispWin like I say this only seems to happen under Netscape.
Thanks
I'm having problems printing the contents of a new window that I create under Netscape. When using IE everything seems to work fine. Under netscape when I try to print the contents of the new window it prints the contents of the original window that created the new window.
So from the main window I code:
DispWin = window.open('','NewWin','directories,location,toolbar,status,menubar,resizable,scrollbars =yes,width=600,height=600');
to open the new window and then I add text to it for example:
DispWin.document.write("<table cellpadding='5'> <tr> <td>");
etc
Then I need to be able to print this DispWin but like I say Netscape prints the original window instead of DispWin when print is pressed on the toolbar of the DispWin window.
Thanks
Thanks for you reply prakash I understand why the problem is occuring but I don't understand your solution. How would I get the row for each update? Surely this is related to i each time. I've included the relevant code to help

Sorry if that's not very clear code I just cut and pasted it.
Firstly I'm new to JavaScript so hopefully this won't be a stupid question.
I have a function called drawTable. This accesses an array and uses the data in the array to draw a table using a for loop. I did this because there could be 100's of lines in the table. The last element of each row in the table draws a button and uses the onClick method to call another function as follows
onClick = update(Array[i])
The problem is that whichever button is pressed it always accesses the last element in the array. I think this is because the onClick method doesn't get accessed till the button is pressed and at that point i is set to the length of the array -1.
Hope that makes sense
I'm not sure what application created the file but it should be 110 lines of 30 floats and integers. I know that each float and int is 4 bytes long. I'm unsure of what convention is used for the floating points. I was worried about the need for byte swapping and if the dataInputStream could be used if byte swapping is needed.
Thanks
19 years ago
I hava an array of 4 bytes and I want to change it into an integer or a float how do I do this?
Thanks
James
19 years ago
I need to read a binary file of int and floats, created on a unix system under windows to my program. I would be grateful if anybody could give me some guidlines,
Thanks
James
19 years ago
I'm using a linked list and I want to synchronize it. There doesn't appear to be a method synchronizedLinkedList() only synchronizedList(). Sun recommend doing something like:
List theList = Collections.synchronizedList(new LinkedList());
this would be fine but I use methods like theList.getFirst() and these are not avaiable in the basic List object. So basically I'm looking for a way of creating a synchronized LinkedList I was also wondering why this isn't available in the Collections class.
Thanks