<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Howto on Shaaf's blog</title><link>https://shaaf.dev/tags/howto/</link><description>Recent content in Howto on Shaaf's blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 11 Dec 2008 10:17:46 +0100</lastBuildDate><atom:link href="https://shaaf.dev/tags/howto/index.xml" rel="self" type="application/rss+xml"/><item><title>Calling wsadmin scripts from ant</title><link>https://shaaf.dev/post/2008-12-11-calling-wsadmin-scripts-from-ant/</link><pubDate>Thu, 11 Dec 2008 10:17:46 +0100</pubDate><guid>https://shaaf.dev/post/2008-12-11-calling-wsadmin-scripts-from-ant/</guid><description>&lt;p>You can simply add the following to a target.
For the following wsadmin should be in your PATH env.&lt;/p>
&lt;pre>&lt;code>&amp;lt; exec dir=&amp;quot;.&amp;quot; executable=&amp;quot;wsadmin.bat&amp;quot; logError=&amp;quot;true&amp;quot; failonerror=&amp;quot;true&amp;quot; output=&amp;quot;wsconfig.out&amp;quot; &amp;gt;
	&amp;lt; arg line=&amp;quot;-lang jython -f ../../createQFactory.py&amp;quot;/ &amp;gt;
&amp;lt; /exec &amp;gt;
&lt;/code>&lt;/pre>
&lt;p>All output will be logged to wsconfig.out&lt;/p></description></item><item><title>Generate XML - DBMS_XMLGEN</title><link>https://shaaf.dev/post/2008-12-10-generate-xml-dbms_xmlgen/</link><pubDate>Wed, 10 Dec 2008 16:58:04 +0100</pubDate><guid>https://shaaf.dev/post/2008-12-10-generate-xml-dbms_xmlgen/</guid><description>&lt;p>On my way to my solution store just found this nice to use, old and easy feature.
Possibilities endless, usage typically very easy.&lt;/p>
&lt;p>I used the following to generate XML from sqlplus:&lt;/p>
&lt;pre>&lt;code>select dbms_xmlgen.getxml('select * from user') from dual;
&lt;/code>&lt;/pre>
&lt;p>Output:
&amp;lt; ROWSET &amp;gt;
&amp;lt; ROW &amp;gt;
&amp;lt; TNAME &amp;gt;Employee&amp;lt; / TNAME &amp;gt;
&amp;lt; TABTYPE &amp;gt; TABLE &amp;lt; / TABTYPE &amp;gt;
&amp;lt; / ROW &amp;gt;
&amp;lt; / ROWSET &amp;gt;&lt;/p></description></item><item><title>Command, Singleton, JMenuItem, JButton, AbstractButton - One Listener for the app</title><link>https://shaaf.dev/post/2008-11-17-command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/</link><pubDate>Mon, 17 Nov 2008 21:17:24 +0100</pubDate><guid>https://shaaf.dev/post/2008-11-17-command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/</guid><description>&lt;p>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.&lt;/p>
&lt;p>Lets see how that is done here.&lt;/p>
&lt;ol>
&lt;li>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.&lt;/li>
&lt;/ol>
&lt;div class="code-block">
 &lt;div class="code-header">
 &lt;div class="code-dots">
 &lt;span class="d1">&lt;/span>&lt;span class="d2">&lt;/span>&lt;span class="d3">&lt;/span>
 &lt;/div>
 &lt;span class="code-filename">text snippet&lt;/span>
 &lt;span class="code-lang">TEXT&lt;/span>
 &lt;/div>&lt;pre tabindex="0">&lt;code>	package com.shaafshah.jmenus;

	import java.awt.event.ActionEvent;
	import java.awt.event.ActionListener;
	import java.util.ArrayList;
	import javax.swing.AbstractButton;

	// Implements the ActionListener and is a Singleton also.

	public class OneListener implements ActionListener{

		private static OneListener oneListener = null;

		// Holds the list of all commands registered to this listener
		private ArrayList&amp;lt;Command&amp;gt; commandList = null;

		// A private constructor
		private OneListener(){
			commandList = new ArrayList&amp;lt;Command&amp;gt;();
		}

		// Ensuring one instance.
		public static OneListener getInstance(){
			if(oneListener != null)
				return oneListener;
			else return oneListener = new OneListener();
		}

		// Add the command and add myself as the listener
		public void addCommand(Command command){
			commandList.add(command);
		 ((AbstractButton)command).addActionListener(this);
		}


		// All Events hit here.
		@Override
		public void actionPerformed(ActionEvent e) {
			((Command)e.getSource()).execute();
		}

	}&lt;/code>&lt;/pre>&lt;/div>
