java

Building a Java based stock trading application, need pointers for technologies to use

I am building an application in Java (with a jQuery frontend) that needs to talk to a third party application. it needs to update the interface every two seconds at the most. Would it be a good idea to use comets? If so, how do they fit into the picture? What other means/technologies can I use to make the application better? The appli...

Effective way to make a system tray application

Hello everyone, This is my first post on Stack Overflow and I'm just wondering on the options of making a system tray application. The application would run primary from the system tray while still operating, and could be brought up into a window when clicked on. It is also needed to have some support for global keystroke tracking, to b...

Is there a java sdk for cygwin?

Is there a java sdk for cygwin? ...

Most efficient way of converting String to Integer in java

There are many ways of converting a String to an Integer object. Which is the most efficient among the below: Integer.valueOf() Integer.parseInt() org.apache.commons.beanutils.converters.IntegerConverter My usecase needs to create wrapper Integer objects...meaning no primitive int...and the converted data is used for read-only. ...

How to detect an infinite loop in a recursive call?

I have a function that is recursively calling itself, and i want to detect and terminate if goes into an infinite loop, i.e - getting called for the same problem again. What is the easiest way to do that? EDIT: This is the function, and it will get called recursively with different values of x and y. i want to terminate if in a recursi...

Eclipse Plugin

I want to get notified when an editor is opened in Eclipse. What is the best way to do that? Thanks in advance. ...

Is it advisable to cast HttpSession as ClientSession in Java? What is the best practice?

The question is self explanatory I guess. This is what I am doing: Student student = Student.findStudent(s.getRegNumber(), (ClientSession)httpSesn); findStudent() method returns me an object of the Student class. As you can see I am casting HttpSession object into a ClientSession. Is it advisable? Are their any hidden snags involved? ...

Caching in J2EE application

I use JBoss AS. I have a long and heavy SQL that run inside the application server. I want to cache the results based on input parameters. I have a few options here: Use a caching manager and manually putting the results in the cache. Use a caching manager with loader that will "load" the results into cache when there's no results in ...

How do you detect the URL in a Java Servlet when forwarding to JSP?

I have a servlet that looks something like this: public class ExampleServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().println(request.getPathInfo()); } } with a web.xml mapping like: <servlet> <servlet-name>exampl...

Handling 'session expired' in JSF web application, running in JBoss AS 5

This question is related to my other question "How to redirect to Login page when Session is expired in Java web application?". Below is what I'm trying to do: I've a JSF web application running on JBoss AS 5 When the user is inactive for, say 15 minutes, I need to log out the user and redirect him to the login page, if he is trying to...

Encoding issue in Java

I have a CSV file that contains both ASCII & Unicode characters. say "ÅÔÉA". I am not sure abt the encoding format of this file, but when I open it in Notepad, it shows "ANSI" as its encoding standard. I fetch these contents of CSV in UTF-8 encoded format. fr = new InputStreamReader(new FileInputStream(fileName),"UTF-8"); but when I ...

number of periods (custom) between two dates

I want to find out how many periods (custom) are there between two dates. Like how many weeks are between 1 july to 2nd Aug or how many half months are there between 2 nd Juy and 14 Dec, where in half month would be customizable whether it ends on 15th or 16th. IS there any library where this or something similar has been done? Not tha...

Scala's existential types

A bit more specific than this question, can someone tell me what is the difference between Scala's existential types and Java's wildcard, prefereably with some illustrative example? In everything I've seen so far, they seem to be pretty equivalent. Edit: A few references. Martin Odersky mentions them; Google's top hit for my question ...

what is the best practice to create a .jar file from a java project??

what is the best practice to create a .jar file from a java project?? ...

Simultaneous Java and Scala development within the same project

I want to leverage the Scala's Actor Framework while I develop the user interface in the familiar Swing way. Is it possible to have a mixed Java - Scala project in Eclipse, NetBeans or any other IDE? ...

multi threading

hi....i m doing a client-server application in which there are multiple clients and they are controlled by a single server.... here i m capturing screen of all clients and i want them to send towords server...so it requires multithreading.... so can anyone tell me how can i use multithreading in my application...? ...

Authenticate linux based user in java

Hi all, I have a username and password for a particular user in Linux i need to verify that if the user is valid or not using java? Abdul Khaliq ...

How can I set WindowState in Struts bridge based portlet links?

I am developing a JSR-286 compliant portlet based on struts 1.2.9 (for historical reasons we want to reuse a lot existing code) using the struts portlet bridge. I want some links to change the WindowState, but the FormTag and LinkTag provided by the portal bridge don't have an easy way to set the WindowState. I'm happy to extend these tw...

Indexing properties files

I need to index a large number of Java properties and manifest files. The data in the files is just key-value pairs. I am thinking to use Lucene for this. However, I do not need any real full-text search capabilities, as the data is quite structured. I only need to search for exact matches of property values, and the property key is a...

How to exclude jars generated by maven war plugin ?

Because of transitive dependencies, my wars are getting populated by xml-apis, xerces jars. I tried following the instructions on the reference page for maven-war-plugin but it is not working. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <packagingExclud...