<?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>Adrian Callaghan`s Blog &#187; Work</title>
	<atom:link href="http://adriancallaghan.co.uk/Categorys/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://adriancallaghan.co.uk</link>
	<description>A general mix of everything</description>
	<lastBuildDate>Thu, 29 Jul 2010 12:45:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>sort a array by its value</title>
		<link>http://adriancallaghan.co.uk/sort-a-array-by-its-value/</link>
		<comments>http://adriancallaghan.co.uk/sort-a-array-by-its-value/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 12:45:07 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://adriancallaghan.co.uk/?p=577</guid>
		<description><![CDATA[To sort an array by its value, similiar to mysql sort by just use Code: usort($array, create_function('$a, $b, $sortBy="distance"', 'return strnatcmp($a[$sortBy], $b[$sortBy]);')); $array stores the array $sortBy set the key to sort by i.e Code: $array = array ( 1=>array('name'=>'me','location'=>'somewhere','distance'=>'200'), 2=>array('name'=>'you','location'=>'somewhere','distance'=>'2') ); usort($array, create_function('$a, $b, $sortBy="distance"', 'return strnatcmp($a[$sortBy], $b[$sortBy]);')); print_r($array); will result in the array [...]]]></description>
			<content:encoded><![CDATA[<p>To sort an array by its value, similiar to mysql sort by just use</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>usort($array, create_function('$a, $b, $sortBy="distance"', 'return strnatcmp($a[$sortBy], $b[$sortBy]);'));</pre>
</div>
<p></code></div>
</div>
<p>$array stores the array<br />
$sortBy set the key to sort by</p>
<p>i.e</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>$array = array (
    1=>array('name'=>'me','location'=>'somewhere','distance'=>'200'),
    2=>array('name'=>'you','location'=>'somewhere','distance'=>'2')
    );

usort($array, create_function('$a, $b, $sortBy="distance"', 'return strnatcmp($a[$sortBy], $b[$sortBy]);'));
print_r($array);</pre>
</div>
<p></code></div>
</div>
<p>will result in the array being re-ordered with location 2 now being in location 1 (preserving the keys)</p>
]]></content:encoded>
			<wfw:commentRss>http://adriancallaghan.co.uk/sort-a-array-by-its-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress comment count as a button</title>
		<link>http://adriancallaghan.co.uk/wordpress-comment-count-as-a-button/</link>
		<comments>http://adriancallaghan.co.uk/wordpress-comment-count-as-a-button/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 13:46:56 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://adriancallaghan.co.uk/?p=533</guid>
		<description><![CDATA[Styling the wordpress comment count as a button/icon etc can be tricky because the normal call to the comments 1 comments_popup_link&#40;__&#40;'Comments (0)'&#41;, __&#40;'Comments (1)'&#41;, __&#40;'Comments (%)'&#41;&#41;; formats the output as an anchor point with the correct link, alt tags etc already set up. So in order to intercept this and then add you own anchor [...]]]></description>
			<content:encoded><![CDATA[<p>Styling the wordpress comment count as a button/icon etc can be tricky because the normal call to the comments</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">comments_popup_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Comments (0)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Comments (1)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Comments (%)'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>formats the output as an anchor point with the correct link, alt tags etc already set up.</p>
<p>So in order to intercept this and then add you own anchor point with divs/imagery etc you need to make a custom request</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">// SQL</span>
<span style="color: #000088;">$SQL</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT COUNT(*) AS Count FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;comments</span> WHERE comment_approved='1'&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$SQL</span><span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;AND comment_post_ID='&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Sort the array into a string prefixed with 'Comments '</span>
<span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$SQL</span><span style="color: #339933;">,</span> ARRAY_A<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 	
<span style="color: #000088;">$comments</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Comments ('</span><span style="color: #339933;">.</span><span style="color: #000088;">$comments</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Count'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// generate the alt and title tags</span>
<span style="color: #000088;">$alt</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Comment on '</span><span style="color: #339933;">.</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// echo the button if this is not a single and not a page</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// anchor open</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">.</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; alt=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$alt</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; title=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$alt</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// complex formatting rules for the comment pop up, go here</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$comments</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// anchor close</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The above does exactly the same, formats the link etc, but now you can access the anchor point directly and format it your own way.</p>
]]></content:encoded>
			<wfw:commentRss>http://adriancallaghan.co.uk/wordpress-comment-count-as-a-button/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ftp open in explorer by default in windows</title>
		<link>http://adriancallaghan.co.uk/ftp-open-in-explorer-by-default-in-windows/</link>
		<comments>http://adriancallaghan.co.uk/ftp-open-in-explorer-by-default-in-windows/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 09:25:24 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://adriancallaghan.co.uk/?p=527</guid>
		<description><![CDATA[How to make explorer open by default when opening an ftp connection, I found can be easy.. I needed to make IE6 style FTP access without the extra pop up step, from a desktop shortcut at work and after much googling, and messing with the registery, attempting to make an ftp site open immediatly in [...]]]></description>
			<content:encoded><![CDATA[<p>How to make explorer open by default when opening an ftp connection, I found can be easy..</p>
<p>I needed to make IE6 style FTP access without the extra pop up step, from a desktop shortcut at work and after much googling, and messing with the registery, attempting to make an ftp site open immediatly in explorer without the main browser opening (pre IE7), I found it can be simply done like this.</p>
<p>1. create a bat file (open notepad, save the file with the affix .bat, making sure .txt is not selected in the dropdown)<br />
2. in the batch file add</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="dos" style="font-family:monospace;">start explorer ftp://USERNAME:PASSWORD<span style="color: #33cc33;">@</span>FTP_SERVER_ADDRESS</pre></td></tr></table></div>

<p>3. add the shortcut to the desktop, and style the icon</p>
<p>Now when the user clicks the shortcut, voila IE6 style FTP access without the extra step, much easier than poking around with the registery <img src='http://adriancallaghan.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://adriancallaghan.co.uk/ftp-open-in-explorer-by-default-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>0 in $_GET is empty in PHP</title>
		<link>http://adriancallaghan.co.uk/zero-tolerance-for-zero-in-php/</link>
		<comments>http://adriancallaghan.co.uk/zero-tolerance-for-zero-in-php/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 20:39:24 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://adriancallaghan.co.uk/?p=119</guid>
		<description><![CDATA[Whilst at work, I was writing a cart for an e-commerce site I am building. The Cart consisted of a multi-dimensioned array, part associative, part indexed, anyway of note here is that, A. It was an array. B. The contents where indexed numerically C. Arrays as you know begin at zero. When removing an element [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst at work, </p>
<p>I was writing a cart for an e-commerce site I am building.</p>
<p>The Cart consisted of a multi-dimensioned array, part associative, part indexed, anyway of note here is that,</p>
<p>A. It was an array.<br />
B. The contents where indexed numerically<br />
C. Arrays as you know begin at zero.</p>
<p>When removing an element from the cart, the elements indexed value, is passed via GET to be handled via the object, for removal.</p>
<p>It seemed to work fine, until I attempted to remove the first element, after a little debugging, I noticed the &#8220;0&#8243; value was being interpreted by PHP as empty?</p>
<p>WTF?</p>
<p>A quick mock up code later</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'get'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;I RECIEVED A GET WITH VALUE: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'get'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>and a check in the url </p>
<p>nameOfFile.php?get=1   displayed &#8220;I RECIEVED A GET WITH VALUE: 1&#8243;<br />
nameOfFile.php?get=0   displayed &#8220;&#8221;</p>
<p>It seems that according to PHP the value zero is interpreted as empty because it is being handled as a string when used within GET.</p>
<p>But&#8230;&#8230;&#8230;&#8230;&#8230;.</p>
<p>A string, as the name suggests is just a string of characters, strung together, it is an array of characters, or bytes, the fact that it held zero, would be irrelevant would`nt it not?</p>
<p>I can understand if it was attempting to cast the datatype to an integer, but again, zero is still zero.</p>
<p>The only scenerio I can see this being valid if it where NULL!</p>
<p>PHP uses loose datatypes or lucid?</p>
]]></content:encoded>
			<wfw:commentRss>http://adriancallaghan.co.uk/zero-tolerance-for-zero-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adrian Callaghan`s graduation</title>
		<link>http://adriancallaghan.co.uk/graduation-footage/</link>
		<comments>http://adriancallaghan.co.uk/graduation-footage/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 21:16:31 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[LinkedIn]]></category>

		<guid isPermaLink="false">http://adriancallaghan.co.uk/?p=48</guid>
		<description><![CDATA[  This is recent footage from the graduation ceremony, I have edited out all the boring stuff, so only about 20sec`s remains. It was a lovely day, and I am glad I attended..]]></description>
			<content:encoded><![CDATA[<p><a href="http://adriancallaghan.co.uk/wp-content/plugins/clikstats/ck.php?Ck_id=48&Ck_lnk=http://adriancallaghan.co.uk/wp-content/uploads/2008/10/TITLE01.wmv"></a></p>
<p style="text-align: center;"> <object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" width="300" height="300" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"><param name="autostart" value="false" /><param name="name" value="Adrians graduation" /><param name="url" value="http://adriancallaghan.co.uk/wp-content/uploads/2008/10/me.wmv" /><embed type="application/x-mplayer2" width="300" height="300" url="http://adriancallaghan.co.uk/wp-content/uploads/2008/10/me.wmv" autostart="false" name="Adrians graduation"></embed></object></p>
<p>This is recent footage from the graduation ceremony, I have edited out all the boring stuff, so only about 20sec`s remains.</p>
<p>It was a lovely day, and I am glad I attended..</p>
]]></content:encoded>
			<wfw:commentRss>http://adriancallaghan.co.uk/graduation-footage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
