java

javamail Delivery status notifications Code Samples

Hi, I'm looking for some code samples on how to use javamail Delivery status notifications. Please, are there any code samples? ngocthan ...

How do I create a distributable application in Clojure?

What is the 'least work' approach to distributing a Clojure application? And is this different from the 'best' approach? For example here is a trivial 'application' that I want to be able to send to someone: (doto (javax.swing.JFrame. "Hello World") (.add (javax.swing.JLabel. "Clojure Distributable")) (.pack) (.show)) I imagin...

Apache Tomcat: adding/deleting/editing JNDI resources

Is there a facility in Tomcat (version 6) to add/delete/edit JNDI resources? If it's possible, how would I update a JDBC data source (as an example)? Note that I'm looking for a possibility to update a JNDI resource without redeploying an application. Apparently Glassfish let's you do this, unfortunately using another application server...

Java modified UTF-8 strings in Python

Hello I am interfacing with a Java application via Python. I need to be able to construct byte sequences which contain utf-8 strings. Java uses a modified utf-8 encoding in DataInputStream.readUTF() which is not supported by python (yet at least) Can anybody point me in the right direction to construct java modified utf-8 strings in py...

Can I set up arbitrary commands in an Eclipse Java project run configuration?

I have a Java Eclipse project, but I don't run it from the command line using java.exe. Instead I run it through a python script that runs the java. What I'd like to do is run this when I hit the 'Run' button in eclipse and see the output in Eclipse's console window. Unfortunately the available run configuration options available are a ...

List<A> canot be sent to method( List<super-class-of-A> ) - why not?

I must have missed something regarding generics in Java, but why does this not work? List<String> list = new ArrayList<String>(); cannot be sent to: method( List<Object> ); But it does not work? How come? But if the method was: method( Object o ) it can be used with: method( new String("hello") ) without any problems q1) S...

How to encode the real time audio?

I am on creating voice report. The user has to submit his voice report and it should simultaneously encode the audio data using Vorbis encoder. Its working fine but encoding will start after the recording is over. But I should have to employ the Vorbis encoder on the fly. Please share any sample code it would be much helpful. ...

Deadlock in ThreadPoolExecutor

Encountered a situation when ThreadPoolExecutor is parked in execute(Runnable) function while all the ThreadPool threads are waiting in getTask func, workQueue is empty. Does anybody have any ideas? The ThreadPoolExecutor is created with ArrayBlockingQueue, corePoolSize == maximumPoolSize = 4 [Edit] To be more precise, the thread is...

Hex representaion of bytes in a String

I read somewhere that string 0123456789ABCDEFFEDCBA987654321089ABCDEF01234567 is 192 bit (24). Its written that it is a "hex representation of bytes" I need help on this concept. PS: This is secret key of TripleDES algorithm. ...

[SOLVED]Why is String " " being read as NULL when mapping from the database to an object using ibatis?

In my oracle database I have table called PERSON with columns code, surname, forename. eg. 'PER001', '________________', 'Bob' (NOTE: _ = space) surname is set to NOT NULL but you can enter in a string of spaces like " ". I am having a problem with this because when Ibatis maps this column to an Object it is mapping it as ...

Session Id Management in Servlets

Hi. I am having some issues with my web application while doing a performance test with Jmeter. My question is not around Jmeter instead, it's around a simple Servlet session management behavior. So we have a web application, where in when you request a login page, it passes back a "Session Id" in response headers and that is used for ...

What means the error-message 'java.lang.OutOfMemoryError: GC overhead limit exceeded' in Java?

I get this errormessage as I execute my JUnit-Tests: java.lang.OutOfMemoryError: GC overhead limit exceeded I know OutOfMemoryError, but what does GC overhead limit mean, and how can I exceed this? EDIT: I resolved the problem, but thanks to your answers I learned something new about the JVM. ...

Can I add a multipageeditor to a multipageeditor

I have an EMF project and i want to use the editor from the emf inside a multipageeditor i have created. Can I do it? or should I change the multipageeditor from the emf to regular editorpart (keep just one editor) ...

Extract a certain div in HTML using Java+RegEx

I want to parse an HTML document and extract a certain div block that can be repeated. I've managed to extract THE FIRST occurrence of the block, but I cant figure out how to get the next. This is my code so far: String inputStr = HTTPGetter.get("http://someurl"); String patternStr ="<div class=\"MY-CLASS\">(.*?)</div>";...

Terracotta for Python world?

Hi, Would you know if something similar to Terracotta (in Java world) exists for Python world? Twisted ? Or something else... Thank you in advance for all ideas. ...

Java Excel API: Add images to the footer of excel files

I've got a bunch of huge excel reports created by JExcel. Now the company's styleguide has changed and somebody had the great idea to add some logos to the footer. Unfortunately, adding images to the header or footer is not possible with JExcel. As a workaround, I am currently modifying the PDF files created from the Excel files with iTe...

Starting an external program in Java and piping it's output

This might seem a bit awkward but I want to start a console program in Java but in it's own window, while at the same time using tee to save the output in a log file. I am porting the program that does this from Perl to Java and am having problems starting the program with lots of command argumments. In Perl it uses system("dtterm -titl...

Why is this covariant override permitted if the method is concrete, but not if abstract?

In the following code, MoreSpecificHasInfo.getInfo() is not permitted as an override by the Sun Java 5/6 compilers, saying, "types IHasSpecialInfo and AbstractHasInfo are incompatible; both define getInfo(), but with unrelated return types", although it compiles without error under Eclipse 3.4.2. Also, if I replace the abstract implemen...

How to use JAXBElement<String> in Web Service?

I am Developing a Web Service using WCF.It is an interoperable Web Service.Now i am consuming this Web Service from a Java Client.now when i created the proxy class.It created all getter & setter method.now in that proxy class it created a JAXBElement field.I searched for it in jdk api for it.and found constructor. JAXBElement(QName na...

Disadvantages of using Java Native Interface

I can not get these two disadvantages of using JNI. I want to know more about them: Difficult to debug runtime error in native code Errors in JNI code take down the entire JVM and don't provide any mechanism for graceful recovery ...