java

How to switch JProfiler launcher in Eclipse integration

The JProfiler plugin of my Eclipse IDE (Eclipse 3.5) is configured to work with JProfiler 6.x which is installed on my machine. I'd like to configure my Eclipse to work with JProfiler 4.x which is also installed on my machine. How can I do it through Eclipse UI? Tried to find this option in Run --> 'Profile Configuration' but couldn't ...

Java RMI - client to server call

Trying to get an understanding on how the RMI is working (I have a simple application that uses RMI and seems to work just fine). My question is : What happens when an rmi call is made? What happens on the way from an rmi client to an rmi server? ...

what is best way to paging big Resultset -Java

hi, i am looking for best aproach from perfomance point of view , to show Resultset on webpage partially , lets say by 10 item per page and if user want to see more result, he pressing "next" btn . i think (probablly wrong) it should be new request to the Server when "Next" button is pressed ?? currentlly i trying to learn Java,GWT ...

string manipulation

Hi, I am creating a request string which hast bo be formatted the following way: http://staging.myproject.com?tags=tag1,tag2,tag3 There is an EditText dialog on the form where the user writes the tags. The user however can write the tags in the EditText whatever way he wants, for example using commas: tag1, tag2, tag3 or tag1,tag2,tag...

Hibernate Criteria returns children multiple times with FetchType.EAGER

I have an Order class that has a list of OrderTransactions and I mapped it with a one-to-many Hibernate mapping like so: @OneToMany(targetEntity = OrderTransaction.class, cascade = CascadeType.ALL) public List<OrderTransaction> getOrderTransactions() { return orderTransactions; } These Order's also have a field orderStatus that ar...

Smart annotation

Hi I have created many annotation in my life and now came to strange case that i need this annotation to do and dont think it is supported by Java at all. Please someone tell me that i am right or wrong. Here is my annotation : @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface DetailsField { public ...

What is the use of marker interfaces in Java?

When there is nothing to implement in the marker interfaces like Serializable . . what is the use of implementing it? ...

Detect encoding of RTF document in Java

My Java program does text extraction on RTF files using the RTFEditorKit. Some of the RTF files contain cyrillic characters (Russian), and depending on the RTF version, the extracted text is either okay or contains gibberish. When it's gibberish, I can use this to get normal text: String text = ... // extracted text String decodedText ...

Combining use of wildcard in methods and in type of receiver in Java.

Hi, I am trying to use a combination of wildcards in the type of the receiver and in the type of an argument to a method in Java. The context is that of defining a container. Now, the type Container should not admit insertions whatsoever, since this type does not specify the type of the contained objects. However, if the underlying data...

What is the best way to profile/optimize google app engine application?

Currently I am working on new App Engine application. Unfortunately it seems that my application uses to lot of resources even for relatively small user number. So I need to determine its bottle necks and optimize them. ...

How to get structure of a Google Protobuf message without the definition

I have to get the message structure of a protobuf message transfered to me without the message's definition. Using UnknownFieldSet methods, I was able to get a string representation of the message as below: 1: "a" 2: { 3:"b" 4:"c" } What data structure does field 2 represent ? Using UnknownFieldSet.Field.getGroupList i was able ...

Java: Performance SQRT Calculations

Hi, I have this code: package math; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { System.out.println("Hi, I will beat Java's Math.sqrt(double) method"); System.out.println("Both ways of calculation will be done"); S...

J2ME text field to double

Is there a way to convert the string from a text field to a double in j2me? And what is the name of the string that comes out of the text field? ...

How to configure Java's SaxParserFactory to disable entity checking?

I am writing a screen scraping app that reads out various pages and extracts the data. I'm using the SAXParserFactory go get a SAXParser which in turn gets me an XMLReader. I have configured the Factory like this: spf = SAXParserFactory.newInstance(); spf.setValidating(false); spf.setFeature("http://xml.org/sax/features/validation", fal...

Generate bytecode from Eclipse's CompilationUnit

I am not working on an Eclipse plug-in project; however, I use an external library that generates an instance of org.eclipse.jdt.core.dom.CompilationUnit. Is there a way to generate Java bytecode from it? Some searching revealed that CompilationUnit's are typically built by registering a custom builder for the Eclipse project, then lett...

how to retrieve multiple selected values from <select multiple > in java code ?

code is below: <select name="merTransactionTypeId" class="cbox" multiple> <!-- <option value="0" <%=request.getParameter("merTransactionTypeId")!=null?"0".equalsIgnoreCase(request.getParameter("merTransactionTypeId"))?"selected":"":""%>>All</option> --> <option value="2" <%=request.getParameter("merTransactionTypeId")!=null?"2...

What is the best Java text indexing library for Google App Engine?

To the moment I know that compass may handle this work. But indexing with compass looks pretty expensive. Is there any lighter alternatives? ...

Scala, the java of the future(?)

I'm trying to figure out the popularity of scala and how many SO users actually use it in the workplace? Here are some scala links ...

saving images from webcam stream directly to web server with java

Is it possible to save images directly from the webcam of my system to a web server in Java? Maybe it can directly passed to an URL address and can be GET at the server or anything else. ...

Java Class (PermGen) Memory Leak (Web Applications) - Generic Solution?

I have a perm gen memory leak, that I know. Profiling using jvisualvm shows that when doing hot deployment (e.g. stop and start an application without killing the JVM, in tomcat, WebSphere, WebLogic etc) - the PermGen space is constantly increasing. After reading, using jhat, and other advanced tools I realized that I probably have a re...