java

In Spring Webflow unit test, how do you assert that a view state has a view of a given name?

I'm developing a Spring webflow, trying to use TDD so I've extended AbstractXmlFlowExecutionTests. I can't see an obvious way to assert what I would have thought would be a simple thing: that a view state has an associated view of a given name. For example, given this flow (excerpt): <?xml version="1.0" encoding="UTF-8"?> <flow ...> ...

How can I create a hibernate collection that will be re-read every time I request it?

I have an entity that has a state table associated with it. The state table is managed by another process, and contains a list of objects that my business logic must process. I would like to get a new snapshot of the state table each time I reload the entity. How can I ensure that no part of Hibernate or its support libraries ever cac...

What is the Java ?: operator called and what does it do?

I have been working with Java a couple of years, but up until recently I haven't run across this construct: int count = isHere ? getHereCount(index) : getAwayCount(index); This is probably a very simple question, but can someone explain it? How do I read it? I am pretty sure I know how it works. if isHere is true, getHereCount() i...

Efficiently sorting data from DB using Java?

What we have: 3 MySQL DB tables: user, text, friend user: username, password, email, etc. text: username, text, date, etc. friend: username, friend_username, etc. Task: Write an algorithm (in Java) to show 10 latest texts from your friends. Ultimate target is to have running time within O(n log n). DB tables can be modified (adde...

How do I get an error message when failing to load a JVM via JNI?

I would like to retrieve an error message that explains why the jvm failed to load. From the examples provided here: http://java.sun.com/docs/books/jni/html/invoke.html I extracted this example: /* Create the Java VM */ res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args); if (res < 0) { // retrieve verbose error here? f...

Is there any way in Java to log *every* Thread interrupt?

I would like to somehow log every time Thread.interrupt() is called, logging which Thread issued the call (and its current stack) as well as identifying information about which Thread is being interrupted. Is there a way to do this? Searching for information, I saw someone reference the possibility of implementing a security manager. ...

Splitting Hibernate Entity among 2 Tables

I have a simple Class Hierarchy that I am trying to get to work with Hibernate/JPA. Basically what I want is for the MovementData to be in its own Table with a FK to the integer id of the Main Vehicle Table in the Database. Am I doing something wrong? How else can I accomplish something similar? I am pretty sure I am following the JPA...

Optimal update in resultset on Sybase IQ

Im looking to rewrite code that update a table on a Sybase IQ database v14 that does the following: selects all the records in the table and extracts some data to file updates the extracted to file flag for each record in the table Currently, once a record is written to file, its extraction flag is updated. Currently there are 40 00...

I/O redirection in eclipse?

Hi, Is it possible to use IO redirection in eclipse? I want to redirect standard input/output on the command line like java MyProgram <input.txt >output.txt, but I can't seem to get it to work in eclipse. I tried including the <'s as part of the program arguments, which was ignored, and also in the VM arguments, which just threw up a cl...

Valid java bean names for booleans

I know most variable names will work with "is", such as isBlue, but is "has" also a valid prefix, like hasProperty? ...

What is a realistic measurement to load test a CMS web application?

Our company is facing some difficulties with our CMS web application. This application was part-built by a contractor and we have been confronting some stability issues (crashing, having to put them in front of load balancers or caching mechanisms) when we think the application should be able to handle it. We put together a minimal sta...

Will zipping a directory in Java affect other processes using the same files?

I'm using the java.util.zip library and ZipOutputStream in order to create a zip file of a directory and all the files and directories under it. In my application, it is likely that another thread could be accessing these same files during the compression. I'm not an expert on file compression (or thread-safety, for that matter) so my ...

Java wait for JFrame to finish

I have a login frame that i have to wait for from another thread. Upon successful login frame disposes itself. And i want to pop up the main frame for the application. Right now i am watching a boolean value to determine when to fire up the main frame. What is the correct way of doing this? Watching a boolean value just does not feel ele...

Java Translucent Selection Box

For custom rendering, I've created a class that extends JPanel and overrides the paintComponent method. In the custom paintComponent I rendering multiple shape objects held in a array. What I would like to add is the ability to drag and select 1 or more of the shapes. While dragging I would like to show a translucent rectangle defining t...

Real runtime method names despite obfuscation?

Is there any way to query the name of the current method if you've obfuscated your code? I'm asking because there are times when I want to log a message with the executing method as a prefix. ...

Defining spring bean using a class with generic parameters

If I have a class that looks something like this: public class MyClass<T extends Enum<T>> { public void setFoo(T[] foos) { .... } } How would I go about declaring this as a bean in my context xml so that I can set the Foo array assuming I know what T is going to be (in my example, let's say T is an enum with the values ONE and...

Eclipse RCP, SWT, JFace: How to create a dialog that is modal only to a view (not the entire shell)?

Hi there, Is there anyway to create a dialog that is modal to a view and not the entire shell (application)? So if say, I have one view called A that is overlaying another view called B, I want to open a dialog that is only modal to view A, so when I switch to view B, the dialog and the view A will be covered by view B. Is there anywa...

Dialect for SQL2005

Hi all, I am new to Hibernate. We are migrating one of our existing web application which uses Hibernate 3 and SQL 2000 server to SQL 2005 server. Can I get help about which version of Hibernate to use with SQL 2005 as I could not find any dialect for SQL 2005 in Hibernate 3.0.5? Thanks in advance. ...

Learn C# to transition to C/C++?

Alright, so I just took an introductory class into Computer Science and the school's language choice was Java (I have basic knowledge of concepts like polymorphism, encapsulation, etc..). I want to learn C++ then C (I hear that one should learn C++ first then go to C), and was wondering if C# is a nice transitional language because of th...

How do I restart the Google App Engine Java Server in Eclipse?

OK, maybe I'm dumb/blind, but in the docs it says "rebuild and restart the server." But I don't see a button to do this anywhere. Or from any contextual menu. And I can't find anything in their docs explaining how to do it. If I just try to start the app again, it gets angry because I already have App Engine running on the needed port. ...