java

Cannot Delete File Within A Child Process Started From A C# App

How do I invoke a child process from C# with UseShellExecute set to false and allow file deletion? The child process is a java program creates a 0 byte file, transfers it to a remote server, and deletes it. This functionality works when I execute the java program from the Windows command line. If I invoke the java program from C# usin...

Deleting Objects with JPA with Foreign Key Constraints

I have a two classes, Service and Customer, with a many-to-one association from Service to Customer. I want to delete a Customer and any Service that references it. I'm using JPA as the ORM (with Hibernate underneath) attached to a PostgreSQL db. It'd be great if I could define the association in such a way that deleting the Customer wo...

any experience with "Play" java web development framework?

I've just stumbled upon the following new java web framework: Play http://www.playframework.org/ http://www.playframework.org/documentation/1.0/home with such a stunning list of features, I'm pretty much surprised I haven't heard of it before... Sounds like the java web development promised land... has anybody tried it? any real exp...

Do autoboxing and unboxing behave differently in Java and C#

I am manually converting code from Java (1.6) to C# and finding some difficulty with the behaviour of primitives (int and double). In C# it appears that almost all conversions happen automatically List<double> list1 = new List<double>(); // legal, C# double d0 = 3.0; list1.Add(d0); // ...

Is this possible to do with images in java?

Hi. Is there any way I can print/show images on top of each other. The picture on top will always be positioned a little lower so that the one under will show partially. How can I decide which image is on top of what image? What layout lets me do this kind of positioning? Is there any way that I can make a border appear on the image wh...

Set PDF title with Java and FOP

Hi, I'm generating some PDF files using Apache FOP v0.94. Can you please tell me how to set the PDF Document Properties like Title, Author, Keywords etc programmatically? Googled a bit but didn't get any useful information. Thanks in advance... ...

How is server-side javascript used/implemented?

I'm aware of server-side javascript for a long time now, but I don't have a clue about how it works. Could someone point me in the right direction? I'm interested in how to use server-side javascript + Java Servlet technology EDIT Great! I have seen those technologies before, but for some reason I didn't associate them with "server-...

help with log4j.xml

I have a dilemma configuring my log4j.xml (attached below) for the Quartz web-app. It is spitting out log messages to stdout (which my Tomcat instance then logs) for INFO reported by Quartz's LoggingJobHistory plugin. It is using the "stdout" appender defined below; I can tell this because I put the "ZZZ" there and it makes its way int...

WSContext.getUserPrincipal() returns null for password digest authentication

In my WebService I need to log the caller's id, but wsContext.getUserPrincipal() returns null even though the user was authenticated using WS-Security with password authentication. According to the JavaDocs for JAX-WS 2.1 WSContext.getUserPrincipal() should only return null if the user has not been authenticated. Do I have to do someth...

Closing db file when using Tokyo Cabinets Java bindings

I'm writing a small Java-based server around Tokyo Cabinets JNI-bindings, and I am a bit confused regarding opening and closing of the db file. The server is multi-threaded, and I'm therefore wondering if it is best to open the db file upon start-up and then let the threads use get/put unsynchronized (I think that the tokyo docs state th...

What is a good emeddable language for an existing Java application?

I want to embed a dsl or existing full language within my application. It should be a simple, full Turing complete language but simple and light enough that the code can be interpreted without too much overhead. Also the other "processes" can't effect any other process. I was considering using Clojure and invoking the Clojure interpret...

Removing rows from a DefaultTableModel with a RowSorter attached doesn't remove last row

I'm somewhat new to Java, and especially new to tables, and I'm having a bit of trouble with one particular task. I have a JTable that uses a custom table model that extends DefaultTableModel, and I've attached a TableRowSorter to the table. The sample application below has two buttons--one will load rows into the table and one will re...

creating a super simple table applet in java

Hello All, I'm trying to create an applet which displays a simple table with no headers or other decoration. Could anyone be so kind as to show me the code for this? All the examples I've found haven't compiled or have included extra features which I don't need. A simple 2 x 2 table with empty cells and no headers is what I'm looking for...

broken img tag with JEditorPane / ListCellRenderer

I have this code in a ListCellRenderer which extends JEditorPane. The editor pane doesn't show the image, but instead shows a 'broken icon'. What's wrong with it? public class TweetCellRenderer extends JEditorPane implements ListCellRenderer { public Component getListCellRendererComponent( javax.swing.JList list, Ob...

Starting with Java recursion (probably an easy ? for most)

Hi I am working on the following problem: Write a recursive function that calculates the sum of the negative numbers of the array. Pass in the array {15 , -7 , -19 , 8 , 5 , -6 , -1} from the main method . The recursive function should return the result -33 . Print out this value in the main method. This program should be named Negsum....

MD5 Hash Issue with Java.

A java implementation creates two different digest for a same input string, if i run as stand alone application or running inside a web application. The standalone application matches with oracle dbms The implementation is MessageDigest md5 = MessageDigest.getInstance("MD5"); if (md5 != null) { md5.reset(); ne...

Use of helper/utility methods in a Factory class

I have a question about the usage of "utility/helper" methods in a factory class. Consider an example of an XML string that reprents a document. I have a class that transforms it to an "object" (say PDF, Word, CSV, etc.). I have a factory class (lets call it DocumentFactory) that accepts this XML string and based on certain rules gives b...

How to return names in alphabetical order?

I have two names from a user. I want to compare them and display them in alphabetical order. I tried the compareTo method, but that only returns an int. EDIT: Answer found! Thanks again guys! ...

Are primitives different in java and c#?

I am manually converting code from Java to C# and struggling with (what I call) primitive types (see, e.g. http://stackoverflow.com/questions/1597154/do-autoboxing-and-unboxing-behave-differently-in-java-and-c). From the answers I understand that double (C#) and Double (C#) are equivalent. double (C#) can also be used in containers, e.g...

How to reverse a string

I need to reverse the string of a user's input. I need it done in the simplest of ways. I was trying to do reverseOrder(UserInput) but it wasn't working. For example, user inputs abc I just take the string and print out cba ...