Is it slower to iterate through a list in Java like this:
for (int i=0;i<list.size();i++) {
.. list.get(i)
}
as opposed to:
for (Object o: list) {
... o
}
Hi,
I am getting the following error when deploying an application on JBoss 4.2.1
7:05:59,673 ERROR [Application Name]StandardWrapper.Throwable
java.lang.IllegalStateException: Application was not properly initialized at
startup, could not find Factory: javax.faces.context.FacesContextFactory
I browsed the net and I found many posts which suggested to add an entry in web.xml but that entry was already there. And all the required libraries are there in web-inf.
So any solutions anybody ?
This question got me re-thinking about something that always bothered me:
Does Java need tuples?
Do you feel the lack of them in your day-to-day work? Do you think tuples would simplify otherwise complex data structures you find yourself implementing?
I have a simple xml file and I want to remove everything before the first tag.
.....
item1
....
The following java code is not working:
String cleanxml = rawxml.replace("^[\\s\\S]+<item>", "");
What is the correct way to do this? And how do I address the non-greedy issue? Sorry I'm a C# programmer.
Say your application is unresponsive and you cannot attach a debugger to it, as it rejects everything. All you have is a Linux Bash and process id. How would you investigate the issue? What tools would you use? My goal is to better my troubleshooting skills using Java.
This particular issue we had in production, on customer site.
I just want that my program or method should run at specific date and time.
i have heard about Timer and TimerTask in java api. But don't know exactly how to use it.
hi,
I need the java code snippet for the below logic:
Following is a string and I need to validate the string based on the below condition :
"100 or 200 and 345 not 550 " - Valid string
"abc or 200 and 345 SAME ** 550 " - Not a Valid String
1 . the operands(eg 100,200 ..) should be positive numbers
2 . the operator should be and/or/not
Thx
hello!
I need to extract the zipcode from file's line.
each line contains an adress and is formatted in a different way.
eg.
"Großen Haag 5c, DE-47559 Kranenburg"
or
"Lange Ruthe 7b, 55294 Bodenheim"
the zipcode is always a five digit number and sometimes follows "DE-".
I use Java.
Thanks a lot!
Is there a way to get all possible values from a MySQL enum column?
The MySQL documentation says the MySQL enum type is returned as a Java String, so I basically would like a way to get all possible strings I can pass when querying a table with such an enum.
I couldn't immediately find anything when I was looking through the metadata returned for such a column, but since enum isn't standard SQL, I'm not sure it's even possible... any suggestions?
This post is similar to this post, but not exactly, so I'm asking this question.
How does one go about, From a Java WebStart app:
launch a new browser window with a target URL?
bring an existing browser window into
focus with a target URL?
Is the solution OS/platform independent? Does it matter which browser you're talking to?
Hi, everybody. I invoked shell command by Process class of java and it gave "stty: standard input: Invalid argument" no matter the command is right or wrong (normal output of shell command is shown too). If I run the shell command in shell, no such error message shows. I can't figure out why.
Thanks
can any one give me the source code for mp3 streaming blackberry java application with play/pause, volume slider controls... with background too...
thanks in advance.
:)
Hi there,
How would I be able to handle downloads using HttpResponse in Java? I made an HttpGet request to a specific site - the site returns the file to be downloaded. How can I handle this download? InputStream doesn't seem to be able to handle it (or maybe I'm using it the wrong way.)
Is there a way to get Class object from the type variable in Java generic class? Something like that:
public class Bar extends Foo<T> {
public Class getParameterClass() {
return T.class; // doesn't compile
}
}
This type information is available at compile time and therefore should not be affected by type erasure, so, theoretically, there should be a way to accomplish this. Does it exist?
I find it curious that the most obvious way to create Date objects in Java has been deprecated and appears to have been "substituted" with not so obvious to use lenient calendar. So...
How do you check that a date given as a combination of day, month and year is a valid date? For instance a date 2008-02-31 (as in yyyy-mm-dd) would be invalid date.
I'm trying to find a balance between performance and degree of compression when gzipping a Java webapp response.
In looking at the Deflater class, I can set a level and a strategy. The levels are self explanatory - BEST_SPEED to BEST_COMPRESSION.
I'm not sure regarding the strategies - DEFAULT_STRATEGY, FILTERED and HUFFMAN_ONLY
I can make some sense from the Javadoc but I was wondering if someone had used a specific strategy in their apps and if you saw any difference in terms of performance / degree of compression.
Thanks,
Keyur
Hi,
Can somebody point me to some tutorials and best practices that show to make a build from source code for a java desktop / jee web application ?
I want to learn what needs to be packaged as a war/jar from source and how it must be structured?
br
/jon
Hi All
To build a java-based GUI using jsp and servlets, what are the different factors that go into selection of frameworks like AJAX, JSF, Struts 1/Struts 2 etc.
Also for each of the above pls throw some light on, what are the libraries, toolkits and IDE which are available?
Thanks.
I have created 8 tabs in a tabbed panel using Java Swing. The problem is when I enter data in any tab and click the save button. After clicking it leaves the present tab/panel and goes to the first tab.
I have to retain on the same tab after clicking the save button.
Please help me on this.
when i try to compile this:
public class Risk
{
}
class territory
{
public static void main (String[]arg)
{
System.out.println ("hi") ;
}
}
I get this error message:
Exception in thread "main" java.lang.NoSuchMethodError: main
whats going wrong here?
Is there a way/tool to auto convert Java source code from using raw types to using generic types?
I have some legacy code with 677 references to raw types:
ArrayList 47
Vector 420
Hashtable 61
Enumeration 64
Class 7
Iterator 78
TOTAL 677
Now I could manually look through the code to infer the generic types and replace, but that is going to take a long time.
Java Socket Program did not work for WAN
I have written a TCP IP socket program which works fine in my LAN.
One of my friend is at bangalore He ran the server and I ran the
client with the host name of my friend's IP. In this case my
socket program did not work.
hi all , BigDecimal is a class in java.math package it has a lot of benefits for handling big numbers with certain scale . is there an equivalent class or data type in c# with this features