<?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>Feet Have Been &#187; xangelo</title>
	<atom:link href="http://wheremy.feethavebeen.com/author/xangelo/feed/" rel="self" type="application/rss+xml" />
	<link>http://wheremy.feethavebeen.com</link>
	<description>Sometimes, you just go where your feet take you</description>
	<lastBuildDate>Tue, 24 Jan 2012 17:39:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>http://xangelo.ca</title>
		<link>http://wheremy.feethavebeen.com/2012/01/httpxangelo-ca/</link>
		<comments>http://wheremy.feethavebeen.com/2012/01/httpxangelo-ca/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 17:39:04 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=554</guid>
		<description><![CDATA[For a while now this blog has laid &#8220;dormant&#8221;. This is because I&#8217;ve been working on a few other things and also setting up a new website at http://xangelo.ca I recommend that you head over there for new updates and follow the feed from there &#8211; this blog will no longer be updated.]]></description>
			<content:encoded><![CDATA[<p>For a while now this blog has laid &#8220;dormant&#8221;. This is because I&#8217;ve been working on a few other things and also setting up a new website at <a href="http://xangelo.ca">http://xangelo.ca</a> I recommend that you head over there for new updates and follow the feed from there &#8211; this blog will no longer be updated. </p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2012/01/httpxangelo-ca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taking notes online</title>
		<link>http://wheremy.feethavebeen.com/2011/06/taking-notes-online/</link>
		<comments>http://wheremy.feethavebeen.com/2011/06/taking-notes-online/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 18:43:18 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/06/taking-notes-online/</guid>
		<description><![CDATA[I have three different kinds of notes. -There are the notes that I write that serve as little reminders to me. These notes are either blog post ideas, or things that I think of, or just a list of things that I need to get done. They get changed and delete a lot as I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>I have three different kinds of notes. -There are the notes that I write that serve as little reminders to me. These notes are either blog post ideas, or things that I think of, or just a list of things that I need to get done. They get changed and delete a lot as I&rsquo;m working through them. -There are the kinds of notes that I write and then share with a few people. These notes tend to be a more fleshed out version of the previous ones, but I&rsquo;m still not ready to make these public. -There are notes that I consider &ldquo;completed&rdquo; these notes will occasionally need some updating, but they are complete thoughts or ideas and there is little that I need to do except maintain them. I don&rsquo;t mind people seeing SOME of these notes, but some of them will still be private.</p>
<p>Most note taking applications let me manage the first one. They let me create these private notes and maintain them myself. Most times they work like a single folder with many notes in it. Most times the notes are organized by their names or when they were created. Sometimes they even let me &ldquo;tag&rdquo; them. Tagging works great for emails, but not for notes. Or at least, not for my notes. For example, there is rarely a note I will ignore, but many emails get ignored for days based on their tags. The notes are something that I actively need to be able to sort and organize &ndash; much like a folder/file structure. A lot of note apps don&rsquo;t allow this level of organization.</p>
<p>A lot fewer note taking applications offer the 2</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/06/taking-notes-online/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>June is going to be interesting</title>
		<link>http://wheremy.feethavebeen.com/2011/06/june-is-going-to-be-interesting/</link>
		<comments>http://wheremy.feethavebeen.com/2011/06/june-is-going-to-be-interesting/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 19:31:24 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/06/june-is-going-to-be-interesting/</guid>
		<description><![CDATA[Rivers Yesterday I announced that I had put up my river of news publicly. I have been using it quite a bit, even transitioning a lot of my feeds over to it and I&#8217;ve realized just how handy something like this is. It&#8217;s interesting news that most times I would just &#8220;Mark as Read&#8221; in [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<h2>Rivers</h2>
<p>Yesterday I <a href="http://xangelo.ca/my-river">announced</a> that I had put up my <a href="http://river.xangelo.ca">river</a> of news publicly. I have been using it quite a bit, even transitioning a lot of my feeds over to it and I&rsquo;ve realized just how handy something like this is. It&rsquo;s interesting news that most times I would just &ldquo;Mark as Read&rdquo; in Google-Reader, but now I can actually scan it at will.</p>
<p><a href="http://scripting.com">Dave Winer</a> has been running various Rivers of his own and claims that this is how he most likes to consume news. For me the River is a way to filter noise out of my standard reading lists that I still subscribe to via the old fashioned RSS.</p>
<p><a href="http://rarst.net">Rarst</a> mentioned to me that to him the SPEED of the river isn&rsquo;t as important as the content flowing through it. Granted he isn&rsquo;t a fan of Rivers in general, but the idea is valid. My River is never going to be as interesting as your river, and <a href="http://daveriver.scripting.com/">Dave&rsquo;s river</a> is probably the most interesting to Dave. So why not a web service that allows users to churn out their own Rivers. So that&rsquo;s the plan for June. Create a private-beta service that allows users to create their own Rivers.</p>
<h2>Notes</h2>
<p>I&rsquo;m in the process of launching a simple web-app that will allow you to create/manage/publish &ldquo;notes&rdquo;. Essentially you would open up the app, log in  and then you could create notes. You could create &ldquo;folders&rdquo; to manage these notes and of course, you can &ldquo;publish&rdquo; them to receive a unique url that is publicly accessible. You can also subscribe to a users public feed notifying you of updates.</p>
<p>This web app stemmed from the need for a single interface to manage all the notes/writing I do on the computer. Normally, when I answer the phone, I pop open notepad to take down notes. When I think of a new idea or concept I write it all up and then either forget where I wrote it or delete it so that I can keep thinking about it. To me, notes are very fluid. Sometimes, I need to share the notes I create with other users, to get their input.</p>
<p>So, I created the web app. Hopefully, this month I&rsquo;ll be able to finish up with branding and add the public notes feature. You&rsquo;ll know that it&rsquo;s ready to officially enter private beta when I transition my blog over from Posterous to a new system that is either completely powered by, or consumes the content provided by this new note application.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/06/june-is-going-to-be-interesting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My river</title>
		<link>http://wheremy.feethavebeen.com/2011/05/my-river/</link>
		<comments>http://wheremy.feethavebeen.com/2011/05/my-river/#comments</comments>
		<pubDate>Tue, 31 May 2011 16:37:56 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/05/my-river/</guid>
		<description><![CDATA[Last night I published my own river at http://river.xangelo.ca. I&#8217;m hoping that soon you&#8217;ll be able to subscribe to it via the RSS with eventual support for rss cloud. Maybe I&#8217;ll even throw in support for JSON. That way, you can run your own river if you want. Building was actually a lot simpler than [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>Last night I published my own <a href="http://www.reallysimplesyndication.com/riverOfNews">river</a> at <a href="http://river.xangelo.ca">http://river.xangelo.ca</a>. I&rsquo;m hoping that soon you&rsquo;ll be able to subscribe to it via the RSS with eventual support for <a href="http://rsscloud.org">rss cloud</a>. Maybe I&rsquo;ll even throw in support for JSON. That way, you can run your own river if you want.</p>
<p>Building was actually a lot simpler than I initially thought. I ended up powering the entire system using <a href="http://limonade-php.net">limonade-php</a> and <a href="http://simplepie.org">SimplePie</a>. For the front end I used <a href="http://baselinecss.com/">Baseline.css</a>, <a href="http://jquery.com">jQuery</a> and a little JavaScript module-based system that I&rsquo;ve been working on.</p>
<p>The system is simple, a <code>GET</code> run on <code>/river</code> will return the last.. 6 hours worth of river in JSON and a timestamp. Just keep <code>GET</code>&lsquo;ing that <code>/river</code> with a query string of <code>last_checked = timestamp</code> and you&rsquo;ll get a JSON update.</p>
<p>So yes, have fun with river.. I&rsquo;ll be mucking about with the update frequency over the next few days.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/05/my-river/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lemondoo</title>
		<link>http://wheremy.feethavebeen.com/2011/04/lemondoo/</link>
		<comments>http://wheremy.feethavebeen.com/2011/04/lemondoo/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 17:22:00 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/04/lemondoo/</guid>
		<description><![CDATA[Before I begin I just want to note that this document is a work in progress. It requires version 5.3+ of php as it utilizies anonymous functions and it requires the use of limonade-php v0.5.1 Get caught up If you haven&#8217;t yet, check out Part 1 of this tutorial to get setup. I&#8217;m going to [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>Before I begin I just want to note that this document is a work in progress. It requires version 5.3+ of php as it utilizies anonymous functions and it requires the use of limonade-php v0.5.1</p>
<h2>Get caught up</h2>
<p>If you haven&rsquo;t yet, check out <a href="">Part 1</a> of this tutorial to get setup. I&rsquo;m going to assume you did.</p>
<h3>Step 1: Setup</h3>
<p>
<div class="data type-php">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<pre class="line_numbers"><span rel="#L1" id="L1">1</span> <span rel="#L2" id="L2">2</span> <span rel="#L3" id="L3">3</span> <span rel="#L4" id="L4">4</span> <span rel="#L5" id="L5">5</span> </pre>
</td>
<td width="100%">
<div class="highlight">
<pre />
<div class="line" id="LC1"><span class="cp">&lt;?php</span> </div>
<div class="line" id="LC2"></div>
<div class="line" id="LC3"><span class="k">include</span><span class="p">(</span><span class="s1">&#39;lib/limonade.php&#39;</span><span class="p">);</span> </div>
<div class="line" id="LC4"></div>
<div class="line" id="LC5"><span class="cp">?&gt;</span><span class="x"></span></div>
</pre>
</div>
</td>
</tr>
</table></div>
</p>
<p>Now, rename index.php to api.php</p>
<h3>Step 2: Database!</h3>
<p>Now we get to setup our database. Since each of us have different ways of doing this (I switch between command line and sqlbuddy) I&rsquo;m providing the SQL code that will create our database. If you want you can re-create it using your favourite SQL manager.. or you can just copy and paste the SQL code and execute it. It&rsquo;s nothing too complicated, just a single table called &ldquo;todo&rdquo; in a database named &ldquo;lemondoo&rdquo;. Each row in this table will have</p>
<ol>
<li>a &ldquo;todo_id&rdquo; which is an auto incremented primary key (int)</li>
<li>a &ldquo;todo_title&rdquo; which is the title of this todo item (varchar(100))</li>
<li>a &ldquo;todo_text&rdquo; which is the text of the todo item (text)</li>
<li>a &ldquo;completed&rdquo; flag that is either 0 (not completed) or 1 (completed) (tinyint)</li>
</ol>
<p>
<div class="data type-sql">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<pre class="line_numbers"><span rel="#L1" id="L1">1</span> <span rel="#L2" id="L2">2</span> <span rel="#L3" id="L3">3</span> <span rel="#L4" id="L4">4</span> <span rel="#L5" id="L5">5</span> <span rel="#L6" id="L6">6</span> <span rel="#L7" id="L7">7</span> <span rel="#L8" id="L8">8</span> <span rel="#L9" id="L9">9</span> <span rel="#L10" id="L10">10</span> <span rel="#L11" id="L11">11</span> </pre>
</td>
<td width="100%">
<div class="highlight">
<pre />
<div class="line" id="LC1"><span class="k">CREATE</span> <span class="k">DATABASE</span> <span class="o">`</span><span class="n">lemondoo</span><span class="o">`</span> <span class="k">DEFAULT</span> <span class="n">CHARSET</span> <span class="n">utf8</span><span class="p">;</span></div>
<div class="line" id="LC2"></div>
<div class="line" id="LC3"><span class="n">USE</span> <span class="o">`</span><span class="n">lemondoo</span><span class="o">`</span><span class="p">;</span></div>
<div class="line" id="LC4"></div>
<div class="line" id="LC5"><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="o">`</span><span class="n">todo</span><span class="o">`</span> <span class="p">(</span></div>
<div class="line" id="LC6">&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="n">todo_id</span><span class="o">`</span> <span class="nb">int</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span> <span class="k">not</span> <span class="k">null</span> <span class="n">auto_increment</span><span class="p">,</span></div>
<div class="line" id="LC7">&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="n">todo_title</span><span class="o">`</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">100</span><span class="p">),</span></div>
<div class="line" id="LC8">&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="n">todo_text</span><span class="o">`</span> <span class="nb">text</span><span class="p">,</span></div>
<div class="line" id="LC9">&nbsp;&nbsp;&nbsp;<span class="o">`</span><span class="n">completed</span><span class="o">`</span> <span class="n">tinyint</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="k">default</span> <span class="s1">&#39;0&#39;</span><span class="p">,</span></div>
<div class="line" id="LC10">&nbsp;&nbsp;&nbsp;<span class="k">PRIMARY</span> <span class="k">KEY</span> <span class="p">(</span><span class="o">`</span><span class="n">todo_id</span><span class="o">`</span><span class="p">)</span></div>
<div class="line" id="LC11"><span class="p">)</span> <span class="n">ENGINE</span><span class="o">=</span><span class="n">InnoDB</span> <span class="k">DEFAULT</span> <span class="n">CHARSET</span><span class="o">=</span><span class="n">utf8</span> <span class="n">AUTO_INCREMENT</span><span class="o">=</span><span class="mi">1</span><span class="p">;</span></div>
</pre>
</div>
</td>
</tr>
</table></div>
</p>
<p>At this point, I would go ahead and enter a couple sets of data into our new table. Make sure that you set the completed field to 0.</p>
<h3>Step 3: Design our API</h3>
<p>API design, as far as I am concerned, should be an entire topic of study in itself. Adding REST principles makes it a little easier, but still it is something that should be thought about carefully. Below I&rsquo;ve outlined the REST header, the associated URL and the function that it will call. Notice that we can have two different headers assigned to the same url and each can map to their own function call. What we&rsquo;re going to do is define this route for limonade-php so that it knows what to do depending on what URL we try to access. Note below that when I say :id it means that if you access /anything it will call the appropriate method and also assign &ldquo;anything&rdquo; to the variable &ldquo;id&rdquo;. So if you had /:yes it would assign &ldquo;anything&rdquo; to the variable &ldquo;yes&rdquo;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/04/lemondoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL access for Limonade-php</title>
		<link>http://wheremy.feethavebeen.com/2011/04/mysql-access-for-limonade-php/</link>
		<comments>http://wheremy.feethavebeen.com/2011/04/mysql-access-for-limonade-php/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 20:21:23 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/04/mysql-access-for-limonade-php/</guid>
		<description><![CDATA[When working on the web it often helps to have some kind of database abstraction present. For my Limonade-php projects, I normally end up utilizing a single function that currently ties in to a mysql database. The connection happens before you call the method, but if you pass in a connection resource it will use [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>When working on the web it often helps to have some kind of database abstraction present. For my Limonade-php projects, I normally end up utilizing a single function that currently ties in to a mysql database. The connection happens before you call the method, but if you pass in a connection resource it will use that resource for the sql statement.</p>
<p>
<div class="data type-php">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<pre class="line_numbers"><span rel="#L1" id="L1">1</span> <span rel="#L2" id="L2">2</span> <span rel="#L3" id="L3">3</span> <span rel="#L4" id="L4">4</span> <span rel="#L5" id="L5">5</span> <span rel="#L6" id="L6">6</span> <span rel="#L7" id="L7">7</span> <span rel="#L8" id="L8">8</span> <span rel="#L9" id="L9">9</span> <span rel="#L10" id="L10">10</span> <span rel="#L11" id="L11">11</span> <span rel="#L12" id="L12">12</span> <span rel="#L13" id="L13">13</span> <span rel="#L14" id="L14">14</span> <span rel="#L15" id="L15">15</span> <span rel="#L16" id="L16">16</span> <span rel="#L17" id="L17">17</span> <span rel="#L18" id="L18">18</span> <span rel="#L19" id="L19">19</span> <span rel="#L20" id="L20">20</span> <span rel="#L21" id="L21">21</span> <span rel="#L22" id="L22">22</span> <span rel="#L23" id="L23">23</span> <span rel="#L24" id="L24">24</span> <span rel="#L25" id="L25">25</span> <span rel="#L26" id="L26">26</span> <span rel="#L27" id="L27">27</span> <span rel="#L28" id="L28">28</span> <span rel="#L29" id="L29">29</span> <span rel="#L30" id="L30">30</span> <span rel="#L31" id="L31">31</span> <span rel="#L32" id="L32">32</span> <span rel="#L33" id="L33">33</span> <span rel="#L34" id="L34">34</span> <span rel="#L35" id="L35">35</span> <span rel="#L36" id="L36">36</span> <span rel="#L37" id="L37">37</span> <span rel="#L38" id="L38">38</span> <span rel="#L39" id="L39">39</span> <span rel="#L40" id="L40">40</span> <span rel="#L41" id="L41">41</span> <span rel="#L42" id="L42">42</span> </pre>
</td>
<td width="100%">
<div class="highlight">
<pre />
<div class="line" id="LC1"><span class="cp">&lt;?php</span></div>
<div class="line" id="LC2"><span class="sd">/**</span></div>
<div class="line" id="LC3"><span class="sd"> * A quick little function to interact with a MySQL database.</span></div>
<div class="line" id="LC4"><span class="sd"> *</span></div>
<div class="line" id="LC5"><span class="sd"> * When working with Limonade-php a full-fledged MySQL wrapper seems like</span></div>
<div class="line" id="LC6"><span class="sd"> * overkill. This method instead accepts any mysql statement and if it works</span></div>
<div class="line" id="LC7"><span class="sd"> * returns either the result or the number of rows affected. If neither worked,</span></div>
<div class="line" id="LC8"><span class="sd"> * then it returns false</span></div>
<div class="line" id="LC9"><span class="sd"> *</span></div>
<div class="line" id="LC10"><span class="sd"> * @param   string      $sql    the sql statement you want to execute</span></div>
<div class="line" id="LC11"><span class="sd"> * @param   resource    $c      mysql connect link identifier, if multi-connect</span></div>
<div class="line" id="LC12"><span class="sd"> *                              otheriwse, you can leave it blank</span></div>
<div class="line" id="LC13"><span class="sd"> * @return  MIXED       array   the result set if the sql statement was a SELECT</span></div>
<div class="line" id="LC14"><span class="sd"> *                      integer if the sql statement was INSERT|UPDATE|DELETE</span></div>
<div class="line" id="LC15"><span class="sd"> *                      bool    if anything went wrong with executing your statement</span></div>
<div class="line" id="LC16"><span class="sd"> *</span></div>
<div class="line" id="LC17"><span class="sd"> *</span></div>
<div class="line" id="LC18"><span class="sd"> * [update|insert|delete]</span></div>
<div class="line" id="LC19"><span class="sd"> * if(db(&#39;update mytable set myrow = 4 where someotherrow = 3&#39;) !== false) {</span></div>
<div class="line" id="LC20"><span class="sd"> *  // worked!</span></div>
<div class="line" id="LC21"><span class="sd"> * }</span></div>
<div class="line" id="LC22"><span class="sd"> *</span></div>
<div class="line" id="LC23"><span class="sd"> * [select]</span></div>
<div class="line" id="LC24"><span class="sd"> * $res = db(&#39;select * from mytable&#39;);</span></div>
<div class="line" id="LC25"><span class="sd"> */</span></div>
<div class="line" id="LC26"><span class="k">function</span> <span class="nf">db</span><span class="p">(</span><span class="nv">$sql</span><span class="p">,</span><span class="nv">$c</span> <span class="o">=</span> <span class="k">null</span><span class="p">)</span> <span class="p">{</span></div>
<div class="line" id="LC27">&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$res</span> <span class="o">=</span> <span class="k">false</span><span class="p">;</span></div>
<div class="line" id="LC28">&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$q</span> <span class="o">=</span> <span class="p">(</span><span class="nv">$c</span> <span class="o">===</span> <span class="k">null</span><span class="p">)</span><span class="o">?@</span><span class="nb">mysql_query</span><span class="p">(</span><span class="nv">$sql</span><span class="p">)</span><span class="o">:@</span><span class="nb">mysql_query</span><span class="p">(</span><span class="nv">$sql</span><span class="p">,</span><span class="nv">$c</span><span class="p">);</span></div>
<div class="line" id="LC29">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span><span class="p">(</span><span class="nv">$q</span><span class="p">)</span> <span class="p">{</span></div>
<div class="line" id="LC30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span><span class="p">(</span><span class="nb">strpos</span><span class="p">(</span><span class="nb">strtolower</span><span class="p">(</span><span class="nv">$sql</span><span class="p">),</span><span class="s1">&#39;select&#39;</span><span class="p">)</span> <span class="o">===</span> <span class="m">0</span><span class="p">)</span> <span class="p">{</span></div>
<div class="line" id="LC31">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$res</span> <span class="o">=</span> <span class="k">array</span><span class="p">();</span></div>
<div class="line" id="LC32">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">while</span><span class="p">(</span><span class="nv">$r</span> <span class="o">=</span> <span class="nb">mysql_fetch_assoc</span><span class="p">(</span><span class="nv">$q</span><span class="p">))</span> <span class="p">{</span></div>
<div class="line" id="LC33">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$res</span><span class="p">[]</span> <span class="o">=</span> <span class="nv">$r</span><span class="p">;</span></div>
<div class="line" id="LC34">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div>
<div class="line" id="LC35">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div>
<div class="line" id="LC36">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span> <span class="p">{</span></div>
<div class="line" id="LC37">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">$res</span> <span class="o">=</span> <span class="p">(</span><span class="nv">$c</span> <span class="o">===</span> <span class="k">null</span><span class="p">)</span><span class="o">?</span><span class="nb">mysql_affected_rows</span><span class="p">()</span><span class="o">:</span><span class="nb">mysql_affected_rows</span><span class="p">(</span><span class="nv">$c</span><span class="p">);</span></div>
<div class="line" id="LC38">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div>
<div class="line" id="LC39">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div>
<div class="line" id="LC40">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nv">$res</span><span class="p">;</span></div>
<div class="line" id="LC41"><span class="p">}</span></div>
<div class="line" id="LC42"><span class="cp">?&gt;</span><span class="x"></span></div>
</pre>
</div>
</td>
</tr>
</table></div>
</p>
<p>Line by line explanation:</p>
<p>1-25: Documentation</p>
<p>26: Function declaration, accepts an sql statement and an optional connection resource.</p>
<p>27: We preset <code>$res</code> to <code>false</code> This is so that we can get rid of a bunch of if-statements 28: If there is no connection resource, just execute the sql statement. If there is, use it. (@ surpresses errors)</p>
<p>29: Check to see if our query worked, if it didn&rsquo;t, we just return <code>res</code> which we preset.</p>
<p>30: Checks to see if we tried to execute a &lsquo;SELECT&rsquo; statement.</p>
<p>31: Change <code>$res</code> into an array. Our results will be a nested array since our statement worked!</p>
<p>32-34: Loop through our results and assign them to <code>$res</code>.</p>
<p>36-38: If the sql statement was NOT a &lsquo;SELECT&rsquo;, return the number of affected rows. If a user passed in a connection resource, use that.</p>
<p>40: return <code>$res</code>, which could either be <code>false</code>, <code>array()</code> or <code>int</code> depending on if the query failed, was a select statement, affected the rows.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/04/mysql-access-for-limonade-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Limonade-php</title>
		<link>http://wheremy.feethavebeen.com/2011/04/introduction-to-limonade-php/</link>
		<comments>http://wheremy.feethavebeen.com/2011/04/introduction-to-limonade-php/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 23:14:15 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/04/introduction-to-limonade-php/</guid>
		<description><![CDATA[Before I begin I just want to note that this document is a work in progress. It requires version 5.3+ of php as it utilizies anonymous functions and it requires the use of limonade-php v0.5.1 Getting started with Limonade-php Your first step is to simply download Limonade-php from GitHub. Make sure you grab the latest [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>Before I begin I just want to note that this document is a work in progress. It requires version 5.3+ of php as it utilizies anonymous functions and it requires the use of limonade-php v0.5.1</p>
<h2>Getting started with Limonade-php</h2>
<p>Your first step is to simply download Limonade-php from <a href="https://github.com/sofadesign/limonade/downloads">GitHub</a>. Make sure you grab the latest version (v0.5.1 at the time of writing this) and extract it. You&rsquo;ll want to go into the lib directory and copy limonade.php and the limonade directory. The directory contains some utilities for limonade-php, but is not necessary. Infact, once your application is complete properly, I&rsquo;d suggest you delete this folder and leave just the limonade.php file behind.</p>
<h2>The standard first project</h2>
<p>When it comes to programming, your first project is always Hello, World. So let&rsquo;s not break that tradition. Create a new directory called &ldquo;hello_world&rdquo; and in it create a directory called &ldquo;lib&rdquo;. You can paste in the file and directory you copied earlier. Now let&rsquo;s create a file called &ldquo;index.php&rdquo; and open it up in an editor of your choice.</p>
<h3>Step 1: Setup</h3>
<p>
<div class="data type-php">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<pre class="line_numbers"><span rel="#L1" id="L1">1</span> <span rel="#L2" id="L2">2</span> <span rel="#L3" id="L3">3</span> <span rel="#L4" id="L4">4</span> <span rel="#L5" id="L5">5</span> </pre>
</td>
<td width="100%">
<div class="highlight">
<pre />
<div class="line" id="LC1"><span class="cp">&lt;?php</span> </div>
<div class="line" id="LC2"></div>
<div class="line" id="LC3"><span class="k">include</span><span class="p">(</span><span class="s1">&#39;lib/limonade.php&#39;</span><span class="p">);</span> </div>
<div class="line" id="LC4"></div>
<div class="line" id="LC5"><span class="cp">?&gt;</span><span class="x"></span></div>
</pre>
</div>
</td>
</tr>
</table></div>
</p>
<p>Simple enough, but if you visit that page in your browser, you&rsquo;ll see that it doesn&rsquo;t really do anything. So we&rsquo;re going to add a bit more code.</p>
<h3>Step 2:</h3>
<p>First we&rsquo;re going to say that whenever a user visits that page using a &ldquo;GET&rdquo; header, we&rsquo;re going to display the text &ldquo;Hello, World!&rdquo;. In a nutshell, GET is one of the four recognized header types for REST implementations. GET is for retrieving information about a resource. For more information about REST, check out <a href="http://tomayko.com/writings/rest-to-my-wife">this post</a> and combine it with <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">this</a>
<div class="data type-php">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<pre class="line_numbers"><span rel="#L1" id="L1">1</span> <span rel="#L2" id="L2">2</span> <span rel="#L3" id="L3">3</span> <span rel="#L4" id="L4">4</span> <span rel="#L5" id="L5">5</span> <span rel="#L6" id="L6">6</span> <span rel="#L7" id="L7">7</span> <span rel="#L8" id="L8">8</span> <span rel="#L9" id="L9">9</span> <span rel="#L10" id="L10">10</span> <span rel="#L11" id="L11">11</span> </pre>
</td>
<td width="100%">
<div class="highlight">
<pre />
<div class="line" id="LC1"><span class="cp">&lt;?php</span> </div>
<div class="line" id="LC2"></div>
<div class="line" id="LC3"><span class="k">include</span><span class="p">(</span><span class="s1">&#39;lib/limonade.php&#39;</span><span class="p">);</span> </div>
<div class="line" id="LC4"></div>
<div class="line" id="LC5"><span class="nx">dispatch_get</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="k">function</span><span class="p">()</span> <span class="p">{</span></div>
<div class="line" id="LC6">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="s2">&quot;Hello, World!&quot;</span><span class="p">;</span></div>
<div class="line" id="LC7"><span class="p">});</span></div>
<div class="line" id="LC8"></div>
<div class="line" id="LC9"><span class="nx">run</span><span class="p">();</span></div>
<div class="line" id="LC10"></div>
<div class="line" id="LC11"><span class="cp">?&gt;</span><span class="x"></span></div>
</pre>
</div>
</td>
</tr>
</table></div>
</p>
<h3>Did you just pass that function a function as an argument?</h3>
<p>Why yes. Yes I did. It&rsquo;s a new feature of PHP 5.3 that allows for anonymous functions. You&rsquo;ll see the same thing happen in JavaScript all the time, so if you work with that, you should find it familiar. Essentially an anonymous function is just a function without a name. There is no way to call it without assigning it to a variable. So, by passing it to <code>dispatch_get</code> as an argument, it is assigned to a variable within limonade-php.</p>
<p>Finally, on line 9 we add the <code>run();</code> command. This tells limonade-php to start.</p>
<p>Now if you visit index.php in your browser, you&rsquo;ll see the text &ldquo;Hello, World!&rdquo;</p>
<h3>Step 3: Profit</h3>
<p>Now that you&rsquo;ve gotten a taste of how easy it is to build something using limonade-php let me just say, that it really is that easy to build just about anything. Because of limonade-php&rsquo;s adherence to RESTful principles it becomes ridiculously easy to build an API or a dynamic website, or just about anything in between. It even integrates very well with other libraries and components. It allows for rapid prototyping (I created <a href="http://lemontrac.xangelo.ca">this</a> ([source])(<a href="https://github.com/AngeloR/Lemontrac)">https://github.com/AngeloR/Lemontrac)</a> in only a few hours &ndash; including the time it took to learn limonade-php) and it has become an important part of my php toolbox.</p>
<h2>Now what?</h2>
<p>Well, it&rsquo;s all well and good to display &ldquo;Hello, World!&rdquo; but it&rsquo;s kind of useless to everyone who wants to build something useful. It hardly scratches the surface of what is possible with limonade-php. So, to properly show you what you can do with it, let&rsquo;s build a very simple todo application. But with a twist. First we&rsquo;re going to build a todo application API. Then we&rsquo;re going to build a website that consumes this API using JavaScript and jQuery.</p>
<p>Stay tuned for part 2!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/04/introduction-to-limonade-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lemontrac updates</title>
		<link>http://wheremy.feethavebeen.com/2011/04/lemontrac-updates/</link>
		<comments>http://wheremy.feethavebeen.com/2011/04/lemontrac-updates/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 05:40:33 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/04/lemontrac-updates/</guid>
		<description><![CDATA[Well it&#8217;s only been a few days since I released Lemontrac to the public but I&#8217;ve already got a slew of updates that I am planning for it. Roles and ACL The biggest of these updates is a complete overhaul of the user management system. The plan is to include role-based access control lists which [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>Well it&rsquo;s only been a few days since I released Lemontrac to the public but I&rsquo;ve already got a slew of updates that I am planning for it.</p>
<h2>Roles and ACL</h2>
<p>The biggest of these updates is a complete overhaul of the user management system. The plan is to include role-based access control lists which will work pretty well I think. I thought about it and instead of shipping with pre-defined roles, the only role allowed will be an administrator role which will be able to do whatever they want. It&rsquo;s up to them to create the rest of the roles and assign privileges to other users as they see fit. The more flexible it is, the better.</p>
<h2>Sorting and Filters</h2>
<p>Any data manipulation application should come with some excellent sorting and filters. The basic (alpha/last updated/created time/priority) will be implemented, but I am open to any other sorting ideas that people may have. Being able to easily get to all of these is a must, and so there will be some slight UI changes coming up.</p>
<h2>Bug dependencies ##</h2>
<p>Basically, some bugs appear because of a bunch of other bugs. A bug must be able to be marked as &ldquo;dependent&rdquo; on another bug. If that&rsquo;s the case, that bug can&rsquo;t be closed unless all of its dependencies are resolved.</p>
<h2>Merging Bugs</h2>
<p>Users are probably going to experience the same bugs. Being able to merge bugs (and notify the bug creator of possible duplicates) is a necessity to preserve the integrity of the application.</p>
<h2>Email Notifications ##</h2>
<p>This is something I completely overlooked until it was pointed out to me, but the ability to &ldquo;subscribe&rdquo; to a bug or project and be notified of it through future emails is a must.</p>
<p>You can count these as the features that absolutely have to be in place before Lemontrac can move to version 0.2 assuming that everything with work and switch to another OS don&rsquo;t go terribly, you can expect April to feature version 0.2 and also a brief introduction into working with <a href="http://limonade-php.net">Limonade-php</a>. I&rsquo;d urge you to check out the website that is currently in place as it does have some great <a href="http://www.limonade-php.net/examples.htm">tutorials and examples</a>, but incase you&rsquo;re waiting for one, it is in the works.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/04/lemontrac-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lemontrac bug tracker</title>
		<link>http://wheremy.feethavebeen.com/2011/03/lemontrac-bug-tracker/</link>
		<comments>http://wheremy.feethavebeen.com/2011/03/lemontrac-bug-tracker/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 17:46:57 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/03/lemontrac-bug-tracker/</guid>
		<description><![CDATA[Every year I try and make it my goal to really learn at least one web framework. I don&#8217;t need to become a master at working with it, but I need to know it enough to consider it one of the &#8220;tools&#8221; available to me. This year I started trying to work with CodeIgniter, but [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>Every year I try and make it my goal to really learn at least one web framework. I don&rsquo;t need to become a master at working with it, but I need to know it enough to consider it one of the &ldquo;tools&rdquo; available to me.</p>
<p>This year I started trying to work with CodeIgniter, but then got sidetracked by various personal projects. That and the fact that most frameworks just feel too bloated to me. They keep trying to add on all these &ldquo;features&rdquo; and as nice as they are, they shouldn&rsquo;t really be part of the CORE framework. They&rsquo;re modules to enhance it. Not to mention that most frameworks have such a weird learning curve that it takes a long time before you&rsquo;re comfortable with it.</p>
<p>That&rsquo;s why I was pleasantly surprised by a new PHP framework I stumbled across called (Limonade-php)[<a href="http://limonade-php.net">http://limonade-php.net</a>]. Limonade-php is a &ldquo;micro&rdquo; framework. It&rsquo;s more or less one file with a few resources, a LOT smaller than any other framework I&rsquo;ve seen. But it&rsquo;s so ridiculously amazing that I knew I just had to work with it. Limonade allows you to build RESTful applications pretty much instantly. There&rsquo;s almost ZERO learning curve and things just make sense.</p>
<p>For example, adding a new page is as simple as <code>dispatch_get('/page/route','func_name');</code> But can be made complex by utilizing some handy features to allow for query parameters. <code>dispatch_get('/page/:id/some/:resource','myfunc');</code></p>
<p>Of course being almost 100% RESTful compliant, you have access to methods such as dispatch_get, dispatch_post, dispatch_put, dispatch_delete all of can be mapped to the same path allowing you to REALLY build RESTful applications.</p>
<p>I was so impressed with Limonade-php that about an hour after playing around with it I started writing a tool that I needed for my daily work. It was a very simple bug-tracker allowing for multiple projects, bugs and users. It allows you to color-code projects, which immediately translate into color-coded bugs. And it was all done in a single file that is under 550 lines of code (not counting primarily HTML views and CSS).</p>
<p>So check out (limonade-php)[<a href="http://limonade-php.net">http://limonade-php.net</a>] and if you like, take a look at (Lemontrac)[<a href="https://github.com/AngeloR/Lemontrac">https://github.com/AngeloR/Lemontrac</a>].</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/03/lemontrac-bug-tracker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why writing your database first is wrong</title>
		<link>http://wheremy.feethavebeen.com/2011/03/why-writing-your-database-first-is-wrong/</link>
		<comments>http://wheremy.feethavebeen.com/2011/03/why-writing-your-database-first-is-wrong/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 14:42:31 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/2011/03/why-writing-your-database-first-is-wrong/</guid>
		<description><![CDATA[After you&#8217;ve been programming for a while, one of the first things that you start doing is working out the database. You decide how your data should be stored, and you think about the optimal ways you can do this. You think about what technology would best support your idea, and then you get to [...]]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>After you&#8217;ve been programming for a while, one of the first things  that you start doing is working out the database. You decide how your  data should be stored, and you think about the optimal ways you can do  this. You think about what technology would best support your idea, and  then you get to work mapping out the back-end. And when that&#8217;s all done  you start writing your classes. You write the little pieces first, like  what the user object should look like. Then you build the classes and  objects that would utilize the user object, creating new objects as  necessary. And finally, when you&#8217;re all done, you start designing the  front-facing portion of your application. Whether it&#8217;s for the web or  for the desktop, as a programmer this is generally the last step.</p>
<p>And you&#8217;re doing it all wrong.</p>
<p>Designing an application from the STORAGE point of view is all wrong.  Imagine designing a car based on the garage that you were going to put  it in. Yes your car will always fit in the garage, but you&#8217;re going to  run into problems. You&#8217;re probably going to have to make some  concessions on the size of the car. But when you&#8217;re programming, you get  to design the garage too. So why not build the car to be the best damn  car ever, and then build the garage around that? That way you never need  to compromise and you can be damn sure that the car is always going to  fit.</p>
<p>Now, lets apply this metaphor to programming.</p>
<p>The first step I take when building an application is to decide its  purpose. Is the application meant for non-technical users? Is it meant  for children or adults? Is it going to be maintained by me or other  developers? What&#8217;s the life expectancy of this application? Are there  any third party applications that need to talk to it, or vice versa?  These questions help us define how we should be building the  application. It imposes some features and necessities while still  allowing us a lot of freedom.</p>
<p>To me, data is the most restrictive part of our application. It&#8217;s the  only part that we have no say in. The data will always be the data. We  can&#8217;t adjust it to suit our needs. As programmers we spend so much time  living with things that have no real substance. The code we right can  just as easily be re-written a different way. The database we design  could have been designed a completely different way. But yet we insist  on building our application on things that can shift at will. The Data  is concrete. The data is ALWAYS the data and it can never look like  anything else. It can never change shape.</p>
<p>So we should start with The Data. We should say &#8220;what is the best way  to display this data&#8221;. Designers think this way (the good ones do at  least) and it&#8217;s time for programmers to think this way too. I&#8217;m not  talking about how The Data should look to users, but how The Data should  function in our application. Too often we end up having complicated  queries simply because we forgot that we need to use The Data in a  certain way.</p>
<p>We should model how the data needs to be displayed. Once we have that  mapped out our Data will start to fall into some shapes. We simply  coral those semi-ambiguous shapes into something concrete and now we  have a solid database design that really does model our Data. And  because we built our database on REAL Data, we know that we will always  have a place for The Data and that things are as simplified as possible.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2011/03/why-writing-your-database-first-is-wrong/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

