<?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>Aidan Lister &#187; Housekeeping</title>
	<atom:link href="http://aidanlister.com/category/housekeeping/feed/" rel="self" type="application/rss+xml" />
	<link>http://aidanlister.com</link>
	<description>Code is poetry</description>
	<lastBuildDate>Tue, 24 Jan 2012 05:15:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Getting up and running with virtualenv on Mac OSX Lion.</title>
		<link>http://aidanlister.com/2011/11/getting-up-and-running-with-virtualenv-on-mac-osx-lion/</link>
		<comments>http://aidanlister.com/2011/11/getting-up-and-running-with-virtualenv-on-mac-osx-lion/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 19:57:31 +0000</pubDate>
		<dc:creator>Aidan Lister</dc:creator>
				<category><![CDATA[Housekeeping]]></category>

		<guid isPermaLink="false">http://aidanlister.com/?p=519</guid>
		<description><![CDATA[I recently purchased a new Macbook Air and had forgotten all of the various steps to get virtualenv up and running. Using the native Python packaged with OSX resulted in Could not call install_name_tool &#8212; you must have Apple&#8217;s development tools installed which I found confusing given that, you know, I have Xcode installed. Resorting [...]]]></description>
			<content:encoded><![CDATA[<p>I recently purchased a new Macbook Air and had forgotten all of the various steps to get <em>virtualenv</em> up and running. Using the native Python packaged with OSX resulted in <em>Could not call install_name_tool &#8212; you must have Apple&#8217;s development tools installed</em> which I found confusing given that, you know, I have Xcode installed.</p>
<p>Resorting to my old friend <a href="http://macports.com">MacPorts</a>, it took me a few tries and plenty of googling to get up and running. To save you some time should you be in a similar position, here are the commands you will need;</p>
<p>The steps required install Python, easy_install, pip and virtualenv in Mac OSX Lion:<br />
<code>$ sudo port install python27<br />
$ sudo port select --set python python27<br />
$ sudo port install py27-distribute<br />
$ PYDIR=`which python`;<br />
$ echo "export PATH=`dirname $PYDIR`:\$PATH" >> ~/.profile<br />
$ source ~/.profile<br />
$ sudo easy_install -U pip<br />
$ sudo pip install -U virtualenv</code></p>
<p>There&#8217;s a bit of magic in there to add pip and easy_install into your path, I found this solution to be nicer than symlinking them to your /usr/bin folder. Once this is done, you are ready to rock:</p>
<p><code>$ virtualenv --no-site-packages --distribute hooray</code></p>
<p>Another reader has pointed out this alternative:<br />
<code>git clone https://github.com/gregglind/virtualenv.git<br />
cd virtualenv<br />
git checkout feature/install_name_tool<br />
sudo python setup.py install</code></p>
]]></content:encoded>
			<wfw:commentRss>http://aidanlister.com/2011/11/getting-up-and-running-with-virtualenv-on-mac-osx-lion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with human readable network addresses</title>
		<link>http://aidanlister.com/2009/10/dealing-with-human-readable-network-addresses/</link>
		<comments>http://aidanlister.com/2009/10/dealing-with-human-readable-network-addresses/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 12:58:22 +0000</pubDate>
		<dc:creator>Aidan Lister</dc:creator>
				<category><![CDATA[Housekeeping]]></category>

		<guid isPermaLink="false">http://aidanlister.com/?p=400</guid>
		<description><![CDATA[<code>network_expand_range()</code> and <code>network_compact_range()</code> allow the expansion and contraction of IP addresses or ranges as human readable input.]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say we need to build a list of network addresses to whitelist access to a restricted area, or blacklist a troublesome spammer. It&#8217;s handy to be able to enter data in a variety of formats, including hostnames, IP addresses, and IP ranges.</p>
<p>Usually we will store this information as a <em>long</em>, then we can easily see if a requesting IP address falls within our list of networks simply by numerical comparison, specifically: start_range < requesting_ip < end_range.</p>
<p>However, our user doesn't want to enter the list of IPs as a <em>long</em> so we need tools to convert between an attractive input format, and an array of start and end ranges.</p>
<p>To accomplish this, we define two functions <code>network_expand_range</code> and <code>network_compact_range</code>. Let&#8217;s have a look:</p>
<pre class="brush: php; title: ; notranslate">
/**
 * Take small human readable network and give dotted quad range
 *
 * Acceptable inputs:
 *   1.1.1.1 - 1.1.255.255
 *   2.2.2.0-255
 *   3.3.3.*
 *   4.4.*.*
 *   5.5.5.20-40
 *   google.com
 *
 * @author Aidan Lister &lt;aidan@php.net&gt;
 * @link http://aidanlister.com/2009/10/dealing-with-human-readable-network-addresses/
 * @param input $string A newline separated list of network ranges
 * @return array Start and end addresses in dotted quads, or false
 */
function network_expand_range($network)
{
    // Sanity check
    if (empty($network)) {
        return false;
    }

    $has_star = strpos($network, '*');
    $has_dash = strpos($network, '-');

    // Last character of a domain must be in the alphabet
    if (ctype_alpha($network[strlen($network)-1])) {
        if (!$address = gethostbyname($network)) {
          return false;
        }
        return array($address, $address);
    } 

    // Simple
    if ($has_star === false &amp;&amp; $has_dash === false) {
        $res   = long2ip(ip2long($network));
        $start = $end = $res;
        if ($res === '0.0.0.0') {
            return false;
        }
    }

    // Using a star
    if ($has_star !== false) {
        $start = long2ip(ip2long(str_replace('*', '0', $network)));
        $end   = long2ip(ip2long(str_replace('*', '255', $network)));
        if ($start === '0.0.0.0' || $end === '0.0.0.0') {
            return false;
        }
    }

    // Using a dash
    if ($has_dash !== false) {
        list($start, $end) = explode('-', $network);

        // Check whether end is a full IP or just the last quad
        if (strpos($end, '.') !== false) {
            $end = long2ip(ip2long(trim($end)));
        } else {
            // Get the first 3 quads of the start address
            $classc = substr($start, 0, strrpos($start, '.'));
            $classc .= '.' . $end;
            $end = long2ip(ip2long(trim($classc)));
        }

        // Check for failure
        $start = long2ip(ip2long(trim($start)));
        if ($start === '0.0.0.0' || $end === '0.0.0.0') {
            return false;
        }
    }

    return array($start, $end);
}
</pre>
<p>Next, the sister function to reverse the expansion process:</p>
<pre class="brush: php; title: ; notranslate">
/**
 * Convert start and end address into small human readable string
 *
 * For example, $s=1.1.1.1 and $e=1.1.255.255 into 1.1.*.*
 *
 * @author Aidan Lister &lt;aidan@php.net&gt;
 * @link http://aidanlister.com/2009/10/dealing-with-human-readable-network-addresses/
 * @param int $start The start address
 * @param int $end The end address
 * @return string A start and end range as the small formatted string
 */
function network_compact_range($start, $end)
{
    if ($start === $end) {
        $output = $start;
    } else {
        $s = explode('.', $start);
        $e = explode('.', $end);
        if ($s[0] === $e[0] &amp;&amp; $s[1] === $e[1] &amp;&amp; $s[2] === $e[2]) {
            if ($s[3] === '0' &amp;&amp; $e[3] === '255') {
                $s[3] = '*';
                $output = implode('.', $s);
            } else {
                $s[3] = sprintf('%s-%s', $s[3], $e[3]);
                $output = implode('.', $s);
            }
        } else {
            $output = $start .' - '. $end;
        }
    }

    return $output;
}
</pre>
<p>To show how it all works, let&#8217;s look at some examples:</p>
<pre class="brush: php; title: ; notranslate">
// Example input (maybe from a textarea, database or file)
$input = array();
$input[] = '1.1.1.1 - 1.1.255.255';
$input[] = '2.2.2.0-255';
$input[] = '3.3.3.*';
$input[] = '4.4.*.*';
$input[] = '5.5.5.20-40';
$input[] = 'google.com';

echo &quot;The input is:\n&quot;;
foreach ($input as $network) {
    echo &quot;$network\n&quot;;
}

echo &quot;\n&quot;;
echo &quot;Expanded into ranges:\n&quot;;
foreach ($input as $network) {
    list($start, $end) = network_expand_range($network);
    echo &quot;$start - $end\n&quot;;
}

echo &quot;\n&quot;;
echo &quot;As a long:\n&quot;;
foreach ($input as $network) {
    list($start, $end) = network_expand_range($network);
    echo ip2long($start) . ' - ' . ip2long($end) . &quot;\n&quot;;
}

echo &quot;\n&quot;;
echo &quot;Back into compacted form:\n&quot;;
foreach ($input as $network) {
    list($start, $end) = network_expand_range($network);
    echo network_compact_range($start, $end), &quot;\n&quot;;
}
</pre>
<p>The output of this would be something like:</p>
<pre class="brush: plain; title: ; notranslate">
The input is:
1.1.1.1 - 1.1.255.255
2.2.2.0-255
3.3.3.*
4.4.*.*
5.5.5.20-40
google.com

Expanded into ranges:
1.1.1.1 - 1.1.255.255
2.2.2.0 - 2.2.2.255
3.3.3.0 - 3.3.3.255
4.4.0.0 - 4.4.255.255
5.5.5.20 - 5.5.5.40
74.125.53.100 - 74.125.53.100

As a long:
16843009 - 16908287
33686016 - 33686271
50529024 - 50529279
67371008 - 67436543
84215060 - 84215080
1249719652 - 1249719652

Back into compacted form:
1.1.1.1 - 1.1.255.255
2.2.2.*
3.3.3.*
4.4.0.0 - 4.4.255.255
5.5.5.20-40
74.125.53.100
</pre>
<p>Hope you find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://aidanlister.com/2009/10/dealing-with-human-readable-network-addresses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I&#8217;ll never eBay again</title>
		<link>http://aidanlister.com/2009/06/why-ill-never-ebay-again/</link>
		<comments>http://aidanlister.com/2009/06/why-ill-never-ebay-again/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 19:34:19 +0000</pubDate>
		<dc:creator>Aidan Lister</dc:creator>
				<category><![CDATA[Housekeeping]]></category>

		<guid isPermaLink="false">http://aidanlister.com/?p=370</guid>
		<description><![CDATA[I listed my old Macbook Pro 15" laptop for sale on eBay today. I paid my fees. I reviewed my add. I was happy for about 6 minutes, until I received a barrage of emails notifying me my account was suspended for "abuse" of their terms and conditions.

My account was locked down, leaving me unable to even log in to respond to the situation! All my bids on other items were revoked. Is this what online selling has become? If so, no thanks.]]></description>
			<content:encoded><![CDATA[<p>I listed my old Macbook Pro 15&#8243; laptop for sale on eBay today. I paid my fees. I reviewed my add. I was happy for about 6 minutes, until I received the following barrage of emails:</p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
MC010 A26 TKO NOTICE:  Restored Account- aidanlister<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Hello aidanlister (aidanlister@gmail.com),</p>
<p>It appears that your account was accessed by an unauthorised third party to list items without your permission. At this time we have taken several steps to secure your eBay account. Be assured that your credit card and banking information is safe as this information is kept encrypted on a secure server and cannot be viewed by anyone.</p></blockquote>
<p>Followed by:</p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
MC040 NOTICE: eBay Auction(s) Cancelled &#8211; User Agreement &#8211; Abusing eBay</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Hello aidanlister (aidanlister@gmail.com),</p>
<p>Due to the suspension of your account you are prohibited from using eBay in any way. This includes registering a new account.</p>
<p>Please note that this does not relieve you of your obligation to pay any fees you may owe to eBay.</p></blockquote>
<p>Evidently listing an item for sale constitutes abuse, but it&#8217;s nice to know they won&#8217;t charge me for it.</p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
MC045 aidanlister: Your eBay automatic payment request<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Hello aidanlister (aidanlister@gmail.com),</p>
<p>We have temporarily disabled your automatic payment method for 30 to 60 days. During this time, eBay will not attempt to collect automatic payment for your invoices.</p></blockquote>
<p>Okay I thought, there&#8217;s a lot of scammers in the world &#8230; I&#8217;m sure they are just taking precautions. Great, I like precautions. I bet there&#8217;s a way to clear all this up in My eBay and I&#8217;ll chalk one up to the Nigerians.</p>
<p>Oh, how wrong I was. Not only has my password been changed, clicking on &#8220;Forgotten password&#8221; (and filling in my entire life history) sends me this beauty of an email:</p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Forgotten Password<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Dear aidanlister,</p>
<p>This email was sent automatically by eBay in response to your request to recover your password. This is done for your protection; only you, the recipient of this email can take the next step in the password recover process.</p></blockquote>
<p>Okay simple one-time login, this should be no problem then pow:</p>
<p><a href="http://aidanlister.com/wp-content/uploads/2009/06/eBay.png"><img class="size-medium wp-image-369" title="eBay - The ultimate user experience" src="http://aidanlister.com/wp-content/uploads/2009/06/eBay.png" alt="Please log in (with your password) to change your password" width="500" /></a></p>
<p>You want me to SIGN IN WITH MY PASSWORD &#8230; TO CHANGE MY PASSWORD? I mean, great odens raven guys, what the hell?</p>
<p>As I furiously write all of this in an anonymous customer support request (because I can&#8217;t log in to my account) I ponder; for a company that spends literally millions every year on ensuring users feel safe on their website, if this is the best they can do, then good luck in the future because I&#8217;m done. I&#8217;ll never eBay again.</p>
<p>What do people sell stuff on these days? I&#8217;d give craigslist a shot, but I&#8217;m worried my ad might be misconstrued sexually.</p>
<p><strong>Update</strong>: 17th June 2009<br />
I received the following email from eBay today:</p>
<blockquote><p>
Thank you for writing to eBay&#8217;s Customer Support. My name is Emma and I<br />
will be assisting you with your account.</p>
<p>Please complete the following steps to secure your account:</p>
<p>1. Change the password on your personal email account. It&#8217;s likely the<br />
unauthorised person has access to your email account. By changing the<br />
password, we can safely send you instructions and it will help prevent<br />
your eBay account from being accessed by someone else again.</p>
<p>2. Please contact our Account Security Live Help team
</p></blockquote>
<p>How ridiculous. Not only can I not log into my account, eBay are still under the impression that someone else listed the laptop for sale. I quite clearly stated in both the subject, and the first lines of my support request that this wasn&#8217;t the case.</p>
]]></content:encoded>
			<wfw:commentRss>http://aidanlister.com/2009/06/why-ill-never-ebay-again/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Repository content moved to the blog</title>
		<link>http://aidanlister.com/2009/04/repository-content-moved-to-the-blog/</link>
		<comments>http://aidanlister.com/2009/04/repository-content-moved-to-the-blog/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 14:12:41 +0000</pubDate>
		<dc:creator>Aidan Lister</dc:creator>
				<category><![CDATA[Housekeeping]]></category>

		<guid isPermaLink="false">http://aidanlister.com/2009/04/repository-content-moved-to-the-blog/</guid>
		<description><![CDATA[I have just finished moving all of my repository content to separate posts in WordPress. I also decided to get a little tricky and manually imported all of the old comments into WordPress too.]]></description>
			<content:encoded><![CDATA[<p>I have just finished moving all of my repository content to separate posts in WordPress. I also decided to get a little tricky and manually imported all of the old comments into WordPress too.</p>
<p>Moving the comments was fairly complicated as I didn&#8217;t record a name or a website, which happens to be the two required fields for WordPress. Using some SQL magic I split the email into name@url, which has worked reasonably well.</p>
<p>I&#8217;ve still got lots and lots of cleaning up to do, so excuse the mess. Once it&#8217;s all done, I will redirect all of the incoming repository links to their relevant blog post.</p>
<p>Also I should take this opportunity to heap praise on the WordPress team &#8211; guys, you have built an amazing piece of software, it&#8217;s an absolute pleasure to use (as long as you don&#8217;t look inside the codebase).</p>
]]></content:encoded>
			<wfw:commentRss>http://aidanlister.com/2009/04/repository-content-moved-to-the-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It begins &#8230;</title>
		<link>http://aidanlister.com/2009/04/it-begins/</link>
		<comments>http://aidanlister.com/2009/04/it-begins/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 19:34:25 +0000</pubDate>
		<dc:creator>Aidan Lister</dc:creator>
				<category><![CDATA[Housekeeping]]></category>

		<guid isPermaLink="false">http://aidanlister.com/?p=1</guid>
		<description><![CDATA[I'm told I'm not a very funny person. Nor is my writing of particular quality. However, after camping this domain name for the last eight years I've finally decided to do something useful (perhaps debatable) with the space and start my own blog.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m told I&#8217;m not a very funny person. Nor is my writing of particular quality. However, after camping this domain name for the last eight years I&#8217;ve finally decided to do something useful (perhaps debatable) with the space and start my own blog. My repository still lives at the <a title="usual address" href="http://aidanlister.com/repos/">usual address</a>, but I will be upgrading it shortly. Happy reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://aidanlister.com/2009/04/it-begins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

