java

Insert Image into Excel - Java

Hi, I am working on a java web application where i have to show an image on excel file. i used the java file iopo to write the image to the excel file. Issue is when the user mail this to client the image does not show up Is there any way to embed the image into the excel file using java with/without using any external API. Thanks & ...

Maven2 & Swing projects: Build & run swing application

I tried to find info on how to use maven to build and run a swing application but couldn't find anything useful (maven documentation is a mess). Can someone point me to relevant documentation? Is anyone using maven in swing development ? ...

Modify HttpServletRequest body

I'm working on legacy code and need to make a patch. The problem: an ancient application sends bad HTTP POST requests. One of the parameters is not URL encoded. I know that this parameter always comes last and I know it's name. I'm now trying to fix it on the server side which is running inside tomcat. This parameter is not accessible ...

How would I map this Delphi function with JNA

I have the following Delphi function: function DoX(const InputBuffer: Pointer; const InputBufferSize: longword; OutputBuffer: Pointer; var OutputBufferSize: longword): longbool; The OutputBuffer and OutputBufferSize would be set in the function as part of the result, with a boolean return to indicate whether the method was successful ...

Using an enum as a mapkey results in a RAW in the database

Hi, I'm trying to use an enum as a mapkey for a map in Hibernate, but Hibernate stores my enum as a RAW: I have this enum: public enum AccountType implements Serializable { CASH, CREDIT_CARD, GIRO, INVOICE, OTHER; } Which I'm trying to use as a key in a map: @CollectionOfElements @MapKey(columns = @Column(name=...

Java Web Starter AMI

I'm trying to follow the tutorial on http://ttlnews.blogspot.com/2009/01/setting-up-amazon-ami-with-java-and.html but can't find the Java Web Starter AMI (ami-1c54b075) when searcing for AMI in the AWS console. Anyone now why this could be? It seems to be one of the most popular AMIs as well (see infobox on the right side), so seems stra...

How to find unit tests not part of any suite?

With JUnit 3, if you forget to add a test to a suite, it will not get run. How can I find all JUnit test cases that are not part of our top level suite, or any suite it recursively contains? ...

Eclipse commands

What is the difference between Ctrl + Shift + R and Ctrl + Shift + T? Do we have a blog with all eclipse tips/shortcuts? ...

Equivalent of IllegalArgumentException of Java in C++

In Java if an input argument to a method is invalid, we can throw an IllegalArgumentException (which is of type RuntimeException). In C++, there is no notion of checked and unchecked exceptions. Is there a similar exception in standard C++ which can be used to indicate a runtime exception? Or is there a common style not in the standard b...

When does a java object become non-null during construction?

Hi, Say you are creating a java object like so: SomeClass someObject = null; someObject = new SomeClass(); At what point does the someObject become non-null? Is it before the SomeClass() constructor runs or after? To clarify a little, say if another thread was to check if someObject was null while the SomeClass() constructor was hal...

Why am I getting this NullPointer exception?

Two tables, primary key of one is foreign key of another (Legacy DB) I used bi-directional one to one mapping: @Entity public class First { @Id protected int a; @OneToOne(mappedBy ="first", cascade = CascadeType.PERSIST) @JoinColumn(name = "a") protected Second second; } @Entity public class Second { @Id protecte...

JcomboBox has no border?

When my program starts up, the comboboxes (there are 2 that are having this problem) do show up. However, when I click on the arrow one item (there should be 7 items showing) shows up and there is no border around the list. If I drag my mouse over the area all the other items appear, but still no border. This is only happening at our w...

Executing command line programs from Java

I have to execute several command line executables in Windows through Java. Rather than using Runtime.exec, I thought of using Ant Tasks to do these invocations, hoping it would be a better way. Is there any other better approach or any popular library to do this? ...

Which is the right way to create an instance of Generic class in Java?

When initialising an instance of a Generic class in Java is there any benefit to specifying the Type on both sides of the statement? Or to put it another way, what's the difference between these two valid statements: ArrayList<String> test = new ArrayList<String>(); and: ArrayList<String> test = new ArrayList(); (It seems second s...

How to get started with Java web development?

I know Java and i've built some stuff with Swing. However, how can I do web development in java? I'm used to PHP/MySQL and I have Apache installed on my dev machine. How can I get it to run java servlets? And also, which database is the best for Java web dev? I'd still prefer to use MySQL. Please give me some steps I need to take to be ...

Change the root of a ZipEntry?

Hi, My project has a few xml templates that were modified and added to a zip file. The problem was that the templates were all in a template folder but the expected format of the zip file was to have them straight in the root. project hierarchy: templates/blah.xml expected zip file hierarchy: blah.xml Anyway of achieving that without...

Java inheritance - added methods

Hi all, I want to have a base class, BaseConnect, which contains an OutputStream and children classes ObjectStreamConnect and DataStreamConnect. In my BaseConnect class I have OutputStream os; And in my Two children classes I have the constructors that do "os = ObjectOutputStream(...)" or "os = DataOutputStream(...)", respectively. ...

How do I create a velocity template that outputs two '#' litterals at the beginning of the line?

I need to create a velocity document that has some lines prefixed with ¨## Foo", but since the # is the velocity directive command, it is not working for me. What I want my output document to look like: ## Foo this ## Bar that k1, v1 k2, v2 k3, v3 Escaping has not worked out how I expected. The below does not work, obviously, as the...

trying to store java objects in contiguous memory

Hi all, I am trying to implement a cache-like collection of objects. The purpose is to have fast access to these objects through locality in memory since I'll likely be reading multiple objects at a time. I currently just store objects in a java collections object like vector or deque. But I do not believe this makes use of contiguou...

Return ROWID Parameter from insert statement using JDBC connection to oracle

I can't seem to get the right magic combination to make this work: OracleDataSource ods = new oracle.jdbc.pool.OracleDataSource(); ods.setURL("jdbc:oracle:thin:app_user/pass@server:1521:sid"); DefaultContext conn = ods.getConnection(); CallableStatement st = conn.prepareCall("INSERT INTO tableA (some_id) VALUES (1) RETURNING ROWID INTO...