java

How to call XSL template from java code ?

How to call XSL template from java code ? Please note that, I don't need to know how to transform xml docuemnt by XSL in Java. What I need exactly is that, I have some XSLT document that contains a template that do something, ex: <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr ...

How can I create an AutoComplete popup in a JTextPane in Java?

I am creating a SQL editor. I am using JTextPane for the editor. I want to implement AutoCompletion for table name etc. like Eclipse. ...

Base64 Decode in C# or Java

I have a Base64-encoded object with the following header: application/x-xfdl;content-encoding="asc-gzip" What is the best way to proceed in decoding the object? Do I need to strip the first line? Also, if I turn it into a byte array (byte[]), how do I un-gzip it? Thanks! ...

Proper usage of JDBC Connection Pool (Glassfish)

I need a database connection in Java Web service implemented as a session bean, and I'm not sure if I do it right. I created a class public final class SQLUtils { //..... private static DataSource m_ds=null; static { try { InitialContext ic = new InitialContext(); ...

how to get seconds from java long, I'm storing it in mssql DB as bigint

I store the long values in mssql using bigint so I could do something like this: --@start and @end are bigint set @duration = @start - @end now I need some additional operation so I could get the duration in seconds, anybody knows how ? ...

Java abstract static Workaround

I understand that neither a abstract class nor an interface can contain a method that is both abstract and static because of ambiguity problems, but is there a workaround? I want to have either an abstract class or an interface that mandates the inclusion of a static method in all of the classes that extend/implement this class/interfac...

JAR for three classes?

I reuse a handful of classes for multiple projects, like Postal Address, State, Zip Code and Phone Number. Associated to them maybe parse/format classes (like Phone Number Formatting). Is it okay to have a JAR with only a couple of classes? An alternative would be to have one "Miscellaneous" JAR with all the classes however it feels...

Building large MTOM/XOP messages with JAX-WS

Hi, I have a question about using MTOM/XOP with JAX-WS. I'm writing a web service which sends large amounts of binary data. The client requests a number of files and the server returns the files in the response. I'm able to get it to build the response correctly so that it correctly implements XOP, but I run into memory-related issues...

Integer Linear Programming Java: Multiple Open Source and Commercial tools are available. Which one to use?

Hi, I need to use Integer Linear Programming API/Tool for my application. Though my application is in Java but I don’t mind calling an EXE (Tool) from Java providing input using file (MPS, etc). My search analysis is as follows: There are multiple Open Source and Commercial tools available to solve ILP Following I found and think are ...

Java - Strange hanging socket?

I have a client-server application with a java server. It works pretty much perfect, except that after an extended period of time, all of a sudden, a socket keeps hanging. This socket is but one of many, the rest seem to do fine still, but once it gets to the socket, the server simply does not go past the sending line. These are the rele...

reliably reproducing db contention

we experience with some regularity contention on a database table, and would like to evaluate a number of different options for resolving this issue. in order to do so, i need to reproduce in a test case, contention on a table (any table) with repeatable reliability. the approach i'm considering would be to reverse the semantics of a l...

Embed hibernate hbm.xml mappings in jar

Is it possible to embed the hibernate mapping hbm.xml’s to the jar and avoid manual reference in applicationContext.xml like <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernatePr...

What is the difference between bendpoints in JBPM 3 plugin for Eclipse and JPBM 4 plugin for Eclipse?

In JBPM 3 plugin for Eclipse, bendpoints are represented using four integers: <transition name=""> <label x="5" y="-10"/> <bendpoint w1="36" h1="-37" w2="43" h2="39"/> </transition> In the source code, there is a class called Bendpoint, which stores two Dimension objects whose values are represented by w1, h1, w2 and h2. This seem...

How many times should I close the connection In SQL?

I have lots of method in my database class that all of them have one statement, when should I close the connection? In each method or at the end of database class? ...

tomcat oracle datasource

I have apache tomcat 5.5.28 on my windows box and I am trying to deploy a web application (WAR) which works fine on other servers. However I am having trouble creating a datasource. I am not sure of the format. The db is oracle. Here is what I have in server.xml. <GlobalNamingResources> <Environment name="simpleValue" ...

Non-trivial Dozer mappings

I'm struggling to get Dozer to bend to my will for something that I feel should be quite simple. I have two similar models that I wish to map between, however one has a 'deeper' hierarchy than the other and this is causing me problems when dealing with collections. Consider the following classes: Source classes: class Foo { String ...

iText Limiting Text Size in a Text Field

Is there any way we can specify the max number of chars a TextField can take in the PDF form created using iText? ...

Unit testing stripes validation annotations directly

Stripes allows you to validate your form input values using the @Validate annotation on your member variables. Does anyone have any experience testing these annotations directly. I could do this by testing the validation errors that come back from the ActionBean, but this seems a little long winded and I would like a more direct method o...

itextsharp: java to vb.net

i am trying to change the font on a pdftable and i have this hint in java but need some help to put it into vb.net PdfPTable table = new PdfPTable(3); table.AddCell("Cell 1"); PdfPCell cell = new PdfPCell(new Phrase("Cell 2", new Font(Font.HELVETICA, 8f, Font.NORMAL, Color.YELLOW))); ...

Inconsistency on equals() applied to Vector

Vector <Double> x = new Vector<Double>(); Vector <Integer> y = new Vector <Integer>(); System.out.print(x.equals(y)); This prints: true Why? Isn't equals() -by default- supposed to compare if two references point to the same object? ...