Laura Williamson

Ranch Hand
+ Follow
since Apr 28, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Laura Williamson

Hi - I have a simple applet that reads in from a text file and displays the values to the screen. Has anyone done this, but reading in from Excel file instead? Thanks
12 years ago
hurrah - thanks guys this site was invaluable. took me forever as was busy at work but got there in the end...onto SCEA...L
13 years ago
Hi - need a bit of advice. I have a program that moves files from one directory to another (and then does some stuff...). The program has multiple threads running e.g.

//in main
XmlCompare xc = new XmlCompare();
Thread t1 = new Thread(xc);

XmlCompare xc2 = new XmlCompare();
Thread t2 = new Thread(xc2);

The problem is that while one thread is moving a file from dir1 to dir2, no other thread should be able to move a file. But I don't think I can sychronize because I have multiple objects? Or can I? I thought about using some kind of lock, so the first thread sets lockCookie to "locked" and while lockCookie.equals("locked") the second thread cannot move the file. But if I have two XmlCompare objects, and lockCookie is a variable within the XmlCompare class, then each object will have its own instance of lockCookie. So was thinking could write a cookie to a file, delete when done - i.e. external to the actual program, but seems kind of clumsy. Any suggestions on best way to do this?

Also - two more questions - why are threads spawned one per object? i.e. why not have:

XmlCompare xc = new XmlCompare();
Thread t1 = new Thread(xc);
Thread t2 = new Thread(xc);

Also, I am setting the name using Thread.setName in main, but in run the name always comes out as -1, or -3 or whatever. Why is this?

All advice appreciated.


Is there anything specific i need to revise for the exam - or just go back over assignment notes, etc...

Doing B&S (...still...) just wondering can I tweak DBAccess interface to implement RMI?


hmm thanks for your replies. i am still a bit confused. i am doing boggit and scraper..i have coded my GUI and database access code, works fine as standalone. then i have coded a simple RMI program separately. Unsure how to integrate them...should there not just be one GUI? Does the RMI code not just call networked data code?

all advice appreciated


Ok so I am good with passing in an arg at the command line - but does the program itself need to start the rmiregistry and server, or would the user do that manually?
rmiregistry &
java HelloServer &

I assume that the user at the server end would start these manually, so we are not expected to code them?

Unsure on the following:

"The operating mode is selected using the single command line argument that is permitted."

How does this work? java GUI is the command that kicks off my program - can this take an additional argument?
Thanks for yr help.
I should add that all is well when I compile with:

javac -d . suncertify\db\*java

But when I try to run a class within the package (e.g.
I get 'Exception in thread "main" java.lang.NoClassDefFoundError: MyTest

I have been working on something else for a while and have foolishly forgotten how to set up classpath/package structure properly as am getting class not found errors. I am on Windows NT.

I have altered autoexec.bat to include: set CLASSPATH = C:suncertify\db
The files I am trying to execute are located at: C:\suncertify\db
The package statement at the top of each file reads package suncertify.db;

Do I have to add another PATH or CLASSPATH statement to autoexec?
along the lines of: set PATH =j2sdk1.4_01\bin;

Thanks - sorry for the thick question but have been doing non-Java stuff for 5 months and forgotten this rudimentary thing.
re Record v String []
-- ok, i got it.

re: time

I think I am pretty much an average programmer - in terms of the programmers who would be sitting this cert. I have an MSc Comp Sci and about 1 year commercial experience (but not in Java). Working with other programmers, I would normally be about maybe 3rd or 4th in a team of 10 - (based on speed, ease of solving problems, code actually working and passing testing, etc, etc) I'm not brilliant, but I can work it out (usually). I got 73% in the SJPC - again, about average. I think the assignment would take me between 100-200 hours. Maybe closer to 200 by the time I test and document it all. But I am not working on it solidly, as I work full-time. I just happen to be on 'training' this week...
no probs, i got it now, thanks very much.

i read somewhere (on Sun site?) that a decent programmer would finish this assignment in 20 hours!! which makes me think that I must be really crap. o well, perseverance conquers all, i mean, most things...

one more question
any preference on storing record as a string [] of data
as opposed to
creating a Record object (i.e. having a record class, with the data as the fields?)
just wondering..........i've gone for string [] data, but maybe a Record would be more OO
1) OK I assume where you put "ANY" you mean "NULL" ??

Case 0:

Criteria[0] = "Pete"
Criteria[1] = "ANY"
Criteria[2] = "ANY"

2) Match on fields makes sense to me. criteria [n] must match field [n] not just any field.
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)

-- this is (perhaps intentionally) unclear.
-- do I have to match on posn. within the array or just on the search term?
e.g. if Fred is in the criteria array, at the posn. for owner, should i also return Fred's Frog Legs if that is the company name? or only searching for matches at posn[n]. Does that make sense? Is the match on any value in any field? or any value in a specific field?

--null in any of the criteria elements will return all records, no?