java

Are escape sequences preserved in CLOB??

We are using Java and Oracle for development. I have table in a oracle database which has a CLOB column in it. Some XYZ application dumps a text file in this column. The text file has multiple rows. Is it possible that while reading the same CLOB file thru Java application, the escape sequences (new line chars, etc) may get lost?? Re...

Read from one large file and write to many (tens, hundreds, or thousands) files in Java?

I have a large-ish file (4-5 GB compressed) of small messages that I wish to parse into approximately 6,000 files by message type. Messages are small; anywhere from 5 to 50 bytes depending on the type. Each message starts with a fixed-size type field (a 6-byte key). If I read a message of type '000001', I want to write append its payloa...

Java Date Format Helper Text Localized For UI

Maybe I'm going about this all wrong but here goes... I'm trying to allow users of my Portlet app to input a date in whatever their localized format would normally be. I plan to parse the string date using a SimpleDateFormat object based on the user's current Locale on the backend. I'm pretty sure that part will work (right?) but I'm ...

java: using regex to parse repeated substrings

This is specifically aimed at parsing hex bytes, but there's a more general question here. Suppose I have a regexp r e.g. \\s*([0-9A-Fa-f]{2})\\s* (optional spaces, 2 hex digits that I'm interested in, and optional spaces). If I want to parse a string s with this regexp such that: if s can be divided into a sequence of blocks that m...

does java have a concept of a console app?

Just downloading eclipse (finally!), and curious if Java has the concept of a console application like c# so I can quickly test my skills out etc. ...

What would be a best way to notify an application (C++ or Java) when underlying DB changes?

I'm writing a C++ console application that needs to respond to a change in a specific field of a database table. Though I can keep sending a query to check the field periodically, I'd like to avoid this because multiple instances of this application might be running. I have heard of the Query Notification feature of SQL Server 2005 but i...

learning java the "right way", any book that goes over DI, loosely coupling, writing testable code?

I'm comfing from the .net world, and want a book that goes over the 'right' way of coding. things like dependancy injection, loosely coupling of objects, how to layout your web application properly, unit-testing etc. ...

When is it OK to catch a RuntimeException

On a recent project I recommended catching a RuntimeException within a test harness code and logging it. The code processes a series of inputs from a database and I do not want the test to stop due to failure of any one input (Null values, Illegal arguments etc). Needless to say, my suggestion triggered a passionate discussion. Is catc...

JBoss RMI Transaction

Hi, How can i can achieve remote transaction while using Remote EJB (over RMI/IIOP or RMI/JRMP). Is that JBoss 4.0 support this kind of transaction or should i use jotm or atomikos? Thanks in advance ...

What's the point of this synchronization?

What is the point of the synchronization here? Why not just use: mConnectedThread.write(out); ? The code snippet is from the BluetoothChat sample for Android (found here) http://developer.android.com/resources/samples/BluetoothChat/index.html /** * Write to the ConnectedThread in an unsynchronized manner * @param out The bytes to...

Java JTable object with multiple fields

I have an object that has X number of fields. Each row in my JTable corresponds to one item. Each column in the row represents a field for that item. I also need to maintain a reference to the item (the item has a unique ID field as well) so I can determine the item in the selected cell. Would the preferred approach to this be putting t...

Is it possible to peek() at the elements of a Java ConcurrentLinkedQueue

Hello I have a program which has multiple objects of type PublisherTask and SubscriberTask. A given subscriber can be subscribed to one or more Publishers. To describe my problem I will post some code.... abstract class Publication { // some published information } class ConcretePublicationA extends Publication { } class Concrete...

How to generate a Java call graph

First time poster. I'd like to analyze and understand a certain Java app and I think a call graph would be very useful. How do I generate one? I'm using Eclipse. Thanks. ...

Send JNI C stderr/stdout through log4j

My java app uses JNI to invoke a library written in C. This native library logs errors to stderr but I would like to redirect the error stream through my log4j logger somehow. Is this possible? The C library is external - I don't have the source, so cannot change it. Thanks ...

Uploadify and JSP/Java servlet

I just started working with Uploadify with our Java/JSP Applications and for that I use a servlet instead of the upload.php to do the upload to the server. I was wondering if there is any servlet example ?? or anyone has additional info for those of us that use JSP instead of PHP? I follow the example but it doesn't seem to do anything...

Which sorted collection implementation has the smallest memory footprint in Java?

I'm not unduly bothered about read/write performance (though obviously as fast as possible is always good), rather I'm looking for a sorted collection implementation that is as memory efficient as possible. Any suggestions? ...

Basic home work question what am I doing wrong.

/* Method: findName() */ /** * Finds the name of the entry and sets it to the name variable. */ private void findName(String line){ end = line.indexOf(" "); name = line.substring(0,end); } /* Method: findDecades() */ /** * Finds the name of the entry and sets it to the name variable. */ private void findD...

Hibernate - Entity Manager Factory

Hi all, I have been recently running into an issue in which my web application will not start properly and the stack trace doesn't indicate exactly what happened. I have been able to isolate it to an event listener that I wrote. Whenever I attempt to activate it, I get a very generic exception: org.jboss.seam.InstantiationException: ...

Strange behaviour of TableRow as a LinearLayout

Hello everyone. I've noticed a strange thing with a TableRow. <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="0"> <TableRow android:background="#9932cc" android:minHeight="40px" android:orientation="h...

Please discuss what are and why use portlets

Why would I want to use java portlets above tomcat and gwt? Would portlets make it less- or un- necessary for me to use jsp and jsf? Has Jboss been part of the portlet evolution culture? Does Jboss satisfy the portlet jsrs? What portlet implementation/brand would run on gae java and gae python? Are portlet specs due to peer pressure fro...