java

What does fragmented memory look like?

I have a mobile application that is suffering from slow-down over time. My hunch, (In part fed by this article,) is that this is due to fragmentation of memory slowing the app down, but I'm not sure. Here's a pretty graph of the app's memory use over time: The 4 peaks on the graph are 4 executions of the exact same task on the app. I ...

Kill Java Applet via Javascript

Hi there, I am working for a developing firm and am doing a major redesign on a Web Application, which reloaded everything after each click, to make extensive use of Javascript, so it actually feels like a real Web application. One of the Features is to use a web-based Painter (think of MSPaint on the Web), which I embed on the Page on ...

lucene ignore queries on fields other than default

i have 2 indexes, one for meta data and one for text, i want to be able to remove all field searches in the query and only use the default fields that the user searched, ie "help AND title:carpool" i want only the help part, ideas? ...

Best coding Style - Checking if a character is a valid character

I am coding a method that returns whether a given character is valid, which looks like this: - private static boolean isValid(char c) { return c == '.' || c == ',' || c == '+' || c == '/' || c == ';' || c == ':'; } Check style flagged this up as the boolean complexity is too great (5 when it should be no more than 3). My developme...

Functional Programming in Java

Is there a good library for functional programming in Java? I'm looking for stuff like Predicate and List.Find() (as a static method). Not complicated to implement, but it would be nice to find reuse a library here. ...

How do I create an EAR file with an ant build including certain files?

I'm using eclipse to build an ear file using ant. I'm using oc4j, and I want to make sure that orion-application.xml is included in the build. What I'm currently using but does not work is: <target name="ear" depends=""> <echo>Building the ear file</echo> <copy todir="${build.dir}/META-INF"> <fileset dir="${conf.dir}"...

Confusion in line about the difference between instance and object in context of Java

Hi, Could anyone please what the following is saying about instance and object: If class is the general representation of an object, an instance is its concrete representation. I know concrete means non-abstract. So what's actually general representation and concrete representation? ...

Create a Spooled File from Java with a specified Job name on iSeries

Is there a way to specifiy the JOB name when creating a spooled file? So that my created s.f. doesn't have the default "QPRTJOB". My method that creates a spooled file with the default QPRTJOB job: public static SpooledFile createSpoolFile( com.ibm.as400.access.AS400 as, PrinterFile pPrinterFile, OutputQueue outq, String ...

Is there an Cocoa or Objective C api for Java?

I'm a Java programmer and i wanted to get into writing so apps for the Iphone. I started to research and found myself looking at xmlvm..that all good, but then xmlvm has a HelloWorld.java with some UIWindow classes that i can't find and can't compile. Short of it is where is the api for Java so i can compile xmlvm's HelloWorld.java for t...

Play Wav file backward

Hi, I'm making Braid in Java. If you rewind the time, the sound plays backward Does somebody now how to play a wav backward? Maybe with a stream with something like previous()??? On the site of braid can you see what I mean. Solved!!: See my own post!!!!!! Thanks ...

importing Source code into Jlist

Hello, Is it possible to importing a java source code into Jlst? Please tell me how, and ll appreciate an example if possible. Thanks ...

Private inner class synthesizes unexpected anonymous class

When you compile a Java class with a private inner class, it appears that an anonymous class is automatically synthesized along with it for some reason. This class is sufficient to reproduce it: public class SynthesizeAnonymous { public static void method() { new InnerClass(); } private static class InnerClass {} } ...

Internationalize Swing Applet Menu Items in English and Chinese - Examples?

A Java Swing applet needs to display its MenuItems in Chinese or English, depending on how a user has set their system preferences. Has anybody seen compilable examples showing how to do this? I've seen a few articles on the subject of i18n and Java/Swing (for example, this one), but so far I haven't found anything specific to the subj...

Frontend for Quartz?

Im looking at developing a web front end to control and monitor quartz jobs. Does anyone have suggestions for starting points, APIs, or other places to look? ...

What are benefits of using the @Deprecated notation on the interface only?

For Java programming, what are some benefits of using the @Deprecated notation on and interface method but not on the class that implements it? public interface Joe { @Deprecated public void doSomething(); ... } public final class Joseph implements Joe { public void doSomething() { ... } ... } ...

Which has better Eclipse support: git or Mercurial

I work in a team of Java-developers who are very familiar with Eclipse. Most of the team uses Windows. We are switching our main project from CVS into something newer. Subversion seems already old and not really that much better than CVS. We are really interested in distributed version control systems, mainly Mercurial and git. Which of ...

where is Enum.values() defined?

Hi, Every Java enumeration has a static values() method can be used like this for (MyEnum enum : MyEnum.values()) { // Do something with enum } However, I cannot figure out where this method is defined. There's no mention of it in the Javadoc and it doesn't appear anywhere in the source file. ...

what synchronized statement used for?

what is the usage of synchronized statements? ...

NetBeans "link with editor" feature

I use mostly Eclipse and have played around a little bit with NetBeans. The feature I have missed most is the "link with editor" which Eclipse has but I haven't found in NetBeans. The idea is that if I turn "link with editor" on, the editor window will always be in sync with the tree view on the left side (in Eclipse it's called "package...

Bug in JOptionPane.showConfirmDialog?

I want to prompt the user for a confirmation when they want to close the frame window, like so: addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { if (JOptionPane.showConfirmDialog(null, "Are you sure you want to abort the game?", "Really quit?", JOptionPane.YES_NO_OPTION) == JOption...