java

Rules Engine in C or Python

I am looking for a rules engine in C or Python, but if you know a rules engine that is implemented in another language I would be glad to know about it. The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc. So no "office" rules there (aka do you rules in Excel or such). I have l...

Writing to temp dir fails when running as SYSTEM on Win7

We have a Java application that includes components that run as SYSTEM on Windows machines. On Windows 7 x64, one component fails when trying to unpack the jnidispatch library: Exception in thread "main" java.lang.Error: Failed to create temporary file for jnidispatch library: java.io.IOException: The system cannot find the path specifi...

How to get JDBC connections obtained from a JNDI datasource to participate in a UserTransaction using Weblogic 10.3?

I am currently retrieving both a UserTransaction and a DataSource from a Weblogic 10.3 server using JNDI. I have set the Datasource up to 'Support Global Transactions' and to use 'Logging Last Resource' My hope was that by beginning a UserTranscation and then retrieving a JDBC connection from the Datasource the connection would partici...

Determine if a year is leap and if a date is valid in Blackberry

i get a date input from the user..in this case i need to determine if the year the user entered is a leap year or not ...and after the user has entered the entire date i.e the month date and year...i need to check if the date is in fact valid if yes need to determine the day for that particular date.. can some one tell me how this could ...

Swing Worker Modal Dialog Won't Close

I have a SwingWorker thread that launches a modal dialog box (from a property change listener that listens to the StateValue of started) and the swing worker proceeds to do its work. However, it looks like the done method is not called because that is called on the EDT but the swing worker's modal dialog is blocking the EDT. So, I can't ...

Can I parse relative times with JodaTime?

I'd love to be able to parse relative strings like now and yesterday and get JodaTime DateTimes. Is it possible? DateTimeFormat.forPattern and doesn't seem to support English relative times and I don't know of any other parsing options in JodaTime. I should add that I'm using scala-time but can easily drop down to the actual JodaTime cl...

Can someone help me speed up my netcode in Java?

Okay, So I'm working on a game (like not even alpha yet) and it's suppose to be a 1 on 1 fighting game where one person hosts the server and the other one connects. But right now the code is too laggy to do anything with. Can someone take a look at it and tell me how to speed it up? PS: I'm also using the Slick2D lib. Server: import ja...

Client/server project structure, folder structure, build files, etc.

I'm writing a client and server application. Right now I've just been developing it on my own, so I have written it as one Eclipse project, organized into Java packages (org.myorg.server, org.myorg.client, org.myorg.networksystem, etc.). The project deploys to a single jar file. Then, the client is an applet, so I simply point the applet...

Why does HashMap#containsKey take an parameter of type Object?

A coworker encountered a bug where HashMap#containsKey was used to verify if a key-value pair exists. The specified key was a different type so the method would always return false. For example (Let's assume the map is populated with objects that he wants to retrieve): Map<String, String> map = new HashMap<String, String>(); Long valu...

Eclipse 3.5.1 uses lot of memory

Hi, I have migrated to Eclipse 3.5.1 and observed it is taking 560 mb when doing clean build. And memory is not getting collected after used. It stays like this. Any solution to this? JVM : jdk1.6.0_17 Windows XP, 2GM RAM Below is my eclipse.ini -showlocation -showsplash org.eclipse.platform --launcher.XXMaxPermSize 384m -startup p...

Building a Java EE app on Mac OS X Snow Leopard for Glassfish 3

I'm having a bit of a problem building a Java Enterprise Edition web application on Mac OS X 10.6.2 using Ant 1.7.1, Glassfish v3 and Java EE 6. The problem is that the build process does not find the Java EE libraries which fair enough as I don't think Apple supply them with the default Java installation but I know they exist in the Gl...

Hibernate sort by properties of inner bean ?

In my domain model I have following Classes.A 'UserProfile' has one 'SecurityPrincipal' class SecurityPrincipal{ private String loginId; private String password; private Date registeredData; private int status; } class UserProfile { private String name; private String company; private SecurityPrincipa principal } I want to ge...

Why does double brace initialization asks for SerialVersionUID?

public static List<Long> abc = new ArrayList<Long>(){{ //Asks for SerialVersionUID abc.add(5L); abc.add(7L); }}; public static List<Long> abc = new ArrayList<Long>();//Does not need SerialVersionUID static{ abc.add(5L); abc.add(7L); } ...

Please suggest some tutorial for learning pointcut expression

Please suggest some tutorial/cheatsheet for learning pointcut expression. ...

Hibernate and order by using column values

Is there a way I can pull off the below query (order by followed by a like) using hibernate criteria api? select * from table where first_name like 'bar%' order by first_name like 'bar%' desc ...

Spring - config apache commons email

I want to use HtmlEmail in apache commons-email in a spring app, so i use the config xml as following: <bean id="commonsEmail" class="org.apache.commons.mail.HtmlEmail"> <property name="hostName" value="smtp.example.com" /> <property name="TLS" value="true"/> <property name="smtpPort" value="587"/> </bean> But i can't initialize it...

Java: Large collection and concurrent threads

Hello. I am facing this issue: I have lots of threads (1024) who access one large collection - Vector. Question: is it possible to do something about it which would allow me to do concurrent actions on it without having to synchronize everything (since that takes time)? What I mean, is something like Mysql database works, you don't have...

how to generate sphinx speech phonems and map them to a word

Hi, I want to develop a speech recognition engine in java using sphinx.My language is not english.Using an english language model produces unexpected results.I wanted to know if its possible to generate a list of phonems for my own language and use it map words in a dictionary.I dont know where to begin with this.Do i have to record pron...

serialization and versionId

please help clarifying the doubt : While doing serialization, if we have defined the version id as static final long serialVersionUID = 2L;, and since this being static it should not get serialize while storing the object to the persistent medium. While reading the object back from persistent medium, how does the object match the ver...

Redirect classes to a remote location in eclipse

I am using eclipse 3.2 in windows environment. I have deployed the webserver in Solaris environment. I want to redirect the class files to the WEB-INF/ folder of the web server in Solaris. I tried using the RSE plug-in of the eclipse. I could see and access the files using the remote explorer but could not transer / redirect the class fi...