I'm playing around with Reflection and I thought I'd make something which loads a class and prints the names of all fields in the class.
I've made a small hello world type of class to have something to inspect:
kent@rat:~/eclipsews/SmallExample/bin$ ls
IndependentClass.class
kent@rat:~/eclipsews/SmallExample/bin$ java IndependentClass
...
I'd like to create a queue monitoring container-managed component in a Java EE 5 app. The queue is a database table and every 5 mins or so the monitor would look for records that match certain criteria in that table. If there are any matching records, the monitor starts some kind of processing in a new thread. This sleep-check-do work...
What is the difference between Math.random() * n and Random.nextInt(n) where n is an integer?
...
I have an application in which users frequently leave the page running in their browser all day. The page has an intervalrendered that updates data every 30 seconds.
However, if the user doesn't interact with the page for a while, it still expires. I'd like it to auto-extend for as long as the browser is open and making the scheduled r...
Hi,
I'm trying to analyze the usage of "#include" in C files (what is included first, dependencies...).
To do so, I extract from a C file the "#include" and I'm building a graph. I would like to identify common patterns in this graph...
So far, I'm using JGraphT as the graph engine (not sure this is the correct expression) and JGraph ...
I've got an XML file storing an array of shorts in my resources. I need to assign this array, but Android API only provides a way to get array of ints (getResources.getIntArray()). I've ended up getting an array of ints and converting it to array of shorts later, but that's hardly ideal.
Is there a way to get an array of shorts from And...
In a paper about the Life Science Identifiers (see LSID Tester, a tool for testing Life Science Identifier resolution services), Dr Roderic DM Page wrote :
Given the LSID urn:lsid**:ubio.org**:namebank:11815, querying the DNS for the SRV record for *_lsid.tcp.ubio.org returns animalia.ubio.org:80 as the location of the ubio.org LSID se...
Hi,
I have this code, can you help me to solve this problem?
I have written this code:
out = new DataOutputStream(urlConnection.getOutputStream());//exception occur
String content = (String) remoteUrlList.get(urlID + ".params");
content = (content == null ? "" : content + "&") + "content=" + URLEncoder.encode(textArea.getText());
if...
how do I get the value of X, Y, and Z from a string "vt X,Y,Z"
...
What's the easiest static (non-animating) 3d model format to load with Java? I used .obj in C++, but that's a pain to do in java. Is there anything better?
...
I downloaded NetBeans 6.5 complete pack with Java ME. And then I downloaded and installed Sun Java Wireless Toolkit too. And I have tried in all ways to go to New Project -> And in under Java ME -> Mobile Application
Then I enter name and location.
And then when to select the emulator platform, "Sun Java Wireless Toolkit 2.5.2 for CLDC...
I am writing a quick server to test an application. If i close the socket on the other end it does not throw and exceptions that the socket is closed. I keeps writing 100mb of random data( what it is suppose to do). How can i detect if the other end closed connection?
import java.io.PrintWriter;
import java.io.BufferedReader;
import jav...
I know we can append strings using StringBuilder. Is there a way we can prepend strings (ie: Add strings infront of a string) using StringBuilder so we can keep the performance benefits that StringBuilder offers?
...
I worked on C# for a few years now move to Java. Is there a good Java tutorial for C# developers?
thanks!
...
Maybe a dumb question, but it would be nice if there was a way to hide or collapse Java annotations when viewing source in Netbeans (or Eclipse). I'm not finding an option and a quick search didn't turn anything up.
Is this one of those "you should never want to do that, code folding is a sin!" things?
Personally I'd find it useful fo...
I have a Java program which generates a PDF file. I want the user to click a button to open the default email client ready to send the PDF as an attachment. The two standard ways of opening the default email client have problems:
Java 6 doesn't seem to allow for attachments in the generated message
JDIC has a bug which prevents Outlo...
Hi all,
I have a (design of) an application to basically work like this:
class Main, class BusinessLogic, class UserInterface
BusinessLogic and UserInterface are designed to be library-like - not on-goingly developed but used by a developer in say, class Main.
The constructor of BusinessLogic also instantiates UserInterface, which w...
Hey everyone,
I am trying to get a test class compiling with JUnit, and I can't figure out why it will not compile.
I have the following lines at the top of my class:
import java.util.*;
import org.junit.*;
And the error I am getting is
package org.junit does not exist
JUnit.jar is currently located in Program Files\JUnit\junit.j...
I have a resource file that will have some optional keys. If the optional resource key is not present, I set a default instead. It appears that there is no easy way to determine if a key exists in the resource bundle. So this is what I'm doing to get around it.
<fmt:message var="title" key="login.reg.signup.${signupForm.regfrom}.title"...
I have a couple of questions actually.
I have a class Dog with the following instance fields:
private int id;
private int id_mother;
private int id_father;
private String name="";
private String owner="";
private String bDate="";
I also have a class Archive which can instantiate Dog and put Dog objects into an ArrayList.
I am trying...