java

Online exam web application

I am developing an online exam using JSP/Servlets which is nearing completion. I'm planning to add timer function for the entire exam that shows elapsed time in minutes. How do I implement this with a fool-proof technique to implement this, because using javascript would mean that the user can turn off the feature in the browser. Any hel...

"The handle is invalid" when running .net console via java

Hi, I'm trying to run dot net console application via Java : process = Runtime.getRuntime().exec(commandLine); I get the following output: Detecting The handle is invalid. when running it directly via the console (windows) there is no problem: Detecting 100% Done. 100% I'm running more applications in this form but have no prob...

Help I have problem with select query in JPA

i have problem i want to select name_magazine from magazine and i already import all library needed and Query q = EntityManger.createQuery ("SELECT name_magazine FROM Magazine"); List results = (List) q.getResultList (); For(Sting s : result) System.out.println(s); but when i run this code it's error. can someon...

fuzzy string search in Java

I'm looking for high performance Java library for fuzzy string search. There are numerous algorithms to find similar strings, Levenshtein distance, Daitch-Mokotoff Soundex, n-grams etc. What Java implemenations exists? Pros and cons for them? I'm aware of Lucene, any other solution or Lucene is best? I found these, anyone has experien...

Strange floating-point behaviour in a Java program

In my program I have one array with 25 double values 0.04 When I try to sum these values in a loop I get following results: 0.0 + 0.04 = 0.04 0.04 + 0.04 = 0.08 0.08 + 0.04 = 0.12 0.12 + 0.04 = 0.16 0.16 + 0.04 = 0.2 0.2 + 0.04 = 0.24000000000000002 0.24000000000000002 + 0.04 = 0.28 0.28 + 0.04 = 0.32 0.32 + 0.04 = 0.36 0.36 + 0.04 = 0....

Is there a library similar to pyparsing in Java?

I need to quickly build a parser for a very simplified version of a html-like markup language in Java. In python, I would use pyparsing library to do this. Is there something similar for Java? Please, don't suggest libraries already out there for html parsing, my application is a school assignment which will demonstrate walking a tree of...

Specifying An Alternative JRE In Eclipse For An Application Launched From Eclipse

I am trying to specify an alternative jre (my default is 1.6 and i need to run with jdk 1.4.2) in Eclipse, for an application that i shall launch from eclipse. I am not sure if I am doing the right thing in the following code: Path jreContainerPath = new Path("/usr/lib/jvm/j2sdk1.4.2_18/"); IVMInstall jre = JavaRuntime.getVMInstall(jreC...

Wildcards in Java PreparedStatements

Here's my current SQL statement: SEARCH_ALBUMS_SQL = "SELECT * FROM albums WHERE title LIKE ? OR artist LIKE ?;"; It's returning exact matches to the album or artist names, but not anything else. I can't use a '%' in the statement or I get errors. How do I add wildcards to a prepared statement? (I'm using Java5 and MySQL) Thanks! ...

Embed XML configuration directly in Spring application context

I have a Java object which is able to configure itself given an XML configuration description (it takes other descriptions as well, but I'm interested in the XML at the moment). I'm wondering if I can embed the XML description directly into a Spring application context description. I'm imagining something like: <bean id="myXMLConfigured...

How does IIS compare in terms of performance and scalability to weblogic and websphere for enterprise web applications?

A common argument against using .NET for high volume, transactional enterprise systems is that IIS does not compare to the likes of Weblogic and websphere for java. Is this true? Unfortunately for .NET web apps IIS is the only option as an application server. Does anyone have any arguments against this? I would like to promote .NET more ...

Image Classification Algorithms Using Java

My goal is to implements different image classification methods to show how they function and the advantages and disadvantages behind such methods. The ones I want to try and implement using Java include; Minimum distance classifier k-nearest neighbour classifier. I was wondering what can be used to accomplish my task that already ex...

Can you recommend an open source workload automation (job scheduling) tool?

I need a workload automation tool, similar to BMC Control-M or CA Autosys which is open source and preferably written in Java. What do you recommend? ...

How do I override the GenerationType strategy using Hibernate/JPA annotations?

I'm considering using Annotations to define my Hibernate mappings but have run into a problem: I want to use a base entity class to define common fields (including the ID field) but I want different tables to have different ID generation strategies: @MappedSuperclass public abstract class Base implements Serializable { @Id @Col...

How to concatenate characters in java?

How do you concatenate characters in java? Concatenating strings would only require a + between the strings, but concatenating chars using + will change the value of the char into ascii and hence giving a numerical output. I want to do System.out.println(char1+char2+char3... and create a String word like this. I could do System.out.pr...

htmlentities equivalent in JSP?

I'm a php guy, but I have to do some small project in JSP. I'm wondering if there's an equivalent to htmlentities function (of php) in JSP. Thanks for your time. Best regards. ...

Regex to replace all \n in a String, but no those inside [code] [/code] tag

Hi, I need help to replace all \n (new line) caracters for in a String, but not those \n inside [code][/code] tags. My brain is burning, I can't solve this by my own :( Example: test test test test test test test test [code]some test code [/code] more text Should be: test test test<br /> test test test<br /> test<br /> test<br /...

When would you use the Builder Pattern?

What are some common, real world examples of using the Builder Pattern? What does it buy you? Why not just use a Factory Pattern? ...

Explicit vs implicit call of toString.

Hello, I used to use the implicit call of toString when wanting some debug info about an object, because in case of the object is null it does not throw an Exception. For instance: System.out.println("obj: "+obj); instead of: System.out.println("obj: "+obj.toString()); Is there any difference apart from the null case? Can the...

How can I turn off anti-aliasing for one specific JLabel?

How can I turn off anti-aliasing for one specific JLabel? It uses a very small font which might look better without anti-aliasing. If important, I'm using Java 1.5 on Mac OS X. ...

Problem with return statement

I have problem with return statment >.< I want to store all magazine names into ArrayList<String> ListNameMagazine = new ArrayList<String>(); I have a DB; in the DB there is a table name_magazine and the data in name_magazine is Magazine1 Magazine2 Magazine3 Magazine4 This my main: ShowData Show = new ShowDa...