hi. i have this really big table with some millions of records every day and in the end of every day i am extracting all the records of the previous day. i am doing this like
String SQL =
"select col1, col2, coln
from mytable
where timecol = yesterday";
Statement.executeQuery(SQL);
but the problem is that this program takes like...
I freaking loosing my mind on this:
I have this code:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ANetApiResponseType", propOrder = {
"resultCode",
"messages"})
and I get this error:
Type mismatch: cannot convert from XmlAccessType to AccessType
I've googled , but all these problems usually occur because some...
I have this method isPalindrome() and am trying to find the time complexity of it, and also rewrite the code more efficiently.
boolean isPalindrome(String s) {
boolean bP = true;
for(int i=0; i<s.length(); i++) {
if(s.charAt(i) != s.charAt(s.length()-i-1)) {
bP = false;
}
}
return bP;
}
Now I know this code...
I have a java properties file containing a key/value pair of country names and codes. I will load the contents of this file into a Collection like List or HashMap.
Then, I want users to be able to search for a country, e.g if they type 'Aus' in a textbox and click submit, then I want to search through the collection I have, containing a...
Hi,
I have heard about Lucene a lot, that it's one of the best search engine library in JAVA, is there any similar(as powerful) library for Ruby.
...
Hello, i just wanted your input on something with regards to java. Would it be good to use javafx for my user interface, or would sticking to swing be easier or more convenient? I'm still a student by the way, so i'm not really thinking in terms of the enterprise yet.
...
Hi,
I'm new to Java Applets. I have a problem while reloading the applet. When I resize the applet window or open some other application and then come back to the applet, the contents on the screen is redrawn. Basically my paint method is getting called. I want the contents of the paint method to be called only once. How can I accomplis...
I recently started learning Java and found it very strange that every Java class must be declared in a separate file. I am a C# programmer and C# doesn't enforce any such restriction.
Why does Java do this? Were there any design consideration?
Edit (based on few answers):
Why is Java not removing this restriction now in the age of ID...
This is some very simple code that I'm using to try showing a VerticalSplitPanel, but the widgets I add don't show. The divider thing of VerticalSplitPanels does show however the widgets I add don't.
Code:
public class MyView extends Composite
{
private VerticalSplitPanel mainPanel=new VerticalSplitPanel();
public CountryFilte...
I am processing text using Java Regexes (1.6) which contain quantifiers and I wish to return the number and values of matched groups. A simple example is:
A BC DEF 1 23 456 7 XY Z
which is matched by:
([A-Z]+){0,9} (\d+){0,9} ([A-Z]+){0,9}
How can I find the number of each capture (here 3 4 2) and the values ("A", "BC", "DEF", "1",...
I'm going to teach a Java course, and I want to show some interesting and impressive examples of simple Java programs at the first lecture to awaken student interest.
Except for the default examples which come with the JDK, what can you advise?
What possibilities of Java were you impressed by?
One more thing - students admittedly kno...
I am practicing making a web app which tries to read the user's twitter profile, display his/her friends and show his/her picture. The code example at the Twitter4j website goes:
public static void main(String args[]) thrwos Exception{
Twitter twitter = new Twitter();
twitter.setOAuthConsumer("[consumer key]", "[consumer secret]"...
I heard a rumor, that Java consumes less energy than PHP and was wondering if and how this would be true. I'm currently working in a company where we base most of our apps on PHP. Power consumption has never been the problem for us, but we are working on bigger projects where it might matter. We love PHP for web developing and are wonder...
I'm working in a JEE Environment in which each application is in a war file of its own.
In the WEB-INF/lib of each application war file there is a common jar that is shared by all applications.
This common jar contains several Singletons which are accessed from many points in the code.
Because of the war-file boundaries each application ...
I want to iterate over a treeMap, and for all 'key's which have a particular value, I want them to be added to a new TreeMap. How can i do this? Code samples would be prefered.
...
I plan on creating a toy application to play games. Is it possible to capture game data from another applications frame? I know this is traditionally done using a low level language and using dll injection but i was wondering if this is possible to do from a high level language?
...
What function is to be used in java so as to print the integer value of a string.
Please explain, maybe with the help of an example.
Example String:
String str = new String("HELLO");
...
Going nuts again with my Mac running Java 1.5.... where do I get a .jar file that has javax.xml.stream.XMLInputFactory ? I want to use StAX but don't know how to get it set up right.
:::scream::: I can't seem to get this setup. I've now downloaded jaxp-api.jar, jsr173_1.0_api.jar, sjsxp.jar, stax-api-1.0.1.jar, stax2-api-3.0.1.jar, an...
What do you have to do in Java to get the Runtime.exec() to run a program that is on the path? I'm trying to run gpsbabel which I have put into the path (/usr/local/bin).
public class GpxLib {
public static void main(String[] args) {
try
{
Runtime r = Runtime.getRuntime();
Process p = r.exec("gpsbabel -i garmi...
Hi all,
I've just started working with javafx, it seems cool and NetBeans seems much more fun than Eclipse but I find it impossible to debug my application. I've added breakpoints, and I pressed the debug button, I see the debugger is registered to some port but it doesn't cause the application to start.
When I run the application and ...