&lt;p>In the above code, the addCommand method adds the command Object and adds a listener to it.
Now how is that possible.
Basically because I am categorizing my UI objects as Commands with in the system having some UI. And I am also assuming that these commands are Currently AbstractButton i.e. JMenuItem, JButton. Lets have a look at the Command Interface and its Implementation.&lt;/p></description></item><item><title>Doing the Locale - Danmark</title><link>https://shaaf.dev/post/2008-11-12-doing-the-locale-danmark/</link><pubDate>Wed, 12 Nov 2008 14:52:08 +0100</pubDate><guid>https://shaaf.dev/post/2008-11-12-doing-the-locale-danmark/</guid><description>&lt;p>The following illustrates how to get the Number format working with a danish locale.&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header">
 &lt;div class="code-dots">
 &lt;span class="d1">&lt;/span>&lt;span class="d2">&lt;/span>&lt;span class="d3">&lt;/span>
 &lt;/div>
 &lt;span class="code-filename">text snippet&lt;/span>
 &lt;span class="code-lang">TEXT&lt;/span>
 &lt;/div>&lt;pre tabindex="0">&lt;code>	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(&amp;#34;da&amp;#34;,&amp;#34;DK&amp;#34;);

 		// 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.getCurrency().getSymbol();
 		// A double amount
 		double amount = 10000.25;
		// print it out after formatting.
 		System.out.println(krFormat.format(amount));
 		}
	}&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>How to read a file from the JAR?</title><link>https://shaaf.dev/post/2008-10-31-how-to-read-a-file-from-the-jar/</link><pubDate>Fri, 31 Oct 2008 20:57:54 +0100</pubDate><guid>https://shaaf.dev/post/2008-10-31-how-to-read-a-file-from-the-jar/</guid><description>&lt;p>Someone just asked me this question today. And I thought might as well put it down for info.&lt;/p>
