java

How port WaitForMultipleObjects to Java?

Hello fellows! I have some code in C++ for Windows and I intend to port it to Java. But unfortunately it is not so easy as I thought. Could someone help me, please? Please, take a look at algorithm: HANDLE hExitEvent; HANDLE hDataAvailabeEvent; while(true) { WaitForMultipleObjects(); if (hExitEvent is set) break; if (hDataA...

How to map an abstract class or interface in Hibernate HQL?

Imagine that I have a Debtor class. With Hibernate, I will define the class like that: @Entity @Table(name = "T_DEBTOR") public class Debtor { @Id @Column(name = "ID_DEBTOR") private String idDebtor; ... My DAO will then looks like: public class DebtorDaoImpl implements DebtorDao { @PersistenceContext privat...

Programmatically creating different log files using log4j

I have an automated integration test harness and would like to streamline the logging (which is implemented using log4j) I have a number of high-level tests, each with an id and require a separate log file per test. As the tests are created randomly the ids are not known until runtime. Therefore I would like to ensure that logging wit...

How to get local time zone name from Ruby in the same way as Java does?

I need to find out local machine time zone name from Ruby (from the TZInfo::Timezone.all_identifiers list of values). I need it so that I could set correctly Oracle database session time zone so that I could handle correctly timestamp with time zone values in the database. I would like to get the same value that in Java you could get wi...

linux shell and java

Hi! I want to send a command to linux shell and get it's response with java.How can i do this? ...

java.lang.VerifyError after extending class

I'm extending the JFreeChart ChartComposite class. When I try to create the instance of extended class I'm getting java.lang.VerifyError : .... incompatible object argument for function call error. ...

single cell read only in excel using java

hi, how can i make a cell read only in excel using java Thanks in advance ...

hibernate session error

I use hibernate for persistence. when i call the method : Session s = getCurrentSession(); s.flush(); i geth the following message : [toString() unavailable - no suspended threads] and it just stops running after the s.flush() method. I'm using JBoss IDE 1.6 and the message is shown within the Variables window when debugging. do y...

Fitnesse SLIM Query Table - Stopping empty cells from failing?

Hi, I've got a large set of Fitnesse (For Java - v20090513) tests which are executed against a SLIM Query table. To help with the testing (explain why we're getting certain results) I've added a new column to the end of the table. The idea is that the cells for that column would be empty (||) as they're not required to be tested agains...

Handling requests using threads

I am writing an application using JSP & Jdbc, Where i have a table name "COMMENT_DATA", In which user can post their comments on that. So now If more than one user is writing comments and posting it at the same time, I am going for threads. So I will be Synchronizing the method which inserts the data onto the Database. Then how to handle...

java.lang.NoClassDefFoundError: ProceedingJoinPoint

We have a number of web service client applications which interface between our main customer facing application and backend web services. These web service application generate their own JAXWS stub code to directly interface with the web services and implementation code to provide a clean interface between the JAXWS code and any applica...

Checking strings for empty

Very tired this morning so if this is obvious then thats my excuse !!! i am using a buffered reader to read through a csv file - but i dont want to add any empty spaces, as in " " the problem is - when i read the line i am checking if the string length is > 0, if so then add, however the string " " is of length 4 - even tho its empty ...

What is the difference between association and dependancy relationship?

What's the difference between Association and Dependency? Aren't they both the same thing? as if class A is associated with B then Class A is dependent on B ie. there's a dependency between A and B. ...

Regular Expressions in java

I want to restrict input to match the statement change = where word and value are both arbitrary words (sequences of characters that don't include spaces) and only one space exists (between the word "change" and a) in the input. For example, "change variable=value" is valid but "change variable= value" and "change this" are not. My att...

Generate WSDL from java class\source

Hi. I have a package with "logic" classes(like CheckAuthenticationDataLogic.java, GetVocabulariesLogic.java). And another class - ApiService.java is used to generate wsdl. ApiService.java is full of methods like this: /** * Check authentication data. * @param contractNumber - number of contract. * @param msisdn - msisdn. * @...

Android: TextView automatically truncate and replace last 3 char of String

If a String is longer than the TextView's width it automatically wraps onto the next line. I can avoid this by using android:singleLine (deprecated) or by setting android:inputType="text". What I now need is something that replaces the last 3 characters of my String with "...". Since I'm not using a monospace font this will always be dif...

Dealing with RollbackException in Java

Hey, Is there any way to "replay" transaction? I mean, sometimes I get RollbackException and rollback the transaction. Can I then "clone" the transaction and try again, or once rollback is called, transaction is lost? I really need the changes, and really don't want to trace every change for rerunning later... thanks, udi ...

Is there a cross platform way of handling named pipes in Java or should I write my own?

I'm writing a bit of JNI code where a DLL running in the process space of various processes on the system needs to talk back to a java process. I've decided to use named pipes to do this (for various reasons) after weighing up shared mem/sockets/rpc etc. My question is, is there a nice way of handling named pipes in Java or should I wr...

Controller in Struts

what is Controller in MVC. Is it struts.xml or Servlet (Action Class) Can we have more than one Controller in our application. is it good practice to have more than one controller. ...

Web SSO solution that's easy to implement?

I'm looking at a SSO (Single Sign On) solution to fit our relatively simple use case. Website1 - currently authenticates with database user table. Website 2 [new] - wants to use the same authentication information and when user clicks link to website1 they shouldn't have to re-login. Website1 is J2EE based running on Websphere. Web...