<?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>Nonsensical Insense &#187; Web Development</title>
	<atom:link href="http://jeffrupert.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://jeffrupert.com</link>
	<description>... Yes, I know it&#039;s spelled &#34;incense.&#34;</description>
	<lastBuildDate>Thu, 25 Feb 2010 05:06:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>On Another, Unrelated Note&#8230;</title>
		<link>http://jeffrupert.com/2009/11/11/on-another-unrelated-note/</link>
		<comments>http://jeffrupert.com/2009/11/11/on-another-unrelated-note/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 17:53:03 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://jeffrupert.com/?p=137</guid>
		<description><![CDATA[<p>Go check out http://www.wtsr.org/! I just finished writing a little script to give them the "On Now" block in the right column. It's a simple PHP script that parses a .csv file and does a few checks to determine day and current time. I tried <a href="http://jeffrupert.com/2009/11/11/on-another-unrelated-note/">Read more</a></p>]]></description>
			<content:encoded><![CDATA[<p>Go check out <a title="WTSR" href="http://wtsr.org/" target="_blank">http://www.wtsr.org/</a>! I just finished writing a little script to give them the &#8220;On Now&#8221; block in the right column. It&#8217;s a simple PHP script that parses a .csv file and does a few checks to determine day and current time.</p>
<p>I tried using <code>file()</code>, but it didn&#8217;t like the file, for whatever reason. Probably because it was using \r instead of \n for newlines. Oh well. So, I had to do a character-by-character parse (until I realized I could use a regular expression&#8230;) to get it implemented. Here are the two loops I ran. I&#8217;m sure it could be written more efficiently (like, checking during the first loop for everything, instead of just Day). How would everyone else write this?<br />
<!-- pre style="border:1px solid #222222; background:#DDDDDD; margin: 1em 2em; padding:1em;" --><br />
<script type="syntaxhighlighter" class="brush: php"><![CDATA[
$shows = array( );
$showInfo = array( );
$nextShowInfo = array( );
$today = date( "l" );
$time = date( "g:i A" );
$todayshows = array( );
$linebuf = "";
if( $file )
{
    while( !feof( $file ) )
    {
        $char = fgetc( $file );
        if( "\r" == $char )
        {
            $showInfo = explode( ',', $linebuf );
            $shows[ ] = $showInfo;
            if( $today == $showInfo[ 0 ] )
            {
                $todayshows[ ] = array( $showInfo[ 1 ], $showInfo[ 2 ] );
            }
            $linebuf = "";
            continue;
        }
        $linebuf .= "$char";
    }
}
for( $i = 0; $i < count( $todayshows ); $i++ )
{
    if( count($todayshows) == $i + 1 )
    {
        $showInfo = $todayshows[ $i ];
        $nextShowInfo = array("12:00 AM");
        break;
    }
    $currTime = strtotime( $time );
    $showTime = strtotime( $todayshows[ $i ][ 0 ] );
    $nextShowTime = strtotime( $todayshows[ $i + 1 ][ 0 ] );
    if( $currTime >= $showTime &#038;&#038; $currTime < $nextShowTime )
    {
        $showInfo = $todayshows[ $i ];
        $nextShowInfo = $todayshows[ $i + 1 ];
        break;
    }
}</script></p>
]]></content:encoded>
			<wfw:commentRss>http://jeffrupert.com/2009/11/11/on-another-unrelated-note/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails: First Use</title>
		<link>http://jeffrupert.com/2009/08/24/ruby-on-rails-first-use/</link>
		<comments>http://jeffrupert.com/2009/08/24/ruby-on-rails-first-use/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 05:14:42 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[cake]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://jeffrupert.com/?p=108</guid>
		<description><![CDATA[<p>So, recently I just started a project with Ruby on Rails. I can't give details on the project JUST yet, but they'll be disclosed as soon as I can. For your information, however, you could relate this project to Craigslist. Now, I've been designing <a href="http://jeffrupert.com/2009/08/24/ruby-on-rails-first-use/">Read more</a></p>]]></description>
			<content:encoded><![CDATA[<p>So, recently I just started a project with <a href="http://www.rubyonrails.org">Ruby on Rails</a>. I can&#8217;t give details on the project JUST yet, but they&#8217;ll be disclosed as soon as I can. For your information, however, you could relate this project to <a href="http://craigslist.org/">Craigslist</a>. Now, I&#8217;ve been designing and developing applications in <a href="http://php.net/">PHP</a> (sometimes using <a href="http://smarty.com">Smarty</a>, others using <a href="http://www.cakephp.org/">CakePHP</a>) for a while now, so I originally blew RoR off as &#8220;the easy way out&#8221; of actually having to develop applications (for the record, I thought the same for Cake and other MVC systems).</p>
<p>Pre-using of Ruby on Rails: (personal opinion of skills)</p>
<ul>
<li>PHP Development: Expert</li>
<li>CakePHP Development: Beginner/Intermediate</li>
<li>Python Development: Beginner</li>
<li>Ruby Development: Absolutely none. All I did was watch the <a href="http://media.rubyonrails.org/video/rails_blog_2.mov">Blog in 15-Minutes Screencast</a> (Quicktime video)</li>
</ul>
<p>The first applications I ever wrote in PHP used Smarty. I have since written applications that do not use Smarty as a templating language (kind of redundant with PHP anyways, I suppose) and I have also worked with CakePHP somewhat. Not enough to consider myself any better than fooling around, but enough to say that I would be comfortable designing and making a development Cake application.</p>
<p>So, what&#8217;s the first thing I can say about Ruby on Rails? It seriously is magic. Continue on to read my compare/contrast of RoR and Cake&#8230;</p>
<p>I decided to compare Cake and RoR by attempting to build the same application in each language. Both were built with separate databases, etc. Both are hosted on my personal webspace, hosted by <a href="http://www.hostgator.com/">HostGator</a>. I used Ruby version 1.8.7, Ruby on Rails version 2.3.3, and CakePHP version 1.2.4.8284, all were in development mode. For this comparison, I will use the following pieces: Command Line apps (Script/&#8230;, Rake and Cake Bake), Model Associations, and basic MVC conventions.</p>
<ol>
<li><strong>Command Line Applications</strong></li>
</ol>
<p>A Rails application comes with a very sophisticated set of scripts that can create files, run your server, and even create a real-time console for your particular application. I used <code>script/generate</code> to do most of my basic model/controller/view creations, which allowed me to have DB tables created on the fly. <code>script/generate</code> is pretty simple to use. It has actions to create models, controllers, views (with controllers), a scaffolded object, database migrations, and can even be augmented by different RubyGems or plugins. I used scaffolding to quickly generate the basic concepts of my pages, which created a model, a controller, views for <a title="Create, read, update and delete - Wikipedia, the free encyclopedia" href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a>, and the related migration file. The aforementioned screencast made it very easy to understand how all of this worked. It may not have helped me really understand the code (scouring of <a href="http://guides.rubyonrails.org/">RailsGuides</a>, <a href="http://stackoverflow.com/">Stack Overflow</a>, and Google searches, however, did help) but I felt at home when trying to use the <code>script/generate</code> command.</p>
<p><code>script/generate</code>, however, is not the only option I used. <code>script/server</code> is very simple. With this running, I was able to hit port 3000 on my machine and view the application as it stood in real time. If something didn&#8217;t work exactly the way I wanted it to, I could attempt to fix it and it updated in real-time (apparently Rails in production doesn&#8217;t work the same way? Or perhaps I read something wrong somewhere.) Also, <code>script/console</code> allowed me to play around with various pieces of code so I could see if what I thought should work, actually worked. All in all, I was very pleased with the options given to me.</p>
<p>Rake is kind of like the UNIX make command. A Rails application creates a Rakefile in the main app directory, and can be called from any child folder in the structure without having to directly reference it. It has no hard coded functions, but pulls the tasks from a separate list of .rake files. I&#8217;m not entirely sure how it all works (I have yet to delve there) but it is pretty fancy. My only usage of <code>rake</code> involved the <code>rake db:migrate</code> and <code>rake routes</code> functions, so rake is probably much more functional than I know.</p>
<p>Cake, on the other hand, only has one option for command line applications. Keeping with the Cake theme, they named the app <code>cake bake</code>. In Cake, you &#8220;bake&#8221; an application. Rather corny, but it has me trying to figure out why RoR has rake. Anyway, <code>cake bake</code> is very different from the <code>script/...</code> functions in RoR. <code>cake bake</code> seems to be almost like a standalone application in and of itself. Thankfully, <code>cake bake</code> has most of the functionality of the <code>script/...</code> functions. Cake&#8217;s method of creating models, controllers, views, etc, works slightly differently than <code>script/...</code>. With Cake, you create all of the database tables, etc. yourself. When you create models, Cake will auto attempt to interpret any associations you may have with your project. So, if you put a user_id column inside of a table, Cake will ask you if that object &#8220;belongs to User.&#8221; If you are building User, and some other table has a user_id column in it, Cake will ask you if &#8220;User has many&#8221; or &#8220;User has one&#8221; of the object you&#8217;re creating.</p>
<p>Well, that&#8217;s it for this round. I&#8217;ll post the link for part two when I finish writing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffrupert.com/2009/08/24/ruby-on-rails-first-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://media.rubyonrails.org/video/rails_blog_2.mov" length="49405864" type="video/quicktime" />
		</item>
	</channel>
</rss>

