java

Using ROME to search RSS feeds

I'm using ROME to read and combine RSS feeds (caching is done with EhCache) in a Java environment. Is there functionality built in to the Rome API that allows you to search the contents of a feed (or a combination of different feeds) and then combine the ones that meet a specific search criteria? I'm thinking of implementing that mysel...

What is the advantage of a do-while(false)?

When looking through some code that was handled by another employee, I see a lot of code written in: do{ ... }while(false); What advantage (if any) does this provide? Here is more of a skeleton that is happening in the code: try{ do{ // Set some variables for(...) { if(...) break; // ...

How does Swing handle consecutive changes to the same component?

I'm a little confused about the Swing painting model. Suppose that I have a JComponent comp, and I do something like: c.setBackground(Color.RED); c.setBackground(Color.YELLOW); Obviously, the end result is that the color is yellow. How does Swing handle this? Does the first call trigger an immediate repaint so there'll be a short f...

[JRuby] How can I make a field transient, so Java objects don't get serialized when using marshal?

I have a JRuby class which contains an instance variable that is a Java object. As you may know, JRuby has a lot of trouble serializing Java objects, and therefore I would just like to skip over the object. How might this be achieved? ...

Is it possible to solve the "A generic array of T is created for a varargs parameter" compiler warning?

This is a simplified version of the code in question, one generic class uses another class with generic type parameters and needs to pass one of the generic types to a method with varargs parameters: class Assembler<X, Y> { void assemble(X container, Y... args) { ... } } class Component<T> { void useAssembler(T something) { ...

Code review conducted by an engineer who codes in a different language. Is it constructive?

I'm a Technical Support Engineer who recently discovered how fun programming can be. My boss noticed this interest and suggested that I learn Ruby as a first language since the company can benefit from it, it has a very elegant syntax, and we have no need for more Java/C/C++ programmers. Well I've written my first fairly large Ruby scri...

Excel to XML, encoding question

This is all mixed up in my head, and I can't wrap my head around it. I have an excel file I have to parse, using Java, and translate to XML. Using the jExcel library, I can achieve the parsing, and the application's doing the right work, and putting the right strings in the right place. So for the parsing part, I've got that covered. P...

Java spring database application won't quit reference to org.enhydra.jdbc.pool.PoolKeeper is still active why?

Hello all I have a simple Spring application which will not end as there is still a reference left to org.enhydra.jdbc.pool.PoolKeeper. I include all the references I feel are revelant below does it look ok and has anyone experienced this before? I ran jstack to see what non daemon threads where running and found the following. "Threa...

How do I get rid of this warning?

I am getting the following warning from my Java code: Lexer.java:591: warning: [unchecked] unchecked conversion found : java.util.ArrayList required: java.util.ArrayList<java.lang.Integer> ArrayList<Integer> tempArray = temp.get(theToken); I've tried casting it to ArrayList but this doesn't matter, it still appears. How can I get r...

How can state be maintained between Java Servlets?

Situation I have a few single-responsibility Servlets that take a request, do their job, respond, and are done -- no state need be maintained in these cases. However, I have I "Plain Old Java Object" that maintains state information based on actions the user has initiated on the client that I would like to make available upon request t...

Blank page when booting up a large web app

I hava a fairly large war based web app. When I boot it up, Tomcat will allow connections immediately even if the app hasn't booted. Because of this, users get a blank page until the app is loaded. I've seen some web apps where they display a "web app is starting, please wait" page while the app is loading. Is there a simple techniqu...

jscrollpane to scrolling a panel

hi i have to writing an applet, in left side i must use an panel to contain a list of vehicles that can be a list of buttons,what is the problem, number of the vehicles are not given !!! so, i need to scrolling panel when number of vehicles is too much, i do this for jframe, but it didn't work correct with panel, please help me with ...

How to enable wire logging for a java HttpURLConnection traffic?

I've used Jakarta commons HttpClient in another project and I would like the same wire logging output but using the "standard" HttpUrlConnection. I've used Fiddler as a proxy but I would like to log the traffic directly from java. Capturing what goes by the connection input and output streams is not enough because the HTTP headers are ...

Java WeakHashMap reference not being updated

Hi, In the code below I create a Pen object and initialize it's color to white. In the constructor of Pen, after setting the field 'penColor' to the value passed into the constructor, I update a global static weak hashmap that I'm keeping where the KEY is the 'this pointer - in my case a Pen, and the value is another weakhashmap whose ...

Format Java Code into Word / RTF

I need to format java code to put into a Word document. Are there any programs that will do this with keyword highlighting, etc. ? ...

Java does not seem to accept Romance as timezone alias. What should it be?

I'm trying to convert a date string from another application in Groovy. Something like "18-sep-2009 10:25:11 Romance Daylight Time" It looks like Java does not understand the Romance as timezone alias. "18-sep-2009 10:25:11 Pacific Daylight Time" works fine. Is there a fix for this other than parse the string and replace "Romance Dayl...

What are good ways to keep GridBagConstraints under control?

I'm somewhat new to Swing programming, and I find that as much as I love the power of GridBagLayout, if you've got a lot of components, there are lots of lines of code just setting up the constraints for the layout. What are some good ways to keep this under control, besides using a visual editor? ...

JavaDB connection error (network protocol)

I'm trying to connect to derby using this: dbProperties.put("create", "true"); dbProperties.put("dataEncryption", "true"); dbProperties.put("encryptionAlgorithm", "DES/CBC/NoPadding"); dbProperties.put("encryptionKey", "1234567890123456"); dbProperties.put("securityMechanism", ClientDataSource.STRONG_PASSWORD_SUBSTITUTE_SECURITY); // p...

Parsing wiki markup using a state machine

I would like to parse a simple grammar such as wiki markup using state machines. I have never written or played with one. I would like to lean how to implement a simple one. I am thinking of using Clojure for this. My question is can you point me to some good tutorials that are for complete newbies on this topic such as my self? ...

Distributed cache with expiration control in Java

The requirement is to cache a large number (100,000 to 1,000,000) of small objects and control the expiration of individual objects based on future events. There is no time component to the expiration. The cache must be available to a number of application servers (SpringSource dm Server) and ideally should be distributable and error t...