java

Java library for converting XML to syntax colored HTML

I have a Java string of XML content. I use Velocity to generate some HTML reports, and this XML needs to be included into one of those HTML files. It would be nice if this XML is syntax colored and formatted. Does anyone know of a Java library to do this? ...

Copy an object in Java

I have an object that I need to copy in Java. I need to create a copy and run some tests on it without changing the original object itself. I assumed that I needed to use the clone() method, but this is protected. Having done some research on the net, I can see that this can be overrided with a public method in my class, but I cannot fi...

Separate decode/encode interfaces or in one interface

I'm creating an implementation that performs conversion from one form to another. The design problem I am facing now is whether the Encoder and Decoder API should be in one interface or in separate ones. e.g. Apache MINA uses separate interfaces I am currently doing something like this: interface Convertor { A encode( B b ); ...

Python as your main language. Possible?

I am currently attending college and the languages that I will 'know' by graduation are C++ and Java. That being said, i am also in the process of teaching myself Python. I know that every programming language has its own pros and cons, but would it be possible to become a python developer out of school? I always have more 'fun' programm...

Naming conventions in C# compared to Java

The standard naming convention in the Java world is to name packages, classes and methods according to: com.domainname.productname (package) com.domainname.productname.ClassName (class) com.domainname.productname.ClassName.isUpperCase(String str) (method) What is the C#/.NET standard naming convention for the above cases? ...

Converting C-DES-implementation to Java - Help needed

Hi, I'm a German student an for computer classes I need to implement the DES-encryption in Java(by myself, not by using the Java-API) and explain it in detail. I didn't find any Java-code-examples using google, however I did find an easy implementation in C(I do not know C, I know a little C++, but not that well, pointer still get me now...

Adding scripting security to an application

Let's say I have an existing application written in Java which I wish to add scripting support to. This is fairly trivial with Groovy (and just as trivial in .Net with any of the Iron range of dynamic languages). As trivial as adding the support is, it raises a whole host of questions about script execution and security - and how to imp...

Tabs with equal (constant) width in JTabbedPane

I'm trying to get a JTabbedPane where all tabs (the actual tabs, not the components) have the same width (either the minimum width needed for the widest label or a constant width). I've tried to override BasicTabbedPaneUI.getTabBounds(int tabIndex, Rectangle dest), but apparently this method isn't used by the painting methods of BasicT...

Consequences of Java 32bit on Win(any) 64bit?

Hi all! I am trying to install JAI (Java Advanced Imaging) 1.1.3 in my Vista 64 and it says that in order for it to be installed JDK 1.3 and up must be installed. The problem is that I have already installed the latest JDK for Win64 and it seems that it is not willing to work with it. I would like to know if there are any severe conseque...

Merging cells in JTable

Hi all, Is it possible to merge some cells of a JTable object? If it's not possible through JTable what is the best approach. Thanx. ...

Setting up a personal (Java) workspace: What do I need?

I want to set up a personal workspace on my home machine. I mainly intend to use it for Java development on home projects. Which tools do you recommend me to use? (I prefer free tools, since this is just for home use.) I hope you could recommend some tools for me, and I'd be grateful if you could give me a brief comparison of some tools...

Using a java library from python.

I have a python app and java app. The python app generates input for the java app and invokes it on the command line. I'm sure there must be a more elegant solution to this; just like using JNI to invoke C code from Java. Any pointers? (FYI I'm v. new to Python) Clarification (at the cost of a long question: apologies) The py app (w...

Smallest Java SVG Engine

What is the smallest Java SVG engine (least/smallest jars) that actually works? If your answer is Batik, what is the minimal dep. graph for getting this to work in a simple Java application? I've looked at the dependency graph on the Batik site, but it looks like a typical Apache mess. Aren't there better alternatives? ...

Good uses for Apache CollectionUtils

I found the CollectionUtils class a year or so ago and a few of the methods like, collect, and transform seem really cool, however, I have yet to find a use where it would not by syntactically cleaner and\or easier to just write the logic with a simple loop. Has any found a unique\useful use for these methods (transform, predicatedColl...

Is there a way for an AIR 1.5 app to read from stdin and write stdout/stderr?

Have been studying the file system related classes of Adobe AIR 1.5, but so far I've not seen anything that mentions how to interact with stdin/stdout/stderr. Is a bit surprising as AIR makes it possible to otherwise interact with the local file system, and there is a FileStream class. Am wanting to launch an AIR app from a parent proce...

What are the benefits of session-per-conversation?

Currently I'm using a session-per-request approach to manage Hibernate sessions in a Java web application. I heard the term session-per-conversation thrown around and was wondering what situations it suits and what benefits it can bring over session-per-request? ...

Does Java support RAII/deterministic destruction?

It's been at least 5 years since I worked with Java, and back then, any time you wanted to allocate an object that needed cleaning up (e.g. sockets, DB handles), you had to remember to add a finally block and call the cleanup method in there. By contrast, in C++ (or other languages where object lifetimes are deterministic, e.g. Perl), t...

Is there a way to access an iteration-counter in Java's for-each loop?

Is there a way in Java's for-each loop for(String s : stringArray) { doSomethingWith(s); } to find out how often the loop has already been processed? Aside from using using the old and well-known for(int i=0;i<boundary;i++)-loop, is the construct int i = 0; for(String s : stringArray) { doSomethingWith(s); i++; } the only wa...

How much logic is it "right" to put in a Callable?

I'm using callables quite often , and I've stubled upon a question that irritates me: Lets say that to run function foo() , one needs to do a couple of checks first. Should you 1. Insert the checks as part of the Callable : class A implements Callable<Long> { ... public Long call() { check1(); check2(); return (run());...

Is it possible to set a TitledBorder opaque on Swing?

Is it somehow possible on Swing to set a TitledBorder transparent so that a background image shines through? ...