java

Correct way to synchronize ArrayList in java.

Hi there, So basically I'm not sure if this is the correct way to synchronize my ArrayList. I have an ArrayList "in_queue" which is passed in from the registerInQueue function. ArrayList<Record> in_queue = null; public void registerInQueue(ArrayList in_queue) { this.in_queue = in_queue; } Now I'm trying to synchroniz...

Equinox: Update of bundle lost after framework restart

Hi all! I've got a running equinox osgi framework with a bunch of started bundles. Now i update a bundle using the osgi console via 'update . (or use provided method: bundle.update(url)); Everything works perfectly... but if i completly restart the osgi framework the previously updated bundle is in the original state again (as it was ...

How to Solve Equations with java ?

Hi guys, according to below 3 Equations x+y+z=100; x+y-z=50; x-y-z=10; how to get the value of x,y,z with java? ============================================= String equation1="x+y+z=100;"; String equation2="x+y-z=50;"; String equation3="x-y-z=10;"; int[] SolveEquations(equation1,equation2,equation3){ // to do //how to do ? } =...

Dynamic language switching in an Eclipse RCP application

I am working on an Eclipse RCP application with localization. A user should be able to change the language used in the application on the fly. A restart of the application should not take place during this language switch. It should also be possible to switch between languages written from left to right and languages written from right t...

Generating java code parse trees and evaluating it for testing

We have a need to generate Java source code. We do this by modeling the abstract syntax tree and have a tree walker that generate the actual source code text. This far all good. Since my AST code is a bit old, it does not have support for annotations and generics. So I'm looking around for open projects to use for future projects with c...

Java and Kerberos authentication krb5.conf versus System.setProperty

Hello, Please help me on a kerberos+Java problem. I have a simple Java program to authenticate to a Windows Active Directory using Kerberos. The following java code works fine without any problems and prints true- public class KerberosAuthenticator { public static void main(String[] args) { String jaasConfigFilePath = "/myD...

Depth first search using java

I want to implement DFS (Depth first search) and BFS using java. Does java have a built in tree data structure that I can use readly? Or any other thing that I can use? ...

Hibernate mapping error

I have created an .hbm.xml file : <xml version="1.0"?> <hibernate-mapping package="com.cmp.iard.sinistre.hbm.dossier"> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd > <class name="Personne" table="NOYS_PERSONNE" > ...

Is there a way to get which classes a ClassLoader has loaded?

I am trying to implement some unit testing for an old framework. I am attempting to mock out the database layer. Unfortunately our framework is a bit old and not quite using best practices so there is no clear separation of concerns. I am bit worried that trying to mock out the database layer might make the JVM load a huge number of clas...

Java: DBunitils + Spring: Different Hibernate-Dialect

I currently use spring for depency injection. Hibernate uses a postgres dialect for the normal run, but I want to use HSQL for the DBUnitils Databank-Testing. My Spring-Configuration contains this: <!-- Hibernate session factory --> <bean id="sessionFactory" class="org.springfram...

Playing audio files in web page?

I trying to write web application that recieves audio files from database and play them.Do you know any open source flash audio player for that?And i am also thinking implementing in java do you suggest java or another programming language for that? ...

Java: Parse a mathematical expression given as a string and return a number

Is there a way in Java to get the result from this mathematical expression: String code = "5+4*(7-15)"; Ie, what's the best way to parse an arithmetic expression? ...

How to deploy.WAR into jboss 5.1.0

Hi All, Could you please help me how to deploy the .war file in jboss 5.1.0 . Here is the error by throung jboss 5.1.0 Note:MY RIFacelate.war contains ricefaces implemation Error 2009-09-16 12:58:26,772 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/RIFacelets 2009-09-16 12:58:26,991 INF...

class importing in jython

I've got a jython script that needs to include a class (from JUnit in this case). I've got the junit jar in "some/path/junit.jar". My script is: from junit.textui import TestRunner TestRunner.Main(["name of some class here"]) I'm running it like this: java -cp "some/path/junit.jar" -jar jython.jar script.py but it complains that: ...

Maven Default Separator

Hi All, In a pom.xml, if we are trying to compile and create a JAR, the name will be taken as <artifactId>-<version>.jar Is there a property or setting which can change the default separator '-' to something else? I know that we can rename it after a jar has been created (or by using finalName). I was just wondering whether anyone ...

How to use String as Velocity Template?

What is the best way to create Velocity Template from a String? I'm aware of Velocity.evaluate method where I can pass String or StringReader, but I'm curios is there a better way to do it (e.g. any advantage of creating an instance of Template). ...

Multiple values in java.util.Properties

It seems that java.util.Properties assumes one value per propery key. That is, foo=1 foo=2 is not expected, Is there a class for this kind of multi-value property sheet, which also provides the load method? ...

Java: shortest way to reverse Properties

I java a java.util.Properties object and I want to obtain another one with the same pairs but keys are converted to values and viceversa. If there are collision (i.e. there are two equal values) then just pick as value an arbitrary key. What is the shortest way to do it. Feel free to use libraries, commons-collections, or whatever. ...

java.lang.NullPointerException on Hibernate persistent class

I have a persistent class Approvisionnement in my .hbm.xml file : <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > <hibernate-mapping package="com.afrikbrain.iard.srv.attestation"> <class name="Approvisionnemen...

When using facade session beans, why should we still use business session beans as well?

When using the facade design pattern to structure an application's business EJB layer, why should we still use session beans for the actual business logic? Is there a specific reason for not just using plain Java classes (if container managed injection isn't required)? How is the performance of a plain Java class versus a session bean, w...