Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Max Habibi

town drunk
( and author)
+ Follow
since Jun 27, 2002
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Max Habibi

Programming requires that you pay attention to every conceivable thing that could go wrong. Being cool requires the opposite.
10 years ago

Originally posted by Vijay Chouhan:

I was thinking of implementing a file based persistent store in Java. I can write the contents of the Objects to a file on the disk. I can dump 100 objects (e.g., for 100 employees) to a file. However how do I read one of the object (for a particular employee) back?

For example if I want to change the data for an object, how can I retrieve the object and replace it in the file.

I hope my question makes sense. In terms of databse terms, Create is fine, but how do I perform Read/Update/Delete?

Couple of options that comes to my mind are:
- create a different file for each object
- retrieve the data for all objects, deserialize them and subsequently persist them again after performing the relevant operations

But both of them are not efficient and have drawbacks.
I hope my question makes sense. Will be thankful for any suggestions/pointers.

Hi Vijay,

You could also consider creating an 'index' file, that would point you to a particular position in your datastore file\directory. You could potentially have several such 'index' files: say, by name, employeeId, etc. Also, unless you're looking @ a lot of files(day, over a 1000), I'd probably use a directory structure to store the data.
10 years ago
eid-et mobarak!
10 years ago
The easiest way to do this, and to avoid a conflict with your management, is to execute the behavior you want in a servlet, then reload the servlet every few minutes or so using either the container, or some Ajax\javascript thingo.

Your management team isn't going to be convinced because Stan, or Lasse, or Max from Javaranch said that what you want to do is ok. Heck, it'll probably get their heckle up.

Yes, it happens to be true, but that's beside the point.

They probably have a (sensible) policy in place that discourages junior programmers from threading in the Web Container: I can see that. Hell, I'd probably support it.

Show them you can swat flies by using a fly swatter and not a baseball bat, and you may find yourself presently surprised that they'll be more willing to listen to your ideas next time.

good luck,

Originally posted by Frank Silbermann:
The Pippi Longstocking books were kinda subversive, in the sense that they made adults seem silly and celebrated an eccentric rebellious child who did as she pleased with no adult supervision.

Adults are silly, and stories about eccentric, rebellious children who do as they please are as old as Romulus and Remus, Hansel & Gretel, various religious mythologies, and Peter Pan.
10 years ago

Originally posted by Darya Akbari:

No, however in ancient Persia Darya were the drivers of chariots who were part of Darius' army.

Really? I thought you were named after the Ocean ;->
10 years ago
I like to maintain the illusion that I'm an aristocrat who doesn't have to care what time it is.
10 years ago

Originally posted by Darya Akbari:

Check my profile, I'm the male in that trio

[ October 05, 2007: Message edited by: Darya Akbari ]

You have a lovely family, Darya: your little girl is literally too cute for words
10 years ago

Originally posted by Chunnard Singh:
But Ulf,
I just realized that the post was somewhat old and had alot of posts like 26 or so. Why delete it so late. There were a good numbers of posts from bartenders as well. I don't feel so bad for myself, But for others who I feel I had provided a forum to say stuff and you took that all away in one swoop. Why Ulf, Why not?

[ September 24, 2007: Message edited by: Chunnard Singh ]

I'm not sure Ulf actually deleted it, but it's possible that the 27th comment was out of line: or it was starting to head that way. If it's any consolation, I had the same thing happen to me a few weeks ago.

I understand where you're coming from, as do most of the moderators.

Really, we do get it.

But at the end of the day, if we feel that a discussion is starting to turn ugly, we reserve the right to remove it.

I'm sure you'd feel the same way if you gave party and people started to argue loudly. It's not personal at all: we enjoy your posts, and hope you continue to make more. But it's the way these sorts of issues are handled. We even say so right in the MD forum.
10 years ago

Originally posted by Ulf Dittmer:

No, I didn't. I might have seen the first one or two starring Roger Moore (although I don't remember), but nothing after that. All of them since might have been great movies for all I know, but for me, if it doesn't have Sean Connery, it ain't James Bond.

[ September 03, 2007: Message edited by: Ulf Dittmer ]

I sincerely wonder how you'd feel if you actually saw the Daniel Craig movie(which, to be honest, I had expected to hate). Or, for that matter, the first Bronson movie.

Moore was no bond: that's for certain. And neither was what's-his-name. But I was impressed with Craig, and the (first) movie of his(Craig's) predecessor.
10 years ago

Originally posted by Ulf Dittmer:
For me, There Can Only Be One Bond, and that's Sean Connery

Really? I thought the Daniel Craig movie was really, really good. Did you see it? Thoughts?
10 years ago

Originally posted by John Smith:
Apparently, the IQ levels for the populations of various countries have been measured or estimated:

Out of the 185 countries, the top 3 are Hong Kong, South Korea, and Japan.

I'm in Japan now: and I have to agree, they're very bright people. I wonder if it's the written language? Maybe being trained to deal with all that complexity makes the brain more comfortable with detail?
10 years ago
Interesting. So now two people I admire really liked the book. Maybe I'll give it another shot.
10 years ago

Originally posted by Paul Clapham:
Nothing wrong with you at all. I read the first two and it didn't take me long to notice that the story of Harry Potter was also the story of Luke Skywalker and Frodo Baggins, in a different setting.

I had the same feeling when I read Dune: thought I was thinking the story of King Arthur.

I really got into that: read all of the Dune books(what? seven? nine?). Then started reading every damn Frank Herbert book I could get my hands on. And mind you, I was about 10 at the time.

But Harry Potter: I dunno. I just don't get it. I don't get the movies either. I think it's a genetic defect of some sort. Probably the same thing that made me retun my MacBook Pro about 10 days after purchase.
[ August 06, 2007: Message edited by: Max Habibi ]
10 years ago