<?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>Random Geekage &#187; code</title>
	<atom:link href="http://kevinisageek.org/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://kevinisageek.org</link>
	<description>Randomness, geekery and whatever else I feel like</description>
	<lastBuildDate>Thu, 20 May 2010 10:29:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Foursquare Python Library</title>
		<link>http://kevinisageek.org/2010/04/23/foursquare-python-library/</link>
		<comments>http://kevinisageek.org/2010/04/23/foursquare-python-library/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 22:16:13 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Foursquare]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://kevinisageek.org/?p=684</guid>
		<description><![CDATA[I signed up to Foursquare a couple weeks ago just to see what it is like. However, a lack of clients for my phone (formally a Nokia N95, now an N900) makes it somewhat of a hassle to use (that and the lack of places the site recognises, damn American focus). Anyway, while at work [...]]]></description>
			<content:encoded><![CDATA[<p>I signed up to <a href="http://foursquare.com/">Foursquare</a> a couple weeks ago just to see what it is like. However, a lack of clients for my phone (formally a Nokia N95, now an N900) makes it somewhat of a hassle to use (that and the lack of places the site recognises, damn American focus).</p>
<p>Anyway, while at work today I had an idea to make an application for my new phone. I haven&#8217;t got particularly far with it, only creating a library with a sprinkling of methods, one to &#8220;check in&#8221;, another to search for venues based on your GPS coordinates and one to do the actual data requests.</p>
<p>Even if you don&#8217;t understand Python, it shouldn&#8217;t be too hard to follow along. If anybody uses this cruft, let me know and I&#8217;ll apologise directly to you.</p>
<p><a href="http://kevinisageek.org/wordpress/wp-content/uploads/2010/04/foursquare.py_.txt">foursquare.py</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kevinisageek.org/2010/04/23/foursquare-python-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random images as a background in HTML</title>
		<link>http://kevinisageek.org/2009/02/06/random-images-as-a-background-in-html/</link>
		<comments>http://kevinisageek.org/2009/02/06/random-images-as-a-background-in-html/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 21:17:20 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Random Knowlege]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://kevinisageek.org/?p=418</guid>
		<description><![CDATA[A nice wee gem that Alex Peake informed me was possible. The problem: you want a randomly chosen image as a background but don&#8217;t want duplication in your css. In your css file: background-image: url('images/background.php'); Create the file referenced above with this code: &#60;?php     $numofimages = count(glob("*.jpg"));     $imagenum = rand(1, $numofimages);     header("Content-Type: [...]]]></description>
			<content:encoded><![CDATA[<p>A nice wee gem that <a href="http://empowerthyself.com">Alex Peake</a> informed me was possible. The problem: you want a randomly chosen image as a background but don&#8217;t want duplication in your css.</p>
<p>In your css file:</p>
<pre>background-image: url('images/background.php');</pre>
<p>Create the file referenced above with this code:</p>
<pre>&lt;?php
    $numofimages = count(glob("*.jpg"));
    $imagenum = rand(1, $numofimages);

    header("Content-Type: image/jpeg\n");
    header("Content-Transfer-Encoding: binary");

    $fp=fopen("headerimage". $imagenum .".jpg" , "r");
    fpassthru($fp);
?&gt;</pre>
<p>and voila, random images as a background with the bonus of being able to throw in a new image without having to do any more coding.</p>
<p>This code assumes that your images are called headerimageX.jpg where X is a number.</p>
]]></content:encoded>
			<wfw:commentRss>http://kevinisageek.org/2009/02/06/random-images-as-a-background-in-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Robot updated</title>
		<link>http://kevinisageek.org/2009/01/21/robot-updated/</link>
		<comments>http://kevinisageek.org/2009/01/21/robot-updated/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 14:40:25 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Robot Army]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[robot]]></category>

		<guid isPermaLink="false">http://kevinisageek.org/?p=402</guid>
		<description><![CDATA[Just a quick post to say that my robot code has been updated to communicate with my arduino. Learned some more about Python as well, mostly relating to how badly I suck at it. Can&#8217;t get object orientation to work with modules but objects are not necessary for this. Straight procedural code is all that [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to say that my robot code has been updated to communicate with my arduino. Learned some more about Python as well, mostly relating to how badly I suck at it. Can&#8217;t get object orientation to work with modules but objects are not necessary for this. Straight procedural code is all that is required, for the moment.</p>
<p><a href="http://kevinisageek.org/code/robot.zip">Download robot code</a></p>
<p><a href="http://kevinisageek.org/code/spy_gear_atv_360_motor_control-081225a.zip">Download arduino code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kevinisageek.org/2009/01/21/robot-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress functions in other pages</title>
		<link>http://kevinisageek.org/2008/10/19/wordpress-functions-in-other-pages/</link>
		<comments>http://kevinisageek.org/2008/10/19/wordpress-functions-in-other-pages/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 13:28:21 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://kevinisageek.org/weblog/?p=270</guid>
		<description><![CDATA[I have rediscovered a cool thing that can be done with WordPress involving static pages. I run my site with a static index.php as the front page. It would be a massive pain in the ass to re-theme it every time I changed my WordPress theme, along with any other pages I make. I remembered [...]]]></description>
			<content:encoded><![CDATA[<p>I have rediscovered a cool thing that can be done with WordPress involving static pages. I run my site with a static index.php as the front page. It would be a massive pain in the ass to re-theme it every time I changed my WordPress theme, along with any other pages I make. I remembered something in the documentation about adding a line of code to your php files and being able to access all the functions available in WordPress and went looking, unsuccessfully.</p>
<p>I then remembered that the index.php file of a WordPress install contains something like what I was looking for. I copied it (require(&#8216;./path/to/wp-blog-header.php&#8217;) ) into the front page along with the functions to display the header, sidebar and footer (get_header(), get_sidebar() and get_footer() respectively) and found that it worked.</p>
<p>Full code for this is below (assumes that your wordpress install is in /wordpress and your page is in the root of your site)</p>
<p><code><br />
&lt;?php require('./wordpress/wp-blog-header.php'); ?&gt;<br />
&lt;?php get_header(); ?&gt;<br />
&lt;div id="container"&gt;<br />
&lt;div id="content"&gt;<br />
&lt;!--your stuff goes here--&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;?php get_sidebar(); ?&gt;<br />
&lt;?php get_footer(); ?&gt;<br />
&lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://kevinisageek.org/2008/10/19/wordpress-functions-in-other-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fail, ASP and other misc stuff</title>
		<link>http://kevinisageek.org/2008/10/09/fail-asp-and-other-misc-stuff/</link>
		<comments>http://kevinisageek.org/2008/10/09/fail-asp-and-other-misc-stuff/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 17:12:00 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[advertising]]></category>
		<category><![CDATA[car]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[problem ASP.Net]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://kevinisageek.org/weblog/?p=248</guid>
		<description><![CDATA[Today was a mixed bag as far as things go. First off, I had some car trouble. The engine malfunction light came on, there was some beeping and the engine started shuddering while going over 60mph. So I pulled over and switched off. Started again and the light came on. So I called AA, got [...]]]></description>
			<content:encoded><![CDATA[<p>Today was a mixed bag as far as things go. First off, I had some car trouble. The engine malfunction light came on, there was some beeping and the engine started shuddering while going over 60mph. So I pulled over and switched off. Started again and the light came on. So I called AA, got my dad to take my brother to uni and hung about until the AA arrived.</p>
<p>They found nothing wrong so I moved off the motorway at the nearest junction. No problems. The guy was on his way to Dundee so he escorted me until my turn off. No problems. Got back with no problems as well.</p>
<p>What I think happened (I am not a mechanic, this is not meant to be accurate info) is that the lambda sensor (monitors CO2 emissions) went wonky and the engine computer decided to let me know. In the time waiting for recovery, the system reset and all was good. A similar situation happened a couple years ago, took my car to the garage and they said it was the sensor misfiring.</p>
<p>While in Dundee waiting for the last class of the day (3 hour gap is a bit of a pain) I went for a bit of a shop. I have been needing some new shaving soap as the stuff I have has pretty much run out. I went to <a href="https://shop.lush.co.uk/">Lush</a> to see what they have and the assistant suggested to use some <a href="http://www.flickr.com/photos/kevinisageek/2926480581/">&#8220;snowcake&#8221; soap</a> which seems to be made from almonds. The lady said it lathers up well so I went with it. I also got a sample of some &#8220;Prince&#8221; soap stuff. Will report on how well they work.</p>
<p>In the union, <a href="http://www.flickr.com/photos/kevinisageek/2926479585/">I found some</a> <a title="http://ubuntu-trading.com/" href="http://">Ubuntu Cola</a> (site needs flash), 80 pence for 2 cans which is not bad. It is not the same folk who make the linux distribution but they do use fairtrade sugar. Unfortunatly, the taste is the same as a certain cola maker who will not be named. Had caffeine as well which is a downer for me (causes headaches, I don&#8217;t drink much caffeine at all). I have a can on my desk, not sure what I will do with it. Anyone want it?</p>
<p>Now for some more technical stuff. As part of my uni course, I have a module called &#8220;Enterprise Internet Solutions&#8221; which involves using ASP.Net. Initially I balked at using it but I am warming up to it. There are some niceitys to it, such as piss easy form creation and processing. It is mainly drag and drop (as is typical of Microsoft development) but you can use the code window exclusivly if you want.</p>
<p>What I really like about ASP.Net is that the processing code is seperated from the html/xml code used for output in the browser. ASP uses xml tags for the user interation widgets (buttons, input boxes etc) in the form</p>
<p><code>&lt;asp:controltype ID="something" attribute="something"&gt;&lt;/asp:controltype&gt;</code></p>
<p>This can be shortened to</p>
<p><code>&lt;asp:controltype ID="something" attribute="something" /&gt;</code></p>
<p>so you have well formed xml empty tags. If you remember all the different attributes and control types then you can use a plain text editor which brings me neatly to my next point.</p>
<p>ASP.Net aparrently works with Mono on linux so that is where I will be going if it works. Won&#8217;t be using a huge clunky expensive IDE, I will be using vim instead (emacs users, direct flames to /dev/null). Hopefully I can get it working with MySQL as well.</p>
<p>On a further tech note, Stanford university has <a href="http://see.stanford.edu/see/courses.aspx">released a bunch of courses online</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kevinisageek.org/2008/10/09/fail-asp-and-other-misc-stuff/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upload Reloaded</title>
		<link>http://kevinisageek.org/2008/06/01/upload-reloaded/</link>
		<comments>http://kevinisageek.org/2008/06/01/upload-reloaded/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 19:28:37 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Journal]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[question]]></category>

		<guid isPermaLink="false">http://www.kevinisageek.org/weblog/?p=99</guid>
		<description><![CDATA[I did a bit more hacking of my upload script (note the exension change) to tweak some things and make it more secure. The updated code is available for criticism/comment. I still consider the script to be in beta. It would be nice if folk could test it and report on any errors you encounter [...]]]></description>
			<content:encoded><![CDATA[<p>I did a bit more hacking of my <a title="Updated uploading tool" href="http://www.kevinisageek.org/mirror/upload.html">upload script</a> (note the exension change) to tweak some things and make it more secure. The updated code <a title="Updated source" href="http://www.kevinisageek.org/code/upload.php.txt">is available </a>for criticism/comment.</p>
<p>I still consider the script to be in beta. It would be nice if folk could test it and report on any errors you encounter (particularly file size related).</p>
<p>I am blocking php asp and python scripts as they are most likely to run on the server and are capable of owning me (which I do not want happening. What other extensions should be blocked on a Linux server?</p>
]]></content:encoded>
			<wfw:commentRss>http://kevinisageek.org/2008/06/01/upload-reloaded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
