<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Software-Development on Shaaf's blog</title><link>https://shaaf.dev/tags/software-development/</link><description>Recent content in Software-Development on Shaaf's blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 12 Nov 2008 14:52:08 +0100</lastBuildDate><atom:link href="https://shaaf.dev/tags/software-development/index.xml" rel="self" type="application/rss+xml"/><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>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>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>