Hi,
I have a Requirement to make an IMAP client as a Web application
I achieved the functionality of Sorting as:
//userFolder is an Object of IMAPFolder
Message[] messages = userFolder.getMessages();
Arrays.sort(messages, new Comparator<Message>()
{
public int compare(Message message1, Message message2)
...
Is there a way of getting internet connection settings (proxy information) being used by java to connect to the internet?
With Java 1.5 you can use the ProxySelector introduced then, is there any way of doing it in jdk1.4?
I tried getting these seeting using the following code snippet, but returning nulls even though i have set my prox...
A list of books is displayed on the page. When a user clicks a book, its detail page is opened. Now the problem is that I need to encode each book's id with the detail page url.
The link to detail page is /loadDetailForm.do. If a book has id=23, the link should appear as /loadDetailForm.do?id=23.
I am pasting code here:
<logic:notEmpt...
I have been tasked to develop an interactive website using java & mysql: using servlets to retrieve & massage data, applets to do special handling of the data client-side, and to handle requests from the client for different data views.
What would you recommend as an proper general-purpose toolkit/environment for web development using j...
Hi,
If we do own a Mail server supporting, how is it possible to add a sort extension to it ?
Also how is it possible for a client using java mail to check if the server does indeed support the Sort extension ?
...
I implemented a multi-file gatherer input stream which is able to read and combine data from previously scattered file segments. However, the current version uses RandomAccessFile along with fixed size ExecutorService, and with lots of CPU overhead. I'd like to avoid these I/O threads and perform a single threaded Selector based approach...
If I have a file, and I want to literally write '42' to it (the value, not the string), which for example is 2a in hex, how do I do it? I want to be able to use something like outfile.write(42) or outfile.write(2a) and not write the string to the file.
(I realize this is a simple question but I can't find the answer of google, probably ...
I am trying to build the dom4j JAR, which includes an xml-apis JAR which contains a DOM API that is older than that shipped with more recent JDKs.
However, even though in the build file the source and target compiler attributes are set to 1.3, and even though the xml-apis JAR is included in the build path, Ant still tries to compile dom...
I've written an algorithm which calculates and stores all paths of a DAG, and it works nicely on small graphs - but now i'm looking to improve it's efficiency to run over larger graphs. The core logic of the algorithm is in createSF() and makePathList() below, the other methods are helpers - I can see that append is a bottleneck. Howeve...
The following snippets are both supposed to calculate sha-1 sum. But for the same file they calculate different sha-1 sums.
//snippet1
byte[] byteArr = new byte[(int) uploadedFile.getLength()];
try {
stream = new BufferedInputStream(uploadedFile.getInputStream());
stream.read(byteArr);
stream.close();
} catch (IOException e) {
e.p...
Hi there!
Inside a for-loop I'm controlling the simulation-step-based traffic simulator SUMO by retrieving and processing information of vehicles. To make sure that my program simulates in "real-time" (1 simulation-step = 1 second) I want to sleep my program after the processing phase until the next time step begins. To get better resul...
I'm reading a local file using a BufferedReader wrapped around a FileReader:
BufferedReader reader = new BufferedReader(new FileReader(fileName));
// read the file
// (error handling snipped)
reader.close();
Do I need to close() the FileReader as well, or will the wrapper handle that?
I've seen code where people do something like this...
Hai I have developed a standalone application in which when an user logs in, an log file will be created and when the application is closed the log file gets deleted.But when i shutdown the system with out closing the application the log file is not geting deleted.what can i do to delete my log file during shutdown or system crash that i...
I use Eclipse with ant scripts, and Eclipse works well with the default JRE installation on Windows XP.
The annoyance comes when I want to run ant scripts compiling with the javac-tag, where it fails because there is no tools.jar in the classpath.
I've gotten the idea that if I could make the JDK become the default Java on Windows, the...
Is it possible to specify connection/query timeout for the Oracle database queries? Either on Oracle side or in Oracle's JDBC driver (10.2.0.4)? So, that Java client just got an error back after, let's say, 2 minutes instead of waiting until Oracle finishes executing the query?
...
I am having a jsp and some jspf in which I want short,long mid term fields as well as heading to be right aligned but it is not working as soon as I remove the width property
from my style right align start working.Although the style is working in one of the included
jsp, but not working the jsp which is including all the other jspf and ...
I need to set up proxy authentication against a SOCKS proxy.
I found out this post giving instructions that appear to work with common HTTP proxies.
httpclient.getHostConfiguration().setProxy("proxyserver.example.com", 8080);
HttpState state = new HttpState();
state.setProxyCredentials(new AuthScope("proxyserver...
I written a multiple thread program, each thread need to parse a xml file and update new value. The problem: assuming i have a xml contents of ABC, now thread A parse the xml and update it become ABCA, at the same time thread B also parse the xml (which the content is ABC) and update it become ABCB. thread B update the xml after thread A...
An instance of java.util.Properties is passed to me which has been created using:
[...]
properties = new java.util.Properties();
try {
properties.load(
AutoProperties.class.getClassLoader().getResourceAsStream(propertyFile)
);
}
[...]
I was wondering how I could retrieve the file name (propertyFile above) from the properties ...
I want to create a bar-chart, but extraordinary high values should be shortened. An example is this image:
I hope it is clear what I want.
My question is: How can I do this with JFreeChart. If it isn't possible with JFreeChart you can possibly recommend alternative open-source Java-libraries to produce such an output.
...