<?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>Mike Newell</title>
	<atom:link href="http://iwearshorts.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://iwearshorts.com</link>
	<description>Cool Tagline Here!</description>
	<lastBuildDate>Wed, 19 Jun 2013 03:40:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Beagle Bone Black &#8211; Getting Started</title>
		<link>http://iwearshorts.com/blog/beagle-bone-black-getting-started/</link>
		<comments>http://iwearshorts.com/blog/beagle-bone-black-getting-started/#comments</comments>
		<pubDate>Tue, 18 Jun 2013 07:30:24 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1283</guid>
		<description><![CDATA[Let&#8217;s get right to it shall we? If this is your first time, get a usb cord, plug into the beagle bone and plug into your laptop. Download the drivers for your computer in step #2 on this page. Then navigate to http://192.168.7.2. NOTE: you may need to restart your computer. If you want to [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s get right to it shall we?</p>
<p>If this is your first time, get a usb cord, plug into the beagle bone and plug into your laptop. Download the drivers for your computer in step #2 on <a href="http://beagleboard.org/static/beaglebone/latest/README.htm">this page</a>. Then navigate to http://192.168.7.2. NOTE: you may need to restart your computer.</p>
<p>If you want to make something blink, click the &#8220;cloud 9 ide&#8221; link, and copy and paste some code from <a href="http://192.168.7.2/bonescript.html">this page</a>, make sure to hit the &#8220;run&#8221; button not the &#8220;debug&#8221; button at the top. Boom you pwn some leds.</p>
<p>Ok, you&#8217;re bored. Enough of this virtual shit, let&#8217;s get something we can develop with.</p>
<p>Adafruit has a <a href="http://learn.adafruit.com/beaglebone-black-installing-operating-systems/angstrom-mac-os-x">good tutorial</a> on how to write an image to an sd card from a mac. <a href="http://beagleboard.org/latest-images">Go here</a>, grab the latest version of angstrom. Follow the instructions from the aforementioned tutorial to write your sd card image. NOTE: if you get a permission denied error when trying to write the disk, it&#8217;s because the sd card reader fugged up. Apparently, apple made the macbook pro like nintendo, so what did you do when your games got messed up on nintendo? Take the game out and blow! <a href="http://groovecoder.com/2012/11/25/mac-raspberry-pi-dd-permission-denied/">Seriously,</a> Jiggle the card around and blow. Thanks apple. Also, this will take a long time, so feel free to surf porn or whatever your do at work.</p>
<p>Now install angstrom on your beagle. Follow the tutorial about half way down the page <a href="http://beagleboard.org/static/beaglebone/latest/README.htm">here</a>. should take about 45 minutes. Be sure you have a power supply that provides more than 1A as the bone can pull this much during installation.</p>
<p>Next get it running with wifi, follow the tutorial here: <a href="http://learn.adafruit.com/beaglebone/wifi">http://learn.adafruit.com/beaglebone/wifi</a></p>
<p>You might also find that you can&#8217;t find the bone on your network after you remove all your peripherals and just plug your wifi into the usb. This is most likely because you haven&#8217;t powered it.</p>
<p>If you want debian, there&#8217;s a great distro here: <a href="http://elinux.org/BeagleBoardDebian">http://elinux.org/BeagleBoardDebian</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/beagle-bone-black-getting-started/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Holy $hit RDS</title>
		<link>http://iwearshorts.com/blog/holy-hit-rds/</link>
		<comments>http://iwearshorts.com/blog/holy-hit-rds/#comments</comments>
		<pubDate>Thu, 09 May 2013 19:49:25 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1275</guid>
		<description><![CDATA[So my life has been changed. Here&#8217;s why: I was choosing platforms partially because of my database structure. I&#8217;d go with PHP if I had a sql database, or nodeJS if I could use Mongo. No more. Just use Amazon RDS for your sql tables and it makes you platform agnosting. I can easily use [...]]]></description>
			<content:encoded><![CDATA[<p>So my life has been changed. Here&#8217;s why:</p>
<p>I was choosing platforms partially because of my database structure. I&#8217;d go with PHP if I had a sql database, or nodeJS if I could use Mongo.</p>
<p>No more. Just use Amazon RDS for your sql tables and it makes you platform agnosting. I can easily use it with nodejs instance running on heroku with almost no performance degredation!</p>
<p>I&#8217;ll write more later but for now do this:</p>
<ol>
<li>Get mysql native client <a href="http://dev.mysql.com/downloads/tools/workbench/">here</a>.</li>
<li>Follow <a href="http://docs.aws.amazon.com/AmazonRDS/latest/GettingStartedGuide/Welcome.html">these instructions </a>to get your RDS instance up and running</li>
<li>Add some command line tools for rds, follow an <a href="http://docs.aws.amazon.com/AmazonRDS/latest/CommandLineReference/StartCLI.html">example here</a>.</li>
<li>Set up your heroku app according<a href="https://devcenter.heroku.com/articles/amazon_rds#prerequisites"> to this</a>.</li>
<li>Export your sql database as a sql file, unzipped and place it directly in your mysql query window. Connect and run!</li>
</ol>
<p>Boom, you have an RDS instance that ready to connect with heroku. Platform agnostic with the added benefit of being scalable on both ends.</p>
<p>I worked with it for 9 hours, and finally got it to work with the following command:</p>
<p><a href="http://iwearshorts.com/Mike/uploads/2013/05/8-hours.png"><img class="aligncenter size-medium wp-image-1281" title="8-hours" src="http://iwearshorts.com/Mike/uploads/2013/05/8-hours-300x82.png" alt="" width="300" height="82" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/holy-hit-rds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi &#8211; The 5 Minute Setup</title>
		<link>http://iwearshorts.com/blog/raspberry-pi-the-5-minute-setup/</link>
		<comments>http://iwearshorts.com/blog/raspberry-pi-the-5-minute-setup/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 08:05:57 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1269</guid>
		<description><![CDATA[I&#8217;ll just dive in. Note: this is a mac only tutorial. SD Card You need to flash an sd card with the latest distro of raspbian. Don&#8217;t worry about it, just do it. Download a copy of raspbian. Unzip it on your desktop and do the following&#8230; Open an terminal and type df -h Look [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll just dive in. Note: this is a mac only tutorial.</p>
<h2>SD Card</h2>
<p>You need to flash an sd card with the latest distro of raspbian. Don&#8217;t worry about it, just do it.</p>
<p>Download a copy of <a href="http://www.raspberrypi.org/downloads">raspbian</a>.</p>
<p>Unzip it on your desktop and do the following&#8230;</p>
<p>Open an terminal and type</p>
<pre class="brush:shell">df -h</pre>
<p>Look at what you have. Then insert your sd card and do the same thing again.</p>
<pre class="brush:shell">df -h</pre>
<p>Notice a difference? You should see something added like <strong>/dev/disk3s1</strong> or something</p>
<p>Now unmount the sd card so you can write it.</p>
<pre class="brush:shell">sudo diskutil unmount /dev/disk3s1</pre>
<p>Now look at the name, we&#8217;re gonna change it. <strong>disk3s1 </strong>becomes <strong>rdisk3 </strong>just drop the &#8220;s1&#8243; and add an &#8220;r&#8221;.</p>
<p>We need to copy it over so do this with your disk name and location of the download file:</p>
<pre class="brush:shell">sudo dd bs=1m if=~/Desktop/2013-02-09-wheezy-raspbian.img of=/dev/rdisk3</pre>
<p>It&#8217;s not gonna tell you anything and it will take a long time. be patient. It will tell you when it&#8217;s done.</p>
<h2>Setup</h2>
<p>eject the sd card and pop it into your raspberry pi. Boot it up with a keyboard and hdmi cable to your monitor already plugged in. You should see s setup screen after it does some stuff.</p>
<p>Do the following setup:</p>
<ol>
<li>Expand root partition to fill SD card (just hit enter on this and it will expand)</li>
<li>Set keyboard layout (I set it to logitech english US version generic)</li>
<li>Enable ssh server</li>
<li>Start desktop on boot? (I set this to no)</li>
<li>Finish</li>
</ol>
<p>Now your set up. It will ask you if you want to reboot. Say yes.</p>
<h2>Install some stuff</h2>
<p>log back in:</p>
<p>Username: <strong>pi</strong></p>
<p>Password: <strong>raspberry</strong></p>
<p>Now we need wifi.</p>
<pre class="brush:shell">sudo pico /etc/network/interfaces</pre>
<p>Edit your interfaces file to look like this:</p>
<pre class="brush:shell">auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid "network name"
        wpa-psk "password"</pre>
<p>Reboot your pi to it can log in and get wifi</p>
<p>Now we want to install some stuff we&#8217;ll use. But first:</p>
<pre class="brush:shell">sudo apt-get update
sudo apt-get upgrade</pre>
<p>Your password is just &#8220;raspberry&#8221;</p>
<p>Next we want to install build-essential and git-core so we can check things out.</p>
<pre class="brush:shell">sudo apt-get install build-essential git-core nodejs npm</pre>
<p>Next we want to make sure we can use node instead of typing nodejs everytime.</p>
<pre class="brush:shell">update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10</pre>
<p>You can double check this is working with:</p>
<pre class="brush:shell">node -v</pre>
<p>If you get a version number output then it worked. Then we want to make sure we can use the gpio pins. I use pi-gpio. To use this library without having to type &#8220;sudo&#8221;. To do this you need GPIO admin:</p>
<pre class="brush:shell">git clone git://github.com/quick2wire/quick2wire-gpio-admin.git
cd quick2wire-gpio-admin
make
sudo make install
sudo adduser $USER gpio</pre>
<p>Next we install pi-gpio</p>
<pre class="brush:shell">sudo npm install -g pi-gpio</pre>
<p>Now we want to manage our nodejs processes without worrying about them crashing. I user &#8220;forever&#8221; for this. NOTE: if you upgrade to node 0.10.5 there&#8217;s a <a href="https://github.com/nodejitsu/forever/issues/408">known bug</a></p>
<pre class="brush:shell">sudo npm install -g forever</pre>
<p>Let&#8217;s say you install your package and you have a node process like &#8220;web.js&#8221;. To start forever you might do:</p>
<pre class="brush:shell">forever start /PATH/TO/FILE/web.js</pre>
<p>Then if you want to stop it:</p>
<pre class="brush:shell">forever list
forever stop 0</pre>
<p>And boom. In about 5 minutes you can go from no pi to pi with a working install of NodeJS.</p>
<h2>General stuff</h2>
<p>You will also need to generate some ssh keys if you want to pull from github&#8230;</p>
<pre class="brush:shell">cd ~/.ssh
ssh-keygen -t rsa -C "my@email.com"
#enter
#enter
#enter</pre>
<p>Then you will need to ssh into your pi. You can find it on your network by doing:</p>
<pre class="brush:shell">nmap 192.168.0.0/24</pre>
<p>Then look for an interface that only has the ssh port open &#8220;22&#8243;</p>
<pre class="brush:shell">ssh pi@192.168.0.102</pre>
<p>Enter your password &#8220;raspberry&#8221;.</p>
<p>If you really can&#8217;t find your pi&#8217;s ip by nmapping, then login into it with your keyboard and monitor and do:</p>
<pre class="brush:shell">ifconfig</pre>
<p>This should tell you if your connected and what IP your on. Look for an IP that doesn&#8217;t have a .255 address.</p>
<p>Next we want to copy that ssh key we generated so we can pull down from github</p>
<p>less ~/.ssh/id_rsa.pub</p>
<p>copy the output and add it to your github repo ssh keys</p>
<p>Now you can pull from github.</p>
<p>If you want to reboot your pi:</p>
<pre class="brush:shell">sudo reboot</pre>
<p>You should always shut your pi down, instead of just unplugging it. I just corrupted an sd card by unplugging it myself. Make sure you shutdown properly:</p>
<pre class="brush:shell">sudo shutdown -h now</pre>
<p>Remember there really arent that many consequences. If you corrupt your card, just reflash it. and reinstall.</p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/raspberry-pi-the-5-minute-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NodeJS on Raspberry Pi named NodeJS Instead of Node</title>
		<link>http://iwearshorts.com/blog/nodejs-on-raspberry-pi-named-nodejs-instead-of-node/</link>
		<comments>http://iwearshorts.com/blog/nodejs-on-raspberry-pi-named-nodejs-instead-of-node/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 04:53:14 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1267</guid>
		<description><![CDATA[So you followed the instructions and installed nodejs from the repositories on wheezy. The problem is, there&#8217;s already a package named node in the sources. So according to binary naming convention, nodeJS gets renamed to &#8220;nodejs&#8221;. You can tell if you have this problem by simply typing node -v # then type nodejs -v If [...]]]></description>
			<content:encoded><![CDATA[<p>So you followed the instructions and installed nodejs from the repositories on wheezy. The problem is, there&#8217;s already a package named node in the sources. So according to binary naming convention, nodeJS gets renamed to &#8220;nodejs&#8221;.</p>
<p>You can tell if you have this problem by simply typing</p>
<pre class="brush:shell">node -v

# then type

nodejs -v</pre>
<p>If you get an error for the first and a version number for the second, your process is named &#8220;nodejs&#8221; instead of &#8220;node&#8221;. Which really isn&#8217;t a problem except that alot of scripts rely on &#8220;node&#8221; instead of the former. Packages like forever expect your process to be named node.</p>
<p>To fix this you simply need to link the nodejs process to node:</p>
<pre class="brush:shell">update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10</pre>
<p>If you run this command under sudo, you should be able to enter</p>
<pre class="brush:shell">node -v</pre>
<p>In the command line and get a version number back (as of writing this, the wheezy distro allows for 0.6.19).</p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/nodejs-on-raspberry-pi-named-nodejs-instead-of-node/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install the latest version of NodeJS</title>
		<link>http://iwearshorts.com/blog/install-the-latest-version-of-nodejs/</link>
		<comments>http://iwearshorts.com/blog/install-the-latest-version-of-nodejs/#comments</comments>
		<pubDate>Wed, 24 Apr 2013 11:21:19 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1265</guid>
		<description><![CDATA[There are alot of theories out there on how to install the latest version of node. I prefer the following: npm install n -g n 0.10.5 Or whatever the latest version is&#8230;]]></description>
			<content:encoded><![CDATA[<p>There are alot of theories out there on how to install the latest version of node. I prefer the following:</p>
<pre class="brush:shell">npm install n -g
n 0.10.5</pre>
<p>Or whatever the latest version is&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/install-the-latest-version-of-nodejs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Splitting Javascript Loops</title>
		<link>http://iwearshorts.com/blog/splitting-javascript-loops/</link>
		<comments>http://iwearshorts.com/blog/splitting-javascript-loops/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 04:46:23 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1263</guid>
		<description><![CDATA[There&#8217;s a programming trick, I was unaware of so I thought I&#8217;d share&#8230; In Javascript for example, it&#8217;s single threaded. Which means you don&#8217;t want to do something like this: for(var i =0; i &#60; 1000000; i++) { // do lots of stuff } That&#8217;s because Javascript will try and complete the process all at [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a programming trick, I was unaware of so I thought I&#8217;d share&#8230;</p>
<p>In Javascript for example, it&#8217;s single threaded. Which means you don&#8217;t want to do something like this:</p>
<pre class="brush:js">for(var i =0; i &lt; 1000000; i++) {
  // do lots of stuff
}</pre>
<p>That&#8217;s because Javascript will try and complete the process all at once, meaning your page will hang while it&#8217;s trying to complete the process.</p>
<p>But you could do:</p>
<pre class="brush:js">for(var i = 0; i &lt; 1000; i++) {
  setTimeout(function(){
    for(var x = 0; x &lt; 1000; i++) {
      // do spme stuff
    }
  }, 0)
}</pre>
<p>This allows the browser to effectively &#8220;catch up&#8221; before it starts on the next batch. To make this into a function you could do</p>
<pre class="brush:js">function part(array, callback) {
  setTimeout(function(){
    var i = array.shift();
    callback.call(i);

    if(array.length &gt; 0) {
      setTimeout(arguments.callee, 0);
    }
  }, 0);
}</pre>
<p>This function from <a href="http://www.nczonline.net/blog/2009/01/13/speed-up-your-javascript-part-1/">here</a>, will set timeouts in order to process your array, but it&#8217;s the same concept. You pass an array and a function (your definition of what to do on each item in the array) as a variable to &#8220;part()&#8221; and it will process things according to when the browser has the next available tick</p>
<p>Pretty cool</p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/splitting-javascript-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NodeJS Dynamic Eventing</title>
		<link>http://iwearshorts.com/blog/nodejs-dynamic-eventing/</link>
		<comments>http://iwearshorts.com/blog/nodejs-dynamic-eventing/#comments</comments>
		<pubDate>Tue, 26 Mar 2013 02:56:48 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1260</guid>
		<description><![CDATA[So here&#8217;s something&#8230; I was trying to define things so I can key/value query later in nodeJS. I have an array of usernames. Then I try and create custom end points using nodeJS and express to customize a json return. If you pull down the code and run it you&#8217;ll see what I mean: var [...]]]></description>
			<content:encoded><![CDATA[<p>So here&#8217;s something&#8230;</p>
<p>I was trying to define things so I can key/value query later in nodeJS. I have an array of usernames. Then I try and create custom end points using nodeJS and express to customize a json return. If you pull down the code and run it you&#8217;ll see what I mean:</p>
<pre class="brush:js"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">
<pre class="brush:js">
var FOLLOWS = new Array('GSPBetaGroup', 'FreedomRiders1');

var lastTweets = new Array();
lastTweets["FreedomRiders1"] = "this is a piece of content!";

for(var t = 0; t &lt; FOLLOWS.length; t++) {

    app.get('/'+FOLLOWS[t]+'.json', function(request, response) {  

        console.log('loggin the function get last tweets')
        console.log(getLastTweets(x))
        console.log('\n\r\t')

        console.log('loggin lastTweets')
        console.log(lastTweets)
        console.log('\n\r\t')

        console.log('testing how to call out an associative arrays')
        console.log('lastTweets.FreedomRiders1 = ' + lastTweets.FreedomRiders1);
        console.log('lastTweets["FreedomRiders1"] = ' + lastTweets["FreedomRiders1"]);
        console.log('lastTweets[\'FreedomRiders1\'] = ' + lastTweets['FreedomRiders1']);
        console.log('\n\r\t')

        console.log('FOLLOWS = ' + FOLLOWS);
        console.log('x = ' + x);
        console.log('FOLLOWS.length = ' + FOLLOWS.length);
        console.log('FOLLOWS[t] = ' + FOLLOWS[x]);
        console.log('FOLLOWS["t"] = ' + FOLLOWS["t"]);
        console.log('FOLLOWS.t = ' + FOLLOWS.t);
        console.log('\n\r\t')

        console.log('lastTweets[FOLLOWS[t]] = ' + lastTweets[FOLLOWS[t]]);
        console.log('\n\r\t')

        for(var x = 0; x &lt; FOLLOWS.length; x++) {
            console.log('loggin the function get last tweets')
            console.log(getLastTweets(x))
            console.log('\n\r\t')

            console.log('loggin lastTweets')
            console.log(lastTweets)
            console.log('\n\r\t')

            console.log('testing how to call out an associative arrays')
            console.log('lastTweets.FreedomRiders1 = ' + lastTweets.FreedomRiders1);
            console.log('lastTweets["FreedomRiders1"] = ' + lastTweets["FreedomRiders1"]);
            console.log('lastTweets[\'FreedomRiders1\'] = ' + lastTweets['FreedomRiders1']);
            console.log('\n\r\t')

            console.log('FOLLOWS = ' + FOLLOWS);
            console.log('x = ' + x);
            console.log('FOLLOWS.length = ' + FOLLOWS.length);
            console.log('FOLLOWS[x] = ' + FOLLOWS[x]);
            console.log('FOLLOWS["x"] = ' + FOLLOWS["x"]);
            console.log('FOLLOWS.x = ' + FOLLOWS.x);
            console.log('\n\r\t')

            console.log('t = ' + t)
            console.log('x = ' + x)
            console.log('FOLLOWS = ' + FOLLOWS)
            console.log('FOLLOWS[t] = ' + FOLLOWS[t])
            console.log('FOLLOWS[x] = ' + FOLLOWS[x])
            console.log('\n\r\t')

            console.log('lastTweets[FOLLOWS[x]] = ' + lastTweets[FOLLOWS[x]]);
            console.log('\n\r\t')
        }

//        response.json({anObject: lastTweet});
//        lastTweets[name] = null;
    });
}</pre>
<p></span></pre>
<pre class="brush:js"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">You can see that everything inside the second for loop is defined whereas everything outside is undefined. Why is this? I know it has something to do with t ending up being equal to the length of the array, but I don't understand why it would not loop through t = 0, t= 1 first?</span></pre>
<pre class="brush:js">
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/nodejs-dynamic-eventing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Associative Arrays?</title>
		<link>http://iwearshorts.com/blog/javascript-associative-arrays/</link>
		<comments>http://iwearshorts.com/blog/javascript-associative-arrays/#comments</comments>
		<pubDate>Tue, 26 Mar 2013 02:48:11 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1258</guid>
		<description><![CDATA[Ok, so first off, everything (I mean EVERYTHING) in Javascript is an object. So there are no such things as &#8220;Associative arrays&#8221;. Let&#8217;s say you&#8217;re coming from PHP and you want to target something by it&#8217;s dynamically generated name. You might say: $things = array(); $things["stuff"] = 123; $things["otherthings"] = "more stuff"; print_r($things); It&#8217;s fairly [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so first off, everything (I mean EVERYTHING) in Javascript is an object. So there are no such things as &#8220;Associative arrays&#8221;.</p>
<p>Let&#8217;s say you&#8217;re coming from PHP and you want to target something by it&#8217;s dynamically generated name. You might say:</p>
<pre class="brush:php">$things = array();
$things["stuff"] = 123;
$things["otherthings"] = "more stuff";

print_r($things);</pre>
<p>It&#8217;s fairly easy to callout the values of the variables, like:</p>
<pre class="brush:php">echo $things['stuff'];
echo $things['otherthings'];</pre>
<p>Let&#8217;s say I do the same thing in Javascript</p>
<pre class="brush:js">var things = new Array();
things["stuff"] = 123;
things["otherthings"] = "more stuff";

console.dir(things);</pre>
<p>I can still call out these things in the array like this</p>
<pre class="brush:js">console.log(things['stuff']);
console.log(things["otherthings"]);</pre>
<p>However I can also use dot syntax like</p>
<pre class="brush:js">console.log(things.stuff)
console.log=(things.otherstuff)</pre>
<p>But the object itself is not implicit so we can&#8217;t say something like</p>
<pre class="brush:js">console.log(things[stuff])</pre>
<p>That last one should error out</p>
<p>Ok that&#8217;s fine.</p>
<pre class="brush:js">
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/javascript-associative-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Up Some RAM Raspberry Pi</title>
		<link>http://iwearshorts.com/blog/free-up-some-ram-raspberry-pi/</link>
		<comments>http://iwearshorts.com/blog/free-up-some-ram-raspberry-pi/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 05:19:00 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1256</guid>
		<description><![CDATA[short example, let&#8217;s say your memory is low. You can find out by typing free -h you can clear some of this up with the following sync echo 3 &#62; /proc/sys/vm/drop_caches That&#8217;s it, super simple]]></description>
			<content:encoded><![CDATA[<p>short example, let&#8217;s say your memory is low.</p>
<p>You can find out by typing</p>
<pre class="brush:shell">free -h</pre>
<p>you can clear some of this up with the following</p>
<pre class="brush:shell">sync
echo 3 &gt; /proc/sys/vm/drop_caches</pre>
<p>That&#8217;s it, super simple</p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/free-up-some-ram-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Out of Memory? Raspberry Pi</title>
		<link>http://iwearshorts.com/blog/out-of-memory-raspberry-pi/</link>
		<comments>http://iwearshorts.com/blog/out-of-memory-raspberry-pi/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 00:08:59 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://iwearshorts.com/?p=1251</guid>
		<description><![CDATA[If you&#8217;re like me and ordered raspbian preinstalled on a 4gig card for model B pi, then you are also like me and have installed maybe two packages before you can&#8217;t run sudo apt-get upgrade You end up returning this error: You don't have enough free space in /var/cache/apt/archives/. So what do we do? Well [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me and ordered raspbian preinstalled on a 4gig card for model B pi, then you are also like me and have installed maybe two packages before you can&#8217;t run</p>
<pre class="brush:shell">sudo apt-get upgrade</pre>
<p>You end up returning this error:</p>
<pre class="brush:shell">You don't have enough free space in /var/cache/apt/archives/.</pre>
<p>So what do we do?</p>
<p>Well I just ordered another 16 gig card, I know, I could have bought a sd card, installed it for free and whatever&#8230; But I like to keep things easy.</p>
<p>In the mean time, if you need a couple extra megs, you can clean out your apt cache. It&#8217;s located here:</p>
<pre class="brush:shell">/var/cache/apt/archives</pre>
<p>And if you try and get the disc usage of this folder you will see how much space your can clear out. Basically, apt just keeps cached copies of the packages in case you need to install them again, so most likely you&#8217;ll be ok if you remove them. To see how much storage you are using in this directory type:</p>
<pre class="brush:shell">cd /var/cache/apt/archives
du -sh .</pre>
<p>I returned like 256 MB. So I cleared the cache:</p>
<pre class="brush:shell">sudo apt-get clean</pre>
<p>And looked at how much memory I have available:</p>
<pre class="brush:shell">free -h</pre>
<h3>Before:</h3>
<p><a href="http://iwearshorts.com/Mike/uploads/2013/03/before.jpg"><img class="aligncenter size-medium wp-image-1252" title="before" src="http://iwearshorts.com/Mike/uploads/2013/03/before-300x53.jpg" alt="" width="300" height="53" /></a></p>
<h3>After:</h3>
<p><a href="http://iwearshorts.com/Mike/uploads/2013/03/cache.jpg"><img class="aligncenter size-medium wp-image-1253" title="cache" src="http://iwearshorts.com/Mike/uploads/2013/03/cache-300x58.jpg" alt="" width="300" height="58" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://iwearshorts.com/blog/out-of-memory-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
