<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Roger Cuddy &#187; Programming</title>
	<atom:link href="http://www.rogercuddy.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rogercuddy.com</link>
	<description>This site holds copies of whatever I&#039;ve posted around the net. YMMV</description>
	<lastBuildDate>Sat, 03 Jul 2010 17:04:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Poor Man Facebook Library Project note 1 &#8211; Setting up your environment to build</title>
		<link>http://www.rogercuddy.com/programming/poor-man-facebook-library-project-note-1-setting-up-your-environment-to-build/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.rogercuddy.com/programming/poor-man-facebook-library-project-note-1-setting-up-your-environment-to-build/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 10:23:42 +0000</pubDate>
		<dc:creator>Roger Cuddy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Facebook Java]]></category>
		<category><![CDATA[Poor Man Face Book Library]]></category>
		<category><![CDATA[Roger Cuddy]]></category>

		<guid isPermaLink="false">http://www.rogercuddy.com/programming/poor-man-facebook-library-project-note-1-setting-up-your-environment-to-build/</guid>
		<description><![CDATA[We’re still a bit undecided on whether to use the library website to post items intended only to the dev team. For now dev items will be posted on my SourceForge site and at Poor’s site both. Poor and I have tried to structure the build process to minimize special requirements on any developer’s machine [...]]]></description>
			<content:encoded><![CDATA[<img style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=4f56e4f86bf509535a047def1525d6f0&amp;default=http://use.perl.org/images/pix.gif' alt='No Gravatar' width=40 height=40/><p>We’re still a bit undecided on whether to use the library website to post items intended only to the dev team. For now dev items will be posted on <a rel="nofollow" href="http://rogercuddy.users.sourceforge.net"  target="_blank">my SourceForge site</a> and at <a href="http://www.poor-man.com"  target="_blank">Poor’s site</a> both. </p>
<p>Poor and I have tried to structure the build process to minimize special requirements on any developer’s machine . So far at least we’ve been able to keep it pretty mild, especially if you only have the developer role. Most developers will already have everything they need installed. </p>
<hr />
<p>To develop and build</p>
<ul>
<li>Text Editor of your choice. Use whichever tool you normally do but <u>DO NOT</u> check IDE specific files into the source repository. </li>
<li><a href="http://subversion.tigris.org/"  target="_blank">Subversion</a> (and a GUI if you wish) </li>
<li><a href="http://java.sun.com/javase/downloads/index.jsp"  target="_blank">JDK 1.6 SE</a> </li>
<li><a href="http://ant.apache.org/index.html"  target="_blank">Ant 1.7.1</a> </li>
<li>Optional – <a rel="nofollow" href="http://pmd.sourceforge.net/"  target="_blank">PMD</a> installed for use by Ant, <a rel="nofollow" href="http://pmd.sourceforge.net/ant-task.html"  target="_blank">ant task doc</a> </li>
</ul>
<hr />
<p>If you will be working on the website then you need to add a little more</p>
<ul>
<li>Pushing to the website via the build script requires that your ssh key be registered with sourceforge. We very much do not want any user ids and passwords embedded in the script at any time. It’s just too easy&#160; to forget and check in build.xml with your id / pw now publicly available. </li>
<li>Pushing from Ant requires you have optional library <a href="http://www.jcraft.com/jsch/"  target="_blank">JSch</a> installed. </li>
</ul>
<p>&#160;</p>
<p>That’s it for now anyway. Changes will be posted as new articles so they are easy to catch.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rogercuddy.com%2Fprogramming%2Fpoor-man-facebook-library-project-note-1-setting-up-your-environment-to-build%2F&amp;linkname=Poor%20Man%20Facebook%20Library%20Project%20note%201%20%26ndash%3B%20Setting%20up%20your%20environment%20to%20build"><img src="http://www.rogercuddy.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.rogercuddy.com/programming/poor-man-facebook-library-project-note-1-setting-up-your-environment-to-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This should be interesting&#8230;</title>
		<link>http://www.rogercuddy.com/programming/this-should-be-interesting/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.rogercuddy.com/programming/this-should-be-interesting/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 19:19:52 +0000</pubDate>
		<dc:creator>Roger Cuddy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Roger Cuddy]]></category>

		<guid isPermaLink="false">http://www.rogercuddy.com/programming/this-should-be-interesting/</guid>
		<description><![CDATA[Can you really run a functioning WordPress blog on Source Forge&#8217;s user space? We&#8217;re going to find out. My first thought about installing was admittedly &#8216;this is going to hurt!&#8217;. Once setup it will be accessible at Rog&#8217;s SF Notes &#60;edit&#62;The install went well. You can read about it at the follow up post &#60;end [...]]]></description>
			<content:encoded><![CDATA[<img style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=4f56e4f86bf509535a047def1525d6f0&amp;default=http://use.perl.org/images/pix.gif' alt='No Gravatar' width=40 height=40/><p>Can you really run a functioning WordPress blog on Source Forge&#8217;s user space? We&#8217;re going to find out. My first thought about installing was admittedly &#8216;this is going to hurt!&#8217;. Once setup it will be accessible at <a rel="nofollow" href="http://rogercuddy.users.sourceforge.net"  target="_blank">Rog&#8217;s SF Notes</a></p>
<p>&lt;edit&gt;The install went well. You can read about it at the <a href="http://www.rogercuddy.com/sourceforge/installing-and-running-wordpress-on-sourceforge/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"  title="follow up post">follow up post</a> &lt;end edit&gt;</p>
<p>Goals: </p>
<ol>
<li>Be able to install themes and plugins. </li>
<li>Responsive enough that it drives readers mad waiting on pages to render. </li>
<li>Support sitemaps </li>
<li>Easy to backup/restore both the database and the file system. </li>
<li>Allow multiple contributors </li>
</ol>
<p> </p>
<p>Quite modest but if I can get that much working I’ll be pretty happy. #1 itself rules out using SF’s Hosted Apps as it won’t be possible to use any themes or plugins. </p>
<p>Will post soon on how it all went. </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rogercuddy.com%2Fprogramming%2Fthis-should-be-interesting%2F&amp;linkname=This%20should%20be%20interesting%26%238230%3B"><img src="http://www.rogercuddy.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.rogercuddy.com/programming/this-should-be-interesting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Combining Derby embedded mode and server mode</title>
		<link>http://www.rogercuddy.com/programming/combining-derby-embedded-mode-and-server-mode/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.rogercuddy.com/programming/combining-derby-embedded-mode-and-server-mode/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 10:25:21 +0000</pubDate>
		<dc:creator>Roger Cuddy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Derby]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.rogercuddy.com/combining-derby-embedded-mode-and-server-mode-60.htm</guid>
		<description><![CDATA[Recently there have been several occasions where I have needed an application to use an embedded driver but also needed to allow for the occasional login to the database externally while the application is executing. Derby works wonderfully for this and starting a server within the application is exceedingly simple. Here I will give just [...]]]></description>
			<content:encoded><![CDATA[<img style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=4f56e4f86bf509535a047def1525d6f0&amp;default=http://use.perl.org/images/pix.gif' alt='No Gravatar' width=40 height=40/><p>Recently there have been several occasions where I have needed an application to use an embedded driver but also needed to allow for the occasional login to the database externally while the application is executing. Derby works wonderfully for this and starting a server within the application is exceedingly simple. Here I will give just a brief example that should be enough to demonstrate the method. The code fragments here are admittedly simplistic but they work and show the principles cleanly. </p>
<pre><span style=" font-family:'Courier New,courier';"> </span></pre>
<pre><span style=" font-family:'Courier New,courier';">//First a method to get an embedded connection:</span></pre>
<pre></pre>
<pre><span style=" font-family:'Courier New,courier';">public Connection getConnection() {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">    try {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">        return DriverManager.getConnection("jdbc:derby:"+dbPath);</span></pre>
<pre><span style=" font-family:'Courier New,courier';">    } catch (SQLException e) {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">        log.error(e.getMessage(),e);</span></pre>
<pre><span style=" font-family:'Courier New,courier';">        return null;</span></pre>
<pre><span style=" font-family:'Courier New,courier';">    }</span></pre>
<pre><span style=" font-family:'Courier New,courier';">}</span></pre>
<pre></pre>
<pre><span style=" font-family:'Courier New,courier';">//Now a method to start the server for external connections.</span></pre>
<pre></pre>
<pre><span style=" font-family:'Courier New,courier';">private void startDBServer() {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">	try {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">		server = new NetworkServerControl(InetAddress.getByName("Localhost"),1527);</span></pre>
<pre><span style=" font-family:'Courier New,courier';">		server.start(null);</span></pre>
<pre><span style=" font-family:'Courier New,courier';">	} catch (Exception e) {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">		log.error(e.getMessage(),e);</span></pre>
<pre><span style=" font-family:'Courier New,courier';">	}</span></pre>
<pre><span style=" font-family:'Courier New,courier';">}</span></pre>
<pre></pre>
<pre><span style=" font-family:'Courier New,courier';">//And lastly let's add a shudown hook to ensure the server gets a chance to exit clean.</span></pre>
<pre></pre>
<pre><span style=" font-family:'Courier New,courier';">private void setShutdownHook() {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">	Runtime.getRuntime().addShutdownHook(new Thread() {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">		public void run() {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">			log.info("**** Application ending ****");</span></pre>
<pre><span style=" font-family:'Courier New,courier';">			try {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">				server.shutdown();</span></pre>
<pre><span style=" font-family:'Courier New,courier';">				} catch (Exception e) {</span></pre>
<pre><span style=" font-family:'Courier New,courier';">					log.error(e.getMessage(),e);</span></pre>
<pre><span style=" font-family:'Courier New,courier';">				}</span></pre>
<pre><span style=" font-family:'Courier New,courier';">			}</span></pre>
<pre><span style=" font-family:'Courier New,courier';">    } );</span></pre>
<pre><span style=" font-family:'Courier New,courier';">}</span></pre>
<pre></pre>
<p> That&#8217;s the basics and it doesn&#8217;t get much easier.</p>
Author <a href="http://www.rogercuddy.com#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" >Roger Cuddy</a> claims no special knowledge of subject beyond a strong interest and slight opinion. Your mileage may vary.<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rogercuddy.com%2Fprogramming%2Fcombining-derby-embedded-mode-and-server-mode%2F&amp;linkname=Combining%20Derby%20embedded%20mode%20and%20server%20mode"><img src="http://www.rogercuddy.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.rogercuddy.com/programming/combining-derby-embedded-mode-and-server-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brief introduction to Java Singleton Classes</title>
		<link>http://www.rogercuddy.com/programming/brief-introduction-to-java-singleton-classes/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.rogercuddy.com/programming/brief-introduction-to-java-singleton-classes/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 23:54:39 +0000</pubDate>
		<dc:creator>Roger Cuddy</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.rogercuddy.com/brief-introduction-to-java-singleton-classes-17.htm</guid>
		<description><![CDATA[The Singleton Pattern is quite simple but at the same time extremely useful. If you have done any serious programming then there is a good chance that you have fudged the behavior into a class or forced a class to act as a singleton without knowing the pattern. In this very short article we will [...]]]></description>
			<content:encoded><![CDATA[<img style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=4f56e4f86bf509535a047def1525d6f0&amp;default=http://use.perl.org/images/pix.gif' alt='No Gravatar' width=40 height=40/><p>The Singleton Pattern is quite simple but at the same time extremely useful. If you have done any serious programming then there is a good chance that you have fudged the behavior into a class or forced a class to act as a singleton without knowing the pattern. In this very short article we will examine the common method to construct a singleton.</p>
<p><span id="more-17"></span></p>
<p>The main purposes of a singleton are to:</p>
<ul>
<li>Provide that only one instance of the class is created</li>
<li>Provide a single point of obtaining that instance</li>
</ul>
<p>The occasions where you want to ensure only one instance of a class are numerous and mostly obvious. Consider an application that performs many validation tests on a database and combines the results into a consolidated report. The simple way to consolidate the differing results is to allow each test to store it’s results into a central repository and then when desired the repository would combine the results and provide the formatted output. In such a situation you want only one instance of the result repository to exist so that all test results are stored in the same holding point.</p>
<p>The time honored method to provide a singleton is make the constructor non-public and provide a method called getInstance that returns the single instance of the class. Let’s look at how a simple singleton class achieves this.</p>
<pre>public class SimpleSingleton {
	private static SimpleSingleton instance = null;

	private SimpleSingleton(){}

	public synchronized SimpleSingleton getInstance() {
		if (instance == null) {
			instance = new SimpleSingleton();
		}
		return instance;
	}
}</pre>
<p>Some notes about derivations to this method. Obviously if you intended to subclass then the constructor must be protected instead of private. However if you make it protected it’s recommended that you put the class in it’s own package to prevent accidental access to the constructor from other classes in the package. Also it’s possible to reduce the overhead of the synchronization by syncing on the instance variable but in practice you won’t call getInstance enough to make it worth worrying about. Personally I recommend just taking the easy approach and creating a class variable at the top of each class that would access the singleton and saving all the method calls.</p>
<p>That’s it for the basics of singleton creation. There are numerous ways to expand on this simple example and we’ll cover several of them in an upcoming post.</p>
<p>For more coverage here are some selected readings on the singleton pattern:</p>
<p><a rel="nofollow" href="http://en.wikipedia.org/wiki/Singleton_pattern" title="http://en.wikipedia.org/wiki/Singleton_pattern" >http://en.wikipedia.org/wiki/Singleton_pattern</a></p>
<p><a href="http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html" title="http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html" >http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html</a></p>
<p><a rel="nofollow" href="http://blogs.techrepublic.com.com/programming-and-development/?p=449" title="http://blogs.techrepublic.com.com/programming-and-development/?p=449" >http://blogs.techrepublic.com.com/programming-and-development/?p=449</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rogercuddy.com%2Fprogramming%2Fbrief-introduction-to-java-singleton-classes%2F&amp;linkname=Brief%20introduction%20to%20Java%20Singleton%20Classes"><img src="http://www.rogercuddy.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.rogercuddy.com/programming/brief-introduction-to-java-singleton-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
