Shlomo Hillel

Greenhorn
+ Follow
since May 20, 2006
Merit badge: grant badges
For More
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 Shlomo Hillel

Hi

I'm confused about the 48-hour rule for room booking.
I assume that room occupency starts at 3PM on the day the room
is available. If the time of the attempted booking is t, I find the difference between 3PM and t. If it falls withing 48 hours, I book.

Now, some rooms don't get booked by 3PM and I think they should be still available on the market. How long should I keep'em available? till midnight?
till the next 3PM of the next day?
Should we assume booking is done via CSR; thus the cuttoff is end of the work day of CSRs?

Can anyone help me?

Regards

S
sorry, that is reading unsigned integer.
I cannot use shifts and store it in a long since shift works on int.

Can I just say i treat it as a signed number and reject record lengths above
(2**31 -1)?
S
how can I read unsigned long in java?
the db has:
4 byte numeric, total overall length in bytes of each record

I read it like this:
RecordLength = (database.readUnsignedShort() << 16) |
(database.readUnsignedShort());

But that is obviously wrong!
How can I do it?

Even if I can do it, how can one reserve a byte array [size], where size
is unsigned long? size must always be int!

S
Why do you have a drop down?

Cannot you just have all the fields on the screen and the user fills in the fields which are relevant to his/her query?

By the way, how do you deal with the max occupency thing? The search interface uses string matching, but does not support query such as "give me all rooms in Dallas having 3 or more max occupency.

Moreover, does your server filter the returned result based on the 48-hour restriction? I think the server should return all matched rooms and only when an update has the customer field not null should check for 48 hours.
What do you all think?

S
Thanks Andrew for your reply.
I care less for learning how to make a dialog box with controls.
As long as I get the result I want why should I care??
Java is inefficient as it is! Who cares about few bytes here and a couple of cycles there? BTW, I noticed the constraint thing and it was on my agenda for disguising the code.

I still would like to know if anyone think that my submission WILL/MIGHT be rejected because it might've been generated?


S
I'm thinking of using an IDE for the gui construction.
I use a null layout and put the components where I want them. Then I
switch to a gridbag layout and get the source code generated.
JBuilder produces code that is clearly generated from an IDE.
However, Sun studio 8 produces code, with few refactoring, can be mistaken for a programmer written rather than computer generated.
For example, see below.

Can I use this approach? It makes life much easier than designing by hand.

Please let me know.

S

Generated code:


java.awt.GridBagConstraints gridBagConstraints;

jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();

getContentPane().setLayout(new java.awt.GridBagLayout());

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Name:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.ipadx = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(40, 50, 0, 0);
getContentPane().add(jLabel1, gridBagConstraints);

gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.ipadx = 104;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(40, 26, 0, 81);
getContentPane().add(jTextField1, gridBagConstraints);

jButton1.setText("Push");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.ipadx = 18;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(70, 36, 69, 0);
getContentPane().add(jButton1, gridBagConstraints);

pack();
Jeroen, Unreferenced should do the trick for bad locking. Just think about it!
However, what can one do when a client wants to lock a record and many clients accessing the database and/or map. This may be long time.
Should I be worried about this? Meaning, should I be worried about the time it takes the server to respond (negatively or positively) to client request.
I haven't started gui yet, but I imaging the user selects a record and hits "rent room". The client tries to lock the record by contacting the server for a cookie. Now if it takes long time to have exclusive access to the synchronised elements (file, map, etc.)
should the user just wait and the system freezes???

What can I do to fix this? From the discussions, I don't implement biz logic on server, but rather use lock-modify-unlock requests from client to server.

Any thoughts from the gurus are welcome!
Hello:

Does anyone know anything about how Sun tests our deliverables?
I'm doing a stress test to the Data.java database gateway and I don't know if there are more systematic way of doing this??

Moreover, are we certain that Sun only tests our Biz logic (e.g., rent roo, vecate room, etc.) or is it possible that they will bypass that and do it using the implemented DB interface (Data.java)?

Any thoughts are welcome. Anyone who wants to share test scripts, etc. is welcome too.
Mine does not have any exceptions! So, I can only return an empty (non-null) array.

I think they are playing games with us!

Shlomo
Congrats.
I'm interested in the test program you developed.
Can you give it to me? I'm doing 1.1.1 and I think looks similar.
Can you give java code of the test so I might change it?
17 years ago
Oh My God! This is exactly what I was about to write!!!
Thanks for saving me the time to articulate this problem!

I think you are right. This is a problem as there are two views of the records and they need to be consistent.

Monkhouse, can you defend your code?
Hello,

In the Child and IceCreamMan example (Ch. 4), the two threads use

private List<IceCreamDish> dishes = new ArrayList<IceCreamDish>();


defined in IceCreamMan for communicating.

Although the requestIceCream() is synchronised, the code that removes the dish after serving (dishes.remove (currentDish) is NOT!!!

There is a possibility that a Child will add a dish while the IceCreamMan is removing another.

Since the ArrayList is not synchronised (unlike Vector), don't you think that this is a problem?

Please clarify.

Regards,

Shlomo
Hi Ricky, All,

Actually, I'm confused as well.
I did not order the assignment (I did not even pass the SCJP!), and trying to see if I can do this (it cost $250!) before ordering it.

So, we have a database D with records R1, R2, ..., Rn.
The server is the only one that can write/read from D.
The server receives a request from client over the Internet.
A synchronised(D) methods executes and tries to lock the record (in case of write) Rx sent by the client. That means I need a unique lock for every record in D. After that, the thread servicing this request tries to finish the request.

This way, I can have concurrent access to the D (I can read records that are not locked as well as delete one record and update a different one at the same time). But, now wait a minute! Don't I need to synch on D when I actually write to the D?? Because if I don't, I can be interrupted between the seek() and the write().

I'm more confused now!

HELP!!!

Shlomo
Hello,

Can we implement the assignment using 5.0?
I haven't ordered it yet, but I was wondering if we can use the new features from 5.0 such as R/W Lock?

Also, if we synch the DB and allow for only serial access, is that acceptable solution?

Thanks!