<?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>DefaultYes &#124; The online ramblings of one man</title>
	<atom:link href="http://defaultyes.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://defaultyes.com</link>
	<description>A place for my, hopefully useful, ramblings :)</description>
	<lastBuildDate>Sat, 02 Jan 2010 13:52:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>FM2009 Coach Calculator Back!</title>
		<link>http://defaultyes.com/?p=190</link>
		<comments>http://defaultyes.com/?p=190#comments</comments>
		<pubDate>Fri, 01 Jan 2010 20:55:58 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Football Manager]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=190</guid>
		<description><![CDATA[That&#8217;s right, the Coach Calculator is back. Happy New Year! Apologies for the wait, technical problems and a lack of time meant I couldn&#8217;t get it sorted until now.
It&#8217;s only for FM2009 although may well work with FM2010 (if it&#8217;s the same formula). Please let me know if you know the FM2010 coach formula and [...]]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s right, the Coach Calculator is back. Happy New Year! Apologies for the wait, technical problems and a lack of time meant I couldn&#8217;t get it sorted until now.</p>
<p>It&#8217;s only for FM2009 although may well work with FM2010 (if it&#8217;s the same formula). Please let me know if you know the FM2010 coach formula and I&#8217;ll make an FM2010 version aswell.</p>
<p>The link is the same as before, please check it out <a href="http://defaultyes.com/other/fm2009/coachcalc/">here</a>.</p>
<p><a href="http://defaultyes.com/other/fm2009/coachcalc/">FM2009 Coach Calculator.</a></p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=190</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FM2009 Coach Calculator Released</title>
		<link>http://defaultyes.com/?p=174</link>
		<comments>http://defaultyes.com/?p=174#comments</comments>
		<pubDate>Thu, 10 Sep 2009 16:46:32 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Football Manager]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=174</guid>
		<description><![CDATA[Well, to get my JavaScript skills going down and to give the Football Manager community a handy tool I&#8217;ve created an FM2009 Coach Calculator.
Please let me know your thoughts, I may add more functionality too it in the future but the core functionality is there. Please note this is only a beta, so please report [...]]]></description>
			<content:encoded><![CDATA[<p>Well, to get my JavaScript skills going down and to give the Football Manager community a handy tool I&#8217;ve created an <a href="http://defaultyes.com/other/fm2009/coachcalc/">FM2009 Coach Calculator</a>.</p>
<p>Please let me know your thoughts, I may add more functionality too it in the future but the core functionality is there. Please note this is only a beta, so please report and bugs, inconveniences or improvements you note in the comments here.</p>
<p>Cheers.</p>
<p class="margin">Enjoy:</p>
<p><a href="../other/fm2009/coachcalc/">FM2009 Coach Calculator</a>.</p>
<p>p.s. If I find time next year I will be updating this for FM2010, and that will most likely be found at the same address, but in &#8216;fm2010&#8242; rather than &#8216;fm2009&#8242;.</p>
<p class="margin">Edit [16/09/09]:</p>
<p> Now includes hover functionality that indicates the formula involved for each skill set.</p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=174</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The Next Year</title>
		<link>http://defaultyes.com/?p=166</link>
		<comments>http://defaultyes.com/?p=166#comments</comments>
		<pubDate>Mon, 07 Sep 2009 14:39:32 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=166</guid>
		<description><![CDATA[In the next year I&#8217;m heading off to Bible College so the blog won&#8217;t be getting much updating. However, it shall continue, or at least stay alive for the year ahead.
Have a nice year, probably catch up soon.
Fred.]]></description>
			<content:encoded><![CDATA[<p>In the next year I&#8217;m heading off to Bible College so the blog won&#8217;t be getting much updating. However, it shall continue, or at least stay alive for the year ahead.</p>
<p>Have a nice year, probably catch up soon.</p>
<p>Fred.</p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=166</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Desktopography 2009 Released!</title>
		<link>http://defaultyes.com/?p=158</link>
		<comments>http://defaultyes.com/?p=158#comments</comments>
		<pubDate>Fri, 31 Jul 2009 09:16:42 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Desktopography]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=158</guid>
		<description><![CDATA[The new set of wallpapers from the desktopography lads are here! Just head over to the site to see all that graphic goodness.
My favourites include:


Wonderful stuff I&#8217;m sure you&#8217;ll agree.]]></description>
			<content:encoded><![CDATA[<p>The new set of wallpapers from the desktopography lads are here! Just head over to the site to see all that <a href="http://desk08.customize.org/exhibition/5" target="_blank">graphic goodness</a>.</p>
<p>My favourites include:</p>
<p><img src="http://defaultyes.com/images/other/desktopography_violin.jpg" alt="Violin Desktopography" /></p>
<p><img src="http://defaultyes.com/images/other/desktopography_mountain.jpg" alt="Mountain Desktopography" /></p>
<p>Wonderful stuff I&#8217;m sure you&#8217;ll agree.</p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=158</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Wave Presented</title>
		<link>http://defaultyes.com/?p=146</link>
		<comments>http://defaultyes.com/?p=146#comments</comments>
		<pubDate>Mon, 27 Jul 2009 13:08:55 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=146</guid>
		<description><![CDATA[Wow, that was good. If you haven&#8217;t seen it yet, I advise checking out the YouTube video.
Here&#8217;s a brief run-down of what I managed to catch from the 80 minute video:

Email reinvented &#8211; Instant messaging and email combine
Live updates when people post replies to your messages
Live character by character updates when you&#8217;re both online
Private messaging
Playback [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, that was good. If you haven&#8217;t seen it yet, I advise checking out the <a href="http://www.youtube.com/watch?v=v_UyVmITiYQ&amp;eurl=http://wave.google.com/&amp;feature=player_embedded" target="_self">YouTube video</a>.</p>
<p>Here&#8217;s a brief run-down of what I managed to catch from the 80 minute video:</p>
<ul>
<li>Email reinvented &#8211; Instant messaging and email combine</li>
<li>Live updates when people post replies to your messages</li>
<li>Live character by character updates when you&#8217;re both online</li>
<li>Private messaging</li>
<li>Playback &#8211; Skip through a conversation stage by stage.</li>
<li>Simultaneous editting</li>
<li>Collaboration &#8211; Edit each others posts</li>
<li>Extract elements of a Wave to a fresh Wave (all images or all text etc.)</li>
<li>Use tags to organise your Wave catalogue</li>
<li>Live spell checker</li>
<li>Blog Interaction &#8211; Embed Wave into your blog for live interaction</li>
<li>Inline Google Search</li>
<li>Embed Video / Maps</li>
<li>Use Twave to Tweet through Wave</li>
<li>Create your own add-ons</li>
<li>Live Language Translation &#8211; Rosey</li>
<li>Bugee &#8211; A debug log</li>
<li>Polls native to Google Wave &#8211; Polly the Pollster</li>
<li>Play games in Wave</li>
<li>It&#8217;s all opensource. You can make your own version of Wave and compete against Google.</li>
</ul>
<p>Check it out, we could all be using this in a few years time.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="295" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/v_UyVmITiYQ&amp;hl=en&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="295" src="http://www.youtube.com/v/v_UyVmITiYQ&amp;hl=en&amp;fs=1&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=146</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Follow Your Dream</title>
		<link>http://defaultyes.com/?p=142</link>
		<comments>http://defaultyes.com/?p=142#comments</comments>
		<pubDate>Tue, 21 Jul 2009 10:12:56 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=142</guid>
		<description><![CDATA[Ever muttered to yourself &#8216;If only I was born X years ago&#8217;? I did just yesterday.
On reflection I didn&#8217;t mean it at all, but it brings me to a good point. Anyone can see the venture they could have done, the one that has already materialised through someone elses actions, but we have as many [...]]]></description>
			<content:encoded><![CDATA[<p>Ever muttered to yourself &#8216;If only I was born X years ago&#8217;? I did just yesterday.</p>
<p>On reflection I didn&#8217;t mean it at all, but it brings me to a good point. Anyone can see the venture they could have done, the one that has already materialised through someone elses actions, but we have as many opportunities if not more than each of the previous generations, right now.</p>
<p>Yeah, it&#8217;s not easy to get into that mindset and do something that hasn&#8217;t been done before, or do it better, but that&#8217;s the fantastic challenge we face. Every new day presents us with millions of possibilities, we just need to realise them.</p>
<p>Just remember. Anything you think of, 99.999% of the time will have gone through someone elses mind. Don&#8217;t let this put you off however. It may have already been done, you can do it better. Be optimistically realistic. Follow your dream.</p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=142</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Expanding Input Box</title>
		<link>http://defaultyes.com/?p=86</link>
		<comments>http://defaultyes.com/?p=86#comments</comments>
		<pubDate>Thu, 16 Jul 2009 17:18:33 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=86</guid>
		<description><![CDATA[
The figures may be a little bit off depending on your browser
Working example:

As you may know I&#8217;ve been working on a Prime Number Calculator to get to grips with JavaScript. As you can imagine it has been full of highs and lows, dead ends and overcoming them.
Through making this I&#8217;ve learnt a few bits and [...]]]></description>
			<content:encoded><![CDATA[<p><script src="//defaultyes.com/files/input-width.js" type="text/javascript"></script></p>
<p class="margin">The figures may be a little bit off depending on your browser</p>
<p>Working example:</p>
<input id="number-input2" style="width: 60px; height: 20px;" onkeypress="inputWidth('number-input2')" name="number-input2" type="text" />
<p>As you may know I&#8217;ve been working on a <a href="http://defaultyes.com/other/primeCheck/" target="_blank">Prime Number Calculator</a> to get to grips with <a href="http://javascript.about.com/od/learnjavascript/a/tut00.htm" target="_blank">JavaScript</a>. As you can imagine it has been full of highs and lows, dead ends and overcoming them.</p>
<p>Through making this I&#8217;ve learnt a few bits and bobs, and here&#8217;s another. Ever wondered..</p>
<p>How can I make an input box <strong>expand</strong> when someone types in it?</p>
<p>Well here I&#8217;ll show you just how.</p>
<p>First, set up an external .<abbr title="JavaScript">js</abbr> file, <a href="http://www.w3schools.com/js/js_whereto.asp" target="_blank">like so</a>.</p>
<p>Now, lets get down to the <abbr title="JavaScript"><acronym title="JavaScript">JS</acronym></abbr>. Set up the function as per normal. However, we may want to use this function more than once so for versatilities sake we will parse a <a href="http://codepunk.hardwar.org.uk/bjs03.htm" target="_blank">parameter</a> in.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> inputWidth<span class="br0">&#40;</span>id<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Now, let&#8217;s get into the real code.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> inputWidth<span class="br0">&#40;</span>id<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="kw2">var</span> d = document.<span class="me1">getElementById</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="kw2">var</span> e = d.<span class="me1">value</span>.<span class="me1">length</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>This is the preparation first half of the code. First, we set the variable &#8216;d&#8217; to hold the string document.getElementById(id). Notice the (id) in brackets? That&#8217;s one of the places our parameter will fill when we <abbr title="See 'Programming Languages'"><a href="http://en.wikipedia.org/wiki/Parse" target="_blank">parse</a></abbr> it in.</p>
<p>Then we set the variable &#8216;e&#8217; to hold the length of the element we parsed in. What this means is that the variable &#8216;e&#8217; will be set to 4, if there&#8217;s 4 characters in the input box. 5 if 5, and so on.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>e &lt; <span class="nu0">4</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> d.<span class="me1">style</span>.<span class="me1">width</span>=<span class="st0">&quot;60px&quot;</span>; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>This is saying if the characters are less than 4, then set it to 60px. This should be the same size as your default width, before any characters are typed.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span>e &gt;= <span class="nu0">4</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp;d.<span class="me1">style</span>.<span class="me1">width</span>=<span class="br0">&#40;</span><span class="nu0">1.5</span> + <span class="br0">&#40;</span><span class="nu0">0.45</span> * e<span class="br0">&#41;</span><span class="br0">&#41;</span> + <span class="st0">&quot;em&quot;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>However, if the characters become 4 or larger then set it to a figure that will vary depending on how many characters are entered. If you&#8217;re not familiar with <a href="http://en.wikipedia.org/wiki/Em_(typography)" target="_blank">em&#8217;s</a> then either click the link to read more or use the slightly less flexible pixels.</p>
<p>Feel free to edit the values, these worked for me but I&#8217;m sure with a tweak you&#8217;ll get exactly what you&#8217;re looking for.</p>
<p>Now, just call the function with onkeypress or onkeydown and it should have the desired effect.</p>
<p class="margin">Be careful when copying and pasting</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;input id=<span class="st0">&quot;VAT&quot;</span> onkeypress=<span class="st0">&quot;inputWidth(&#8217;VAT&#8217;)&quot;</span> <span class="kw3">name</span>=<span class="st0">&quot;VAT&quot;</span> type=<span class="st0">&quot;text&quot;</span> /&gt;</div>
</li>
</ol>
</div>
<p>And there you have it! Here&#8217;s the final code <abbr title="Cascading Style Sheets"><acronym title="Cascading Style Sheets">CSS</acronym></abbr> code:</p>
<p class="margin">Tested in Firefox3, Chrome2 &#038; Safari3</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> inputWidth<span class="br0">&#40;</span>id<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="kw2">var</span> d = document.<span class="me1">getElementById</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="kw2">var</span> e = d.<span class="me1">value</span>.<span class="me1">length</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>e &lt; <span class="nu0">4</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> d.<span class="me1">style</span>.<span class="me1">width</span>=<span class="st0">&quot;60px&quot;</span>; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span>e &gt;= <span class="nu0">4</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp;d.<span class="me1">style</span>.<span class="me1">width</span>=<span class="br0">&#40;</span><span class="nu0">1.5</span> + <span class="br0">&#40;</span><span class="nu0">0.45</span> * e<span class="br0">&#41;</span><span class="br0">&#41;</span> + <span class="st0">&quot;em&quot;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
</ol>
</div>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=86</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t Mistreat Tables</title>
		<link>http://defaultyes.com/?p=80</link>
		<comments>http://defaultyes.com/?p=80#comments</comments>
		<pubDate>Thu, 16 Jul 2009 10:18:21 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Layout]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=80</guid>
		<description><![CDATA[You wouldn&#8217;t mistreat a child would you?
I hope not
Tables for tabular data, we all know that, but here&#8217;s 2 interesting viewpoints on the matter that will hopefully clear the murk and help you understand things a little better.
Seybold: Why Tables for Layout is Stupid
And a quote from the DesignForums Harry Roberts:
&#8220;You can hold a car [...]]]></description>
			<content:encoded><![CDATA[<p>You wouldn&#8217;t mistreat a child would you?</p>
<p class="margin">I hope not</p>
<p>Tables for <a href="http://webdesign.about.com/od/tables/a/aa122605.htm" target="_blank">tabular data</a>, we all know that, but here&#8217;s 2 interesting viewpoints on the matter that will hopefully clear the murk and help you understand things a little better.</p>
<p><a href="http://www.hotdesign.com/seybold/" target="_blank">Seybold: Why Tables for Layout is Stupid</a></p>
<p>And a quote from the <a href="http://www.designforums.co.uk/" target="_blank">DesignForums</a> <a href="http://csswizardry.com/iamharryroberts.com/" target="_blank">Harry Roberts</a>:</p>
<blockquote><p>&#8220;You can hold a car up with bricks just as well as you could a jack, but bricks aren&#8217;t specifically built for that purpose. Sure the bricks will hold the car up, but it&#8217;s gonna be a lot harder to do, and in future the jack will be the easiest to manipulate and alter. And if you&#8217;re using bricks to hold up a car, what are you building your house with?&#8221;</p></blockquote>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=80</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Prime Number Calculator is Complete!</title>
		<link>http://defaultyes.com/?p=71</link>
		<comments>http://defaultyes.com/?p=71#comments</comments>
		<pubDate>Wed, 08 Jul 2009 18:47:49 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[PNC]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=71</guid>
		<description><![CDATA[That&#8217;s right, I&#8217;ve finally managed it. It&#8217;s taken me a good week of learning JavaScript but my first foray into JS is complete.
Check it out by clicking here.
The PNC list input has at the time of writing been tested for the first 10,000 primes, so it&#8217;s pretty accurate. If you find any problems though, please [...]]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s right, I&#8217;ve finally managed it. It&#8217;s taken me a good week of learning JavaScript but my first foray into <acronym title="JavaScript">JS</acronym> is complete.</p>
<p><a href="http://defaultyes.com/other/primeCheck/" target="_blank">Check it out by clicking here</a>.</p>
<p>The <abbr title="Prime Number Calculator">PNC</abbr> list input has at the time of writing been tested for the first 10,000 primes, so it&#8217;s pretty accurate. If you find any problems though, please do drop me a comment.</p>
<p>I&#8217;ll be blogging about the workings behind the <abbr title="Prime Number Calculator">PNC</abbr> soon so look out for that.</p>
<p class="margin">:)</p>
<p>Any comments are more than welcome.</p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=71</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JavaScript: How To Edit the End of a String</title>
		<link>http://defaultyes.com/?p=38</link>
		<comments>http://defaultyes.com/?p=38#comments</comments>
		<pubDate>Tue, 07 Jul 2009 11:23:58 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Edit String]]></category>

		<guid isPermaLink="false">http://defaultyes.com/?p=38</guid>
		<description><![CDATA[Ever wondered how to remove that comma from the end of a list? I have, and after googling it I found my answer.
Don&#8217;t worry about the confusing list of characters, all will be explained.
Here&#8217;s the finished code:
Be careful when copying and pasting



var stringName = &#34;a,b,c,d,&#34;;






stringName = stringName.replace&#40;/\,$/,&#8216;.&#8217;&#41;;






alert&#40;stringName&#41;;



But you don&#8217;t understand that right? I didn&#8217;t. Let [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wondered how to remove that comma from the end of a list? I have, and after googling it I found my answer.</p>
<p>Don&#8217;t worry about the confusing list of characters, all will be explained.</p>
<p>Here&#8217;s the finished code:</p>
<p class="margin">Be careful when copying and pasting</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> stringName = <span class="st0">&quot;a,b,c,d,&quot;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">stringName = stringName.<span class="me1">replace</span><span class="br0">&#40;</span><span class="re0">/\,$/</span>,<span class="st0">&#8216;.&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">alert</span><span class="br0">&#40;</span>stringName<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>But you don&#8217;t understand that right? I didn&#8217;t. Let me explain:</p>
<p class="margin">Here&#8217;s an example</p>
<p>We start with a variable that contains a <a href="http://www.w3schools.com/jS/js_obj_string.asp" target="_blank">string</a>, in this example &#8220;dave&#8221;.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> stringName = <span class="st0">&quot;My name is Dave&quot;</span>;</div>
</li>
</ol>
</div>
<p>Then add the .replace code:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">stringName = stringName.<span class="me1">replace</span><span class="br0">&#40;</span><span class="re0">/Dave/</span>, <span class="st0">&quot;John&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>The basic structure is:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">str.<span class="me1">replace</span><span class="br0">&#40;</span><span class="re0">/replaceThis/</span>, <span class="st0">&quot;withThis&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Now if we add an alert box to pop up and show us our new string we can see it in action:</p>
<p class="margin">Remember, we don&#8217;t need quotation marks for variables</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> stringName = <span class="st0">&quot;My name is Dave&quot;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">stringName = stringName.<span class="me1">replace</span><span class="br0">&#40;</span><span class="re0">/Dave/</span>, <span class="st0">&quot;John&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">alert</span><span class="br0">&#40;</span>stringName<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Which gives us:</p>
<p>&#8220;My name is John&#8221;</p>
<p>Going back to our finished code, here&#8217;s what the code jargon means.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">stringName = stringName.<span class="me1">replace</span><span class="br0">&#40;</span><span class="re0">/\,$/</span>,<span class="st0">&#8216;.&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>The blackslash (\) &#8216;escapes&#8217; the following character. That just means it treats the next character as just that, rather than as part of the <acronym title="JavaScript">JS</acronym> code.</p>
<p>The comma (,) is what we want to replace, and the dollar sign ($) tells <acronym title="JavaScript">JS</acronym> to only catch the comma if it&#8217;s at the end of the string. Hopefully the rest is self-explanatory, although if not read through the article again and feel free to drop me a comment.</p>
<p>Note: If you want to remove every occurence of a string then use the code:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">str.<span class="me1">replace</span><span class="br0">&#40;</span><span class="re0">/replaceThis/g</span>, <span class="st0">&quot;withThis&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>The &#8216;g&#8217; after the closing forward slash is the key to that.</p>
<p>Note: With thanks to <a href="http://blog.techsaints.com/2007/06/15/javascript-how-to-remove-comma-from-the-end-of-a-list/" target="_blank">Joey</a> for the basics behind this post and <a href="http://www.myhow2guru.com/archives/javascript-string-replace-all/" target="_blank">how2guru</a> for the every occurence fix.</p>]]></content:encoded>
			<wfw:commentRss>http://defaultyes.com/?feed=rss2&amp;p=38</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
