java

How can I compress jpeg images in Java without losing any metadata in that image?

I want compress jpeg files using Java. I do it like this: Read the image as BufferedImage Write the image to another file with compression rate. OK, that seems easy, but I find the ICC color profile and the EXIF information are gone in the new file and the DPI of the image is dropped from 240 to 72. It looks different from the origi...

Java SOCKS proxy

Does socksProxyHost property requires an IP address System.setProperty("socksProxyHost", preferences.getProxyHost() ); setting it like following, If i provide 127.0.0.1 i get connected to the proxy on my localhost but giving it localhost it does not connect it. I have no other machine on lan to test it so does anyone know if it works ...

Open Source Java Profilers

What can you guys recommend to use with Java? Only requirement is it should be open source, or has not too expensive academic licence . ...

Show TableViewer not in line, but in matrix order

I use the TableViewer to show informations in a table. The user can select one of the shown options by selecting one line of the table. I want to create a table in matrix form, in which the user can not only select the line. It should be possible to select every item of the table, like row 2 column 3. For every item selection an action ...

jcifs.smb.NtlmPasswordAuthentication getPassword() null

i trying to do integrating with AD with jcifs. each time i do getPassword(), i get null. as I am using WMA. each time firefox will prompt for username/password . how to get the password entered by user? i able to get the username with .getName(); ...

Is there a way to put a version number in XML generated by XStream ?

I serialize my domainObjects using XStream. I would like to add some kind of versioning information to a generated xml file just in case my domain model changes. Is there a way to do it using xstream ? I vould prefer a parameter named "version" in a root tag (<object-stream>) but anything else would be good too. Thanks in advance. ...

NtlmSsp vs kerberos

can anyone elaborate the different? i'm currently using ntlmssp.authenticaten ( jcifs) but seems not able to do getPassword(). it's always return null ...

Choosing between Hudson and CruiseControl for the long term

My purpose is to chose between CruiseControl and Hudson as continuous integration tool for java desktop application. I have seen lots of reading comparing Hudson and CruiseControl. In terms of features and ease of use, Hudson seems the best. But in terms of robustness, reliability with heavy configuration and finally in the long term, ...

How do I publish cruise control emails using Exchange server

I'm trying to set up Cruise Control to build my project and check for build failures. I've got most things working. I'd like emails sent to me on build success or failure. However, I'm in a fairly restricted corporate environment, so I don't have an SMTP server with open ports available. We use exchange/outlook to send emails. How do I...

Business rules - where do they go in OOP?

I have a class : Schedule. public class Schedule { private int locationNum; private int cost; private String costReason; private Date weekOfChange; private Date dayOfChange; private String changeReason; // and all those getters and setters public Schedule(int locationNum, int cost, String costReason, Date weekOfChange, Date dayOfCh...

distributed shared memory or not to be?

Hello, A quick design question for the worth. I need to share data between C++ client and Java server. The Client talks to the server using SOAP. The issue is - I have a generic interface serving all kinds of requests on the Java backend. I don't want to "pollute" is with specific kind of request object which will most of the times re...

In Java, Is there such thing as instanceOf(Class<?> c)?

I want to check if an object o is an instance of the class c or of a subclass of c. For instance, if p is of class Point I want x.instanceOf(Point.class) to be true and also x.instanceOf(Object.class) to be true. I want it to work also for primitive types. For instance, if x is an integer then x.instanceOf(Integer.class) should be true. ...

Java: Altering UI fonts (Nimbus) doesn't work!

Hello! I'm referring to this Nimbus reference. I tried to set global Font to be slightly larger: UIManager.put("defaultFont", new Font(Font.SANS_SERIF, 0, 16)); ...works only for the menu but nothing else (buttons, labels). I tried to change labels and buttons fonts with UIManager.put("Button.font", new Font(Font.SANS_SERIF, 0, ...

newCachedThreadPool() V/s newFixedThreadPool

newCachedThreadPool() V/s newFixedThreadPool(...) when to use and which is better in terms of resource utilisation? ...

Limit availableProcessors

I had a problem a while ago whilst using Solaris that I wanted to limit the number of CPUs that Java could see (that was returned by Runtime.getRuntime().availableProcessors(). I thought I had it and I was given some info for Linux and took it on faith. I was told that using taskset would limit the number of CPUs that java would use (whi...

Uploading a file in java using a servlet

I'm using javazoom for uploading protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException { PrintWriter out = null; JOptionPane.showMessageDialog(null, "Lets do this"); try { response.setContentType("text/html;charset=UTF-8"); try { MultipartF...

Is it necessary to call a flush() (JPA interface) in this situation?

Hey fellows, Because calling a flush() to get every entities persist from memory to database. So if I use call too much unnecessary flush(), it could take much time therefore not a good choice for the performance. Here is a scenario that I don't know when to call a flush()? //Order and Item have Bidirectional Relationships Order ord = ...

How can I save a process resource from proc_open in order to check the status later on?

I'm running a sh script that runs a java process through php on ubuntu server. I'm using proc_open for running the process. usually the Workflow goes like : request a page -> script runs (until it's finished) -> result page. In my case the script runs in parallel so the server won't wait until the script is finished (it takes ho...

How to navigate to a bookmark in eclipse 3.4.1 ?

I am able to set bookmarks in a source file, but are there shortcut keys to navigate to a bookmark ? The navigate menu has a goto line. But that is not useful. ...

System.out not working when calling jar-file from Windows command line

I have this class: public class Test { public static void main(String[] args) { System.out.println("Hello World!"); } } And I used Eclipse's "Export to runnable JAR" function to make it into a executable jar-file (test.jar). When I run this program in Eclipse, it prints out "Hello World!", but when I call the jar-file from the com...