<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Neil Ang</title>
    <link>http://neilang.com</link>
    <description>Neil Ang Feed</description>
    <language>en-us</language>
    <generator>Symphony (build 1701)</generator>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <title>Validate an ISSN using Perl or JavaScript</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/6YbSB8sgdLk/</link>
      <pubDate>Fri, 12 Jun 2009 07:57:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/validate-an-issn-using-perl-or-javascript/</guid>
      <description>&lt;p&gt;Last week I wrote about &lt;a href="/entries/how-to-check-if-an-isbn-is-valid-in-perl-or-javasc/"&gt;validating an ISBN&lt;/a&gt;, so this week I thought I would post the code to validate an ISSN.&lt;/p&gt;

&lt;p&gt;There are only a few minor differences between validating an ISSN and ISBN.&lt;/p&gt;

&lt;h3&gt;Validate ISSN in Perl&lt;/h3&gt;

&lt;code&gt;sub valid_issn { &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $issn = $_[0]; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $issn =~ s/[^\dX]//gi; &lt;br /&gt; &amp;nbsp;&amp;nbsp;return if length($issn) != 8; &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $sum = 0; &lt;br /&gt; &amp;nbsp;&amp;nbsp;my @chars = split('', $issn); &lt;br /&gt; &amp;nbsp;&amp;nbsp;$chars[7] = 10 if uc($chars[7]) eq 'X'; &lt;br /&gt; &amp;nbsp;&amp;nbsp;for (my $char = 0; $char &amp;lt; @chars; $char++) { &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$sum += (8-$char) * $chars[$char]; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp;return (($sum % 11) == 0); &lt;br /&gt; } &lt;br /&gt; &lt;/code&gt;

&lt;h3&gt;Validate ISSN in JavaScript&lt;/h3&gt;

&lt;code&gt;function isValidISSN (issn) { &lt;br /&gt; &amp;nbsp;&amp;nbsp;issn = issn.replace(/[^\dX]/gi, ''); &lt;br /&gt; &amp;nbsp;&amp;nbsp;if(issn.length != 8){ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp;var chars = issn.split(''); &lt;br /&gt; &amp;nbsp;&amp;nbsp;if(chars[7].toUpperCase() == 'X'){ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;chars[7] = 10; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp;var sum = 0; &lt;br /&gt; &amp;nbsp;&amp;nbsp;for (var i = 0; i &amp;lt; chars.length; i++) { &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum += ((8-i) * parseInt(chars[i])); &lt;br /&gt; &amp;nbsp;&amp;nbsp;}; &lt;br /&gt; &amp;nbsp;&amp;nbsp;return ((sum % 11) == 0); &lt;br /&gt; }&lt;/code&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/validate-an-issn-using-perl-or-javascript/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=6YbSB8sgdLk:fjJ9irj-KAE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=6YbSB8sgdLk:fjJ9irj-KAE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=6YbSB8sgdLk:fjJ9irj-KAE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=6YbSB8sgdLk:fjJ9irj-KAE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=6YbSB8sgdLk:fjJ9irj-KAE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=6YbSB8sgdLk:fjJ9irj-KAE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/validate-an-issn-using-perl-or-javascript/</feedburner:origLink></item>
    <item>
      <title>How to check if an ISBN is valid in Perl or JavaScript</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/ZF-0lyhJza4/</link>
      <pubDate>Thu, 04 Jun 2009 22:22:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/how-to-check-if-an-isbn-is-valid-in-perl-or-javasc/</guid>
      <description>&lt;p&gt;The cool thing about an ISBN is that its last digit is a "check digit", which validates the rest of the number. How does it work? "It is calculated on a modulus 11 with weights 10-2, using X in lieu of 10 where ten would occur as a check digit." &lt;a href="http://www.isbn.org/standards/home/isbn/international/html/usm4.htm"&gt;More info&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;Validate an ISBN in Perl&lt;/h3&gt;
&lt;p&gt;Here is a simple subroutine I wrote to check if a number entered is valid: &lt;/p&gt;
&lt;p&gt;
&lt;code&gt;sub valid_isbn { &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $isbn = shift; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $isbn =~ s/[^\dX]//gi; &lt;br /&gt; &amp;nbsp;&amp;nbsp;return if length($isbn) != 10; &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $sum = 0; &lt;br /&gt; &amp;nbsp;&amp;nbsp;my @chars = split('', $isbn); &lt;br /&gt; &amp;nbsp;&amp;nbsp;$chars[9] = 10 if uc($chars[9]) eq 'X'; &lt;br /&gt; &amp;nbsp;&amp;nbsp;for (my $char = 0; $char &amp;lt; @chars; $char++) { &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$sum += (10-$char) * $chars[$char]; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp;return (($sum % 11) == 0); &lt;br /&gt; }&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;Code would not be complete without tests!&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;use Test::More tests =&amp;gt; 12; &lt;br /&gt; &lt;br /&gt; is(valid_isbn("ISBN 0843610727"), 1); &lt;br /&gt; is(valid_isbn("99921-58-10-7"), 1); &lt;br /&gt; is(valid_isbn("9971 5 0210 0"), 1); &lt;br /&gt; is(valid_isbn("0-8044-2957-X"), 1); &lt;br /&gt; is(valid_isbn("0943396042"), 1); &lt;br /&gt; is(valid_isbn("0-9752298-0-X"), 1); &lt;br /&gt; &lt;br /&gt; isnt(valid_isbn("ISBN 0843610723"), 1); &lt;br /&gt; isnt(valid_isbn("91921-58-10-7"), 1); &lt;br /&gt; isnt(valid_isbn("9971 5 0214 0"), 1); &lt;br /&gt; isnt(valid_isbn("0-8044-2957-2"), 1); &lt;br /&gt; isnt(valid_isbn("0943394042"), 1); &lt;br /&gt; isnt(valid_isbn("0-9757297-0-X"), 1);&lt;/code&gt;&lt;/p&gt;


&lt;h3&gt;Validate an ISBN in JavaScript&lt;/h3&gt;

&lt;p&gt;And here it is written as a JavaScript function:&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;&amp;lt;script type="text/javascript" charset="utf-8"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;function isValidISBN (isbn) { &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;isbn = isbn.replace(/[^\dX]/gi, ''); &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(isbn.length != 10){ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var chars = isbn.split(''); &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(chars[9].toUpperCase() == 'X'){ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;chars[9] = 10; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var sum = 0; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (var i = 0; i &amp;lt; chars.length; i++) { &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum += ((10-i) * parseInt(chars[i])); &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return ((sum % 11) == 0); &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;lt;/script&amp;gt;&lt;/code&gt;
&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/how-to-check-if-an-isbn-is-valid-in-perl-or-javasc/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=ZF-0lyhJza4:3epE_-Oszo0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=ZF-0lyhJza4:3epE_-Oszo0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=ZF-0lyhJza4:3epE_-Oszo0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=ZF-0lyhJza4:3epE_-Oszo0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=ZF-0lyhJza4:3epE_-Oszo0:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=ZF-0lyhJza4:3epE_-Oszo0:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/how-to-check-if-an-isbn-is-valid-in-perl-or-javasc/</feedburner:origLink></item>
    <item>
      <title>Computer namer</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/A8F_LsWVgnE/</link>
      <pubDate>Sun, 22 Feb 2009 11:30:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/computer-namer/</guid>
      <description>&lt;p&gt;Last week I was working with rails, and decided to test how much I had learnt to date. I picked a small website idea I had had aeons ago, and wanted to see how quickly and easily I could put it together in rails.&lt;/p&gt;

&lt;p&gt;To my surprise I did better then I thought. In less then an hour I had the site, database, administration screen and mailer setup. I did a bit more work later on, and added ajax, mac style buttons and &lt;a href="http://twitter.com/computernamer"&gt;twitter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The site - &lt;a href="http://computernamer.com/"&gt;Computer namer&lt;/a&gt; - is a random name generator for naming your computer. It was fun to make and  (hopefully) fun to use.&lt;/p&gt;

&lt;p&gt;Please have a look at it, and let me know what you think. Also, make a suggestion for a computer name if you can think of one.&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/computer-namer/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=A8F_LsWVgnE:wTM4d9Mc9xo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=A8F_LsWVgnE:wTM4d9Mc9xo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=A8F_LsWVgnE:wTM4d9Mc9xo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=A8F_LsWVgnE:wTM4d9Mc9xo:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=A8F_LsWVgnE:wTM4d9Mc9xo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=A8F_LsWVgnE:wTM4d9Mc9xo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/computer-namer/</feedburner:origLink></item>
    <item>
      <title>PHP not working on fresh OS X install</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/uyWt3CnAXCM/</link>
      <pubDate>Mon, 19 Jan 2009 04:35:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/php-not-working-on-fresh-os-x-install/</guid>
      <description>&lt;p&gt;Twice recently I have formatted and started with a fresh install of leopard (10.5.6), and twice Apache has not loaded PHP correctly after enabling PHP in the config. It fails to add the .php file type, causing php files to download rather then display. This is due to execute permissions not being set on the &lt;kbd&gt;/etc/apache2/other&lt;/kbd&gt; directory.&lt;/p&gt;

&lt;h3&gt;The solution&lt;/h3&gt;

&lt;p&gt;Here is what I needed to do to get PHP 5 working on a fresh install:&lt;/p&gt;

&lt;p&gt;Using terminal: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;open -a textmate /etc/apache2/httpd.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Locate and uncomment (remove the hash) from the PHP declaration (about line 115):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;LoadModule php5_module        libexec/apache2/libphp5.so&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Save the httpd.conf, then back in terminal type:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo chmod 554 /etc/apache2/other/php5.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will fix the PHP configuration file so it will load. You now need to restart the apache server:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo httpd -k restart&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Everything should work as expected now.&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/php-not-working-on-fresh-os-x-install/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=uyWt3CnAXCM:KCEWuv0UyR8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=uyWt3CnAXCM:KCEWuv0UyR8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=uyWt3CnAXCM:KCEWuv0UyR8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=uyWt3CnAXCM:KCEWuv0UyR8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=uyWt3CnAXCM:KCEWuv0UyR8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=uyWt3CnAXCM:KCEWuv0UyR8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/php-not-working-on-fresh-os-x-install/</feedburner:origLink></item>
    <item>
      <title>Generating a calendar using XSLT</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/Bc2FXiCEOWU/</link>
      <pubDate>Sun, 16 Nov 2008 07:43:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/generating-a-calendar-using-xslt/</guid>
      <description>&lt;p&gt;Recently I was tasked to build an interactive calendar in XSLT. I wanted the calendar to always start on a Sunday as well as have clean markup. I couldn't find any good examples on the web while I was building it, so I decided to post the base of my solution.&lt;/p&gt;

&lt;p&gt;
	&lt;img src="http://neilang.com/workspace/upload/calendar.png" alt="Picture of final product" /&gt;
&lt;/p&gt;

&lt;p&gt;Insert the following variables and templates into your stylesheet:&lt;/p&gt;

&lt;code&gt;&amp;lt;xsl:variable name="DisplayDate" select="date:date()"/&amp;gt; &lt;br /&gt; &amp;lt;xsl:variable name="Year" select="date:year($DisplayDate)"/&amp;gt; &lt;br /&gt; &amp;lt;xsl:variable name="Month" select="date:month-in-year($DisplayDate)"/&amp;gt; &lt;br /&gt; &amp;lt;xsl:variable name="MonthName" select="date:month-name($DisplayDate)" /&amp;gt; &lt;br /&gt; &amp;lt;xsl:variable name="NumberOfDaysInMonth"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:call-template name="DaysInMonth"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="month" select="$Month" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="year" select="$Year" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;/xsl:call-template&amp;gt; &lt;br /&gt; &amp;lt;/xsl:variable&amp;gt; &lt;br /&gt; &amp;lt;xsl:variable name="FirstDayInWeekForMonth"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;xsl:choose&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:when test="$Month &amp;amp;lt; 10"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:value-of select="date:day-in-week(date:date(concat($Year,'-0', $Month, '-01')))" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:when&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:otherwise&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:value-of select="date:day-in-week(date:date(concat($Year,'-', $Month, '-01')))" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:otherwise&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:choose&amp;gt;&lt;br /&gt;
&amp;lt;/xsl:variable&amp;gt; &lt;br /&gt; &amp;lt;xsl:variable name="WeeksInMonth"&amp;gt;&amp;lt;xsl:value-of select="($NumberOfDaysInMonth + $FirstDayInWeekForMonth - 1) div 7" /&amp;gt;&amp;lt;/xsl:variable&amp;gt; &lt;br /&gt; &lt;br /&gt; &amp;lt;xsl:template name="DaysInMonth"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:param name="month"&amp;gt;&amp;lt;xsl:value-of select="$Month" /&amp;gt;&amp;lt;/xsl:param&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:param name="year"&amp;gt;&amp;lt;xsl:value-of select="$Year" /&amp;gt;&amp;lt;/xsl:param&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:choose&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:when test="$month = 1 or $month = 3 or $month = 5 or $month = 7 or $month = 8 or $month = 10 or $month = 12"&amp;gt;31&amp;lt;/xsl:when&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:when test="$month=2"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:choose&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:when test="$year mod 4 = 0"&amp;gt;29&amp;lt;/xsl:when&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:otherwise&amp;gt;28&amp;lt;/xsl:otherwise&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:choose&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:when&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:otherwise&amp;gt;30&amp;lt;/xsl:otherwise&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;/xsl:choose&amp;gt; &lt;br /&gt; &amp;lt;/xsl:template&amp;gt; &lt;br /&gt; &lt;br /&gt; &amp;lt;xsl:template name="Calendar"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;table summary="Monthly calendar"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;caption&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:value-of select="$MonthName" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:text&amp;gt; &amp;lt;/xsl:text&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:value-of select="$Year" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/caption&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;tr&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th abbr="Sunday"&amp;gt;Sun&amp;lt;/th&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th abbr="Monday"&amp;gt;Mon&amp;lt;/th&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th abbr="Tuesday"&amp;gt;Tue&amp;lt;/th&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th abbr="Wednesday"&amp;gt;Wed&amp;lt;/th&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th abbr="Thursday"&amp;gt;Thu&amp;lt;/th&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th abbr="Friday"&amp;gt;Fri&amp;lt;/th&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;th abbr="Saturday"&amp;gt;Sat&amp;lt;/th&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/tr&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:call-template name="CalendarWeek"/&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;/table&amp;gt; &lt;br /&gt; &amp;lt;/xsl:template&amp;gt; &lt;br /&gt; &lt;br /&gt; &amp;lt;xsl:template name="CalendarWeek"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:param name="week"&amp;gt;1&amp;lt;/xsl:param&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:param name="day"&amp;gt;1&amp;lt;/xsl:param&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;tr&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:call-template name="CalendarDay"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="day" select="$day" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:call-template&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;/tr&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:if test="$WeeksInMonth &amp;amp;gt; $week"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:call-template name="CalendarWeek"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="week" select="$week + 1" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="day" select="$week * 7 - ($FirstDayInWeekForMonth - 2)" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:call-template&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;/xsl:if&amp;gt; &lt;br /&gt; &amp;lt;/xsl:template&amp;gt; &lt;br /&gt; &lt;br /&gt; &amp;lt;xsl:template name="CalendarDay"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:param name="count"&amp;gt;1&amp;lt;/xsl:param&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:param name="day" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;xsl:choose&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:when test="($day = 1 and $count != $FirstDayInWeekForMonth) or $day &amp;amp;gt; $NumberOfDaysInMonth"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td class="empty"&amp;gt;&amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;amp;amp;nbsp;&amp;lt;/xsl:text&amp;gt;&amp;lt;/td&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:if test="$count &amp;amp;lt; 7"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:call-template name="CalendarDay"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="count" select="$count + 1" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="day" select="$day" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:call-template&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:if&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:when&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:otherwise&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:value-of select="$day" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/td&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:if test="$count &amp;amp;lt; 7"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:call-template name="CalendarDay"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="count" select="$count + 1" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;xsl:with-param name="day" select="$day + 1" /&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:call-template&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:if&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/xsl:otherwise&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;/xsl:choose&amp;gt; &lt;br /&gt; &amp;lt;/xsl:template&amp;gt;&lt;/code&gt;

&lt;p&gt;For this code to work, you need to be using &lt;a href="http://exslt.org/"&gt;exslt&lt;/a&gt;.&lt;/p&gt;

&lt;code&gt;&amp;lt;xsl:stylesheet version="1.0" &lt;br /&gt; &amp;nbsp;&amp;nbsp;xmlns:xsl="http://www.w3.org/1999/XSL/Transform" &lt;br /&gt; &amp;nbsp;&amp;nbsp;xmlns:exslt="http://exslt.org/common" &lt;br /&gt; &amp;nbsp;&amp;nbsp;xmlns:date="http://exslt.org/dates-and-times"&amp;gt;&lt;/code&gt;

&lt;p&gt;Once you have added the templates you can call the calendar like this: &lt;/p&gt;

&lt;code&gt;&amp;lt;xsl:call-template name="Calendar" /&amp;gt;&lt;/code&gt;

&lt;p&gt;Finally add some CSS to the page so your calendar looks more presentable:&lt;/p&gt;

&lt;code&gt;&amp;lt;style type="text/css" media="screen"&amp;gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;table{ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;border:1px solid #CCC; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;border-collapse: collapse; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp;caption{ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;font-weight:bold; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;font-size:120%; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;margin-bottom:8px; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp; &lt;br /&gt; &amp;nbsp;&amp;nbsp;td,th{ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;text-align:center; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vertical-align:middle; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;width:36px; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;height:34px; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;border:1px solid #CCC; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;padding:0; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp; &lt;br /&gt; &amp;nbsp;&amp;nbsp;th{ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;height:inherit; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;nbsp;&amp;nbsp; &lt;br /&gt; &amp;nbsp;&amp;nbsp;.empty{ &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;background-color:#EEE; &lt;br /&gt; &amp;nbsp;&amp;nbsp;} &lt;br /&gt; &amp;lt;/style&amp;gt; &lt;br /&gt; &lt;br /&gt; &lt;/code&gt;

&lt;p&gt;This is only the base of the calendar I built, and you can expand this to make it browse-able. But I will leave that for another post. &lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/generating-a-calendar-using-xslt/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=Bc2FXiCEOWU:rTG4acWK9Us:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=Bc2FXiCEOWU:rTG4acWK9Us:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=Bc2FXiCEOWU:rTG4acWK9Us:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=Bc2FXiCEOWU:rTG4acWK9Us:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=Bc2FXiCEOWU:rTG4acWK9Us:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=Bc2FXiCEOWU:rTG4acWK9Us:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/generating-a-calendar-using-xslt/</feedburner:origLink></item>
    <item>
      <title>The New MacBook "Felt" (running Hyperspaces)</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/p7tXqP6WhAo/</link>
      <pubDate>Fri, 31 Oct 2008 22:10:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/the-new-macbook-felt-running-hyperspaces/</guid>
      <description>&lt;p&gt;Apple are secretly working on a new line of laptops to replace the "Airs". As awesome developers, Apple sent us some preview hardware to see how &lt;a href="http://hyperspacesapp.com"&gt;Hyperspaces&lt;/a&gt; performed on the new systems. I know Apple like to keep their products secret, but I say "NDA... ND-Shmay" - here is the new line, the Macbook "Felt".&lt;/p&gt;

&lt;div style="text-align:center"&gt;
&lt;object codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="256"&gt;&lt;param name="src" value="/workspace/upload/MacBook.mov" /&gt;&lt;param name="controller" value="true" /&gt;&lt;param name="autoplay" value="false" /&gt;&lt;param name="scale" value="tofit" /&gt;&lt;param name="volume" value="100" /&gt;&lt;param name="loop" value="false" /&gt;&lt;embed pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" class="mov" width="320" height="256" src="/workspace/upload/MacBook.mov" controller="true" autoplay="false" scale="tofit" volume="100" loop="false"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;/div&gt;
&lt;p&gt;Here are the new features expected in this model:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;This is the lightest notebook ever made by Apple.&lt;/li&gt;
	&lt;li&gt;The screen is carved from felt, which has no glare.&lt;/li&gt;
	&lt;li&gt;Due to the flammable nature of felt, all parts have been removed. This has resulted in a 98% reduction in heating.&lt;/li&gt;
	&lt;li&gt;There are no ports, which gives smooth looking edges.&lt;/li&gt;
	&lt;li&gt;New efficient 26 character keyboard.&lt;/li&gt;
&lt;/ul&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/the-new-macbook-felt-running-hyperspaces/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=p7tXqP6WhAo:E8xeZZpl6TE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=p7tXqP6WhAo:E8xeZZpl6TE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=p7tXqP6WhAo:E8xeZZpl6TE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=p7tXqP6WhAo:E8xeZZpl6TE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=p7tXqP6WhAo:E8xeZZpl6TE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=p7tXqP6WhAo:E8xeZZpl6TE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/the-new-macbook-felt-running-hyperspaces/</feedburner:origLink></item>
    <item>
      <title>Hyperspaces ...Hyperawesome</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/goHR8ox6YBI/</link>
      <pubDate>Sat, 18 Oct 2008 10:06:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/hyperspaces-hyperawesome/</guid>
      <description>&lt;p&gt;My most anticipated software release of this year is &lt;a href="http://tonyarnold.com"&gt;Tony Arnold's&lt;/a&gt; "Hyperspaces". This new application extends Leopards built-in Spaces application to add features that you would expect out-of-the-box for a multiple desktop program. Hyperspaces lets you set custom backgrounds, colours and labels on each desktop, giving each space its own special "flavour" (why would you want four identical desktops??). The application also allows you to set custom hot keys to quickly add and remove more rows of spaces as you need them.&lt;/p&gt;

&lt;p&gt;I was lucky enough to be on the early beta program for this app, and I have been really impressed by what Tony has been able to do and how well  Hyperspaces has been built. Why Apple didn't ship these features with Spaces originally is a mystery to me, as these set of features substantially improves the user experience of Spaces.&lt;/p&gt;

&lt;p&gt;My favourite feature of the app is the colour blends. I've set a different colour tint and label on each desktop. The colours blend with my wallpaper to give a distinct variation on every desktop.&lt;/p&gt;

&lt;p&gt;I would highly recommend &lt;a href="http://hyperspacesapp.com"&gt;trying out this app&lt;/a&gt;.&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/hyperspaces-hyperawesome/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=goHR8ox6YBI:xKnRKcay3j8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=goHR8ox6YBI:xKnRKcay3j8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=goHR8ox6YBI:xKnRKcay3j8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=goHR8ox6YBI:xKnRKcay3j8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=goHR8ox6YBI:xKnRKcay3j8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=goHR8ox6YBI:xKnRKcay3j8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/hyperspaces-hyperawesome/</feedburner:origLink></item>
    <item>
      <title>How to setup virtual hosts on Mac OS X 10.5 (Leopard)</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/OzbFJJqv8YY/</link>
      <pubDate>Sat, 20 Sep 2008 04:29:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/how-to-setup-virtual-hosts-on-mac-os-x-105-leopar/</guid>
      <description>&lt;p&gt;Whilst developing a new project it can be convenient to setup a virtual host on your local machine. For example, if I wanted to have a local development/demonstration version of a website I'm developing (e.g. &lt;a href="http://learnhowtojuggle.info"&gt;http://learnhowtojuggle.info&lt;/a&gt;), I could setup the following virtual host: &lt;a href="http://learnhowtojuggle.dev" rel="nofollow"&gt;http://learnhowtojuggle.dev&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;N.B. Only follow this tutorial if you are comfortable with editing system configurations and are aware of the risks. If you have &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; installed, you can click the file path links in these instructions to quickly open them on your local computer (&lt;a href="http://manual.macromates.com/en/using_textmate_from_terminal.html"&gt;More Information&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;1. Modify the virtual hosts configuration&lt;/h3&gt;

&lt;p&gt;Use terminal to find and modify your virtual hosts configuration file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mate &lt;a href="txmt://open/?url=file:///private/etc/apache2/extra/httpd-vhosts.conf" class="textmate"&gt;/private/etc/apache2/extra/httpd-vhosts.conf&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Append to this bottom of this file an entry for your virtual domain:&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt; &lt;br /&gt; ServerAdmin webmaster@learnhowtojuggle.dev &lt;br /&gt; DocumentRoot "/Users/neil/Sites/learnhowtojuggle" &lt;br /&gt; ServerName learnhowtojuggle.dev &lt;br /&gt; ServerAlias learnhowtojuggle.dev &lt;br /&gt; ErrorLog "/private/var/log/apache2/learnhowtojuggle.dev-error_log" &lt;br /&gt; &amp;lt;/VirtualHost&amp;gt;&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;Make sure the &lt;kbd&gt;DocumentRoot&lt;/kbd&gt; you enter actually exists. For convenience, I've placed mine in my Site folder. You can now save and close this file.&lt;/p&gt;

&lt;h3&gt;2. Check Apache knows about virtual hosts&lt;/h3&gt;

&lt;p&gt;Next we will need to modify the Apache configuration file to make sure it includes the virtual hosts file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mate &lt;a href="txmt://open/?url=file:///private/etc/apache2/httpd.conf&amp;amp;line=460" class="textmate"&gt;/private/etc/apache2/httpd.conf&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Locate the following line and remove the # sign (also known as an "octothorpe" ) from in front of it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Include /private/etc/apache2/extra/httpd-vhosts.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Save and close this file as well.&lt;/p&gt;

&lt;h3&gt;3. Restart Apache&lt;/h3&gt;

&lt;p&gt;For any changes to take effect on the Apache server, you will need to restart it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo httpd -k restart&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;4. Update hosts file&lt;/h3&gt;

&lt;p&gt;Finally, the easiest way to let our browser know to use our local server when it get a request for our virtual host is to modify the hosts file. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;mate &lt;a href="txmt://open/?url=file:///private/etc/hosts" class="textmate"&gt;/private/etc/hosts&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add the following entry:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;127.0.0.1	learnhowtojuggle.dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After you save and close this file, navigate to &lt;a href="http://learnhowtojuggle.dev" rel="nofollow"&gt;http://learnhowtojuggle.dev&lt;/a&gt; in your browser to see the newly created virtual host on your local machine. &lt;/p&gt;


&lt;h3&gt;Additional Configuration&lt;/h3&gt;

&lt;p&gt;Since I am serving my new virtual host out of my Sites folder, and I want to use my .htacess file for URL rewriting, I had to update the Apache configuration again to allow permission for this.&lt;/p&gt;

&lt;p&gt;The configuration for my Site folder was located at &lt;kbd&gt;/private/etc/apache2/users/neil.conf&lt;/kbd&gt; (yours will be different based on your system profile name). I then set my permissions to be pretty loose since it is only my local machine.&lt;/p&gt;

&lt;p&gt;Example configuration: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Directory "/Users/neil/Sites/"&amp;gt; &lt;br /&gt; Options Indexes FollowSymLinks MultiViews &lt;br /&gt; AllowOverride All &lt;br /&gt; Order allow,deny &lt;br /&gt; Allow from all &lt;br /&gt; &amp;lt;/Directory&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After you update your directory permissions, you will need to restart apache again for these to changes to take effect.&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/how-to-setup-virtual-hosts-on-mac-os-x-105-leopar/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=OzbFJJqv8YY:9Ga_OzhRxo0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=OzbFJJqv8YY:9Ga_OzhRxo0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=OzbFJJqv8YY:9Ga_OzhRxo0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=OzbFJJqv8YY:9Ga_OzhRxo0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=OzbFJJqv8YY:9Ga_OzhRxo0:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=OzbFJJqv8YY:9Ga_OzhRxo0:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/how-to-setup-virtual-hosts-on-mac-os-x-105-leopar/</feedburner:origLink></item>
    <item>
      <title>Things to know before going to WWDC</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/M7XcQrwTXkQ/</link>
      <pubDate>Sat, 21 Jun 2008 06:59:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/things-to-know-before-going-to-wwdc/</guid>
      <description>&lt;p&gt;As most of you know I spent last week in San Francisco attending WWDC ‘08. I had a great time thanks to the &lt;a href="http://www.auc.edu.au/"&gt;AUC&lt;/a&gt;, and highly encourage others to attend this conference next year if they have the opportunity. It is worth it. &lt;/p&gt;

&lt;p&gt;Here are some tips for anyone who is thinking of going in 2009:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Bring a list of issues you want solved&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The conference has sessions that run all day, but they also have labs where you can get Apple engineers to help solve issues with your software. These labs gave me a chance to talk with the actual engineers who work in the field of my software problems. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Take business cards&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I didn’t take any business cards with me, but a few people asked for my email address and it would of been perfect if I had a business card to give them. You don’t need a business to have a business card. Just include your name, email address and website (if you have one).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Take your equipment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This one is pretty much a given, but if you have a laptop, take it along. If you have an iphone or ipod touch, take that as well. Apple set up a convenient website for the attendees with the latest session updates and news which I checked everyday. They also had a version of the site that worked on the iphone. Very handy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Partition your hard drive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before I left Australia, I backed up and formatted my hard drive to clear up some space. I also made a separate partition incase we got new software. After I got a copy of snow leopard I was able to install it straight away alongside leopard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. See San Francisco while you are there&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://www.auc.edu.au/"&gt;AUC&lt;/a&gt; had arranged a bus tour for the Australian delegates, and we had an awesome day seeing all the highlights of the area. We checked out the Googleplex, Apple HQ and the computer history museum. Silicon valley is a great place for nerds to site see.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. File bug reports before you attend&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A common response to questions in sessions and labs was “file a bug report”. The engineers are not able to fix things on the spot, so if you have found a major problem with an API or system, its better to file a bug report before you attend. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Prepare to get up early&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Jet-lag along with early morning sessions and late nights out will leave you feeling tired most of the week. Luckily there are plenty of starbuck stores around and other coffee outlets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Attend parties&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;During the week parties are held by various organisations to celebrate WWDC. If you are thinking of attending any, make sure you RSVP. I would also recommend going to the “Stump the experts” event and the Apple design awards. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Don’t be afraid to meet people&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the conference you are surrounded by developers, engineers and Apple enthusiasts. It is a great chance to make contacts and spread your own name as well (again, take business cards). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Don’t feel bad about missing sessions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A lot of interesting sessions and labs are run concurrently at the conference which means you will miss sessions that you wanted to attend. If there is a conflicting lab and session, attend the lab as the sessions become available on video after the conference. &lt;/p&gt;

&lt;p&gt;And finally, enjoy the time there as much as possible and take lots of photos. The week will go by very quickly. &lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/things-to-know-before-going-to-wwdc/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=M7XcQrwTXkQ:4Qojhb81EPg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=M7XcQrwTXkQ:4Qojhb81EPg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=M7XcQrwTXkQ:4Qojhb81EPg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=M7XcQrwTXkQ:4Qojhb81EPg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=M7XcQrwTXkQ:4Qojhb81EPg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=M7XcQrwTXkQ:4Qojhb81EPg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/things-to-know-before-going-to-wwdc/</feedburner:origLink></item>
    <item>
      <title>Converting seconds into a readable format in Perl</title>
      <link>http://feedproxy.google.com/~r/neilang/~3/-iAW3kFT4KM/</link>
      <pubDate>Wed, 18 Jun 2008 09:49:00 GMT</pubDate>
      <guid isPermaLink="false">http://neilang.com/entries/converting-seconds-into-a-readable-format-in-perl/</guid>
      <description>&lt;p&gt;Here is a short and easy Perl function to convert the difference between two time stamps, into something that is more human readable. There are Perl modules that can do this as well, however I thought I would share what I wrote incase someone finds it useful.&lt;/p&gt;

&lt;code&gt;#!/usr/bin/env perl -w &lt;br /&gt; &lt;br /&gt; sub convert_time { &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $time = shift; &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $days = int($time / 86400); &lt;br /&gt; &amp;nbsp;&amp;nbsp; $time -= ($days * 86400); &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $hours = int($time / 3600); &lt;br /&gt; &amp;nbsp;&amp;nbsp; $time -= ($hours * 3600); &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $minutes = int($time / 60); &lt;br /&gt; &amp;nbsp;&amp;nbsp;my $seconds = $time % 60; &lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;$days = $days &amp;lt; 1 ? '' : $days .'d '; &lt;br /&gt; &amp;nbsp;&amp;nbsp;$hours = $hours &amp;lt; 1 ? '' : $hours .'h '; &lt;br /&gt; &amp;nbsp;&amp;nbsp;$minutes = $minutes &amp;lt; 1 ? '' : $minutes . 'm '; &lt;br /&gt; &amp;nbsp;&amp;nbsp;$time = $days . $hours . $minutes . $seconds . 's'; &lt;br /&gt; &amp;nbsp;&amp;nbsp;return $time; &lt;br /&gt; }&lt;/code&gt;

&lt;p&gt;When using this function, these are the outputs you should see:&lt;/p&gt;

&lt;code&gt;print convert_time(1); # result: 1s &lt;br /&gt; print convert_time(61); # result: 1m 1s &lt;br /&gt; print convert_time(3661); # result: 1h 1m 1s &lt;br /&gt; print convert_time(90061); # result: 1d 1h 1m 1s&lt;/code&gt;

&lt;p&gt;This code can easily be modified to output other formats as well. Let me know if you come up with something different.&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/converting-seconds-into-a-readable-format-in-perl/#comment"&gt;Please post a comment&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/neilang?a=-iAW3kFT4KM:W1_Y8yWLL_E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=-iAW3kFT4KM:W1_Y8yWLL_E:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=-iAW3kFT4KM:W1_Y8yWLL_E:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=-iAW3kFT4KM:W1_Y8yWLL_E:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/neilang?a=-iAW3kFT4KM:W1_Y8yWLL_E:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/neilang?i=-iAW3kFT4KM:W1_Y8yWLL_E:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
    <feedburner:origLink>http://neilang.com/entries/converting-seconds-into-a-readable-format-in-perl/</feedburner:origLink></item>
  </channel>
</rss>
