java

java ResultSet, using MAX sql function

Hello here is what I want, I connect to a DB and retrieve the biggest element of the UniqueId column, and assign it to an integer variable named maxID, here is my approach: int maxID = 0; Statement s2 = con.createStatement(); s2.execute("SELECT MAX(UniqueId) FROM MyTable"); ResultSet rs2 = s2.getResultSet(); // while ( rs2.next() )...

Integrate applications using multiple programming languages into a Java application

Is there an open source application that could integrate applications using multiple programming languages into a Java application? ...

JTidy upgrade broke document xpaths

I just updated to the newest version of jtidy which came out in october and it seems to have broken my document object for unknown reasons. This is my code: tidy = new Tidy(); tidy.setShowWarnings(false); tidy.setShowErrors(0); tidy.setQuiet(true); tidy.setMakeClean(true); URL url = new URL(url_string); Document doc = tidy.parseDOM(url...

It it necessary to learn J2ME for Android or iPhone development?

I want to learn mobile programming, specifically Android or iPhone programming, but not sure if it is necessary to learn J2ME before working with Android or iPhone. I know only core Java (and OOP concepts very well). I need your suggestion, especially if any one working in mobile development field. Hoping for favorable reply...! Thanks....

Convert the following C# code into java code?

I have the following C# code and I want to have a Java code equivalent to this. The following C# code is from this answer to another StackOverflow question. The code is as follows: string orkutSite = "http://www.orkut.com/Login.aspx"; // enter correct address string formPage = ""; string afterLoginPage = ""; // Get postback data and c...

Aborting ViewGroup if a condition is not met ?

My custom ViewGroup expects a certain number of strings for an array specified in arrays.xml. I want the app to stop if that condition is not met. What is the best practice for this? Should I just throw an IllegalStateException from the ViewGroup constructor ? public MyViewGroup( Context context, AttributeSet attrs ) { super( contex...

How can I simulate a turing machine?

I don't quite understand the whole idea of a turing machine thing. I am currently tasked with making a busy beaver turing machine. But the thing I don't really get is it simulates input. So what kind of input do I simulate? For example, it's asking me how many 1s the 3 states busy beaver machines writes on tape? I'm sure I need to write...

Can java.util.logging be configured to use compressed log files?

Is it possible to configure java.util.logging to compress log files when it "rolls" onto using a new log file? For example, an extract from my log configuration file looks like this: java.util.logging.FileHandler.level = ALL java.util.logging.FileHandler.pattern = /blah.log java.util.logging.FileHandler.limit = 10000000 java....

In what situations is static method a good practice?

I have read the following discussions: http://stackoverflow.com/questions/538870/java-static-methods-best-practices , and http://stackoverflow.com/questions/658407/static-methods It seems that people in general would accept static methods, but are a little bit skeptical about it, for the following 2 reasons: They are hard to test. Th...

How to get a "ribbon" UI component, like in Office 2007, in a Java program?

I want to create a ribbon-based GUI. I am pretty much a newbie when it comes to Java interfaces, I have used the basic Swing toolkit, but that's it. Can anyone point me in the right direction regarding what to do to get more flexibility with my UI and in particular being able to create a "ribbon"? ...

Useful velocity gadgets

There are lots of interesting JSP tag libraries. I wanted to know what good Velocity gadgets or libraries or resusable components are out there. Please one per answer. ...

Alternate of C# Events in Java

hi. I am .Net developer. i want to know that is there any event handling mechanism in Java for Events Handling like C#. what i want to do is i want to raise/fire an event form my class upon some condition. and consumer of this class should register that event and write event handling method. this can be done easily in C#. i have to im...

Spring: can ResourceBundleMessageSource be configured to load properties in xml format

As you may know, properties are usually written in files in key=value format but can also be written in XML format. The question is if (and how) can Spring's ResourceBundleMessageSource be configured to load properties in XML format. ...

How can IE lose ability to execute Java applets?

I have an applet which is used on our company intranet. From time to time there are users who are suddenly no longer able to use the applet and they get an error message. I notice that the browser (IE6) no longer displays the Tools->Open Java Console menu. Java 1.5 is still installed and I can open the Java settings dialog from the Cont...

coordinates system problem with jogl

Hi, Currently I am developing an application in Jogl(My first application actually). Frist I have to load model into the canvas from a .obj file.(I manage to do so). Next is I have to use the mouse dragged event to draw stroke on the same canvans and it the stroke must be in front of the teapot.(I use GL.GL_LINE_STRIP)and (glu.gluUnpr...

Using managed-property with CommandButton in Java Server Faces

In addition to my question "Creating an “Edit my Item”-page in Java Server Faces with Facelets" I would liek to cover an issue that this provided. When I press the commandButton the ID=100 is removed and the page is refreshed, and this is Before it even runs the method, right, so this means that I do not have the ID when i press the but...

ibatis in/out parameter problem

Can anyone tell me what's wrong? I have two procedures and two mappings for them. One works fine and another fails. This one works fine: <parameterMap id="mapping-descriptions" class="java.util.Map"> <parameter property="id" javaType="java.lang.Long" jdbcType="NUMBER" mode="IN"/> <parameter property="lang" javaType="java.l...

Java class can be run by double click but not task scheduler

Java class in *.bat can be run by double click but not task scheduler. What's the problem? Classpath or something else? What should I do? ...

Java: Why doesn't my string comparison work?

Ok, this is stupid, but wtf is going on? I have a String variable in a servlet, which takes the value of a parameter and based on that value I make a test to do something, but the if is not working. What is the problem? String action = request.getParameter("action"); System.out.println("Action: " + action); // I put 2 ifs to be su...

How to use some configuration file for JEE servlet?

I need to access some files on servers from servlet. They have different paths on my development machine and on the deployment server. I would like to put some config file (with paths) somewhere (like shared dir in capistrano deployment) so application could read it. Or maybe set some property on the application server or anything like t...