Vitaly Zhuravlyov

Greenhorn
+ Follow
since Apr 11, 2003
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 Vitaly Zhuravlyov

It took more than 4 weeks to get the result and the score is quite unexpected:

General Con: 100 82
Documentation: 70 70
OOD: 30 25
GUI: 40 33
Locking: 80 80
Data Store: 40 40
Network Server: 40 27
Total: 400 357

Maybe my essay was not too good. But anyway it's done, and many thanks to Andrew, Max, Jim, Ken, Vlad and late Phil!

Vitaly
15 years ago
I nearly missed your results Vlad
Congratulations! Well done!
16 years ago
NIO
Jim,
Looks like now and then we (or at least I) follow another motto: "For every simple problem, there is a solution that is complex, combersome, but correct" I've got my intial schema reading re-written from RAF to NIO to be "consistent" and hoping it performs better. Illusions are broken.
Vitaly
NIO
Jim, the code is not sophisticated at all. The "small" file is the data file from the assignment, the "big" file has 1000 similar records (180K).

I also ran a similar test for 10 different small files and 10 different big files. Well, not really different but with different names. And in this case FileChannel slightly outperformed RAF for big files.
I am really eager to hear that I'm wrong.
Vitaly
NIO
Hi Jim,


Though I think most of us are just using FileChannel, which has nothing really to do with the nonblocking functionality; it's just fast.


Have you ever performed or seen any test showing that FileChannel really outperform RandomAccessFile in read mode? I ran a number of simple tests and they show that FileChannel in most cases is slower.
Cheers
Vitaly
Thanks Vlad. Although I do not agree that someone must manually specify a constuctor, the thing encouraging me is that there is no requirement for Data constructor in the instructions.
Cheers
Vitaly
Hi Vlad,
I've just come back to my assignment and read this thread. I'd like to highlight the point that you should not rely on a file name but rather use a File object as Philippe does in Data1. Otherwise what happens if you invoke getInstance() method with "db-2x2.db" and "DB-2x2.DB" on Windows platform?
Another my concern is applying the singleton or multiton patterns to the Data class directly. This means that you do not provide a public constructor for this class. On the other hand Sun explicitly specifies the name of the class and its package. Doesn't that mean that they are going to test this class automatically? And how can they instantiate it in this case? Tell me that I'm wrong.
Thanks
Vitaly
You are welcome Andrew!
It's not often that people reply to my messages so promptly Because of the time zones
Vitaly
Hi Andrew and Ganapathy,

Originally posted by Andrew Monkhouse:
In you match() method - nice use of &= (last time I did that, my team spent 15 minutes reviewing 200 lines of code, and 45 minutes reviewing my use of &= ) but I wonder if it is worthwhile?


It certainly is not worthwhile

is always found and

is always false
Vitaly
Hi Jim,


The more I think about it though, the more I think maybe I should always trim() strings when they're read and pad with spaces when storing, just as Jeff plans to do.


Consider trimming the following

Do you also think that if we encounter a null terminated string possibly inserted by some other program we must preserve its format?
Thanks
Vitaly
[ May 23, 2003: Message edited by: Vitaly Zhuravlyov ]
I did not think that the Shutdown Hook is not well-known. You can use something like this.

This feature is available since JDK 1.3
Vitaly

Originally posted by Ta Ri Ki Sun:


no Shan, DBMain is implemented by Data which does all the dog work, and DataFacade has methods like Map findRooms(String[] criteria) throws Exception; , void bookRoom(int recNo, String owner) throws Exception; , these methods use several Data methods to get the job done,


Hi Ta Ri Ki Sun,
Do you correctly use the word "Facade"? Facade for what? It seems to me that you do not use the Facade pattern. Correct me if I'm wrong.
Vitaly

Originally posted by Erik Manor:

00 is octal for 0 (1 byte), 0xFF is hex for 255. Since byte is signed 255 does not fit in a byte without a cast. With a cast 255 is -1.


You can use readUnsignedByte(). In this case there is no problem with 0xFF.
Also make your code independent on space or null trailing in field values.

Originally posted by Michael Dreese:

If DataInputStream/DataOutputStream did implement the reset method, I would not have to use RandomAccessFile.


Try something like this
FileInputStream fis = new FileInputStream(databaseFileName);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);