java

Creation of a EML file with an attachment using JavaMail

Hi. I'll create a EML file with an attachment using JavaMail. I created a simple EML file successfully, but adding an attachment don't work properly. I'm going to add a PDF file. My EML file will be created successfully. If I open the generated EML file with Outlook I'll find not my PDF file as attachment but I'll find the EML file it...

Running/Interpreting C on top of the JVM?

Is there a way to run plain c code on top of the JVM? Not connect via JNI, running, like you can run ruby code via JRuby, or javascript via Rhino. If there is no current solution, what would you recommend I should do? Obviously I want to use as many partials solutions as I can to make it happen. ANTLR seems like a good place to start, ...

Running specific version of java on firefox

In IE, I can use the classid "clsid:CAFEEFAC-0015-0000-0011-ABCDEFFEDCBA" to tell it to use java version 1.5.0_11. Is there an equivalent for Firefox and other browsers? ...

How do I limit the number of entries in a java hashtable?

Is there a technique such that I can specify a number n such that when the (n + 1)th entry is inserted, the oldest entry is removed first ensuring that the size of the hashtable is always limited to n? ...

Are there any illegal characters when using named parameters in JDBC?

I'm using named parameters in a query to match fields in a map-like data structure. The data structure can have fields, or another map-like data structure. This nested structure is repeatable ad nauseum. I would like to name the parameters in the query using an XPath like language, that can be parsed to indicate further nested lookups. ...

Where can I find unit tests for Sun classes?

I'm writing an implementation of an interface provided by Sun and I'm wondering if anyone knows of the availability of unit tests for Sun's APIs. It would seem that such of thing would be available, but I'm having a hard time finding them. Specifically, I'm looking for BlockingQueue tests (ie: a test for LinkedBlockingQueue that I coul...

ANT: How to modify java.library.path in a buildfile

The java.library.path property appears to be read-only. For example when you run ant on the following buildfile <project name="MyProject" default="showprops" basedir="."> <property name="java.library.path" value="test"/> <property name="some.other.property" value="test1"/> <target name="showprops"> <echo>java.library...

autogenerate HTTP screen scraping Java code

Hi, I need to screen scrape some data from a website, because it isn't available via their web service. When I've needed to do this previously, I've written the Java code myself using Apache's HTTP client library to make the relevant HTTP calls to download the data. I figured out the relevant calls I needed to make by clicking through t...

Java Swing or Java Qt?

Can someone with extensive experience with both Qt and Java Swing please discuss whether you would use Swing or Qt under Java, and why? Secondly, what is the business impact of using Qt? Is it reasonably popular or will I have a hard time finding experienced Qt developers? Are there any other business impacts I should be aware of? UPDA...

Get source of website in java

I would like to use java to get the source of a website (secure) and then parse that website for links that are in it. I have found how to connect to that url, but then how can i easily get just the source, preferraby as the DOM Document oso that I could easily get the info I want. Or is there a better way to connect to https site, get ...

OpenOffice .xls export to PDF causes check boxes to overlap

OpenOffice Excel file export to PDF is being done programmatically and I wish to know if there is a way to resolve this issue by maybe passing some kind of flag or something during the conversion process which will make the cell background transparent in the PDF document. Please note an example PDF output. The original Excel file does n...

Interfaces in Java: cannot make implemented methods protected or private

Hi all, I know that an interface must be public. However, I don't want that. I want my implemented methods to only be accessible from their own package, so I want my implemented methods to be protected. The problem is I can't make the interface or the implemented methods protected. What is a work around? Is there a design pattern...

Vehicle tracking system/Jan08

hi, we are developing cost effective vehicle tracking system, for my knowledge Using GPS to track vehicle costs more. So we are looking to develop using GPRS system which costs less. my doubt is can track the vehicle using only GPRS (not using GPS at all) is this possible .please correct if i am wrong if you any documentation or lin...

What are the tell-tale signs in an interview that a developer is not competent?

I'm specifically talking about interviewing for a position for a very experienced and competent C++/C#/Java systems developer, not a html, javascript web developer position. In my experience nervousness is often not a good indicator, because many good developers get very nervous under pressure, so what is a good indicator? Hmmm... so...

CodeBetter.com like blogs for Java..

I'm moving from .Net to java. So i wanted to know any good community blog site like CodeBetter.com, of java developers. EDIT: i'm looking for something more than just coding examples, like CodeBetter.com or Artima.com, which influence your thinking. ...

how to control focus in JTable

What I want to do is when user finish editing of data in table cell to move focus onto another cell depending of what user entered, and to turn that cell into editing mode so user can start typing immediately with no additional action. This way user can focus on his work and software will do the 'thinking' about which cell should be edit...

Java and CANopen

Background Dear friends, I am required to create a java program on a laptop to receive/send CANopen messages. RJ45 is chosen to be the network's physical medium. I am new to CANopen and Java communications programming. Pardon me if I appear to be uninitiated. The truth is, I have been reading up a lot but I still do not know how to get ...

Running junit tests in parallel ?

I'm using junit 4.4 and maven and I have a large number of long-running integration tests. When it comes to parallellizing test suites there are a few solutions that allow me to run each test method in a single test-class in parallel. But all of these require that I change the tests in one way or another. I really think it would be a m...

[Java] int or Integer

Hi, I need to create a data transfer object, which I will use for storing the records retrieved from database. In this data transfer object, I need to declare a numeric field. For that which one is better - int or Integer If I am defining the field as Integer, will there be any performance impact because of 'Integer' type if I am going...

Way to convert java.hprof.txt to binary hprof format?

I have a java.hprof.txt file (automatically generated after an OutOfMemoryError) which I would like to convert to the binary hprof format. Is there any easy way to do this? ...