<?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>nick has a blog! &#187; programming</title>
	<atom:link href="http://www.nickpeters.net/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nickpeters.net</link>
	<description></description>
	<lastBuildDate>Thu, 16 Dec 2010 07:07:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>PHP Frameworks</title>
		<link>http://www.nickpeters.net/2009/02/20/php-frameworks/</link>
		<comments>http://www.nickpeters.net/2009/02/20/php-frameworks/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 13:19:09 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/?p=123</guid>
		<description><![CDATA[I&#8217;ve been coding in PHP off and on for years now.  Each project I&#8217;ve done thus far has always been by hand.  Doing the architecture of your site by hand is the easiest way to introduce bugs and end up with sloppy code.   For the first time I&#8217;ve started a project where I used a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been coding in PHP off and on for years now.  Each project I&#8217;ve done thus far has always been by hand.  Doing the architecture of your site by hand is the easiest way to introduce bugs and end up with sloppy code.   For the first time I&#8217;ve started a project where I used a framework in PHP.  My framework? <a href="http://www.codeigniter.com" target="_blank">Codeigniter</a>.  I like it&#8217;s simplicity, MFC design and how it&#8217;s not like Rails.  I thought Rails was a bit too complicated and involved hacking the internal code way too much to get anything done, but that&#8217;s a whole other rant.</p>
<p>Anyway, the project I&#8217;m working on?  Just a twitter clone.  Why?  For the sake of learning, that&#8217;s all.  It&#8217;s actually for a project in school.  The idea is to implement this idea in something that I&#8217;m already familiar with (PHP) and then implement it again in another language I&#8217;m not familiar with at all.  After I&#8217;m doing with the first part I want to implement it in Python using the Django framework.  Python has always been one of those languages I&#8217;ve been meaning to learn.  In fact it seems I try to learn it every summer, but I just don&#8217;t seem to have the dedication to sit in doors learning it.</p>
<p>Regardless, I hope to use this knowledge in my professional life.  The last PHP project I worked on was stressful just because of some of the design decisisons I made (Doing a half-assed MVC implementation&#8230;didn&#8217;t do the best job of dividing up the view and controller).  However, I&#8217;ve learned from those mistakes and I might be taking up a new project at work where I&#8217;ll probably be using this framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2009/02/20/php-frameworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Report back from SHDH22</title>
		<link>http://www.nickpeters.net/2008/01/09/report-back-from-shdh22/</link>
		<comments>http://www.nickpeters.net/2008/01/09/report-back-from-shdh22/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 06:57:23 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[shdh]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/2008/01/09/report-back-from-shdh22/</guid>
		<description><![CDATA[Since moving to Camarillo for college in August, I missed both SHDH20 and SHDH21 due to the increased distance between the Bay Area and where I live. However, since I&#8217;m back in San Luis Obispo for winter break, I was able to attend SHDH22. Instead of spending my time socializing and learning, I actually came [...]]]></description>
			<content:encoded><![CDATA[<p>Since moving to Camarillo for college in August, I missed both SHDH20 and SHDH21 due to the increased distance between the Bay Area and where I live.  However, since I&#8217;m back in San Luis Obispo for winter break, I was able to attend <a href="http://superhappydevhouse.org/SuperHappyDevHouse22" target="_blank">SHDH22</a>.  Instead of spending my time socializing and learning, I actually came with an agenda of things to do.</p>
<p>A few months back I registered the domain <a href="http://www.picturesofpeopletakingpictures.net">http://picturesofpeopletakingpictures.net</a> because my friends thought it would be funny.  (Alcohol was also involved and it seemed like a good idea at the time).  I still don&#8217;t know what I want to do with it, but I put wrote up a small script using Rails that queries flickr and displays a random picture tagged &#8220;<a href="http://flickr.com/photos/tags/picturesofpeopletakingpictures/" target="_blank">picturesofpeopletakingpictures</a>.&#8221;  It turned out to actually be a huge pain in the ass because the <a href="http://www.redgreenblu.com/flickr/doc/files/flickr_rb.html" target="_blank">flickr gem</a> I used had their own API key built in.  Once I hacked together a fix for using my own, I got it working pretty quickly.  When I uploaded it to my web server, nothing worked.  Duh I forgot to freeze the flickr gem!  Nope that wasn&#8217;t the problem.  Apparently you have to use a folder structure like ~/flickr-ver_num/lib/flickr.rb.  The library had ~/flickr-ver_num/flickr.rb.  After struggling with that for at least 45 minutes, I had it up and running.  Anyways, if anyone has suggestions of something better, leave a comment.</p>
<p>I started on a project that could turn into a DevHouse competition.  More on this later if it actually happens.</p>
<p>Lastly, I started looking at the Android Java Framework by Google for Cell Phones.  I mean why not?  Google has some pretty good <a href="http://code.google.com/android/index.html" target="_blank">documentation</a> and <a href="http://code.google.com/android/intro/tutorial-ex1.html" target="_blank">tutorials</a> that I was able to follow and I end up writing a<a href="http://code.google.com/android/intro/hello-android.html" target="_blank"> Hello World program</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2008/01/09/report-back-from-shdh22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Iterators</title>
		<link>http://www.nickpeters.net/2008/01/09/ruby-iterators/</link>
		<comments>http://www.nickpeters.net/2008/01/09/ruby-iterators/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 05:58:09 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/2008/01/09/ruby-iterators/</guid>
		<description><![CDATA[I&#8217;m sure like most people, I started learning Rails by reading about&#8230;.Rails. It would seem logical to learn Rails by reading about Rails, right? I think a better way of learning about Rails is to first master Ruby and THEN learn the Rails framework for Ruby. This approach has helped me debug some of those [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure like most people, I started learning Rails by reading about&#8230;.Rails.  It would seem logical to learn Rails by reading about Rails, right?  I think a better way of learning about Rails is to first master Ruby and THEN learn the Rails framework for Ruby.  This approach has helped me debug some of those error messages that seemed so cryptic at first.  Recently I picked up &#8220;<a href="http://www.amazon.com/dp/0974514055?tag=letmeputitthi-20&amp;camp=14573&amp;creative=327641&amp;linkCode=as1&amp;creativeASIN=0974514055&amp;adid=0MVBB0HNKYQ6M504ZHEB&amp;" target="_blank">Programming Ruby</a>&#8221; by <a href="http://www.pragprog.com/" target="_blank">The Pragmatic Programmers</a>.  Reading it I found out that some of methods that I thought  were part of the Rails framework actually belong to Ruby.</p>
<p>One of the things I wanted to focus on are the differences between three different types of iterators in Ruby that are commonly used in Rails: find, each, and collect.  Let&#8217;s first start by asking what is an iterator?  An iterator goes through each element in an array or hash table and let&#8217;s us perform an action using the individual element.  Let&#8217;s check out the differences between these iterators.</p>
<p><span style="font-weight: bold" class="Apple-style-span">find</span></p>
<p>Find is a bit misleading.  The classical definition of a find method would be to return the index of the element (or perhaps the entire element itself) that matches a string.  The find iterator method in ruby will instead compare each element using some comparison operator (&lt;, &gt;, ==, etc.) and based off of the boolean result (true or false), it will return the first matching value.  For example say we have an array called <em>a</em>:</p>
<p><code>a = [ 1, 2, 3, 4, 5 ]</code></p>
<p>Using this array we want to find the first even value.  Our code would look something like this:</p>
<p><code>a.find { |n| n % 2 == 0 }</code></p>
<p>Since 2 is the first even number, that would be the result.</p>
<p><strong>each</strong></p>
<p>Each is the simplest iterator method of the three.  It simply traverses all elements in the array and returns each one individually.  So if we want to print all lements of the array a, it would look something like this:</p>
<p><code>a.each { |n| print n }</code></p>
<p>The result would look like <code>12345</code></p>
<p><span style="font-weight: bold" class="Apple-style-span">collect</span></p>
<p>Collect, or also known as map, is pretty much the same as each, except that collect returns an array of values.  For this example, we&#8217;ll increment each element in array a and save the new element in b.</p>
<p><code>b = a.collect { |n| n + 1 }</code></p>
<p>This returns the array <code>[2, 3, 4, 5, 6]</code></p>
<p>I hope this gives some insight on how Rails uses these methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2008/01/09/ruby-iterators/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>In need of WD-40</title>
		<link>http://www.nickpeters.net/2007/02/25/in-need-of-wd-40/</link>
		<comments>http://www.nickpeters.net/2007/02/25/in-need-of-wd-40/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 05:17:47 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/2007/02/25/in-need-of-wd-40/</guid>
		<description><![CDATA[I had some free time today, so I decided to start on a proof-of-concept for my OpenID + Microformats idea. Holy $^#@ am I rusty with PHP. It&#8217;s now been about a year since I last done any sort of programming with it and I find myself having to reference the books I was reading [...]]]></description>
			<content:encoded><![CDATA[<p>I had some free time today, so I decided to start on a proof-of-concept for my <a href="http://www.nickpeters.net/2007/02/07/openid-uf-epiphany/" title="nickpeters.net: openId and uF epiphany" target="_blank">OpenID + Microformats idea</a>.  Holy $^#@ am I rusty with PHP.  It&#8217;s now been about a year since I last done any sort of programming with it and I find myself having to reference the books I was reading when I first began learning PHP 2 years ago.  I really need to start fitting time into my schedule for working on programming projects because I&#8217;m finding myself having to look up information that has been lost over time.</p>
<p>On another note, I <strong>REALLY</strong> need to sit down and learn regular expressions.  I&#8217;m tired of having to google search this sort of thing.  I heard O&#8217;Reilly&#8217;s book on Regular Expressions is a good resource; perhaps I should pick it up.  I&#8217;m going to have to learn them anyways, the sooner the better I suppose.</p>
<p>Afterthought: Perhaps instead of re-learning everything, I should just learn the <a href="http://pear.php.net" title="PHP Extension and Application Repository" target="_blank">PEAR library</a> instead and fill in the gaps along the way.  Anyways, I guess I know what books I&#8217;ll be ordering soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2007/02/25/in-need-of-wd-40/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>OpenID + uF epiphany</title>
		<link>http://www.nickpeters.net/2007/02/07/openid-uf-epiphany/</link>
		<comments>http://www.nickpeters.net/2007/02/07/openid-uf-epiphany/#comments</comments>
		<pubDate>Thu, 08 Feb 2007 04:31:08 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[microformats]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/2007/02/07/openid-uf-epiphany/</guid>
		<description><![CDATA[UPDATE: After an email discussion with Adam Darowski, I revised this post to make it a bit more user-friendly. I think I might be going about this idea of consolidating your online identity with the OpenID simple registration extension and microformats wrong. I found this microformat library for PHP; It works by by retrieving the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE</strong>: After an email discussion with <a href="http://www.darowski.com/tracesofinspiration/">Adam Darowski</a>, I revised this post to make it a bit more user-friendly. </p>
<p>I think I might be going about this <a href="http://www.nickpeters.net/2007/02/05/shdh15-and-openid/" title="SHDH15 and OpenID">idea of consolidating your online identity</a> with the <a href="http://openid.net/specs/openid-simple-registration-extension-1_0.html" target="_blank" title="OpenID Simple Registration Extension">OpenID simple registration extension</a> and microformats wrong.  I found <a href="http://allinthehead.com/hkit" target="_blank" title="hKit for PHP5">this microformat library</a> for PHP; It works by by retrieving the microformatted data (in this case hCard) by simply feeding it a URL and it then saves the hCard data for future manipulation.  I&#8217;m starting to realize this same practice may be another way to consolidate your online identity with OpenID.  </p>
<p>Before we get ahead of ourselves, let&#8217;s see how the applicable portion of the OpenID protocol works.  The first step is to supply our OpenID URL to the consumer site and hit &#8220;submit.&#8221;  For example, I would enter &#8220;nickpeters.net&#8221; as my OpenID URL to the consumer site <a href="http://ma.gnolia.com">ma.gnolia</a>.  What is a consumer site exactly?  According to the <a href="http://openid.net/specs/openid-authentication-1_1.html#anchor2">OpenID Specification</a>, the consumer is:</p>
<blockquote><p>A web service that wants proof that the End User owns the Claimed Identifier.</p></blockquote>
<p>Pretty much it means a site that wants to find out whether or not we are who we say we are by first asking for our OpenID URL.</p>
<p>After we hit the &#8220;Submit&#8221; button, an internal script on the consumer site will redirect itself to the given URL and look for two link tags in the head of the given HTML document.  For the sake of simplicity, we&#8217;re only going to discuss the one of them: rel=&#8221;openid.server.&#8221;  The href value of this link tag is going to be the script that actually authenticates you by asking you for the username and password you use on all OpenID-enabled sites.  This practice is useful because you can offload the authentication process to a site like Vox or livejournal instead of setting up a server on your own server.  This means I can enter the URL for the livejournal authentication script or a script hosted on my site.  It also means your username and password isn&#8217;t sent to the consumer site and is only sent to the specified script.</p>
<p>That should be enough information for now, so let&#8217;s see how hCards can fit into this.  Let&#8217;s say we log in to our OpenID consumer site (<a href="http://ma.gnolia.com" target="_blank" title="Ma.gnolia: Social Bookmarking">ma.gnolia</a>) and go through the login process as normal.  While the consumer site looks for the and OpenID.server URL in the head of our page, it would also look for some sort of clue as to the location of your hCard information.  Perhaps this &#8220;clue&#8221; could follow in the steps of the existing OpenID protocol and also be a link tag, such as rel=&#8221;hcard&#8221; in the head of the document.  From there, the consumer-site script can retrieve the hCard location by looking at the href value, properly redirect itself, and retrieve your information (Perhaps even using the hKit library).  </p>
<p>The pros of this is that you can add as much or as little information as you want about yourself in your hCard.  The simple registration data fields are very limited and there maybe some information in there that you don&#8217;t want to be shared (such as email address).</p>
<p>The cons is that it requires more administrative overhead.  You&#8217;ll have to edit the header information of your site.  You may not even be able to do this on all OpenID identifiers (such as ones on livejournal) because you don&#8217;t have permission to edit the header information.  </p>
<p>Right now there are discussions going on in the microformat community about authoritative hCards that could possibly guide this idea in the right direction.  I will continue to think about this and would appreciate any ideas from others.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2007/02/07/openid-uf-epiphany/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dev House 13</title>
		<link>http://www.nickpeters.net/2006/11/08/dev-house-13/</link>
		<comments>http://www.nickpeters.net/2006/11/08/dev-house-13/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 01:44:26 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[fun]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[shdh]]></category>

		<guid isPermaLink="false">http://www.letmeputitthisway.com/?p=14</guid>
		<description><![CDATA[This past weekend I experienced my first Super Happy Dev-House convention/get together. I must say that never before have I met so many people that put me to shame. With this said however, I have learned more about online technologies from this than I have from any online tutorial or book. One of the biggest [...]]]></description>
			<content:encoded><![CDATA[<p>This past weekend I experienced my first <a target="_blank" title="Super Happy Dev-House" href="http://superhappydevhouse.org/">Super Happy Dev-House</a> convention/get together.  I must say that never before have I met so many people that put me to shame.  With this said however, I have learned more about online technologies from this than I have from any online tutorial or  book.  One of the biggest eye-openers for me was that I felt I was investing too much of my time learning <a target="_blank" title="PHP" href="http://www.php.net/">PHP</a> when instead I should be concentrating on learning Javascript-based technologies (most notably <a title="AJAX Wikipedia Entry" href="http://en.wikipedia.org/wiki/Ajax_(programming)">AJAX</a>) and maybe <a target="_blank" title="Ruby Language" href="http://www.ruby-lang.org/en/">Ruby</a>/<a target="_blank" title="Ruby on Rails" href="http://www.rubyonrails.org/">Ruby on Rails</a>.  Being around so many developers at once opened my eyes as to what is possible and how to get there.</p>
<p>With everyone working on their projects, it gave me the opportunity to begin filling in the gaps of my knowledge.  I began researching new (to me at least) concepts, ideas, etc.  Some examples are <a target="_blank" title="Microformats" href="http://microformats.org/">microformats</a>, <a target="_blank" title="JQuery" href="http://jquery.com/">JQuery</a>, and <a target="_blank" title="JSON" href="http://json.org/">JSON</a>.  On top of that, I began going through AJAX tutorials, something I should&#8217;ve started a long time ago.</p>
<p>One of the unique things about being around this many people with similar interests are the conversations had throughout the night.  Most of my conversations focused on web technologies: something I never have the opportunity to talk about at home.  Topics included Ruby on Rails, the manageability of PHP in large projects, peoples&#8217; current projects (including personal and business related).  Most of all, I was able to network with people in the industry.  There were a variety of people including CTOs, bloggers, and even someone from google.  Hollywood has celebrities, but the bay area has eCelebrities.</p>
<p>This event has inspired me to form this sort of community back at home, but will it really be worth it?   If I plan on moving in January (oh please make it happen), my efforts will be wasted in San Luis Obispo.  I feel I should instead wait till I move to <a target="_blank" title="CSU Channel Islands" href="http://www.csuci.edu/">Camarillo</a> for this sort of thing.</p>
<p>Anyways, can&#8217;t wait for Dev House 14!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2006/11/08/dev-house-13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

