java

Java: Timer and thread it creates

Hey. I have this question: I have a timer. With scheduleAtFixedRate it creates a new Timer task. In that timer task there is certain code, which may take a while to complete. How can I make sure that Timer won't create new task when the previous one didn't complete yet? Thanks ...

Quartz Java resuming a job excecutes it many times.

For my application i create jobs and schedule them with CronTriggers. Each job has only one trigger and both the job name and the trigger names are the same. No jobs share a trigger. Now when i create a cron trigger like this "0/1 * * * * ?" which instructs the job to execute every second, it works just fine. The problem rises when i f...

Linking a variable and a text box in Java

Hi, How can I link a variable and a text box in the simplest possible way? I.e. If the user changes the text box contents the variable changes and if the program changes the variable the text in the text box changes. N.B. I'm using the swing and awt libraries. Thanks in advance. ...

Passing data from request ManagedBeans in JSF

I'm somewhat confused about the lifecycle of ManagedBeans of type "request". In this example i'm using one request bean "userBean" to fill this page and one request bean "userEditBean" to fill the following edit page. <h:form> <h:panelGrid border="1" columns="2"> <h:outputText value="Name" /> <h:outputText value="#...

why is in place merge sort not stable?

The implementation below is stable as it used <= instead of < at line marked XXX. This also makes it more efficient. Is there any reason to use < and not <= at this line? /** class for In place MergeSort **/ class MergeSortAlgorithm extends SortAlgorithm { void sort(int a[], int lo0, int hi0) throws Exception { int lo = lo0; ...

Dreaded Could not reserve enough space for object heap

Im trying to get Solr up and running, at first I had the JDK.1.6 working fine, then tomcat running fine too. All of a sudden when trying to run Solr for the first time however I get the error message: [root@78 bin]# ./java -version Error occurred during initialization of VM Could not reserve enough space for object heap Could not create...

JPA mapping: Reusing entities in multiple relationships

Let's say I have: class Unit { private TextContainer source; private List<TextContainer> targets; } Can I annotate class TextContainer in such a way that it works within both relationships? TextContainer must be either source or target. ...

Dynamically binding lists with Spring's form tag

Hello, I have a command object FaxForm and it holds a list of FaxStatus objects inside a faxStatusList property. public class FaxForm { private List<FaxStatus> faxStatusList; public void setFaxStatusList(List<FaxStatus> faxStatusList) { this.faxStatusList = faxStatusList; } public List<FaxStatus> getFaxStatusList() { ...

Java Ajax WebApp - Tips and Pitfalls?

A coworker and I have started tech spec'ing a webapp project we're going to be working on together in our spare time. We've (mostly) settled on using: Eclipse for Java EE, ICEfaces (so that means JSF), Tomcat, Hibernate, MySQL. At work we use: IntelliJ IDEA, Struts, JSP, WebLogic, JDO, and Oracle. The only common solution we'll be using ...

Android + WS-* services ?

How to create an Android application with WS-* services connections? Where to get information for beginners - it should contain video tutorials and explanation what types of bindings are not supported. ...

How to change HTML tag content in Java?

How can I change HTML content of tag in Java? For example: before: <html> <head> </head> <body> <div>text<div>**text**</div>text</div> </body> </html> after: <html> <head> </head> <body> <div>text<div>**new text**</div>text</div> </body> </html> I tried JTidy, but it doesn't support ...

Which is the best way to implement a sparse vector in Java?

Which is the best way to implement a sparse vector in Java? Of course the good thing would be to have something that can be manipulated quite easily (normalization, scalar product and so on) Thanks in advance ...

Way of processing a string of plus and minus operations

Hello, I'm writing a java method that takes a string of plus and minus operations, eg "+1+2+3-5" and I want it to return an int of the answer. I'm trying to do this as efficiently as possible. I've tried the String.split() method, but it gets slightly confusing with the pluses and minuses. Can anyone help? No, this isn't homework. ...

Java GUI Builder.... do you know any?

Possible Duplicate: IDE for Swing Hi I'm looking for some java gui builder. I used Swing Designer from instantiations and it was pretty good, but I can't use it anymore since I don't want to pay for it and it's a pain to install on linux. Eclipse just won't access the site. I love netbeans, but I'm looking for something that wi...

Making Java version of Notepad and I have a problem

I am trying to load all types of files (like Microsoft Notepad). The SwingWorker I have can load normal text just fine but when a file such as mp3, pdf, etc. is attempted to be loaded I receive a NullPointerException. Can someone take a look at my code and possibly see why I keep getting this error for files such as mp3, pdf, etc.? Lik...

Unicode to string conversion in Java

I am building a language, a toy language. The syntax \#0061 is supposed to convert the given Unicode to an character: String temp = yytext().subtring(2); Then after that try to append '\u' to the string, I noticed that generated an error. I also tried to "\\" + "u" + temp; this way does not do any conversion. I am basically trying...

Java InputReader. Detect if file being read is binary?

I had posted a question in regards to this code. I found that JTextArea does not support the binary type data that is loaded. So my new question is how can I go about detecting the 'bad' file and canceling the file I/O and telling the user that they need to select a new file? class Open extends SwingWorker<Void, String> { File fil...

how to create a drop down menu java app on the desktop to hold desktop icons (java)

Hi all, I'm trying to create a java desktop application that holds desktop icons. The app will be a menu/panel that is invisible until you hover your cursor near the top of the screen, at which point the menu full of desktop icons will drop down. To add new icons to the menu one must simply drag icons from the desktop into the menu and ...

liberal xml parser for c# or java

I am looking for a liberal xml parser, one for java and one for C#, that can "properly" parse unquoted attribute values non-conjugated attribute like: <Person id=candy female single phone=555.666.7777 /> rather than <Person id='candy' female='true' single='true' phone='555.666.7777'/> ...

Displaying GUI components in Java

Hi guys I have a GUI window that I've created using Netbeans. I then ported the code into my own program so that I can display .png's at my will. However, the GUI components are not displaying, and the window opens up with no size by default. I need the window to initially open up with the GUI components visible, with the window of ...