java

struts 2 if : compare enum

Hello all, I have a Struts 2 jsp with the following code... <s:iterator value="categories" id="category" status="iteratorStatus"> <s:if test='#category == "M" '> snip </s:if> The problem is the java code behind categories is.. private static final CategoryEnum[] PRIVATE_VALUES = {A,B,C,M }; public static final List<Catego...

Slow CGLIB Performance using Callback Filters

I'm noticing terrible speeds when trying to use CGLIB with a callback filter (on tens of thousands of objects) but I'm unable to find any information about optimizing CGLIB. For a search/list interface, the system is loading multiple properties from an optimized query and populating the domain tree with those properties. For all other p...

more practical learning books?

there are tons of books out there teaching you a new language. but some of them are just too thick with lot of information and less code. it usually makes you sleepy. especially when you already know the basic syntax and wanna learn how to use a new language very fast. are there good series of books for this? the dummies series is very...

Android Component ClassNotFoundException

A component I have created works fine if I put it in the main project and reference it from any res/layout xml, but when I put it in a project on which the main project depends, I get a ClassNotFoundException in the xml. Whilst after compiling the interface works fine, it is a pain in the * to design an interface without seeing what I ...

MP3 Compression i.e converting mp3 file from 256kbps to 128kbps in java..

i want to achieve mp3 compression.. it means i want to convert a 256kbps mp3 file into a 128 or even 64kbps mp3 file using java programming language.. is it possible using JLayer..? how do i do it..? A code snippet would be useful. Thanks in advance..!! ...

Best GC for Java daemon

Hi. Just to clarify a point I seen here indirectly answered: Is the best GC to use on multi-CPU / multi-Core machine, which mostly runs the application, is ConcurrentMarkSweeper (aka -XX:+UseConcMarkSweepGC)? Also, there is something called G1, any idea when it will become available for Java6 ? EDIT: I'm using Sun Java VM, 1.6.0_16-b...

how does spring allow for lazy-loading?

If you have a call in a Dao method like (pseudo code): return ..getHibernateTemplate( get by id ); Now say that entity has a lazy-loaded collection. Once you return from your Dao using the hibernateTemplate helper method, how come the session stays in scope and allows you to lazy-load a collection? Is the session initialized and comm...

how to use appcfg.py for google-app-engine projects created using google's eclipse plugin?

I have created a google-app-engine java project in Eclipse using Google's Eclipse plugin. My previous attempt to deploy failed. Now, when I retry, I get the following message: Unable to update app: Error posting to URL : http://appengine.google.com/api/appversion/create?app_id=mybdaywisherversion=1 409 conflict Another transaction for ...

How to extract the data from a website using java?

Hi I am familier with java programming language I like to extract the data from a website and store it to my database running on my machine.Is that possible in java.If so which API I should use. For example the are number of schools listed on a website How can I extract that data and store it to my database using java. ...

Display numbers from 1 to 100 without loops or conditions

Is there a way to print numbers from 1 to 100 without using any loops or conditions like "if"? We can easily do using recursion but that again has an if condition. Is there a way to do without using "if" as well? Also no repetitive print statements,or a single print statement containing all the numbers from 1 to 100. A solution in Java ...

Would you use DI or a factory?

My application stores files, and you have the option of storing the files on your own server or using S3. I defined an interface: interface FileStorage { } Then I have 2 implementations, S3FileStorage and LocalFileStorage. In the control panel, the administrator chooses which FileStorage method they want, and this value is stored i...

Wicket's @SpringBean's and request scoped objects

Is there any reason why a request scoped Spring object would be cached between requests, by a injected @SpringBean field? ...

Do I have to learn AWT before learning Swing?

If I want to code an desktop application in Windows with Java, should I buy a book about Swing and just skip reading books/tutorials about AWT? Or do I have to learn AWT before using Swing? ...

Designing full website using java applets

Hi, I want some suggestions. I want to create a website with using Java Applets. Could u pls suggest me if I am thinking in the right way or not? What are the problems (other than development) my site will have to face, mean like flash plugin, users having JRE installed on their system or not, The applet based site performs good on ea...

Java: Does FileReader support finding files using strings with %20?

My apologies if this is too simple a question, I was unable to google it as it did not like searching for %20. If I have a URL on which I use the getFile() method to obtain the path for a file I would like to open for processing. If the particular file resides in a directory that contains spaces, the path returned would contains %20 whe...

How to load program resources in Clojure

How do you load program resources such as icons, strings, graphical elements, scripts, and so on in a Clojure program? I am using a project layout similar to that in many Java projects where there is a "resources" directory hanging off of a "source" directory. A jar file is created from the source and includes the resources, but I can't ...

Java introspection and reflection

Can any one explain the use of Java reflection and introspection? When we need to use both? ...

Problem loading Java applets after creating VM in Internet Explorer

I have an Internet Explorer Browser Helper Object (BHO) that uses the JNI_CreateJavaVM() API to create a Java VM in the iexplore.exe process so that I can make JNI calls for my business logic. However, when I browse to sites that try and load Java applets (e.g., http://www.javatester.org/version.html), then the applet fails to load. If...

Tree in java to store words from a text

Hi guys! I have a text file where each line is a path of word strings word1/word2/.../wordn and I want to query the file. I need to build a tree which stores the words and each line of the file as a path so that anytime I search for a word, I get the word-node and all the paths this word belongs to. I was wondering if there is a build-in...

exporting matlab class object (or struct) into java object of similar class using xml

I have similar matlab and java classes: public class myClass { double[][] v1; String v2; } I need to export the matlab object, whos struct is: obj = v1: [2x2 double] v2: 'abc' into Java. Is there a common way to do it? I can also save the struct as xml file. Is there any parser that can do: myClass obj = SomeParser( xmlFile...