
<?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>Dan Ruscoe &#187; PHP Code</title>
	<atom:link href="http://ruscoe.org/category/php-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://ruscoe.org</link>
	<description></description>
	<lastBuildDate>Tue, 24 Aug 2010 02:10:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Generating Images from GPS Coordinates in PHP</title>
		<link>http://ruscoe.org/generating-images-from-gps-coordinates/</link>
		<comments>http://ruscoe.org/generating-images-from-gps-coordinates/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 02:10:46 +0000</pubDate>
		<dc:creator>ruscoe</dc:creator>
				<category><![CDATA[PHP Code]]></category>

		<guid isPermaLink="false">http://ruscoe.org/?p=135</guid>
		<description><![CDATA[Since getting a new Android phone, I've been playing around with logging GPS data. I've been using GPSLogger, which can be configured to create KML files right on the phone's SD card. As an experiment, I set up my phone to log my current location hourly and took it with me on vacation to Florida. [...]]]></description>
			<content:encoded><![CDATA[<p>Since getting a new Android phone, I've been playing around with logging GPS data. I've been using GPSLogger, which can be configured to create KML files right on the phone's SD card.<br />
<span id="more-135"></span><br />
As an experiment, I set up my phone to log my current location hourly and took it with me on vacation to Florida. Normal people probably buy souvenirs on vacation; I came back with GPS logs of the entire trip.*</p>
<p>I wanted to do something interesting with the data I had, and generating some kind of image sounded like a fun idea.</p>
<p>I started by writing some PHP code to accept a range of X / Y points and use the GD library to plot them on a blank image. If the same pair of points appeared more than once, the plotted point would increase in size. This way, the size of a point would indicate how much time was spent there.</p>
<p>Once the basic point plotter was working, I wrote some additional code to parse the KML files and interpret the GPS coordinates as points. I fed in the data from Florida and got this image back:</p>
<p><img class="screenshot" src="http://img.ruscoe.org/blog/florida_point_map.png" width="400" height="453" alt="Florida Point Map" /></p>
<p>Pretty cool. The large point is the rented accommodation and the pockets of points are theme parks.</p>
<p>I put the <a href="http://github.com/ruscoe/PointMap" title="PointMap on GitHub">code up on GitHub</a>. Feel free to experiment with it.</p>
<p>* Except for when GPSLogger just stopped working for no reason.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruscoe.org/generating-images-from-gps-coordinates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Class for the Nabaztag API</title>
		<link>http://ruscoe.org/php-class-for-the-nabaztag-api/</link>
		<comments>http://ruscoe.org/php-class-for-the-nabaztag-api/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 20:09:38 +0000</pubDate>
		<dc:creator>ruscoe</dc:creator>
				<category><![CDATA[PHP Code]]></category>

		<guid isPermaLink="false">http://danruscoe.com/?p=84</guid>
		<description><![CDATA[A Nabaztag is a plastic rabbit that connects to your WiFi and reads out news stories and emails. It can also display weather information by lighting up and it moves its ears around from time to time. It comes with an API that's fun to tinker with. Just for fun I've written a small PHP [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://www.nabaztag.com/" title="Nabaztag" target="_blank">Nabaztag</a> is a plastic rabbit that connects to your WiFi and reads out news stories and emails. It can also display weather information by lighting up and it moves its ears around from time to time. It comes with an API that's fun to tinker with.</p>
<p>Just for fun I've written a small PHP class to allow PHP applications to interface with the Nabaztag API.<br />
<span id="more-84"></span><br />
<b><a href="http://github.com/ruscoe/Nabaztag-API-PHP-Class/tree/master" title="Nabaztag API PHP Class" target="_blank">Get the code on GitHub</a>.</b></p>
<p>The example script demonstrates all the functionality, but for quick reference:</p>
<p>Create a new nabaztag object:<br />
<span class="code">$nab = new nabaztag($your_serial_number, $your_api_token);</span></p>
<p>Speak using text-to-speach:<br />
<span class="code">$nab->speak("that rabbit's got a vicious streak a mile wide");</span></p>
<p>Move ears:<br />
<span class="code">$nab->move_ears($left_ear_position, $right_ear_position);</span><br />
<i>Provide an integer between 0 and 16 to move the ears through their cycle.</i></p>
<p>Wake up or put to sleep:<br />
<span class="code">$nab->set_wake_status($status);</span><br />
<i>Passing a 1 to this function wakes the Nabaztag, 0 puts it to sleep.</i></p>
<p>The Nabaztag API will send a response to acknowlege a successful request or point out any errors made. The response is stored in the class and can be accessed via this function:<br />
<span class="code">$nab->display_api_response();</span></p>
<p>There is another diagnostic function that will list the parameters being send in an API request:<br />
<span class="code">$nab->display_api_params();</span></p>
<p>Feel free to expand on this class. There is plenty of information in the <a href="http://doc.nabaztag.com/api/home.html" title="Nabaztag API Documentation" target="_blank">official API docs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruscoe.org/php-class-for-the-nabaztag-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
