<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>27smiles</title>
	
	<link>http://27smiles.com</link>
	<description>The Zen of Design, Coding &amp; Happiness</description>
	<pubDate>Wed, 20 Aug 2008 20:14:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/27smiles" type="application/rss+xml" /><item>
		<title>Simple backup script written in Ruby</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/368237789/</link>
		<comments>http://27smiles.com/2008/08/18/simple-backup-script-written-in-ruby/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 16:44:23 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[Projects]]></category>

		<category><![CDATA[backup]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[osx]]></category>

		<category><![CDATA[rsync]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://27smiles.com/?p=212</guid>
		<description><![CDATA[I&#8217;ve written a simple backup script in Ruby that utilises Rsync I&#8217;ve made it public so feel free to fork, change and contribute!
The backups are structured as such:
/remote/location/current - The current folder contains the the latest clone of the intended backup folder.
/remote/location/backup_dir - The backup directory, which by default is the current day (monday, tuesday, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a simple backup script in <a href="http://www.ruby-lang.org/en/">Ruby</a> that utilises <a href="http://samba.anu.edu.au/rsync/">Rsync</a> I&#8217;ve made it public so feel free to fork, change and contribute!</p>
<p>The backups are structured as such:</p>
<p>/remote/location/current - The current folder contains the the latest clone of the intended backup folder.<br />
/remote/location/backup_dir - The backup directory, which by default is the current day (monday, tuesday, etc) contains<br />
the difference to current since it was last run. So it will contain any new files and any files that were deleted.</p>
<p>I need to add a few examples of the settings and how to use it via cron on Linux and Launchd on OS X but the basic script should be working fine.</p>
<p>The script can be found on my <a href="http://github.com/RichGuk">github account</a>, <a href="http://github.com/RichGuk/rrsync/tree/master">http://github.com/RichGuk/rrsync/tree/master</a></p>
<p>You can simply clone it with the following command:</p>
<p><strong>git clone git://github.com/RichGuk/rrsync.git</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/08/18/simple-backup-script-written-in-ruby/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/08/18/simple-backup-script-written-in-ruby/</feedburner:origLink></item>
		<item>
		<title>Setting up Xen on Debian etch (64bit)</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/359265647/</link>
		<comments>http://27smiles.com/2008/08/08/setting-up-xen-on-debian-etch-64bit/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 09:20:12 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[How-to]]></category>

		<category><![CDATA[debian]]></category>

		<category><![CDATA[Dom0]]></category>

		<category><![CDATA[DomU]]></category>

		<category><![CDATA[server]]></category>

		<category><![CDATA[virtual servers]]></category>

		<category><![CDATA[VPS]]></category>

		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://27smiles.com/?p=184</guid>
		<description><![CDATA[Today I decided to setup Xen (not the Half-Life world) on a clean Debian installation so I could have a few VPSes to play around with load balancing mySQL, FastCGI and Mongrel. I thought I&#8217;d break down the steps I went though to get the basic Xen setup working.
Note: This is by no means a [...]]]></description>
			<content:encoded><![CDATA[<p>Today I decided to setup <a href="http://www.xen.org/">Xen</a> (not the Half-Life world) on a clean <a href="http://www.debian.org/">Debian</a> installation so I could have a few <a href="http://en.wikipedia.org/wiki/Virtual_private_server">VPSes</a> to play around with load balancing <a href="http://www.mysql.com/">mySQL</a>, <a href="http://www.fastcgi.com/">FastCGI</a> and <a href="http://mongrel.rubyforge.org/">Mongrel</a>. I thought I&#8217;d break down the steps I went though to get the basic Xen setup working.</p>
<p><strong><em>Note: This is by no means a perfect setup, it&#8217;s more of a quick way to play around with Xen using a spare PC in the home. If you want more of a production level setup I suggest checking out the Xen website, or Google.</em></strong></p>
<h2>Step 1. Install Debian (Etch)</h2>
<p>Here you just need to setup a standard Debian system, I&#8217;m using the 64bit edition of Etch but the process is the same for most Debian releases. I won&#8217;t go into detail on how to setup Debian as there are plenty of how-tos out there, for me the normal setup was fine. During the installation I gave the machine <strong>judgement</strong> as the hostname and <strong>gnet.foo</strong> as the domain (you can use whatever) I also unchecked <strong>desktop</strong> from the selectable software menu as I didn&#8217;t need/or want a GUI.</p>
<h2>Step 2. Configure Debian ready for Xen</h2>
<p>Once you&#8217;ve booted and logged into your system you need to install a few applications, but before we do that I tend to remove the CD source from apt-get&#8217;s sources.list:</p>
<pre class="syntax-highlight:php">vim /etc/apt/sources.list
#comment out the CD line
#deb cdrom:[Debian...........
apt-get update</pre>
<p>Now install the packages (remove <strong>vim-full</strong> if you're not using vim):</p>
<pre class="syntax-highlight:php">apt-get install ssh build-essential vim-full</pre>
<p>Next we need to configure the server to use a static IP (if you didn't during the installation). I gave my box (<strong>judgement</strong>) a static IP of <strong>192.168.1.10</strong>. Open up the interfaces file:</p>
<pre class="syntax-highlight:php">vim /etc/network/interfaces</pre>
<p>Now if you selected DHCP during the installation your file should look similar to this by default (eth2 was my interface, yours might be different):</p>
<pre class="syntax-highlight:php">
allow-hotplug eth2
iface eth2 inet dhcp
</pre>
<p>Change yours to match this (of course change eth2 to match yours and whatever IP you wish to use):</p>
<pre class="syntax-highlight:php">auto eth2
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1</pre>
<p>Once you've done that you need to restart the networking:</p>
<pre class="syntax-highlight:php">/etc/init.d/networking restart</pre>
<p>If all is working then you should be able to ping other computers on your network and they should be able to ping your machine.</p>
<p>If you wish you can continue the rest of the setup via SSH (on windows you can use <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">Putty</a>).</p>
<p>Finally just make sure your system is up-to-date before giving it a reboot:</p>
<pre class="syntax-highlight:php">apt-get upgrade
shutdown -r now</pre>
<h2>Step 3. Installing Xen</h2>
<p>There are two main options when it comes to installing Xen. You can compile it from the source code or simply use apt-get, the latter worked fine for me and is dead simple...to install via apt-get use the following command (bridge-utils is used to setup the network for the virtual machines):</p>
<pre class="syntax-highlight:php">apt-get install xen-linux-system-2.6.18-6-xen-amd64 bridge-utils</pre>
<p>The version of Xen kernel might of changed since writing this, try this command to see what's there:</p>
<pre class="syntax-highlight:php">apt-cache search xen-linux</pre>
<p>When that has finished installing give the machine a reboot and select Xen kernel from the GRUB menu (for me it became the default option):</p>
<pre class="syntax-highlight:php">shudown -r now</pre>
<p>Once the system is back up and logged in (your previous credentials should work) check that you've booted the correct kernel:</p>
<pre class="syntax-highlight:php">uname -r</pre>
<p>It should read something <strong>like 2.6.18-6-xen-amd64</strong> if not then you've most likely booted the wrong kernel from GRUB.</p>
<h2>Step 4. Creating virtual images or DomU's (the VPSes)</h2>
<p>To help with creating, starting, stopping, etc... you need to install xen-tools:</p>
<pre class="syntax-highlight:php">apt-get install xen-tools</pre>
<p>Next we need to create the place we want to store the domains (virtual servers), I put mine in /home/xen (xen requires a folder called domains within this folder) so run this command:</p>
<pre class="syntax-highlight:php">mkdir -p /home/xen/domains</pre>
<p>Once you've created the location to store the domains you need to edit a few options in Xen's configuration. Start by opening up <strong>xend-config.sxp</strong>:</p>
<pre class="syntax-highlight:php">vim /etc/xen/xend-config.sxp</pre>
<p>and look this for line (around <strong>line 70</strong> for me):</p>
<pre class="syntax-highlight:php">##
# To bridge network traffic, like this:
#
# dom0: fake eth0 -&gt; vif0.0 -+
#                            |
#                          bridge -&gt; real eth0 -&gt; the network
#                            |
# domU: fake eth0 -&gt; vifN.0 -+
#
# use
#
# (network-script network-bridge)</pre>
<p>and uncomment the <strong>network-script network-bridge</strong> part so it looks like this:</p>
<pre class="syntax-highlight:php">##
# To bridge network traffic, like this:
#
# dom0: fake eth0 -&gt; vif0.0 -+
#                            |
#                          bridge -&gt; real eth0 -&gt; the network
#                            |
# domU: fake eth0 -&gt;; vifN.0 -+
#
# use
#
(network-script network-bridge)</pre>
<p>Now we need to setup some defaults as well as the location to store the domains by opening up <strong>xen-tools.conf</strong>:</p>
<pre class="syntax-highlight:php">vim /etc/xen-tools/xen-tools.conf</pre>
<p>There are several things to comment out and change here so I'll just list the values I changed in mine:</p>
<pre class="syntax-highlight:php">...
dir = /home/xen
...
debootstrap = 1
...
dist = etch
#If you want to give your domains static IP&#039;s rather than use DHCP (which I did then you can setup the default gateway/netmask)
gateway = 192.168.1.1
netmask = 255.255.255.0
...
#This bit is important, as mine differed to the default you need to change kernel and initrd to point to the right ones (ls /boot/* - to find out)
kernel = /boot/vmlinuz-2.6.18-6-xen-amd64
initrd = /boot/initrd.img-2.6.18-6-xen-amd64
...
#Change this to your prefered mirror (for me that&#039;s the UK):
mirror = http://ftp.uk.debian.org/debian/</pre>
<p>Restart Xen to make sure the configuration loads correctly:</p>
<pre class="syntax-highlight:php">/etc/init.d/xend restart</pre>
<p>You should now be ready to create your first domain. If you're happy with the defaults in the <strong>xen-tools.conf</strong> file then you can leave a lot of the options out or you can of course put them as arguments of the command, check the man pages for <strong>xen-create-image</strong> for more information:</p>
<pre class="syntax-highlight:php">xen-create-image --hostname=i-am-webial --ip=192.168.1.11 --netmask=255.255.255.0 --gateway=192.168.1.1 --passwd</pre>
<p>You should see output of something like this:</p>
<pre>General Infomation
--------------------
Hostname       :  i-am-webial
Distribution   :  etch
Fileystem Type :  ext3

Size Information
----------------
Image size     :  4Gb
Swap size      :  128Mb
Image type     :  sparse
Memory size    :  128Mb
Kernel path    :  /boot/vmlinuz-2.6.18-6-xen-amd64
Initrd path    :  /boot/initrd.img-2.6.18-6-xen-amd64

Networking Information
----------------------
IP Address 1   : 192.168.1.11
Netmask        : 255.255.255.0
Gateway        : 192.168.1.1

Creating swap image: /home/xen/domains/i-am-webial/swap.img
Done

Creating disk image: /home/xen/domains/i-am-webial/disk.img
Done

Creating ext3 filesystem on /home/xen/domains/i-am-webial/disk.img
Done

Installing your system with debootstrap mirror http://ftp.uk.debian.org/debian/
....
....
....</pre>
<p>Once it's finished you can start your domain by using the following command:</p>
<pre class="syntax-highlight:php">xm create /etc/xen/i-am-webial.cfg</pre>
<h2>Extra Stuff</h2>
<p>Open a console for the domain:</p>
<pre class="syntax-highlight:php">xm console i-am-webial</pre>
<p>you can exit the console by doing <strong>Ctrl + ]</strong>.</p>
<p>To shutdown a domain:</p>
<pre class="syntax-highlight:php">xm shutdown i-am-webial</pre>
<p>Increase the RAM of the domain:</p>
<pre class="syntax-highlight:php">vim /etc/xen/i-am-webial.cfg</pre>
<p>find and edit <strong>memory</strong></p>
<pre class="syntax-highlight:php">memory  = &#039;512&#039;</pre>
<p>Resize the swap to 1GB (<strong>Resize Xen DomU swap</strong>):</p>
<pre class="syntax-highlight:php">cd /home/xen/domains/i-am-webial
dd if=/dev/zero of=swap.img bs=1024k count=1024
mkswap swap.img</pre>
<p>Expand the file system by 4 GB (<strong>Resize Xen DomU disk</strong>)</p>
<pre class="syntax-highlight:php">dd if=/dev/zero bs=1GB count=4 &gt;&gt; disk.img
resize2fs -f disk.img</pre>
<p>Hopefully you should now all be setup with basic VPSes, if you need any help with problems please feel free to contact me. You may also leave any feedback/comments you wish below.</p>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/08/08/setting-up-xen-on-debian-etch-64bit/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/08/08/setting-up-xen-on-debian-etch-64bit/</feedburner:origLink></item>
		<item>
		<title>Setting up Nginx with Rails</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/344832723/</link>
		<comments>http://27smiles.com/2008/05/22/setting-up-nginx-with-rails/#comments</comments>
		<pubDate>Thu, 22 May 2008 10:58:56 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[How-to]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[server]]></category>

		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://localhost/~rich/wp_27smiles/?p=18</guid>
		<description><![CDATA[So the other day I decided to switch from using Apache to Nginx not because apache isn&#8217;t any good, far from it.  Nginx just uses much less ram and when you&#8217;re on a fairly small slice, using up more ram just isn&#8217;t good. I was going to benchmark speed and things between apache and [...]]]></description>
			<content:encoded><![CDATA[<p>So the other day I decided to switch from using <a href="http://www.apache.org">Apache</a> to <a href="http://nginx.net/">Nginx</a> not because apache isn&#8217;t any good, far from it.  Nginx just uses much less ram and when you&#8217;re on a fairly small slice, using up more ram just isn&#8217;t good. I was going to benchmark speed and things between apache and nginx but I forgot to take some readings before stopping the apache service and installing nginx so we&#8217;ll skip over that idea like the thought never came into my head.</p>
<p>I&#8217;ll mention a few things I like about nginx first:</p>
<ol>
<li><strong>It&#8217;s Russian</strong> -Being Russian it makes me feel like a communist, which is fun. It also reminds me of being build to take all things thrown at it.</li>
<li><strong>It uses a lot less memory</strong> - As I said before, not really done much benchmarks so these were some quick figures from &#8216;top&#8217; but I had apache running with about 5 instances each using 2-3% of ram even at 2% each that&#8217;s still 10% of ram being used just for apache&#8230; with nginx I appear to have 2 instances running both using 0.2% of ram, so 0.4% in total - which is a nice difference.</li>
<li><strong>Faster page serving </strong>- Now this is meant to be a server fast at serving static content so its not just be me but I find the site much quicker compared to when it used to be on apache (all the sites in fact). I&#8217;m not to sure if I just think it&#8217;s quicker, the slice has more ram free so never going into swap or&#8230;. it is just a lot quicker at serving pages.</li>
</ol>
<p><span id="more-18"></span></p>
<h2>Installing nginx</h2>
<p>I follow pretty much most of these from <a href="http://articles.slicehost.com">slicehost&#8217;s articles</a> but I didn&#8217;t find an article on how to setup the sites-available and sites-enabled type directories for Debian (if you compile from source), so I&#8217;ll cover that here.</p>
<p>On Debian the package manager contains a rather outdated version of nginx so I&#8217;d recommend installing it from the latest source. we&#8217;ll start by making sure you have all the required library&#8217;s:</p>
<pre class="syntax-highlight:php">sudo apt-get install build-essential libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-de
sudo apt-get build-dep nginx</pre>
<p>When you&#8217;re ready you need to obtain the latest source from the nginx website, the latest stable when writing this was 0.6.31.</p>
<pre class="syntax-highlight:php">cd ~
mkdir sources
cd sources
wget http://sysoev.ru/nginx/nginx-0.6.31.tar.gz
tar xvzf nginx-0.6.31.tar.gz
cd nginx-0.6.31</pre>
<p>There are a few options we need to set when compiling from source. I wanted my nginx configuration files in <strong>/etc/nginx</strong> instead of the default, so you may ignore this option (&#8211;conf-path) if you prefer the defaults.</p>
<p>We also need to change the location of where nginx puts it&#8217;s binary files using the <strong>&#8211;sbin-path</strong> option because by default this path is set to <strong>/usr/local/nginx</strong> meaning the binary files would be in <strong>/usr/local/nginx/sbin/nginx</strong><br />
which won&#8217;t be in our PATH setting, this option will allow the binary files<br />
to be placed where it can be found.</p>
<p>The last option will compile nginx<br />
with the ssl module, so we can have ssl conections.</p>
<pre class="syntax-highlight:php">sudo mkdir /etc/nginx
./configure --sbin-path=/usr/local/sbin --conf-path=/etc/nginx/nginx.conf --with-http_ssl_module
make</pre>
<p>When the configuration has finish you can compile and install it using make:</p>
<pre class="syntax-highlight:php">sudo make install</pre>
<p>This should hopefully of installed nginx into <strong>/usr/local/nginx</strong> and the configuration files into <strong>/etc/nginx</strong>.</p>
<p>When compiling from source we need to make the <strong>/etc/init.d</strong> script ourselves otherwise we&#8217;ll have no way of starting, stopping and restarting nginx. Slicehost have a script on one of their articles that should be suitable here, so we&#8217;ll download it and move it to the right directory.</p>
<pre class="syntax-highlight:php"> cd ~
wget http://articles.slicehost.com/assets/2007/10/19/nginx
chmod +x nginx
sudo mv nginx /etc/init.d/nginx  </pre>
<p>Then finally add it to all the default run levels.</p>
<pre class="syntax-highlight:php">sudo /usr/sbin/update-rc.d -f nginx defaults</pre>
<p>You should now be able to start nginx and browse to it <strong>http://127.0.0.1</strong> (change with your servers IP). If all is working OK you should see a message that says &#8220;Welcome to nginx&#8221;.</p>
<pre class="syntax-highlight:php">sudo /etc/init.d/nginx start</pre>
<h2>Configuration for Nginx</h2>
<p>The compiled version of nginx doesn&#8217;t quite have the structure you would have if you&#8217;d installed it from apt-get, the package manager sets up a familiar structure to Apache having the <strong>/etc/nginx/sites-available</strong> and <strong>/etc/nginx/sites-enabled </strong>directories, I find this to be a good way of organising all your virtual hosts so lets add that feature.</p>
<pre class="syntax-highlight:php">sudo mkdir /etc/nginx/sites-available
sudo mkdir /etc/nginx/sites-enabled
sudo vim /etc/nginx/nginx.conf</pre>
<p>After we&#8217;ve created the two directories we&#8217;ll open the nginx.conf file so we can add the following line which will include our virtual host files.</p>
<pre class="syntax-highlight:php">include /etc/nginx/sites-enabled/*;</pre>
<p>I was unsure the best place to put this so I placed mine after the server {} block, like this.</p>
<pre class="syntax-highlight:php">http {
......
server {
......
}
include /etc/nginx/sites-enabled/*;
}</pre>
<p>Once you have done that we are ready to setup our virtual host, for this well proxy all the dynamic content to mongrel and serve all static content using nginx.</p>
<pre class="syntax-highlight:php">sudo vim /etc/nginx/sites-available/site_name</pre>
<p>You&#8217;ll want to replace the <strong>site_name</strong> with the name of your site. Into this file paste the following:</p>
<pre class="syntax-highlight:php">#Setup the location of your mongrel servers.
upstream give_proxy_a_name {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}
#Rename www.site_name.com to site_domain.com
#Remove this if this is something you don&#039;t want.
server {
listen   80;
server_name  www.site_name.com;
rewrite ^/(.*) http://site_name.com/$1 permanent;
}
server {
listen   80;
server_name site_name.com;
#Setup nginx logs.
access_log /path/to/rails/project/log/access.log;
error_log /path/to/rails/project/log/error.log;
root   /path/to/rails/project/public/;
index  index.html;
location / {
proxy_set_header  X-Real-IP  $remote_addr;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://give_proxy_a_name;
break;
}
}
}</pre>
<p>Replace <strong>site_name.com</strong> with your domain. You can also rename <strong>give_proxy_a_name</strong> to something else, the name of your site (e.g. 27smiles) should be fine here.</p>
<p>So what does some of that mean? Well the <strong>log</strong> and <strong>root</strong> stuff are pretty straight forward, they define where to put the logs and the what the root folder for the domain is, which in the case of rails will be the public folder within the rails project.</p>
<pre class="syntax-highlight:php">upstream give_proxy_a_name {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}</pre>
<p style="padding-left: 30px;">This is where you setup the mongrel cluster, for each mongrel server you have running you will need to put a server directive here nginx will then load balance between the servers.</p>
<pre class="syntax-highlight:php">location / {
proxy_set_header  X-Real-IP  $remote_addr;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://give_proxy_a_name;
break;
}
} </pre>
<p>There are 3 IF statements to this bit, the first checks to see if an index.html file exists and if it does then nginx will serve it rather than passing it onto mongrel.</p>
<p>The 2nd IF does pretty much the same but it looks for a html file with the same name as the request. So say you requested <strong>site_name.com/about</strong> it will attempt to find a file called <strong>about.html</strong> in the public folder of the rails project and serve it rather than passing it onto mongrel. This means that if you&#8217;re using page caching in rails you can skip mongrel for cached pages - very good on performance.</p>
<p>The 3rd IF makes sure the file doesn&#8217;t exist before passing the request onto mongrel. For example say you requested <strong>site_name.com/images/logo.png</strong> nginx would attempt to locate the file and serve it rather than passing the request on to mongrel, this means you can serve all your static content using nginx instead of mongrel which is much much quicker.</p>
<p>When you&#8217;ve setup your virtual host you need to create a symlink to the sites-enabled folder in order for it to work.</p>
<pre class="syntax-highlight:php">sudo ln -s /etc/nginx/sites-available/site_name /etc/nginx/sites-enabled/site_name</pre>
<p>And then finally restart the nginx server.</p>
<pre class="syntax-highlight:php">sudo /etc/init.d/nginx restart</pre>
<p>If all went OK you should be able to browse to your domain name and see your rails project. If not then make sure you created the link to the sites-enabled folder and also that you actually have some mongrel instances running on the IP&#8217;s you defined (I think you&#8217;ll get bad gateway messages if it can&#8217;t find mongrel).</p>
<p>If you need help setting up mongrel head over to <a href="http://articles.slicehost.com">slicehost&#8217;s article</a> page they have some good articles on how to do it.</p>
<h2>Extra configuration options</h2>
<p>There are a few extra configuration options in nginx that I use on 27smiles; gzip, expiry headers, on another site I also use HTTP authentication. I thought I&#8217;d list them here for some people.</p>
<p>If you&#8217;re looking to setup gzip compression on nginx then add the following.</p>
<pre class="syntax-highlight:php">gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types      text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;</pre>
<p>If you&#8217;re looking to set some expiry headers to images, etc in nginx try this.</p>
<pre class="syntax-highlight:php">location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
expires 30d;
break;

}</pre>
<p>And finally if you want to password protect domain try this.</p>
<pre class="syntax-highlight:php">
auth_basic &quot;Restricted&quot;;
auth_basic_user_file /path/to/htpasswd/file;</pre>
<p>If you need any help or have any questions feel free to <a href="http://27smiles.com/contact">contact me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/05/22/setting-up-nginx-with-rails/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/05/22/setting-up-nginx-with-rails/</feedburner:origLink></item>
		<item>
		<title>Come back in focus again</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/344832724/</link>
		<comments>http://27smiles.com/2008/05/15/come-back-in-focus-again/#comments</comments>
		<pubDate>Thu, 15 May 2008 10:59:30 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://localhost/~rich/wp_27smiles/?p=45</guid>
		<description><![CDATA[Off to see Kerry at aber this weekend so thought I&#8217;d pump out a quick youtube Friday before I head off.
First off I thought I&#8217;d start with the Floyd, this is from division bell, which is one of my favourite Pink Floyd album.

http://www.youtube.com/watch?v=RuG_316cPMY

Next up a bit of Thom, not to sure if I&#8217;ve posted this [...]]]></description>
			<content:encoded><![CDATA[<p>Off to see Kerry at aber this weekend so thought I&#8217;d pump out a quick youtube Friday before I head off.</p>
<p>First off I thought I&#8217;d start with the Floyd, this is from division bell, which is one of my <span class="p">favourite</span> Pink Floyd album.</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521cd479f"><a href="http://www.youtube.com/watch?v=RuG_316cPMY">http://www.youtube.com/watch?v=RuG_316cPMY</a></p>
</div>
<p>Next up a bit of Thom, not to sure if I&#8217;ve posted this before - I have yet to import posts from the old blog. I&#8217;m sure you can survive having to watch it again&#8230;..after all it is Thom <img src='http://27smiles.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521cd6e6f"><a href="http://www.youtube.com/watch?v=Z1nFB-R-_gI">http://www.youtube.com/watch?v=Z1nFB-R-_gI</a></p>
</div>
<p>Finally I thought I&#8217;d post this video I found, I was orginally going to find Bob&#8217;s version, and then the one thats playing at the end of the last season of<span class="l"> Battlestar Galactica but instead I found this insane child playing it like a pro. Enjoy (All along the watch tower btw).</span></p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521cd95ca"><a href="http://www.youtube.com/watch?v=_YEXMU711y0">http://www.youtube.com/watch?v=_YEXMU711y0</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/05/15/come-back-in-focus-again/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/05/15/come-back-in-focus-again/</feedburner:origLink></item>
		<item>
		<title>I love web frameworks, why don’t you?</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/344832728/</link>
		<comments>http://27smiles.com/2008/05/11/i-love-web-frameworks-why-dont-you/#comments</comments>
		<pubDate>Sun, 11 May 2008 11:07:30 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[Grind My Gears]]></category>

		<category><![CDATA[cakephp]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[development]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ranting]]></category>

		<guid isPermaLink="false">http://localhost/~rich/wp_27smiles/?p=50</guid>
		<description><![CDATA[Lately I&#8217;ve become fanatical over web frameworks, mainly Django, Rails and CakePHP. Something about them just clicks, maybe its because I can go back to a rails app months after I&#8217;ve written it, even with no comments, and just know where each file is likely to be and where to find a certain method. Also [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve become fanatical over web frameworks, mainly <a href="http://www.djangoproject.com">Django</a>, <a href="http://www.rubyonrails.org">Rails</a> and <a href="http://www.cakephp.org">CakePHP</a>. Something about them just clicks, maybe its because I can go back to a rails app months after I&#8217;ve written it, even with no comments, and just know where each file is likely to be and where to find a certain method. Also I can create <a href="http://en.wikipedia.org/wiki/Create%2C_read%2C_update_and_delete">CRUD</a> (Create, Read, Update and Delete) functionality in seconds as most frameworks provide some form of scaffold, something that would take time to produce without a framework in something like PHP.</p>
<p>If there is one thing that pisses me off about frameworks - it&#8217;s the people who don&#8217;t like them. If like me you&#8217;ve read a lot of people talking about how crap frameworks are? How they don&#8217;t see the point: &#8220;What&#8217;s the point in a framework? I can just find all the different library&#8217;s I need such as templating, databases and include them in my app&#8221;. Why? Why would you want to waste your time including a database class, setting it up and then going to find a template engine to include and then setting that up too! When the framework will just give you that from the word go. It just confuses me. Then there is the fact that with most frameworks you get nice clean URL&#8217;s, free without having to do anything. try doing that in your simple PHP app without doing some form of mod_rewrite YOURSELF.</p>
<p>Most frameworks will log errors, show debug information (in development mode), give you the option of simply editing a file (not having to set it up too) to get nice 404/500 type errors. Something that would require you to make your own form of exceptions, your own error logging if you were not using a framework, which would do it all for you.</p>
<p>Another thing that pisses me off about not having a framework - is validating form inputs. Argh, it annoys me so much having to do lots of if statements to check if a field is empty, having to do a query to check a field isn&#8217;t already taken. In a framework, for example rails I just have to do:</p>
<pre class="syntax-highlight:ruby">validates_presence_of :title</pre>
<p>Tell me again why people prefer to spend ages writing if statements and queries to check form data?</p>
<p>People will always try to say &#8220;I don&#8217;t like being told how I should code&#8221; - Fuck me, yes maybe&#8230;maybe there are some standards you have to stick to in frameworks and if you&#8217;re totally mentally retarded you might think this is horrible idea to have to agree on a naming convention for the benefit of others. It&#8217;s like these people have never worked with other people? At work we&#8217;ve had entire meetings just agreeing on a standard form of code to use, have you ever tried submitting a PEAR class?! talk about anal. I&#8217;ve found apart with some naming conventions you can pretty much code however the hell you like in a framework - much like you can if you were not using a framework!</p>
<p>From my experience so far I&#8217;ve never had a website that has not fitted the framework type model&#8230; now I&#8217;m sure there are loads of sites that would not work at all in a framework and the anti-framework people will be the first to tell you but that&#8217;s fair enough if it doesn&#8217;t fit the model then you don&#8217;t have much choice. But these people do it out of choice?! Are they better than us mortals? Do they know something we don&#8217;t? No! from my experience the people who shoot down using a framework to speed up development, to help bring out creativity, to help with debuging, these people are generally scared to learn something new, scared to well&#8230;learn. They refuse to even look becuase they know it&#8217;ll be something else that&#8217;s not what they know, even if the current method they use is rubbish.</p>
<p>All this technology, all the advances in medicine we have, space travel, you name it. It all comes from people wanting to discover, people wanting to learn. So I beg you, don&#8217;t just push the framework out the window as though it&#8217;s all &#8216;hype&#8217; and doesn&#8217;t have any real world use.. please please please just give it a try. There&#8217;s a reason it&#8217;s popular, even among the big names, because frameworks are damn good.</p>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/05/11/i-love-web-frameworks-why-dont-you/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/05/11/i-love-web-frameworks-why-dont-you/</feedburner:origLink></item>
		<item>
		<title>Where the hell have you been?</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/344832733/</link>
		<comments>http://27smiles.com/2008/05/08/where-the-hell-have-you-been/#comments</comments>
		<pubDate>Thu, 08 May 2008 11:12:07 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[Youtube Friday]]></category>

		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://localhost/~rich/wp_27smiles/?p=56</guid>
		<description><![CDATA[Man have I been busy the last two weeks what with travelling and doing projects for other people, feels like I never get time to write a blog post - which of course will be my excuse. You see I get home from work have some dinner, do a bit of a project and before [...]]]></description>
			<content:encoded><![CDATA[<p>Man have I been busy the last two weeks what with travelling and doing projects for other people, feels like I never get time to write a blog post - which of course will be my excuse. You see I get home from work have some dinner, do a bit of a project and before you know it the night has gone, gone like the acting skills of Keanu Reeves in, well anything?</p>
<p>I&#8217;ve missed youtube Friday twice now and quite frankly that just needs to be sorted out right now. So bring on youtube Friday. Before I post some videos I&#8217;d like to bore you, come on entertain me for a second or too - I&#8217;m of course talking about what I&#8217;m up to and stuff.</p>
<p>Lately I have been busy doing a website for someone which I initially started in <a href="http://cakephp.org/">cakePHP</a> and switched to <a href="http://www.rubyonrails.org/">rails</a> - don&#8217;t ask me why!? Maybe it&#8217;s because I&#8217;m a fan boy (GO RAILS, GO APPLE!) and like a good fanboy I do as I&#8217;m told. Not to say I don&#8217;t like cake, I love cake! Frameworks in general are just a really neat idea.</p>
<p>I did manage to finish the project from scratch in a weekend though - which was handy and I even tried <a href="http://ennerchi.com/projects/jrails">JRails</a> to replace prototype with jquery, much much better and all the helpers and RJS I normally use still work.</p>
<p>While we&#8217;re in that framework sort of area - I&#8217;m going to relearn the limited <a href="http://www.python.org/">python</a> I know and do <a href="http://readinfra.com">readinfra.com</a> in <a href="http://www.djangoproject.com/">django</a> and here&#8217;s the twist I might just record screencasts of what I learn and how I learned it right from the beginning so if anyone else wants to pickup python and/or django feel free to watch along.</p>
<p>For the project I did at the weekend I decided to switch to using <a href="http://git.or.cz/">GIT</a> to revision control it, and I has to say I do really like it. Yes! More fanboyisum but I just love how quick it is, how easy it is to do branches. I actually use branches now with SVN I&#8217;d always create a branches folder but did I ever use it? Nope. For readinfra I&#8217;m going to try <a href="http://www.selenic.com/mercurial/wiki/">Mercurial (HG)</a> though see if I perfer that to git, has better windows support and while I personally don&#8217;t care about that as I don&#8217;t ever see myself trying to run rails/python apps on windows and pretty much always developing on my Mac, others however may differ so easier for team projects.</p>
<h2>Enter youtube fun</h2>
<p>The first video I&#8217;m posting is of good ol&#8217; Thom. Thought I&#8217;d start off with a quite video but doesn&#8217;t Thom just look the perfect picture of strange folk at the start, when he takes a nice glare at the crowd. Anyhow enjoy - oh and shutup Jools.</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521d04f79"><a href="http://www.youtube.com/watch?v=p8uGdz0LwY8">http://www.youtube.com/watch?v=p8uGdz0LwY8</a></p>
</div>
<p>The second video is from someone accross the pond, so to speak from Thom. Stephen Malkmus, singing in a lift, while clapping.</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521d0768f"><a href="http://www.youtube.com/watch?v=zaPtP8obfJk">http://www.youtube.com/watch?v=zaPtP8obfJk</a></p>
</div>
<p>I&#8217;m a new soul, I came to this strange world, Hoping I could learn a bit bout how to give and take, But since I came here, felt the joy and the fear, Finding myself making every possible mistake&#8230;..macdell air.</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521d09d57"><a href="http://www.youtube.com/watch?v=fAyBaNwDX8c">http://www.youtube.com/watch?v=fAyBaNwDX8c</a></p>
</div>
<p>Ah, Tony and Bush - at the gay bar?</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521d0c496"><a href="http://www.youtube.com/watch?v=tTzs9G-VOZ4">http://www.youtube.com/watch?v=tTzs9G-VOZ4</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/05/08/where-the-hell-have-you-been/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/05/08/where-the-hell-have-you-been/</feedburner:origLink></item>
		<item>
		<title>Tinymce Syntaxhighlighter Plugin</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/344832739/</link>
		<comments>http://27smiles.com/2008/04/07/tinymce-syntaxhighlighter-plugin/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 11:46:00 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[highlighting]]></category>

		<category><![CDATA[plugins]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[syntax]]></category>

		<category><![CDATA[syntax highlighter]]></category>

		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://localhost/~rich/wp_27smiles/?p=70</guid>
		<description><![CDATA[I went to intergrate Syntaxhighlighter into the site tonight, something I&#8217;d forgotten to do in the redesign and I thought it would be nice if I could just click a button in tinymce and paste in the code, select a few options and click insert. Which of course is entirely possible so I&#8217;ve written a [...]]]></description>
			<content:encoded><![CDATA[<p>I went to intergrate <a href="http://code.google.com/p/syntaxhighlighter/">Syntaxhighlighter</a> into the site tonight, something I&#8217;d forgotten to do in the redesign and I thought it would be nice if I could just click a button in <a href="http://tinymce.moxiecode.com/">tinymce</a> and paste in the code, select a few options and click insert. Which of course is entirely possible so I&#8217;ve written a tinymce plugin to do just that.</p>
<p>I did encounter one little bug writing the plugin. When inserting the pasted code it keept repeating itself if there was currently no content in the body of the textarea (tinymce). I finally managed to fix it by putting a space at the end of the variable I was trying to insert (and with the power of highlighting here&#8217;s what that looked like).</p>
<pre class="syntax-highlight:javascript">textarea_output += &#039;&lt;/textarea&gt; &#039;; /* Note space */
tinyMCEPopup.editor.execCommand(&#039;mceInsertContent&#039;, false, textarea_output);</pre>
<p><span style="color: #ff0000;"> You can download the plugin here:</span><br />
Note: There is a file embedded within this post, please visit this post to download the file.</p>
<p><span style="font-size: medium;font-weight: bold;">UPDATE: The project has been moved to github, this is the preferred way of obtaining the files. I will leave the old download links up for now. Also feel free to fork, modify and send pull request with changes to the project&#8230; improvements are always welcome.</span></p>
<p><span style="font-size: medium;font-weight: bold;"><a href="http://github.com/RichGuk/syntaxhl/tree/master">http://github.com/RichGuk/syntaxhl/tree/master</a></span></p>
<h2>Getting it to work</h2>
<p>First you need to download <a href="http://code.google.com/p/syntaxhighlighter/">Syntaxhighlighter</a> and get that working by including the CSS file and Javascript files. I combind all of the syntaxhighlighter javascript files into one on 27smiles, you can get it <a href="/javascripts/syntaxhighlighter/all.js">here</a>.</p>
<h2>Extract the plugin</h2>
<p>Next you need to extract the plugin to your tinymce plugin directory. When extracted it should be something like this:<br />
<strong>/path/to/tinymce/plugins/syntaxhl</strong></p>
<h2>Configure tinymce</h2>
<p>Finally we need to configure tinymce to use our plugin we also need to stop tinymce from stripping out &lt;textarea&gt;&lt;/textarea&gt; html tags as this is needed for Syntaxhighlighter.</p>
<pre class="syntax-highlight:xhtml">tinyMCE.init({
theme : &quot;advanced&quot;,
plugins : &quot;syntaxhl&quot;,
theme_advanced_buttons1 : &quot;bold,italic,underline,undo,redo,link,unlink,image,forecolor,styleselect,removeformat,cleanup,code, syntaxhl&quot;,
theme_advanced_buttons2 : &quot;&quot;,
theme_advanced_buttons3 : &quot;&quot;,
remove_linebreaks : false,
extended_valid_elements : &quot;textarea[cols|rows|disabled|name|readonly|class]&quot;
});</pre>
<p>We tell tinymce to use our plugin by adding <strong>syntaxhl </strong>to the plugins list and also adding the <strong>sytnaxhl </strong>button to the buttons list also note that extended_valid_elements contains the textarea tag this tells tinymce to not remove it.</p>
<p>If all went well you should see a new highlighter icon button in tinymce and when you click it you should get a dialog popup allowing you to insert code into your content.</p>
<p>If you encounter any bugs or have any problems getting it to work please <a href="/contact">contact me</a> I&#8217;d be happy to help/fix bugs. Please note that I&#8217;ve only briefly tested this on Safari/IE7/Firefox 2/Firefox 3b5 and a quick blast on IE6 and from first tests it seemed to work. Also I was unsure if you have to stick to any standards when writing plugin&#8217;s for tinymce so it might not be the correctly way of doing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/04/07/tinymce-syntaxhighlighter-plugin/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/04/07/tinymce-syntaxhighlighter-plugin/</feedburner:origLink></item>
		<item>
		<title>Return of the Youtube Friday</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/344832754/</link>
		<comments>http://27smiles.com/2008/04/04/return-of-the-youtube-friday/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 11:29:26 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[Youtube Friday]]></category>

		<category><![CDATA[music]]></category>

		<category><![CDATA[Radiohead]]></category>

		<category><![CDATA[silver jews]]></category>

		<category><![CDATA[south park]]></category>

		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://localhost/~rich/wp_27smiles/?p=68</guid>
		<description><![CDATA[Wow, is what you&#8217;re thinking eh? A final return of the youtube Friday, my weekly collection of music video&#8217;s that I&#8217;ve listened to/watched throughout the week? Well yes&#8230; but I&#8217;ve decided to open the weekly event to more than just music&#8230;I&#8217;ve decided folks to open it up to any youtube video (what you&#8217;re crazy!), that&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, is what you&#8217;re thinking eh? A final return of the <a href="http://youtube.com">youtube</a> Friday, my weekly collection of music video&#8217;s that I&#8217;ve listened to/watched throughout the week? Well yes&#8230; but I&#8217;ve decided to open the weekly event to more than just music&#8230;I&#8217;ve decided folks to open it up to any youtube video (what you&#8217;re crazy!), that&#8217;s right any video. Now before you all go shouting and all the craziness makes me want to become <a href="http://en.wikipedia.org/wiki/Amish">Amish</a> let me tell you this tonight&#8217;s videos are of a music nature.</p>
<h2>Sleeping is the only love</h2>
<p>How fucking creepy are his eyes in this video? The first video tonight is from one of my favrioute musical bands. <a href="http://en.wikipedia.org/wiki/Silver_Jews">Silver Jews</a>. This song is off their 2005 album Tanglewood numbers (track number 6).</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521d1fd46"><a href="http://www.youtube.com/watch?v=UVwamE7t_YQ">http://www.youtube.com/watch?v=UVwamE7t_YQ</a></p>
</div>
<h2>Radiohead - 15 Steps (Seven)</h2>
<p>This video is funny with Thom in a box, yay. 15 Steps is from their latest album In Rainbows and this video was on one of their webcasts. You can checkout <a href="http://greenplastic.com">greenplastic.com</a> or <a href="http://ateaseweb.com">ateaseweb.com</a> for some Radiohead fansites.</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521d223e1"><a href="http://www.youtube.com/watch?v=W1ASzwriBOw">http://www.youtube.com/watch?v=W1ASzwriBOw</a></p>
</div>
<h2><del>What What, in my butt</del> Lets fighting love</h2>
<p><del>This video was on the latest south park, which was funny as normal the south park boys basically trying to make it big on the internet and this is the kind of video that&#8217;s big on youtube.</del> Ok so some stupid ass company removed all the videos from youtube that I could find, so for now another song from south park, lets fighting love. Enjoy and happy youtubing.</p>
<div class="vvqbox vvqyoutube" style="width:425px;height:355px;">
<p id="vvq491b521d24b3c"><a href="http://www.youtube.com/watch?v=KT_OYBXZxwM">http://www.youtube.com/watch?v=KT_OYBXZxwM</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/04/04/return-of-the-youtube-friday/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/04/04/return-of-the-youtube-friday/</feedburner:origLink></item>
		<item>
		<title>New Site and the holiday</title>
		<link>http://feeds.feedburner.com/~r/27smiles/~3/344832757/</link>
		<comments>http://27smiles.com/2008/04/02/new-site-and-the-holiday/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 11:21:29 +0000</pubDate>
		<dc:creator>rich</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[27smiles]]></category>

		<category><![CDATA[edinburgh]]></category>

		<category><![CDATA[holiday]]></category>

		<category><![CDATA[london]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://localhost/~rich/wp_27smiles/?p=63</guid>
		<description><![CDATA[New website
I&#8217;ve finally fixed the website, from that file I
deleted. True it wouldn&#8217;t of required
that much effort to fix but I thought I&#8217;d give the site a re-code/design while I was at it
- I seem to have a habit of that but anyhow since I&#8217;ve improved on my Rails skills since the last code this [...]]]></description>
			<content:encoded><![CDATA[<h2>New website</h2>
<p>I&#8217;ve finally fixed the website, from that file I<br />
deleted. True it wouldn&#8217;t of required<br />
that much effort to fix but I thought I&#8217;d give the site a re-code/design while I was at it<br />
- I seem to have a habit of that but anyhow since I&#8217;ve improved on my <a title="Ruby on Rails" href="http://www.rubyonrails.org/">Rails</a> skills since the last code this build went much smoother which leads nicely into the next change. The layout.</p>
<p>I&#8217;m<br />
sure you have noticed the new layout but I bet you did know that it in<br />
fact changes between a night theme and a day theme at 6AM or 6PM&#8230;.<br />
but if you prefer one theme over the other why not click one of those<br />
little icons in the top right? They change the theme to whatever one<br />
you choose for that session (while the browser is open) you can even<br />
switch back to the time based theme if you prefer that.</p>
<p>You&#8217;ll also notice the <a title="Flickr" href="http://www.flickr.com">flickr</a>, <a title="Twitter" href="http://twitter.com">twitter</a> and <a title="Last.fm" href="http://last.fm">last.fm</a><br />
integration on the right of the page. Apart from twitter they are all pulled in from an RSS feed and then using fragment caching with memcache in rails to do<br />
some time based caching so the <a href="http://www.flickr.com">flickr</a> feed is updated every hour and the <a title="Last.fm" href="http://last.fm">last.fm</a> one every 5 minutes. I will talk more about how I did this in a later post.</p>
<p>The twitter feed is updated/imported using their javascript code so that should be real time. Oh and about twitter I&#8217;ve finally decided I&#8217;d get one after months of thinking hmmm is there much point in telling people what I&#8217;m doing all the time? Well I thought meh why not? People don&#8217;t have to read it and its something all the &#8216;cool&#8217; kids are doing.</p>
<h2>Holiday</h2>
<p>So for the past two week I&#8217;ve had some time off work and was lucky enough to spend 5 days in Edinburgh and 3 days in London with my girl friend (Kerry). Both trips went smoothly and a I thoroughly enjoyed both (I even enjoyed London :o).</p>
<p><a href="http://flickr.com/photos/richguk/sets/72157604336233579/"><img style="float: left; border: 1px solid black; margin: 5px;" src="http://farm4.static.flickr.com/3201/2378743948_a590f79f15_m.jpg" alt="National Portrait Gallary (Edinburgh)" width="240" height="180" /></a>Edinburgh is both amazing and beautiful me and Kerry had a fantastic time here looking around both the city, art galleries and museums of which there are lots! We took a <a title="Flybe" href="http://www.flybe.com">Flybe</a> flight up to Edinburgh from Birmingham on a small plane which was nice. When we arrived in Edinburgh they had a very handy and excellent bus service from the airport which took us all the way into the centre, the buses run every 10 minutes - I really did think this was excellent. We stopped in the <a title="Royal Garden Apartments" href="http://www.royal-garden.co.uk/">Royal Garden Apartments</a> which was a very nice apartment. The apartment was but 5 minute walk from Prince&#8217;s Street and any shops we needed also being close to most of the attractions. Oh and the <a href="http://www.nationalgalleries.org/visit/page/2:298:3">national portrait gallery</a> was right opposite the apartment so of course we went there first =) (left image was view from the window).</p>
<p><a title="Part of Edinburgh Castle" href="http://flickr.com/photos/richguk/2377941991/in/set-72157604336233579/"><img style="float: right; border: 1px solid black; margin: 5px;" src="http://farm4.static.flickr.com/3163/2377941991_0ef3a9cd05_m.jpg" alt="Part of Edinburgh Castle" width="240" height="240" /></a></p>
<p>On the second day we went to <a href="http://en.wikipedia.org/wiki/Edinburgh_Castle">Edinburgh castle</a>, although I&#8217;d been before I was quite young so I only remembered bits so going again was a very fun day out, it also meant I got to take lots of pictures and blend in with all the cute Japanese tourists taking all their pictures. The castle was quite busy as you expect though there were a lot of school trips there with all these Scottish kids, I love the Scottish accent its cute.</p>
<p>On the third day we decided to visit all the galleries - <a href="http://www.nationalgalleries.org/visit/page/2:114:2/">national</a>, <a href="http://www.nationalgalleries.org/visit/page/2:118:4/">modern</a>, etc&#8230; these were spread all over the city so it took all day to get around. They were quite interesting but I&#8217;m sure Kerry enjoyed/appreciated them more so than I.</p>
<p>On the fourth day we went to the <a href="http://www.nms.ac.uk/">Museum of Scotland</a> and the <a href="http://www.nms.ac.uk/royal_museum_project.aspx">Royal Museum</a>, which are attached, these were both very interesting and fun :), while being quite big and hard to navigate around at the same time.</p>
<p style="text-align: center;"><a href="http://flickr.com/photos/richguk/sets/72157604336233579/"><img style="border: 1px solid black; margin: 5px;" src="http://farm3.static.flickr.com/2219/2377948369_e7c9db3d99.jpg" alt="Edinburgh" width="500" height="375" /></a></p>
<p><a href="http://flickr.com/photos/richguk/sets/72157604336891673/"><img style="float: left; border: 1px solid black; margin: 5px;" src="http://farm3.static.flickr.com/2098/2378049683_8fda0299ce_m.jpg" alt="London Art Gallary" width="240" height="180" /></a>The 3 days we spent in London were very fun too, again we visited the <a href="http://www.nationalgallery.org.uk/">art gallery</a> and the <a href="http://www.nhm.ac.uk/">natural history museum</a> which were both very big and full of interesting paintings and animals the real excitement of course for me was the <a href="http://www.sciencemuseum.org.uk/">science museum</a> <img src='http://27smiles.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> getting to play with all the interactive stuff like a little child, amazing amounts fun indeed. Although we did get evacuated from the building for some reason, and I&#8217;d love to know why lucky for us though we were in the last room.</p>
<p><a href="http://flickr.com/photos/richguk/sets/72157604336891673/"><img style="float: right; border: 1px solid black; margin: 5px;" src="http://farm3.static.flickr.com/2218/2378917524_3c90a0d87c_m.jpg" alt="London Natural History" width="180" height="240" /></a>The tube was not to bad at all, we found our way around with ease and although it got a little busy now and then majority of the time it was pretty empty. Also for some strange reason unbeknown to me I like the smell at the tube station, must be all that unclean air plus the tube kinda reminds me of the 60&#8217;s, maybe its because the icon looks all retro.</p>
<p>So all in all the holiday&#8217;s went very well and I enjoyed both lots and lots, although going back to work was a shock to the system.</p>
]]></content:encoded>
			<wfw:commentRss>http://27smiles.com/2008/04/02/new-site-and-the-holiday/feed/</wfw:commentRss>
		<feedburner:origLink>http://27smiles.com/2008/04/02/new-site-and-the-holiday/</feedburner:origLink></item>
	</channel>
</rss>
