java

Drools: How to insert a fact after checking if it is not already present in working memory

Hi All, I am using drools to validate an object. The object also has a getChildrenList() method which returns the child objects related to this object (master-detail relation). I do some validations on the object and then I want to validate the child objects as well, so I insert all of the child objects as well into the working memory...

How to write content into pdf use iText ?

Right now i use iText to generate a pdf automatically. And my problem is that when the content is really very large, i need to calculate the content's height and width, and then add new page... this is really very inconvinent. so I wonder whether or not there is a method like: Document.add("a very very large article"); and after this , ...

How to indent jsp pages in eclipse

just started working with jsps and my pages look awful. Please suggest a way to have them indented. thanks ...

jsp error when using if-else with html

I have the following in my jsp page (assume that client is an object ) <% if( client == null) %> NO client <% else %> <a href='page.jsp?aid=<%=client.getID()%>'> and his name is <%=client.getName()%> thanks ...

How does ORM work under the covers? Also what is the best way to have persistent objects in Java?

How does ORM work? Are objects serialized into BLOBs? In Java, is JDO still the way to go for this? What else is available? Seems like there was a lot of talk of EJB, direct object serialization, and JDO. ...

Google Web Toolkit -- only for Gmail type applications?

I am trying to build a web application, similar in feel to something like GMail, with one persistent AJAXy page. I am told that GWT is the way to do this most effectively. However, I also want a framework that I can use for other things besides single AJAXy pages. Is GWT more scalable than this, or should I spend the time and build this...

What is the simplest solution to integrate 2 apps within a Tomcat server?

I'm new to this and is looking at Apache Camel, Spring Integration and even Terracotta. I'm looking at sharing of common data like user/groups/account/permission and common business data like inventory/product details/etc. Any example will be really appreciated. ...

A bounded BlockingQueue that doesn't block

The title of this question makes me doubt if this exist, but still: I'm interested in whether there is an implemented of Java's BlockingQueue, that is bounded by size, and never blocks, but rather throws an exception when trying to enqueue too many elements. Edit - I'm passing the BlockingQueue to an Executor, which I suppose uses its ...

Message passing to asynchronus working thread in Java J2ME

I'm working on a J2ME Bluetooth application, and one of the classes searches for other Bluetooth devices. It does this in another thread, so the GUI doesn't freeze up. The problem I have is how to pass messages to the thread. I can ask it to search, or cancel searching, and it can tell the GUI it has found some other devices. Currently...

Setting up application wide Key Listeners

How do i setup application wide key listeners (keyboard shortcuts), so that when a key combination (e.g. Ctrl + Shift + T) is pressed, a certain action is invoked in a Java application. I know keyboard shortcuts can be set JMenuBar menu items, but in my case the application does not have a menu bar. ...

Servlet control multiple request.

When i click a link im calling a servlet. When i click that link multiple time the servlet throws an error (error details not important) Though there are other work around for this fix (Like disable the link once clicked, etc) I am curious is there any way to control this thru request/response Object. ...

Creating multiple thread in JVM to fulfil high user load

I have a C program that will be storing and retrieving alot of data in a Java store. I am putting alot of stress in my C program and multiple threads are adding and retrieving data from Java store. How will java handle such load? Because if there is only one main thread running JVM and handling all the requests from C, then it may become...

change type of fields in emf editor

Hello, I'm using EMF to let the user create a model using a generated editor. In the editor properties, in one of the properties of the model I want the user to click on "..." button instead of using string value. after he clicks the "..." button i will open a dialog that I created for him to pick from a list. How do I change the proper...

How to automatically create jar in JBuilder

Have a project developed in JBuilder 2007. I can create a jar with the compiled classes and resources by right-clicking on the project in Package Explorer and selecting Export, but is there a way to set-up the project to automatically generate the jar file, whenever the source changes ? ...

How to activate JMX on remote Glassfish server for access with jconsole?

I would like to monitor remote glassfish server. I have enabled JMX Connection in domain.xml: <jmx-connector accept-all="true" address="0.0.0.0" auth-realm-name="admin-realm" enabled="true" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false"> But this didn't help. I still can't connect to server with JConsole. Then ...

Lock Free Array Element Swapping

In multi-thread environment, in order to have thread safe array element swapping, we will perform synchronized locking. // a is char array. synchronized(a) { char tmp = a[1]; a[1] = a[0]; a[0] = tmp; } Is it possible that we can make use of the following API in the above situation, so that we can have a lock free array ele...

What is the Royal Mail's PAF Address Database?

Hi, I'm struggling to understand what you would get from the Royal Mail if you bought their PAF file dataset of UK addresses. I was expecting that PAF was some form of database which you would host yourself, and the Royal Mail provide APIs into that database. However, after reading this, I'm presuming that all you get is a series of f...

Android development resources for a Java newbie

I've got one of those newfangled Android phones and want to do some app development for it and am looking for guides. I haven't really found anything that looks promising for both an Android newbie and a Java newbie though. I know PHP and code in it professionally as well as a basic smattering of some other languages so any 'for dummies...

How to visualize sent XML stream with a CXF generated client

Hi ! I would like to be able to see the XML Stream generated by my CXF generated from WSDL client. Is there a way to do this ? For example, I'm building my request with Java objects, and I would like to see the XML stream built by CXF before it sends it to the server. Thank you for your answer ! ...

jpcap for vista

Hi everyone I am using jpcap for packet capturing which is working fine in Windows XP but the same is not working on Vista Do help me out to reslove this issue ...