This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!

Mike Noel

Ranch Hand
+ Follow
since Dec 15, 2005
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 Mike Noel

It is an enhanced for loop that was introduced with java 5. You can think of it like a foreach (if you're familiar with foreach from scripting languages).

Check out

for some info on that.
12 years ago

Originally posted by Santhana Lakshmi.S:
If i java.util.regex class i need to give the pattern where the special characters will occur.Am i right?
But in my case, the input string is user defined one.
In that,at any place the special characters and numbers will occur.
How to check those?
Thanks in advance

Regular expression syntax allows you to specify the characters without worrying about their exact placement in the string. For instance the pattern [a-z]* matches zero or more lower case letters. It doesn't matter what order the letters are in.
12 years ago
The term "static object reference" doesn't make sense to me (maybe it's too early in the morning) because using a static member means that there is no object involved. Maybe what you are asking is what's the different between accessing a static method vs. accessing a non-static member.

Non-static methods are called using a object reference. For example:

In this case we create a new object, myObject, that is an instance of the class MyClass. After creating the object we call the method myMethod using the object to access it.

Static methods are called using the Class name instead of an object. For example:

In this case notice that we didn't need to create an instance of the MyClass class in order to call the method. We just called it using the class name.

The same applies to accessing public non-static and static fields in a class.

Hope this helps.
12 years ago
Thanks Jim. Didn't think about case. Now I can't get to 13. When you all say you're stuck on 12 does that mean you made it to 13 or that you can't get to 13?
12 years ago
I think it also can be used to mean "and there's more but I don't feel like writing everything to fill in the blanks". As an example, I might write:

"And then after initializing the loop you want to create new objects and set them to values then call out to the Helper class (hopefully there won't be an exception there...) and then you're done."

The "..." in that phrase means that's there more to discuss in that direction if the conversation heads there. Hopefully it won't.
12 years ago
It's embarassing but I can't get past 3... Am I missing something? Well, clearly I am.
12 years ago
Yes, the bed spread should be handled with rubber gloves. Just pull it off the bed and stuff it in the closet for the whole time you're there.
12 years ago
I see (and use) "this" a lot in getter and setter methods.

In this case it's a style thing. I could just as easily give my method parameters a different name and then avoid using "this".
12 years ago
I'm still pretty confused about what you're trying to do here. Since your question seems to revolve around the for loops I'll explain what you have going on in the code and maybe that will shed some light. Your code shows three for loops:

The first loop uses "i" as the loop index. It starts at 0 and goes to CallClass.length. This outer loop will execute that many times. The next loop uses "is" as the loop index. It starts at 0 and runs "methodlen" times. "methodlen" is set by calling getMethods() on the clsCouple object. The inner most loop uses "ns" as the loop variable and it executes dataType.length times unless the "break" kicks in. This happens when "m" > -1. Since "m" is set using the indexOf method I'm assuming that this loop is meant to break out as soon as the there is a match. That's what will happen.

Hmm. Maybe that's the problem you are seeing. Do you want the inner loop to stop the first time a data type is found in the method string or are you wanting to see all of the dataType matches in the string? If you are wanting to see all of the matches then you need to remove the break statement. Generally speaking break statements in loops are a bad idea. There is almost always a better way to do things.

Well, I'm not sure if my comments have helped at all. Maybe you can clarify what you're trying to do and where things are going wrong.
12 years ago
When you switched to 512 did it still crash at about 22000 records? Also, how big are the fields in the class. In order to to run out of memory due to these objects it seems that each one would need to be around 10k in size. Is that about what you're dealing with?

If your records really are that big then you might want to think of a different algorithm for processing them. Even if you solve the memory problem for now your solution won't scale to more data.
12 years ago
What's the question?
Those were pretty funny. And it looks like most of the victims were good sports. Not sure how that would go over here in the US. We'd probably start suing everyone or demanding that we be paid for being on TV. :-)
12 years ago
There might be a tomcat setting for limiting this but it seems easier to limit the upload size in your app. It is likely that you have a loop that is reading bytes from the incoming stream. You can just keep a sum of the size you've read so far and then throw an error if the size is greater than your threshold.

An advantage of doing this yourself instead of having tomcat do it is that your app is a little more portable. You can move it to another servlet container without worrying about the upload size limiting.
12 years ago
A little confused here as to what you're trying to do but I think I can help get you headed in the right direction. First of all, try to use the code tags (see the "code" button below the message edit screen when posting) around your code. It makes things easier for people to read which means it's easier for people to understand and help.

Your for loop headers are not formed correctly. The for loop header should contain: initializer, condition, update. In your case the condition and update look fine but the initializer is not correct. "i<0" is not initializing the loop variable "i".

What does the CALLCLASS[i] statement do? Or rather, what's it supposed to do? Also, where do arr and arr2 come from?

Just a little more explanation and context is needed then we can help more.
12 years ago
If you are still having problems after you have familiarized yourself with the classes Layne suggested then post your partial solution here and we'll help you figure it out the rest of the way.
12 years ago