<?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>Aaron Brazell<title>&#187; sql</title>
</title>
	<atom:link href="http://aaronbrazell.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://aaronbrazell.com</link>
	<description>Unplugged.</description>
	<lastBuildDate>Tue, 01 Jun 2010 16:27:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Fun With Programming Languages</title>
		<link>http://aaronbrazell.com/2009/02/26/fun-with-programming-languages/</link>
		<comments>http://aaronbrazell.com/2009/02/26/fun-with-programming-languages/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 05:03:55 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://aaronbrazell.com/?p=164</guid>
		<description><![CDATA[Tonight, a Facebook thread got a little out of control after I posted a status update that I was &#8220;mentally bankrupt.&#8221; It was a long day working on client work &#8211; a project that is just about done but past due. After some commentary by Facebook friends, we got to writing little scripts that would [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight, a Facebook thread got a little out of control after I posted a status update that I was &#8220;mentally bankrupt.&#8221; It was a long day working on client work &#8211; a project that is just about done but past due.</p>
<p>After some commentary by Facebook friends, we got to writing little scripts that would take a random selection from a group of adjectives and adverbs and put similar phrases together randomly.</p>
<p>What came of this exercise was a fun little jaunt into a variety of programming languages.</p>
<p><strong>PHP</strong><br />
[cc lang="php"]<?php<br />
$adverbs = array(<br />
	'mentally',<br />
	'morally',<br />
	'emotionally',<br />
	'socially',<br />
	'psychologically'<br />
);</p>
<p>$adjectives = array(<br />
	'devoid',<br />
	'bankrupt',<br />
	'empty',<br />
	'hollow',<br />
	'vacant',<br />
	'sleeping with fishes',<br />
	'taking a dirt nap',<br />
	'shallow'<br />
);</p>
<p>echo $adverbs[array_rand( $adverbs )] . ' '<br />
	. $adjectives[array_rand( $adjectives )];<br />
?>[/cc]<br />
<strong>Ruby</strong><br />
[cc lang="ruby"]<br />
adj = [ "mentally", "morally",<br />
	"emotionally", "socially",<br />
	"psychologically" ]</p>
<p>adv = [ "devoid","bankrupt",<br />
	"empty", "hollow","vacant",<br />
	"sleeping with fishes",<br />
	"taking a dirt nap","shallow" ]</p>
<p>print adj[rand(adj.length)] + &#8221; &#8221;<br />
	+ adv[rand(adv.length)] + &#8220;\n&#8221;<br />
[/cc]</p>
<p><strong>Python</strong><br />
[cc lang="python"]<br />
import random</p>
<p>def popchoice(seq):<br />
    return seq.pop(random.randrange(len(seq)))</p>
<p>adj = [ 'mentally', 'morally',<br />
	'emotionally', 'socially',<br />
	'psychologically' ]</p>
<p>adv = [ 'devoid','bankrupt','empty',<br />
	'hollow','vacant','sleeping with fishes',<br />
	'taking a dirt nap','shallow' ]</p>
<p>print popchoice(adj) + &#8221; &#8221;<br />
	+ popchoice(adv)<br />
[/cc]</p>
<p><strong>SQL</strong><br />
[cc lang="sql"]CREATE TEMPORARY TABLE adjectives (<br />
    adjective VARCHAR (30) NOT NULL<br />
    );</p>
<p>CREATE TEMPORARY TABLE adverbs (<br />
    adverb VARCHAR (30) NOT NULL<br />
    );</p>
<p>INSERT INTO adjectives (adjective)<br />
    VALUES<br />
    (&#8216;mentally&#8217;),<br />
    (&#8216;morally&#8217;),<br />
    (&#8216;emotionally&#8217;),<br />
    (&#8216;socially&#8217;),<br />
    (&#8216;psychologically&#8217;);</p>
<p>INSERT INTO adverbs (adverb)<br />
    VALUES<br />
    (&#8216;devoid&#8217;),<br />
    (&#8216;bankrupt&#8217;),<br />
    (&#8216;empty&#8217;),<br />
    (&#8216;hollow&#8217;),<br />
    (&#8216;vacant&#8217;),<br />
    (&#8216;sleeping with fishes&#8217;),<br />
    (&#8216;taking a dirt nap&#8217;),<br />
    (&#8216;shallow&#8217;);</p>
<p>SELECT CONCAT_WS(<br />
    &#8216; &#8216;,<br />
        ( SELECT adjective FROM adjectives ORDER BY RAND() LIMIT 1 ),<br />
        ( SELECT adverb FROM adverbs ORDER BY RAND() LIMIT 1 ) )<br />
    as RandomStuff;<br />
[/cc]</p>
<script type="text/javascript">
  addthis_url    = 'http%3A%2F%2Faaronbrazell.com%2F2009%2F02%2F26%2Ffun-with-programming-languages%2F';
  addthis_title  = 'Fun+With+Programming+Languages';
  addthis_pub    = 'technosailor';
</script><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script>
]]></content:encoded>
			<wfw:commentRss>http://aaronbrazell.com/2009/02/26/fun-with-programming-languages/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (enhanced)
Database Caching using memcached
Content Delivery Network via aaronbrazell.wpengine.netdna-cdn.com

Served from: aaronbrazell.com @ 2010-09-09 06:04:01 -->