java

Cosine Similarity

Hi All, Thank you all great guys here for helping people like me :) I just need small hint .... I calculated tf/idf values of two documents. Following is the tf/idf values 1.txt 0.0 0.5 2.txt 0.0 0.5 The documents are like 1.txt = > dog cat 2.txt = > cat elephant As now I have tf/idf values. Can any body tell me how to use these valu...

what is the use of character stream in java?

what is the use of character stream in java? why we need while there is byte streams?I hav gone through many sites i dint get it clearly...Please make me clear...please dont paste google results ...

Deadlock situation in threads?

want to know what is deadlock condition in threads, because in many of the books i studied how to avoid deadlock situation, i just want to know what is deadlock situation and a example code for that? ...

How to Use context menu with tray icon in Java?

I'm using Netbeans to develop a Java application and I want to create a tray icon at system tray and a popup menu will be display when I right click on tray icon. I have created a jframe and popup menu by drop and drap them. But I have a problem.My popup menu have 2 menu items (Exit and Show Login) but selected menu item is not high-li...

Java JNI - associating resources allocated in C with java objects?

I want to allocate some memory in C and keep it associated with a java object instance, like this: void configure(JNIEnv *object, jobject obj, ....) { char *buf = new char[1024]; // associated <buf> with <obj> somehow } And then later free the memory when the java object gets garbage collected - I could do this by calling a JNI fu...

Control sort order of files in zip archive

Description I'm interested in learning if there is any way to control sort order of files inside zip files using standard routines in PHP and/or Java. I'm not primarily interested in using zip/unzip using shell_exec() or similar, but it can be of interest if it provides with an easy to read solution. With sort order it's safe to assum...

Scriptlets over EL

Hi what is the advantage of using EL over scriptlets in JSP.EL is said to be scriptfree language ...

Tomcat not shutting down within Eclipse.

I'm building a relatively simple web-app where the main servlet implements the ServletContextListener interface to determine whether the context has been started or stopped. I've implemented my contextInitialized, contextDestroyed, init and destroy methods (both init and destroy call super on the base class). I've currently implemented n...

Xstream: Implicitly ignoring all fields

How do I tell Xstream to serialize only fields which are annotated explicitly and ignore the rest? I am trying to serialize a hibernate persistent object and all proxy related fields get serialized which I don’t want in my xml. e.g. <createdBy class="com..domain.Users " reference="../../values/createdBy"/> is not something I wan...

implementaion independent communication within a process

is there any way two threads within the same process can communicate without knowing anything about each other's interface ? basically, one thread is a STOMP server, the other is a client. they're supposed to communicate in a direct manner (not via a socket) and it should be independent of the implementation so i can't assume either of ...

JFrame action listener - Erron

I have create a Java application using xcode. In that application i am getting the error in the following declaration - Public class testapp extends JFrame implements ActionListener{} the error is - "testapp is not abstract & does not override abstract method actionPerformed (java.awt.event_ActionEvents) in java.awt.events_ActionListe...

How to create a jsp Form with validation and mail form details to administrator?

Hi, I am new to JSP and related technologies. I need to write a JSP form with some required fields (including Captcha), the form will require validation. Upon successful submission of the form, it should be able to email to a stated email address which is grabbed/parsed from a .txt file. That is basically the flow. But technically how ...

enterprise with jdbc

I have enterprise project, but all queries are implemented using oracle stored procedures, I use jbdc and Spring framework to get results like this : public class HoaDonDAOimpl extends JdbcDaoSupport implements HoaDonDAO { public List<HoaDon> getDsTatcaHoadonPhathanh(int vthang, int vnam, String vmaDvqltb) throws Exception { Ca...

Opensource packaging software for Mysql Server with Java Desktop Application

I have a Java desktop application which uses mysql database . Is there any Open source software for packaging or executable wrapper of Mysql server and Java desktop application into one single Exe/Debian package where i need not separately install Mysql server separately . Its like one click installer which installs everything and the...

Can't I use annotation to indicate a bean is a primary bean

We know in Spring, <bean> has an attribute "primary" to indicate a bean is the first candidate if there are multiple beans are available to be autowired to a property. But now all my bean definition are declared using @Component/@Service, etc, I can't find the corresponding "primary" attribute I can use to declare a bean. Please advis...

Java: ResultSet closing strategy, apart from closing it in finally

I am facing ORA-01000: maximum open cursors exceeded although I am closing the resultsets in finally block. But I suspect there is some trouble with my legacy code, below is my pseudo-code while (someCondition) { rs1=executePreparedStatementNew(query1,param1,""); //do something with rs1 rs1=executePreparedStatementNew(query2,param2,"")...

Method has the same erasure as another method in type

Why is it not legal to have those two methods in the same class? class Test{ void add(Set<Integer> ii){} void add(Set<String> ss){} } I get the complication error "Method add(Set) has the same erasure add(Set) as another method in type Test". while I can work around it, I was wondering why javac doesn't like this. I can see tha...

clear jBoss DLQ

hi, Does anyone know how to clear DeadLetterQueue from jBoss? When i start jBoss, it is waiting 4 minutes at: 12:09:06,281 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS' and other 4 min at: [DLQ] () Bound to JNDI name: queue/DLQ a...

Logging Key and Mouse events in java

I would like to capture key strokes and mouse events being entered into a different window, eg such as a browser. What is the best approach to doing this, and no i dont want to be sneaky and capture bank account passwords. I appreciate that this requires JNI in order to setup some hooks and the like with the current host OS. I could not...

The best tool for build swing UI visually

What is the best and powerful tool for building swing interface? What tool do you use for swing? Why? ...