java

Java Code Design Question and Example

Hey everyone, I've been writing code in Java for awhile now, however I feel as though I lack in code "design" - that is, creating packages and separating classes and such. I'm just not sure when to create what. So, I'm practicing :) I am setting out to write a Calculator (with a Swing GUI), and I want to create a really good design for...

Debugging handling slightly different inputs

I am currently working on a Java compiler. In the context of the compiler, slightly different inputs may result in different output (e.g. adding final in Java permits compiler to perform more optimizations). In some other cases, different inputs may result into the same output (e.g. de-sugering some constructs - for-each loops). When ...

Taking over for JspWriter

Thanks to everyone in advance - I have yet to find an easy way to do this but, is it possible to take over the handling of the data (headers and everything) written to JspWriter? Sort of like a liaison to manage that buffer dynamically and then control the output to JspWriter? I am running into issues with redirects where the status hea...

Difference between status codes and error codes

folks, How can I differentiate between error codes and status codes in case of Servlet response? Is it right to say that there is some status codes in HttpServletResponse class which show errors. Or I've to use more definite way to differentiate between them? ...

Declarative Security--what's this?

Hi, How can I define the term "Declarative Security" in context of web programming? Is it same like defining "Declarative Programming"? ...

stretch a row to fit the data in jasper reports using iReport

I use Ireport 2.0.5 to generate jrxml file and use the same in my java web propject, I have used all the flags to stretch to fit the data, but it doesn't work Example:- ...

Cannot run shell function using PHP

Hi, I encountered some problems with the shell function in php. I want to execute a java program on the server by running a php function on a php webpage. The java program writes some chars to a local file on the server. test.php <?php $WshShell = new COM("WScript.Shell"); $cmd = ' "C:\\Program Files\\Java\\jdk1.6.0_14\\bin\\...

Online Java Book

Hello, So I have seen topics regarding Java books, and it really looks like "Effective Java" is a very good book regarding Java. Well, unfortunately, I don't have $50 to blow on a new hobby. My question is, can anybody recommend a quality complete online Java book (preferably one available in PDF)? The closest thing I could think to r...

Test case to fail this code?

I have to maintain code from a contractor. It has this "interesting" snippet: String webServicesValue = webResponse.substring(webResponse.indexOf("<" + fieldName + ">") + fieldName.length() + 2, webResponse.indexOf("</" + fieldName + ">")); It took me a few minutes to understand wh...

Is there a bug in org.apache.catalina.realm.JDBCRealm?

http://www.docjar.com/html/api/org/apache/catalina/realm/JDBCRealm.java.html To use this JDBCRealm we need two tables, user and user_role. user table - user_id, user_name, user_password user_role table - user_id, role_id, user_name Why user_name is required in user_role table when user_id is there as foreign key. The JDBCRealm could...

is there any similar jtrac ticketing system ?

is there any free java ticketing system like jtrac with workflow feature? jira is not free thou. ...

How to get custom value from text field in JSP?

I'm working in a very simple and small web application, it is a jsp that handles a shopping cart. What I do at this point is to iterate through all the products that are stored in the car and add them one by one to the jsp with each iteration. This is the code that adds a row to the jsp in each iteration: <tr> <td> <inp...

Blackberry URL encoder

Hi, I need to encode a URL using HTTP GET request in Blackberry. Can any one help me find how do I achieve this. ...

Blackberry Java String to date conversion.

Hi, I used following code to convert string to date but it is applying timezone of device while conversion. I don't need this but I want same date/time from that string like String = "2009-07-31 07:59:17.427" Date = 2009-07-31 07:59:17.427 Date formatter = new Date(HttpDateParser.parse("2009-07-31 07:59:17.427")); SimpleDateFormat d...

Storing passwords for batch jobs

I have a little java prog that uses a webservice which needs authorization. So the java prog (which is to be run using windows task scheduler) needs to have a user/password argument. How can I store these somewhere without having them laying around in a file as plaintext? So far I've tried using runtime.getRuntime and CACLS to have a ...

Signed Java applet doesnt get permissions in Safari

Hi there, I've got a signed java applet (using a self-signed-certificate) which has to access the user's file system. I have to do it, so please no replies ala "you shouldn't do it" :) The thing is, when I execute the Applet from Firefox 3.0 / Mac, everything works as desired, I get all access just as it should. When I use Safar 4 / M...

How do I get URLs of other servlets from within a servlet

I have two servlets (S1 and S2). S1 renders a HTML-Page which acces S2 via an URL (img src="URL"). I know the servlet name of S2, but not the URL. The URL is configured in the web.xml of course, but how can I access that from S1? ...

What is ruby's StringIO class really?

I think I understand StringIO somewhat as being similar to java's StringBuffer class, but I don't really understand it fully. How would you define it and it's purpose/possible uses in ruby? Just hoping to clear up my confusion. Thanks ...

Headless build of eclipse features - PDE Tools or Buckminster?

I am trying to set up a headless build for a big eclipse feature, containing other features and plugins. As some needed plugins are generated using GMF and EMF, the build workflow must be something like this: SVN Check-out Invoke Generation Run Tests Build all Publish update-site Over the last couple of weeks, i played around with...

Android, add new view without XML Layout

Posted: Thu Jul 30, 2009 6:09 pm Post subject: How to show small View? I need a little help from people with expirience. I hope it's easy. I just want to show new View (creating it without XML layouts) above main program's view. It's to integrate AdMob.com ad block: I wrote such code: AdView ad = new AdView(this); ad.layout(10,...