<?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"
	>

<channel>
	<title>Mark's Site</title>
	<atom:link href="http://www.marksiedle.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marksiedle.com</link>
	<description>Pensieve for coding and golf :-)</description>
	<pubDate>Sat, 16 Aug 2008 12:00:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Correct Distance From The Ball</title>
		<link>http://www.marksiedle.com/2008/08/16/correct-distance-from-the-ball/</link>
		<comments>http://www.marksiedle.com/2008/08/16/correct-distance-from-the-ball/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 11:42:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[2. Mini-Articles]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1389</guid>
		<description><![CDATA[This is a subsection of my post titled &#8216;Thoughts For The Swing&#8217;.
My thoughts on determining if you are standing the correct distance from the golf ball in more detail:
You will know if this feels wrong through developing a feel for your clubs (by practicing daily). To verify the correct distance to stand from the ball, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a subsection of my post titled <a href="http://www.marksiedle.com/2008/08/16/thoughts-for-the-swing/" target="_self">&#8216;Thoughts For The Swing&#8217;</a>.</p>
<p>My thoughts on determining if you are standing the correct distance from the golf ball in more detail:</p>
<p>You will know if this feels wrong through developing a feel for your clubs (by practicing daily). To verify the correct distance to stand from the ball, let your right arm fall away from your grip, hanging from your body. If your right hard falls away from your grip in line with your target, you are the correct distance from the ball. This same rule applies with all clubs from your wedge to your driver.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/08/16/correct-distance-from-the-ball/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thoughts for the Swing</title>
		<link>http://www.marksiedle.com/2008/08/16/thoughts-for-the-swing/</link>
		<comments>http://www.marksiedle.com/2008/08/16/thoughts-for-the-swing/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 11:37:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[1. My Swing]]></category>

		<category><![CDATA[golf swing]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1353</guid>
		<description><![CDATA[My personal thoughts when hitting a golf ball with a full swing (same swing for any club).
Address

Address the ball. [more info]
Check I&#8217;m standing the correct distance from the ball. [more info]
Check the ball is where I want it in relation to my stance.
Check my feet are far enough apart to provide a strong foundation for [...]]]></description>
			<content:encoded><![CDATA[<p>My personal thoughts when hitting a golf ball with a full swing (same swing for any club).</p>
<h2>Address</h2>
<ol>
<li>Address the ball. <a title="Read more detail about addressing the ball" href="http://www.marksiedle.com/2008/08/15/pre-address-checklist/" target="_self">[more info]</a></li>
<li>Check I&#8217;m standing the correct distance from the ball. <a href="http://www.marksiedle.com/2008/08/16/correct-distance-from-the-ball/" target="_self">[more info]</a></li>
<li>Check the ball is where I want it in relation to my stance.</li>
<li>Check my feet are far enough apart to provide a strong foundation for my swing.</li>
<li>Look at the target and make any final foot adjustments.</li>
<li>Check my knees feel like that are pointing towards each other, providing a strong swing foundation.</li>
<li>Check my elbows are in the correct positions. (Left elbow straight, with inside of left elbow pointing up. Right elbow bent straight down in a relaxed position, with inside of right elbow pointing up)</li>
</ol>
<h2>Backswing</h2>
<ol>
<li>Take the club away in one motion. (The hands, arms, shoulders all acting as one)</li>
<li>Feel that right elbow brushing against my side throughout the whole backswing. (This ensures I&#8217;m on the correct swing plane, rotating around my body)</li>
<li>Check I get a full shoulder turn on the backswing.</li>
<li>At top of backswing, check I still feel that right elbow brushed against my side.</li>
</ol>
<h2>Downswing</h2>
<ol>
<li>Turn my hips back to the left. (Make sure this is a turn, not a slide)</li>
<li>Check your head does not move too far forward on the downswing.</li>
<li>Feel that leading left arm through the impact zone. (This will prevent the right arm dominating and hooking the ball, and gives you the control to play a draw, fade or straight shot, just direct the left arm through the hitting area how you want)</li>
</ol>
<h2>Final Thoughts</h2>
<ol>
<li>If blocking or slicing, check you are getting a full shoulder turn, your hips are not sliding on the back or downswing, and that your right elbow is in the correct position on the backswing.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/08/16/thoughts-for-the-swing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pre-Address Checklist</title>
		<link>http://www.marksiedle.com/2008/08/15/pre-address-checklist/</link>
		<comments>http://www.marksiedle.com/2008/08/15/pre-address-checklist/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 08:46:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[2. Mini-Articles]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1359</guid>
		<description><![CDATA[This is a subsection of my post titled &#8216;Thoughts For The Swing&#8217;.
My thoughts on stepping up to the golf ball in more detail:

With no club in my hand, pick my target.
Choose the precise spot on the green or fairway where I want my ball to land. (Be sure to take into account the roll you [...]]]></description>
			<content:encoded><![CDATA[<p>This is a subsection of my post titled <a href="http://www.marksiedle.com/2008/08/16/thoughts-for-the-swing/" target="_self">&#8216;Thoughts For The Swing&#8217;</a>.</p>
<p>My thoughts on stepping up to the golf ball in more detail:</p>
<ol>
<li><strong>With no club in my hand, pick my target.</strong><br />
<em>Choose the precise spot on the green or fairway where I want my ball to land. (Be sure to take into account the roll you expect for a given landing spot)</em></li>
<li><strong>Select my club, and take my grip.</strong><br />
<em>Through experience we learn club selections, only practice can tell you what club to select. I will not go into grip specifics but I&#8217;m an interlock grip fan. As a general rule, at address you should see two knuckles on your leading hand, with both V&#8217;s of your thumb and forefingers of both hands pointing towards your face.</em></li>
<li><strong>Step up to the ball.</strong><br />
<em>First position the clubface square to the ball (in line with my target), then take my stance, with the ball positioned forward in my stance (forward for standard shots, back in the stance to play a punch shot under the wind). </em></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/08/15/pre-address-checklist/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Performance Friendly PHP</title>
		<link>http://www.marksiedle.com/2008/06/12/performance-friendly-php/</link>
		<comments>http://www.marksiedle.com/2008/06/12/performance-friendly-php/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 13:57:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[1.3. Good Practice Coding]]></category>

		<category><![CDATA[performance friendly php]]></category>

		<category><![CDATA[php coding tips]]></category>

		<category><![CDATA[php mysql coding tips]]></category>

		<category><![CDATA[php performance]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1084</guid>
		<description><![CDATA[As you grow into programming, you can pick up some poor habits along the way. These habits produce the same output, but when used in large projects could end up causing some performance headaches in the long run, causing you to get mentally spanked for not paying attention when reading this article!
So to save your [...]]]></description>
			<content:encoded><![CDATA[<p>As you grow into programming, you can pick up some poor habits along the way. These habits produce the same output, but when used in large projects could end up causing some performance headaches in the long run, causing you to get mentally spanked for not paying attention when reading this article!</p>
<p>So to save your ass, I&#8217;d like to shed some light on good versus bad methods. You may disagree with some methods because they may not improve readability of code, and that is your choice, but the ultimate aim of this article is to promote the most performance friendly method for a given situation.</p>
<h2>Strings on Multiple Lines</h2>
<p>If you work with PHP, sooner or later you will need to manage a multiple line string in code (whether it be for outputting text, or creating a SQL statement string). If you need to create a multiple line string, my advice is to use multiple lines within the ONE string.</p>
<p>Eg: Don&#8217;t do this:</p>
<pre class="php">&lt;?php
$sql_insert_string = 'SELECT id, name';
$sql_insert_string .= 'FROM products';
$sql_insert_string .= 'ORDER BY name ASC';
?&gt;</pre>
<p>(<span style="font-weight: bold; color: red;">performance unfriendly</span>: PHP has to allocate memory for three strings and concatenate them)</p>
<p>Or this:</p>
<pre class="php">&lt;?php
$sql_insert_string = 'SELECT id, name'
. 'FROM products'
. 'ORDER BY name ASC';
?&gt;</pre>
<p>(<span style="font-weight: bold; color: red;">performance unfriendly</span>: Even though this looks like one long string, PHP is really dealing with three strings and has to concatenate them to form the one string)</p>
<p>Instead, do this:</p>
<pre class="php">&lt;?php
$sql_insert_string = 'SELECT id, name
FROM products
ORDER BY name ASC';
?&gt;</pre>
<p>(<span style="font-weight: bold; color: blue;">performance friendly</span>: PHP has one string to deal with, single memory allocation, no concatenation)</p>
<h2>Use Single Quoted Strings</h2>
<p>I&#8217;m sure you know about PHP&#8217;s nice and friendly way of allowing you to put variables directly inside double quoted strings like this:</p>
<pre class="php">&lt;?php
$years_old = 21;
$one_liner = "Hey good lookin, you must be $years_old this year";
?&gt;</pre>
<p>(<span style="font-weight: bold; color: red;">performance unfriendly</span>: unnecessary overhead)</p>
<p>This seems nice and handy I know, but for PHP, this means that ANY string with double quotes has to be searched for potential variables = unnecessary overhead.</p>
<p>Instead, stick to the single quote method. As I also work with VB.NET (where there is no double quote support for strings) this wasn&#8217;t a hard one for me to adjust to, but if you&#8217;re starting out, it&#8217;s important to not get into the bad habit of using double quoted strings if you can avoid it. You might think the overhead marginal, but add up all the double quoted strings in your ever-growing application, put your application under heavy load with shitloads of users hitting your webserver and you&#8217;ll be wishing you had written your strings in the single quote method.</p>
<p>This is the better version:</p>
<pre class="php">&lt;?php
$years_old = 21;
$one_liner = 'Hey good lookin, you must be '.$years_old;
?&gt;</pre>
<p>(<span style="font-weight: bold; color: blue;">performance friendly</span>: No double quotes here, yay!)</p>
<p>I can attest to this being true. I had a project a year or so ago that dealt with heavy mathematical operations (luckily the mathematical operations were already written and I just had to translate them to PHP). I had the bad habit of always writing variables within double quoted strings for various output. When it came time to analyse the performance, the client wanted every minisecond he could get. I had to find ways to knock a few seconds off execution time. The first thing I did was a mass find-and-replace operation to convert double quoted strings to the single quote method (not an easy operation), but when I was done we shaved a second off. That one second proved to me just how important this method is. Imagine an extra second load time for users when your webserver is under load :-/</p>
<p>Note: This same principle applies to array indexes:</p>
<pre class="php">&lt;?php
//if using string indexes, do it like this:
echo $date_array['january'];
//not like this:
echo $date_array["january"];
?&gt;</pre>
<h2>String Concatenation and Output</h2>
<p>This is a pretty cool trick I didn&#8217;t know about until recently, but you can use commas to concatenate strings in PHP and it provides a performance benefit.</p>
<p>For example:</p>
<pre class="php">&lt;?php
//while this looks like a single line of output:
echo 'SELECT id, name' . ' FROM products' . ' ORDER BY name ASC';
//to PHP it actually translates to:
echo 'SELECT id, name';
echo ' FROM products';
echo ' ORDER BY name ASC';
?&gt;</pre>
<p>(<span style="font-weight: bold; color: red;">performance unfriendly</span>: even though this looks like one long string, PHP is actually dealing with three separate strings here, and sending all three strings to output as shown in the translated section &#8230;hence unnecessary overhead)</p>
<p>Instead, use commas:</p>
<pre class="php">&lt;?php
//this looks like a single line of output:
echo 'SELECT id, name', ' FROM products', ' ORDER BY name ASC';
//it actually translates to one line of output for PHP:
echo 'SELECT id, name FROM products ORDER BY name ASC';
?&gt;</pre>
<p>(<span style="font-weight: bold; color: blue;">performance friendly</span>: PHP has one string to deal with, single memory allocation, no concatenation)</p>
<h2>Choice of Functions</h2>
<p>Always refer to the official PHP manual when confronted with a choice of potential PHP functions for a given situation. Many functions exist that appear to do the same thing, but if used unnecessarily can lead to unnecessary overhead/confusion in your applications.</p>
<p>For example, you will probably get some advice to look at using preg/ereg functions in PHP whenever you ask about string replacements, but if you need to do a simple string replacement (Eg. replace all &#8216;http&#8217; with &#8216;https&#8217;) use the str_replace function. Only use the preg/ereg functions when you need to involve regular expressions &#8230;that is their purpose. And str_replace is for simple string replacements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/06/12/performance-friendly-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Importance of SEO</title>
		<link>http://www.marksiedle.com/2008/06/09/the-importance-of-seo/</link>
		<comments>http://www.marksiedle.com/2008/06/09/the-importance-of-seo/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 10:19:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Mark's Blog]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1087</guid>
		<description><![CDATA[I was asked today about why &#8216;just having a website&#8217; is not enough to be successful online. The question came up after I was talking about a seminar I attended last year with my father. The seminar was an American based company successfully selling website services (of course they didn&#8217;t market it like this, but [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked today about why &#8216;just having a website&#8217; is not enough to be successful online. The question came up after I was talking about a seminar I attended last year with my father. The seminar was an American based company successfully selling website services (of course they didn&#8217;t market it like this, but that&#8217;s all they were essentially doing) selling a website that they&#8217;d create for you, providing you with a specific product driven website that would &#8216;definitely make you wealthy beyond your wildest dreams&#8217;.</p>
<p>Now I say &#8217;successfully&#8217; because more than half the audience was sold on their little scam. And for big money too. We&#8217;re talking upwards of $12,000 for each sale. You might think crazy price, but for a fully product driven website, with the company holding your hand the whole way, that&#8217;s probably about the right price. The only problem is they were hinting at guaranteed success, and failed to mention how competitive the search industry is for <strong>any </strong>common product driven website. Sure, hand over your hard earned cash, get a website developed, but then what? <strong>How is anyone going to find your site over the thousands of other sites all similarly produced?</strong></p>
<p>The truth is search engine marketing is a massively important part of the equation, and I&#8217;d  say you need to allow more than half of your initial project budget and time to search engine activities for the first year, otherwise you can expect to be getting minimal, if any, traffic to your fancy site. I won&#8217;t go into specifics about search engine techniques, because honestly I&#8217;m still learning myself (and it is a continuous learning curve), but I will be documenting my progress as I learn and succeed, so keep tuned. My point is simply to make you aware of scams like this one I witnessed, and to be very wary of anyone selling you a website that fails to mention the importance of &#8216;being found online&#8217;. If they don&#8217;t mention it, YOU bring it up. <strong>It&#8217;s your money and your future success. Be smart, ask the questions, analyse the answers. </strong>If you&#8217;re unsure about the answers you get, take your question and the answers you&#8217;ve got to the top search forums (type &#8217;seo forum&#8217; in google) and see what the experts have to say about your situation. You&#8217;ll find the nice guys more than happy to comment honestly and openly. Don&#8217;t ever be taken for a ride &#8230;and always remember that the people you deal with are often professional salesmen <img src='http://www.marksiedle.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/06/09/the-importance-of-seo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSV Data Generator</title>
		<link>http://www.marksiedle.com/2008/06/04/csv-data-generator/</link>
		<comments>http://www.marksiedle.com/2008/06/04/csv-data-generator/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 23:24:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[2.4. Testing]]></category>

		<category><![CDATA[csv data generator]]></category>

		<category><![CDATA[csv generator]]></category>

		<category><![CDATA[generate csv data]]></category>

		<category><![CDATA[testing]]></category>

		<category><![CDATA[testing in php]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1086</guid>
		<description><![CDATA[I&#8217;m in the process of creating a csv import application for employee data among other things, so I needed good quality test data. Instead of writing a few lines of test data myself, I thought I&#8217;d check if any free applications existed to do the work for me. I&#8217;m into free applications that I don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in the process of creating a csv import application for employee data among other things, so I needed good quality test data. Instead of writing a few lines of test data myself, I thought I&#8217;d check if any free applications existed to do the work for me. I&#8217;m into free applications that I don&#8217;t have to download, so the search was on, and I&#8217;m happy to say I didn&#8217;t have to look very far.</p>
<p>I found this free little tool for generating different types of data online:</p>
<p>(<a title="csv generator" href="http://www.generatedata.com/#generator" target="_blank">http://www.generatedata.com/#generator</a>).</p>
<p>I just plug in a few options and this generator gives me as much realistic data as I need to properly test my csv import application. Saves me more than a few minutes writing test data myself. Useful for load testing as well. Generate a few thousand lines of csv, import it to your database and test away. Of course, you can use MySQL functions to help generate a heap of INSERT statements as well, but this is another way <img src='http://www.marksiedle.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/06/04/csv-data-generator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Importance of Coding Preparation</title>
		<link>http://www.marksiedle.com/2008/06/04/the-importance-of-coding-preparation/</link>
		<comments>http://www.marksiedle.com/2008/06/04/the-importance-of-coding-preparation/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 05:26:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[2.1.1. Planning]]></category>

		<category><![CDATA[coding preparation]]></category>

		<category><![CDATA[php planning]]></category>

		<category><![CDATA[php programming]]></category>

		<category><![CDATA[planning and design]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1085</guid>
		<description><![CDATA[Some call it coding preparation, others will call it planning and design, but we&#8217;re talking about the same thing. The more I code, the more I see professional programmers who just want to code. They don&#8217;t care if the design is complete. After all, they have enough info to get started right? They have the [...]]]></description>
			<content:encoded><![CDATA[<p>Some call it coding preparation, others will call it planning and design, but we&#8217;re talking about the same thing. The more I code, the more I see professional programmers who just want to code. They don&#8217;t care if the design is complete. After all, they have enough info to get started right? They have <strong>the coding bug</strong>. I know because I have the same bug. Coding is our high. Solving small or large problems in code form gives us a buzz. You are God of the moment. Just like any other high, it can entice you into doing something too quickly without thinking it through.</p>
<p>The problems come when you leave the small problems and move into medium-large scale problems with lots of interrelated subsystems all talking to each other. Or, more importantly, when you have a system with base classes and you start the coding of the base classes too quickly. End result - disaster! Coding is just like real world construction: If your foundations are crap, guess what? The final product (if you ever make it to a final product) will be flimsy at best. It (your application) will either fall over or will be subject to criticism for the rest of its short life because of what we call <strong>incomplete coding preparation</strong>.</p>
<p>Still feel like rushing into that programming? <strong>If you do you&#8217;re a knob</strong> (politically correct term for you morons that are giving programmers a bad name by jumping into programming too quickly, then blaming the designers and everyone else when things go to shit)</p>
<p>Being what I consider a <strong>good programmer</strong> means having the ability to <strong>read design documents and being critical of them</strong>. Don&#8217;t take the attitude that if the coding screws up, we can trace it to the design documents, so the designers will be to blame, not me. That&#8217;s the quickest way to failure. Instead, stand up, approach the designers and tell them of the errors or any questions you have. Feel unsure about a section of the design? Ask them! Think of it like this: <strong>If you, a professional programmer, cannot understand the design document, then the design is flawed</strong>.</p>
<p>A key concept you need to understand early in your programming life is that <strong>the overall goal of planning and design is to reduce risk</strong>. Asking questions of the design, if you (the programmer) don&#8217;t understand something, is all helping to minimise the risk and ensure the project&#8217;s success. Your project&#8217;s preparation needs to focus heavily on improving the planning and design so that the clear direction follows through to the programming stage. Ensuring good communication between design and programming is imperative to your project&#8217;s success and the wellbeing of everyone involved.</p>
<p>I know, I know, some programmers are out there reading this and saying to themselves &#8220;<em>but my boss wants things done quickly and we don&#8217;t have the time.</em>&#8221; Bad attitude and wrong decision.</p>
<p>Firstly, good design might be hard to master at first, but once your designers get in the groove of turning out quality well thought out designs, everything runs smoothly. The programmers can&#8217;t stuff anything up if the design is bulletproof, and if they do, they need a boot up the arse so they begin to follow the good direction of the design to a tee. What follows is a well oiled application making group of individuals that respect each others work and produce good results, which in turn gives the company a better reputation for quality work. <strong>The point is, good design may take time, but it takes less time than bad design stuffing up the programming stage, which will end up taking a LOT more time to fix and re-test.</strong> So if your boss doesn&#8217;t understand that, request a meeting and let them know, and if nothing changes, find a new boss because you deserve better <img src='http://www.marksiedle.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/06/04/the-importance-of-coding-preparation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Very Impressed With New Wordpress 2.5</title>
		<link>http://www.marksiedle.com/2008/05/25/very-impressed-with-new-wordpress-25/</link>
		<comments>http://www.marksiedle.com/2008/05/25/very-impressed-with-new-wordpress-25/#comments</comments>
		<pubDate>Sun, 25 May 2008 03:55:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Mark's Blog]]></category>

		<category><![CDATA[latest wordpress]]></category>

		<category><![CDATA[web software]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1080</guid>
		<description><![CDATA[The title says it all &#8230;Vanessa told me that our boss Darryl really likes the new wordpress, so seeing I didn&#8217;t even know there WAS a new wordpress I thought I&#8217;d check it out. The old 2.0 version just didn&#8217;t have what I was looking for 6 months or more ago, so I made my [...]]]></description>
			<content:encoded><![CDATA[<p>The title says it all &#8230;Vanessa told me that our boss Darryl really likes the new wordpress, so seeing I didn&#8217;t even know there WAS a new wordpress I thought I&#8217;d check it out. The old 2.0 version just didn&#8217;t have what I was looking for 6 months or more ago, so I made my own CMS site (which I&#8217;ll be documenting as a &#8216;how to&#8217; on this site over time), but now it&#8217;s safe to say this new version of wordpress ROCKS!</p>
<p>The admin design has had some serious modifications to vastly improve usability. No more menu clutter. Smart use of ajax technology where necessary. But I just can&#8217;t get over how clean and professional the whole package looks. Things are just intuitive. And the really cool part is I can use Windows Live Writer to write blog posts from my desktop without even needing to be logged into the website (not a huge bonus but still pretty cool)</p>
<p>I&#8217;d seriously recommend checking out wordpress&#8217;s latest and greatest stable offering. The interface is really second to none. Thanking you wordpress!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/05/25/very-impressed-with-new-wordpress-25/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Singleton Pattern</title>
		<link>http://www.marksiedle.com/2008/05/17/singleton-pattern/</link>
		<comments>http://www.marksiedle.com/2008/05/17/singleton-pattern/#comments</comments>
		<pubDate>Sat, 17 May 2008 12:22:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[2.3.1. Creational Patterns]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1079</guid>
		<description><![CDATA[This is important, listen up! The singleton design pattern is used to ensure a class has only one instance, and that global access to that instance is available. In other words, it restricts instantiation of a class to one object.]]></description>
			<content:encoded><![CDATA[<p>The singleton design pattern is used to ensure a class has only one instance, and that global access to that instance is available. In other words, it restricts instantiation of a class to one object.</p>
<p>When I first read this concept I just didn&#8217;t get it (I&#8217;m a bit slow). But it&#8217;s really pretty simple. You just have to know your terms. A class defines the structure of an object, and to use that class, we instantiate an object of the class. So take the following php:</p>
<pre name="code" class="php">&lt;?php
//create an instance of the Product class
$product_object = new Product();
//print the product's name
echo $product_object-&gt;product_name;

//create another instance of the Product class
$product_object2 = new Product();
//do other stuff
//...
?&gt;</pre>
<p>In this example, &#8216;Product&#8217; is the class and &#8216;$product_object&#8217; and &#8216;$product_object2&#8242; are instances of the Product class.</p>
<p>We use the singleton pattern by creating a class with a function that creates a new instance of the class only if one does not exist. If an instance does already exist, it simply returns a reference to that object. This ensures you only have one instance at any one time, hence singleton.</p>
<p>So in the above php for example, if our Product class used the singleton pattern, &#8216;$product_object&#8217; and &#8216;$product_object2&#8242; would in fact be referring to the same instance of the Product class.</p>
<h2>Why is this useful?</h2>
<p>Well firstly I imagine this would use less system resources. If it&#8217;s only ever referencing one instance, memory usage would be kept to a minimum, so one could argue a performance advantage.</p>
<p>Secondly I could see this pattern useful in complicated systems where you need a be referencing a single object at any given time, perhaps a User object, to coordinate actions in different parts of the system, or sub systems. A user object is often referenced in many different parts of the system, so always referencing the one instance would be beneficial.</p>
<h2>Real world example</h2>
<p>Here is some example code from the PHP manual on how to create a class that uses the singleton pattern:</p>
<pre name="code" class="php">&lt;?php
class Singleton{
	// $instance holds a single instance of the object
	private static $instance;
	// private constructor
	private function __construct(){}
	// the getInstance() method returns a single instance of the object
	public static function getInstance(){
		if(!isset(self::$instance)){
			$object= __CLASS__;
			self::$instance=new $object;
		}
		return self::$instance;
	}
	public function displayMessage(){
		echo 'I am a Singleton';
	}
}
$singleton=Singleton::getInstance();//return a single instance of the object
$singleton-&gt;displayMessage();// display message
?&gt;</pre>
<p>And here is another useful example I found that you can use that is more animated &#8230;run this and you&#8217;ll see the singleton output inform you that only one instance exists at a time <img src='http://www.marksiedle.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<pre name="code" class="php">&lt;?php
echo '1:';
$user_1 = CurrentUser::singleton();

echo '2:';
$user_1-&gt;counter();

echo '3:';
$user_2 = CurrentUser::singleton();

/* Singleton Class: CurrentUser */
class CurrentUser {
    // Hold an instance of the class
    private static $instance;
    private $counter = 0;

    // A private constructor; prevents direct creation of object
    private function __construct() {
        echo 'Constructing CurrentUser';
    }

    // The singleton method
    public static function singleton() {
        if (!isset(self::$instance)) {
            $c = __CLASS__;
            self::$instance = new $c;
        } else {
            echo 'CurrentUser already exists';
        }
        return self::$instance;
    }

    public function counter() {
        echo 'CurrentUser -&gt; counter = ' . $this-&gt;counter;
        ++$this-&gt;counter;
    }
}
?&gt;</pre>
<p>(<a href="http://www.imarc.net/communique/view/118/implementing_a_php_singleton" target="_blank">original source</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/05/17/singleton-pattern/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Design Patterns Defined</title>
		<link>http://www.marksiedle.com/2008/05/17/design-patterns-defined/</link>
		<comments>http://www.marksiedle.com/2008/05/17/design-patterns-defined/#comments</comments>
		<pubDate>Sat, 17 May 2008 06:13:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[2.3. Design Patterns]]></category>

		<guid isPermaLink="false">http://www.marksiedle.com/?p=1078</guid>
		<description><![CDATA[What are design patterns and why do I want to know about them?]]></description>
			<content:encoded><![CDATA[<p>A design pattern is a software engineering terms and is used to describe a reusable solution to solve common problems in software design. A design pattern doesn&#8217;t provide you with code per se, but is more a method of development, or template, to solve your problem.</p>
<p>Design patterns speed up the development of a project by providing a proven and tested way of doing things. Reusing design patterns in your project helps to prevent any unforeseen problems, and provides a common ground for developers working on your project who are familiar with the patterns. This can help to improve your code readability and consistency of methods, which all help to provide a good software product.</p>
<p>Imagine you introduce a new developer to your project. If your current developers can say that the X part of the system uses the Decorator pattern, both developers have just saved a lot of time in teaching/learning curve, because the developers know what that means. It&#8217;s their &#8216;geek speak&#8217; and allows them to explain a somewhat complicated concept very quickly. </p>
<p>My point is, if you want a future in the software industry, you need to be fluent in this geek speak so that you too understand these terms for quick introductions to new or old projects. What follows is examples of the common design patterns in software engineering with easy to understand examples for each pattern to help you learn and understand the concepts quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marksiedle.com/2008/05/17/design-patterns-defined/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
