java

Inspect Swing/SWT app at runtime?

Is there any way to inspect (in a broad sense, to get any info) a SWT app without disassembling it (as it's packed as exe and I don't know how to extract it first ;) )? EDIT: turns out the app is a SWT one. ...

Transitioning from Java to C and then C++?

Currently I am working with Java and its object oriented-design aspects (I also work with PHP/MySQL a lot). I don't implement it on the web; I just use it for designing programs for general purposes. However, now I need to learn C right now, and I have an interest in C++. I got The C Programming Language, which some people say is the bes...

Enable C application as Webservice

We have an application written in C language which interacts with Oracle database. This application is an executable and runs on unix platform. We need to expose this application over http as web service for others to consume. I thought of using JNI and CXF for webservice and run the application in tomcat. Is this a right solution or t...

How do you debug a Rails application?

Is it possible to debug a Rails application in a similar way to a Java application - setting breakpoints and stepping into the code? What are the best tools for this? I have a hybrid Java/Ruby on Rails application which I can run in Eclipse or Netbeans. I would like to step into some code in this app and try to figure out the cause of...

Listing a local directory from a signed applet

The following applet is compiled and packed into jar which is then signed with a self-signed cert. import java.applet.Applet; import java.io.File; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; public class Test extends Applet { private static final...

Is it possible to use Visual Studio as an IDE for Google Web Toolkit?

As a long time user of Visual Studio, I feel comfortable using this as my primary IDE for editing code (I primarily code in C#/ASP.NET). Lately I've been looking more in depth into the Google Web Toolkit (or GWT) as a potential tool for building rapid web client tools for the web. I would therefore like to know whether it is possible to ...

Serial Port Not getting closed. I want to release the COM port ...

Serial Port Not getting closed. I want to release the COM port ... Below is my code.... import java.io.*; import java.util.*; import gnu.io.*; public class ReadCommPort implements SerialPortEventListener { static CommPortIdentifier portId; static Enumeration portList; InputStream inputStrea...

How do I configure JUnit Ant task to only produce output on failures?

I am configuring JUnit in Ant so that unit tests will be run on each build. I would like the output of failing tests to be printed in the Ant console output whenever they are run. I don't need to see any output from succeeding tests. Here is the relevant bit of my build.xml file: <junit> <classpath> <pathelement path="${bui...

In log4j, does checking isDebugEnabled before logging improve performance?

I am using Log4J in my application for logging. Previously I was using debug call like: Option 1: logger.debug("some debug text"); but some links suggest that it is better to check isDebugEnabled() first, like: Option 2: boolean debugEnabled = logger.isDebugEnabled(); if (debugEnabled) { logger.debug("some debug text"); } So...

How to create in-page configuration. Via c:set?

I've got a web application that I need to be able to configure parts of from a JSF page. So for example, imagine my application was split into several smaller parts each with a folder/file structure like below: /partname /config config.xhtml /template generaltemplate.xhtml search.xhtml results.xhtml Se...

Java: Spring Framework: Declaring Nested Maps

I get an error at 4th line saying: cvc-complex-type.2.4.d: Invalid content was found starting with element 'map'. No child element is expected at this point. <util:map id="entirePayTypesMap"> <entry key="34"> <value> <map> <entry key="default"> <v...

Java frameworks vs. Javascript frameworks

I am a big fan of the Dojo Toolkit but I see here often that there are Java frameworks that do the same thing but they are not as extensive or as user friendly as Dojo in my opinion. What are the main differences? Can I use Dojo for the GUI and Java as the back-end? Is there a list of Java frameworks for web development? ...

Should I use composite primary keys or not?

There seems to only be 2nd class support for composite database keys in Java's JPA (via EmbeddedId or IdClass annotations). And when I read up on composite keys, regardless of language, people keep coming across as them being a bad thing. But I cannot understand why. Are composite keys still acceptable to use these days? If not, why not?...

Gracefully avoiding NullPointerException in Java

Consider this line: if (object.getAttribute("someAttr").equals("true")) { // .... Obviously this line is a potential bug, the attribute might be null and we will get a NullPointerException. So we need to refactor it to one of two choices: First option: if ("true".equals(object.getAttribute("someAttr"))) { // .... Second option: S...

Is there a way to see what the values of the arguments that are sent into a method in Java?

Hey, I am currently working on a debug/error handling tool for my Java project. This is a long-shot, but is there a way to print out the values of the arguments that are sent into a method? The JVM must have them stored when calling the method. Anyway I can just grab hold of those values? My goal is to just call on my own printArgumen...

Creating very large image files with BufferedImage, strange issues depending on compilation and computer (-Xmx does not work)

Just to follow up on here: http://stackoverflow.com/questions/961795/creating-very-large-image-files-with-bufferedimage-strange-issues-depending-on-c I still have the issue and I did try the Xmx command line to make sure the JVM had at least 1024m of RAM, I put the parametere in as both -Xmx1024m and -Xmx 1024m but neither worked. ...

Obtaining in IE the length of a Java array passed from an applet to its Javascript wrapper

I have the following method in my applet: public File[] getFiles() Which I call from Javascript as follows: var files = applet.getFiles(); for (var i = 0; i < files.length; i++) { // Do something. } This works in Firefox but IE gives me 'length' is null or not an object Any ideas anyone? ...

JExcelAPI - writing date to Excel sheet ignores day, month and year.

I try to generate some Excel sheets in Java application using JExcelAPI (v. 2.6.3) and can't generate date cells properly. For example, for code: WritableWorkbook workbook = null; workbook = Workbook.createWorkbook(new File("C:\\tmp\\tests.xls")); try { Date date = new Date(); final WritableSheet sheet = workbook.createSheet("Shee...

XML to Relational with DB2 and Java (and Hibernate?)

What I have here is a bunch of XML-Files containing data and a nice ER-Model to which the data belongs. What my problem is: I need to get this data into a db2. The tables with all necessary attributes and keys are already created. I was thinking of three different solutions: Parsing the XML and creating SQL-Queries from it. This solut...

XML Validation in configuration parsing code with XMLSchema: Best Practices? (Java)

Hi everyone! I have to parse a XML configuration file. I decided to do the basic validation with XMLSchema to avoid massive amounts of boilerplate code for validation. Since the parsing class should work for itself i was wondering: "How can i validate the incoming XML file with XMLSchema without having the XMLSchema stored on disc where...