<?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>Moose56 blog &#187; Web</title>
	<atom:link href="http://www.moose56.com/blog/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.moose56.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 13 Jan 2012 07:24:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Full height CSS layout</title>
		<link>http://www.moose56.com/blog/2009/10/24/full-height-sizeable-css-layout/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=full-height-sizeable-css-layout</link>
		<comments>http://www.moose56.com/blog/2009/10/24/full-height-sizeable-css-layout/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 10:47:04 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/?p=102</guid>
		<description><![CDATA[The other day I needed to produce a web page which had a full height and width layout. It also needed header, left hand navigation and main content areas. There would be no guarantee that the navigation or the main content would be taller than the screen so I needed to fix the layout to [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I needed to produce a web page which had a full height and width layout. It also needed header, left hand navigation and main content areas.</p>
<p>There would be no guarantee that the navigation or the main content would be taller than the screen so I needed to fix the layout to the height of the browser. I also wanted it to be cross browser compatible and sizeable by the user if it was used as a popup.
<p><span id="more-102"></span>
<p>Lots of Google searches uncovered various different ways of getting a similar result to what I wanted, but most made use of the %100 heigh method. As I needed it to work in IE6/7/8 none of these solutions seemed to work.
<p>Anyway, a lot of playing and a complete re-write later I think I have a pretty good solution that works in:</p>
<ul>
<li>IE</li>
<li>Safari</li>
<li>FireFox</li>
</ul>
<p>Take a look at an example <a href="http://moose56.com/blog/wp-content/uploads/2009/10/FullHeightExample1.html" title="FullHeightExample.html">here</a>.</p>
<p>This should give you the idea of what I was after. So because I could not find what I needed here is a <a href="http://moose56.com/blog/wp-content/uploads/2009/10/FullHeightLayout1.zip" title="FullHeightLayout.zip">template</a> for anyone else who needs something like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2009/10/24/full-height-sizeable-css-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash video on OS X 10.6</title>
		<link>http://www.moose56.com/blog/2009/10/17/flash-video-on-os-x-10-6/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flash-video-on-os-x-10-6</link>
		<comments>http://www.moose56.com/blog/2009/10/17/flash-video-on-os-x-10-6/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 08:40:02 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/?p=90</guid>
		<description><![CDATA[While watching a YouTube video today my computer started to show the usual Flash symptoms. The system fan sounded like it was taking off and the CPU usage was going through the roof, it also began to heat up to the point where I could not have it on my lap. I have the ClickToFlash [...]]]></description>
			<content:encoded><![CDATA[<p>While watching a YouTube video today my computer started to show the usual Flash symptoms. The system fan sounded like it was taking off and the CPU usage was going through the roof, it also began to heat up to the point where I could not have it on my lap.</p>
<p><span id="more-90"></span>
<p>I have the <a href="http://rentzsch.github.com/clicktoflash/">ClickToFlash</a> Safari plugin installed which helps prevent a lot of these issues, but obviously if you want to watch a YouTube view you have to succumb to the evil of Flash right? Wrong!</p>
<p>YouTube for a while have been encoding their videos in the MP4 format using the h.264 compression standard. What this means is you can watch a video that is not encoded in Flash. Great but how do I access it I hear you ask. Well if you have ClickToFlash you can set it to load this version of the video by default:</p>
<p><img src="http://moose56.com/blog/wp-content/uploads/2009/10/ClickToFlash1.tiff" alt="ClickToFlash.tiff" border="0" width="330" height="62" /></p>
<p>Take a look at the different in Activity monitor between Flash and MP4.</p>
<p>First Flash:</p>
<p><img src="http://moose56.com/blog/wp-content/uploads/2009/10/Flash3.tiff" alt="Flash.tiff" border="0" width="466" height="558" /></p>
<p>Next MP4 using h.264 compression:</p>
<p><img src="http://moose56.com/blog/wp-content/uploads/2009/10/h2641.tiff" alt="h264.tiff" border="0" width="466" height="558" /></p>
<p>There is a massive difference in CPU usage. No wonder my laptop was getting hot while watching Flash video.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2009/10/17/flash-video-on-os-x-10-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google or Bing</title>
		<link>http://www.moose56.com/blog/2009/06/04/google-or-bing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-or-bing</link>
		<comments>http://www.moose56.com/blog/2009/06/04/google-or-bing/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 10:46:39 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/?p=69</guid>
		<description><![CDATA[So why do I use Google and not Bing? I want to find the homepage for Beanstalk (Version control with a human face), so I type &#8220;beanstalk&#8221; into Google and Bing. Google: First result Beanstalk. Just what I wanted. Bing: The site I want is not even on the first page of results. (it&#8217;s second [...]]]></description>
			<content:encoded><![CDATA[<p>So why do I use Google and not Bing?</p>
<p>I want to find the homepage for Beanstalk (Version control with a human face), so I type &#8220;beanstalk&#8221; into Google and Bing.</p>
<ul>
<li>Google: First result <a href="http://beanstalkapp.com">Beanstalk</a>. Just what I wanted.</li>
<li>Bing: The site I want is not even on the first page of results. (it&#8217;s second from bottom on page 2).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2009/06/04/google-or-bing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSSpress</title>
		<link>http://www.moose56.com/blog/2008/05/16/csspress/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=csspress</link>
		<comments>http://www.moose56.com/blog/2008/05/16/csspress/#comments</comments>
		<pubDate>Fri, 16 May 2008 20:51:35 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/?p=52</guid>
		<description><![CDATA[So today I launched a little command line application for compressing CSS files. My main motivations for this were that I wanted a little tool to strip out comments and whitespace as well as crunch down some of the style values into more optimized versions. As well as this I wanted to write a program [...]]]></description>
			<content:encoded><![CDATA[<p>So today I launched a little command line application for compressing CSS files.</p>
<p><span id="more-40"></span></p>
<p>My main motivations for this were that I wanted a little tool to strip out comments and whitespace as well as crunch down some of the style values into more optimized versions. As well as this I wanted to write a program in Ruby that someone else might actually find usefull as well as help me learn a little more about the language.</p>
<p>Currently it can do a pretty good job of removing the comments and the white space and I am working on the rest. You can find out more about it at <a href="http://www.csspress.net">csspress.net</a>.</p>
<h3>A long road</h3>
<p>What follows is a little account of how I got this far with it. If you don&#8217;t care about implementation stuff you probably don&#8217;t want to read on.</p>
<p>In order to distribute the tool I found that by packaging my application as a <a href="http://www.rubygems.org/">RubyGem</a> and hosting it on <a href="http://rubyforge.org/">RubyForge</a> anyone can download it simply by typing sudo gem install csspress (anyone on a mac that is) and they can use it right away. No difficult messing with source code.</p>
<p>In terms of writing it in Ruby, that was not crucial to the programs operation. From the users point of view they don&#8217;t care what its implemented in, only that it works. The advantage of using Ruby from my point of view is that I like programming with it and with the gem system it makes it child&#8217;s play to deploy it.</p>
<h3>Gems</h3>
<p>In order to package your code as a gem you have to use a specific directory structure. I already had a rudimentary working version of my application so I had to fit it in around this structure. It was a little trial and error at first and then I found <a href="http://newgem.rubyforge.org/">New Gem Generator</a>, this provides a command that generates the directory structure and as well as a load of useful files and rake tasks. You might find it a bit over the top (is so try <a href="http://seattlerb.rubyforge.org/hoe/">Hoe</a>), but after spending a bit of time and a little more trial and error I have come to really like it.</p>
<h3>Tips</h3>
<p>If you use a version control system like Subversion or Git you should ignore the doc/ and pkg/ directories as well as the index.html file, as these contain files that will change a lot and cause you a lot of problems.</p>
<p>I also found it useful to have a dig about in some of the gems I already had installed on my system. Its really good to see how other people have done it before you.<br />
<h3>What&#8217;s coming</h3>
<p>If I am honest it took me longer to set up the gem, SVN repository and rubyforge account than it did to write the program. Now its all in place though I can now get cracking on improving the tool and adding functionality.</p>
<p>Download it and give it a go; you might find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2008/05/16/csspress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This is very depressing!</title>
		<link>http://www.moose56.com/blog/2008/04/15/who-will-rid-me-of-this-turbulent-browser/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=who-will-rid-me-of-this-turbulent-browser</link>
		<comments>http://www.moose56.com/blog/2008/04/15/who-will-rid-me-of-this-turbulent-browser/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 15:19:59 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[IE]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/2008/04/15/who-will-rid-me-of-this-turbulent-browser/</guid>
		<description><![CDATA[Who will rid me of this turbulent browser? When will IE6 die a death? I know there are a few people out there who say quit complaining and live with it, but I really am fed up with having to accommodate it. End of rant.]]></description>
			<content:encoded><![CDATA[<p>Who will rid me of this turbulent browser?</p>
<p><span id="more-33"></span></p>
<p><img src="http://65.38.103.130/~moose56/blog/wp-content/uploads/2008/04/browsersie.jpg" alt="ie.jpg" border="0" width="199" height="150" /></p>
<p>When will IE6 die a death? I know there are a few people out there who say quit complaining and live with it, but I really am fed up with having to accommodate it.</p>
<p>End of rant.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2008/04/15/who-will-rid-me-of-this-turbulent-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have you been fireballed?</title>
		<link>http://www.moose56.com/blog/2008/03/14/have-you-been-fireballed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=have-you-been-fireballed</link>
		<comments>http://www.moose56.com/blog/2008/03/14/have-you-been-fireballed/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 00:17:16 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/2008/03/14/have-you-been-fireballed/</guid>
		<description><![CDATA[Daring Fireball the excellent blog by John Gruber occasionally brings sites to their knees in a digg-esk manner if he deems them worthy of a link. From this day on, the effect will be known as being FIREBALLED. (If this has already been done or has an even more witty name its my bad!) Update: [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://daringfireball.net">Daring Fireball</a> the excellent blog by John Gruber occasionally brings sites to their knees in a digg-esk manner if he deems them worthy of a link.</p>
<p>From this day on, the effect will be known as being <strong>FIREBALLED</strong>. <small>(If this has already been done or has an even more witty name its my bad!)</small></p>
<p>Update: John already uses it, Doh! Oh well back to the drawing board.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2008/03/14/have-you-been-fireballed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BBC iPlayer on the Mac</title>
		<link>http://www.moose56.com/blog/2008/02/19/bbc-iplayer-on-the-mac/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bbc-iplayer-on-the-mac</link>
		<comments>http://www.moose56.com/blog/2008/02/19/bbc-iplayer-on-the-mac/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 11:06:33 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/2008/02/19/bbc-iplayer-on-the-mac/</guid>
		<description><![CDATA[Recently the BBC have launched the iPlayer. This is a service which allows people to watch TV programs or listen to radio shows from that last 7 days again on their computer as many times as they like. That is unless they have a Mac. This is because the DRM they use is a Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p>Recently the BBC have launched the iPlayer. This is a service which allows people to watch TV programs or listen to radio shows from that last 7 days again on their computer as many times as they like. That is unless they have a Mac.</p>
<p><span id="more-28"></span></p>
<p>This is because the DRM they use is a Microsoft thing and so will not work on the OS X platform. I suppose this is not such a big deal because if you are running a modern Mac you may have a copy of windows installed and you can use that to run the iPlayer. The BBC have also made the programs available to stream online so that any flash enabled browser can show them.</p>
<p>So what&#8217;s the big issue, am I just a mac fanboy crying because they have ignored my beloved computer. No! I do however find it amusing that the BBC decided to rip of the &#8216;i&#8217; naming convention for their player and then not fully support the mac platform.</p>
<h3>A Solution?</h3>
<p>In setting up this system the BBC required some way of delivering content to computer users and limiting the length of time that the file was available or usable. They chose the Microsoft DRM method like Channel 4 and its 4 on demand service (another non mac service). What I think might have been a better option was to use iTunes. This is an application that I would guess is on the majority of macs even if the owners don&#8217;t use it. It also has a built in content delivery system and pretty good DRM. Content can also be viewed on iPods, iPhones and Apple TV with no extra work. It also plays nicely with Windows.</p>
<p>Now this nearly came to fruition yesterday when BBC World programs became available for purchase on the iTunes music store. I say nearly because only a handful of shows are available and you have to pay for them.</p>
<p>Now I guess that it is not as strait forward as it sounds to get Apple to put a load of video content on iTunes and then give it away for free (even for a limited period of 7 days a program). Their will be costs and by implementing their own system the BBC can keep a tighter grip on things. I just feel that they missed a great opportunity.</p>
<p>Mac users are not alone in this either because the iPlayer does not work on Linux and surprisingly Vista (yes the Microsoft Windows one!). It is not all bad news however because the BBC has been ordered to make the iPlayer multi platform and that the flash streaming alternative that they currently offer is not good enough.</p>
<p>Should be interesting to see how they finally sort this out.</p>
<h3>Update</h3>
<p>An article on the Register <a href="http://www.theregister.co.uk/2008/02/20/iplayer_flash_iphone/">here</a> indicates that the BBC will soon make the iPlayer available on the iPhone and the iPod Touch. This means they will have to provide another method of serving the programs rather that streaming flash video because neither of these devices support flash.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2008/02/19/bbc-iplayer-on-the-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mootools and its documentation</title>
		<link>http://www.moose56.com/blog/2008/02/14/a-very-unproductive-day-with-mootools-and-its-documentation/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-very-unproductive-day-with-mootools-and-its-documentation</link>
		<comments>http://www.moose56.com/blog/2008/02/14/a-very-unproductive-day-with-mootools-and-its-documentation/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 19:23:39 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/2008/02/14/a-very-unproductive-day-with-mootools-and-its-documentation/</guid>
		<description><![CDATA[So today I was trying to update my moose56.com homepage and thought I would add some javascript effects using the Mootools library. I have used the Script.aculo.us library before, but I thought I would try out Mootools as it has a really nice object orientated design. Now I don&#8217;t know if its just me, but [...]]]></description>
			<content:encoded><![CDATA[<p>So today I was trying to update my moose56.com homepage and thought I would add some javascript effects using the Mootools library.</p>
<p><span id="more-19"></span></p>
<p>I have used the <a href="http://script.aculo.us/">Script.aculo.us</a> library before, but I thought I would try out <a href="http://mootools.net/">Mootools</a> as it has a really nice object orientated design.</p>
<p>Now I don&#8217;t know if its just me, but I can&#8217;t make any sense of the documentation to the extent that I can only get things to work by following the examples which is fine until I can&#8217;t fine an example for what I need.</p>
<p>Where the documentations messes me up is that when I create an object I want to know its parameters and its methods. Now it does tell you all of this, but I really can&#8217;t see it clearly. If you are used to the Java or Ruby or any other programming documentation you will be very confused.</p>
<p>Anyway, hopefully I will figure it out eventually, maybe I am just a douche.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2008/02/14/a-very-unproductive-day-with-mootools-and-its-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending an email with PHP and Ruby</title>
		<link>http://www.moose56.com/blog/2008/01/23/sending-an-email-with-php-and-ruby/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sending-an-email-with-php-and-ruby</link>
		<comments>http://www.moose56.com/blog/2008/01/23/sending-an-email-with-php-and-ruby/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 12:26:48 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/2008/01/23/sending-an-email-with-php-and-ruby/</guid>
		<description><![CDATA[The other day I was trying to code a back end to a simple web form. I wanted the data entered into the form to be emailed back to me. Here I describe two very simple methods to send an email from both PHP and Ruby code. So why am I posting this? Well it [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was trying to code a back end to a simple web form. I wanted the data entered into the form to be emailed back to me. Here I describe two very simple methods to send an email from both PHP and Ruby code.</p>
<p><span id="more-13"></span></p>
<p>So why am I posting this? Well it took a bit of fishing to find some of the information so I thought this might help someone in the future. Also if you google anything to do with Ruby and web development you can&#8217;t get away from heaps Rails stuff which is not what I was after so this post might help.</p>
<h2>PHP</h2>
<p>PHP was built for this sort of thing so I was expecting it to be pretty easy and I was not disappointed. The actual function to send a mail is called&#8230;yep mail. The php documentation lists it as:</p>
<pre class="viewsource"><code class="php">bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )</code></pre>
<p>With this its simple to code up a working version:</p>
<pre class="viewsource"><code class="php">
// pick up values from form
$name = $_POST['name'];
$email = $_POST['email'];
$comment = $_POST['comment'];

// create email message
$from = $email;
$to = "some@address.com";
$subject = "Some subject";
$message = wordwrap(stripcslashes($comment), 70);
$headers = "From: $name &lt;$from&gt;" . "rn";

// send email
mail($to, $subject, $message, $headers);
</code></pre>
<p>Thats it, simply point the action attribute of your form to this script file and it will pick up the form data and send it off in an email to who ever you want.</p>
<p>Obviously this is a pretty basic example and you would need to add some form validation and a redirect when the script has completed otherwise the user will be directed to a totally blank page.</p>
<p>One other cool thing is that because the mail funciton returns a bool to can stick it in an if statement:</p>
<pre class="viewsource"><code class="php">
if (!mail($to, $subject, $message, $headers)){
  // redirect to fatal error page
  // or stick an entry in a log file
  // exit the script
}

//everything fine and dandy, continue
</code></pre>
<h2>Ruby</h2>
<p>Ok so I tried it in Ruby because it is my current language du jour and I did not want to see it outdone by PHP. Sadly however I have to admit it was not as simple as the PHP method.  Here is the listing:</p>
<pre class="viewsource"><code class="ruby">
require "net/smtp"

# set up smtp object
server = Net::SMTP.new('you.domain.com', 25,
  'localhost.localdomain', 'username', 'password', :login)

# message template
myMessage = &lt;&lt;END_OF_MESSAGE
From: Name &lt;some.address@mail.com&gt;
To: Name &lt;some@address.com&gt;
Subject: Some subject

This is the message text
END_OF_MESSAGE

# send the email
server.start do |smtp|
  smtp.sendmail myMessage, "from@mail.com",
    "to@mail.com", "to@mail.com"
end
</code></pre>
<p>There are a few more things to set up in the Ruby version, namely an SMTP object. This is because to send the email you need to provide a SMTP server. You do this by providing the domain, port number and if needed the username and password plus the authentication type of your domains SMTP server.</p>
<p>The sendmail method then takes the message, from address, and a list of addresses to send the email to.</p>
<p>One thing to note is that both sendmail and start can kick out a load of different errors so it would be better to wrap it in a begin rescue statement.</p>
<p>A few resources for the ruby version are:</p>
<ul>
<li><a href="http://ruby.about.com/od/tutorials/ss/ruby_email.htm">A fuller tutorial than this</a></li>
<li><a href="http://www.ruby-doc.org/stdlib/libdoc/net/smtp/rdoc/index.html">Ruby doc for NET::SMTP</a></li>
<li><a href="http://spariamsgems.blogspot.com/2007/12/sending-e-mail-with-ruby-netsmtp.html">Another good example of the Ruby method</a></li>
</ul>
<p>Ok I admit this was a very brief intro into sending email from code using Ruby or PHP, but I hope It might point some people in the right direction.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2008/01/23/sending-an-email-with-php-and-ruby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web site development with StaticMatic</title>
		<link>http://www.moose56.com/blog/2008/01/11/web-site-development-with-staticmatic/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=web-site-development-with-staticmatic</link>
		<comments>http://www.moose56.com/blog/2008/01/11/web-site-development-with-staticmatic/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 12:39:41 +0000</pubDate>
		<dc:creator>moose56</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://moose56.com/blog/2008/01/11/web-site-development-with-staticmatic/</guid>
		<description><![CDATA[StaticMatic is a small framework for producing static web sites. It is built on top of a number of Ruby gems such as Haml and makes it possible to create totally static sites using Ruby. I have spent a bit of time playing with StaticMatic and thought I would share some of the things I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://staticmatic.rubyforge.org/">StaticMatic</a> is a small framework for producing static web sites. It is built on top of a number of Ruby gems such as <a href="http://haml.hamptoncatlin.com/docs/rdoc/classes/Haml.html">Haml</a> and makes it possible to create totally static sites using Ruby.</p>
<p>I have spent a bit of time playing with StaticMatic and thought I would share some of the things I have learnt just in case anyone else has the same questions as I did.</p>
<p><span id="more-12"></span></p>
<h2>Haml Syntax Highlighting</h2>
<p>First off I use TextMate for editing. In order to make more sense of the the Haml markup which I was totally new to, I found this page with a link to a svn repository where you can download a TextMate bundle for Haml: <a href="http://wincent.com/knowledge-base/Installing_the_Haml_TextMate_bundle">Installing the Haml TextMate bundle</a>. The only difference I had with the instructions was that I had to create a bundles directory which is no big deal. After that I switched TextMate&#8217;s language association option (located at the bottom of the window) to Ruby Haml and everything was great. I also found that the Blackboard theme worked quite will with it.</p>
<h2>Setting up Helpers</h2>
<p>As StaicMatic is based in part on Ruby on Rails there is the ability to define helper functions. There is even a page on the StaticMatic website where developers can upload there own for others to use.</p>
<p>The problem I had was that I could not find out how to set up a helper function in words of one syllable in the documentation and had to piece it together from a few different sources.</p>
<p>When you create your StaticMatic site it will make an empty directory called helpers, but thats it. In order to add a helper function to your site you need to create a file in this directory called application_helper.rb (think rails). In this add the module definition:</p>
<pre><code class="ruby">
module ApplicationHelper
end
</code></pre>
<p>Add any function you like to this module and it will be available to you from all haml files simply buy using:</p>
<pre class="viewsource"><code class="ruby">
= function_name(params)
</code></pre>
<h2>Using Partials</h2>
<p>This is pretty strait forward but may catch some out (it did me). If you place a partial directly in the partials directory do not prefix the filename with an underscore or it will not be able to find the partial file.</p>
<h2>Things to look out for</h2>
<p>I had a lot of problems with tab characters in my Haml files. This is very annoying as the page will not display and the error message from the terminal is not useful at all. The best way I found to overcome it was to use soft tabs, 2 characters wide and if I pasted in any code to always manually re-indent it. This is a pain I know, but so is bug hunting an invisible bug for hours.</p>
<p>Hope this is of some help to some one, below is a list of the web pages I have found useful.</p>
<ul>
<li><a href="http://haml.hamptoncatlin.com/docs/rdoc/classes/Haml.html">Haml docs</a></li>
<li><a href="http://wincent.com/knowledge-base/Installing_the_Haml_TextMate_bundle">Install TextMate bundle</a></li>
<li><a href="http://www.planetrubyonrails.org/show/feed/187">Some tips from Planet Ruby on Rails</a></li>
<li><a href="http://www.danielfischer.com/2007/11/08/static-websites-the-ruby-way-part-2/">Tips from Daniel Fischer</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.moose56.com/blog/2008/01/11/web-site-development-with-staticmatic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

