Yevgeniy Treyvus

Ranch Hand
+ Follow
since Mar 09, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Yevgeniy Treyvus

Hey guys, does anyone here have experience with disabling JMS and EJB in JBOSS? I am using JBOSS 4.0. Any help greatly appreciated.

Thanks.
19 years ago
Struts should handle this automatically. Input fields are not saved in session-scope. They are saved in request-scope.
19 years ago
What you're looking for is a cryptographic hashing function. There are generally two mainstream flavors: MD5 and SHA1.

http://java.sun.com/j2se/1.4.2/docs/api/java/security/MessageDigest.html
http://java.sun.com/developer/technicalArticles/Security/Crypto/

Hashing functions are used to produce a unique key for some input. If the input changes in any way, then the hash produced will be completely different, however if the same input is supplied you will consistently be getting the same hash.

In UNIX, for example, passwords are not stored in cleartext. Instead, the passwords are hashed and the hash is stored. This way if a hacker gets his hands on the hash he/she has no way of getting back the password. This is a property of a one-way hash function - you can only go one way (from password to hash, and not from hash to password). When a user supplies his/her password again to login into the system, the password is hashed once again and compared to what is stored on file. If the hashes match, then you login.

Here I wrote a quick example for you:


[ July 12, 2005: Message edited by: Yevgeniy Treyvus ]

[ July 12, 2005: Message edited by: Yevgeniy Treyvus ]
[ July 12, 2005: Message edited by: Yevgeniy Treyvus ]
19 years ago
In terms of efficiency, I don't think there's any way to make this operation any faster than O(n).

In terms of implementation, I think it might turn out a bit tedious to keep track of all the last modified dates for all the files -- especially if you have a lot of files.

Instead, try generating a hash for all the files within a directory (recursive operation). This way you only have to keep track of one number, as opposed to possibly thousands of last modified dates. If the hashes don't match that means something has changed.
19 years ago
Yes, I think Frans is right After looking at my code, I appear to be doing the same thing.
Mihai,

I guess it all depends on your implementation. But it does not seem intuitive to me to have to open/close the RandomAccessFile every time you have to read a record. Why not open your RAF in the constructor once, and only close it in the finalize?

In my implementation I did just that and passed.

Yevgeniy.
Jack,

I think you're on the right track. Even if an exception occurs, it does not make any sense to leave the record locked. The record should be unlocked in any case to let other clients have a chance at it.

PS: I have been done with my assignment for a few months now, so I am little rusty but I think your method can be simplified a bit. I think that there's no reason in obtaining a lock before making a check to see if the contractor is booked or not -- that's a read only operation.



[ July 07, 2005: Message edited by: Yevgeniy Treyvus ]
[ July 07, 2005: Message edited by: Yevgeniy Treyvus ]
Mihai,

I think your search method is a bit long. I think there are some quick ways you can make your code less complex and more intuitive.

For example, you could have a method that given an offset in the file, it would read a record from the database. Incidently, it would also have to handle any IO exceptions it may encounter.

In fact, doesn't your assignment specification require you to have a read method?? Mine did. If you already have a read method then why not use it and call it in your search method?

I think you can get rid of this code:




and replace it with a single call to a read method...Hope this helps.
I think there are a couple of problems here. Each time you call your static methods that in turn creates a brand new instance of FileHandler class.

Instead you should create only one instance of the FileHandler class for each log file and work with that.

As a side note, both of you static methods (getClientLogger and getServerLogger) are nearly identical. Sun may take points off for that since this is generally a bad programming practice.

Instead try creating only one method (getLogger) and make it take some kind of parameter that will differentiate between the different logging modes (client & server). Doing so will half the size of you FileLogger class.
I thought it meant that it took RT expression as values for arguments used by the tag (i.e) disabled="$(user.readOnly}". Is that not correct ?
[ May 05, 2005: Message edited by: Yevgeniy Treyvus ]
19 years ago
I tried that, but I get the following error:

/WEB-INF/tiles/websm/carrier/info.jsp(23,32) According to TLD or attribute directive in tag file, attribute value does not accept any expressions

But looking at the TLD itself, it says RTexpr is true.

Any ideas?
19 years ago
How do I disable a text field based on a bean property in Struts ?
19 years ago
I wouldn't bother with rollbacks...especially in a situation like this.

Also, unless your instructions state otherwise you don't have to implement rollbacks. You can always describe why or why not in your choices.txt file.
The -m command simply tells the Jar utility to package the Manifest.mf file you wrote within the Jar. An example command would look like:

jar cmf Sample.mf Sample.jar Sample.class Turtle.class Sample.java Turtle.java images

You can find a more complete exlanation in this tutorial:

http://www.cs.princeton.edu/introcs/85application/jar/jar.html

Make sure your Manifest.mf file is in the META-INF folder. An example structure would look like:

META-INF/
META-INF/MANIFEST.MF
Sample.class
Turtle.class
Sample.java
Turtle.java
images/
images/image1.gif
images/image2.gif
images/image3.gif

You can use something like Winzip to look at the contents of your Jar file. Make sure all needed .class files are indeed there.
19 years ago
Sure,

You should write your own Manifest.mf file and force the Java Jar utility to use it with the -m command. Your Manifest.mf file should have an entry called "Main-Class" that points to the class in your application that has the



method. An example Manifest.mf file would look like:

19 years ago