java

populating a jcombobox with database information

I know I am missing something simple, I think in getting the combobox to access the array. package my.freelancebillingapp; import java.sql.; import java.sql.Connection; import java.sql.DriverManager; import java.util.ArrayList; import javax.swing.; public class billingInfoUI extends javax.swing.JFrame { public billingInfoUI() { ...

Watch Date in Eclipse for Java Application

I have been trying to add to the Watch window a Java Date object (java.util.Date). Sometimes, when i hover over a Date in the source editor view, it shows the Date value in a readable format (e.g. 2009 Oct 26 14...) but sometimes, it just does not show the Date value but it only shows the declaration of the date variable/identifier. So a...

Tomcat App says "Unable to configure the logging system. No log.properties was found."

I have an embedded tomcat app and whenever I start it up I see this error printed to the console twice: Unable to configure the logging system. No log.properties was found. It seems stupid, but I've done some googling and searched stackoverflow and can't seem to find someone experiencing this problem. My main class Looks roughly lik...

jcombobox not loading values from an array

jComboBox1.setModel(customers); public class CustomerData { private static final String JDBC_CONNECTION_URL = "jdbc:mysql://localhost/test"; private static final String DATABASE_USER = "root"; private static final String DATABASE_PASSWORD = "root"; // query to select customer data private static final String SQL_FETCH_CUSTOMERS = "...

Inconsistencies in ASCII conversion of UTF-8 in Properties files

Does anyone know why native2ascii generates lower-case hex codes, while Properties.store() produces upper-case hex? Example: 保存 is encoded as \u4FDD\u5B58 when using Properties.store(), but is encoded as \u4fdd\u5b58 when using native2ascii Is there any way to control this? ...

Getting large file and folder icons on a Mac

This article says: At this time, there is no public API for getting larger file and folder icons from Java on a Mac. That was on Dec 2008 and for Java 1.5 Is there a way to access larger file folders from Java on a Mac in the latest release? ...

How to set VM for a java application in MAC OS X

I am setting my VM for my java application in windows using a batch file with following command: java -jar -Xmx800m "App.jar" Now I wanna do the same thing for MAC OS X? Any suggestions? ...

How to store files in Android's cache directory ?

My goal is store temporary files in the directory returned by Context#getCacheDir(). /data/data/my.app/cache/somedir/foo.json I presume I can just use java.io apis to write files there. But I'm not sure how to set permissions on files there because I would not be able to use Context#MODE_PRIVATE. The filename parameter to Context#ope...

Java: type safety, generics, .equals()

I'm trying to override equals() for a parametrized class. How can I make sure that this parameter is the same? /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) * Because this is commutative, `Tuple(a0, a1)` is the same as `Tuple(a1, a0)` */ @Override public boolean equals(Object obj) { if (this == obj) return true...

Learning Java Recursion, Ackerman function

I'm working on a recursive Ackermann function in Java. I am getting an error at may recursive line, 23. return Ack(m - 1, Ack(m, n - 1)); Thanks so much if anyone could point out what's wrong. -Kyle /*enter code here Ackerman's function, A(m, n) is defined: A(0 , n) = n + 1 for n >= 0 A(m , 0) = A(m – 1 , 1) ...

Markov Chain Text Generation

We were just assigned a new project in my data structures class -- Generating text with markov chains. Overview Given an input text file, we create an initial seed of length n characters. We add that to our output string and choose our next character based on frequency analysis.. This is the cat and there are two dogs. Initial ...

ResourceBundle.getString removed backslash character

I tried to get a resource from a file path from a properties file. Property File: info_path=c:\Info\output Java: String path = ResourceBundle.getBundle("bundle_name").getString("info_path"); Result: C:Infooutput I would need to set the file: info_path=c:\\Info\\output Is this the default behavior? or would it depend on the fil...

How do you create a DAO class for Seam / JPA (hibernate)?

Hi, I'm learning Seam and JPA/Hibernate and while I could find some examples on how to build a DAO class with Hibernate I'm a bit confused on how to do the same thing with Seam (or even if that is at all necessary). I do know that seam manages the transactions using its conversations so I don't (?) have to worry about committing / roll...

Any way of getting a set of all set pairs in Java?

Let's say I have a set with the following values: A, B, C, D. Is there an easy way of getting a set that contains AB, AC, AD, BC, BD, CD? In Ruby, I can do this directly with the combination function. Any suggestions on how to do this in Java? ...

What are the minimum requirements for writing a Java client for MQSeries?

I need to write a simple MQSeries client in Java. The client just has to connect to the queue and pull off the next message. I have done this before a number of years ago and have all the sample code etc. All I remember needing are the three jar files: com.ibm.mq.iiop.jar com.ibm.mq.jar connector.jar I have been doing some reading...

server side programming in java

how to write server side scripting and validation s in java by using servlets and jsp is there any reference site regarding to this.plesae help me . THAN Q ...

Root URl of the servlet

I want to get the root url of my web application from one of the servlet. If I deploy my application in "www.mydomain.com" I want to get the root url like "http://www.mydomain.com". Same thing if I deploy it in local tomcat server with 8080 port it should give "http://localhost:8080/myapp" Can anyone tell me how to get the root URL of...

How to find if system has attached webcam

Hi all, I want to know if the system has a attached webcam. How should i proceed? I want to do it with java language. ...

Configuring velocity within a tomcat web application. (Cookbook wanted)

Hi all, I have recently been introduced to the Velocity project. I have written a template and have run it as a simple Java application. Integration within my existing web project has not been that easy. Can anyone supply a cookbook for integrating Velocity and Tomcat? Thanks all! ...

Ignore System.exit() from other class

Given the class below, public class ClassOne { public static void main(String... args) { System.exit(1); } } The following class will be destroyed as well, assuming there are other things to do after ClassOne.main is invoked. public class ClassTwo { public static void main(String... args) { ClassOne.main(a...