This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!

Andre Brito

Ranch Hand
+ Follow
since Dec 13, 2007
Andre likes ...
Java Scala
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 Andre Brito

I believe Reflection is all you need. Nothing else but the reflection's API from Java.
8 years ago
I'm sorry, but I'm not understanding your problem.

For what I understood, this should help:


Validates only numbers and characters, but I believe that if you want to validate special characters, all you gotta do is to put those into the compile method, from Pattern.

About the e-mail validation, I believe that the best way to validate it is using regular expressions. Check the Pattern class doc for more information. It's all there.
8 years ago
Try to remove the jar, clean the project and put it again.

In Windows, it's Ctrl + Shift + O to organize the imports.
Maybe it's because the method createNewFile() in File throws an IOException (it's not a RuntimeException (so, it must be catched), like ArithmeticException and NullPointerException, that only can be detected at runtime) and the mkdir() method doesn't throw that.

Exception description:

http://java.sun.com/javase/6/docs/api/java/lang/Exception.html wrote:The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch.



And RuntimeException:

http://java.sun.com/javase/6/docs/api/java/lang/RuntimeException.html wrote:A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.



I guess that's the reason why...
What's up, J.
Keep in mind that this is just my opinion, ok?

I'd say that depends of the amount of queries you want to perform in an entity. In my opinion, one of the best way to search objects is using NamedQueries. You can type a name for it and a query in JPQL (not very different from SQL). Than, in your DAO, you would create that NamedQuery and get the result.

Something like this


In your DAO, you can have something like this:


Of course, this is a very resumed version of the code. I omitted great part of it. Checkout this doc for more details. In my opinion, it's the best documentation for JPA.

There's other ways to do it. You can create only the JPQL and store it in a class and, when you need it, you can get that JPQL sentence. I don't recommend for you to do only one thing: don't ever write the JPQL code in a class like a DAO. It's very nice to find all the queries in a class (or in the class that refers to that entity or something like that). Another thing you should study is Criteria.

About the 'flow' you said, I guess it's ok. I'd just add a few throws exceptions with the message to present in the screen. Something like... "Oh, we don't have an entity with that name.".



By the way, I'm sorry my english. It's late in Brazil and I'm tired =) Bad day at the office.
8 years ago
I guess that it's because there can be a class ( C ) that extends A and implements I... Note that I'm not saying that there's.

In compile time it will work, but in runtime it will throw a ClassCastExcpetion.
As you said, Axis2 can do that... You can run that bat file (with wdsl2java) using Runtime.getRuntime().exec("..."), can't you?

By the way, you don't need to run that bat file using Runtime.getRuntim().exec(). You can run theWSDL2Java (in org.apache.axis2.wsdl) directly from a java application, using a few jars (maybe only the wsdl2j) from the lib folder.
8 years ago
Well... If you're thinking about buttons and frames, you'll may want to use Swing. Things get waaaaay different and easier, then. If that's what you're using, you'll need only one main, starting the main frame. After that, it's all about events...
I'm not going to answer all of your questions. There're plenty of tutorials and free codes on the Internet.
8 years ago
Is that it? If it's not, you can find out how to use the correct command through Java, right?
8 years ago
Got it: when I use fields I can use manipulate the objects with operations (i.e., I can call methods from the String class if the field is the String type).

Have a nice week. Can close this, guys.
Hey guys. Can anyone tell me the difference between Parameters and Fields in iReport? I don't know if it's a relevant information, but I'm using "JavaBean set datasource" option when I set the datasource.

Thanks.
You can search (maybe start one?) in the repositories of Google Code, Sourceforge and Github.
8 years ago
Hmmm... David, I guess you're completely right... The length of the array is, de facto, the size of the image. I'll try a new approach (maybe a 2 dimensional array of pixels or something like that).

By the way, I'm trying to pass an array from Java to other technology (through the network, with rmi and jni), so I thought that if I passed the things like that it would be ok... Maybe I'll try another approach in receiving the array in the other side of the application.
8 years ago
Hey guys.

I have 2 captcha images, from the same site (but different symbols). Both of them are jpg. I have a method that converts that images to array of bytes. So far so good.
When I use that method over captchaOne, it returns X as the size of the array. When I use that method over captchaTwo, it returns Y as the size of the array. Is that correct? I mean, I'm feeling that that is the mechanism over the captchas... But there's gotta be a way to get the same byte array (with different values, obviously) from different images... Can you guys help me?

Thanks! And I'm sorry about my poor english.
8 years ago