I use a class for detecting email addresses which uses static final booleans to configure the matching behavior. Since I upgraded to Eclipse 3.5 I get warnings about dead code, since Eclipse notices that one branch in this can not be reached:
private static final boolean ALLOW_DOMAIN_LITERALS = false;
private static final String domain ...
My java servlet call httpclient to get page content. may I know what is the best practice to re-use same session for same user when doing multiple sub sequence request from servlet
...
I have a variety of Velocity template files that represent e-mail messages. I am searching for an elegant way to allow the template file to output a subject line for the message as well as the contents. I have considered a few options:
Make the first line of the output something like "Subject: Bla" and strip it out in the Java. I ha...
I have a list of jars that contains jar with needed main-class.
I try to run it main class:
public static void runCommandlineMain(String classPathFile, String args[]) throws Exception{
URL[] urls = getJarUrls(classPathFile);
URLClassLoader classLoader = new URLClassLoader(urls);
Class<?> clazz = classLoader.loadClass("liqui...
Hi,
I have a test application that opens a socket , sends something through this socket and then closes it . This is done in a loop for 5-10.000 times. The thing is that after 3,4000 iterations I get an error of this type :
enter code here
java.net.BindException: Address already in use: connect
I even set the socket to be used immedi...
Vector methods are synchronized. What does it mean programmatically and logically?
...
I'm still looking for a usable documentation tool chain. Working in the Java environment but also a Python user, I wondered if Sphinx would run on Jython 2.5?
...
The method ObjectOutputStream.writeStreamHeader() can be overridden to prepend or append data to the header. However, if that data is based on an argument passed to the derived class's constructor like:
public class MyObjectOutputStream extends ObjectOutputStream {
public MyObjectOutputStream( int myData, OutputStream out ) throws...
pseudo code
service(..){
//httpclient get http://www.facebook.com
}
the above is pseudo code for java servlet, when user call this servlet service(..) from browser repeatly
for instance
1. call http://localhost:8080/callService?url=facebook.com/index.php
2. call http://localhost:8080/callService?url=facebook.com/editprofile.p...
Currently Google App Engine supports both Python & Java. Java support is less mature. However, Java seems to have a longer list of libraries and especially support for Java bytecode regardless of the languages used to write that code. Which language will give better performance and more power? Please advise. Thank you!
Edit:
http://grou...
Hi,
I have an array of integers which represent a RGB image and would like to convert it to the byte array and save it to the file.
Does anyone know what's the best way to convert an array of integers to the array of bytes in Java?
Thanks!
...
I need to make custom text field which will format numeric values according to local way of formatting. So I've made a clas:
public class NumberTextField extends JFormattedTextField
{...
constructor looks this like:
public NumberTextField()
{
formater=new NumberFormatter();
formater.setAllowsInvalid( false );
nf=Nu...
any built in methods available to convert a string into titlecase format as such??
...
I'm porting a few java gwt projects into eclipse and the projects depends on many external .jar files, some of the dependencies seem to be dynamically linked so eclipse isn't picking up the missing links while running the ide.
At run time, I often get exceptions that say for example 'import bar.foo.XML' is missing or some FooBar class d...
Consider the following case:
public class A {
public A() { b = new B(); }
B b;
private class B { }
}
From a warning in Eclipse I quote that: the java complier emulates the constructor A.B() by a synthetic accessor method. I suppose the compiler now goes ahead and creates an extra "under water" constructor for B.
I feel this is ...
Hi.
I need to manipulate large strings in Java (deleting and adding the deleted
chars again, moving chars around), but still want to remember the
original position offsets. E.g. the word "computer" starts at offset
133 in the original text and is then moved to position 244, I still
want the info that it was originally at position 133.
T...
Hi all,
I have start date and end date.
I need the number of months between this two dates in java.
For eg,
from date:29-01-2009
to date :02-02-2009
(It has jan date and Feb date).
It should return 2.
...
Is there a known order to the firing of GWT EventHandlers?
ie. If I have a class that extends ListBox and add an EventHandler from the constructor, can I be sure that this Handler will be called before another Handler which is added later on by a surrounding class?
Likewise, if a subclass takes the constructor:
Subclass() {
super(...
When I run the ant file in verbose mode, I got an error like the one below. Does anyone have any ideas what is going wrong? I am new to this
antlib:org.apache.tools.ant] Could not load definitions from resource org/apach
e/tools/ant/antlib.xml. It could not be found.
Override ignored for property "java.home"
BUILD FAILED
Target "build.....
The subject basically says it all.
XmlBeans' XmlError.getLine() always returns -1.
Is there any way to get at least an approximate position for an error?
I have already tried the XmlObject, but since whitespace, quotes, et al. are stripped or changed, that's not much help.
...