java

java exception chaining question

Hi all, Imagine I have the methods: public static void funcA() {...} public static void funcB() { byteBuffer.wrap(someByteArray, 0, someByteArra.length); } IN JAVA API: public static ByteBuffer wrap(byte[]array, int offset, int length) { try { return new HeapByteBuffer(array, offset, length); } catch (IllegalAr...

Process the file before uploading it

I got a form with SWFUpload. Files uploaded to the server are converted server-side (video being compressed, images being resized etc) Question is - can i delegate some of the functionality to client-side (like image resizing), to save some bandwidth for user. ...

Java: how to clone ArrayList but also clone its items?

Hello, How can I clone Array List but also clone its items in Java 1.5? For example I have: ArrayList<Dog> dogs = getDogs(); ArrayList<Dog> clonedList = ....something to do with dogs.... And I would expect that objects in clonedList are not the same as in dogs list. Thanks for any answer! ...

JSTL format tag?

I have a custom java.text.Format and would like to use it in my JSP. Is there a JSP/JSTL tag that can format an object using a custom java.text.Format? I'm looking for something similar to <fmt:formatNumber> and <fmt:formatDate> except that an custom format can be used. I know that I can write my own tag but am curious if there's an exi...

Java: synchronizing threads across multiple servers

I have a problem where I need to synchronize processing for multiple threads across multiple different servers for a Java service on Windows. In this application, I have multiple consumer threads pullings messages off the same JMS queue. Messages come in in groups of 3 or 4, and I need to make sure the messages in each group are proces...

connecting to database through network using java application

hey guys can you please help me again, i want my restaurant system to connect to database through network i.e. when waiter place order using handheld computer(PDA) and sending it to chef, so i want all data to be saved in database via network. i'm using java for this system. ...

Using dependency injection in a library

I'm writing a java library that will be used by an existing application. I'm using dependency injection so testing is easier, and I'm familiar with Spring so I was planning to use it to manage the dependency injection while testing. The applications that will eventually use the library are not Spring-based, however, nor does it use any...

JavaDB connection issues; database not found

I am having a problem with Java DB that I just don't know how to resolve. I am creating a DB and connecting to it using Java DB's native JDBC driver. If I relocate that database physically and try to connect to it using its new path, I consistently get XJ004 errors: ERROR XJ004: Database 'blahblah' not found. I am sure I am using th...

Java Command line arguments

I am trying to detect whether the 'a' was entered as the first string argument. ...

Get mode value in java

Any know how can I get the mode value from an array? For example, if I have a array with difference number, how can I use Java to search out which number is appears the most? ...

Hibernate, iBatis, JEE or other Java ORM tool

We're in the process of planning a large, enterprise application. We're focusing our efforts on evaluating hibernate after experiencing the pains of J2EE. It looks like the new JEE API is simpler. I've also read some good things about Hibernate and iBatis. Our team has little experience with any of the frameworks. There are 5 main co...

How to transition from embedded software development to web development?

Hello, I am an embedded software developer with about 5+ years of experience working on mobile devices. I recently lost my job and most of the jobs in the embedded field (that I came across) require security clearance and I am not eligible for that. So, for this reason and also just to learn something new, I am planning to move to web d...

Array or List in Java. Which is faster ?

I have to keep thousands of strings in memory to be accessed serially in Java. Should I store them in an array or should I use some kind of List ? Since arrays keep all the data in a contiguous chunk of memory (unlike Lists), would the use of an array to store thousands of strings cause problems ? Answer: The common consensus is that t...

Java tcp socket server with j2me client socket

Hi, I want to create java server socket and j2me client socket which can communicate with each other. Does anyone know? Can any one send me the code if done. or any link. Thanks Bapi ...

Recursive data processing performance using Java and SQLite

If you have an answer that is not Java / SQLite related, I'd be pleased to read it. The environment I store items in a database with the following scheme : ################### # Item # ################### # _id # This is the primary key # parent_id # If set, it the ID of the item containing this ...

Disable Struts converting HTML tags into entities

Hi I'm using Struts 1.2 and I installed TinyMCE. The problem is that struts is converting all HTML tags into entities. How do I disable or configure this to allow only selected tags? ...

Applying a regular expression to a Java I/O Stream

I seek an example of applying a regular expression to a Java I/O stream that doesn't simply convert the stream to a string as I would like to preserve binary data. Most of the examples on the Internet focus on text data... ...

Java Web Services

Where can I find good Java web services practicals and tutorials (I'm a newbe to JWS so I prefer from the scratch). Thanks. ...

efficient java object graph serialization

What is the best approach for serializing java object graphs? My requirements for serialization library are 1) speed of deserialization 2) size - as small as possible (smaller than in java default serialization) 3) flexibility - annotation based definitions of what has to be serialized would be nice. the underlying file format is not i...

Why not always use ArrayLists in Java, instead of plain ol' arrays?

Hi all, Quick question here: why not ALWAYS use ArrayLists in Java? They apparently have equal access speed as arrays, in addition to extra useful functionality. I understand the limitation in that it cannot hold primitives, but this is easily mitigated by use of wrappers. Thanks! :) ...