<?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"
	>

<channel>
	<title>Purple Haze!</title>
	<atom:link href="http://purplehaze.me.uk/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://purplehaze.me.uk</link>
	<description>Ramblings of a software engineer in london</description>
	<pubDate>Sun, 11 Jul 2010 10:11:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>The greatest burger in the world</title>
		<link>http://purplehaze.me.uk/?p=89</link>
		<comments>http://purplehaze.me.uk/?p=89#comments</comments>
		<pubDate>Sun, 11 Jul 2010 10:08:57 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Random thoughts]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=89</guid>
		<description><![CDATA[Dear Reader, I can appreciate your cynicism here. I too was skeptical that my mind could be blown by a mere burger. I am now 26 years old and I have eaten a lot of burgers from a variety of places and felt confident that I knew all there was to know. I mean, it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Reader, I can appreciate your cynicism here. I too was skeptical that my mind could be blown by a mere burger. I am now 26 years old and I have eaten a lot of burgers from a variety of places and felt confident that I knew all there was to know. I mean, it&#8217;s not really possible for a burger to be <em>that</em> good. Sure there are varying degrees of quality, Burger King is better than McDonalds, getting a fresh one from the supermarket and cooking it yourself can be quite pleasant.</p>
<p>But a burger is a burger and it&#8217;s just not a high quality foodstuff inherently. It&#8217;s like trying to make garden peas taste <strong>really</strong> good.</p>
<p>If there is one thing I have learnt during my short lifetime so far, it&#8217;s that I am almost always wrong.</p>
<p>Reader, I beg you, make it your mission to go to Gent (Belgium), go to Martino&#8217;s and get the cheese and egg burger.</p>
<p><a title="IMG_4882 by chrisjames, on Flickr" href="http://www.flickr.com/photos/chrisjames/4779402711/"><img src="http://farm5.static.flickr.com/4093/4779402711_3fee4149c0.jpg" alt="IMG_4882" width="500" height="375" /><em>Epic fries not pictured</em></a></p>
<p>You may be looking at this picture and asking, where the hell is the burger?</p>
<p>The burger is lovingly enclosed within the delicious sauce that encompasses the majority of the plate. It vaguely tastes like mayo and tomato ketchup but there is way more to it and you will take great pleasure in dipping your fries in it. In case you didnt know, Belgium is famous for making great fries and this fact makes the meal even better.</p>
<p>Above the burger itself are some fried onions and a gloriously melted cheese, quite mild and complements the rest of the dish beautifully. The fried egg on top is perfectly prepared.</p>
<p>The burger itself is divine, perfectly cooked, not at all dry like you experience far too often in British establishments and tastes like meat, which makes a change.</p>
<p>Accompany this meal with a choice from the wide selection of beers and you have yourself a perfect meal for around 15 euros.</p>
<p>It&#8217;s so good, Ruth and I went twice and I just noticed a little bit of drool appear around my lips; I wish I was joking.</p>
<p><a href="http://www.flickr.com/photos/chrisjames/4779405879/" title="IMG_4885 by chrisjames, on Flickr"><img src="http://farm5.static.flickr.com/4121/4779405879_4e1beec862.jpg" width="375" height="500" alt="IMG_4885"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=89</wfw:commentRss>
		</item>
		<item>
		<title>My complaint to TFL about Keith at Stratford</title>
		<link>http://purplehaze.me.uk/?p=88</link>
		<comments>http://purplehaze.me.uk/?p=88#comments</comments>
		<pubDate>Fri, 14 May 2010 10:43:48 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Random thoughts]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=88</guid>
		<description><![CDATA[It seems like most people have a story to tell about how customer service at TFL is god awful. Conflicting and incorrect advice is a common complaint amongst my friends.
The following is by far the worst customer service I have ever recieved. I came to this man simply asking for help and without provocation he [...]]]></description>
			<content:encoded><![CDATA[<p>It seems like most people have a story to tell about how customer service at TFL is god awful. Conflicting and incorrect advice is a common complaint amongst my friends.</p>
<p>The following is by far the worst customer service I have <strong>ever </strong>recieved. I came to this man simply asking for help and without provocation he was an utter c*nt to me.</p>
<p>I honestly hope the fucker gets the sack although I realise my complaint will probably fall on deaf ears. I have worked in customer service under rediculous pressure and even as an immature 16 year old managed to maintain an air of politeness. I&#8217;m sure there are plenty of people out of the 2.5 million people unemployed right now who wouldn&#8217;t be such a <a href="http://en.wikipedia.org/wiki/Jobsworth">useless jobsworth douche</a>.</p>
<h2>The complaint</h2>
<p><strong>Complaint regarding poor customer service and appalling rudeness from staff member Keith, at Stratford Station ticket office, 9th of May 2010.</strong></p>
<p>I travelled into Stratford by train from Manor Park earlier the same day, and seeing the Central Line was out of service, had asked a staff member if the DLR service was running, who told me that Yes, today the DLR line was running from Stratford.</p>
<p>When I returned to the station to continue my journey,  towards the DLR platform, I saw that it was closed off and there was a notice that the line was being improved.</p>
<p>I touched out within 10minutes (which I believed would mean I was not charged), but I saw that the fare had been taken off my Oyster card.<br />
I asked the TFL workers at the barriers and they told me to go to the ticket office to be refunded.</p>
<p>This is where I encountered Keith, who:</p>
<ul>
<li>Did not greet me, I had to greet him.</li>
<li>Was sarcastic; when I told him I had touched in and touched out and that I had been charged he replied with &#8220;Yeah it will do that&#8221;</li>
<li>Did not listen to my concern or complaint</li>
</ul>
<p>This made me cross and after asking him not to be condescending, he:</p>
<ul>
<li>Was unhelpful; did not refund the money for the journey I had not taken after being given misinformation by staff</li>
<li>Was demeaning, implying I was stupid by saying &#8220;the signs all over the station mean nothing to you then&#8221; (which was understandably offensive having categorically been told the DLR was running)</li>
<li>Was rude, and returned my pass with “yeah, whatever” and without a refund, laughing about me with his colleague</li>
</ul>
<p>I then left the ticket desk, but decided to return to get his name to make a formal complaint.</p>
<p>He looked at me so I explained that I was taking his name and he continued to insult me by asking whether I would like him to spell it for me, as apparently I cannot read.</p>
<p>He then slowly and phonetically pronounced each letter of his name as if I am a moron, followed by a wink before I left the station.</p>
<p>I am furious after this. I was simply a customer asking for some help and was treated like an idiot and without respect.</p>
<p>It astounds me that someone with such poor manners can possibly be a front for the main form of transportation in London.</p>
<p>I expect an apology and a full refund of £1.30</p>
<p>My oyster card number is xxxxxxxxx</p>
<p>Here are the details of the journey I gathered from the TFL website<br />
17:01 Stratford Exit £3.00   £14.70   16:58 Stratford Entry - £4.30   £11.70</p>
<p>I look forward to your prompt reply</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=88</wfw:commentRss>
		</item>
		<item>
		<title>Allergic reaction to soap at Fitness First</title>
		<link>http://purplehaze.me.uk/?p=86</link>
		<comments>http://purplehaze.me.uk/?p=86#comments</comments>
		<pubDate>Tue, 11 May 2010 20:29:51 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Random thoughts]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=86</guid>
		<description><![CDATA[After having a 6 month hiatus from the gym and having my knee operation I felt it was finally the right time to try and get rid of some pounds that I have gained.
After an hour or so of working out I had a shower and returned home.
Once I got home I started having an [...]]]></description>
			<content:encoded><![CDATA[<p>After having a 6 month hiatus from the gym and having my knee operation I felt it was finally the right time to try and get rid of some pounds that I have gained.</p>
<p>After an hour or so of working out I had a shower and returned home.</p>
<p>Once I got home I started having an asthma attack, quite a severe one by my standards so I blasted around 6 puffs of Ventolin down my lungs. Soon I noticed that my eyes were starting to water and my nose was becoming blocked, like hay fever.</p>
<p>Ruth suggested I had a shower so I did. When I got out I looked in the mirror and noticed that my bottom lip had swollen up and my face was a crimson red. Not cool. As I went back in to the bedroom I started to feel like shit; heartburn, difficulty in swallowing and I noticed that I had <strong>huge disgusting rashes all over my body.</strong></p>
<p>I had to lie down and I took a number of anti-histamines to try and stop the allergic reaction which is very similar to the one I have when I eat fish.</p>
<p>After a while the anaphylactic shock eased a bit and Ruth and I wondered wtf caused this. I noticed that the rashes, whilst being huge and disgusting were localised mainly to where I had actually bothered to use the soap at the gym properly; for instance my lower legs are mainly fine as I didn&#8217;t really wash them.</p>
<p>Presumably Fitness First have changed their soap to some evil death soap AIDS concentrate since the last time I visited. Suffice to say I will let them know.</p>
<p><a href="http://www.flickr.com/photos/chrisjames/4599604170/" title="IMG_4743 by chrisjames, on Flickr"><img src="http://farm2.static.flickr.com/1325/4599604170_3632c81818.jpg" width="500" height="375" alt="IMG_4743" /></a></p>
<p>Here are some pictures. Believe me I am not proud of my torso, so for me to expose myself in this unsexy manner reinforces the fact that people should know about this!</p>
<p><a href="http://www.flickr.com/photos/chrisjames/sets/72157623917642279/">http://www.flickr.com/photos/chrisjames/sets/72157623917642279/</a></p>
<p>Unfortunately I cannot blame my bloated belly on the soap :p</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=86</wfw:commentRss>
		</item>
		<item>
		<title>Bombastic, basic, budget, bol.</title>
		<link>http://purplehaze.me.uk/?p=84</link>
		<comments>http://purplehaze.me.uk/?p=84#comments</comments>
		<pubDate>Wed, 05 May 2010 14:42:00 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Cooking]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=84</guid>
		<description><![CDATA[Ever since when I could remember I have been a fan of spaghetti bolognaise. It&#8217;s such a typically English working class trying to get to middle class family meal, which is exactly what my family was like. When I got to uni I realised I had not learnt how to make bolognaise and I desperately [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since when I could remember I have been a fan of spaghetti bolognaise. It&#8217;s such a typically English working class trying to get to middle class family meal, which is exactly what my family was like. When I got to uni I realised I had not learnt how to make bolognaise and I desperately craved it.</p>
<p>At first I was content with simply frying some mince and then chucking a jar of Dolmio/Ragu on it, letting it simmer for 20 minutes and serve. In fairness, it makes quite a nice dinner. But it lacks anything special to it and doesn&#8217;t really feature nice fresh ingredients to fill your five a day.</p>
<p>For years I have been making bolognaises with an eye on maximum flavour, veg and cheapness (£1.50 max per person). I have borrowed tips from a few a number of cooking websites but the main influence has come from Dan&#8217;s mum&#8217;s recipe.</p>
<p>The main philosophy behind it is recognising that although you would consider the beef mince to be the most important ingredient, it isn&#8217;t. You can make it with the cheapest mince at the supermarket for a third of the normal price (£1 vs £3) and then mask the shortcomings with other flavours.</p>
<p>As I said I have been cooking and refining this for years. It might not be to everyone&#8217;s taste. I can imagine some people baulking at the idea of not putting in lean mince and a complete lack of red wine; plus <strong>chicken stock?!</strong> But it works for me and anyone who has had it seems to enjoy it.</p>
<h3>Ingredients (for 3-4 people)</h3>
<p>Prices are approximated</p>
<ul>
<li>500g of beef mince. £1</li>
<li>Closed-cup mushrooms 400g £1.30</li>
<li>Large onion 33p</li>
<li>Carton of chopped tomatos 400g-ish 60p</li>
<li>Tomato puree 40p</li>
<li>2 chicken stock cubes 25p</li>
<li>Optionally a fresh tomato per person</li>
</ul>
<p>Total: <strong>£3.88</strong></p>
<h3>General stuff needed from larder</h3>
<ul>
<li>Soy sauce</li>
<li>Pepper</li>
<li>Oregano/italian spice mix</li>
<li>3 garlic cloves</li>
<li>Olive oil</li>
</ul>
<h3>Instructions</h3>
<ul>
<li>Chop the onion and crush the garlic. Put 3 tablespoonsish of olive oil in your pan and drop a small bit of onion in it, put on a medium to hot heat. When it starts fizzling add the rest of the chopped onion, stir it up quickly and then add the garlic. Make sure the garlic is stirred in well. Revel in the awesome smell for a few minutes, stirring occasionally.</li>
<li>Whilst the onion and garlic is cooking you can start chopping your mushrooms. Chop them to however chunky you like</li>
<li>When the onion starts to turn translucent add the mince. Make sure you break it up well in the pan so there are no clumpy bits. Keep it moving in between chopping the rest of the mushrooms.</li>
<li>Once most of the redness from the meat has gone, you should have chopped your mushrooms. Add them in and mix well.</li>
<li>Whilst keeping the mushrooms moving, chop the tomatos if you have them. Put the kettle on and put the stock cubes in a measuring jug. Once it boils fill to around 300ml and stir so the stock cubes are properly dissolved.</li>
<li>Once the mushrooms are properly cooked, add the non fresh chopped toms and fresh ones if you have them. Give it a few minutes and then add the stock, stir.</li>
</ul>
<h3>The not very scientific bit</h3>
<p>The rest you will learn from experience and how you like your bolognaise to taste. I will try and guide you as best I can</p>
<ul>
<li>I tend to add half a tube of tomato puree. The tomato puree gives a lovely tomato-y flavour and redness but adding too much makes it taste bitter. I am always tempted to add too much, as at this stage the bolognaise doesnt look much like a bolognaise. Have faith!</li>
<li>Add a generous splash of soy sauce. This makes the bol a bit saltier.</li>
<li>Be genereous with black pepper too. Black pepper brings out flavours in almost all food.</li>
<li>Oregano/italian spice to taste.</li>
</ul>
<p>Mix it all up well and turn down the heat. It needs at least 20 minutes for everything to &#8220;infuse&#8221;. Be sure to keep the bolognaise moving every few minutes. If it starts to stick to your pan, the heat is too strong. I like to just clean up the dishes I used and to grate some cheese.</p>
<p>After the 20 minutes have a taste. You can season a little bit more if you feel you need to but you shouldnt add any more tomato puree as it wont really mix in very well at this point. Put on the lowest heat you can and cook your favourite pasta to serve with it.</p>
<p>Like a lot of italian food, it is great to leave some of it in the fridge overnight as it seems to magically taste even better the next day. To re-heat it, sprinkle a little water over it and heat for a few minutes, stir and heat again.</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=84</wfw:commentRss>
		</item>
		<item>
		<title>Second ACL operation</title>
		<link>http://purplehaze.me.uk/?p=83</link>
		<comments>http://purplehaze.me.uk/?p=83#comments</comments>
		<pubDate>Tue, 30 Mar 2010 15:01:51 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Random thoughts]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=83</guid>
		<description><![CDATA[Just over 2 weeks ago I had my second operation on my knee, I was in surgery for 4-5 hours which was much longer than last time. Unfortunately for Ruth she took time off work, arriving shortly after I had left for the theater so had to sit around waiting for me.
I was told this [...]]]></description>
			<content:encoded><![CDATA[<p>Just over 2 weeks ago I had my second operation on my knee, I was in surgery for 4-5 hours which was much longer than last time. Unfortunately for Ruth she took time off work, arriving shortly after I had left for the theater so had to sit around waiting for me.</p>
<p>I was told this procedure would be more invasive than the previous one and they weren&#8217;t kidding. This <a href="http://www.youtube.com/watch?v=q96M0jRqn7k">video illustrates it superbly</a> (about 4 minutes long) but for those too lazy to watch it, essentially they take a graft from the <a href="http://en.wikipedia.org/wiki/Patellar_ligament">patellar tendon (wiki link)</a>; drill a hole from the top of the shin through the knee and out of the thigh. Finally they thread the graft through and screw it in.</p>
<p>Rehabilitation has been generally OK. Obviously I have been in a lot of pain but the therapy is going well and I have got pretty good range of motion back again now, 2 weeks after the procedure. After the first week I ran out of the prescription pain killers and as a result the pain made sleep pretty difficult but this seems to have stopped now.</p>
<p>When I phoned my parents a day after the operation they told me my Nan had passed away. My Nan has had mental health issues which started before I went to University. It has caused me and my family a great deal of heartache at times. She had forgotten who I was years ago. I am not sure it has really hit me yet but I&#8217;m sure it will when I return to Kent next week for the funeral.</p>
<p>So these 2 weeks have been pretty tough. I find it hard to enjoy being like this, I honestly don&#8217;t like being a burden on my friends so I am working hard to get fit again as soon as possible.</p>
<p>Ruth and my friends have been absolutely fantastic in looking after me. Especially the first week, I barely had to lift a finger. I will have to make it up to them all sometime, once I think of something thoughtful (and cheap :p)</p>
<p>I am now officially working from home. I would honestly prefer to be in the office with my nice coworkers, this just feels like work without the social aspect - which is weak.</p>
<p>Looking onward I have my first post op examination with my surgeon on Thursday just to check everything is dandy and a physiotherapy session. I have been through 6 months of this before and so I know what to expect; a boring and painful process! I just have to keep remembering the eventual goal of hopefully being able to play some football.</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=83</wfw:commentRss>
		</item>
		<item>
		<title>Knife life</title>
		<link>http://purplehaze.me.uk/?p=82</link>
		<comments>http://purplehaze.me.uk/?p=82#comments</comments>
		<pubDate>Sun, 14 Mar 2010 09:18:12 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Random thoughts]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=82</guid>
		<description><![CDATA[Tomorrow I will be going for the second operation for my well documented cruciate ligament problems. My first operation was around 2 years ago and proved to be unsuccesful (warning, that link is incredibly depressing), probably because of my fall during physiotherapy. Initially it was thought I would get away with it but it seems [...]]]></description>
			<content:encoded><![CDATA[<p>Tomorrow I will be going for the second operation for my well documented cruciate ligament problems. My first operation was around 2 years ago and <a href="http://purplehaze.me.uk/?p=52">proved to be unsuccesful</a> (warning, that link is incredibly depressing), probably because of my fall during physiotherapy. Initially it was thought I would get away with it but it seems after quite an extensive program of physiotherapy my knee wont get strong enough so I need to be operated on again.</p>
<p>After the last operation I was walking again, albeit gingerly; within a week. This is because it was relatively uninvasive surgery. The projected time before I could play football again was meant to be after around 6 months of physiotherapy.</p>
<p>This time however, the procedure is a bit more involved than before and I am looking at least a year before I can even contemplate engaging in any contact sport. It&#8217;s going to be a real mission to get through, but I have a lot of friends to help me through it and in a way I look forward to it and it&#8217;ll force me to get fit again. The fact that I have been through it all before gives me a bit more confidence too.</p>
<p>Work as always have been very supportive, I wont be in the office for a month and I think I will begin to miss it after a while. Thankfully the next month wont be a complete waste of time and I have some interesting iPhone apps to write in the meantime.</p>
<p>It is unfortunate that the operation was scheduled after my parents had already planned to be abroad so it will feel a little weird having to go to hospital by myself for the surgery on Monday morning. I will be pretty nervous, even though I know it will be fine; it is very routine surgery.</p>
<p><a title="IMG_9512 by chrisjames, on Flickr" href="http://www.flickr.com/photos/chrisjames/3811749242/"><img src="http://farm3.static.flickr.com/2520/3811749242_fc34b9c5ce.jpg" alt="IMG_9512" width="500" height="375" /></a></p>
<p>I really cant wait to be on my feet and doing the training to get going again, but for now it&#8217;s going to be a frustrating few months. As you will know I <strong>love</strong> playing football and I cannot describe how frustrating it is that I haven&#8217;t been able to participate in my favourite passtime for around 3 years now. After experiencing the Springer Cup, the inter-company football tournament held in Heidelberg, Germany; it is really annoying that I cant go this year. Hopefully I will be able to make it for Springer Cup 2011 <img src='http://purplehaze.me.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=82</wfw:commentRss>
		</item>
		<item>
		<title>Making Countify &#038; Data persistence</title>
		<link>http://purplehaze.me.uk/?p=77</link>
		<comments>http://purplehaze.me.uk/?p=77#comments</comments>
		<pubDate>Tue, 19 Jan 2010 11:20:45 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Application]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Iphone]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=77</guid>
		<description><![CDATA[It was to be expected that I wouldnt be able to sit and learn iPhone development without interruption, so I&#8217;ve had to scale it back for a while whilst fixing bugs and enjoying Christmas
To consolidate my learning I have started making an application for myself. I try to be organised with my finances and keep [...]]]></description>
			<content:encoded><![CDATA[<p>It was to be expected that I wouldnt be able to sit and learn iPhone development without interruption, so I&#8217;ve had to scale it back for a while whilst fixing bugs and enjoying Christmas</p>
<p>To consolidate my learning I have started making an application for myself. I try to be organised with my finances and keep a fairly keen eye on them but when budgeting I find it hard to put a figure on what I spend on food per month.</p>
<p>Keeping a pen and paper to write down every time I bought something from Tescos was a fruitless endeavour so why not make an iPhone application? I always thought it would be a nice simple project to start with, basic user interaction and some data persistence.</p>
<p>So using what I had learnt in the first few days I created a basic user interface and put in the logic to count and it worked nicely. Also what was quite pleasing was that it was pretty easy, I had a non persistent version working in a few hours.</p>
<p><a title="First " href="http://www.flickr.com/photos/chrisjames/4152427633/"><img style="vertical-align: middle;" src="http://farm3.static.flickr.com/2576/4152427633_b3f0a4c561.jpg" alt="First " width="267" height="500" /></a></p>
<h2>Data persistence</h2>
<p>For this first version I only need to save the amount spent, which you would normally just save in a text file and this is possible on the iPhone. However most of the applications I will be writing will require a structured data storage using SQLite so I decided to skip a few chapters in the book and learn how to do that.</p>
<p>I am aware that the approach I have taken is quite <em>hacky</em>, the database table is created in code (<strong>bleurgh!</strong>) and the querying code is in the controller, rather than abstracted away elsewhere. But in principle it works and gives a grounding on how to do it.</p>
<h3>Adding references</h3>
<p>First of all you need to create a reference to the SQLite3 library in the project. Right click on the frameworks folder and select <strong>Add to project</strong> from the Project menu. Navigate to <em>Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/IphoneSimulatorX.Y.sdk/usr/lib </em>and add the file <strong>libsqlite3.dylib</strong>.</p>
<p>In the header file that you want to work with SQLite add <code>#import "/usr/include/sqlite3.h"</code> and add a pointer to the SQLite database <code>sqlite3 *database;</code>.</p>
<p>You will also need to define some kind of filepath for the database file. Use the <code>NSSearchPathForDirectoriesInDomains</code> to search for the directories in the iPhone&#8217;s directory and get the documents directory by taking the first element in the array returned. Then define a file name for it i.e &#8220;mydb.sqlite3&#8243;.</p>
<h3>Creating the database</h3>
<p>The method <code>sqlite3_open</code> takes a filepath to a database and the reference to a database pointer. If the database hasn&#8217;t been created, it will create one in the filepath defined, otherwise it just opens. </p>
<p>In Countify I then wrote an SQL statement into an <code>NSString</code> which created the table I wanted <code>IF NOT EXISTS</code>. To execute the code you use the method <code>sqlite3_exec</code>. It is worth noting that SQLite works with C strings, so you have to do <code>[mystring UTF8String]</code> in order for your strings to work. </p>
<h3>Running queries on the database</h3>
<p>The pattern for querying the database is to prepare a statement, binding different variables as you see fit, performing a step to execute the statement and then using the sqlite methods to read the current data shown. </p>
<p>So first you create a <code>sqlite3_stmt</code> pointer along with an NSString of your query. On to your query you can add ? characters which you can bind different values to, for example:</p>
<blockquote><p><code>SELECT TOTALSPENT FROM SPENDING WHERE ID = ?"</code></p></blockquote>
<p>Then after you have used <code>sqlite3_prepare_v2</code> to prepare your sqlite3_stmt you can use the statement multiple times and simply bind different values to them. So imagine were using the above SQL statement to read through multiple spending records:</p>
<blockquote><p>
<code></p>
<pre>
for(i blah blah whatever i want to iterate through){
   if(sqlite3_prepare_v2(database, [nsstringofquery UTF8String], -1, &#038;pointerto_stmt, nil)==SQLITE_OK){
      sqlite_3_bind_int(pointerto_stmt, 1, i); //1 refers to the ? index, not zero based!
      sqlite3_step(pointerto_stmt);
      totalSpent= totalSpent+sqlite3_column_double(pointerto_stmt, 0); //0 refers to the column index of the row in the database
   }
}
</pre>
<p></code>
</p></blockquote>
<p>I followed a similar pattern with updating the database. </p>
<p>So this is certainly a lot more long winded than using LINQtoSQL to say the least. But at the same time it is fairly simple and I dont think there will be any need for an elaborate database schema with any projects I do, so the methods I have described should be fine. </p>
<h2>Done! For now.</h2>
<p>I am quite pleased at how simple (relatively) this was. Admittedly it is a very basic application but it does work well. I am not going to make any additions to it for now, I have to learn other things which are less applicable for what I want to do and more about what I need to write for work. I have to make a video quiz application in under 6 weeks so I really have to work hard to achieve that.</p>
<p>I feel like I&#8217;m still not entirely sure how about how an iPhone application should be written from an architectural standpoint. Hopefully as I get more experience I will understand how to structure them so they are a bit more maintainable. </p>
<p>Next blog post will be about writing multiple view applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=77</wfw:commentRss>
		</item>
		<item>
		<title>Work in 2009</title>
		<link>http://purplehaze.me.uk/?p=78</link>
		<comments>http://purplehaze.me.uk/?p=78#comments</comments>
		<pubDate>Tue, 12 Jan 2010 21:58:47 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=78</guid>
		<description><![CDATA[I have completed another year of working with .NET and other technologies and below I will summarise what I have achieved. It has been a good solid year, I have some more feathers in my cap and more meaningless acronyms to add to my CV.
AIDS Images
I talked about this in detail in a previous post. [...]]]></description>
			<content:encoded><![CDATA[<p>I have completed another year of working with .NET and other technologies and below I will summarise what I have achieved. It has been a good solid year, I have some more feathers in my cap and more meaningless acronyms to add to my CV.</p>
<h2>AIDS Images</h2>
<p>I talked about this in detail <a href="http://purplehaze.me.uk/?p=65">in a previous post</a>. I would say this is the biggest programming project I have undertaken. I had to work with 2 other teams to get this to work and I was lucky enough to fly out to Geneva to meet the client.</p>
<p>The website is a database of AIDS images collected by the client. It has nice web 2.0-y features like drag and drop using javascript and other AJAX magic. The back end was build using ASP MVC 1, which was building on my knowledge of writing CoDriver (our in-house issue tracking system). This was the first project that I tried to really develop using test driven development</p>
<h2>AIR Dictionary</h2>
<p>In my previous year I had created some pure javascript dictionaries that can be plugged into a web page with one line of Javascript. It was decided that I could take this concept and create an Adobe AIR application for more dictionaries.</p>
<p>The main challenge of this project was ensuring that it would be simple to deploy either web based or air dictionaries, given an XML file of dictionary data. I wrote an importer in C# which converted the XML into compressed JSON. The dictionary Javascript then performed AJAX requests to get definitions from a web service that I also built.</p>
<p>There was a central Javascript library which did most of the business logic and to handle the differences between AIR and normal web pages there were Javascript files to call the library functions and render.</p>
<h2>iPhone Development</h2>
<p>Towards the end of the year we were told that sales would require us to be able to create iPhone applications. Specifically &#8220;Video Bytes&#8221; which will be medical quizzes and medical dictionary applications. When I have had time I have tried to learn Objective C with a view to creating these applications.</p>
<p>It&#8217;s a nice change of pace from .NET, going back to essentially C which is what I studied at university.</p>
<h2>Summary of skills gained</h2>
<h3>Test driven development</h3>
<p>I really like the idea of TDD and it does save a lot of time in retesting and I have witnessed how it does give you more confidence to refactor your code. So how come I always seem to end up lacking the discipline to actually do it all the time?!</p>
<p>As I mentioned the AIDS website was the first time I really tried this. Unfortunately due to pressure from the client our timescales got reduced quite dramatically. At this point I decided to go with what I was familiar with just to get the site done in time. This was frustrating and perhaps I should have been braver.</p>
<p>I have found that after doing TDD for a significant amount of time, that I am writing my methods expecting it to be tested, even if it isn&#8217;t. What I mean by this is that it has encouraged me to write methods which are short, self descriptive and self contained - even when I am not testing. I knew this to be a good habit before doing TDD but it seems to have been hammered into me more now.</p>
<h3>ASP MVC</h3>
<p>I built on my skills and experience gained in the previous year which has lead to the view and controller code being a lot leaner and easier to understand.</p>
<h3>Dependency injection</h3>
<p>I was reading a number of blogs on how to do TDD effectively and a recurring theme was to use dependency injection to make your business classes easier to test by separating the dependency on data access.</p>
<p>This worked out really well for me and I can definitely see the benefit in it.</p>
<h3>Improved Javascript</h3>
<p>The dark days of Javascript where there were no fancy libraries and no firebug mentally scarred me and made me frightened of using Javascript for years. I have been forced into embracing Javascript, mainly as any kind of web development without some kind of fancy AJAX effects is quite archaic.</p>
<p>Making AIR applications is more or less 99% Javascript too so I had to pull my finger out.</p>
<p>I still feel slightly frightened of Javascript, I think I am so used to strongly typed C# catching all my mistakes that I will always be a little wary of using them, although I appreciate the advantages that come from it.</p>
<h3>Objective C</h3>
<p>I am very much a fledgling objective C coder, but it pleases me that I get to learn it on the job. It&#8217;s refreshing to be using a completely different language and this will allow me to not only make iPhone apps, but possibly normal Mac OS X apps too.</p>
<h2>Next year</h2>
<p>Next year promises more .NET development as usual. I plan to learn ASP MVC2 and this will probably come by rewriting my blog in .NET.</p>
<p>Time permitting I will be writing iPhone applications, including dictionaries (again!) and a video quiz.</p>
<p>Our team is always talking about how we want to rewrite elements of our content management system, migrating away from WebForms, integrating new web 2.0 features using more modern javascript frameworks, rather than Microsoft&#8217;s one and using TDD. Whether we get the time and justification to do this is another matter but it would certainly be a very exciting project to do.</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=78</wfw:commentRss>
		</item>
		<item>
		<title>New years resolutions 2010</title>
		<link>http://purplehaze.me.uk/?p=79</link>
		<comments>http://purplehaze.me.uk/?p=79#comments</comments>
		<pubDate>Mon, 04 Jan 2010 19:48:26 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Random thoughts]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=79</guid>
		<description><![CDATA[After looking at my new years resolutions of last year I achieved NONE OF THEM. So I forgive you if you dont read this as I am obviously full of shit.
However, I want this set in stone on the internets to remind myself of how I am a failure when I look back this time [...]]]></description>
			<content:encoded><![CDATA[<p>After looking at my <a href="http://purplehaze.me.uk/?p=56">new years resolutions of last year</a> I achieved <strong>NONE OF THEM</strong>. So I forgive you if you dont read this as I am obviously full of shit.</p>
<p>However, I want this set in stone on the internets to remind myself of how I am a failure when I look back this time next year.</p>
<h3>Learn more things to cook</h3>
<p>In 2009 I found that I actually quite like cooking, despite being a bit cack-handed at it. For Christmas I was given two cooking books so this should help me out. I made this resolution last year but stupidly said that I should blog about them, which sort of added an extra burden to the resolution which meant I didnt do it.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://img.tesco.com/pi/Books/L/62/9780340918562.jpg" alt="" width="211" height="278" /></p>
<p>I&#8217;m finding that by learning to cook more and more I am wasting less food as I get a little creative with what ingredients I have. Great for <em>these tough economic times</em>.</p>
<h3>Make an iPhone app (of my own)</h3>
<p>I have been lucky enough that I am allowed to sit down and get paid to learn Objective-C whilst working, when I dont have other projects to deal with. I have a few ideas for some iPhone applications, most of which are quite simple so I dont see why I wont be able to make them.</p>
<h3>Maximise my profits!</h3>
<p>I have to say, although the design of <a href="http://www.moneysavingexpert.com/">moneysavingexpert</a> is awful, it is actually a pretty nifty site if you can bear to navigate through it. What it has made me aware of is how I can be more frugal with money and save some cash.</p>
<p>I have got a nice cashback credit card and I have finally bothered to get loyalty cards to places I frequently shop at. Along with checking for offers at the supermarket and learning how to make the most of the food I buy (rather than letting it go off) I can hopefully save myself a lot of money.</p>
<h3>Lose a bit of weight</h3>
<p>Ever since doing my knee in again after the Springer Cup, I have found it very hard to be motivated to eat sensibly and exercise. This has resulted in me putting on a bit of weight. I really aught to buck my ideas up and lose a bit of weight.</p>
<p>This shouldnt actually be too hard if I get back in the routine of going to the gym every week and trying to eat a little less cheese a week. It&#8217;s not like I am grossly overweight, I just need to eat a few less pies.</p>
<p align="center"><a href="http://www.flickr.com/photos/chrisjames/4217233788/" title="IMG_4292 by chrisjames, on Flickr"><img src="http://farm5.static.flickr.com/4031/4217233788_5eb39ab188_m.jpg" width="240" height="180" alt="IMG_4292" /></a><br /><em>Less cake for me, unfortunately</em></p>
<p>I have a feeling that after I have my operation this will happen sort of naturally as exercise is a big part of physiotherapy - which I have at least a year of.</p>
<h3>Re-write my website in .NET</h3>
<p>The last time I updated my WordPress install (the thing that powers this blog) I broke everything. I know how to write PHP but I have very little desire to touch it and I cannot be bothered to learn the WordPress architecture.</p>
<p>I know that if I write the site from the ground up I&#8217;ll be able to do a lot more experimentation and be able to add new features easier, freeing myself from the shackles of apathy.</p>
<p>It&#8217;ll also let me do some more frontend designy work which I miss somewhat.</p>
<p>I think of all the resolutions this is the least likely I will be doing, as I already have a website I am supposed to be making in my free time.</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=79</wfw:commentRss>
		</item>
		<item>
		<title>Top songs of 2009</title>
		<link>http://purplehaze.me.uk/?p=70</link>
		<comments>http://purplehaze.me.uk/?p=70#comments</comments>
		<pubDate>Mon, 04 Jan 2010 17:06:54 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Random thoughts]]></category>

		<guid isPermaLink="false">http://purplehaze.me.uk/?p=70</guid>
		<description><![CDATA[Like last year I am going to talk about the songs I have enjoyed this year. Once again, most of these weren&#8217;t released this year, as I am pretty uncool and cant keep up with the kids.
When I looked at my last.fm for top songs this year, quite a lot of last year&#8217;s songs were [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://purplehaze.me.uk/?p=54">Like last year</a> I am going to talk about the songs I have enjoyed this year. Once again, most of these weren&#8217;t released this year, as I am pretty uncool and cant keep up with the kids.</p>
<p>When I looked at my <a href="http://www.last.fm/user/quii/charts?rangetype=year&amp;subtype=tracks">last.fm for top songs this year</a>, quite a lot of last year&#8217;s songs were there, my musical credability is so fail. I still really like Phantom Limb and Crooked Teeth it seems.</p>
<p>So this post although not entirely &#8220;my top songs of 2009&#8243;, are my top songs excluding 2008.</p>
<p>I have gone to great lengths to make the music as accessible as possible, putting links to both spotify and grooveshark (for our international friends). I have also made an 8 tracks that you can listen to through the flash player below.</p>
<p>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="120" ><param name="movie" value="http://8tracks.com/mixes/74016/player_v2"><param name="allowscriptaccess" value="always"><param name="FlashVars" value="bg_color=_000000"><embed FlashVars="bg_color=_000000" src="http://8tracks.com/mixes/74016/player_v2" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="120" allowscriptaccess="always" ></embed></object></p>
<h3>The Crimea – Several Thousand Years Of Talking Nonsense</h3>
<blockquote><p>Some people can&#8217;t take their eyes off the prize,<br />
just believe it&#8217;s a god given right to survive, to have life.<br />
Some people don&#8217;t know how lucky they are.</p></blockquote>
<p><a href="http://listen.grooveshark.com/#/song/Several_Thousand_Years_of_Talking_Nonsense/8967837">Grooveshark</a></p>
<p>I went to a Crimea gig quite early when I moved to London and I actually really enjoyed it. Typically it took me a while to actually dig up the music and have a good listen. I think this was in Tom&#8217;s top list of songs last year which is what prompted me to listen. I really like the lyrics and the way the end (the lyrics quoted) is delivered really powerfully, it&#8217;s annoying that it&#8217;s not available on Spotify as I would listen to it all the time.</p>
<h3>The Shins – Saint Simon</h3>
<blockquote><p>Mercy&#8217;s eyes are blue<br />
When she places them in front of you<br />
nothing really holds a candle to<br />
the solemn warmth you feel inside of you</p></blockquote>
<p><a href="http://listen.grooveshark.com/#/song/Saint_Simon/8077">Grooveshark</a></p>
<p>I&#8217;m not really too sure what this song is about, but the quoted lyrics seem to light a spark in me every time I hear it. James Mercer&#8217;s singing during it as always is impeccable.</p>
<h3>The Veils – Sit Down by the Fire</h3>
<blockquote><p>It&#8217;s hard to say<br />
But I think you&#8217;d better<br />
Just say you don&#8217;t love me<br />
You don&#8217;t love me anymore</p></blockquote>
<p><a href="spotify:track:6cK7yu6oAKr4fqG5HoLYgd">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/Sit_Down_By_The_Fire/22069853">Grooveshark</a></p>
<p>This song has an acceptance of defeat about it, that bad things happen and things don&#8217;t always work out - but it&#8217;s ok. To me at least, I could be way off the mark.</p>
<p>Dan had this song playing in the house a few times and I always called it &#8220;that epic song&#8221;, by &#8220;that band&#8221;. I eventually got round to properly listening to The Veils and seeing them live later in the year. I think if Finn Andrews wasn&#8217;t in a band he&#8217;d be a software engineer. He has an awkward stage presence, it&#8217;s brilliant.</p>
<h3>The Pains of Being Pure at Heart – Stay Alive</h3>
<blockquote><p>Can&#8217;t you see his arms are a hell you won&#8217;t ever leave?</p></blockquote>
<p><a href="spotify:track:7xh9iFqDMOf9UpVHv4o5dT">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/Stay_Alive/21967575">Grooveshark</a></p>
<p>This band have a wonderful Smiths-y/The Cure vibe to them. Theres so few lyrics to this song that you cant draw many conclusions on to what it&#8217;s about. I&#8217;m guessing its something to do with trying to convince some loved one to escape some deadbeat town with you. 1000&#8217;s of songs on this theme but it doesn&#8217;t make it any less awesome.</p>
<h3>She &amp; Him – Why Do You Let Me Stay Here?</h3>
<blockquote><p>Why don&#8217;t you sit right down and stay awhile?<br />
We like the same things and I like your style</p></blockquote>
<p><a href="spotify:track:4RoEvN1c9zYbemaMBy039T">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/Why_Do_You_Let_Me_Stay_Here_/7211523"> Grooveshark</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/FkzRyHa9a6g&amp;hl=en_GB&amp;fs=1&amp;" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/FkzRyHa9a6g&amp;hl=en_GB&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I might be mixing up events in time here, but Ruth introduced me to this song and I like to think she sent it to me before I had asked her out, as a not-so-subtle hint for me to man up and tell her how I felt. Whether this is actually the case I am unsure :p Still it&#8217;s a great song and it does remind me of her. The video is also glorious as the singer is Zooey de Chanel who is <strong>actually a goddess</strong></p>
<p><img src="http://farm4.static.flickr.com/3059/2783146386_5580c9e1db.jpg" alt="" width="378" height="500" /></p>
<h3>Florence + The Machine – Dog Days Are Over</h3>
<blockquote><p>Happiness hit her like a bullet in the head</p></blockquote>
<p><a href="spotify:track:4Jm1ZaOPZcVb2UGvYqR7W0">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/Dog_Days_Are_Over/22118361">Grooveshark</a><br />
Florence couldn&#8217;t possibly want to be Kate Bush any more if she tried. She has a great voice and this song in particular I enjoy listening to. Not much else to say really, it&#8217;s just really good!</p>
<h3>Pixies - I&#8217;ve been waiting for you</h3>
<blockquote><p>A woman<br />
With the feeling<br />
Of losing once or twice</p></blockquote>
<p><a href="spotify:track:6khaTY9hXBoF2g71VQ6xPu">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/Ive_Been_Waiting_For_You/42691">Grooveshark</a><br />
When I managed to throw a pint of water on my laptop and then subsequently my iPhone died, I lost all my music which I had stored in the megabitz. When i got it all back I quickly re-downloaded what I could (cba to burn cds!) and along with that I got a load of Pixies B-sides. This cover of a Neil Young song and is in my opinion much better than the original. It&#8217;s a Pixies song where Kim Deal is singing, so quite frankly it is automatically good. </p>
<h3>The Decemberists - The Wanting Comes In Waves</h3>
<blockquote><p><strong>RE-PAAAAAAAAAAAAAAIIIIIID!!!</strong></p></blockquote>
<p><a href="spotify:track:77pOieTICtn6xnw8iOh65c">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/The_Wanting_Comes_in_Waves_Repaid/22199930">Grooveshark</a><br />
I really enjoyed The Hazards Of Love album, it&#8217;s a fun and weird story to follow. This part is when our hero tries to bargain with the Queen (of the forest? or something?) who saved him when he was a child - to allow him to be human again for one more night so he can see his newly found lover. The singing by the woman is just unbelievably epic.</p>
<h3>The National - Karen</h3>
<blockquote><p>Karen, put me in a chair, fuck me and make me a drink</p></blockquote>
<p><a href="spotify:track:5LYKaWkIpuKS9fLJAf4TbL">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/Fake_Empire/48028">Grooveshark</a><br />
I saw The National twice this year, at Glastonbury and at some other place around Southbank that I cant remember the name of. I much preferred the latter gig where they played a lot more of Alligator, which was an album I hadnt really paid much attention to, the brilliance of Boxer was too distracting it seems. This was a mistake, Alligator is fantastic and Karen is probably my favourite - I love the quoted lyrics. </p>
<h3>Mumford &#038; Sons - Sigh no more</h3>
<p><a href="http://open.spotify.com/track/7ETa4yUUHberyWTkItsZoQ">Spotify</a> | <a href="http://listen.grooveshark.com/#/song/Sigh+No+More/23581411">Grooveshark</a><br />
I stand by what I said last year that Mumford and Sons are amazing live. I saw them again this year where they plugged their (at the time) upcoming album called Sigh no more. Out of the songs I hadn&#8217;t already heard this was definitely my favourite. Typically it took me a while to catch up with the album but now I have I cant stop playing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://purplehaze.me.uk/?feed=rss2&amp;p=70</wfw:commentRss>
		</item>
	</channel>
</rss>
