java

What are some types of programs I could write to reinforce/advance my early skillset?

I'm coming to the end of my intro programming class, we're using java and have been doing command line programs so far, no gui's which I've enjoyed quite a bit. So far in the class the programming assignments have been somewhat challenging but leave me wishing for a bit more. I find myself wanting to write a program when I'm bored but ...

How get selected items in backing bean for <h:SelectManyListBox> ?

Pals, I got stuck again while my web development, I am providing multiple selection list to user for selecting many option. A Fragment of JSF Page <h:selectManyListbox id="associatedAS" value="#{maintainForm.selectedAS}"> <s:selectItems value="#{maintainForm.associatedAS}" var="as" label="#{as.name}" /> <rmc:...

multi-staged form using spring

hi all, please forgive me for this stupid questions. I just started developing web application using spring yesterday. The project that i worked on, have a multi staged form, that require users to complete them before the data can be persisted on the database. Is there any way to keep those input in a temporary storage eg: session scope...

Infinite while loop in java

I am new to Java. I tried to extract employee data from a text file and store it in a collection. I used Stringtokenizer to get the strings from the file, but in the second iteration, the while loop goes infinite; it won't come out of the while loop. My code is: public class Reader1 { String a; int i = 0; int count = 0; ...

FileInputStream and FileOutputStream line by line

FileInputStream reads all bytes of a file and FileOutputStream writes allbytes to a file which class do i use if i want to read all bytes of a file but line by line so that if fileA contains two lines line1 line2 then bytes of line1 and line2 are read seperately same goes for FileOutputStream ...

Jamon statistics aggregation across multiple JVMs

Hello, I have a tomcat server running a webapp. Apart from this there are two other JVMs that run batch processing tasks. Jamon is a really cool way to monitor performance, hits etc., and can be viewed on the web using Jamonadmin.jsp (supplied with jamon war file). But I want to aggregate the Jamon statistics from the other two JVMs and...

Displaying a list of items with Swing from bottom to top

I need to display items in a list (read-only), but instead of the default top-to-bottom way of displaying a list, I need to display it bottom-to-top. +-----------------+ | | | | | | | | | value 3| | value 2| | value 1| +-----------------+ If a n...

java:how to hide static resources like html ,images from user on jboss platfrom?

I have developed a java 1.4 web application.Application is deployed on jboss(tomcat). suppose my folder structure is mainfolder(contains subfolders and jsp pages) images(contains all of images files) headerfiles(header files) javascript(javascript files) url for website login page is mywebsite.com/...

Which is preferable and less expensive: class matching vs exception?

Which is less expensive and preferable: put1 or put2? Map<String, Animal> map = new Map<String, Animal>(); void put1(){ for (.....) if (Animal.class.isAssignableFrom(item[i].getClass()) map.put(key[i], item[i]); void put2(){ for (.....) try{ map.put(key[i], item[i]);} catch (...){} Question revision: The question wasn'...

Why does stdout decoding fail when adding carriage return?

The following java code does exactly what is expected: 1 String s = "♪♬♪♪♬♪♪♬♪♪♬♪♪♬♪♪♬♪"; 2 for(int i=0; i < s.length(); i++) 3 { 4 System.out.print(s.substring(i,i+1)); 5 //System.out.print("\r"); 6 Thread.currentThread().sleep(500); 7 } But when I try to add carriage return by commenting i...

how can the decryption happen at a later stage with this AES program

i am really not able to figure this out myself so please help me out. this is a program to encrypt contents of an existing file keeper.txt using 128bit AES putting the encrypted text into newly created file called Encrypted.txt, then decrypting the contents of Encrypted.txt into newly created file called Decrypted.txt everytime this pro...

parsing problem

hi every one i need to parse the following one such that it wil store each line in an array avoiding emptyline asthere r two new lines after [2K RTRV-ALM-EQPT::ALL:RA01; [2K SIMULATOR 09-11-20 13:52:15 M RA01 COMPLD "SLOT-1-1-1,CMP:MN,T-FANCURRENT-1-HIGH,NSA,01-10-09,00-00-00,,:\"Fan-T\"," "SLOT-1-1-1,CMP:MJ,T-BATTERYPWR-2-L...

Swing won't trigger mouseEntered/mouseExited properly after mouse wheel events?

I have an issue where Swing (in Java 1.6, Windows) doesn't seem to trigger mouseEntered and mouseExited events the way I want it to. I have an application where I wish to have a number of JPanels stacked vertically in a JScrollPane, and that they should be highlighted with a different colour when the mouse is over them. Simple enough pro...

Source code indentation and highlighting on server side?

I need to do source code formatting (similar to what Stack Overflow does), but on the server side. What options do I have? My serverside language could be PHP or JSP. Does google have a server version of syntaxhighlighter? ...

Java - why are wait() and notify() declared on Object Class?

Hi Experts, Please define why the wait() and notify() methods are in Object class and not in Thread class? Thanx ...

Getting server name in ContextLoaderListener

My listener is filling Cache (Terracota) and if something goes wrong at application start, ExceptionInInitializerError is thrown. I would like to get server name (like on HttpServletRequest - getServerName()) to know where this happened. How can I come to this information?? import javax.servlet.ServletContextEvent; import net.f.core.s...

Beautifying a SWT application on Mac

SWT is designed to be cross-platform, so it can run on a Mac. The problem is it commits the cardinal sin of Macland - it's UGLY. Toolbars don't look like Mac toolbars, status bars don't look like Mac status bars, etc. Does anyone have any experience in making an SWT application look more like a Mac application? For example, by making...

Concurrency issues when retriveing Ids of newly inserted rows with ibatis

I'm using iBatis/Java and Postgres 8.3. When I do an insert in ibatis i need the id returned. I use the following table for describing my question: CREATE TABLE sometable ( id serial NOT NULL, somefield VARCHAR(10) ); The Sequence sometable_id_seq gets autogenerated by running the create statement. At the moment i use the following sq...

javadoc for ISODateTimeFormat.dateTime()

The javadoc for org.joda.time.format.ISODateTimeFormat.dateTime() is: Returns a formatter that combines a full date and time, separated by a 'T' (yyyy-MM-dd'T'HH:mm:ss.SSSZZ). The time zone offset is 'Z' for zero, and of the form '±HH:mm' for non-zero. It is not clear to me where the word 'zero' is pointing at/to. Zero where or wha...

Java Hibernate service class

Dear All! I have a painful problem regarding Java Hibernate. I have my own POJO classes in my modell, and I would like to submit query from an instance of that class, to a table of my relational DB. The problem is, that I want to submit several different queries to different tables. For example: I have a Bus class, representing buses. ...