java

Full-screen Flash application test needs external pokes

I'm testing a full-screen Flash application. My preference is to drive the process with Java and I've had a lot of luck with the java.awt.Robot class. I'm looking for ways of modifying the test's behavior while the app still occupies the full screen. So far, I've found one "outside control", the caps lock key. If I see the process go...

Spring MVC very confused about controller mappings

Using annotation-based controller mappings. @Controller public class AlertsController { @RequestMapping(value="create", method=RequestMethod.GET) public void create(HttpServletRequest request, Model model) { } } When access alerts/create, I get the message Does your handler implement a supported interface like Controller?. Thi...

java io read and write lock

suppose I have a file that might gets written by one thread/process Writer and read by another thread/process Reader. Writer updates the file every x time interval, and Reader reads it every y time interval, if they happen to read and write to the file at the same time, will there be any issues? would the read block until writes finishe...

Dial Number Without Prompt

I'm trying to write a function for the Android Platform that will allow me to call 911 without any sort of prompt. I have already added the permission "android.permission.CALL_PRIVILEGED" I just need a function that will dial 911 at the press of a button in my options menu. ...

Java: null pointer exception?

This code is causing a null pointer exception. I have no idea why: private void setSiblings(PhylogenyTree node, Color color) throws InvalidCellNumberException { PhylogenyTree parent = node.getParent(); for (PhylogenyTree sibling : parent.getChildren()) { if (! sibling.equals(node)) { Animal animal = sibling....

Locating local hospitals in android

I want to be able to plot every hospital within 10 miles of my current location on the map in Android. I've already started with this code as a base (http://android-er.blogspot.com/2009/11/androidlocation-with-zoom-level-control.html) I just need to plot the locations of hospitals without switching to another screen. ...

Java change label text from another frame

I'm writing a server/client program. In the server, when I click a button some infomations will be sent to client and show on a jLabel. But the problem is when the client get focus, it loses all the informations recieved. Somebody help me please!!! ...

When should I use ConcurrentSkipListMap?

In Java, ConcurrentHashMap is there for better multithreading solution. Then when should I use ConcurrentSkipListMap? Is it a redundancy? Does multithreading aspects between these two are common? ...

How to write automated unit tests for java annotation processor?

I'm experimenting with java annotation processors. I'm able to write integration tests using the "JavaCompiler" (in fact I'm using "hickory" at the moment). I can run the compile process and analyse the output. The Problem: a single test runs for about half a second even without any code in my annotation processor. This is way too long t...

Java swing. How to wait for other Jframes

In a JFrame, when I click on 'login', I pop up another Jframe which is the login window. How do I make my main Jframe wait for my login Jframe to exit, before doing anything else? ...

Grouping Jar's Under lib

The external jar files are placed under /Library/Java/Extensions on Mac OS X, i have multiple applications that depend on a group of jars such as JavaMail Api, if i dump all the jars in the folder java picks them up, but what i want to do is group them together such as all mail api jars go to the mail folder. But if group them under fold...

scheduling algorithm for running tasks at specified time

guys, please suggest me best algo for the below situation: I have some taks which are to be scheduled by users anytime, the tasks may have recurring options(periodically/weekly/monthly...).I have to run these tasks at the scheduled time. Run only once after a specified start date Run periodically for every 1 hour after a specified d...

Portletfilter to change locale?

Hello there, the ServletResponse provides a setLocale() method to modify the locale of a response which is not commited yet. The PortletResponse doesn't provide such a method, only getLocale() - is there any other way to change the locale of a portlet request/response? ...

Simplest way to serve static data from outside the application server in a Java web application

I have a Java web application, using Spring and Struts, running on Tomcat 5.5. I want to load static images that will be shown both on the Web UI and in PDF files generated by the application. Also new images will be added and saved by uploading via the Web UI. It's not a problem to do this by having the static data stored within the th...

Is there any simple Java FTP Server libraries that is embeddable ?

I've tried Apache FTP Server but it lacks document and support. And it's totally based on spring configuration framework which I don't think I could understand very quickly. What I want is just a simple FTP Server that could I could embed into my application I could handle "download" commands using my own code, sending some data fro...

Which API in Java to use for file reading to have best performance?

In my place where I work, used to have files with more than million rows per file. Even though the server memory are more than 10GB with 8GB for JVM, sometimes the server get hanged for few moments and chokes the other tasks. I profiled the code and found that while file reading memory use rises in Giga bytes frequently(1GB to 3GB) and ...

How to handle Java "jobs" synchronously?

We have a set of actions or "Jobs" which we'd like to happen one at a time (not concurrently). Ie: Job A can't happen while B is happening, and you can't have two C jobs running at the same time. In the event that a thread attempts to run a job concurrently they should get an error. We shouldn't just queue up the request. Some jobs...

Implementing item edition page in JSF

Hi, I am creating a JSF application. I have some items (e.g. products) from database and I want to create a JSF page for editing particular items, that is: it should display selected item properties and enable user to edit them, I want to be able to view this item with some link, I want JSF to somehow remember that I'm editing particu...

TimeZone problem in Java

Hi I am trying to instantiate GregorianCalendar with TimeZone GMT, but whenever I call the getTime() method, it gives me time in local TimeZone. Here is my code: Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT")); System.out.println(cal.getTime()); The output I am getting is this: Sat Nov 28 19:55:49 PKT 2009 Please...

for each loop help

Hi guys i am looping through a list of strings, in psudocode this is how for (each node in my list) if the node.getBooleanVariable == true add one to my counter else take one away from my counter if my counter = another counter print node.getStringVariable() //THIS IS WHERE I AM STUCK here i want ...