So, this is a question of coding style more or less. I'm using Bean Validation here but the idea is the same for any interface that has simple implementations that aren't likely to get changed all that often.
@Target( { METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@Constraint(validatedBy = PhoneNumber.PhoneNumberValidator.clas...
After being convinced ("schooled") that Swing apps on Mac do look native, I'm trying to make mine look as native as possible. Everything looks great, but when I hit command-Q or do it from the menu, my windowStateChanged(WindowEvent e) is not firing on my main JFrame (if I exit in any other way, it does fire). How can I respond to the re...
I first tried the spring mvc tutorial using eclipse, but got a bit frustration and just did the first few steps using netbeans.
Netbeans, using a java web template, creates folders like:
/webpages
/webpages/meta-inf/
/webpages/web-inf/
/webpages/*.jsp
/source packages
/source packages/xxxx/xxx.java
/test packages/
/libraries
/configura...
Does anybody know of a good common frameworks for Java that has common but tedious utility methods that do things like...
ObjectUtil.equalsOrBothNull(obj1,obj2)
FormatUtil.formatName(String firstName String middleName, String lastName)
AddressUtil.formatAddress(address)
etc...
It seems like I always end up re-implementing these so...
We have to validate a CSV file containing various configuration parameters. Are there any standard design patterns to do this type of validation.
More details:
There are different types of records - each with their own validation logic
Certain records cross reference other records
There are rules on the order of the records
There are...
I am trying to create an image from a binary file. The file contains a 32x32 icon and its corresponding 16 colors palette.
Specification
The icon is 512 bytes long. The icon is separated in 4x4 tiles. Each tile is 4x8 bytes.
Here's the 4x8 arrangement of bytes for a single tile:
B B B B
B B B B
B B B B
B B B B
B B B B
...
Hi,
I have the following java code fragment
while (condition1){
switch (someinteger){
case 1:
if(condition2) continue;
// other stuff here
break;
// other cases here
}
}
All is fine. When I generate a class file and then decompile it using a free tool (JD-gui), I get back th...
Lets say I launch my app from the home screen, navigate through some activities, then I press the home key and do something else in the Gmail app.
After i'm done checking my mail,I press the home key again to leave the Gmail app and click my app's icon at the home screen again to return to it.
When I return to my app, I want it to ret...
I want to play an MP4 videon streamed over rtmp protocol in java.
I found a few rtmp libraries (yuv, red5), but nothing on mp4 display.
Is there a (possibly simple and maybe platform-indenpendent) solution to do it in java?
...
It sounds stupid, but over the years I haven't been able to come up with a use case that would require this. A quick google search didn't reveal anything worthwhile.
From memory there was a use case mentioned by Bjarne Stroustrup but i can't find a reference to it.
So why can't you have this in C languages:
int val = 0;
if val
doSom...
acording to the docs on service lifecycle i should be able to implement RegistryShutdownListener and tidy up my resources (in this case, shutdown a threadpool) however it is throwing an exception and seems to be trying to re-initialise my service in order to perform the shutdown listener!?
2010-01-14 10:59:01,750 [main] ERROR org.apache...
I got interested in looking at JSF 2.0 as a potential technology to use. Does anybody know when this version is scheduled to come out and how active is the project in general?
...
i have downloaded the latest quercus 4.0.3 war-file from
http://quercus.caucho.com/
how do you install quercus in glassfish?
i followed this old tutorial for a old quercus version but it didnt work:
http://weblogs.java.net/blog/ludo/archive/2007/03/100_java_quercu.html
has someone successfully implemented quercus in glassfish and co...
I am building a web application that has to be able to do the following:
Send emails to the (external) addresses registered by the users (say, Gmail, Yahoo Mail, etc).
Send/receive emails to local mailboxes that live in the application. These are more "messages" in that sense.
What are the potential open source technologies I could ...
I am considering purchasing VBulletin and integrating it with my J2EE application. While I am still looking into what it takes to enable this integration, I was wondering if VBulletin supports single sign on so that my users do not have to login to VBulletin once they have been authenticated to the application. Any thoughts?
...
I want to write a Java App that can communicate with an Infra-red device. I have a USB infra-red reader that I want to use. Are there any Java Libraries that I can use to make this happen... Ideally I want the program to work on windows and macOS X. Anyone have any sample code or anything they can do to point me in the right direction, I...
How can I tell if the JVM my application runs in is 32 bit or 64-bit? Specifically, what function or preference do I access to detect this within the program?
...
I want to be able to have Java to control a webkit/gecko/konqueror browser.
The Java should be able to do things like "go to this url; give me the DOM tree; simulate mouse click / keyboard input on blah".
What is the easiest way to do this? There seems to be some half-working solutions on the web, but no one true open source project.
...
Hi,
I am a newbie at java/java servlet. I need the simpleCaptcha for a form, using html and javaservlet for the code. With reference to http://simplecaptcha.sourceforge.net/extending.html.
Captcha captcha = new Captcha.Builder(200, 50)
.addText()
.addBackground()
.addNoise()
.gimp()
.addBorder()
.build(); // Req...
I currently use Apache Axis. But I am creating a new project in Intellij IDEA and I have the option to add one of the following:
1) Apache Axis
2) Glassfish /JAX-WS 2.x RI / Metro 1.x / JWSDP 2.0
3) Restful Web services
I am choosing Axis because it's the one I am used to, but I am still wondering if it's the easier option.
...