java

How to collect spring properties from multiple files for use on a single bean

I haven't gotten my head wrapped around Spring yet, so correct me if this question doesn't make sense... I have a PropertyPlaceholderConfigurer <bean id="rdbmPropertiesPlacholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" lazy-init="false"> <property name="location" value="classpath:/properties/...

Using IntelliJ IDEA 8 for IDEA 6 Projects

A customer of mine is using IDEA 6 for their project and I'd like to use IDEA 8. I know that IDEA 8 gives the option of upgrading the project or keeping it in the v6 format. If I use IDEA 8 but keep it in v6 format, will this give any grief to the the IDEA 6 users? ...

How to Daemonize a Java Program?

I have a Java program that I'd like to daemonize on a linux system. In other words, I want to start running it in a shell and have it continue running after I've logged out. I also want to be able to stop the program cleanly. I found this article which uses a combination of shell scripting and Java code to do the trick. It looks good, b...

How to store an object instance as a field of an EJB3 entity?

I have an entity Promotion, which has 3 simple fields (id, name, description) and all 3 will be mapped to DB. So far so good. Problem is with the 4th field, ruleModel, which is an instance of RuleModel and when constructed at runtime, it will contain object instances of a dozen other classes. I don't want to map RuleModel to a DB table, ...

Catching exceptions in Java

Hello, There are certain predefined exceptions in Java, which, if thrown, report that something serious has happened and you'd better improve your code, than catching them in a catch block (if I have understood it correctly). But still I find many programs in which I have the following: } catch (IOException e) { ... } catch (FileN...

Storing a 2 dimensional table (decision table) in XML for efficient Query(ies)

Hi, I need to implement a Routing Table where there are a number of paramters. For eg, i am stating five attributes in the incoming message below Customer Txn Group Txn Type Sender Priority Target UTI CORP ONEOFF ABC LOW TRG1 UTI GOV ONEOFF ABC LOW TRG2 What is the best way to represent th...

ruby thread programming , ruby equivalent of java wait/notify/notifyAll

I would like to know what are ruby's alternatives to the Java methods : wait notify notifyAll Could you please post a small snippet or some links ? ...

Why is the end of the input stream never reached using Java Sockets?

I am writing a simple proxy in Java. I am having trouble reading the entirety of a given request into a byte array. Specifically, in the following loop, the call to 'read' blocks even though the client has sent all the data that it will (that is, the end of stream is never reached). As I can't be sure that it is time to start writing ...

Unix epoch time to Java Date Object

I have a string containing the UNIX Epoch time, and I need to convert it to a Java Date Object. String date = "1081157732"; DateFormat df = new SimpleDateFormat(""); // This line try { Date expiry = df.parse(date); } catch ( ParseException ex ) { ex.getStackTrace(); } The marked line is where I'm having trouble. I can't work o...

Best Approach for Cloning database records using SPs

Hi, I have to write code to clone a database entry with associated data in other tables and assign it a new ID. Simplified I have a MAIN Table with a key of ID and sub table say SUB1 with FK of ID and multiple records for each entry in MAIN. I want to copy the data for a specific ID in MAIN to new records updating the ID to a new value...

Take string "asdxyz\n" and replace \n with the ascii value

I dont want to replace it with /u000A, do NOT want it to look like "asdxyz/u000A" I want to replace it with the actual newline CHARACTER. ...

About bug details

Hi, i'm begginer in java while running the java application i got below mentioned bug.why this bug has occured? plz reply thank u # # An unexpected error has been detected by Java Runtime Environment: # # Internal Error (exceptions.cpp:367), pid=2552, tid=2532 # Error: ExceptionMark destructor expects no pending exceptions # # Java V...

Classic Singleton implementation in OCaml

I am attempting to conceptualize the Singleton design pattern (qua Java) in OCaml and have seen ever instance allude to functors or modules, neither of which I am using in a proof of concept of GoF's work. Basically, I would like to recreate the following functionality using OCaml: public class Singleton { private static Singleton Uniq...

How to Overwrite the file saved in the Context Directory...

I created two files 1)index.html 2)player.jsp I am using Tomcat Server. In the index.html i created some checkboxes in a form and assigned the values... After clicking submit i forwarded these values to player.jsp... In player.jsp i dynamically generated an xml file named "generate.xml" . This XML file changes according to the user requ...

C# Equivalent of Java anonymous inner classes with init blocks

In Java, i like to use constructs such as List<String> list = new ArrayList<String>() {{add("foo");}}; Is there a way to do this in 1 line in C#, too? ...

Java sockets with out of band data

Does anybody know how to receive (how to know that you received) out-of-band data with Java sockets? In particular I've read the documentation for sendUrgentData and setOOBInline which states that: Note, only limited support is provided for handling incoming urgent data. In particular, no notification of incoming urgent data is provi...

Do I have to include libs in every tile within Apache Tiles?

I am using Tiles within my web-application. I have a standard-layout (standard.jsp) within the tiles are used. On top of the standard.jsp are a lot of includes, concerning tag-libraries and such. Let's do a simplified example. standard.jsp: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ inc...

Pausing in between Retries of Network Connections

Im am writing an application for the JBOSS JEE-Server. I would like to have the DB-access code quite robust. Thus I have created retry loops so that the request won't fail because of temporary network problems. Now I would like the execution of the request to pause in between retries. The server thread has been spawned by a request to a...

is there any java mobile games builder for non programmers ?

is there any tool in the market that support making games for mobile java , for none programmers ? i need to find out what is the best and fastest way to do that , before we plan to build such tool this is for simple games only .. to be add-on to our main product Thanks ...

Doubt in Java Service wrapper while running jar application fom window service

Hi All: I have a jar application which process n converts file into csv file. I have made it to run in windows service using Java Service Wrapper. It got installed my jar application successfully when i run "InstallApp-NT.bat" file and starts running my application when i run "app" command. But when i try to start the service in services...