java

Using the Apple IKImagePicker_Class in a java application

I was able to use the IKImagePicker_Class in my cocoa with very little trouble but I am wondering how hard would this be to get working in a java application. Has anyone tried this? Have they had any luck? How hard was it? Thanks. ...

JDBC query returning no rows, but interactive query does?

Hi all, I'm attempting to retrieve data from a SolarWinds network performance database (MS SQL 2005) and a query that works perfectly fine interactively (in the Orion database manager) returns no rows when run via JDBC. Any ideas? The query itself is a shocker (I dislike MS-SQL date/time handling which I believe forces queries like th...

What is the JBoss equivalent of Tomcat's server.xml?

I am running an application which was deployed on JBoss. There is only documentation for Tomcat, none for JBoss. I need to change some connector tag attributes to look like so: <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8443" minProcessors="5" maxProcessors="75" enableLookups="true" acceptCount="100" debu...

vector and garbage collector

I'm running a java program that uses many vectors. I'm afraid my use of them is causing the garbage collector not to work. I have many threads that do: vec.addAll(<collection>); and other threads that do: vec.remove(0); I have printouts that show the vector is empty from time to time but I was wondering if the memory is actually f...

Java: I have a big string of html and need to extract the href="..." text...

I have this string containing a large chunk of html and am trying to extract the link from href="..." portion of the string. The href could be in one of the following forms: <a href="..." /> <a class="..." href="..." /> I don't really have a problem with regex but for some reason when I use the following code: String innerHTM...

Eclipse highlight occurrences, right column marker color

Similar, but different to this question: I use highlight occurrences a lot, but sometimes I'm irritated by how hard it is to see the little grey-ish rectangles on the rightmost side of the editor - to the right of the scrollbar. Is there any way to change the color of these markers - looking in General -> Editors -> Text Editors -> Ann...

Synchronized and local copies of variables

I'm looking at some legacy code which has the following idiom: Map<String, Boolean> myMap = someGlobalInstance.getMap(); synchronized (myMap) { item = myMap.get(myKey); } The warning I get from Intelli-J's code inspections is: Synchronization on local variable 'myMap' Is this the appropriate synchronization and why? Map<String...

Where is the signing for signed integral types stored? (In Java)

The Java data type byte for example holds data from -128 to 127 in a single byte on storage. To enable to distingush between - 1 to -128 from 0 to 127 would require extra data which would take the datatype obver its allocated storage. Admittedly it would only take 1 extra bit but it still goes over. How does java do this? ...

Using a thread to capture process output

I am using a thread to capture stream output from a process, and then outputting that stream to the eclipse console. The question I have is when to terminate the thread that is doing the stream output. Thread t = new Thread(new Runnable(){ private boolean isProcessDone(Process p) { //not sure what to do here } public void run...

Is it ok for private instances to be shared among objects?

I am only allowed to use private members in the programming course I'm taking, and I was wondering if something like this is ok. public class View { private Model object_; public View(Model object) { object_ = object; //blah blah blah } //blah blah blah } public class Controller { private Model object_; ...

Wrapping an existing application with JNI

Most of the documentation that details how to get started with JNI described how to build a new JNI application using X-Code. Can anyone link me to a description of how to use JNI to interface with Objective-C in an existing application. ...

Obtaining powerset of a set in java

The powerset of {1, 2, 3} is: {{}, {2}, {3}, {2, 3}, {1, 2}, {1, 3}, {1, 2, 3}, {1}} Lets say I have a Set in Java... Set<Integer> mySet = new HashSet<Integer>(); mySet.add(1); mySet.add(2); mySet.add(3); Set<Set<Integer>> powerSet = getPowerset(mySet); What I want is the function getPowerset, with the best possible order of complex...

Mouse over Color in Java

I need to make a game in Java for a project. What I'm trying to do is a game where you have to go through a maze without touching the walls. Is there a way to get the color of the pixel the mouse is over? ...

Java Swing: what class can be used to implement this?

What Swing class can I use to implement something like this? EDIT: Hmm..for some reason I cannot add the image here. Well, here's the link: Basically, I need a list table, where each column can be of different type of gui (i.e. plain text, check box, or drop-down menu). EDIT I have re-publish the image for you ;) ...

Compare Date objects with different levels of precision

I have a JUnit test that fails because the milliseconds are different. In this case I don't care about the milliseconds. How can I change the precision of the assert to ignore milliseconds (or any precision I would like it set to)? Example of a failing assert that I would like to pass: Date dateOne = new Date(); dateOne.setTime(61202...

How to use SwingX-WS to simulate an HTML Form submit? (Not a directly post request)

i would like to know how to use the library in https://swingx-ws.dev.java.net/ to scrape a web page and submit a form. the simple code writen below is simply not working and i don't know why. could someone help me? thanks in advance. public static void main(String[] args) { try { Session s = new Session(); Resp...

how to handle large lists of data

We have a part of an application where, say, 20% of the time it needs to read in a huge amount of data that exceeds memory limits. While we can increase memory limits, we hesitate to do so to since it requires having a high allocation when most times it's not necessary. We are considering using a customized java.util.List implementatio...

[Java] Generics and "where" clause

In. NET, I can do something like this: public static T[] CreateAndFillArray<T>(int size) where T : new() { T[] array = new T[size]; for (int i = size - 1; i >= 0; i--) array[i] = new T(); return array; } We must to specify "where T : new()" clause. How to do it in Java? ...

Why are synchronize expensive in Java?

I am really new to Java and I read that "synchronized" is "very expensive" in Java. All I want to know is what is expensive and how is it expensive? Thanks. ...

How to detect eclipse compile errors (Java - JDT)

Hi everybody, I need to detect compile errors in the java source code after a POST_CHANGE event (usually it is fired after saving changes in the java file). I'm using IElementChangedListener for doing that. So, for detecting errors I tried the two possibilities bellow: 1: boolean error = IMarker.SEVERITY_ERROR == iFile.findMaxProblemS...