<?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>Daniel Tillett</title>
	<atom:link href="http://www.tillett.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tillett.info</link>
	<description>Just my blog</description>
	<lastBuildDate>Wed, 07 Apr 2010 23:54:41 +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>Removing large numbers of duplicate emails from Mac OSX Mail</title>
		<link>http://www.tillett.info/2010/03/29/removing-large-numbers-of-duplicate-emails-from-mac-osx-mail/</link>
		<comments>http://www.tillett.info/2010/03/29/removing-large-numbers-of-duplicate-emails-from-mac-osx-mail/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 00:27:56 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.tillett.info/?p=77</guid>
		<description><![CDATA[I was faced with the problem of having duplicate emails in some of my very large folders in Mail (some of my mail boxes have over 80,000 messages). There are applescripts for finding and removing duplicate messages, but they are very slow (~100 messages a minute) and so are not really viable on very large [...]]]></description>
			<content:encoded><![CDATA[<p>I was faced with the problem of having duplicate emails in some of my very large folders in <em>Mail</em> (some of my mail boxes have over 80,000 messages). There are applescripts for finding and removing duplicate messages, but they are very slow (~100 messages a minute) and so are not really viable on very large mail boxes  &#8211; at this rate it would take more than 5 days to process one of my large email folders. </p>
<p>One simple solution is to archive the mailbox and then use <code>formail</code> to strip out the duplicate messages, then importing the cleaned mbox back into <em>Mail</em>. This approach retains all the meta information like flags and attachments and is actually quite fast. The basic procedure is:</p>
<p>1. <strong>Rebuild the mail box.</strong> This is probably a good idea anyway.<br />
2. <strong>Archive the mail box.</strong> This will save a copy of your mailbox in standard mbox format which then formail can process.<br />
3. <strong>Open a terminal window</strong> and <code>cd</code> to the folder containing the new mbox archive.<br />
4 <strong>. Run the following formail command.</strong> This will create a copy of the mbox (mbox_new) with the duplicate messages removed. This will take around 5 minutes to process 80,000 messages.<br />
<code>formail -D 100000000 idcache < mbox -s > mbox_new</code><br />
5. <strong>Open <em>Mail</em> and <em>Import Mailboxes</em>.</strong> Select the mbox_new mbox. Once it finishes importing you will now have a new folder under <em>Import</em> with all the non-duplicate messages. It is a good idea to rebuild the folder before moving it back to where you want.<br />
6. <strong>Delete the archive.</strong> </p>
<p>This approach is much,much faster and has the advantage of working on a copy of your email data so if anything goes wrong you won&#8217;t mess up your current mailboxes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2010/03/29/removing-large-numbers-of-duplicate-emails-from-mac-osx-mail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Root privilege scripts from Apache</title>
		<link>http://www.tillett.info/2010/02/17/root-privilege-scripts-from-apache/</link>
		<comments>http://www.tillett.info/2010/02/17/root-privilege-scripts-from-apache/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 15:14:33 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[server admin]]></category>

		<guid isPermaLink="false">http://www.tillett.info/?p=62</guid>
		<description><![CDATA[If you have a script that needs to access functions that can only be run as root (e.g. chmod, chgrp, mkdir, etc) you will find that you can&#8217;t call these directly since the Apache user is not root (at least it should not be root). There is no perfect solution around this as all solutions [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a script that needs to access functions that can only be run as root (e.g. chmod, chgrp, mkdir, etc) you will find that you can&#8217;t call these directly since the Apache user is not root (at least it should not be root). There is no perfect solution around this as all solutions involve some security risk, but the least bad seems to be to use sudoer to grant root privileges to the script and then lock down the script so nobody other than root can modify the script. </p>
<p>First chmod the script so that anyone can execute it, but nobody other than root can modify it (I am assuming here that you are logged in as root, otherwise sudo).<br />
<code><br />
chmod 111 /home/path_to_script<br />
</code><br />
Next modify sudoer using visudo. It is a good idea to use visudo so that any change you make are updated without having to restart sudo.<br />
<code><br />
# visudo<br />
</code><br />
Add the following line after the root entry in sudoer<br />
<code><br />
apache_user ALL = NOPASSWD: /home/path_to_script<br />
</code><br />
Change the apache_user to whatever your apache user is (e.g. nobody) and then add the path to your script. You might want to add your favorite editor (mine is nano) to your export in .bashrc. You should now be able to call your script from apache without problem.</p>
<p>Update. Make sure that you have commented out the <code>Defaults requiretty</code> line in <code>visudo</code> or else the script won&#8217;t be run by Apache. This problem wasted a couple of hours of my time since the script would run fine from the bash shell of the apache user, but not when called by apache. I finally took a look at the log file (yes I should have done this first) and there was the problem <code>sudo: sorry, you must have a tty to run sudo</code>! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2010/02/17/root-privilege-scripts-from-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X compatible external web camera</title>
		<link>http://www.tillett.info/2010/02/16/mac-os-x-compatible-external-web-camera/</link>
		<comments>http://www.tillett.info/2010/02/16/mac-os-x-compatible-external-web-camera/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 03:32:56 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.tillett.info/?p=59</guid>
		<description><![CDATA[I use my macbook with an Apple 23 inch monitor at work and so I can&#8217;t use the inbuilt iSight camera. Since Apple stopped selling the external iSight camera there is not much choice for Apple compatible web cams since most of the web cameras on the market don&#8217;t come with Mac OS X drivers. [...]]]></description>
			<content:encoded><![CDATA[<p>I use my macbook with an Apple 23 inch monitor at work and so I can&#8217;t use the inbuilt iSight camera. Since Apple stopped selling the external iSight camera there is not much choice for Apple compatible web cams since most of the web cameras on the market don&#8217;t come with Mac OS X drivers. </p>
<p>One surprisingly option is the xbox360 web cam. This external usb camera works without any drivers and just plugs straight in and works. I managed to pick up a brand new one on eBay for A$35. The quality is pretty good and it sits without any problems on top of my monitor. Nice work microsoft.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2010/02/16/mac-os-x-compatible-external-web-camera/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding iso repository under XenServer 5.5</title>
		<link>http://www.tillett.info/2009/09/23/adding-iso-repository-under-xenserver-5-5/</link>
		<comments>http://www.tillett.info/2009/09/23/adding-iso-repository-under-xenserver-5-5/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 08:14:21 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[server admin]]></category>

		<guid isPermaLink="false">http://www.tillett.info/?p=51</guid>
		<description><![CDATA[If you want to install an OS from a local repository under XenServer 5.5 then you need to do the following. The documentation on how to do this in the xenserver manual is incomplete. first ssh into the xenserver mkdir -p /var/opt/xen/iso_import Copy your ISO images to the /var/opt/xen/iso_import directory using scp. Create a repository [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to install an OS from a local repository under XenServer 5.5 then you need to do the following. The documentation on how to do this in the xenserver manual is incomplete.</p>
<p>first ssh into the xenserver<br />
<code>mkdir -p /var/opt/xen/iso_import</code><br />
Copy your ISO images to the /var/opt/xen/iso_import directory using scp.<br />
Create a repository with this command:<br />
<code>xe sr-create name-label=ISOs type=iso device-config:location=/var/opt/xen/iso_import device-config:legacy_mode=true content-type=iso</code><br />
You then need to attach the ISO library with this command (nicely not mentioned in the citrix documentation)<br />
<code>xe-mount-iso-sr /var/opt/xen/iso_import</code></p>
<p>You should then be able to create a VM using the .iso</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2009/09/23/adding-iso-repository-under-xenserver-5-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apple Bootcamp 2.1 and Windows XP SP3</title>
		<link>http://www.tillett.info/2009/08/26/apple-bootcamp-2-1-and-windows-xp-sp3/</link>
		<comments>http://www.tillett.info/2009/08/26/apple-bootcamp-2-1-and-windows-xp-sp3/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 07:17:07 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Windows XP]]></category>

		<guid isPermaLink="false">http://www.tillett.info/?p=46</guid>
		<description><![CDATA[There is a problem with Bootcamp 2.1 in that you can&#8217;t install the Apple drivers under Windows XP SP3. I recently bought a new MacBook Pro and installed Windows XP SP3 from an image and then tried to update the XP hardware drivers using bootcamp 2.1. This didn&#8217;t work an instead gave a nice cryptic [...]]]></description>
			<content:encoded><![CDATA[<p>There is a problem with Bootcamp 2.1 in that you can&#8217;t install the Apple drivers under Windows XP SP3. I recently bought a new MacBook Pro and installed Windows XP SP3 from an image and then tried to update the XP hardware drivers using bootcamp 2.1. This didn&#8217;t work an instead gave a nice cryptic error 2762. It seems it is not possible to install the drivers manually either as windows can&#8217;t install the drivers for the wireless network, iSight camera, and trackpad.</p>
<p>The solution is to install XP from a SP2 image (luckily I had kept one), then install the drivers, and then upgrade to SP3. I hope this saves someone a bit of time.</p>
<p>Update. This has apparently been fixed in snow leopard. I guess another reason to update.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2009/08/26/apple-bootcamp-2-1-and-windows-xp-sp3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get total folder / directory size with Linux</title>
		<link>http://www.tillett.info/2009/05/16/how-to-get-total-folder-directory-size-in-linux/</link>
		<comments>http://www.tillett.info/2009/05/16/how-to-get-total-folder-directory-size-in-linux/#comments</comments>
		<pubDate>Fri, 15 May 2009 23:28:30 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[server admin]]></category>

		<guid isPermaLink="false">http://www.tillett.info/?p=39</guid>
		<description><![CDATA[If you want to know how much disk space is being used by a directory (including all the sub-directories) then you can use the following command. It will output a single number in human readable form (eg 8.2G). I have found this very useful for finding where all my disk space has gone. du -h [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to know how much disk space is being used by a directory (including all the sub-directories) then you can use the following command. It will output a single number in human readable form (eg 8.2G). I have found this very useful for finding where all my disk space has gone.<br />
<code><br />
du -h | grep -v '/' | awk '{print $1}'<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2009/05/16/how-to-get-total-folder-directory-size-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>X11 ssh-forwarding of a gnome-session to Mac OS X 10.5</title>
		<link>http://www.tillett.info/2008/09/17/x11-ssh-forwarding-of-a-gnome-session-from-mac-os-x-105/</link>
		<comments>http://www.tillett.info/2008/09/17/x11-ssh-forwarding-of-a-gnome-session-from-mac-os-x-105/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 07:32:47 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[server admin]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[macos x 10.5]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.tillett.info/?p=15</guid>
		<description><![CDATA[If you want to X11 ssh-forward a gnome-session on a remote linux server to MacOS X Leopard there seems to be some bug in the 10.5 X11 that causes the gnome desktop to take over the whole screen and you can&#8217;t access the session. The solution is to open the gnome-session using Xnest instead. This [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to X11 ssh-forward a gnome-session on a remote linux server to MacOS X Leopard there seems to be some bug in the 10.5 X11 that causes the gnome desktop to take over the whole screen and you can&#8217;t access the session. The solution is to open the gnome-session using Xnest instead. This opens the session in a small X11 window (1024&#215;768 in the example below).</p>
<pre class="alt2" dir="ltr">Xnest -geometry 1024x768 :1&amp; DISPLAY=:1 ssh -X &lt;HOST&gt; gnome-session</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2008/09/17/x11-ssh-forwarding-of-a-gnome-session-from-mac-os-x-105/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random PHP string</title>
		<link>http://www.tillett.info/2008/02/14/random-php-string/</link>
		<comments>http://www.tillett.info/2008/02/14/random-php-string/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 00:04:52 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.tillett.info/2008/02/14/random-php-string/</guid>
		<description><![CDATA[I needed to generate a random string in php that did not repeat. This little snippet will generate a random non-repeating 32 character string. // Generate random 32 character string $string = md5(time());]]></description>
			<content:encoded><![CDATA[<p>I needed to generate a random string in php that did not repeat. This little snippet will generate a random non-repeating 32 character string.</p>
<p>// Generate random 32 character string<br />
$string = md5(time());</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2008/02/14/random-php-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE 6 javascript onchange() problem</title>
		<link>http://www.tillett.info/2008/02/06/work-around-for-ir-6-javascript-onchange-bug/</link>
		<comments>http://www.tillett.info/2008/02/06/work-around-for-ir-6-javascript-onchange-bug/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 05:01:37 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[onchange]]></category>

		<guid isPermaLink="false">http://www.tillett.info/2008/02/06/work-around-for-ir-6-javascript-onchange-bug/</guid>
		<description><![CDATA[I really hate IE6, but as it is still so common it is important to support it. I recently ran into a problem with the javascript onchange function. I was using onchange to update a text box on the page when the check box was selected. I was using &#8220;&#8230;onchange(this.checked)&#8230;&#8221; This worked fine for everything [...]]]></description>
			<content:encoded><![CDATA[<p>I really hate IE6, but as it is still so common it is important to support it. I recently ran into a problem with the javascript onchange function. I was using onchange to update a text box on the page when the check box was selected. I was using &#8220;&#8230;onchange(this.checked)&#8230;&#8221; This worked fine for everything except IE6. It turns out that IE doesn&#8217;t fire the onchange state until the checkbox loses focus and so my update was not occurring.</p>
<p>The simple way around for this problem was to change onchange() to onclick(). The function now works in all browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2008/02/06/work-around-for-ir-6-javascript-onchange-bug/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>PHP number_format function problem</title>
		<link>http://www.tillett.info/2008/02/05/php-number_format-function-problem/</link>
		<comments>http://www.tillett.info/2008/02/05/php-number_format-function-problem/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 23:46:26 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.tillett.info/2008/02/05/php-number_format-function-problem/</guid>
		<description><![CDATA[I have been using the php number_function() to format currency values in my code and was recently caught by the thousand separator comma. If you use the function and just specify the the number of decimal places (ie $x = number_format ($y,2) ) then you will get a comma introduced for all numbers above 999.99. [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using the php number_function() to format currency values in my code and was recently caught by the thousand separator comma. If you use the function and just specify the the number of decimal places (ie $x = number_format ($y,2) ) then you will get a comma introduced for all numbers above 999.99. This comma will break any maths functions that you might use downstream. </p>
<p>The solution is to specify the decimal point but remove the comma. The format to use to achieve this is $x = $number_format ($y,2,&#8221;.&#8221;,&#8221;") &#8211; the empty double quotes tell the number format function to not include the thousand separator comma.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tillett.info/2008/02/05/php-number_format-function-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
