<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Software on Shaaf's blog</title><link>https://shaaf.dev/tags/software/</link><description>Recent content in Software on Shaaf's blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 22 Jun 2009 15:59:07 +0200</lastBuildDate><atom:link href="https://shaaf.dev/tags/software/index.xml" rel="self" type="application/rss+xml"/><item><title>Keep it simple, short and stupid (KISS)</title><link>https://shaaf.dev/post/2009-06-22-keep-it-simple-short-and-stupid/</link><pubDate>Mon, 22 Jun 2009 15:59:07 +0200</pubDate><guid>https://shaaf.dev/post/2009-06-22-keep-it-simple-short-and-stupid/</guid><description>&lt;p>&lt;em>everything should be made as simple as possible, but no simpler&lt;/em> -
&lt;a href="http://en.wikipedia.org/wiki/Albert_Einstein">Albert Einstein&lt;/a>&lt;/p>
&lt;p>I am sitting in a design room today designing a simple requirement for a client. He wants me to enhance the transfer money from one account to another. Just that it happens that I have my best friend Yuky sitting right next to me. He is damn good in Maths and extra ordinarily knows all the calculations on his tips. I am sure if I had asked him what was the angle of sight to the light on the wall he could just tell me in a few seconds looking with 10 eyes at his 12 fingers, trust me it will be correct.&lt;/p></description></item><item><title>Automation with Selenium,Junit, Ant</title><link>https://shaaf.dev/post/2009-01-19-automation-with-seleniumjunit-ant/</link><pubDate>Mon, 19 Jan 2009 16:31:52 +0100</pubDate><guid>https://shaaf.dev/post/2009-01-19-automation-with-seleniumjunit-ant/</guid><description>&lt;p>Much of the technologies above do not or will not need an introduction if you already know them or can read them from the links above.&lt;/p>
&lt;p>More over today&amp;rsquo;s article is more about how we can use all the three selenium, ant and junit to come up with an automated solution for regressive testing.&lt;/p>
&lt;p>Please refer to the documentation links above for the basic knowledge on any of the used tools.&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>Continous Integration - A blast from the past</title><link>https://shaaf.dev/post/2008-11-12-continous-integration-a-blast-from-the-past/</link><pubDate>Wed, 12 Nov 2008 20:00:16 +0100</pubDate><guid>https://shaaf.dev/post/2008-11-12-continous-integration-a-blast-from-the-past/</guid><description>&lt;p>Although this didn&amp;rsquo;t happen a decade ago but still has been a good case for me to learn and realize how Continuous Integration brings value addition to our work.&lt;/p>
&lt;p>As I recall it was like this when they were teenagers :D
Few teams working on different modules of same application, deployed together.
No build process formalized
No builds except for the ones that need major milestone deployments.
No feedback, reports, reviews etc.&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>That thing about CI - Continous Integration</title><link>https://shaaf.dev/post/2008-11-12-that-thing-about-ci-continous-integration/</link><pubDate>Wed, 12 Nov 2008 14:11:18 +0100</pubDate><guid>https://shaaf.dev/post/2008-11-12-that-thing-about-ci-continous-integration/</guid><description>&lt;p>Challenging Business requirements and the need for software development teams to remain agile and competitive while managing parallel development and releases requires a system which is adaptive to these demands.&lt;/p>
&lt;p>Our approach to SCM enables unlimited and adaptable process models, which are ideally suited for parallel, distributed, and agile software development. Using state of the Art technologies from various vendors to automate processes such as branching, merging, build, and release keeps you a click away from software delivery.&lt;/p></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>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>Crocus - CSV Reader</title><link>https://shaaf.dev/post/2008-10-03-crocus-csv-reader/</link><pubDate>Fri, 03 Oct 2008 23:38:42 +0200</pubDate><guid>https://shaaf.dev/post/2008-10-03-crocus-csv-reader/</guid><description>&lt;p>Easy to use ready to go CSV File Reading utility. Read One or Multiple files into a RecordManager, quick access to the file with segmentation into Fields and Records. Merge Multiple CSV files in one. Listener to CSV Files.&lt;/p>
&lt;p>&lt;a href="https://sourceforge.net/project/platformdownload.php?group_id=172152">Download Here&lt;/a>&lt;/p>
&lt;p>Organization:
A CSV file is broken up as follows
A CSVField has a group of characters
A CSVRecord has a group of CSVFields
A CSVFile has a group of record&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>