&lt;div class="code-block">
 &lt;div class="code-header">
 &lt;div class="code-dots">
 &lt;span class="d1">&lt;/span>&lt;span class="d2">&lt;/span>&lt;span class="d3">&lt;/span>
 &lt;/div>
 &lt;span class="code-filename">text snippet&lt;/span>
 &lt;span class="code-lang">TEXT&lt;/span>
 &lt;/div>&lt;pre tabindex="0">&lt;code> 	public TestReadFileFromJar() throws FileNotFoundException, IOException {
 	InputStream is = getClass().getResource(&amp;#34;txtData/states.properties&amp;#34;);
 	read(is);
	}&lt;/code>&lt;/pre>&lt;/div>
&lt;p>In the case above txtData is placed in the jar on the root. Remmember to add the path with the &amp;ldquo;/&amp;rdquo;&lt;/p></description></item><item><title>Command</title><link>https://shaaf.dev/post/2008-10-31-command/</link><pubDate>Fri, 31 Oct 2008 20:45:04 +0100</pubDate><guid>https://shaaf.dev/post/2008-10-31-command/</guid><description>&lt;p>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&lt;/p>
&lt;p>You want to parameterize objects to perform an action
You want to specify, execute and queue requests at different times.&lt;/p>
&lt;p>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.g. Swing MenuItem or Button.
Below the execute Method is the one invoked to do something when this command is called or asked to do its stuff.
Where as the getCommandName is assumed as a unique name how ever I am sure we can always come up with a better implementation for uniqueness.&lt;/p></description></item><item><title>Implementing the adapter</title><link>https://shaaf.dev/post/2008-10-29-implementing-the-adapter/</link><pubDate>Wed, 29 Oct 2008 20:47:56 +0100</pubDate><guid>https://shaaf.dev/post/2008-10-29-implementing-the-adapter/</guid><description>&lt;p>Typically when implementing an interface you would have to implement all the methods that exist in that interface. A very good example is the MouseListener in the java Swing. When you need to implement more then one method where as typically you might be catching only one of them. Saying that you would also find a Mouse Adapter provided as well. Some of us use that often. And that is part of the Adapter pattern. It makes life easier for me sometimes.&lt;/p></description></item><item><title>wasprofile -create -delete</title><link>https://shaaf.dev/post/2008-10-24-wasprofile-create-delete/</link><pubDate>Fri, 24 Oct 2008 13:38:00 +0200</pubDate><guid>https://shaaf.dev/post/2008-10-24-wasprofile-create-delete/</guid><description>&lt;p>Sometimes you require to do things silently, without any questions asked and &amp;ldquo;Just Do It&amp;rdquo; attitude is required.&lt;/p>
&lt;p>I often find my self with this problem.&lt;/p>
&lt;p>If you want to delete or create a Websphere profile from your command line try the following. (I have tried on RSA only)&lt;/p>
&lt;pre>&lt;code># deleteing a profile
wasprofile -delete -profileName MyProfile
&lt;/code>&lt;/pre>
&lt;p>You should get the following message on deletion&lt;/p>
&lt;pre>&lt;code>INSTCONFSUCCESS: Success: The profile no longer exists.
&lt;/code>&lt;/pre>
&lt;p>Creating a websphere profile&lt;/p></description></item><item><title>Abstract Factory pattern</title><link>https://shaaf.dev/post/2008-10-10-abstract-factory-pattern/</link><pubDate>Fri, 10 Oct 2008 10:20:10 +0200</pubDate><guid>https://shaaf.dev/post/2008-10-10-abstract-factory-pattern/</guid><description>&lt;p>Factories have been a key pattern in building applications, its fascinatingly simple, effective and to the point. When starting to learn a design oriented approach to applications or API, I would always recommend a factory pattern as one of the key starting notes of highlight in your design.&lt;/p>
&lt;p>So today I am talking about the Abstract Factory pattern. Its not an &amp;ldquo;abstract&amp;rdquo; class or object that you call a pattern. But its a Factory of facotries and that is what exactly makes it so much wordingly abstract. Having &amp;ldquo;abstract&amp;rdquo; classes is there but just some other side of the coin.&lt;/p></description></item><item><title>SVN - some quick commands during merge</title><link>https://shaaf.dev/post/2008-08-25-svn-some-quick-commands-during-merge/</link><pubDate>Mon, 25 Aug 2008 15:55:54 +0200</pubDate><guid>https://shaaf.dev/post/2008-08-25-svn-some-quick-commands-during-merge/</guid><description>&lt;p>Following are some of the frequently used svn commands during merging and branching. I used to work with tortoise for this but as soon as I learned these, it feels like a more easier space to be in. Although no points taken away from tortoise, it still works pretty good for the gui part, This article is more targeted towards dark screen lovers.&lt;/p>
&lt;p>Create a new branch from trunk:
If you want to create a branch from a specific revision of Trunk following command is handy. It does a remote copy. which means the machine you are on does not need a copy of the whole tree.&lt;/p></description></item><item><title>HowTo create a JDBC provider with wsadmin scripting - Jython</title><link>https://shaaf.dev/post/2008-07-01-howto-create-a-jdbc-provider-with-wsadmin-scripting-jython/</link><pubDate>Tue, 01 Jul 2008 14:21:48 +0200</pubDate><guid>https://shaaf.dev/post/2008-07-01-howto-create-a-jdbc-provider-with-wsadmin-scripting-jython/</guid><description>&lt;p>Last week I wrote a post about creating MQQueues with jacl. However today I am moving to Jython. This is the new scripting languauge supported by the wsadmin. The following write-up helps you create a JDBC provider using Jython in 6 easy steps on the wsadmin console.&lt;/p>
&lt;p>*Pre requirements:
*Following should be known to start using this tutorial.&lt;/p>
&lt;ol>
&lt;li>How to launch the wsadmin with Jython enabled.&lt;/li>
&lt;/ol>
&lt;p>*Where will I find the wsadmin?
*It is typically placed in the bin directory of your server.
In my case its lying in my RAD installation directory as
../Rational/SDP/6.0/runtimes/base_v6/bin&lt;/p></description></item><item><title>Creating an SVN wrap for your build using Ant</title><link>https://shaaf.dev/post/2008-06-30-creating-an-svn-wrap-for-your-build-using-ant/</link><pubDate>Mon, 30 Jun 2008 14:45:32 +0200</pubDate><guid>https://shaaf.dev/post/2008-06-30-creating-an-svn-wrap-for-your-build-using-ant/</guid><description>&lt;p>Today after along break I would jump right on to one of the interesting topics in my den these days.&lt;/p>
&lt;p>One of my friends was lately troubled with doing some SVN stuff like merging etc. And a lot of people will agree with me on their first experiences. :) I think.&lt;/p>
&lt;p>While Automated builds take a lot of our time I thought I could plug in with some automated merging and a few other tasks. Its hard to go over all of that in one post but I will try putting in some basic stuff to get us started.&lt;/p></description></item><item><title>Creating the MQQueues with wsadmin scripting - JACL Part 2</title><link>https://shaaf.dev/post/2008-06-25-creating-the-mqqueues-with-wsadmin-scripting-jacl-part-2/</link><pubDate>Wed, 25 Jun 2008 14:40:47 +0200</pubDate><guid>https://shaaf.dev/post/2008-06-25-creating-the-mqqueues-with-wsadmin-scripting-jacl-part-2/</guid><description>&lt;p>Yesterday I wrote an article about creating and configuring the MQQueueConnectionFactory with the JACL on the wsadmin console. The other half of the article that was left out was to create the queues also.&lt;/p>
&lt;p>The world looks pretty much the same today and my /etc/profile doesnt seemed to have been sourced again. Good we dont need a restart.&lt;/p>
&lt;p>You would find some of the steps to be similar and that is because we are running on the same configs.&lt;/p></description></item><item><title>Creating the MQQueueConnectionFactory with wsadmin scripting - JACL Part 1.</title><link>https://shaaf.dev/post/2008-06-24-websphere-admin-scripting-jacl-part-1/</link><pubDate>Tue, 24 Jun 2008 15:44:31 +0200</pubDate><guid>https://shaaf.dev/post/2008-06-24-websphere-admin-scripting-jacl-part-1/</guid><description>&lt;p>While working my way in some piece of long java code I came across this huge pile of sand that just shattered me off every bit of patience I was left with. The dilemma all of us face every second day. &lt;em>CONFIGURATIONS!!&lt;/em>&lt;/p>
&lt;p>While my sarcastic mind was just saying Congratulations to me instead. And just how the - would you expect me to start configuring now.&lt;/p>
&lt;p>So what exactly is my problem? I have a list of MQs, Factories, datasource, providers etc.. that I need to configure. And every time I create a new profile on my RAD (Rational Application Developer) I have to manually goto the Admin console and configure them.&lt;/p></description></item><item><title>Quick start Singleton - Walk through</title><link>https://shaaf.dev/post/2008-06-23-quick-start-singleton-walk-through/</link><pubDate>Mon, 23 Jun 2008 03:56:37 +0200</pubDate><guid>https://shaaf.dev/post/2008-06-23-quick-start-singleton-walk-through/</guid><description>&lt;p>This being my first existence on the network and I just want to make sure that I would come back to this blog page again sometime and keep on writing. For now this is a quick 5 min walk through of getting your hands dirty on the Singleton Pattern. As any ones first pattern Singleton always seems to be the easiest to adapt and ironically always the mistress of your pains; when you realize the act wasn&amp;rsquo;t right in the first place.
More details on that later.&lt;/p></description></item></channel></rss>