java

how to convert string to Charsequence in JAVA

how to convert string to Charsequence in JAVA...???? ...

Should I make all my java code threadsafe ?

I was reading some of the concurrency patterns in Brian Goetze's Java Concurrency in Practice and got confused over when is the right time to make the code thread safe. I normally write code that's meant to run in a single thread so I do not worry too much about thread safety and synchronization etc. However, there always exists a possi...

Retrieve images from a folder, Scale down them, save them into another folder. How? (Java)

I have a small problem... There are hundreds of images in a folder. they should scale down to specific height and specific width. so, the problem is... Retrieving images from a folder, and scale down them, and save them into another folder. Is it possible with Java? if yes, please help me, how? This is only for reducing memory size in my...

session persistant across browser/server restart using google app-engine

How do I make sessions persist across browser/server restarts? I'm using Google AppEngine. I'm getting a new session id everytime I restart my browser and/or server. String jSessionId=this.getThreadLocalRequest().getSession().getId(); End Goal The big win I'm shooting for is long lived anonymous accounts. For example, a user can do ac...

How do I customise jaxb generation?

I have a series of xml messages, all with their own schemas and namespaces. The messages are currently marshalled using JAXB (we still live in a Java 1.4 environment) and we have a large amount of legacy code using this JAXB code so any solution needs to be minimally intrusive. My problem is that while each of the messages has a set of...

Is it a Test Driven Development approach ?

Hi, Suppose the following model public class Product { private Integer requiredQuantity; private Integer allowedQuantity; // getters and setters } public class Order { public void allowsOrder(List<Product> productList) throws AppException { Integer allowedQuantity = 0; Integer requiredQuantity = 0...

Handling Shutdown Event

Hi I have an Standalone application in which when an user logs in a abc.lck file gets created when the application is closed it gets deleted.I have used addshutdownhook() to delete the file when power supply is interrupted that is switching off the power supply when my application is running.My problem is the file is not getting deleted ...

Java Reflection: Why is it so bad?

I've always avoided Java reflection soley based on its reputation for slowness. I reached a point in the design of my current project where being able to use it would make my code much more readable and elegant, so I decided to give it a go. I was simply astonished by the difference, I noticed at times almost 100x longer run times. Eve...

Server Tomcat v6.0 Server at localhost failed to start

I have actually figured this problem out, but it took me days, so I thought I would paste my solution here to aide others. I am using Fedora 11, and in Eclipse I tried adding a Tomcat 6 server and starting it. I would get the following error: 'Starting Tomcat v6.0 Server at localhost' has encountered a problem. Server Tomcat v6...

Package Dependency

I have a huge Java Application with numerous packages. Some of the classes in these packages have dependency on classes in other packages. given a class, i want ot know all the dependent classes on it and vice versa. A GUI tool shld be really helpful. ...

Struts : is there a way to test the current module?

In a JSP, I want part of the content to be module dependent. How do I test the current module? ...

Thread dump in a separate file with tomcat?

My tomcat (running in linux/ubuntu) crashes sometimes with a thread dump appended to catalina.out. How do I get this thread dump into a separate log file? The thread dump is quite large due to the large number of threads running and therefore fills catalina.out making it hard to debug. ...

Java Minimize Dependencies

I have a situation where there is a small piece of Java code that has a large number of jars that it depends on. However, the dependencies inside these jars are very shallow. In most cases it only depends on a jar for a single interface. Instead of distributing all of the jars with the application, I would like to just distribute the sp...

Choosing the right version of Apache Commons Logging

I've got dependencies on several Apache TLPs (Top Level Projects) like Apache Axis, Commons HttpClient, Commons DBCP, Commons Transaction etc. Each of these projects has a dependency on JCL (Commons Logging) and every project depends on a different version of JCL. Which version of JCL should I be choosing - will the highest version be ...

Mitigating verbosity of Maven pom.xml files (or: a critique of Maven by a fan)

I like maven. I even like it very very much. Since I switched to it from Ant I have saved lots of hours of works, building build files, administrating dependencies, etc, and saved lots of space in my source control repository. The problem is that maven files are too verbose. Not that Ant files where less verbose, but their verbosity was...

Sql Parser With Engine

Hi, I need parser on java that parse SQL and return it as some structure. This structure must have some binding point to what I can bind low level reader. ...

scroll bar problems in java Layered Panes

Hi all, I've been trying to build this small java app. I find it very difficult to design UI in java, tasks that seem very simple become complicated and all these strange misbehaviors occur. In my app I've created a JLayeredPane which contains two layers. One on top on the other, They both contain scrollbars. Here's an explanation of t...

How do I configure autoformatting in Eclipse?

I dislike how auto format messes up empty cycle body, like: Before for (int i = 0; isTest(i); i++); After for (int i = 0; isTest(i); i++) ; How to configure eclipse not to do this? ...

scroll bar in JSF page

I want a scroll bar inside a page for complex rich:dataTable. I can not use scrollableDataTable since the table has very complex structure. Currently i used div with width in pixels. But the width is changing for different computers. Can anyone help ? ...

using JDBC Connection from presentation tier in 2-tier and 3-tier applications

I am writing a module that will be used in different applications (2-tiers and 3-tiers). I'll need to connect to a DB. so, I made the module requires a java.sql.Connection object as a parameter when used with a 2-tier application. there's no problem there. the problem i'm facing is that in case of a 3-tier application, the module will b...