The goal is that a Java app provides contextual menu functions for files as seen in the Finder, thru the Services menu, on OS X 10.6 (Snow Leopard).
Is that possible from within Java code, or do I need to write a stub in ObjC which then talks to the Java app (via a socket)?
Any sample code around?
...
Hello! I was just wondering what a ghost reference was? Is it that you don't have to refer to a object? EDIT: Sorry, I wasn't clear, the langauge is Java, and I read it about linked lists. While reading a problem to write a LinkedQueue iterator to support the remove method. Then, you would have a ghost reference.
...
I have several different processes within a single project that I work on. I am constantly opening and closing tabs(java files) in the code editor for that particular process. Each process almost always uses the same java files.
I was wondering if it is possible to save what files are opened as part of the working set so I can select ...
Yes, it's a trivial piece of code to write, but I still wonder if there's a built-in replacement.
Here's the code:
/**
* Cast x to int, throw an exception if there's loss of information
*/
public static int safeLongToInt(long x)
{
int result = (int) x;
if (result != x)
throw new RuntimeException("long doesn't fit in an int: "...
I have a List<Foo>, and a compare() method taking two Foo objects and returning the 'greater' one. Is there a built-in Java method that takes the list and finds the largest one?
...
When there were duplicate JARs with different versions, the behavior was very inconsistent. Does anyone know how the JVM deals with duplicates?
...
I herd about RED5, but unfortunately I can't find any examples for feeding it with external source. I know RTSP is in development, but I'm thinking about (named) pipes or something like this. There is is also project named xuggle that is as far as I understand ffmpeg wrapper for Java, but I herd they have also problems with live streamin...
Hi
I have a requirement where there are few scenarios.
User registration(There are different types of users say buyer, seller, moderator etc)
search feature where a seller/buyer could be searched with few keywords
user dashboards
search functionality can be exposed as webservice in future.
I identified that first 3 can go as separa...
How does one unit test that a new thread was spawned for a Runnable task when using an ExecutorService?
Basically, I have a static thread pool for my application.
public static final ExecutorService executorService = Executors.newCachedThreadPool();
I'd like to use this thread pool for the my unit tests, rather than mocking one out o...
I get the following exception when trying to access any nodes of a parsed xml document on dom4j:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/JaxenException
at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230)
at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207)
at org.dom4j.tree.Abstr...
I'm debugging a jnlp application, and I used to be able to remote debug it through eclipse, but not anymore.
the command to start it is:
/usr/java/jdk1.6.0_14/jre/bin/java -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1445 -Djnlpx.heapsize=64m,512m -DtrustProxy=true -Xverify:remote -Djava.security.policy=/lib/secu...
We have several areas where code like this can be seen
public Map extractData(ResultSet rs) throws SQLException, DataAccessException {
Map m = new HashMap();
while(rs.next()){
Jurisdiction j = new Jurisdiction();
m.put("code",rs.getLong(1) );
m.put("type",rs.getSt...
Hi,
How do I acknowledge a message when I am using a message listener?
I get the following error when I try to do an acknowledge in my message listener.
A synchronous method call is not permitted when a session is being used asynchronously: 'acknowledge'
...
I have two sets of Animal objects. The distance between animals is defined using a specific algorithm that looks at their traits. I am trying to design a method to find the pair from the two sets (one from each) that minimizes the distance.
One idea I had: create a parametrized Tuple class to pair up Animals. Create a PriorityQueue with...
Hi,
I want to find about the HTTP 1.1 compression of the site I am talking to.
I need to do it programmatically in Java.
What I want to find out is:
Does the server support compression for incoming requests?
Does the server support compression for responses?
Thanks in advance.
...
I was wondering what happens to the earlier values in the case of duplicate/overwritten keys.
Didn't find any documentation regarding the same.
Case 1: We overwrite values for a key
Case 2: Duplicate key
Map mymap = new HashMap();
mymap.put("1","one");
mymap.put("1","not one");
mymap.put("1","surely not one");
//the following line is ...
Hi all,
I decided to create a currency converter in Java, and have it so that it would pull the conversion values out of a text file (to allow for easy editability since these values are constantly changing). I did manage to do it by using the Scanner class and putting all the values into an ArrayList.
Now I'm wondering if there is a w...
I have data that is organized in kind of a "key-key" format, rather than "key-value". It's like a HashMap, but I will need O(1) lookup in both directions. Is there a name for this type of data structure, and is anything like this included in Java's standard libraries? (or maybe Apache Commons?)
I could write my own class that basicall...
public Interface Foo<T extends Colors>{...}
Is there a way to retrieve which T was given for an implementation of Foo?
For example,
public Class FooImpl implements Foo<Green>{..}
Would return Green.
...
Hi, I'm using IntelliJ IDEA 8 and Axis to set up a webservice that's deployed on Tomcat5.5. The generated wsdl looks like this: http://track.priskick.se/Tracker.wsdl
A method is declared as
public void storeImpressionReport(int siteId, int adId, int zoneId, int count,
int excludeCount) { ... }
and e...