Generate XML - DBMS_XMLGEN

On my way to my solution store just found this nice to use, old and easy feature. Possibilities endless, usage typically very easy. I used the following to generate XML from sqlplus: select dbms_xmlgen.getxml('select * from user') from dual; Output: < ROWSET > < ROW > < TNAME >Employee< / TNAME > < TABTYPE > TABLE < / TABTYPE > < / ROW > < / ROWSET >

December 10, 2008 · 1 min · Theme PaperMod

Command, Singleton, JMenuItem, JButton, AbstractButton - One Listener for the app

Here I would like to demonstrate a simple use of JMenuItems being used with Single Listener for the entire system. A simple sample of use would probably be SingleInstance Desktop Application. Lets see how that is done here. First lets create a OneListener class that should be able to listen to ActionEvents and also be able to add Commands to itself. Please refer to my previous post on Command,Singleton if you would like to see more about this patterns and there usage....

November 17, 2008 · 2 min · Theme PaperMod

Doing the Locale - Danmark

The following illustrates how to get the Number format working with a danish locale. ''' import java.text.NumberFormat; import java.util.Currency; import java.util.Locale; public class TestLocale { public static void main(String args[]){ // Create a Locale for Danmark Locale DANMARK = new Locale("da","DK"); // get the currency instance for this locale. Currency krone = Currency.getInstance(DANMARK); // Get a Number format for the locale. NumberFormat krFormat = NumberFormat.getCurrencyInstance(DANMARK); // A symbol for the currency String symbol = krFormat....

November 12, 2008 · 1 min · Theme PaperMod

How to read a file from the JAR?

Someone just asked me this question today. And I thought might as well put it down for info. ''' public TestReadFileFromJar() throws FileNotFoundException, IOException { InputStream is = getClass().getResource(“txtData/states.properties”); read(is); } ''' In the case above txtData is placed in the jar on the root. Remmember to add the path with the “/”

October 31, 2008 · 1 min · Theme PaperMod

Command

By using the command pattern you are seperating the operation from the invoking object. And just because of that it becomes easier to change the command without chagning the caller/s. This means that you could use Command pattern when you might have the following situation You want to parameterize objects to perform an action You want to specify, execute and queue requests at different times. Just to quickly start you need a command object, An interface will keep it easy going in this case, thus providing you with the option of extending other classes e....

October 31, 2008 · 2 min · Theme PaperMod