<?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/"
	
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Nothing to See Here &#187; Geekery</title>
	<atom:link href="http://ottodestruct.com/blog/category/geekery/feed/" rel="self" type="application/rss+xml" />
	<link>http://ottodestruct.com</link>
	<description>Random meanderings you&#039;re probably not interested in</description>
	<lastBuildDate>Wed, 08 Feb 2012 14:47:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://ottodestruct.com/?pushpress=hub'/>
<cloud domain='ottodestruct.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Go Granny Advertisement</title>
		<link>http://ottodestruct.com/blog/2011/go-granny-advertisement/</link>
		<comments>http://ottodestruct.com/blog/2011/go-granny-advertisement/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 22:38:56 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[commercial]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[parody]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/?p=954</guid>
		<description><![CDATA[I would never recommend NetSol for any sort of service of any kind, but damn if they can&#8217;t make a funny parody. &#160;]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2011/go-granny-advertisement/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>I would never recommend NetSol for any sort of service of any kind, but damn if they can&#8217;t make a funny parody.</p>
<p><iframe width="584" height="329" src="http://www.youtube.com/embed/Nn25Lb8dick?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>&nbsp;</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2Fb5&count=vertical&related=otto42&text=Go Granny Advertisement' class='twitter-share-button' data-text='Go Granny Advertisement' data-url='http://otto42.com/b5' data-counturl='http://ottodestruct.com/blog/2011/go-granny-advertisement/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2011/go-granny-advertisement/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2011/go-granny-advertisement/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2011/go-granny-advertisement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>Hidden Doodles in the Thanksgiving Google Doodle</title>
		<link>http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/</link>
		<comments>http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 21:45:44 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Linkery]]></category>
		<category><![CDATA[doodle]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[pirate]]></category>
		<category><![CDATA[thanksgiving]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/?p=941</guid>
		<description><![CDATA[Google has a pretty neat interactive Doodle for Thanksgiving&#8230; Pirate: http://g.co/doodle/7gmtj5 Wizard: http://g.co/doodle/y4rs2x Beanie hat on bicycle: http://g.co/doodle/enz2bt Disco Roller Skater: http://g.co/doodle/zskwej Astronaut: http://g.co/doodle/my24pw There&#8217;s more, but I haven&#8217;t found them all yet. To find them, just get the right combination of shoes, hat, &#8230; <a href="http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Google has a pretty neat interactive <a href="http://google.com">Doodle</a> for Thanksgiving&#8230;</p>
<p><img class="alignnone size-full wp-image-942" title="p" src="http://ottodestruct.com/wp-content/uploads/p.jpg" alt="" width="216" height="120" /></p>
<ul>
<li>Pirate: <a href="http://g.co/doodle/7gmtj5">http://g.co/doodle/7gmtj5</a></li>
<li>Wizard: <a href="http://g.co/doodle/y4rs2x">http://g.co/doodle/y4rs2x</a></li>
<li>Beanie hat on bicycle: <a href="http://g.co/doodle/enz2bt">http://g.co/doodle/enz2bt</a></li>
<li>Disco Roller Skater: <a href="http://g.co/doodle/zskwej">http://g.co/doodle/zskwej</a></li>
<li>Astronaut: <a href="http://g.co/doodle/my24pw">http://g.co/doodle/my24pw</a></li>
</ul>
<p>There&#8217;s more, but I haven&#8217;t found them all yet. To find them, just get the right combination of shoes, hat, and feathers and poof, it transforms. <img src='http://ottodestruct.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2Fay&count=vertical&related=otto42&text=Hidden Doodles in the Thanksgiving Google Doodle' class='twitter-share-button' data-text='Hidden Doodles in the Thanksgiving Google Doodle' data-url='http://otto42.com/ay' data-counturl='http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2011/hidden-doodles-in-the-thanksgiving-google-doodle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/p-150x83.jpg" />
		<media:content url="http://ottodestruct.com/wp-content/uploads/p.jpg" medium="image">
			<media:title type="html">p</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/p-150x83.jpg" />
		</media:content>
	</item>
		<item>
		<title>The future is awesome.</title>
		<link>http://ottodestruct.com/blog/2011/the-future-is-awesome/</link>
		<comments>http://ottodestruct.com/blog/2011/the-future-is-awesome/#comments</comments>
		<pubDate>Fri, 06 May 2011 23:49:22 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Linkery]]></category>
		<category><![CDATA[awesome]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/?p=848</guid>
		<description><![CDATA[This tweet got me to thinking about the myriad uses of technology used for rather simple things. For example, the weather. The National Weather Service has set up climate observation stations throughout the US, at places like airports, on top &#8230; <a href="http://ottodestruct.com/blog/2011/the-future-is-awesome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2011/the-future-is-awesome/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p><a href="https://twitter.com/#!/JohnJamesJacoby/statuses/66607241930874880">This tweet</a> got me to thinking about the myriad uses of technology used for rather simple things.</p>
<div id="attachment_849" class="wp-caption alignright" style="width: 286px"><a rel="attachment wp-att-849" href="http://ottodestruct.com/blog/2011/the-future-is-awesome/ws-16n-a/"><img class="size-full wp-image-849" title="weather-station-example" src="http://ottodestruct.com/wp-content/uploads/ws-16n-a.jpg" alt="Weather Station Example" width="276" height="369" /></a><p class="wp-caption-text">Weather Station Example</p></div>
<p>For example, the weather. The <a href="http://www.weather.gov/">National Weather Service</a> has set up <a href="http://en.wikipedia.org/wiki/Surface_weather_observation">climate observation stations</a> throughout the US, at places like airports, on top of tall buildings, alongside freeways, random places in the countryside, even on ships and buoys in the ocean. These monitor the temperature, humidity, and a bunch of other things of that nature. Sometimes they&#8217;re integrated into the overall system, like at an airport tower, sometimes they&#8217;re just self contained boxes mounted somewhere with power, like on a freeway sign or beside the road. Anyway, these boxes record this information and generally use radio transmitters to send updates back to some centralized location in each region. Usually a local university, TV station, NWS local offices, etc.</p>
<p>This information is then sent on to the next stop via various methods. As the technology evolved, old methods like phone lines got replaced with the internet, or on other more secure lines. They call this overall system <a href="http://www.weather.gov/tg/tginfo.html">The Gateway</a>, and it has its own special protocols and methodologies along with it as well. Anyway, the data is sent back to the NWS&#8217;s central server center somewhere. Probably in DC, although they likely have multiple redundancy in various other locations. This information is naturally combined with all the other information from all over the world, so that a complete up-to-date system of meteorlogical data of the entire world can be maintained.</p>
<p>Thousands of other organizations read from this data via various protocols of their own. For example, <a href="http://www.weather.com/">The Weather Channel</a> gets a lot of their information from this large, distributed, database via some kind of real time feed. They even re-serve the data themselves using various formats, such as the <a href="http://xoap.weather.com/">XOAP system</a>.</p>
<p>That XOAP system is interesting because it&#8217;s a pretty good feed of weather related data for various regions. I use it myself, indirectly. On my iPhone, for example, I have the <a href="http://typophone.gmtaz.com/">Typophone Weather</a> application, which uses the <a href="http://en.wikipedia.org/wiki/3G">3G network</a> (which is itself a highly connected system of radio towers using multi-spectrum packet switching technologies), to connect to the internet (this big system of pipes which is in reality not all that well put together but nevertheless works because of incredible fault tolerance in its <a href="http://en.wikipedia.org/wiki/Internet_Protocol_Suite">various protocols</a>), in order to query that XOAP system (which uses <a href="http://en.wikipedia.org/wiki/XML">XML</a> and <a href="http://en.wikipedia.org/wiki/SOAP">SOAP</a> standards for its interface).</p>
<p>All this happens in order to display the current temperature on my iPhone&#8217;s lock screen, while I sit here on a couch, not four feet from a friggin&#8217; window.</p>
<p>The future is awesome.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2F9e&count=vertical&related=otto42&text=The future is awesome.' class='twitter-share-button' data-text='The future is awesome.' data-url='http://otto42.com/9e' data-counturl='http://ottodestruct.com/blog/2011/the-future-is-awesome/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2011/the-future-is-awesome/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2011/the-future-is-awesome/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2011/the-future-is-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/ws-16n-a-112x150.jpg" />
		<media:content url="http://ottodestruct.com/wp-content/uploads/ws-16n-a.jpg" medium="image">
			<media:title type="html">weather-station-example</media:title>
			<media:description type="html">Weather Station Example</media:description>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/ws-16n-a-112x150.jpg" />
		</media:content>
	</item>
		<item>
		<title>Genetic Testing: 23andme</title>
		<link>http://ottodestruct.com/blog/2010/genetic-testing-23andme/</link>
		<comments>http://ottodestruct.com/blog/2010/genetic-testing-23andme/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 05:57:18 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[23andme]]></category>
		<category><![CDATA[dna]]></category>
		<category><![CDATA[genetic]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/?p=731</guid>
		<description><![CDATA[A while back, the personal genetic testing company 23andme offered a special sale. They discounted their normal price from $500 to $99 for one day only. Naturally, I jumped on it. Just got my results back. Nothing particularly surprising here, &#8230; <a href="http://ottodestruct.com/blog/2010/genetic-testing-23andme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2010/genetic-testing-23andme/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p><a href="http://ottodestruct.com/wp-content/uploads/dna_logo.jpg"><img class="alignright size-medium wp-image-732" title="DNA" src="http://ottodestruct.com/wp-content/uploads/dna_logo-135x300.jpg" alt="" width="135" height="300" /></a>A while back, the personal genetic testing company <a href="http://23andme.com">23andme</a> offered a special sale. They discounted their normal price from $500 to $99 for one day only. Naturally, I jumped on it.</p>
<p>Just got my results back. Nothing particularly surprising here, but it is neat.</p>
<ul>
<li>My blood type is A (A/O). I knew this, good to see it backed up by genetics. <img src='http://ottodestruct.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>I have an elevated risk for Type I and II diabetes (no news here, my sister is diabetic).</li>
<li>Apparently, I can&#8217;t taste &#8220;bitter&#8221;. This does explain why I love Brussels Sprouts.</li>
<li>I&#8217;m lactose intolerant. I was pretty sure of this already.</li>
<li>I have a natural resistance to norovirus (stomach flu). Didn&#8217;t know that.</li>
<li>I am a carrier for Cystic Fibrosis. I don&#8217;t have it, but it&#8217;s possible that my children could.</li>
<li>I am a slow caffeine metabolizer. It says that drinking coffee increases my heart attack risk (duh), but I&#8217;m not sure what this really means. Caffeine typically doesn&#8217;t do a thing to me, at least not immediately. I go through a fair amount of it on a regular basis.</li>
<li>Paternal Haplogroup: I1*, Maternal Haplogroup: H1. This basically makes my ancestry 100% European. Very vanilla there. However, this does conflict with my known ancestry slightly, in that it says I don&#8217;t have any Native American ancestors (within 5 generations). But then again, I don&#8217;t have a whole lot of reliable information on that branch of the family tree.</li>
</ul>
<p>There&#8217;s a ton more information (apparently I&#8217;d respond really well to Interferon Beta Therapy, whatever the hell that is), and I haven&#8217;t gone through it all yet.</p>
<p>One thing I did note is that they do allow you to download the raw data, which is pretty cool. However when I looked at it, I noticed that it&#8217;s not a complete record of your DNA, just a sampling. Basically it&#8217;s like 500,000 markers of it instead of the full 3 billion or whatever. Clearly you don&#8217;t need the complete sequence to draw useful information out of it.</p>
<p>Still, kinda neat that this is within the reach of the average person.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2F16&count=vertical&related=otto42&text=Genetic Testing: 23andme' class='twitter-share-button' data-text='Genetic Testing: 23andme' data-url='http://otto42.com/16' data-counturl='http://ottodestruct.com/blog/2010/genetic-testing-23andme/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2010/genetic-testing-23andme/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2010/genetic-testing-23andme/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2010/genetic-testing-23andme/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/dna_logo-67x150.jpg" />
		<media:content url="http://ottodestruct.com/wp-content/uploads/dna_logo.jpg" medium="image">
			<media:title type="html">DNA</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/dna_logo-67x150.jpg" />
		</media:content>
	</item>
		<item>
		<title>Simple Twitter Connect</title>
		<link>http://ottodestruct.com/blog/2010/simple-twitter-connect/</link>
		<comments>http://ottodestruct.com/blog/2010/simple-twitter-connect/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 19:38:55 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[Programmery]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[otto]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=688</guid>
		<description><![CDATA[Since people have been emailing me and asking for it&#8230; WordPress Plugin: Simple Twitter Connect It&#8217;s similar in concept to the Simple Facebook Connect plugin. In fact, it rips off quite a lot of the same code. But instead of &#8230; <a href="http://ottodestruct.com/blog/2010/simple-twitter-connect/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2010/simple-twitter-connect/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Since people have been emailing me and asking for it&#8230;</p>
<p>WordPress Plugin: <a href="http://ottopress.com/wordpress-plugins/simple-twitter-connect/">Simple Twitter Connect</a></p>
<p>It&#8217;s similar in concept to the <a href="http://ottopress.com/wordpress-plugins/simple-facebook-connect/">Simple Facebook Connect</a> plugin. In fact, it rips off quite a lot of the same code. But instead of Facebook, this integrates your WordPress site better with Twitter.</p>
<p>Now, there&#8217;s a lot of Twitter plugins out there already. And this plugin by no means competes with them (yet). This plugin can&#8217;t, for example, send a post to Twitter (yet). Nor can it pull posts from Twitter to display on your own site (yet).</p>
<p>What it does is to provide the framework for a more complete Twitter integration. Right now it can do:</p>
<ul>
<li>Login via Twitter</li>
<li>Comment via Twitter</li>
</ul>
<p>Not much, really. But it has the backend code necessary to make it easier to connect your site to a <a href="http://twitter.com/apps">Twitter Application</a>, and to make plugins surrounding it that won&#8217;t interfere with each other. That&#8217;s the same basic reason for the Simple Facebook Connect plugin.</p>
<p>So yes, eventually this plugin will send and receive stuff from Twitter. But for now, it lets you allow users to Login and/or to have users Comment using their Twitter credentials.</p>
<p>Expect frequent updates.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2Fv&count=vertical&related=otto42&text=Simple Twitter Connect' class='twitter-share-button' data-text='Simple Twitter Connect' data-url='http://otto42.com/v' data-counturl='http://ottodestruct.com/blog/2010/simple-twitter-connect/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2010/simple-twitter-connect/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2010/simple-twitter-connect/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2010/simple-twitter-connect/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
	</item>
		<item>
		<title>Don&#039;t include wp-load, please.</title>
		<link>http://ottodestruct.com/blog/2010/dont-include-wp-load-please/</link>
		<comments>http://ottodestruct.com/blog/2010/dont-include-wp-load-please/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 17:24:32 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[General Spew]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[Programmery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-config]]></category>
		<category><![CDATA[wp-load]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=667</guid>
		<description><![CDATA[Edit: This post has moved to here: http://ottopress.com/2010/dont-include-wp-load-please/. Take your comments there. Time for Otto&#8217;s general griping: WordPress plugin programming edition. Here&#8217;s a practice I see in plugins far too often: Plugin.php file adds something like this to the wp_head: &#8230; <a href="http://ottodestruct.com/blog/2010/dont-include-wp-load-please/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2010/dont-include-wp-load-please/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Edit: This post has moved to here: <a href="http://ottopress.com/2010/dont-include-wp-load-please/">http://ottopress.com/2010/dont-include-wp-load-please/</a>. Take your comments there.</p>
<p>Time for Otto&#8217;s general griping: WordPress plugin programming edition.</p>
<p>Here&#8217;s a practice I see in plugins far too often:</p>
<ol>
<li>Plugin.php file adds something like this to the wp_head:
<pre class="brush: xml; notranslate">&lt;script src='http://example.com/wp-content/plugins/my-plugin/script.js.php'&gt;</pre>
</li>
<li>Script.js.php has code like the following:
<pre class="brush: php; notranslate">
&lt;?php
include &quot;../../../wp-load.php&quot;;
?&gt;
... javascript code ...
</pre>
</li>
</ol>
<p>The reason for this sort of thing is that there&#8217;s some option or code or something that the javascript needs from the database or from WordPress or whatever. This PHP file is, basically, generating the javascript on the fly.</p>
<p>Usually, the case for this turns out to be something minor. The code needs the value from an option, or some flag to turn it on or off. Or whatever.</p>
<p>Problem is that finding wp-load.php can be a bit of a chore. I&#8217;ve seen extreme efforts to find and load that file in plugins before, including searching for it, examining the directory structure to make decent guesses, etc. This sort of thing has existed even before wp-load.php came around, with people trying to load wp-config.php themselves and such.</p>
<p>But the real problem is simpler: <em>This is always the wrong way to do it.</em><br />
<span id="more-667"></span></p>
<h3>Why this is wrong</h3>
<ol>
<li>You don&#8217;t have the first clue where wp-load.php actually is. Both the plugin directory and the wp-content directory can be moved around in the installation. ALL the WordPress files could be moved about in this manner, are you going to search around for them?</li>
<li>You&#8217;ve instantly doubled the load on that server. WordPress and the PHP processing of it all now have to get loaded twice for every page load. Once to produce the page, and then again to produce your generated javascript.</li>
<li>You&#8217;re generating javascript on the fly. That&#8217;s simply crap for caching and speed and such.</li>
</ol>
<p>The right way? Well, there&#8217;s two options.</p>
<h3>Right Way the First</h3>
<p>Generate your options separately, put them in using wp_print_scripts.</p>
<p>Examine this pseudo-code:</p>
<pre class="brush: php; notranslate">
add_action('wp_print_scripts','myscript');
function myscript() {
?&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
  var plugin_option= &lt;?php echo json_encode(get_option('plugin_option')); ?&gt;;
&lt;/script&gt;
&lt;?php
}
wp_enqueue_script('myscript','...myscript.js',...);
</pre>
<p>Basically, the plugin option value is inserted directly into the page. The myscript.js file that loads shortly afterwards can use this value however it likes.</p>
<p>Why this is better:</p>
<ol>
<li>No searching for wp-load.php.</li>
<li>The javascript is static, only your options are variable. No added load on the site.</li>
<li>Static scripts mean you get great speed from caching.</li>
</ol>
<p>Sidenote: Note the use of json_encode? You should always use this when producing javascript variables from PHP variables. It handles quoting and escaping and everything for you. It can even turn PHP arrays into javascript arrays nicely! Handy for storing all your options in one place.</p>
<p>What if you have a ton of plugin options though? What if you really WANT to generate that javascript on-the-fly?</p>
<h3>Right Way the Second</h3>
<p>Generate the javascript from a call to WordPress itself, not to a separate file.</p>
<p>Examine this pseudo-code:</p>
<pre class="brush: php; notranslate">
add_filter('query_vars','plugin_add_trigger');
function plugin_add_trigger($vars) {
    $vars[] = 'plugin_trigger';
    return $vars;
}

add_action('template_redirect', 'plugin_trigger_check');
function plugin_trigger_check() {
	if(intval(get_query_var('plugin_trigger')) == 1) {
	?&gt;
function javascript_code() {
...
}
&lt;?php
	exit;
	}
}
</pre>
<p>That code does something a little clever. Basically it&#8217;s adding a new query variable to be used as the &#8220;trigger&#8221;. When the trigger gets pulled, a bunch of javascript is generated, then the code *exits*, stopping WordPress from proceeding any further.</p>
<p>So, with that code in a plugin, a call to http://example.com/?plugin_trigger=1 will now produce your javascript code. This is running entirely within the content of a WordPress call, so you get all the WP functions and database access with which you can generate your code as well.</p>
<p>Thus, you can happily put your
<pre class="brush: xml; notranslate">&lt;script src=&quot;http://example.com/?plugin_trigger=1&quot;&gt;</pre>
<p> code into the page and it&#8217;ll load up that &#8220;file&#8221; just fine.</p>
<p>Why this is better:</p>
<ol>
<li>No searching for load.php</li>
<li>&#8230; Well, okay, there is no other reason. The load problem still exists, and your caching issues still exist. You&#8217;re programmatically generating code here, after all. It&#8217;s not a particularly good practice to do. Still, sometimes this is easier and faster to develop, even if it&#8217;s never actually &#8220;necessary&#8221;.</li>
</ol>
<p>Also see that while I&#8217;m using the number 1 there as the value I&#8217;m checking for, that value can be anything you like. If you want to be a smartass about it and have all sorts of different things that could be generated, you can do them all with that one trigger. It&#8217;s still a generally bad idea because of the added load, but hey, maybe you have a legitimate reason. I&#8217;ve seen one or two valid reasons to do this before.</p>
<h3>Wrap up</h3>
<p>Also note all of the above also applies to &#8220;generating&#8221; CSS code. It&#8217;s just as unnecessary. Usually more so.</p>
<p>So please, stop including wp-load. It&#8217;s just wrong. Let WordPress load itself, and make your plugin do the output it needs to produce in the right places.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2F1b&count=vertical&related=otto42&text=Don&#039;t include wp-load, please.' class='twitter-share-button' data-text='Don&#039;t include wp-load, please.' data-url='http://otto42.com/1b' data-counturl='http://ottodestruct.com/blog/2010/dont-include-wp-load-please/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2010/dont-include-wp-load-please/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2010/dont-include-wp-load-please/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2010/dont-include-wp-load-please/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
	
	</item>
		<item>
		<title>How to Setup your Facebook Connect Application</title>
		<link>http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/</link>
		<comments>http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 17:21:45 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[Programmery]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[settings]]></category>
		<category><![CDATA[sfc]]></category>
		<category><![CDATA[simple facebook connect]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=655</guid>
		<description><![CDATA[Note: This post has been moved to here. Please leave comments there instead. The majority of the email I get from users of the Simple Facebook Connect plugin is questions regarding how to setup their Facebook Application. It&#8217;s really not &#8230; <a href="http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Note: This post has been moved to <a href="http://ottopress.com/2010/how-to-setup-your-facebook-connect-application/">here</a>. Please leave comments there instead.</p>
<p>The majority of the email I get from users of the <a href="http://ottodestruct.com/blog/wordpress-plugins/simple-facebook-connect/">Simple Facebook Connect</a> plugin is questions regarding how to setup their Facebook Application. It&#8217;s really not that hard to do, but the plethora of options can seem  somewhat intimidating. So here&#8217;s the basics of what you need to do.</p>
<p><span id="more-655"></span></p>
<p>After creating your application, you&#8217;ll need to visit the <a href="http://www.facebook.com/developers/apps.php">Apps section</a> in the Facebook Developer Home area. Here you&#8217;ll find your application, and the all critical &#8220;Edit Settings&#8221; link.</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp1.png"><img class="alignnone size-full wp-image-656" src="http://ottodestruct.com/files/2010/02/apphelp1.png" alt="Main Application Screen" width="761" height="404" /></a></p>
<p>Firstly, <em>never give out your Application Secret</em>. If you give this out by accident, then use the Reset Secret Key link to get a new one.</p>
<p>Anyway, from here, you want to go into the settings. The settings area is divided into six main sections, but most of the settings are irrelevant. See, you&#8217;re building a &#8220;Connect&#8221; application, not a &#8220;Canvas&#8221; one. So most of these are meaningless for you. The following ones are what you actually care about:</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp2.png"><img class="alignnone size-full wp-image-657" src="http://ottodestruct.com/files/2010/02/apphelp2.png" alt="Application name" width="704" height="93" /></a></p>
<p>Obviously, you want the name of your Application to make sense. I suggest using the same name as your website. You can even use your domain name here if you like. Just be aware that this name is what the Fans of your site will see in their Applications area.</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp3.png"><img class="alignnone size-full wp-image-658" src="http://ottodestruct.com/files/2010/02/apphelp3.png" alt="Basic Information" width="700" height="284" /></a></p>
<p>The Basic Information section is important as well, fill it in as you see fit. I also recommend uploading good icons and/or logos for your site. Gives it that finished look.</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp4.png"><img class="alignnone size-full wp-image-659" src="http://ottodestruct.com/files/2010/02/apphelp4.png" alt="Contact Information" width="695" height="342" /></a></p>
<p>Contact Information is obviously important as well, but don&#8217;t worry about all those extra URLs. They really apply more to Canvas apps. Of course, if you want to make special pages on your site for them and provide the URLs here, feel free.</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp5.png"><img class="alignnone size-full wp-image-660" src="http://ottodestruct.com/files/2010/02/apphelp5.png" alt="Authentication Settings" width="695" height="222" /></a></p>
<p>The Authentication Settings page is surprisingly important. Those top two boxes need to be unchecked for a Facebook Connect application. Why? Because when they are unchecked, your Application becomes an &#8220;External Website&#8221; as far as Facebook is concerned. If you have either them checked, then your app&#8217;s Canvas section becomes active and you might have users trying to add it to their profiles and such, resulting in broken pages and a general bad user experience.</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp6.png"><img class="alignnone size-full wp-image-661" src="http://ottodestruct.com/files/2010/02/apphelp6.png" alt="Connect Settings" width="688" height="227" /></a></p>
<p>The Connect Settings page is probably the most important one. These settings must be filled in and they must be <em>absolutely accurate</em>. Specifically, the URLs must be the URLs that are actually used by your site. Capitalization matters. The leading &#8220;www&#8221; or lack of one matters. Whatever the URL your site is in the browser is what you MUST put into these fields. Anything less and your site <em>will not work</em>.</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp8.png"><img class="alignnone size-full wp-image-663" src="http://ottodestruct.com/files/2010/02/apphelp8.png" alt="Advanced Settings" width="687" height="134" /></a></p>
<p>The Advanced Settings screen contains these three fields which you need to set in the same way I did. The email domain should be your own domain, obviously. This field must be filled in for you to get real user emails on your Connected site. Without this, you only get proxied emails through Facebook.</p>
<p><a href="http://ottodestruct.com/files/2010/02/apphelp7.png"><img class="alignnone size-full wp-image-662" src="http://ottodestruct.com/files/2010/02/apphelp7.png" alt="Application Profile" width="567" height="262" /></a></p>
<p>Finally, after you have saved those settings, take the time to go back to the main application screen and click the &#8220;Edit Application Profile&#8221; link. You&#8217;ll be taken here, where you can set up the &#8220;look&#8221; of your application page on Facebook. This includes what tabs are visible, the stuff in the Info section, etc. You can add extra Applications tabs to this page and generally customize all sorts of stuff. None of that affects your site, but it does affect how the App Page looks in Facebook. The more polished it is, the more likely people will &#8220;Fan&#8221; your Application. And Fans get updates from when you publish posts to the Wall. Great way to drive traffic to your content.</p>
<p>Hope this helps! Mainly, I hope this reduces the number of questions I get about this process. Enjoy SFC!</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2F1e&count=vertical&related=otto42&text=How to Setup your Facebook Connect Application' class='twitter-share-button' data-text='How to Setup your Facebook Connect Application' data-url='http://otto42.com/1e' data-counturl='http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2010/how-to-setup-your-facebook-connect-application/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
	
		<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp1-150x150.png" />
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp1.png" medium="image">
			<media:title type="html">Main Application Screen</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp1-150x150.png" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp2.png" medium="image">
			<media:title type="html">Application name</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp2-150x93.png" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp3.png" medium="image">
			<media:title type="html">Basic Information</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp3-150x150.png" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp4.png" medium="image">
			<media:title type="html">Contact Information</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp4-150x150.png" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp5.png" medium="image">
			<media:title type="html">Authentication Settings</media:title>
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp6.png" medium="image">
			<media:title type="html">Connect Settings</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp6-150x150.png" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp8.png" medium="image">
			<media:title type="html">Advanced Settings</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp8-150x134.png" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp7.png" medium="image">
			<media:title type="html">Application Profile</media:title>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2010/02/apphelp7-150x150.png" />
		</media:content>
	</item>
		<item>
		<title>SFC Chicklet</title>
		<link>http://ottodestruct.com/blog/2009/sfc-chicklet/</link>
		<comments>http://ottodestruct.com/blog/2009/sfc-chicklet/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 17:13:56 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[Programmery]]></category>
		<category><![CDATA[chicklet]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbfoundations]]></category>
		<category><![CDATA[sfc]]></category>
		<category><![CDATA[simple facebook connect]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=633</guid>
		<description><![CDATA[I saw this morning that Jesse Stay had created a rather neat little chicklet for his FBFoundations plugin. I thought it was a clever idea, so naturally I stole it and added it to Simple Facebook Connect as well. Of &#8230; <a href="http://ottodestruct.com/blog/2009/sfc-chicklet/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2009/sfc-chicklet/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>I saw this morning that <a href="http://staynalive.com/articles/2009/12/22/make-your-facebook-page-fly-with-the-fbfoundations-facebook-chicklet/">Jesse Stay had created</a> a rather neat little <a href="http://www.ifeedreaders.com/chicklet-creator/">chicklet</a> for his <a href="http://staynalive.com/articles/2009/10/10/fbfoundations-facebook-connect-plugin-for-wordpress/">FBFoundations</a> plugin. I thought it was a clever idea, so naturally I stole it and added it to Simple Facebook Connect as well.</p>
<p>Of course, just copying an idea is no fun. So I had to improve upon it a bit for my version. <img src='http://ottodestruct.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I ended up not using any of Jesse&#8217;s code, but I did (mostly) keep the format of his chicklet output the same, so as to try to be compatible with it for styling rules and such.</p>
<p><span id="more-633"></span></p>
<h3>Usage</h3>
<p>The SFC Chicklet works in one of a few ways:</p>
<ul>
<li>First, it&#8217;s a widget if you just want to stick it in a sidebar or something. That&#8217;s easy.</li>
<li>On the other hand, if you want to integrate it into your theme, then all you have to do is to add a call to sfc_chicklet(); anywhere you like.</li>
</ul>
<h3>Configuration (Styling)</h3>
<p>Now, unlike Jesse&#8217;s FBFoundations plugin, Simple Facebook Connect is all about simplicity. So I removed all the configuration options that he used (widths, colors, etc) and made them styleable instead.</p>
<p>The SFC Chicklet has a default set of styles that it puts right into the HTML itself. However, these can be easily overridden by your own styles in your theme. The thing to notice is that all the styles I use refer to classes only, not referencing the tags. So, if you re-style and use the tags as well, then your styles win the <a href="http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html">specificity war</a>, and will take precedence.</p>
<p>Thus, if you want to change the background color of the main box, you can do this:<br />
<code><br />
div.fanBoxChicklet {<br />
background-color:blue;<br />
}</code></p>
<p>Simple. The &#8220;div&#8221; makes it take precedence. Anybody familiar with simple CSS should be able to easily style it the way they like.</p>
<p>On the other hand, if you&#8217;re a super-themer and want to disable the built-in styles entirely, add this to your theme&#8217;s functions.php file:</p>
<p><code>global $sfc_chicklet_no_style;<br />
$sfc_chicklet_no_style = true;</code></p>
<h3>Extra</h3>
<p>And, of course, this new plugin supports both the Application and the Fan Page methods, for those of you who have your webpage hooked to a Fan Page. This is similar to the new support for Fan Pages in the SFC Publish and SFC Fan Box plugins.</p>
<p>If you&#8217;re a <em>real</em> power user, you might want to display a chicklet for more than one page or application. Well, we&#8217;ve got you covered, just call sfc_chicklet(&#8220;ID-NUMBER&#8221;), where ID-NUMBER is the ID of your application or page. Remember, this needs to be a string, not an integer.</p>
<h3>Internals</h3>
<p>Internally, the plugin uses the Facebook PHP library to get the necessary data from Facebook, so there&#8217;s no need to have any odd javascript or ajax requests to make the system work. Because of the use of this Facebook code, PHP 5 is required to use this plugin.</p>
<p>However, the Facebook code includes a JSON library (if you don&#8217;t have one already loading), which means that if you activate this plugin, it&#8217;s quite probable that the whole SFC system will run on WordPress 2.8, even if it wouldn&#8217;t before. Of course, since 2.9 was just released, this is not as big of a deal, really.</p>
<p>The plugin also uses the <a href="http://codex.wordpress.org/Transients_API">WordPress Transients API</a> as a caching mechanism, so that it only asks Facebook for the fan count a maximum of once per hour. The Transients API was introduced in 2.8, and so the plugin should still work okay if you haven&#8217;t upgraded to 2.9 yet.</p>
<p>And if you can come up with any other good Facebook plugin ideas, let me know. SFC has proven to be an easy platform for building simple Facebook plugins on top of, so they can probably be produced pretty quickly and easily. <img src='http://ottodestruct.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Installation</h3>
<p>If you haven&#8217;t installed SFC yet, then this chicklet is part of the package. Just download it and install from here:<br />
<a href="http://plugins.svn.wordpress.org/simple-facebook-connect/trunk/sfc-chicklet.php">http://wordpress.org/extend/plugins/simple-facebook-connect/</a></p>
<p>Alternatively, in a WordPress installation, just go to the &#8220;Plugins-&gt;Add New&#8221; area and search for &#8220;Simple Facebook Connect&#8221;. You can install the package directly from there.</p>
<p>If you already are using SFC 0.8, then you only need the new file. You can download it separately here:<br />
<a href="http://plugins.svn.wordpress.org/simple-facebook-connect/trunk/sfc-chicklet.php">http://plugins.svn.wordpress.org/simple-facebook-connect/trunk/sfc-chicklet.php</a></p>
<p>Just drop it into your /wp-content/plugins/simple-facebook-connect directory, then activate it in the Plugins panel.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2Ft&count=vertical&related=otto42&text=SFC Chicklet' class='twitter-share-button' data-text='SFC Chicklet' data-url='http://otto42.com/t' data-counturl='http://ottodestruct.com/blog/2009/sfc-chicklet/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2009/sfc-chicklet/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2009/sfc-chicklet/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2009/sfc-chicklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>Twitter Geolocation</title>
		<link>http://ottodestruct.com/blog/2009/twitter-geolocation/</link>
		<comments>http://ottodestruct.com/blog/2009/twitter-geolocation/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 20:08:03 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[General Spew]]></category>
		<category><![CDATA[Linkery]]></category>
		<category><![CDATA[Thingery]]></category>
		<category><![CDATA[fire eagle]]></category>
		<category><![CDATA[geotag]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tweetie]]></category>
		<category><![CDATA[twitaloc]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=618</guid>
		<description><![CDATA[Heard of geotagged tweets yet? Not surprised, a lot of my friends seem to have not caught on to it, so I&#8217;m writing this in a possibly futile attempt to get them to try it out. How to add your &#8230; <a href="http://ottodestruct.com/blog/2009/twitter-geolocation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2009/twitter-geolocation/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Heard of geotagged tweets yet? Not surprised, a lot of my friends seem to have not caught on to it, so I&#8217;m writing this in a possibly futile attempt to get them to try it out.</p>
<h3>How to add your location to your tweets</h3>
<p>1. Turn on Geotagging. To do this, go to <a href="http://twitter.com/account/settings">your Twitter settings page</a>. Down under the &#8220;Location&#8221; section is an option to enable geotagging. Turn it on.</p>
<div id="attachment_619" class="wp-caption alignnone" style="width: 505px"><a rel="attachment wp-att-619" href="http://ottodestruct.com/blog/2009/twitter-geolocation/tweetie5/"><img class="size-full wp-image-619" src="http://ottodestruct.com/files/2009/12/tweetie5.jpg" alt="" width="495" height="198" /></a><p class="wp-caption-text">Twitter Settings</p></div>
<p>2. Get a Twitter client that supports Geotagging. These are generally mobile applications. <a href="http://itunes.apple.com/gb/app/tweetie-2/">Tweetie 2 for the iPhone</a> added support for it in 2.1. Several other clients support it as well. Find one.</p>
<p>3. Turn it on in your client. How you do this depends on the client, but it can usually be enabled on a per-tweet basis.</p>
<p>Here&#8217;s an example of how it works and looks in Tweetie 2 for the iPhone.</p>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_620" class="wp-caption alignnone" style="width: 110px"><a href="http://ottodestruct.com/files/2009/12/tweetie1.jpg"><img class="size-thumbnail wp-image-620" src="http://ottodestruct.com/files/2009/12/tweetie1-100x150.jpg" alt="" width="100" height="150" /></a><p class="wp-caption-text">First, you type in a new tweet, and pull open the drop down.</p></div></td>
<td>
<p><div id="attachment_621" class="wp-caption alignnone" style="width: 110px"><a href="http://ottodestruct.com/files/2009/12/tweetie2.jpg"><img class="size-thumbnail wp-image-621" src="http://ottodestruct.com/files/2009/12/tweetie2-100x150.jpg" alt="" width="100" height="150" /></a><p class="wp-caption-text">Next, you enable the geotag feature, and you&#039;ll see a little red pin appear.</p></div></td>
<td>
<p><div id="attachment_622" class="wp-caption alignnone" style="width: 110px"><a href="http://ottodestruct.com/files/2009/12/tweetie3.jpg"><img class="size-thumbnail wp-image-622" src="http://ottodestruct.com/files/2009/12/tweetie3-100x150.jpg" alt="" width="100" height="150" /></a><p class="wp-caption-text">You&#039;ll see little maps on tweets with locations attached to them.</p></div></td>
<td>
<p><div id="attachment_623" class="wp-caption alignnone" style="width: 110px"><a href="http://ottodestruct.com/files/2009/12/tweetie4.jpg"><img class="size-thumbnail wp-image-623" src="http://ottodestruct.com/files/2009/12/tweetie4-100x150.jpg" alt="" width="100" height="150" /></a><p class="wp-caption-text">Click on the map icon for greater detail.</p></div></td>
</tr>
</tbody>
</table>
<p>You can do more with your Twitter location too. For example, <a href="http://tweetaloc.nowwhat.in/">this website</a> will read your twitter feed and get your latest location, then send it over to <a href="http://fireeagle.yahoo.net/">Fire Eagle</a>, which is Yahoo&#8217;s location service. Fire Eagle can do all sorts of things, but basically it&#8217;s just a service that stores your location for <a href="http://fireeagle.yahoo.net/gallery">other programs</a> to use. So if you want to display your location on your blog, or on Facebook for your friends to see, or anything else you can think of, you can do that, using nothing more than your already existing tweets.</p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2F1h&count=vertical&related=otto42&text=Twitter Geolocation' class='twitter-share-button' data-text='Twitter Geolocation' data-url='http://otto42.com/1h' data-counturl='http://ottodestruct.com/blog/2009/twitter-geolocation/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2009/twitter-geolocation/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2009/twitter-geolocation/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2009/twitter-geolocation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie5-150x150.jpg" />
		<media:content url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie5.jpg" medium="image">
			<media:title type="html">tweetie5</media:title>
			<media:description type="html">Twitter Settings</media:description>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie5-150x150.jpg" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie1.jpg" medium="image">
			<media:title type="html">Tweetie1</media:title>
			<media:description type="html">First, you type in a new tweet, and pull open the drop down.</media:description>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie1-150x150.jpg" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie2.jpg" medium="image">
			<media:title type="html">tweetie2</media:title>
			<media:description type="html">Next, you enable the geotag feature, and you'll see a little red pin appear.</media:description>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie2-150x150.jpg" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie3.jpg" medium="image">
			<media:title type="html">tweetie3</media:title>
			<media:description type="html">You'll see little maps on tweets with locations attached to them.</media:description>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie3-150x150.jpg" />
		</media:content>
		<media:content url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie4.jpg" medium="image">
			<media:title type="html">tweetie4</media:title>
			<media:description type="html">Click on the map icon for greater detail.</media:description>
			<media:thumbnail url="http://ottodestruct.com/wp-content/uploads/2009/12/tweetie4-150x150.jpg" />
		</media:content>
	</item>
		<item>
		<title>WordPress Settings API Tutorial</title>
		<link>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/</link>
		<comments>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 22:49:55 +0000</pubDate>
		<dc:creator>Otto</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[Programmery]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[settings]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://ottodestruct.com/blog/?p=583</guid>
		<description><![CDATA[Edit: This post has moved to here: http://ottopress.com/2009/wordpress-settings-api-tutorial/. Take your comments there. When writing the Simple Facebook Connect plugin, I investigated how the Settings API worked. It&#8217;s relatively new to WordPress (introduced in version 2.7), and many things I read &#8230; <a href="http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<fb:like href='http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/' send='true' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>Edit: This post has moved to here: <a href="http://ottopress.com/2009/wordpress-settings-api-tutorial/">http://ottopress.com/2009/wordpress-settings-api-tutorial/</a>. Take your comments there.</p>
<p>When writing the <a href="http://ottodestruct.com/blog/wordpress-plugins/simple-facebook-connect/">Simple Facebook Connect</a> plugin, I investigated how the <a href="http://codex.wordpress.org/Settings_API">Settings API</a> worked. It&#8217;s relatively new to WordPress (introduced in version 2.7), and many things I read said that it was much easier to use.</p>
<p>It is much easier to use in that it makes things nice and secure almost automatically for you. No confusion about nonces or anything along those lines. However, it&#8217;s slightly more difficult to use in that there&#8217;s very little good documentation for it. Especially for the most common case: Making your own settings page.</p>
<p>So, here is my little documentation attempt.</p>
<p><span id="more-583"></span></p>
<h3>Making your own settings page</h3>
<p>First, add yourself an options page. Code to do that:</p>
<pre class="brush: php; notranslate">
&lt;?php // add the admin options page
add_action('admin_menu', 'plugin_admin_add_page');
function plugin_admin_add_page() {
add_options_page('Custom Plugin Page', 'Custom Plugin Menu', 'manage_options', 'plugin', 'plugin_options_page');
}
?&gt;
</pre>
<p>What this does is quite simple, really:</p>
<p>a. It adds a link under the settings menu called &#8220;Custom Plugin Menu&#8221;.<br />
b. When you click it, you go to a page with a title of &#8220;Custom Plugin Page&#8221;.<br />
c. You must have the &#8220;manage_options&#8221; capability to get there though (admins only).<br />
d. The link this will be will in fact be /wp-admin/options-general.php?page=plugin (so &#8220;plugin&#8221; needs to be something only you will use).<br />
e. And the content of the page itself will be generated by the &#8220;plugin_options_page&#8221; function.</p>
<p>Oh wait, we need that function! Let&#8217;s go ahead and create that, shall we?</p>
<pre class="brush: php; notranslate">
&lt;?php // display the admin options page
function plugin_options_page() {
?&gt;
&lt;div&gt;
&lt;h2&gt;My custom plugin&lt;/h2&gt;
Options relating to the Custom Plugin.
&lt;form action=&quot;options.php&quot; method=&quot;post&quot;&gt;
&lt;?php settings_fields('plugin_options'); ?&gt;
&lt;?php do_settings_sections('plugin'); ?&gt;

&lt;input name=&quot;Submit&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Save Changes'); ?&gt;&quot; /&gt;
&lt;/form&gt;&lt;/div&gt;

&lt;?php
}?&gt;
</pre>
<p>Hang on a minute, where&#8217;s all the options? Well, here&#8217;s where the Settings API kicks in a bit. Up to now, this has been more or less the same as previous tutorials. Adding the options pages is really quite easy. But now, we&#8217;re going to use two new functions.</p>
<p>First, we call settings_fields(&#8216;plugin_options&#8217;). This outputs the hidden bits that we need to make our options page both do what we want and to make it secure with a nonce. The string &#8220;plugin-options&#8221; can be anything, as long as it&#8217;s unique. There is another call we&#8217;re going to have to make with this same string later.</p>
<p>Next, we call do_settings_sections(&#8216;plugin&#8217;). This is going to output all of our input fields. Text input boxes, radio fields, anything we like. Obviously though, we have to tell it what those fields are and look like somewhere. We do both of these things in the next section.</p>
<h3>Defining the settings</h3>
<pre class="brush: php; notranslate">
&lt;?php // add the admin settings and such
add_action('admin_init', 'plugin_admin_init');
function plugin_admin_init(){
register_setting( 'plugin_options', 'plugin_options', 'plugin_options_validate' );
add_settings_section('plugin_main', 'Main Settings', 'plugin_section_text', 'plugin');
add_settings_field('plugin_text_string', 'Plugin Text Input', 'plugin_setting_string', 'plugin', 'plugin_main');
}?&gt;
</pre>
<p>Here we&#8217;ve done three things. Let&#8217;s break that down, shall we?</p>
<pre class="brush: php; notranslate">
&lt;?php register_setting( 'plugin_options', 'plugin_options', 'plugin_options_validate' );?&gt;
</pre>
<p>First, we register the settings. In my case, I&#8217;m going to store all my settings in one options field, as an array. This is usually the recommended way. The first argument is a group, which needs to be the same as what you used in the settings_fields function call. The second argument is the name of the options. If we were doing more than one, we&#8217;d have to call this over and over for each separate setting. The final arguement is a function name that will validate your options. Basically perform checking on them, to make sure they make sense.</p>
<p>Ignoring the validation function for a moment, lets move on to the setting section. This one is actually quite simple.</p>
<pre class="brush: php; notranslate">
&lt;?php add_settings_section('plugin_main', 'Main Settings', 'plugin_section_text', 'plugin'); ?&gt;
</pre>
<p>This creates a &#8220;section&#8221; of settings.<br />
The first argument is simply a unique id for the section.<br />
The second argument is the title or name of the section (to be output on the page).<br />
The third is a function callback to display the guts of the section itself.<br />
The fourth is a page name. This needs to match the text we gave to the do_settings_sections function call.</p>
<p>That function callback in the third argument should look a bit like this:</p>
<pre class="brush: php; notranslate">
&lt;?php function plugin_section_text() {
echo '&lt;p&gt;Main description of this section here.&lt;/p&gt;';
} ?&gt;
</pre>
<p>Simple, really. You can put any HTML you like here.</p>
<p>Now that we&#8217;ve talked about the section itself, we need to talk about the fields in that section.</p>
<pre class="brush: php; notranslate">
&lt;?php add_settings_field('plugin_text_string', 'Plugin Text Input', 'plugin_setting_string', 'plugin', 'plugin_main'); ?&gt;
</pre>
<p>The first argument is simply a unique id for the field.<br />
The second is a title for the field.<br />
The third is a function callback, to display the input box.<br />
The fourth is the page name that this is attached to (same as the do_settings_sections function call).<br />
The fifth is the id of the settings section that this goes into (same as the first argument to add_settings_section).</p>
<p>The only difficult one here is, again, the callback. Let&#8217;s look at that, shall we?</p>
<pre class="brush: php; notranslate">
&lt;?php function plugin_setting_string() {
$options = get_option('plugin_options');
echo &quot;&lt;input id='plugin_text_string' name='plugin_options[text_string]' size='40' type='text' value='{$options['text_string']}' /&gt;&quot;;
} ?&gt;
</pre>
<p>Simple. It just gets the options then outputs the input HTML for it. Note the &#8220;name&#8221; is set to plugin_options[text_string]. This is not coincidence, the name *must* start with plugin_options in our case. Why? Because that is the second argument we passed to register_settings.</p>
<p>The settings pages use a whitelist system. Only valid options get read. Anything else gets tossed out, for security. Here, we&#8217;re using a php trick. PHP interprets an incoming GET or POST data of name[thing] as being an array called name with &#8216;thing&#8217; as one of the elements in it. So, all our options are going to take the form of plugin_options[some_thing], so that we get that single array back, and the array name itself is whitelisted.</p>
<p>Since this is designed with security in mind, we have one last callback to deal with: The validation callback that we skipped earlier:</p>
<pre class="brush: php; notranslate">
&lt;?php // validate our options
function plugin_options_validate($input) {
$newinput['text_string'] = trim($input['text_string']);
if(!preg_match('/^[a-z0-9]{32}$/i', $newinput['text_string'])) {
$newinput['text_string'] = '';
}
return $newinput;
}
?&gt;
</pre>
<p>Here I&#8217;m taking a liberty with the code. I&#8217;m going to say that our text_string has to be exactly 32 alphanumerics long. You can actually validate any way you want in here. The point of this function is simply to let you check all the incoming options and make sure they are valid in some way. Invalid options need to be fixed or blanked out. Finally, you return the whole input array again, which will get automatically saved to the database.</p>
<p>Take special note of the fact that I don&#8217;t return the original array. One of the drawbacks of this sort of approach is that somebody could, in theory, send bad options back to the plugin. These would then be in the $input array. So by validating my options and *only* my options, then any extra data they send back which might make it here gets blocked. So the validation function not only makes sure that my options have valid values, but that no other options get through. In short, $input is untrusted data, but the returned $newinput should be trusted data.</p>
<h3>And we&#8217;re done. Wait, what?</h3>
<p>Yes, the whole point of this exercise is that the options are automatically saved for you. And everything else. You have an options page, you have fields on it, you are validating them&#8230; and that&#8217;s it. The actual *display* of the page is even done for you. Remember the input we made? It&#8217;ll get put into a table with the title on the left side before it, waiting for input.</p>
<p>Another nice thing is that this is easily expandable. For each option to add we:<br />
1. Do a new add_settings_field call.<br />
2. Make the function to display that particular input.<br />
3. Add code to validate it when it comes back to us from the user.</p>
<p>To add a new section, you:<br />
1. Do a new add_settings_section call.<br />
2. Make the function to display any descriptive text about it.<br />
3. Add settings fields to it as above.</p>
<h3>One last thing</h3>
<p>Sometimes we don&#8217;t need a whole page. Sometimes we only have one setting, and it would work well on some existing page. Maybe on the general page, or the discussion page. Well, we can add settings to those too!</p>
<p>If you look through the core code, you&#8217;ll find references like do_settings_sections(&#8216;general&#8217;) or do_settings_sections(&#8216;writing&#8217;), and so on. These you can add on to like any others, getting your settings on the main WordPress settings pages instead of having to make your own.</p>
<p>Just do this:<br />
1. Make an add_settings_section call. The last argument should be &#8220;general&#8221;, or wherever you want to add your new section.<br />
2. Add fields to your new section, using add_settings_field.<br />
3. You still need to make your own settings whitelisted. To do this, you&#8217;ll need to make a call to register_setting. The first argument should be the same as the page name, like &#8216;general&#8217;, or wherever you&#8217;re putting your settings. This will let that page recognize and allow your settings to come through.</p>
<p>All the callbacks will basically be the same for this method. You&#8217;re just skipping a step of making your own page. Easy.</p>
<p>And there you go. More reading: <a title="Settings API on WordPress Codex" href="http://codex.wordpress.org/Settings_API">http://codex.wordpress.org/Settings_API</a></p>
<a href='http://twitter.com/share?url=http%3A%2F%2Fotto42.com%2F1l&count=vertical&related=otto42&text=WordPress Settings API Tutorial' class='twitter-share-button' data-text='WordPress Settings API Tutorial' data-url='http://otto42.com/1l' data-counturl='http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/' data-count='vertical' data-via='ottodestruct' data-related='otto42'></a><span class="fb_share"><fb:like href="http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/" layout="box_count"></fb:like></span><div class="plusone"><g:plusone size=tall annotation=bubble align=left href="http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using xcache
Object Caching 3017/3224 objects using xcache

Served from: ottodestruct.com @ 2012-02-11 06:56:09 -->
