Rick O'Shay

Ranch Hand
+ Follow
since Sep 19, 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 Rick O'Shay

First, I would not tweak memory parameters unless you know precisely what you are doing and have hard proof of before and after improvements. The exception is the ceiling:


I believe that is the maximum the 1.4 JVM can handle and even if it's not your GC will be seriously bogged down with a 4G heap. Keep it at 2Gs, then fire up another JVM in parallel if you need more memory/processing power.

The other common reason for OOME is permanent memory exhaustion. That is where class information lives so if you have a lot of classes loaded you can exhaust that. You should VERIFY that using the memory monitor available with 1.4. You should watch the permanent memory block under load. Make sure you have 16 megs or so of headroom. The default permsize is 64m for serer mode.


BTW, are you CERTAIN your cache is flushing old content and recycling memory?
[ February 24, 2006: Message edited by: Rick O'Shay ]
13 years ago

Actually I am trying to understand the JVM completly for that I have to understand the Native code too.

The JVM executes translates virtual machine instructions in to native machine instructions. Now you understand the JVM completely -- specific details notwithstanding.

I think if you seriously want to understand the JVM completely you should start with the general theory of operation and work your way down through specifics. You can understand the JVM completely without ever seeing a line of native code.
13 years ago
Introspection (a.k.a. reflection) is used for runtime discovery of fields and methods and related items. If you can expose that information at compile time you can avoid introspection. Interfaces provide compile time knowledge and you can distribute them across many classes.

You have to go out of your way to use reflection so it's not something that even a mildly experienced programmer would use by mistake. I think if one is using reflection when they should not be they need a remedial study session.
[ February 22, 2006: Message edited by: Rick O'Shay ]
13 years ago
For sequential you would just count as I already pointed out. There are R to the N values or 36 to the power of 8 if you use 8 characters in the range of zero to capital 'Z'. Count 'em.

What I am trying to convey is that you have a lot of data and code for something that could be done in a loop. The future requirements you've mentioned seem somewhat contrived but, regardless, they are easily done using small tweaks to the loop. 'Nuff said.
13 years ago
Yes, you can change the letters but for what purpose? Let's leave aside efficiency and bloat issues and ask what the actual task is and what's the simplest way that we can achieve that in a reasonably extensible way.

The idea is to generate a string of N random characters withing a range R. That little loop will do that. There is nothing sequential about the result. It's essentially random. What purpose would it serve to choose your own non sequential characters if you are going to pick them randomly?

BTW, what makes you think you could not filter out E, f, d in a loop? A minor tweak to the loop is all that is required. KISS!!! Keep It Simple Students!
[ February 21, 2006: Message edited by: Rick O'Shay ]
13 years ago

Originally posted by Jherald Lacambra:
here's a javascript that i have created that generates 8 characters string. Just convert the methods into java...


Yikes! Why would you ever use an array to store sequential values when you can use the + operator? Anyway, if he wanted a random string (rather than unique strings as he asked for) he could generate that with a loop.

Remember that characters are people too, er... numbers.
13 years ago
This is really a beginner's questions. In general, google is faster than news groups or discussion forums; so try "sleep java", assuming you do not have an introductory Java book handy.
[ February 19, 2006: Message edited by: Rick O'Shay ]
13 years ago
This is really a beginner's questions. In general, google is faster than news groups or discussion forums; so try "sleep java", assuming you do not have an introductory Java book handy.
[ February 19, 2006: Message edited by: Rick O'Shay ]
13 years ago
>> He showed an example containing two Os..

Assuming that was intentional then what he is asking for (appears to have left the building) is nothing more than a counter from 00000000 to ZZZZZZZZ. May be base 26 but that hardly complicates matters.

Maybe he wants a random string with no duplicates of 8 characters in length? That being the case he can just keep a list of "numbers" already dished out, keeping them sorted for a fast binary search.

I noticed folks at The Ranch often fail to distill the germ of their question and leave out critical details. So you get "How do I display a pink polka dot on Tuedsay" instead of "How do I display an image contained in a JPEG file".
13 years ago

Originally posted by John Todd:
I want to create an algorithm that create a unique 8-length charaters String, like :
Any ideas ?
Thanks for help.

The correct answer: the task is impossible.

If you want to pose an answerable question it might be worded as follows: How does one generate the set of all 8 character permutations using upper case letters? I think that is what you meant to ask.

If you have taken an introductory statistics class you may recall this is simply a permutation. In permutations the position has meaning. AB is not the same as BA for example. Now, you have 26 objects (upper case letters) and 8 positions so this is just 26P8 (read: 26 permute 8).

Possible solutions: 26! / (26 - 8)! = 62990928000

So what you need is an algorithm to cycle through all of these possibilities. The way you do that is google for "generate permutations" I'ts probably not pretty.
[ February 18, 2006: Message edited by: Rick O'Shay ]
13 years ago

Originally posted by riaz rahman:
How To Acqiure finger print image from web browser.
is ther any open source plugin.
ther is provision for sending text from web browser to server how to transfer imager from browser to server (not as a file)

thanks in advance

You must be thinking of the Finger Print Image Web Browser Acquisition Utility. They canceled that project with they realized a fingerprint image was just an image and that you could already upload and download an image. Same think happene to the View Banana Spider Plug-in. They got half way through development and thought, "gee, why do we need a special plug-in for this?"

Side note: I find the lack of grasp of the notion of generalization evident in so many questions posted here very disconcerting.
13 years ago
I am going to assume you know how to google and that you are rather looking for a point of view that you can interact with. Moreover, every question on this forum could be preceded by "you can get information from google"; so it is pointless to suggest that.

Factory methods insulate your application from custom code. Creating custom versions of an application is therefore simplified.

Assume you have several customers and they all have specialized needs. Sprinkling your code with conditional statements everywhere there was a customer variance would create a maintenance nightmare. Instead, you can capture variances in a class or set of classes with a standard interface. Factory methods are then used to select the appropariate sub-type at runtime. The rest of your application is unaware that it's running a specialized version of the application. The same application can support an infinite variety of implementations withou change.

Note that you still have the conditional statement that decides which class to instantiate, however, it's all neatly packaged inside a factory method that creates
13 years ago
>> I personally don't think the design/implementation of the generics is good

That's unfortunate. Why didn't you speak up earlier? You could have saved the Java community a lot of effort by letting them know this earlier. The brightest minds in the industry toiled over this for years analyzing C++ and other alternatives finally coming up with an effective solution that was compatible with existing Java code. Now we find out from you it's not good. Thanks.
[ February 03, 2006: Message edited by: Rick O'Shay ]
13 years ago
I assume you are using 1.4 or greater in which case call stack information is cheap and available. There are several uses for this but of course you should avoid injecting dependencies on a particular caller in any method. Here's one way you can call a method to find out who's calling.

Note that you don't care who called "whence() but rather who called the method containing whence, hence the index is one not zero. Example:

13 years ago

Originally posted by Babar Qadri:
I have a method in my class. But I dont want to call it straight. Infact, I am getting the method call from database as a string. The string looks like, "classA.calculate(valueA)".

I get this method call, statement, as string using rs.getString(). Is there any way to execute this statement?


"Why"? He dared ask.
13 years ago