Man, this character encoding hole just keeps on getting deeper. Sigh. Ok. Check this out: I have a java String that contains the unicode character U+9996 (that's what I get if I do codePointAt()). If I look at it in the debugger expressions panel (in eclipse) then all is well and it looks like "首". However if I print it out to the conso...
Given an instance x of Callable<T>, how can I run x in a separate process such that I can redirect the standard input and output of the process? For example, is there a way to build a Process from a Callable? Is there a standard Executor that gives control over input and output?
[UPDATE] It's not important that the Callable execute in a...
Has anyone implemented sorting a list of domain names?
I have seen some applications sort them as flat strings, but the problem is that you end up scattering all the related hosts in a domain:
a.me.com
a.you.com
b.me.com
b.you.com
So, the basic logic I came up with reverse the order of the labels, then sort.
FQDNs of one label should...
I've been using the Rome API to parse data from an XML feed pretty successfully so for, but have run in to a bit of a snag.
Given the following snippet of XML:
<entry> <id>uniqueId</id> <updated>2008-11-05T01:32:35Z</updated> <mm:status xmlns:mm="http://contentprovider.com&quot; available="true"/> <title>Title</title> ...
I'm coming from a .net background and want to know the accepted way of creating a method that returns a boolean and modifies a string that was passed in via parameter. I understand Strings are immutable in Java so the below snippet will always produce an empty string. I am constrained to return boolean only. Exceptions can't be thrown. I...
I am planning to use this to poll a database which can take close to 10-15 minutes or more, so should I be using timers for this.
...
I want to capture the output of an exe file as an png or jpg image, i mean the display of that exe.
Is there any command on windows to capture and save as image of an exe output or any other idea that i can do this.
...
How can I create an instance of the Java console inside of a panel?
...
Is it possible using Java to convert a real time audio stream from the mixer to MP3?
It has to be converted chunk by chunk otherwise the memory will be exhausted.
I already know how to record but only to lossless formats such as wav and aiff.
I need conversion as the audio comes in.
...
I have this code:
if (file.exists()) {
Document doc = builder.parse(file);
NodeList list = doc.getElementsByTagName("property");
System.out.println("XML Elements: ");
for (int ii = 0; ii < list.getLength(); ii++) {
line 2 gives following exception
E:\workspace\test\testDomain\src\com\test\ins\nxg\maps\Right.hbm.xml
...***jav...
ANSWER:
If you ever see these lines and are mistified like I was, here's what they mean.
Thread[AWT-EventQueue-0] (Suspended (exception NullPointerException))
EventDispatchTread.run() line: not available [local variables unavailable]
It's not that the variables are unavailable because they are lurking behind a shroud of mystery in a ...
Here's some code I saw once. Can you see what's wrong with it?
[updated]
public class ResourceManager1
{
private final String mutex = "";
Object resource = null;
public Object getResource()
{
synchronized (mutex)
{
if (resource == null)
{
resource = new Object();
}
}
return...
Hi, I need to an algorithm, to write frames (Pictures) into a file, which can be read by some Video-Cutting/Producing-Software to work with.
So I got frames, and I want to give them a input into a function/Method.
Let's do i in Java.
How can I do this?
Is there a simple way, I can write videofiles without using any systemcodecs?
I jus...
How do I get whole and fractional parts from double in jsp/java ? If the value is 3.25 then I want to get fractional =.25, whole = 3
How can we do this in java?
Any pointers is highly appreciated.
...
I have two or three i18n files in my struts application. I am able to switch between these by setting the Global.LOCALE_KEY variable in the session.
Is there a way to set a default locale for the application (probably in the struts-config.xml file, I guess) ? Is the session the only place to set the locale ?
Sure, I could intercept the...
Hey guys.
Got a quick question. Does anyone know how to let JAXB (marshall) render boolean fields as 1 and 0 instead of printing out "true" and "false"?
...
Hello
Apache XMLBeans can be used to generate Java classes and interfaces from XML Schema Definition files (XSD). It also generates Enums based on StringEnumAbstractBase and StringEnumAbstractBase.Table to represent domain values. They are handy for entering only valid values. However, I want to get all those values to generate a JCombo...
The APIs that might be of interest to
developers of Java applications that
need to perform source code analysis
are the Java Compiler API (JSR 199),
the Pluggable Annotation Processing
API (JSR 269), and the Compiler Tree
API.
Any similar api or library for .net?
...
Same question, different langauge.
How do you do it in Java? Do you use JNI? run exe? or are there any library read/write *.lnk like POI read/write *.xls?
I used to workaround to create ".url" which is plain text INI file. But I am looking for other interesting way to do it.
...
I'm exploring the possibility of running a Java app on a machine with very large amounts of RAM (anywhere from 300GB to 15TB, probably on an SGI Altix 4700 machine), and I'm curious as to how Java's GC is likely to perform in this scenario.
I've heard that IBM's or JRockit's JVMs may be better suited to this than Sun's. Does anyone kno...