java

Save JFrame location in multi-display environment

I want to store a JFrame's location (bounds, extendedState) when the user closes it. However, when the user moves the frame onto the 2nd screen and maximizes it, how can I store that information? My naive (and single display) implementation is like this: void saveFrame(JFrame frame) throws IOException { Properties props = new Prope...

Display only selected Log4j debug statements

Is it possible to display only those statements in console, which are having certain words. For eq: logger.debug ( "java: hello " ); logger.debug ( "groovy: hello " ); logger.debug ( "ruby: hello " ); Now, by doing some configuration or whatever, all statements which are starting with groovy: should display. ...

What data structure will hold a bounded stack of items in LIFO ?

I'm looking for a data structure that is basically a bounded stack. If I declare that the stack can hold at most 3 items, and I push another item in, the oldest item is popped. ...

Looking for Modern Java Threading / Concurrent programming Book

I'm looking for a modern java threading book. I've quite enjoyed reading Taming Java Threads by Allen Holub, but it's a little old now. That was 8 years ago. I want the knowledge develop concurrent and industry standard multi-threading applications. Suggestions? Or even online resources? ...

Oracle SYS_CONNECT_BY_PATH hitting 4000 character limit

I'd like to run a query like the one below against an Oracle 9i database from Java (an example table structure and example data are below). SELECT deptno , SUBSTR(comma_list, 2) comma_list FROM (SELECT deptno , SYS_CONNECT_BY_PATH(ename, ',') comma_list , row_number , row_count ...

Flex :: <mx:transitions> not working Properly in my flex project ?

i used <mx:transitions> <mx:Transition fromState="*" toState=""> //universal_title name for TitleWindow id another stage .loginform is panel id another winidow <mx:Sequence targets="{[Universal_title,loginform]}"> <mx:Sequence id="sequence1" filter="show" > ...

Where is Java going?

I'm an experienced Java programmer that for the last two years have programmed for necessity in C# and Javascript. Now with this two languages I have used some interesting features like closures and anonymous function (in effect with the c/c++ I had already used pointer functions) and I've appreciated a lot how the code has became cleare...

Hibernate @Version Field error

I am using hibernate, spring, struts framework for my application. In my application, each of the table has one field called as Version for tracking updation of any records. Whenever i am updating existing record of my Country table which has version 0, it works fine & update the record update the version field to 1. But whenever i am...

Java alphabets in different languages

How can I determine if String contains only alphabets and I want to have little more than [a-zA-Z]+, so is there any way to determine alphabets by Locale? ...

Maven Release Plugin war stories

Hello, I have been given the task of exploring the maven-release-plugin before we try using it on our project. As of now, the releases are done manually on request. This process involves (skip this part if you're not interested, it's just to give you an idea): In the head, open the base POM file: Increment the numbering of the \proje...

How can I use Drag-and-Drop in Swing to get file path?

I have a JTextField in my swing application that holds the file path of a file selected to be used. Currently I have a JFileChooser that is used to populate this value. However, I would like to add the ability for a user to drag-and-drop a file onto this JTextField and have it place the file path of that file into the JTextField instead ...

Is there ANY way to save a graph object containing nodes and edges?

I've tried using the standard serializing type things, stuff like: FileOutputStream f_out; try { f_out = new FileOutputStream("MAOS.data"); ObjectOutputStream obj_out = new ObjectOutputStream (f_out); obj_out.writeObject(s); obj_out.flush(); obj_out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated c...

How to insert and update multiple rows to Sql database with same query?

I have counter for unique column in my table. Now I have list where I have column name (which is unique) and counter (which contains some integer value). I know that it is possible to insert multiple lines, I just could make query containing all those items on the list, but problem is that if there is already data in unique field. In th...

hibernate deletion problem please help urgent

i have a course object. The course object has a set of tutorials and a set of applications. When i delete a course objects i want the assocated set of tutorials and applications to get deleted. My course.hbm is as follows and my application.hbm contains <property name="appdatetime" type="timestamp"> <column name="appdatetime" lengt...

How do I call a webservice over SSL in Java?

I have recently been working on a C# application that calls a webservice over SSL and handles the certificate security using a delegate for the ServerCertificateValidationCallback event like so: System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate(object certsender, X509Certificate certificate, X509Chai...

Problem with imports in java?

I'm having a problem with imports in one of my java applications. I've Taken a working JSP out of one Eclipse project, Jar'd up all the classes from that project and put it into a new project. In the new Project I've imported the jar file generated from the original, and pasted the jsp code into a new JSP document. I'm getting "The im...

How do I guarantee the order of items in a collection

I have a list of objects and each and every object in the list have a position which may not change unless explicitly changed, in other words, the objects are in a queue. What collection should I use in my entity class to store these objects and how should that collection be annotated? I currently have this @Entity class Foo { ... ...

Where should I put my JUnit tests?

I've got 2 questions about organising Unit tests. Do I have to put test to the same package as tested class, or can I organise tests in different packages? For example if I have validity and other tests, is it correct to split them into different packages, even if they are for same class? What about mock and stub classes? Shall I sepa...

Is there an equivent library to Java's DisplayTag in PHP?

For a long time in the Java/JSP world I used to use the Display Tag library to generate a table that would allow you to sort a table, and export the table as a CSV file. Is there anything like this in a PHP library that I could use? ...

Setting a JPA timestamp column to be generated by the database?

In my SQL Server 2000 database, I have a timestamp (in function not in data type) column of type datetime named lastTouched set to (getdate()) as its default value/binding. I am using the Netbeans 6.5 generated JPA entity classes, and have this in my code @Basic(optional = false) @Column(name = "LastTouched") @Temporal(TemporalType.TIM...