java

What is your favorite hot-key in Eclipse?

I've been using Visual Studio with Re-Sharper for the past few years and have recently taken a gig at a Java shop where we use Eclipse. Googling for Eclipse hotkeys has returned a bunch of 'Top 10 Hot-Key' posts, but that's about it. What are your favorite hotkeys? And which are essential? ...

Best J2EE server

At my shop, we use WebSphere, but I hate it with a passion. Updates are a nightmare It's not J2EE compliant Automated deploys are very difficult What is the best J2EE Application Server out there and why? Edit: We see largish scale activity 50k+ daily logins, 50ish Web Applications, Several MDBs and an EJB. ...

Does having many unused beans in a Spring Bean Context waste significant resources?

My model layer is being used by a handful of different projects and I'd like to use a single XML Spring Configuration file for the model regardless of which project is using it. My question is: Since not all beans are used in all projects am I wasting resources to any significant amount if there not being instantiated? I'm not too sure...

Creating a java servlet web application

We have to create a web application for a school project and I'm wondering what best practices are when creating a web application using java servlets, beans and jsp. Specifically I'm curious about servlets. Should a single servlet be created with many methods depending on which page is requested (a single controller) or should a servle...

Fastest Gaussian blur implementation

How do you implement the fastest possible Gaussian blur algorithm ? I am going to implement it in Java, so GPU solutions are ruled out. My application planetGenesis is cross platform, so I dont want JNI. ...

Can the NetBeans code formatter be made to format javadoc comments?

The NetBeans 6.1 editor doesn't seem to like to wrap comments, and the code formatter seems to ignore them. For JavaDoc comments, this behaviour seems inappropriate, as you can end up spending a lot of wasted time manually reflowing paragraphs. I was wondering if there's some magic setting to get the builtin code formatter, or the edit...

What is the best way to obtain a list of site resources when writing a Maven2 site plugin?

When creating a plugin that executes in the default life-cycle, it's easy to obtain a reference to the project and its resources, but I'm getting a null instead of a MavenProject object when creating plugins that execute in the site life-cycle. Any hints, tips or suggestions? ...

How do I have a socket accept connections only from the localhost (in Java)?

I have a java app (not running in any application container) which listens on a ServerSocket for connections. I would like it to only accept connections which come from localhost. Currently, after a connection is accepted, it checks the peer IP and rejects it if it is not the loopback address, but I know that peer IP addresses can be s...

Would it be useful to have method return values for null objects?

Would it be useful to be able to provide method return value for null objects? For a List the null return values might be: get(int) : null size() : 0 iterator() : empty iterator That would allow the following code that has less null checks. List items = null; if(something) { items = ... } for(int index = 0; index < items.size(...

Generate a current datestamp in Java

What is the best way to generate a current datestamp in Java? YYYY-MM-DD:hh-mm-ss ...

Would Automatic Casts be useful?

Is there any downside or problem potential to change the Java compiler to automatically cast? In the example below the result of list.get(0) would automatically be casted to the type of the variable hi. List list = new ArrayList(); list.add("hi"); String hi = list.get(0); I know that generics allow you to reduce casting but they do so...

Iterate with for loop or while loop?

I often see code like: Iterator i = list.iterator(); while(i.hasNext()) { ... } but I write that (when Java 1.5 isn't available or for each can't be used) as: for(Iterator i = list.iterator(); i.hasNext(); ) { ... } because It is shorter It keeps i in a smaller scope It reduces the chance of confusion. (Is i used outside...

RMI server: rmiregistry or LocateRegistry.createRegistry

For RMI on server-side, do we need to start rmiregistry program, or just call LocateRegistry.createRegistry? If both are possible, what are the advantages and disadvantages? ...

Would it be useful to add extra info to stack traces?

Would it be useful to be able to mark objects where the value ofString.valueOf() would included in any stack trace. In my example below I used "trace". Variables that aren't declared at the point of the stack trace would just be ingored. It would make debugging much easier and make it much easier to write programs that are easy to debug...

Would it be useful to include the class name and variable name in any NullPointerException message?

Would it be useful to include the class name and variable name in any NullPointerException message? I know that it might not always be possible because of changes made by a JIT but is seems like the info should be available often (class members, etc). From: http://jamesjava.blogspot.com/2005/04/what-was-null.html ...

Would it be useful to change java to support both static and dynamic types?

What if a Java allow both static and dynamic types. That might allow the best of both worlds. i.e.: String str = "Hello"; var temp = str; temp = 10; temp = temp * 5; Would that be possible? Would that be beneficial? Do any languages currently support both and how well does it work out? Here is a better example (generics can't be us...

Is there a good reference on how java executes bytecode?

I'm interested in how java organizes memory and executes code (like what gets put in the stack or the heap), from the start of main, to assigning variables, calling functions, passing parameters, returning values, instantiating objects, etc. Has anyone found a good, beginner-friendly article/reference on it? Preferably online, of course,...

What's the definitive Java Swing starter guide and reference?

Obviously the Java API reference, but what else is there that you all use? I've been doing web development my entire career. Lately I've been messing around a lot with Groovy and I've decided to do a small application in Griffon just to experiment more with Groovy and also break some ground in desktop development. The only thing is ...

Biggest GWT Pitfalls?

I'm at the beginning/middle of a project that we chose to implement using GWT. Has anyone encountered any major pitfalls in using GWT (and GWT-EXT) that were unable to be overcome? How about from a performance perspective? A couple things that we've seen/heard already include: Google not being able to index content CSS and styling in ...

What do you consider the best CMS in Java

Which CMS are you using in Java and what is your experience with it (in terms of extensibility, usage comfort, framework API, memory usage, performance etc.). I am looking for suggestions. ...