<?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>Marc Hibbins &#187; development</title>
	<atom:link href="http://blog.marchibbins.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.marchibbins.com</link>
	<description>Freelance Web developer, blogger</description>
	<lastBuildDate>Wed, 21 Sep 2011 11:42:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>One Note</title>
		<link>http://blog.marchibbins.com/2011/09/21/one-note/</link>
		<comments>http://blog.marchibbins.com/2011/09/21/one-note/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 11:41:48 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=1795</guid>
		<description><![CDATA[Here’s a note on using the PyDev plug-in for Eclipse with our virtualenv set-up, configuring your Python Path within PyDev and running custom commands from the console — particularly for Django development.]]></description>
			<content:encoded><![CDATA[<p>In addition to <a title="Here’s to Taking It Easy" href="http://blog.marchibbins.com/2011/09/15/here%e2%80%99s-to-taking-it-easy/">my last post</a> on Python development environments, here’s a note on using the <a title="PyDev" href="http://pydev.org/" target="_blank">PyDev plug-in for Eclipse</a> with our virtualenv set-up.</p>
<p>Assuming everything went swimmingly — virutalenv running, Django installed with a project folder (let’s call it ‘<strong>myproject</strong>’) having done something like this:</p>
<blockquote><p><code>$ mkdir dev<br />
$ cd dev<br />
$ virtualenv --no-site-packages env<br />
$ source env/bin/activate<br />
(env) $ pip install django<br />
(env) $ django-admin.py startproject myproject</code></p></blockquote>
<p>First install PyDev in Eclipse under “Install New Software” with the URL: <a href="http://pydev.org/updates" target="_blank">http://pydev.org/updates</a></p>
<p>Once that’s done, configure the Python interpreter. In your Preferences, under <strong>PyDev</strong> and <strong>Interpreter &#8211; Python</strong>, hit the <strong>Auto Config</strong> option to find all your libraries and populate the Python Path.</p>
<p>Otherwise, manually add Python and locate your interpreter, mine is under <code>/usr/bin/python2.7</code>.</p>
<p>For now, this only includes your globally-installed system-wide libraries, not those you’ve installed within the virtualenv environment.</p>
<p>To create a new &#8220;PyDev Django project&#8221; however, you’ll need to have Django installed globally (or otherwise configured in the above Python Path settings) so PyDev can see it. Right now ours isn’t, so we have an extra step.</p>
<p>Instead, we’ll create a &#8220;New PyDev project&#8221; (non-Django), add our virtualenv location containing the libraries in our local site-packages directory, then <em>convert</em> that to a Django Project once PyDev is satisfied we have the goods.</p>
<p>This method means we don’t have to install Django globally just for the sake of using this IDE.</p>
<p>To do this, from the File menu and <strong>New PyDev Project</strong>, I un-tick ‘Create src folder and add it to the PYTHONPATH’, instead selecting ‘Don’t configure PYTHONPATH (to be done manually later on)’.</p>
<p>Right-click the project folder, go to <strong>Properties</strong> and <strong>PyDev &#8211; PYTHONPATH</strong> and add a Source Folder pointing to your virtualenv site-packages. In this instance:</p>
<blockquote><p><code>dev/env/lib/python2.7/site-packages</code></p></blockquote>
<p>Having found Django, PyDev now let’s us convert this to a Django project. Right-click again and under the <strong>PyDev</strong> menu select <strong>Set as Django Project</strong>.</p>
<p>Now everything can be performed within Eclipse, rather than by the command line.</p>
<p>For example, to run the server we’ll add a Custom Command. Under the <strong>Django</strong> menu select <strong>Custom Command</strong> and add the following:</p>
<blockquote><p><code>runserver --noreload</code></p></blockquote>
<p>You may be asked to select which <code>manage.py</code> to run from, choose the one within your project, i.e. <code>myproject/manage.py</code>.</p>
<p>Hit Run and test <a href="http://localhost:8000/" target="_blank">http://localhost:8000/</a> within your browser.</p>
<p>Note the <code>--noreload</code> option allows Eclipse to maintain control over the process, rather than spawning a new thread. This function usually allows the server to reload automatically when changes are made to your code, at your convenience.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2011/09/21/one-note/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Here’s to Taking It Easy</title>
		<link>http://blog.marchibbins.com/2011/09/15/here%e2%80%99s-to-taking-it-easy/</link>
		<comments>http://blog.marchibbins.com/2011/09/15/here%e2%80%99s-to-taking-it-easy/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 16:43:43 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=1763</guid>
		<description><![CDATA[How to set up multiple Python environments on Linux, using Virtualenv to handle isolated project and pip for package management.]]></description>
			<content:encoded><![CDATA[<p>I mentioned in my previous post that I borked my system meddling with Python. Having reset my workspace, I’ve now set up a solid system that makes handling projects and multiple development environments super simple.</p>
<p>The new set up easily handles multiple Python projects, without compatibility or version conflicts. The installation is equally straightforward.</p>
<p>Before switching to a desktop Linux, I used to sing the praises of VMware and developing with virtual machines when dealing with unique environments. By “unique”, I rather mean any odd project out of the ordinary LAMP set-up I usually work with, or something that requires a specific version of a piece of software.</p>
<p>Since then however, I’ve found no need. So long as you think before you leap.</p>
<p>Virtual boxes (as closed, single-piece software) are good and all, you can be as venturous as you wish without risk of damaging your native system. Plus, if you screw one of these you can restore a saved state in a few clicks. However, the VM safety net allows you to proceed without caution, perhaps recklessly, at the expense of fully comprehending the commands you’re executing and tasks you’re running.</p>
<p>In that sense, they’re great for beginners uncertain of how (or if) they should install software, e.g. Apache, PHP, Python etc — appliances and virtual stacks are helpful.</p>
<p>Otherwise they can convolute your workspace — and more often than not, won&#8217;t be configured exactly how you want or need them. Running software natively is simple and as intended, it also allows you to configure your entire environment without any assumptions made by distributors.</p>
<h3><a class="anchor" name="Virtualenv">Virtualenv</a></h3>
<p><a title="virtualenv 1.6.4 : Python Package Index" href="http://pypi.python.org/pypi/virtualenv" target="_blank">Virtualenv</a> is quite the revelation. It facilitates multiple isolated Python environments on a single system, dynamically handling your <a title="6. Modules — Python v2.7.2 documentation" href="http://docs.python.org/tutorial/modules.html#the-module-search-path" target="_blank">Python Path</a> so packages are install within an enclosed local directory, rather than in amongst your top-level system packages.</p>
<p>This means you can create project-by-project virtual environments avoiding compatibility and version conflicts. When an environment is created (and activated) libraries are thereafter installed within discreet directories that aren&#8217;t shared with other virtualenv environments.</p>
<p>This means nothing is installed “system-wide”, so libraries don’t accrue over time, there’s no balancing of versions. It also means you can work with different version of Python simultaneously.</p>
<p>Python packages should be installed with a package manager. The latest of which is <a title="pip 1.0.2 : Python Package Index" href="http://pypi.python.org/pypi/pip" target="_blank">pip</a>.</p>
<p>Prior to this, easy_install was the manager <em>du jour</em> (part of Setuptools, both now out-dated), but we’ll only be using that to install pip:</p>
<blockquote><p><code>$ sudo easy_install pip</code></p></blockquote>
<p>Pip is a direct replacement for easy_install, improving on a few things (a <a title="pip — pip v1.0.2 documentation" href="http://www.pip-installer.org/en/latest/index.html#pip-compared-to-easy-install" target="_blank">comparison can be found on the installer site</a>). Packages that are available with easy_install should be pip-installable and the installation method is the same — the following installs virtualenv:</p>
<blockquote><p><code>$ sudo pip install virtualenv</code></p></blockquote>
<p>With virtualenv installed we can create an environment within your workspace, all it needs is the environment directory name, here ‘<strong>env</strong>’:</p>
<blockquote><p><code>$ virtualenv env</code></p></blockquote>
<p>There are a few options you have with this command. In the following example, the <code>--no-site-packages</code> flag means that the new environment will <em>not </em>inherit any system-wide global site packages. The <code>--distribute</code> flag will install <a title="distribute 0.6.21 : Python Package Index" href="http://pypi.python.org/pypi/distribute" target="_blank">Distribute</a> rather than Setuptools:</p>
<blockquote><p><code>$ virtualenv --no-site-packages --distribute env</code></p></blockquote>
<p>Distribute is to setuptools as Pip is to easy_install. Distribute and pip are <a href="http://s3.pixane.com/pip_distribute.png" target="_blank">the new hotness</a>, Setuptools and easy_install are old and busted — <a title="Introduction to Packaging — The Hitchhiker's Guide to Packaging v1.0 documentation" href="http://guide.python-distribute.org/introduction.html#current-state-of-packaging" target="_blank">for now</a>.</p>
<p>Anyway, activate your environment:</p>
<blockquote><p><code>$ source env/bin/activate</code></p></blockquote>
<p>You’ll see from your shell prompt that the environment is activated, with the name prepended.</p>
<p>Then we’ll install something with pip. <a title="yolk 0.4.1 : Python Package Index" href="http://pypi.python.org/pypi/yolk" target="_blank">Yolk</a> is a tool for querying the packages currently installed on your system, so we’ll install that and grab a list:</p>
<blockquote><p><code>(env) $ pip install yolk<br />
(env) $ yolk -l</code></p></blockquote>
<p>Then you’ll see everything the environment can see in the output (this will depend on your global site packages and how you created the environment, as above).</p>
<p>Note that you don&#8217;t need to sudo whilst in the activated environment.</p>
<p>As a test, we’ll <code>deactivate</code> the environment and run the same command, which gets the following error (unless you have yolk installed globally):</p>
<blockquote><p><code>(env) $ deactivate<br />
$ yolk -l<br />
yolk: command not found</code></p></blockquote>
<p>If installed within an environment, a package is only available whilst it is activated. This is the means to install whatever you wish, without worrying about cross-project conflicts.</p>
<h3><a class="anchor" name="More_pip">More pip</a></h3>
<p>Another good feature of pip is to generate a list of requirements for your working set of packages. The command is called freeze and generates a text file as follows:</p>
<blockquote><p><code>(env) $ pip freeze &gt; requirements.txt</code></p></blockquote>
<p>This will create a list of all installed packages with specific versions for each library. This is in a custom syntax and looks something like this:</p>
<blockquote><p><code>distribute==0.6.19<br />
wsgiref==0.1.2<br />
yolk==0.4.1</code></p></blockquote>
<p>This list can then be distributed (e.g. to a team of developers) and used to install those packages on other systems, like so:</p>
<blockquote><p><code>(env) $ pip install -r requirements.txt</code></p></blockquote>
<p>Note, this isn’t couple with virtualenv, which actually has it’s own method of bootstrapping — <a title="virtualenv 1.6.4 : Python Package Index" href="http://pypi.python.org/pypi/virtualenv" target="_blank">see &#8220;Creating Your Own Bootstrap Scripts&#8221;</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2011/09/15/here%e2%80%99s-to-taking-it-easy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Home Security</title>
		<link>http://blog.marchibbins.com/2011/09/08/home-security/</link>
		<comments>http://blog.marchibbins.com/2011/09/08/home-security/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 15:43:46 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=1742</guid>
		<description><![CDATA[Lessons in user permissions and groups, enabling Apache VirtualHosts to server HTTP from within an encrypted home directory on Ubuntu.]]></description>
			<content:encoded><![CDATA[<p>Since <a title="» Better Half by Marc Hibbins" href="http://blog.marchibbins.com/2011/03/15/better-half/">deciding to work exclusively in a Linux environment</a> at the beginning of the year, I’ve been more than pleasantly surprised not to have found myself needing to reset my system as a result of the frequent changes of set-up and numerous installations and removals of software that I’ve needed to perform in order to work on various projects.</p>
<p>The inevitable day, however, came a couple of weeks ago when I royally screwed my system messing around with Python (solution in another blog post. <em>Update</em>: <a title="» Here’s to Taking It Easy by Marc Hibbins" href="http://blog.marchibbins.com/2011/09/15/here%e2%80%99s-to-taking-it-easy/">here it is</a>).</p>
<p>Once Ubuntu was reinstalled, I encountered a problem attempting to recreate my workspace having opted to encrypt my home directory during user setup.</p>
<p>Running the normal LAMP-server setup, Apache is unable to access files within the <a title="EncryptedHome - Community Ubuntu Documentation" href="https://help.ubuntu.com/community/EncryptedHome" target="_blank">encrypted home</a>.</p>
<p>I was tying to duplicate my previous configuration, using individual VirtualHosts locating directories within my user home, for example:</p>
<blockquote><p>/home/marc/sites/dev/</p></blockquote>
<p>I’m pretty sure my home directory was encrypted last time too, but this problem was new for me — perhaps something from an update in between?</p>
<p>The permissions problem occurs as only my user, <strong>marc</strong>, has access to the home and Apache’s user, <strong>www-data</strong>, does not. This results in a HTTP 403 Forbidden when attempting to serve files.</p>
<p>Having a look around, I found <a title="Ubuntu Forums - View Single Post - [SOLVED] apache 403 on encrypted home dir in 10.10 maverick meerkat" href="http://ubuntuforums.org/showpost.php?s=26a3c259806ff43ed7e18ca3c00f15be&amp;p=9868230" target="_blank">a convoluted method using symlinks and Apache’s UserDir</a> then a far simpler solution, on <a title="permissions - Allowing apache access to a subdirectory in a home directory without access to the home directory - Ask Ubuntu - Stack Exchange" href="http://askubuntu.com/questions/36533/" target="_blank">AskUbuntu</a>, as follows.</p>
<p>It’s unsafe to change your home ownership (to <strong>www-data</strong>, for example) but Apache needs execute permissions there. So selectively <strong>chmod</strong> the directory:</p>
<blockquote><p>sudo chmod 751 /home</p></blockquote>
<p>This grants execute access to others, who can only read files with correct knowledge of names and locations. It also removes your user’s read access to /home, so you’ll have to <strong>sudo</strong> for that.</p>
<p>Another precaution benefiting those on development-only machines, is to restrict IP listening within Apache’s ports.conf, so only local connections get any attention:</p>
<blockquote><p>Listen 127.0.0.1:80</p></blockquote>
<h3><a name="Alternatives" class="anchor">Alternatives</a></h3>
<p>As for alternatives, you could encrypt your whole drive rather than just the home directory. You shouldn’t see any problems then.</p>
<p>Or you could just ignore encryption all together.</p>
<p>You could, of course, just work out of the traditional <strong>/var/www/</strong> location, which is the Apache default. Simply create a directory there and <strong>chown</strong> to your user so you don’t have to always <strong>sudo</strong> changes.</p>
<blockquote><p>sudo mkdir /var/www/dev/<br />
sudo chown marc /var/www/dev/</p></blockquote>
<p>If you’re directories are elsewhere on your system, for example in SVN repositories such as <strong>/srv/svn/</strong> or <strong>/usr/local/svn/</strong> then you’ll need to <strong>chown</strong> those to <strong>www-data</strong> so they’re readable, similar to our method of reading from within /home above.</p>
<p>The <a title="Subversion - Community Ubuntu Documentation" href="https://help.ubuntu.com/community/Subversion#Server_Configuration" target="_blank">Ubuntu docs on Subversion</a> offer the best solution for handling user permissions for SVN over HTTP.</p>
<p>Create a new user group, <strong>subversion</strong>, add the users <strong>marc</strong> and <strong>www-data</strong> to it and <strong>chown</strong> the repo to <strong>www-data:subversion</strong>, giving read/write access to the group (granting privileges to <strong>marc</strong>). Finally <strong>chmod</strong> with <strong>-s</strong> so that new files inherit that group ID, like so:</p>
<blockquote><p>cd /srv/svn/<br />
sudo chown -R www-data:subversion dev/<br />
sudo chmod -R g+rws dev/</p></blockquote>
<p>The <strong>-s</strong> flag means that all files created inside that directory will inherit the <em>group of the directory</em>, otherwise files takes on the primary <em>group of the user</em>. New subdirectories will also inherit this.</p>
<p>The <strong>-R</strong> option applies the changes recursively (i.e. existing subdirectories).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2011/09/08/home-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Half</title>
		<link>http://blog.marchibbins.com/2011/03/15/better-half/</link>
		<comments>http://blog.marchibbins.com/2011/03/15/better-half/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 14:25:07 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=1555</guid>
		<description><![CDATA[Dual-booting Ubuntu and Windows and getting to grips with using Linux on the desktop full-time.]]></description>
			<content:encoded><![CDATA[<p>With a new venture, comes a new set-up. I’m going to be working with a new start-up company, a small outfit that will require some working from home, some working on site, plenty of time spent in odd Wi-Fi spots around London presumably — all amounting to a good enough excuse to purchase a brand new laptop and establish a new development environment.</p>
<p>For some time I’ve been keen to try working with Linux full-time, particularly <a title="Ubuntu homepage | Ubuntu" href="http://www.ubuntu.com/" target="_blank">Ubuntu</a>, the most popular flavour of Linux. So with a brand new system I have an opportunity to try it.</p>
<p>I usually work with Unix-like systems for Web development, but on the server-side and <a title="Weapon of Choice by Marc Hibbins" href="http://blog.marchibbins.com/2008/11/19/weapon-of-choice/" target="_blank">using a virtualisation such as VMware</a>, but infrequently at author time or on the desktop. I figured this is going to be a development machine, prone to be tarnished by experiment (or more likely ignorance), perhaps in need of frequent reset, so why not give it a roll.</p>
<p>Rather than go solo with only an installation of Ubuntu, I decided to dual-boot with Windows 7. I already own a genuine copy of Windows 7 and a few other PC-based applications, particularly Creative Suite for Web, plus this meant I could save some cash on buying a laptop without a pre-installed operating system. The dual-boot also gifts me with a fallback option if I really can’t get on with Linux.</p>
<p>So far as installation goes, there’s really not much to report. Installing Windows came first, a set-up as normal, straightforward but tiresome probably hitting double figures in the number of reboots required to get going. Around seventy updates recommended therein.</p>
<p>Ubuntu was downloaded and <a title="BurningIsoHowto - Community Ubuntu Documentation" href="https://help.ubuntu.com/community/BurningIsoHowto" target="_blank">burned as a Live CD</a>, running a super-simple installer with a couldn’t-be-easier draggable horizontal slider to determine the partition size.</p>
<p>There are many ways to partition drives, recommended schemes such as <a title="PartitioningSchemes - Community Ubuntu Documentation" href="https://help.ubuntu.com/community/PartitioningSchemes" target="_blank">those on the Ubuntu docs</a>, but I figured a halfway split would be fine. I can always readdress the partitioning if Linux doesn’t work out or if I end up never touching Windows and need the extra space.</p>
<p>After a few days to playing with Ubuntu, so far so good. Needless to say, now at version 10.10 it’s been a fully realised operating system for some time.</p>
<p>The two flavours, for desktop and netbook, are both fully featured, true alternatives to Windows and Mac OS. No longer only options for developers and the computer-savvy.</p>
<p>They both come with a number of applications pre-installed — browsers, mail and chat clients, image editors, a range of software you’d expect. Anything else you need can be found in the Ubuntu Software Centre, an App Store-like directory of open-source and proprietary software from Ubuntu and trusted third-parties and partners.</p>
<p>Firefox and Thunderbird are amongst the familiar names that come packaged with the basic install and a huge number of common day-to-day applications are widely supported — Chrome, Opera, the Flash player, Skype, all AIR-based apps (such as TweetDeck).</p>
<p>There’s support for iPhone and Android devices and cameras. <a title="OpenOffice.org  - The Free and Open Productivity Suite" href="http://www.openoffice.org/" target="_blank">OpenOffice</a> provides your alternative to Word, Excel and PowerPoint.</p>
<p>I’m currently getting to grips with Evolution Mail (email apps are always fun) and Empathy IM, a chat client that integrates Google Chat, MSN, Jabber — all the usual suspects — akin to Pidgin or Adium.</p>
<p>And the icing on the cake —<a title="Spotify Linux - Spotify Wine - Download Spotify" href="http://www.spotify.com/int/download/previews/" target="_blank"> Spotify have a Linux preview</a>. With that installed, it feels like home. Now I just need to get used to a whole new set of shortcuts and hotkeys.</p>
<p><a href="http://blog.marchibbins.com/wp-content/uploads/2011/03/ubuntu-desktop.jpg"><img class="aligncenter size-medium wp-image-1560" title="Ubuntu 10.10 desktop screenshot" src="http://blog.marchibbins.com/wp-content/uploads/2011/03/ubuntu-desktop-300x168.jpg" alt="" width="300" height="168" /></a></p>
<p>The Ubuntu docs have a lengthy article about the various ways of <a title="Dual Boot Ubuntu and Windows - Community Ubuntu Documentation" href="https://help.ubuntu.com/community/WindowsDualBoot" target="_blank">dual booting with Windows</a>, on the whole the <a title="Community Documentation - Community Ubuntu Documentation" href="https://help.ubuntu.com/community" target="_blank">Community Docs</a> look like a very helpful resource.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2011/03/15/better-half/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>25 Minutes to Go</title>
		<link>http://blog.marchibbins.com/2011/03/13/25-minutes-to-go/</link>
		<comments>http://blog.marchibbins.com/2011/03/13/25-minutes-to-go/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 19:57:26 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=1531</guid>
		<description><![CDATA[Investigating the Pomodoro Technique, a tasty lifehack promising to boost your productivity.]]></description>
			<content:encoded><![CDATA[<p>The <a title="The Pomodoro Technique" href="http://www.pomodorotechnique.com/" target="_blank">Pomodoro Technique</a> is a time management method developed in the late 1980s by a man named Francesco Cirillo.</p>
<p>The method is simple, you take a 25-minute timer (or anything capable of timing 25 minutes) and work uninterrupted until that time is up. Then you take a 5 minute break, then you repeat. At the end of every fourth working interval, take a longer break &#8211; say 15-20 minutes. Sounds easy.</p>
<p>The technique has gained a kind of quasi-cult status online, heralded as one of the most effective modern lifehacks &#8211; productivity tricks devised to cut through information overload, frequently adopted by programmers.</p>
<p>So what’s the big deal? Skeptically, you may ask &#8211; why do you need to employ this or any technique? Why can’t you just work normally? Particularly of one so straightforward.</p>
<p>Whilst the method is simple, such tricks can be hugely effective. The very process of planning, recording and reflecting on progress and work completed creates a sense of motivation and adds to your feelings of accomplishment. The ‘<a title="Our Products - The Pomodoro technique" href="http://www.pomodorotechnique.com/products.html" target="_blank">Pomodoro Timer</a>’, a tomato-shaped kitchen timer (pomodoro is the Italian word for tomato) produces an audible ticking during the working interval, triggering some subconscious drive to get things done.</p>
<p>Cirillo’s view adds that the physical act of winding up the timer confirms the user&#8217;s determination to start the task, the kick we need to get going. To overcome the all-too-familiar deadline anxiety.</p>
<p>So over the past month I’ve been working with the Pomodoro Technique. Adopted at the beginning of a new one-month contact, in a new office at a new desk, a clean opportunity to try it out.</p>
<p>Firstly I should say I am usually somewhat skeptical to any kind of technique promising some revolutionary effect, on any level be it relating to money, work or health. I guess I already consider to days to be pretty productive, thanks. I probably only considered the Pomodoro Technique because of the amount of positive testimonials I’ve heard, from a wealth of online sources and more recently from a few people whose opinions I respect.</p>
<p>But I don’t particularly suffer from deadline anxiety, motivation isn’t a problem for me when I’m given a heap of work &#8211; in fact I’m the opposite, irritably frustrated when I have nothing to do.</p>
<p>I hoped this would improve my time management, rather than boost my productivity. Too often I’m distracted by checking emails, chat clients or Twitter. By &#8220;distracted&#8221;, I don’t particularly mean going off-task and browsing intermittently, so much as perhaps in a lull of attention, wonder whether an email response has arrived or message been returned, so I&#8217;ll switch windows hit refresh.</p>
<p>For me the technique structured my breaks. It offered the reassurance that I will have the chance to check for that email or tweet in no longer than 25 minutes time. It meant that there was no possibility that I could get caught up in a task that might stretch an hour and therefore cause me to fall behind in anything else.</p>
<p>Ultimately, that I could devote my full attention to the current task and I’ll be reminded of when it’s time for a break, when my timer tells me so.</p>
<p>An essential aim of the technique is to cut down on interruptions, both internal and external. If asked “Do you have time for a quick chat?”, I could confidently say “Yes, in 5 minutes”, or however much time I had left on the clock. I knew that if that ‘quick chat’ became a 10 minute meeting, my work wouldn’t be any more interrupted.</p>
<p>The timer offers an impartial and impersonal structure, an obedience to which relieves the distraction of continual desktop beeps and alerts whilst sharpening your focus on the task in hand.</p>
<p>There are a number of free unofficial Pomodoro applications for desktop and mobile platforms to save you ordering a tomato timer or testing your colleagues patience with a bell ringing every half hour.</p>
<p>I used the<a title="Pomodoro Time Management Lite for iPhone, iPod touch and iPad on the iTunes App Store" href="http://itunes.apple.com/gb/app/pomodoro-time-management-lite/id323224845" target="_blank"> Pomodoro Lite iPhone app</a>, which is very straightforward (it’s just a preset interval timer after all), though eats up the battery for use of a whole day.</p>
<p><a title="focus booster - home; try the pomodoro technique" href="http://www.focusboosterapp.com/" target="_blank">Focus Booster</a> and <a title="pomodairo - Project Hosting on Google Code" href="https://code.google.com/p/pomodairo/" target="_blank">Pomodairo</a> are cross-platform AIR-based apps. Both look pretty slick and have additional features such as task lists.</p>
<p><a title="ChromoDoro - Google Chrome extension gallery" href="https://chrome.google.com/extensions/detail/edhkjecdcakijjmlelnjjiohjmlaikhb?hl=en-US" target="_blank">ChromoDoro</a> is an extension for Google Chrome, adding a tomato timer to your toolbar with pop-ups to alert you when you’re done.</p>
<p>Whether I’ll continue to use the technique, I’m not sure. I think as a method of concentrating your focus, or retraining your attention span even, it’s very effective. I didn’t find any revelation, but it didn’t disrupt my normal working day either.</p>
<p>Getting into the hang of it, completing tasks within a 25 minute cycles does result a great sense of accomplishment, feeding a higher level of motivation. It might also surprise you how much you can achieve in 25 uninterrupted minutes. I found myself attempting tasks I would usually estimate taking longer. Perhaps that’s the competitive part of me, but it felt great beating the clock.</p>
<p>The most positive outcome as I say, put a stop to my tendency to allow distractions to creep into working time. Though it would be nice to think that I could achieve that with just a bit more self-discipline instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2011/03/13/25-minutes-to-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hip to Be Square</title>
		<link>http://blog.marchibbins.com/2011/03/08/hip-to-be-square/</link>
		<comments>http://blog.marchibbins.com/2011/03/08/hip-to-be-square/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 00:00:47 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=1526</guid>
		<description><![CDATA[A bit about server-side image manipulation with PHP &#038; GD, plus something to play with.]]></description>
			<content:encoded><![CDATA[<p>Whilst being still somewhat of a newcomer to the world of freelance development, it&#8217;s already very apparent that the call for services is always heavily affected by online trends both technological and fashionable.</p>
<p>It’s quite understandable, that being the nature of the beast &#8211; to be adaptable and reactive, to be able to rapidly assimilate new skills. It’s much simpler for employers to call for contractors who have already worked with a certain platform, rather than channel time and resources into training &#8211; neither of which are often in disposable measure.</p>
<p>Recently I’ve taken frequent forays into the Facebook platform, both in the form of Canvas-based applications and Facebook-enabled external sites (what was previously known as Facebook Connect). Both however leveraging the Facebook’s core platform functionality, the Graph API, in strikingly similar ways.</p>
<p>Twice I’ve been tasked with projects that have required building bespoke photo manipulation tools.</p>
<p>Specifically, two (unrelated) applications both offering users the ability to select photos from their Facebook albums, apply some choice or combination of filters, effects or creative imagery and produce a processed image as a result. Awarding them free opportunity to download, share, remix or do whatever they please with the final outcome.</p>
<p>The first was <a title="Marc Hibbins | Projects" href="http://marchibbins.com/projects/#honda-mode-art">Honda’s CR-Z Mode Art</a>, both a Canvas application and third-party site running from the same code base.</p>
<p>This was Flash-based and applied simple run-time blending modes and colour transformations to a user’s profile image, largely relying on a bank of ready-made illustrated assets (of theme selected by the user) to embellish and augment the picture. Snippets of their profile information were also added.</p>
<p>When deciding upon a methodology for the image processing, I initially suggested that it all be handed to a server to make use a library such as PHP’s <a title="Main Page - LibGD" href="http://www.libgd.org/" target="_blank">GD</a> or <a title="ImageMagick: Convert, Edit, Or Compose Bitmap Images" href="http://www.imagemagick.org/" target="_blank">ImageMagick</a>.</p>
<p>This would take the weight off the client, both in handling the processing itself and in the delivery of aforementioned asset library. Even with a rudimentary grasp, both offer a much more powerful level of image manipulation than I thought easily achievable with Flash.</p>
<p>But Flash was a must. I recommended using <a title="Adobe Pixel Bender Plug-in | Photoshop filters - Adobe Labs" href="http://labs.adobe.com/technologies/pixelbenderplugin/" target="_blank">Pixel Bender</a>, mainly for selfish reasons, but also because it offers a complexity of processing down to the pixel level &#8211; but that wasn&#8217;t an option due to client-imposed restrictions on the Flash Player version.</p>
<p>More recently I was offered a second attempt with a very similar application with <a title="The Now Project on Facebook" href="http://apps.facebook.com/nowproject/" target="_blank">Samsung’s Now Project</a>, an entirely PHP-based Facebook Canvas app.</p>
<p>This application offered the user a number of presets to apply to their image, very much along the lines of <a title="Hipstamatic iPhone App - Digital Photography Never Looked So Analog" href="http://hipstamaticapp.com/" target="_blank">Hipstamatic</a> &#8211; or rather it’s recent successor, <a title="instagr.am" href="http://instagr.am/" target="_blank">Instagram</a>.</p>
<p>Here we made use of <a title="PHP: imagefilter - Manual" href="http://www.php.net/manual/en/function.imagefilter.php" target="_blank">GD’s built-in image filter</a> functions, which are really handy.</p>
<p>A lot of the time GD is called upon for the likes of simple image cropping, rotating or resampling. That describes the most of my experience, anyway.</p>
<p>The filter options however offer control over a number of image properties as common as you’d expect in any image editing software, brightness and contrast for example. There’s conversion to grayscale and colour inverting, there’s a colorize method to handle RGB processing, also blur and smoothing options.</p>
<p>All can be used in combination to achieve a wide breadth of results.</p>
<p>In order to create the desired presets, something requiring a more creative eye than mine, I built a custom tool for uploading and processing images on-the-fly so the project designers could tweak and exact filter combination until they found their ideal results. It provided an option to export the settings so I could implement them later.</p>
<p>I’ve recreated that tool in a simpler form <a title="PHP GD Filter testing" href="http://marchibbins.com/dev/gd/">here</a>. This one was thrown together very quickly this evening, there are a few images to choose from and a number of settings &#8211; it’s all achieved entirely with the GD library. Almost completely untested, not optimised whatsoever &#8211; so you’ll have to bear with the waiting time. <a title="PHP GD Filter testing" href="http://marchibbins.com/dev/gd/">Have a play!</a></p>
<p><a href="http://marchibbins.com/dev/gd/"><img class="aligncenter size-full wp-image-1705" title="GD filter testing tool" src="http://blog.marchibbins.com/wp-content/uploads/2011/03/gd-testing.jpg" alt="" width="500" height="415" /></a></p>
<p>You get the idea anyway.</p>
<p>GD can be used for watermarking images, often seen applying a transparent PNG to the corner of a picture, say. The same process is used to apply vignettes and overlays of scratches or noise in this example.</p>
<p>It’s really adaptable and still really useful &#8211; it hasn&#8217;t seen an update since November 2007.</p>
<p><a title="marchibbins/GD-Filter-testing - GitHub" href="https://github.com/marchibbins/GD-Filter-testing" target="_blank">Full source code for the tool is available on GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2011/03/08/hip-to-be-square/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Start Making Sense</title>
		<link>http://blog.marchibbins.com/2010/01/12/start-making-sense/</link>
		<comments>http://blog.marchibbins.com/2010/01/12/start-making-sense/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 12:43:29 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[blogging]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=1376</guid>
		<description><![CDATA[Adding some optimisations to my Wordpress blog, improving SEO and clearing some things up.]]></description>
			<content:encoded><![CDATA[<p>I thought with the turn of the new year and whatnot, I&#8217;d make a few improvements to my blog.</p>
<p>For some reason when I started writing I thought it&#8217;d be a great idea to use rather abstract titles for all of my posts, something short and curiously inviting (hopefully) rather than the straightforward approach of actually describing what the post is about. I wanted to avoid long and boring titles like &#8220;Differences between Flash Player 10 and 10.1&#8243; or &#8220;How to install.. blah blah&#8221;.</p>
<p>So although, as far as titles go, they could probably be more boring &#8211; they could definitely be more helpful. Most of them are obscure and aren&#8217;t really meaningful. They&#8217;re fine for human readers, especially after people have read the post, but they&#8217;re not so good for search engines or people searching for what I&#8217;ve written about.</p>
<p>I decided then to use WordPress&#8217; <a title="Custom Fields « WordPress Codex" href="http://codex.wordpress.org/Custom_Fields" target="_blank">custom fields</a> to add a descriptive &#8216;subtitle&#8217; to each post that should shed some light on what I&#8217;m actually writing about and hopefully the titles should start making sense.</p>
<p>I could have started anew and use descriptive titles from here on, but that would be inconsistent and make those old titles even more nonsensical. I could have renamed the lot, but the old URLs would then be meaningless (the name is in the permalink) or if I changed those URLs then previously incoming links would be broken.</p>
<h3><a name="Adding_Custom_Fields" class="anchor">Adding Custom Fields</a></h3>
<p>Custom fields are essentially metadata for each post and can be pulled in by your theme.</p>
<p>I choose to display my subtitle under the each post title so humans, search engines and crawlers alike can read abstract title and the helpful subtitle description together.</p>
<p>Custom fields are added at the bottom of the &#8216;Add New Post&#8217; page and can be any amount of value pairs that take a <strong>name</strong> and <strong>value</strong>.</p>
<p>These custom fields won&#8217;t automatically show in your post, you&#8217;ll need to edit your current theme&#8217;s PHP files to retrieve them.</p>
<p>The <a title="Function Reference/get post custom « WordPress Codex" href="http://codex.wordpress.org/Function_Reference/get_post_custom" target="_blank"><strong>get_post_custom</strong> function</a> will return a multidimensional array with all custom fields of a particular post or page, which you can traverse to find your custom value pair:</p>
<blockquote><p>&lt;?php get_post_custom($post_id); ?&gt;</p></blockquote>
<p>Otherwise you can use the <a title="Function Reference/get post custom values « WordPress Codex" href="http://codex.wordpress.org/Function_Reference/get_post_custom_values" target="_blank"><strong>get_post_custom_values</strong> function</a> and send the field name to get an array of all the values with that particular key:</p>
<blockquote><p>&lt;?php get_post_custom_values($key); ?&gt;</p></blockquote>
<p>I&#8217;m using a field to add a subtitle, so I append the value onto the end of my title which you can see on the left (if you&#8217;re reading this <a title=" » Start Making Sense by Marc Hibbins" href="http://blog.marchibbins.com/2010/01/12/start-making-sense/">on my site</a>).</p>
<p>Semantically this is part of my title. As I stated above, for SEO purposes, I want this to be considered as a part of my title for all intents and purposes by search engines and spiders as well as humans. I only ever want them considered &#8216;separately&#8217; on an aesthetic level and in WordPress&#8217; forming of the permalink.</p>
<p>So I&#8217;ve styled up the subtitle to look complimentary to the &#8216;actual&#8217; title with CSS, but injected it into the post&#8217;s <strong>h2</strong> title tag in my mark-up so it stays semantically sound for machine readers and accessibility purposes.</p>
<p>So here&#8217;s the combined title mark-up (without style hooks):</p>
<blockquote><p>&lt;h2 class=&#8221;entry-title&#8221;&gt;<br />
<span style="padding-left:15px">&lt;a href=&#8221;..&#8221;&gt;Start Making Sense&lt;/a&gt;:</span><br />
<span style="padding-left:30px">&lt;span class=&#8221;entry-subtitle&#8221;&gt;Wordpress, SEO and pimping my blog&lt;/span&gt;</span><br />
&lt;/h2&gt;</p></blockquote>
<p>And the styled and un-styled versions look like this:</p>
<p><a href="http://blog.marchibbins.com/wp-content/uploads/2010/01/subtitle-styled.jpg" target="_blank"><img src="http://blog.marchibbins.com/wp-content/uploads/2010/01/subtitle-styled-300x95.jpg" alt="" title="Title and subtitle - styled" width="300" height="95" class="aligncenter size-medium wp-image-1386" style="border:1px solid #333" /></a><br />
<a href="http://blog.marchibbins.com/wp-content/uploads/2010/01/subtitle-unstyled.jpg" target="_blank"><img src="http://blog.marchibbins.com/wp-content/uploads/2010/01/subtitle-unstyled-300x95.jpg" alt="" title="Title and subtitle - unstyled" width="300" height="95" class="aligncenter size-medium wp-image-1387" style="border:1px solid #fff" /></a></p>
<p>It&#8217;s subject to a conditional statement that checks whether the custom field has been populated, so I don&#8217;t have to rush through adding them to all my posts and those without subtitles yet won&#8217;t look broken.</p>
<p>This does mean however that it&#8217;s only implemented by the theme, not by the publishing platform. This means it will only be seen by visitors to the blog, it isn&#8217;t published to the RSS feed, for example, so syndicated readers won&#8217;t see it.</p>
<h3><a name="Sitemaps" class="anchor">Sitemaps</a></h3>
<p>Another improvement for SEO purposes was to add an XML sitemap.</p>
<p>I recently added a HTML sitemap in the form of my <a title="» Index by Marc Hibbins" href="http://blog.marchibbins.com/index/" target="_blank">index page</a>, but then saw <a title="YouTube - Which is better: an HTML site map or XML Sitemap?" href="http://www.youtube.com/watch?v=hi5DGOu1uA0&amp;fmt=22" target="_blank">Google&#8217;s Matt Cutts discussing HTML versus XML sitemaps</a> who concludes that if you can have both, then do so.</p>
<p>It&#8217;s very easy to generate a sitemap and according to Matt&#8217;s video a simple list of URLs would suffice, but I looked up the <a title="WordPress › WordPress Plugins" href="http://wordpress.org/extend/plugins/" target="_blank">WordPress Plugin Directory</a> for ready-to-roll solution and found the <a title="WordPress › Google XML Sitemaps « WordPress Plugins" href="http://wordpress.org/extend/plugins/google-sitemap-generator/" target="_blank">Google XML Sitemaps</a> which does the job for me.</p>
<p>It&#8217;s fully automatic so it doesn&#8217;t need my attention once I&#8217;ve installed it. It generates an XML file based on my current posts and pages and automatically updates whenever I publish or modify anything new.</p>
<p>It also sends notifications of updates to the main search engines &#8211; Google, Bing, Ask.com and Yahoo! &#8211; and has a number of advanced options concerning prioritising pages and setting the frequency of how often certain pages should be checked again by crawlers for updates.</p>
<p>The XML file it generates sits at <a title="My Sitemap" href="http://blog.marchibbins.com/sitemap.xml" target="_blank">http://blog.marchibbins.com/sitemap.xml</a> (for me) and there&#8217;s an option to attach an XSL file for styling, but I choose just to use plain XML.</p>
<h3><a name="Social_Bookmarking" class="anchor">Social Bookmarking</a></h3>
<p>I got to browsing some of the other <a title="WordPress › Most Popular « WordPress Plugins" href="http://wordpress.org/extend/plugins/browse/popular/" target="_blank">popular plugins</a> and temporarily tried out <a title="WordPress › Sociable « WordPress Plugins" href="http://wordpress.org/extend/plugins/sociable/" target="_blank">Sociable</a> which adds typical social bookmarking links to the bottom of each post.</p>
<p>It supports nearly 100 different APIs and <a title="WordPress › Sociable « WordPress Plugins" href="http://wordpress.org/extend/plugins/sociable/screenshots/" target="_blank">the drag-and-drop interface</a> and nice and easy to work with.</p>
<p>I chose not to use it in the end, I thought it was a bit over-the-top for my site.</p>
<p>There&#8217;s a lot more in the directory though, like <a title="WordPress › Add to Any: Share/Bookmark/Email Button « WordPress Plugins" href="http://wordpress.org/extend/plugins/add-to-any/" target="_blank">Add to Any</a>, <a title="WordPress › SexyBookmarks « WordPress Plugins" href="http://wordpress.org/extend/plugins/sexybookmarks/" target="_blank">SexyBookmarks</a> and <a title="WordPress › ShareThis « WordPress Plugins" href="http://wordpress.org/extend/plugins/share-this/" target="_blank">ShareThis</a> &#8211; though they&#8217;re not hard to write anyway, if I eventually change my mind.</p>
<h3><a name="Tweaks" class="anchor">Tweaks</a></h3>
<p>I made a few other minor changes here and there, some CSS changes and design tweaks.</p>
<p>I threw an RSS link into the header and dropped the amount of posts that show on my front page.</p>
<p>I realised my posts can tend to get pretty lengthy and often have embedded videos or Flash content, so showing ten of those (the default) made the page quite heavy.</p>
<p>I started using the <a title="Theme Tuesday: ChaosTheory — Blog — WordPress.com" href="http://en.blog.wordpress.com/2007/11/05/theme-tuesday-chaostheory/" target="_blank">ChaosTheory theme</a> when my blog was freely hosted on WordPress.com and I&#8217;ve stuck with it since, making odd modifications to both server-side code and the front-end as and when. To use it on a WordPress.org blog I found <a title="WordPress › Support » Chaos Theory Theme" href="http://wordpress.org/support/topic/192260" target="_blank">a port hosted by Automattic</a> but it&#8217;s never been quite right nor entirely compliant with mark-up or CSS standards, I&#8217;ve only really maintained it for consistency.</p>
<p>Recently though I found the <a title="Unicorn" href="http://qa-dev.w3.org/unicorn/" target="_blank">Unicorn &#8216;Universal Conformance Checker&#8217;</a> from the W3C which combines all the common validation checks and also has a MobileOK Checker which looks at the &#8216;mobile-friendliness&#8217; of a site.</p>
<p>Shamefully my blog scores an awful 0/100, due to links with <strong>&#8220;_blank&#8221;</strong> targets, the amount of images embedded, the presence of Flash and Javascript and a ton of other things.</p>
<p>Over time it&#8217;ll be my aim to get all that sorted. Hopefully without having to start my own theme completely from scratch.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2010/01/12/start-making-sense/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generator</title>
		<link>http://blog.marchibbins.com/2009/08/11/generator/</link>
		<comments>http://blog.marchibbins.com/2009/08/11/generator/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 09:45:47 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[collaboration]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ydn]]></category>

		<guid isPermaLink="false">http://blog.marchibbins.com/?p=809</guid>
		<description><![CDATA[This month's YDN Tuesday was presented by Steve Marshall, he spoke about code generation, 'Writing the Code that Writes the Code'.]]></description>
			<content:encoded><![CDATA[<p>This month&#8217;s YDN Tuesday was presented by <a title="About / nascentguruism" href="http://nascentguruism.com/about" target="_blank">Steve Marshall</a>, he spoke about code generation, <a title="Skills Matter : Yahoo! Developer Network : Writing the Code" href="http://skillsmatter.com/event/java-jee/writing-the-code-that-writes-the-code-code-generation-in-action" target="_blank">&#8216;Writing the Code that Writes the Code&#8217;</a>.</p>
<p>A bit of a disclaimer: Going into this talk I wasn&#8217;t sure how much I&#8217;d be able to take from it, or whether what Steve would be discussing would be relevant to my own kind of development. I figured he&#8217;d be talking about working with huge projects with (literally) tens of thousands of lines of code and I don&#8217;t think that the evening was part of the &#8216;RIA&#8217; umbrella which is probably closest to home for me. Anyway although Steve&#8217;s talk <em>did </em>cover those kinds of projects, he also went through some platform-agnostic fundamentals &#8211; the kind of transferable ideas that could be applied to any coder &#8211; and it&#8217;s really those I&#8217;m looking at here.</p>
<h3><a name="Code_Generation_in_Action" class="anchor">Code Generation in Action</a></h3>
<p>Steve opened with a bit of code generation evangelism, introducing a discussion as to why code generation is something that all developers should want and should do.</p>
<p>Each point here I think speaks for itself, but only really having gone over each benefit staring me in the face have I questioned, hold on, why don&#8217;t I do this already? It&#8217;s a convincing argument..</p>
<p>The most immediate is scalability &#8211; so often development projects have large amounts of repetition, say in creating views, or sets of view/mediator/component classes, or whatever &#8211; needless to say as projects get larger, generating this kind of code from templates and base classes reduces or even eliminates the room for error.</p>
<p>Neatly, this this was his next point &#8211; consistency. Automated code cannot be mistyped or have any part overlooked (as could when writing by hand), unless of course the source is incorrect. And even if that&#8217;s the case, a small change can be rolled out to all generated code once corrected. Which brings us to his third point &#8211; automatic code is of course far quicker to produce.</p>
<p>Steve also suggests that generated code is &#8216;predictable&#8217;, in a way. Whether looking at code that has been generated or that written for &#8216;expansion&#8217; (more on this later), on the whole it&#8217;s consequently easier to digest. Likewise, source code that is to be used by a generator or to be &#8216;expanded upon&#8217; is, by its very nature, a smaller volume &#8211; so therefore easier to approach.</p>
<p>It&#8217;s also a single point of knowledge. Only the core source code needs to be understood. A project of tens of thousands of lines of code would be near impossible to traverse or otherwise understand, knowing that code has been generated from a smaller source that you <em>do</em> understand offers a reassurance that the rest of the code is good.</p>
<p>Another advantage is the ease of which the code can be refactored. Obviously only the source code base requires changing, the larger volume is generated automatically. This kind of code is language independent.</p>
<p>Outside of working with code direcly, the kind of abstraction writing <em>for </em>code generation offers its own benefits. Although arguably a desirable trait of good programming anyway, Steve suggests this kind of code is far more decoupled with the design process. Thinking more abstractly about coding means it has less effect on design capability, and vice-versa. Design reviews or changes should have no bearing on the coding. By being naturally quicker to produce, Steve also says that generated code is a good methodology to pursue when prototyping applications.</p>
<p>Steve also discussed testing, offering that generated code has (or presumably can have) 100% test coverage. Similarly, full documentation is easier achieved by way of having written a smaller code base.</p>
<p>Overall, cleaner code that&#8217;s easier to work with and easier to understand is undeniably a more attractive prospect to work with. Developers are more enthusiastic about working with that kind of code and so that kind of code is of a higher quality &#8211; in the first place, as well as because it has been consistently deployed, tested and documented thereafter.</p>
<p>So how is this achieved?</p>
<h3><a name="Models" class="anchor">Models</a></h3>
<p>Steve recognised six principle methods for generating code, each technique seemingly increasingly more &#8216;advanced&#8217; than the previous and, as I said before, each progressively more suited to larger-scale projects.</p>
<p>He saw these as:</p>
<ol>
<li><a href="#Code_munging">Code munging</a></li>
<li><a href="#Inline_code_expansion">Inline code expansion</a></li>
<li><a href="#Mixed_code_generation">Mixed code generation</a></li>
<li><a href="#Partial_class_generation">Partial class generation</a></li>
<li><a href="#Tier_generation">Tier generation</a></li>
<li><a href="#Full_domain_language">Full domain language</a></li>
</ol>
<p>&nbsp;</p>
<p>I&#8217;ll look at each briefly.</p>
<h3><a name="Code_munging" class="anchor">Code munging</a></h3>
<p><br/><img src="http://blog.marchibbins.com/wp-content/uploads/2009/08/code_munging.jpg" alt="Code Munging" title="Code Munging" width="500" height="65" class="aligncenter size-full wp-image-839" /><br />
Code munging essentially takes your code, parses, introspects and creates something new that&#8217;s not code, though still of benefit and in inherently useful.</p>
<p>Steve&#8217;s examples were <a title="Javadoc Tool Home Page" href="http://java.sun.com/j2se/javadoc/" target="_blank">Javadoc</a> or <a title="phpDocumentor: The complete documentation solution for PHP" href="http://www.phpdoc.org/" target="_blank">PHPdoc</a>, it&#8217;s the most basic form of generation you can introduce to your workflow.</p>
<h3><a name="Inline_code_expansion" class="anchor">Inline code expansion</a></h3>
<p><br/><img src="http://blog.marchibbins.com/wp-content/uploads/2009/08/inline_code_expansion.jpg" alt="Inline Code Expansion" title="Inline Code Expansion" width="500" height="65" class="aligncenter size-full wp-image-840" /><br />
This the &#8216;expansion&#8217; mentioned above, where source code is annotated with keywords or variables where upon additional code is generated to replace those markers to extrapolate upon the original.</p>
<p>Templates are the most rudimentary example. This technique gets repetitive jobs done well, quickly and correctly.</p>
<h3><a name="Mixed_code_generation" class="anchor">Mixed code generation</a></h3>
<p><br/><img src="http://blog.marchibbins.com/wp-content/uploads/2009/08/mixed_code_generation.jpg" alt="Mixed Code Generation" title="Mixed Code Generation" width="500" height="80" class="aligncenter size-full wp-image-841" /><br />
This is the first &#8216;real&#8217; form of generation, this expands upon Inline code expansion by allowing the output code to be used as input code once created. Instead of simply replacing special keywords for example, mixed code generation may use start and end markers, expanding code as before, but allowing the result to be worked upon once completed.</p>
<p>This may include code snippets, or smaller templates injected within classes.</p>
<h3><a name="Partial_class_generation" class="anchor">Partial class generation</a></h3>
<p><br/><img src="http://blog.marchibbins.com/wp-content/uploads/2009/08/partial_class_generation.jpg" alt="Partial Class Generation" title="Partial Class Generation" width="500" height="120" class="aligncenter size-full wp-image-836" /><br />
I guess here&#8217;s where things start to get serious. Partial class generation begins to look at modeling languages like UML, creating abstract system models and generating base classes from a definition file.</p>
<p>The base classes are designed to do the majority of the low level work of the completed class, leaving the derived class free to override specific behaviors on a case-by-case basis.</p>
<h3><a name="Tier_generation" class="anchor">Tier generation</a></h3>
<p><br/><img src="http://blog.marchibbins.com/wp-content/uploads/2009/08/tier_generation.jpg" alt="Tier generation" title="Tier generation" width="500" height="120" class="aligncenter size-full wp-image-837" /><br />
This takes partial class generation a level further, a tier generator builds and maintains an entire tier within an application &#8211; not only the base classes. Again from some kind of abstract definition file, but the generator this time outputs files that constitute all of the functionality for an entire tier of the application &#8211; rather than classes to be extended.</p>
<h3><a name="Full_domain_language" class="anchor">Full domain language</a></h3>
<p>Steve didn&#8217;t really talk about this much, he said it&#8217;s very tough &#8211; and even if you think this is what you want to do, it&#8217;s probably not (though a hand from the crowd wanted to reassure that it might not be quite <em>that </em>intimidating).</p>
<p>A domain language is a complete specification dedicated solely to a particular problem &#8211; with specific types, syntax and operations that map directly to the concepts of a particular domain.</p>
<p>I used the <a title="Code Generation Network - Models Introduction" href="http://www.codegeneration.net/tiki-index.php?page=ModelsIntroduction" target="_blank">Code Generation Network&#8217;s Introduction</a> for reference here, which looks like a good resource.</p>
<p>Also, all the diagrams belong to Steve. He&#8217;s put his <a title="Writing Code That Writes Code" href="http://www.slideshare.net/SteveMarshall/writing-code-that-writes-code-1823693" target="_blank">presentation slides on Slideshare</a> and uploaded <a title="Writing Code that Writes Code—nascentguruism" href="http://nascentguruism.com/presentations/codegen/" target="_blank">PDF and Keynote versions on his website</a>.</p>
<p>The presentation was also recorded as a podcast and is now on <a title="Skills Matter : Yahoo! Developer Network:Code Generation in Action" href="http://skillsmatter.com/podcast/java-jee/code-generation-in-action" target="_blank">the Skills Matter site</a>.</p>
<h3><a name="In_retrospect" class="anchor">In retrospect</a></h3>
<p>After all these, Steve took us through an example he&#8217;d worked on where code generation really proved it&#8217;s worth (a huge project for Yahoo!) &#8211; and offered tips and best practices to use once you&#8217;ve convinced your team to take on code generation (see the slides linked to above).</p>
<p>Though in my opinion here he seemed to seemed to almost contradict some of the things he&#8217;d talked about before. He pointed to some tools to use within your workflow, but spoke extensively about writing your own generator. Stressing that it can be written in any language, though should be written in a different language to that of the code being produced, that its easier than perhaps you think &#8211; though still with a fair few caveats.</p>
<p>But what happened to cutting down the work load? As the talk summary says, developer <em>are</em> fundamentally very lazy &#8211; we want to do less and less, surely this requires more effort?</p>
<p>One of his recommendations is that you document your generator once you&#8217;ve written it. But how would you create that documentation, with another generator? Is that meant to be a specially written generator also? And <em>that</em> needing documentation too?</p>
<p>I remember an episode of Sesame Street from my childhood, where Big Bird was painting a bench. Once he&#8217;d finished he made a &#8216;Wet Paint&#8217; sign with the paint remaining, only to realise that the sign also was wet, so needed a &#8216;Wet Paint&#8217; sign of it&#8217;s own. Which of course, was also wet and needed <em>it&#8217;s own</em> sign. Cut back a scene later and the whole street is full of signs. <a title="The Science Creative Quarterly » IN WHICH OUR PROTAGONIST LEARNS THE IMPORTANCE OF THE BASE CASE" href="http://www.scq.ubc.ca/in-which-our-protagonist-learns-the-importance-of-the-base-case/" target="_blank">It was upsetting</a>, to say the least.</p>
<p>I&#8217;m being pedantic, I know.</p>
<p>But I guess that&#8217;s where I recognise a line for me, or at least the kind of development I do. Very large-scale projects <em>do</em> often need this kind of approach, Steve is proof of that. For me only the first few techniques are appropriate. Though those, undeniably, are incredibly beneficial when you have the opportunity to put them into play.</p>
<p>On a similar note, this month&#8217;s LFPUG meeting had a presentation on <a title="London Flash Platform User Group » Blog Archive » UML for AS3" href="http://www.lfpug.com/uml-for-as3/" target="_blank">UML for AS3 by Matthew Press</a>, the recorded video for which is now online &#8211; have a look!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2009/08/11/generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weapon of Choice</title>
		<link>http://blog.marchibbins.com/2008/11/19/weapon-of-choice/</link>
		<comments>http://blog.marchibbins.com/2008/11/19/weapon-of-choice/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 21:53:24 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://hibbins.wordpress.com/?p=155</guid>
		<description><![CDATA[Yesterday, I wrote a ‘how to’ on installing and running multiple versions and concurrent instances of Firefox on Windows XP. But what about the other browser choices?]]></description>
			<content:encoded><![CDATA[<p><em>Yesterday, <a title="Version - Marc Hibbins" href="http://hibbins.wordpress.com/2008/11/19/version/" target="_blank">I wrote</a> a &#8216;how to&#8217; on installing and running multiple versions and concurrent instances of Firefox on Windows XP.</em></p>
<p>But what about the other browser choices? After all, my original intention was a to develope a versatile testing environment, specifically for cross-browser, cross-platform intended web sites.</p>
<p>Surprisingly, running multiple versions of the other major browsers isn&#8217;t as complicated as the Firefox process.</p>
<p><a title="Opera Web Browser | Faster &amp; safer | Download new internet browsers free" href="http://www.opera.com/" target="_blank">Opera</a>, for example, gives you the option whether to install the set-up as an upgrade or separately, straight out of the box. They offer <a title="Download Opera Web Browser" href="http://www.opera.com/download/index.dml?step=2&amp;opsys=Windows&amp;platform=Windows" target="_blank">alternate releases</a> of the current version on their site (9.62 at the time of writing) and have a <a title="Opera browser archive" href="http://arc.opera.com/pub/opera/win/" target="_blank">publicly available archive</a> that goes back to version 3.21 for any old release candidates you need to test.</p>
<p>If you want to run multiple versions of Internet Explorer, you can alter various system and user profile settings in a similar way to my method with Firefox, but it&#8217;s far easier to take advantage of the many &#8216;standalone&#8217; versions you can find online. These are generally third-party, non-Microsoft developments.</p>
<p><a title="TredoSoft | Every little program helps!" href="http://tredosoft.com/" target="_blank">TredoSoft</a> have collated standalone versions of Internet Explorer from 3 up to 6, ready to install from a single set-up &#8211; it&#8217;s called <a title="Install multiple versions of IE on your PC | TredoSoft" href="http://tredosoft.com/Multiple_IE" target="_blank">Multiple IE</a>.</p>
<p>It&#8217;s brilliant to see IE3, I decided I&#8217;d use it as my default browser for a day &#8211; loved seeing the frantic alerts about some <em>alien </em>idea called a &#8216;cookie&#8217; and whether I wanted to risk accepting it onto my computer.</p>
<p>NB: If you&#8217;re concerned about what&#8217;s being installed when you use Multiple IE, you can do it all yourself with the instructions on <a title="Taming Your Multiple IE Standalones" href="http://www.positioniseverything.net/articles/multiIE.html" target="_blank">Manfred Staudinger&#8217;s Multiple IE page</a>.</p>
<p>There&#8217;s standalone applications for other browsers too. I only use Windows nowadays, but I&#8217;ve recently found Michel Fortin&#8217;s <a title="Multi-Safari" href="http://michelf.com/projects/multi-safari/" target="_blank">standalone versions of Safari</a> &#8211; he&#8217;s even numbered the icons for your dock (<a title="Running older browsers" href="http://comments.deasil.com/2007/08/26/geekfindr-running-older-browsers/" target="_blank">via</a>). That page also links to instructions on running <a title="Running multiple Firefox versions concurrently | Jeroen Coumans" href="http://www.jeroencoumans.nl/journal/multiple-firefox-versions" target="_blank">multiple versions of Firefox for Mac</a>.</p>
<p>As for testing Linux system &#8211; and this goes beyond HTML and CSS debugging, I use <a title="VMware Player, Virtual Machine, Virtual PC - VMware" href="http://www.vmware.com/products/player/" target="_blank">VMware Player</a> from <a title="Virtualization via Hypervisor, Virtual Machine &amp; Server Consolidation - VMware" href="http://www.vmware.com/" target="_blank">VMware</a>. Not only because when I&#8217;ve been developing server-side applications, I&#8217;ve not wanted to bother installing those on my home computer base &#8211; because it can be tricky, time-consuming, potentially damaging if things go wrong, etc etc and I tend to use Linux-based system for deployment anyway &#8211; but because <a title="Software appliance - Wikipedia, the free encyclopedia" href="http://en.wikipedia.org/wiki/Software_appliance" target="_blank">appliances</a> are so damn handy.</p>
<p>Virtual appliances run within a virtual machine like VMware Player as self-contained, packaged software. They can be created and restored as system images, so if something goes wrong &#8211; it&#8217;s so easy to turn back, with no risk to whatever personal data you might have on your computer as you would installing software as services on the base.</p>
<p>More than that, they&#8217;re readily available. VMware has an <a title="Virtual Appliance Marketplace, Virtual Appliances, VMware Appliance - VMware" href="http://www.vmware.com/appliances/" target="_blank">Appliance Marketplace</a>, with over 900 ready-to-go appliances and a simple, central repository to develop or distribute your own.</p>
<p>There&#8217;s popular Linux distributions, various <a title="Red Hat Enterprise Linux | Virtual Appliance Marketplace" href="http://www.vmware.com/appliances/directory/626" target="_blank">Red Hat</a>, <a title="Ubuntu 8.04 Desktop with VMware Tools | Virtual Appliance Marketplace" href="http://www.vmware.com/appliances/directory/1224" target="_blank">Ubuntu</a>, <a title="Fedora 9 | Virtual Appliance Marketplace" href="http://www.vmware.com/appliances/directory/1255" target="_blank">Fedora</a> &#8211; all pretty clean, the basic install, but also some interesting others.</p>
<p>I particularly like the <a title="The Web Developer Appliance | Virtual Appliance Marketplace" href="http://www.vmware.com/appliances/directory/134" target="_blank">Web Developer appliance</a>, specifically designed to safely test and fine tune web apps. Based on Ubuntu, the creator has consciously included some trendy applications that are gathering more attention, like Ruby on Rails. On top of the expected with Apache, PHP and MySQL, you get a a handful of browsers, various database and debugging tools, code and graphics editors, all as standard, all configured and running &#8211; great way to get started.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2008/11/19/weapon-of-choice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Version</title>
		<link>http://blog.marchibbins.com/2008/11/19/version/</link>
		<comments>http://blog.marchibbins.com/2008/11/19/version/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 01:11:55 +0000</pubDate>
		<dc:creator>Marc Hibbins</dc:creator>
				<category><![CDATA[bbc]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://hibbins.wordpress.com/?p=138</guid>
		<description><![CDATA[Sometimes it can be really tricky to get hold of the all the browsers and platform machines that you need to with. There’s various ways of reconfiguring application and registry settings to install multiple versions of browsers on a single machine, the following method is one method.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently completed building a new site for the BBC, this time a project pretty much entirely in HTML. As you&#8217;d probably expect, the BBC are pretty hot on maintaining a wide foundation of web standards and providing a high level of accessible content, two approaches I&#8217;d say I&#8217;m a keen practitioner of.</p>
<p>I truly believe that there is zero excuse for slapping &#8216;this page is best viewed with [browser name] in [screen dimension]&#8216; on any website, unless it is specifically designed otherwise &#8211; and <em>especially </em>if it&#8217;s text and image content only &#8211; when it&#8217;s really so straightforward to adhere to some basic standards which, with almost an exponential effect, can improve the way your content is delivered, cross-browser, cross-platform. That kind of disclaimer is just a cop out, plus <a title="Tim Berners-Lee - Wikiquote" href="http://en.wikiquote.org/wiki/Tim_Berners-Lee" target="_blank">Tim agrees</a> - and he&#8217;s the man.</p>
<p>A part of that development process is to determine, amongst things, which browsers on what device or platform are the priority. In turn, getting hold of these browsers readily for testing and ideally, available frequently for an agile development. Not leaving testing until a stage where any damage might be irreparable because of time constraints and deadlines, or viewing testing time as an easily squeezable phase, first to suffer when scope is altered.</p>
<p>The BBC have outlined such requirements, they have very in depth guidelines publicly available on their site. The following table defines the &#8216;levels&#8217; of browser support that all projects must comply with:</p>
<p><a href="http://hibbins.files.wordpress.com/2008/11/bbc_browser_support.jpg"><img class="aligncenter size-medium wp-image-150" title="BBC Browser Support" src="http://hibbins.files.wordpress.com/2008/11/bbc_browser_support.jpg?w=300" alt="BBC Browser Support" width="300" height="154" /></a> </p>
<p>Abbreviated definitions:</p>
<p>Level 1:</p>
<ul>
<li>All content and functionality must work, minimised variations to presentation, fully-styled, maximise user experience.</li>
</ul>
<p>Level 2:</p>
<ul>
<li>Core content must be readable, usable and navigable, any degradation to must be graceful, no content must be obscured.</li>
</ul>
<p>Level 3:</p>
<ul>
<li>No support or testing necessary. </li>
</ul>
<p> </p>
<p><a title="BBC - Future Media Standards - Guidelines - Browser Support Standards v3.3" href="http://www.bbc.co.uk/guidelines/futuremedia/technical/browser_support.shtml" target="_blank">Read the full support documentation</a>.</p>
<p>What can be really tricky sometimes though, is getting hold of the all those browsers and platforms to test with. There&#8217;s various ways of reconfiguring application and registry settings to install multiple versions of browsers, but the following method is how I installed and concurrently ran multiple instances and versions of Firefox on Windows XP.</p>
<p>Firstly, Firefox 3 (current version, 3.0.4) is readily available from <a title="Firefox web browser | Faster, more secure, - customizable" href="http://www.mozilla.com/en-US/firefox/" target="_blank">Mozilla</a>, as are <a title="Mozilla Firefox 2" href="http://www.mozilla.com/en-US/firefox/all-older.html" target="_blank">previous releases of Firefox 2</a>. Firefox 1.5 though is slightly harder to find. Along with a <a title="Firefox README" href="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/README" target="_blank">strong recommendation</a> not use them, you can get other releases from the <a title="Mozilla Firefox FTP Archive" href="ftp://archive.mozilla.org/pub/mozilla.org/firefox/releases/" target="_blank">FTP archive</a> going back to v0.10!</p>
<p>With each set-up, select Custom Installation, giving each version a different installation folder, so something like:</p>
<blockquote><p>C:\Program Files\Mozilla Firefox 1.5<br />
C:\Program Files\Mozilla Firefox 2.0<br />
C:\Program Files\Mozilla Firefox 3.0</p></blockquote>
<p>Be sure to uncheck the option to run Firefox when you click Finish, this bypasses writing some default system settings.</p>
<p>Then you&#8217;ll need to create a seperate Firefox profile for each version of the browser you&#8217;ll be running. Open the profile manager from Start &gt; Run:</p>
<blockquote><p>&#8220;C:\Program Files\Mozilla Firefox 2.0\firefox.exe&#8221; -ProfileManager</p></blockquote>
<p>It doesn&#8217;t matter which you choose. Create three new profiles, I named mine &#8216;Firefox 1.5&#8242;, &#8216;Firefox 2.0&#8242; and &#8216;Firefox 3.0&#8242; to keep it obvious.</p>
<p>Then I created three .bat files in Notepad, these function as shortcuts to the different versions, as follows:</p>
<p>Firefox 1.5:</p>
<blockquote><p>set MOZ_NO_REMOTE=1<br />
start &#8220;&#8221; &#8220;C:\Program Files\Mozilla Firefox 1.5\firefox.exe&#8221; -P &#8220;Firefox 1.5&#8243;<br />
set MOZ_NO_REMOTE=0</p></blockquote>
<p>Firefox 2.0:</p>
<blockquote><p>set MOZ_NO_REMOTE=1<br />
start &#8220;&#8221; &#8220;C:\Program Files\Mozilla Firefox 2.0\firefox.exe&#8221; -P &#8220;Firefox 2.0&#8243;<br />
set MOZ_NO_REMOTE=0</p></blockquote>
<p>Firefox 3.0:</p>
<blockquote><p>set MOZ_NO_REMOTE=1<br />
start &#8220;&#8221; &#8220;C:\Program Files\Mozilla Firefox 1.5\firefox.exe&#8221; -P &#8220;Firefox 3.0&#8243;<br />
set MOZ_NO_REMOTE=0</p></blockquote>
<p>Obviously change the path and profile names if you don&#8217;t use the same as mine, open those up et voila!</p>
<p><a href="http://hibbins.files.wordpress.com/2008/11/firefox.jpg"><img class="aligncenter size-medium wp-image-147" title="Running multiple versions of Firefox" src="http://hibbins.files.wordpress.com/2008/11/firefox.jpg?w=300" alt="Running multiple versions of Firefox" width="300" height="166" /></a></p>
<p>Click to enlarge [<a title="Aadesh Mistry - Blog Archive - Installing multiple versions of Firefox" href="http://www.idizyn.com/development/installing-multiple-versions-of-firefox/" target="_blank">via</a>].</p>
<p><strong>Update (18.08.09):</strong> This also works with Firefox 3.5, just follow the same steps!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marchibbins.com/2008/11/19/version/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

