<?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>The Blackbox &#187; Programming</title>
	<atom:link href="http://www.the-blackbox.co.uk/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.the-blackbox.co.uk</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 31 Aug 2010 20:27:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Aptana and RadRails</title>
		<link>http://www.the-blackbox.co.uk/programming/aptana-and-radrails/</link>
		<comments>http://www.the-blackbox.co.uk/programming/aptana-and-radrails/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 11:05:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Aptana]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=58</guid>
		<description><![CDATA[I&#8217;ve recently started playing with Aptana and RadRails under Windows, where I encountered a problem where Aptana wasn&#8217;t able to install gems, and it popped up the installation window each time I started Aptana. It is logged as a known issue but I wanted it working, so I persevered. The upshot of it is, I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently started playing with Aptana and RadRails under Windows, where I encountered a problem where Aptana wasn&#8217;t able to install gems, and it popped up the installation window each time I started Aptana.  It is l<a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fsupport.aptana.com%2Fasap%2Fbrowse%2FROR-155&sref=rss">ogged as a known issue</a> but I wanted it working, so I persevered.</p>
<p>The upshot of it is, I looked at the Rails console within Aptana at what commands were being run.  Most of the where, for example:</p>
<blockquote><p>gem install rails -l</p></blockquote>
<p>All I did, is take each of the commands run automatically from the console and removed the <strong>-l</strong> option:</p>
<blockquote><p>gem install rails</p></blockquote>
<p>Everything installed perfectly in no time at all, and it&#8217;s all now up and running!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/aptana-and-radrails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Basic Thickbox (lightbox, blackbox)</title>
		<link>http://www.the-blackbox.co.uk/programming/jquery-basic-thickbox-lightbox-blackbox/</link>
		<comments>http://www.the-blackbox.co.uk/programming/jquery-basic-thickbox-lightbox-blackbox/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 17:01:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=45</guid>
		<description><![CDATA[This is a very quick run through on how to get a basic jquery thickbox (blackbox) popup working, containing an image, and is based on the official demo page. The actual thickbox demo page has more advanced options available and full documentation &#8211; this is intended for those who don&#8217;t wish to know the full [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very quick run through on how to get a basic jquery thickbox (blackbox) popup working, containing an image, and is based on the <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2F&sref=rss">official demo page</a>.  The <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2F&sref=rss">actual thickbox demo page</a> has more advanced options available and full documentation &#8211; this is intended for those who don&#8217;t wish to know the full ins and outs of the functionality, but just want it working! <img src='http://www.the-blackbox.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So let&#8217;s get started&#8230;.</p>
<p>The first thing to do is <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fdocs.jquery.com%2FDownloading_jQuery%23Current_Release&sref=rss">download the latest version of jquery</a>.</p>
<p>Next grab:</p>
<ul>
<li><a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fthickbox-code%2Fthickbox.js&sref=rss">thickbox.js</a> (<a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fthickbox-code%2Fthickbox-compressed.js&sref=rss">thickbox-compressed.js</a>)</li>
<li><a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fthickbox-code%2Fthickbox.css&sref=rss">thickbox.css</a></li>
<li><a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fjquery.com%2Fdemo%2Fthickbox%2Fimages%2FloadingAnimation.gif&sref=rss">loadingAnimation.gif</a></li>
</ul>
<p>First, make sure the page you are trying to use the Thickbox on, has a valid <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fwww.alistapart.com%2Farticles%2Fdoctype%2F&sref=rss">DTD</a> &#8211; it will not function correctly if you don&#8217;t.  I as a rule, use the Strict DTD.</p>
<p>Next we include the javascript files we have downloaded, and the css file &#8211; taking note to replace the path and filenames if you downloaded the compressed versions:</p>
<blockquote><p>
&lt;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;true&#8221; checked=&#8221;checked&#8221;/&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;<strong>javascript/jquery.1.6.4.pack.js</strong>&#8220;&gt;&lt;/script&gt;<br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;<strong>javascript/thickbox-compressed.js</strong>&#8220;&gt;&lt;/script&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;<strong>css/thickbox.css</strong>&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; /&gt;
</p></blockquote>
<p>Now that we have those included, we need to quickly edit <strong>thickbox.css</strong>, and tell it where to find the <strong>loadingAnimation.gif</strong> that we downloaded earlier.  By default it looks for <strong>images/loadingAnimation.gif</strong>, so if this is where you&#8217;ve put it, you can ignore this step.</p>
<p>We should now be good to go, to try your thickbox out &#8211; there are a few ways to do this,the most common being from a text or image link, opening up the thickbox to contain an image, so we&#8217;ll use that as our example.</p>
<p>Text link:</p>
<blockquote><p>
&lt;a href=&#8221;path-to-your/image.jpg&#8221; class=&#8221;thickbox&#8221;&gt;Show Image&lt;/a&gt;
</p></blockquote>
<p>Image link:</p>
<blockquote><p>
&lt;a href=&#8221;path-to-your/image.jpg&#8221; class=&#8221;thickbox&#8221;&gt;&lt;img src=&#8221;path-to-your/link-image.jpg&#8221; /&gt;&lt;/a&gt;
</p></blockquote>
<p>The <strong>class=&#8221;thickbox&#8221;</strong> is the important bit, so make sure you&#8217;ve got that in there!</p>
<p>This should give you a working, (very) basic example of the thickbox.  Once you&#8217;re happy with that, look at the rest of the examples, and you will find you can use it for various things, not just for showing pictures!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/jquery-basic-thickbox-lightbox-blackbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Re-setting CSS Styles</title>
		<link>http://www.the-blackbox.co.uk/programming/re-setting-css-styles/</link>
		<comments>http://www.the-blackbox.co.uk/programming/re-setting-css-styles/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 11:33:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[developers]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=34</guid>
		<description><![CDATA[Having had some proper developers come in and work on our code, it&#8217;s backed up my cosntant moaning that our code base is in a pretty bad state. Lots of duplication of code all over the place, and lots of pages across multiple sites, which could be common. The other thing, which one of my [...]]]></description>
			<content:encoded><![CDATA[<p>Having had some proper developers come in and work on our code, it&#8217;s backed up my cosntant moaning that our code base is in a pretty bad state.  Lots of duplication of code all over the place, and lots of pages across multiple sites, which could be common.</p>
<p>The other thing, which one of my developers claims to be very good at and knows almost all there is to know about it, is CSS.</p>
<p>The contractors however, have pointed out many many problems with our css, and have recommended resetting the styles on the sites, before doing anything.  I don&#8217;t claim to be good at CSS, I know the basics but apart from that, I get my hands dirty with the backend code &#8211; so <a href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fmeyerweb.com%2Feric%2Fthoughts%2F2007%2F05%2F01%2Freset-reloaded%2F&sref=rss">this link</a> proved very useful and insightful when it was given to me.  Explains style resets very well, and I now know what we need to do&#8230;. the question is will it ever happen?!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/re-setting-css-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript bra size calculator</title>
		<link>http://www.the-blackbox.co.uk/programming/javascript-bra-size-calculator/</link>
		<comments>http://www.the-blackbox.co.uk/programming/javascript-bra-size-calculator/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 12:54:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[bras]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=25</guid>
		<description><![CDATA[Not sure that I would ever need this, however I would most certainly have liked to have been involved in creating it JavaScript bra size calculator]]></description>
			<content:encoded><![CDATA[<p>Not sure that I would ever need this, however I would most certainly have liked to have been involved in creating it <img src='http://www.the-blackbox.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a title="JavaScript bra size calculator" href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fedspencer.net%2F2008%2F11%2Fjavascript-bra-size-calculator.html&sref=rss" target="_blank">JavaScript bra size calculator </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/javascript-bra-size-calculator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Show and Hide Input Box &amp; Highlighting</title>
		<link>http://www.the-blackbox.co.uk/programming/jquery-show-and-hide-input-box-highlighting/</link>
		<comments>http://www.the-blackbox.co.uk/programming/jquery-show-and-hide-input-box-highlighting/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 12:50:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=22</guid>
		<description><![CDATA[As part of a recent project, I had to make a payment page clear, user friendly and intuative.  One of the key things was to only display fields when certain options were selected &#8211; in this case, when a radio button had a certain value. &#60;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;true&#8221; checked=&#8221;checked&#8221;/&#62; the full amount ($amountDue). &#60;input [...]]]></description>
			<content:encoded><![CDATA[<p>As part of a recent project, I had to make a payment page clear, user friendly and intuative.  One of the key things was to only display fields when certain options were selected &#8211; in this case, when a radio button had a certain value.</p>
<blockquote><p>&lt;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;true&#8221; checked=&#8221;checked&#8221;/&gt; the full amount ($amountDue).<br />
&lt;input type=&#8221;radio&#8221; name=&#8221;payRemainingBalance&#8221; value=&#8221;false&#8221; /&gt; another amount. (Enter the amount you wish to pay in the field below)&lt;/td&gt;<br />
&lt;div id=&#8221;anotherAmount&#8221;&gt;<br />
Another Amount: &lt;input type=&#8221;text&#8221; name=&#8221;paymentAmount&#8221; id=&#8221;paymentAmount&#8221; maxlength=&#8221;8&#8243; /&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>Using jQuery, this is very simple to do:</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>$(document).ready(function(){<br />
$(&#8220;input[@name='payFullAmount']&#8220;).click(function(){<br />
$(&#8220;input[@name='payFullAmount']:checked&#8221;).val() == &#8216;false&#8217; ? $(&#8220;#anotherAmount&#8221;).show() : $(&#8220;#anotherAmount&#8221;).hide();<br />
});<br />
});</p>
<p>&lt;/script&gt;</p></blockquote>
<p>As we don&#8217;t have an id on the radio button, we use the name of the input as the identifier, and a simple one liner to establish what the new value of the radio button is.</p>
<p>Due to the focus being on making it clear what is happening, it could be quite easy when you select the radio button, to miss what has changed on the page (a new input box appearing), so I decided to try and highlight the newly displayed input box by fading the background colour of the input box, in and out.  In order to do this in jQuery, you need the <a title="jQuery Color Plugin" href="http://redirectingat.com?id=3344X607854&xs=1&url=http%3A%2F%2Fplugins.jquery.com%2Fproject%2Fcolor&sref=rss" target="_blank">jQuery Color plugin</a>.</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>$(document).ready(function(){<br />
$(&#8220;input[@name='payFullAmount']&#8220;).click(function(){<br />
$(&#8220;input[@name='payFullAmount']:checked&#8221;).val() == &#8216;false&#8217; ? $(&#8220;#anotherAmount&#8221;).show() : $(&#8220;#anotherAmount&#8221;).hide();</p>
<p>if ($(&#8220;input[@name='payFullAmount']:checked&#8221;).val() == &#8216;false&#8217;) {<br />
$(&#8220;#paymentAmount&#8221;).animate({ backgroundColor: &#8220;#EFB559&#8243; }, 1000).animate({ backgroundColor: &#8220;#FFFFFF&#8221; }, 1000).animate({ backgroundColor: &#8220;#EFB559&#8243; }, 1000).animate({ backgroundColor: &#8220;#FFFFFF&#8221; }, 1000);<br />
}</p>
<p>});<br />
});</p>
<p>&lt;/script&gt;</p></blockquote>
<p>Our starting background colour is #FFFFFF, we fade to #EFB559 in 1 second, back to #FFFFFF in 1 second, to #EFB559 in 1 second, and finally back to #FFFFFF in 1 second.  This gives the effect of highlighting the field in an orange colour twice, hopefullyhelping the user notice what has changed on the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/jquery-show-and-hide-input-box-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Velocity &#8211; Looping through a TreeMap</title>
		<link>http://www.the-blackbox.co.uk/programming/velocity-looping-through-a-treemap/</link>
		<comments>http://www.the-blackbox.co.uk/programming/velocity-looping-through-a-treemap/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 09:31:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[keys]]></category>
		<category><![CDATA[TreeMap]]></category>
		<category><![CDATA[values]]></category>
		<category><![CDATA[velocity]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=14</guid>
		<description><![CDATA[I had trouble finding any real information on this to pass on to the developers here, so I had to document it myself, to help them move on from their PHP background to understand things other than simple multi-dimensional arrays. So here, our TreeMap structure is&#8230;. TreeMap tMap = new TreeMap(); tMap.put(1, &#8220;London&#8221;); tMap.put(2, &#8220;New [...]]]></description>
			<content:encoded><![CDATA[<p>I had trouble finding any real information on this to pass on to the developers here, so I had to document it myself, to help them move on from their PHP background to understand things other than simple multi-dimensional arrays.</p>
<p>So here, our TreeMap structure is&#8230;.</p>
<blockquote><p>TreeMap <Double,String> tMap = new TreeMap<Double,String>();<br />
tMap.put(1, &#8220;London&#8221;);<br />
tMap.put(2, &#8220;New York&#8221;);<br />
tMap.put(3, &#8220;Paris&#8221;);<br />
tMap.put(4, &#8220;Sydney&#8221;);<br />
tMap.put(5, &#8220;Geneva&#8221;);</p></blockquote>
<p>Looping through this in Velocity and getting the values OR the keys is easy enough to do, and can be found through searching on Google, but pulling out both is hard to find.  Presuming we&#8217;re passed the above TreeMap to the Velocity layer as$cities</p>
<blockquote><p>// loop through the keySet of our TreeMap and assign<br />
// the key to $cityKey<br />
#foreach ($cityKey in $cities.keySet())</p>
<p>    // using the current $cityKey, get the value assigned<br />
    // to that key and set it to the variable $city<br />
    #set ($city = $cities.get($cityKey))</p>
<p>    Key: $cityKey<br />
    City: $city</p>
<p>#end</p></blockquote>
<p>Very basic example, but hopefully it&#8217;s useful to someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/programming/velocity-looping-through-a-treemap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developers and AJAX</title>
		<link>http://www.the-blackbox.co.uk/rants/developers-and-ajax/</link>
		<comments>http://www.the-blackbox.co.uk/rants/developers-and-ajax/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 09:00:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[idiots]]></category>
		<category><![CDATA[people not having a clue]]></category>

		<guid isPermaLink="false">http://www.the-blackbox.co.uk/?p=5</guid>
		<description><![CDATA[I do wish people would stop spouting rubbish about AJAX. Clicking a link and making a div appear/disappear is not AJAX &#8211; how many times do I have to explain this to these people? AJAX refers to not interfering with the display and behaviour of the existing page, whilst communicating with the server in the [...]]]></description>
			<content:encoded><![CDATA[<p>I do wish people would stop spouting rubbish about AJAX.  Clicking a link and making a div appear/disappear is not AJAX &#8211; how many times do I have to explain this to these people?  </p>
<p>AJAX refers to not interfering with the display and behaviour of the existing page, whilst communicating with the server in the &#8216;background&#8217;.  Once it&#8217;s received a response, then the page can be updated.</p>
<p>Yes clicking a link and making things appear/disappear might be done with Javascript, but it is not making an asynchronous call to the server for anything, which is quite a key part of the whole concept of AJAX!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-blackbox.co.uk/rants/developers-and-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
