<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="weebly" -->
<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/" >

<channel><title><![CDATA[Witty.ca - Graham's Professional Archives - My Blog]]></title><link><![CDATA[http://www.witty.ca/my-blog.html]]></link><description><![CDATA[My Blog]]></description><pubDate>Mon, 07 May 2012 14:44:54 -0400</pubDate><generator>Weebly</generator><item><title><![CDATA[Broadening Focus]]></title><link><![CDATA[http://www.witty.ca/2/post/2012/01/broadening-focus.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2012/01/broadening-focus.html#comments]]></comments><pubDate>Fri, 06 Jan 2012 10:22:38 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2012/01/broadening-focus.html</guid><description><![CDATA[On Dec. 14th, I was fortunate to discover the Fredericton Developer User Group. &nbsp;I attended their meeting and then was really fortunate to head down to the Garrison for a pint and a chat.During our conversation, I discovered that some in the group had Ruby-on-Rails experience, but had found that Frederi [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">On Dec. 14th, I was fortunate to discover the <a href="http://frederictonug.net/" target="_blank">Fredericton Developer User Group</a>. &nbsp;I attended their meeting and then was really fortunate to head down to the <a href="http://www.thegarrison.ca/" target="_blank">Garrison</a> for a pint and a chat.<br /><br />During our conversation, I discovered that some in the group had Ruby-on-Rails experience, but had found that Fredericton employment centered on .Net and Java skills. &nbsp;It was great just to chat about living and working here.<br /><br />In the end, I decided to broaden my focus to include C# and jQuery, as these appear to be skills in demand.<br /></div>  <div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; ">For the next week, I worked on C# (using video tutorials from <a href="http://www.pluralsight.com" target="_blank">PluralSight</a>). &nbsp;These were very helpful, but boring, as the strategy for beginners is to go through basic language constructs. &nbsp;I'm more used to a "learn by doing" approach, where the tutorial builds something and then explains the concepts we're using as we go. &nbsp;That being said, I did learn a number of things, and was surprised to find that C# is a 'toned down' version of C++ (from my 20-year-old memories) but more powerful than I remember VB and Excel Macros being. &nbsp;So, the concepts were fairly easy to grasp while the API is what it is.<br><br>Then, I went to move onto jQuery, but decided that the best way forward was to take the humble approach and do the JavaScript tutorial first. &nbsp;Surprisingly, this was a huge benefit, as I discovered I had never really understood the underlying structures of JavaScript. &nbsp;<em>(In the years gone by, JavaScript was so clumsy that I had decided to avoid it altogether in favour of boring HTML and a page-load with every click. &nbsp;In the years that I've been away, it's amazing to see how much faster and useful JavaScript (and, by extension, AJAX) has become.)</em><br><br>To date, I still haven't completed the jQuery videos, as I keep getting distracted by other things. &nbsp;For instance, in looking into the CSS code, I discovered SCSS/SASS and thought it was awesome. &nbsp;When I looked up "gradient" features, I was put onto Compass - which looked awesome but I have yet to get gradients working with Compass. &nbsp;Eight hours working on Compass haven't yielded any results. &nbsp;...<em>Groan..</em>. &nbsp;Either I haven't got the API working correctly, or the "gradient" features are currently under construction... or both.<br><br>What have I learned through this whole process?<br><ol><li>I learn better with people around me. &nbsp;(<em>Learning by myself, even with video tutorials, has gone against the grain of my learning style</em>.)</li><li>Just because the install and 'getting started' instructions <em>SAY </em>that it's really easy to use, these are usually written by an expert (or even the original developer) and often don't reflect a newbie's experience.</li><li>Visual Studio Express can be a useful IDE, but has been significantly hobbled by Microsoft when they cut plug-in capability. &nbsp;(<em>Yes, technically 'template' plug-ins still work. &nbsp;However, the plug-ins that matter, like Mindscape Web Workbench, that would have made SCSS/SASS awesome, don't</em>.)</li><li>With VSE2010 hobbled, you'll need to be familiar with the DOS command line and batch files, especially if you want SCSS/SASS to work. &nbsp;Very useful SCSS/SASS newbie instructions <a href="http://blog.accessibledesign.net/2010/09/getting-started-with-sass-and-haml-in-windows-a-front-end-developers-guide/" target="_blank">here</a>&nbsp;(also good notes <a href="https://github.com/nex3/sass" target="_blank">here</a> and <a href="http://thesassway.com/beginner/getting-started-with-sass-and-compass" target="_blank">here</a>.)</li><li>So, with all of the above in mind, keep a good text editor around. &nbsp;I use all of these, at various times:<br>- Notepad++ (Windows only)<br>- VI, vim, gVIM (*nix, Windows)<br>- gEdit (*nix)<br>- edit (Windows command-line only, in a pinch)<br>Thanks to all of you who have recommended (over and over) to use TextMate. &nbsp;<i>Now, if only I had the $$$ to get a new computer (i.e. Mac.....)</i></li></ol><div><i><br></i></div><div>The next meeting for the FDUG is on Jan. 11, so I'm looking forward to learning more about I.T. employment in Fredericton.</div></div>  ]]></content:encoded></item><item><title><![CDATA[My Rails Installation Notes]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/12/my-rails-installation-notes.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/12/my-rails-installation-notes.html#comments]]></comments><pubDate>Sun, 11 Dec 2011 23:08:08 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/12/my-rails-installation-notes.html</guid><description><![CDATA[So, after starting a number of Rails projects, I thought I'd make a quick list of commands and system changes that I use with almost every install.&nbsp; (I'll also include some common commands at the bottom.)      _ [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">So, after starting a number of Rails projects, I thought I'd make a quick list of commands and system changes that I use with almost every install.&nbsp; <span style="font-style: italic;">(I'll also include some common commands at the bottom.)</span><br /><span></span><br /></div>  <div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; "><span style="display:none;">_</span><span style="font-weight: bold;">$ rails new myapp -d postgresql -T</span>&nbsp;&nbsp;<span style="font-style: italic;">&nbsp; # use pg, don't install any tests</span><br /><br /><span style="font-weight: bold;">$ vi Gemfile</span><br /><span style="font-style: italic;">Gemfile begin: ^^^^^^^^^^^^^^^^^^^^^^</span>&nbsp; <span style="font-style: italic;"># you'll need to update the numbers</span><br />&nbsp;source 'http://rubygems.org'<br /><br />&nbsp;gem 'rails', '3.1.1'<br />&nbsp;gem 'pg', '0.11.0'<br />&nbsp;gem 'heroku', '2.11.0'<br />&nbsp;gem 'gravatar_image_tag', '1.0.0'<br />&nbsp;gem 'will_paginate', '3.0.2'<br />&nbsp;gem 'faker', '1.0.1'&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # This shouldn't be here, but Heroku errors won't stop!<br /><br />&nbsp;gem 'jquery-rails', '1.0.16'<br />&nbsp;<br />&nbsp;# Gems used only for assets and not required<br />&nbsp;# in production environments by default.<br />&nbsp;group :assets do<br />&nbsp;&nbsp; gem 'sass-rails',&nbsp;&nbsp; '~&gt; 3.1.4'<br />&nbsp;&nbsp; gem 'coffee-rails', '~&gt; 3.1.1'<br />&nbsp;&nbsp; gem 'uglifier', '&gt;= 1.0.3'<br />&nbsp;end<br /><br />&nbsp;group :development do<br />&nbsp;&nbsp; gem 'rspec-rails', '2.7.0'<br />&nbsp;&nbsp; gem 'annotate', :git =&gt; 'git://github.com/ctran/annotate_models.git'<br />&nbsp;end<br />&nbsp;<br />&nbsp;group :test do<br />&nbsp;&nbsp; gem 'turn', :require =&gt; false&nbsp;&nbsp;&nbsp; # Pretty printed test output<br />&nbsp;&nbsp; gem 'rspec-rails', '2.7.0'<br />&nbsp;&nbsp; gem 'webrat', '0.7.3'<br />&nbsp;&nbsp; gem 'factory_girl_rails', '1.3.0'<br />&nbsp;end<br />&nbsp;<br />&nbsp;group :production do<br />&nbsp;&nbsp; gem 'thin', '1.2.11'<br />&nbsp;end<br /><span style="font-style: italic;">Gemfile end: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span><br /><br /><br /><span style="font-weight: bold;">$ bundle install</span><br /><span style="font-weight: bold;">$ rails generate rspec:install</span><br /><span style="font-weight: bold;">$ vi .gitignore</span><br /><span style="font-style: italic;">.gitignore begin ^^^^^^^^^^^^^^^^^^^^^^^</span><br /><span></span> &nbsp;&nbsp;&nbsp;&nbsp; .bundle<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log/*.log<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *.log<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /tmp/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tmp/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .sass-cache/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *.swp<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *~<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .project<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .DS_Store<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bin/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public/assets/<br /><span style="font-style: italic;">.gitignore end ^^^^^^^^^^^^^^^^^^^^^^^</span><br />  <span></span><br /><span style="font-weight: bold;">$ git init</span><br /><span style="font-weight: bold;">$ git add .</span><br /><span style="font-weight: bold;">$ git commit -m "Initial commit"</span><br /><span style="font-weight: bold;">$ vi README</span><br /><span style="font-weight: bold;">$ git mv README README.markdown</span><br /><span style="font-weight: bold;">$ git commit -am "Improved README"</span><br /><span></span><br /><span>(go to GitHub and at your Dashboard create a New Repository)</span><br /><span style="font-weight: bold;">$ git remote add origin git@github.com:........ (from github)</span><br /><span style="font-weight: bold;">$ git push origin master</span><br /><br /><span style="font-weight: bold;">$ bundle install --binstubs</span><br /><br /><span style="font-weight: bold;">$ heroku keys&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; </span>&nbsp; // To see what RSA keys are in the system<br /><span style="font-weight: bold;">$ heroku keys:add&nbsp;</span> // To choose which key to use<br /><span style="font-weight: bold;">$ heroku create myapp --stack cedar</span><br /><span style="font-weight: bold;">$ git remote rm heroku</span><br /><span style="font-weight: bold;">$ git remote add heroku git@heroku.com:myapp.git</span><br /><span style="font-weight: bold;">$ git push heroku master</span><br /><span style="font-weight: bold;">$ heroku open</span><br /><span></span><br /></div>  <span class='imgPusher' style='float:left;height:0px'></span><span style=' float: left; z-index: 10; position: relative; ;clear:left;margin-top:0px;*margin-top:0px'><a><img src="http://www.witty.ca/uploads/4/7/6/4/4764474/3186365.png" style="margin-top: 5px; margin-bottom: 10px; margin-left: 0px; margin-right: 10px; border-width:1px;padding:3px;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px; text-align: center;"></div></span> <div  class="paragraph editable-text" style=" text-align: left; display: block; "><font size="3"><span style="font-weight: bold; text-decoration: underline;">Some common commands:</span></font><br /><br />$ git checkout -b first_branch_name<br />$ rails generate controller Pages home about<br />$ rails g controller Users new<br />$ rails g model Users last_name:string first_name:string<br />$ rails g scaffold User name:string email:string<br /><br />$ git reset --hard&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-style: italic;"> # to reset and blow away all changes</span><br /><br />$ rake db:migrate<br />$ rake db:test:prepare<br />$ heroku run rake db:migrate<br /><br />$ rake db:reset<br /><br /><span style="font-style: italic;"># For running RSpec with a beep at the end</span><br />$ clear; time bin/rspec spec/; beep -l 2;<br /><br /><span style="font-style: italic;"># For precompiling assets (and cleaning the folder first, before you upload to Heroku)</span><br />$ clear; git rm -rf public/assets; rm -rf public/assets; bin/rake assets:precompile; beep -l 2;<br /><span></span><br /><br /> <span style="font-style: italic;"># For telling "rails server" in development that you don't want pre-compiled assets</span><br /><span style="font-style: italic;"> # in config/environments/development.rb, add this (on</span><span style="font-style: italic;"> advice of </span><a style="font-style: italic;" target="_blank" href="http://stackoverflow.com/questions/7225600/why-is-rails-ujs-ajaxsuccess-bind-being-called-twice">StackOverflow</a>)<br />config.serve_static_assets = false<br /><br /> <br /><span></span><br /></div> <hr  style=" clear: both; visibility: hidden; width: 100%; "></hr>  <span class='imgPusher' style='float:left;height:0px'></span><span style=' float: left; z-index: 10; position: relative; ;clear:left;margin-top:0px;*margin-top:0px'><a><img src="http://www.witty.ca/uploads/4/7/6/4/4764474/8520778.png?105" style="margin-top: 5px; margin-bottom: 10px; margin-left: 0px; margin-right: 10px; border-width:1px;padding:3px;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px; text-align: center;"></div></span> <div  class="paragraph editable-text" style=" text-align: left; display: block; "><font style="text-decoration: underline; font-weight: bold;" size="3">Database Setup</font><br /><span>Don't forget to setup your database!</span><br /><span>(If you do, you'll get a <span style="font-weight: bold;">PG Error</span> that says:</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-style: italic;">fe_sendauth: no password supplied</span> )<br /><br /><span>To setup the database, you'll need to edit <span style="text-decoration: underline;">config/database.yml</span></span><br />to include something like this.&nbsp; (Don't worry about the production data, as it will be overwritten when you upload the site to Heroku.)<br /><br /><span style="font-style: italic;">database.yml begin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span><br /># PostgreSQL. Versions 7.4 and 8.x are supported.<br /><br /><span></span>development:<br />&nbsp; adapter: postgresql<br />&nbsp; encoding: unicode<br />&nbsp; database: myapp_development<br />&nbsp; pool: 5<br />&nbsp; host: localhost<br />&nbsp; port: 5432<br />&nbsp; username: myapp<br />&nbsp; password: myapp_password<br /><br /><span></span>test:<br />&nbsp; adapter: postgresql<br />&nbsp; encoding: unicode<br />&nbsp; database: myapp_test<br />&nbsp; pool: 5<br />&nbsp; host: localhost<br />&nbsp; port: 5432<br />&nbsp; username: myapp<br />&nbsp; password: myapp_password<br /><br />production:<br />&nbsp; adapter: postgresql<br />&nbsp; encoding: unicode<br />&nbsp; database: myapp_production<br />&nbsp; pool: 5<br />&nbsp; host: localhost<br />&nbsp; port: 5432<br />&nbsp; username: myapp<br />&nbsp; password: myapp_password<br /><span style="font-style: italic;">database.yml end ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span><br /><br /></div> <hr  style=" clear: both; visibility: hidden; width: 100%; "></hr>  ]]></content:encoded></item><item><title><![CDATA[Current Events in Canada]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/11/current-events-in-canada.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/11/current-events-in-canada.html#comments]]></comments><pubDate>Wed, 09 Nov 2011 16:40:13 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/11/current-events-in-canada.html</guid><description><![CDATA[I was out supply teaching yesterday and had a fabulous time!&nbsp; I met some great kids in a Law 12 class and we had an awesome discussion about Prisons and Money and Canadian Politics with the Stephen Harper Government.&nbsp; Curious what resources we used?&nbsp; Try these videos for starters.&nbsp; And, yes, I informed the students that the CBC is known for leaning somewhat to the left.&nbsp;&nbsp; :-) [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">I was out supply teaching yesterday and had a fabulous time!&nbsp; I met some great kids in a Law 12 class and we had an awesome discussion about Prisons and Money and Canadian Politics with the Stephen Harper Government.&nbsp; Curious what resources we used?&nbsp; Try these videos for starters.&nbsp; And, yes, I informed the students that the CBC is known for leaning somewhat to the left.&nbsp;&nbsp; :-)<br /><br /><a target="_blank" href="http://www.youtube.com/watch?v=dbPtJ1ml5Zw"><span>Rick Mercer's Camelot Skit</span></a><br /><br /><a target="_blank" href="http://www.cbc.ca/news/politics/story/2011/10/17/pol-vp-milewski-texas-crime.html"><span>Terry Mileski's Investigative Journalism on the changing justice system in Texas</span></a><br /></div>  ]]></content:encoded></item><item><title><![CDATA[Finally.  The RailsTutorial is finished!]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/11/finally-the-railstutorial-is-finished.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/11/finally-the-railstutorial-is-finished.html#comments]]></comments><pubDate>Sat, 05 Nov 2011 19:23:18 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/11/finally-the-railstutorial-is-finished.html</guid><description><![CDATA[Celebration time!&nbsp; I've finally finished the 12 chapters of the RailsTutorial.Of course, he finishes off the video series with 2 things:a Chapter 13, where he discusses all the differences in the tutorial between Rails 3.0 and 3.1....&nbsp; like I didn't just go through and figure it all out!!!! [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">Celebration time!&nbsp; I've finally finished the 12 chapters of the <a target="_blank" href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book">RailsTutorial</a>.<br /><br /><span>Of course, he finishes off the video series with 2 things:</span><br /><ul><li>a Chapter 13, where he discusses all the differences in the tutorial between Rails 3.0 and 3.1....&nbsp; like I didn't just go through and figure it all out!!!!</li><li>a list of all the things he DIDN'T cover in the tutorial.... and now I'm back to feeling overwhelmed again.&nbsp; <br /></li></ul>But, on the bright side, he has done a lovely introduction so that <a target="_blank" href="http://railscasts.com/">RailsCasts</a> now make some sense.&nbsp; And, hopefully, the future will be much brighter now that I know what a :scope is!<br /></div>  ]]></content:encoded></item><item><title><![CDATA[JavaScript and the awesome FireBug]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/11/javascript-and-the-awesome-firebug.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/11/javascript-and-the-awesome-firebug.html#comments]]></comments><pubDate>Fri, 04 Nov 2011 12:59:37 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/11/javascript-and-the-awesome-firebug.html</guid><description><![CDATA[As a Rails newbie, trying to wrap my head around JQuery (the new default on Rails 3.1) has been a bit of a chore.&nbsp; This isn't because it's hard to use, or because the RailsTutorial.org is hard to follow.&nbsp; Actually, the opposite is true: because it's so easy to use, that means it is harder (for me) to figure out what is going wrong if (aka "when") somethi [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">As a Rails newbie, trying to wrap my head around JQuery (the new default on Rails 3.1) has been a bit of a chore.&nbsp; This isn't because it's hard to use, or because the <a title="" target="_blank" href="http://www.RailsTutorial.org">RailsTutorial.org</a> is hard to follow.&nbsp; Actually, the opposite is true: because it's so easy to use, that means it is harder (for me) to figure out what is going wrong if (aka "when") something does go wrong.<br /><br /><span>Take, for instance, my latest trials with the RailsTutorial.&nbsp; It should have been easy enough to type in exactly what we were told.&nbsp; Except that this didn't work!&nbsp; And, where do errors go if you're using a JavaScript button?</span><br /><br /><span>Enter <a title="" target="_blank" href="http://getfirebug.com/">FireBug</a>.&nbsp; It's not entirely intuitive, but at least it gives some pointers and displays the error messages that would otherwise fail to be displayed.</span>&nbsp; At first, I thought FireBug would just start spitting out the error messages, but I needed to configure it first.&nbsp; Again, it wasn't much, but it did take me an hour of searching the web to just give up and try poking around.&nbsp; The "Console" button was what I wanted.&nbsp; Displayed nice error messages so that I could track down the bugs.&nbsp; (Not that they're all fixed yet, but at least I have a direction to look!)<br /><br /><span></span>Very valuable!&nbsp; Thanks so much.<br /><br /><span>By the way, if you're developing in Rails 3.1, you should be told that the JavaScript code might be running twice if you have assets:precompile as a setting.&nbsp; (In development mode, it runs once as the raw code, and once as the compiled code.)&nbsp;&nbsp; To fix this, in your<span style="font-weight: bold;"> config/environments/development.rb</span> file, put <span style="font-weight: bold;">config.serve_static_assets = false</span> and then you're stuck with the precompiled assets only.</span>&nbsp; I found that answer <a title="" target="_blank" href="http://stackoverflow.com/questions/7225600/why-is-rails-ujs-ajaxsuccess-bind-being-called-twice">here</a>.&nbsp; Thanks, <a target="_blank" href="http://stackoverflow.com">StackOverflow</a>!<br /></div>  ]]></content:encoded></item><item><title><![CDATA[The strangeness of conventions]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/11/the-strangeness-of-conventions.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/11/the-strangeness-of-conventions.html#comments]]></comments><pubDate>Tue, 01 Nov 2011 13:09:05 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/11/the-strangeness-of-conventions.html</guid><description><![CDATA[Yes, I'm an old fuddy-duddy.&nbsp; I started programming back in the 80's and learned Turbo Pascal and Modula-2.&nbsp;&nbsp;&nbsp; I still remember that making code readable was about using helpful names for variables and functions... and ALWAYS make sure those names were visually different so that you wouldn't confuse them.&nbsp; (e.g.&nbsp; $user,&nbsp; $users,&nbsp; $Users)Well, welcom [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">Yes, I'm an old fuddy-duddy.&nbsp; I started programming back in the 80's and learned Turbo Pascal and Modula-2.&nbsp;&nbsp;&nbsp; <br /><br /><span>I still remember that </span>making code readable was about using helpful names for variables and functions... and ALWAYS make sure those names were visually different so that you wouldn't confuse them.&nbsp; (e.g.&nbsp; $user,&nbsp; $users,&nbsp; $Users)<br /><br /><span>Well, welcome to the world of Ruby on Rails. </span><br /><br /><span>if Michael Hartl's tutorial is any indication, then this world is chock full of references to things that all look the same.&nbsp; So far, I've discovered that the following are very VERY different, yet they look so similar.&nbsp; These are all variables, instances or classes.&nbsp; (I get so confused!)</span><br /><br /><span>user</span><br /><span>users</span><br /><span>User</span><br /><span>@user</span><br /><br /><span>micropost</span><br /><span>microposts</span><br /><span>Micropost</span><br /><span>@micropost</span><br /><br /><span>And yes, I do find all this hard on my tired old eyes</span>.&nbsp; While it might "read more like English" I have to wonder at what cost.&nbsp; I'm sure someday I'll lose hours trying to find a bug that was more about a missing (or extra) "s" than anything else.<br /><br /><span>If being readable means that my code is hardly debugable, then maybe we've "swung the pendulum" too far!</span><br /></div>  ]]></content:encoded></item><item><title><![CDATA[What I hate most about being a newbie...]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/11/what-i-hate-most-about-being-a-newbie.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/11/what-i-hate-most-about-being-a-newbie.html#comments]]></comments><pubDate>Tue, 01 Nov 2011 10:06:22 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/11/what-i-hate-most-about-being-a-newbie.html</guid><description><![CDATA[Sure, we all have to learn something new at some point.&nbsp; But what I hate the most is the solution that you can't learn from.So, I spent yesterday working on Chapter 11 of the Rails Tutorial.&nbsp; It's been great, but there was a "re- [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">Sure, we all have to learn something new at some point.&nbsp; But what I hate the most is the solution that you can't learn from.<br /><br /><span>So, I spent yesterday working on <a target="_blank" href="http://ruby.railstutorial.org/chapters/user-microposts#top">Chapter 11</a> of the <a target="_blank" href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book">Rails Tutorial</a>.&nbsp; It's been great, but there was a "re-factoring" section in the middle that I knew was going to haunt me.&nbsp; There were too many changes, too many RSpec test added and and the development was just too much.&nbsp; My code "blew up" on me.&nbsp; I had at least 14 tests go red, and the solution that should have been obvious was completely hidden behind all my attempted fixes that only made things worse.</span><br /><br /><span>So, I blew away all my Chapter 11 work ("git reset --hard" takes you back to your last commit).&nbsp; I started again, and when I got to the "too busy" part, I broke it down into smaller chunks and went by baby steps (with a complete RSpec run after every step).</span><br /><br /><span>Did I find my problem?&nbsp; NO!!!!!</span><br /><br /><span>Every RSpec test passes now with flying colours.</span><br /><br /><span>The big step (I had thought) was to move "def authenticate ..." from the users_controller to the sessions_helper.&nbsp; I moved the code, ran the test, held my breath, ... and it ran green!&nbsp;&nbsp; For once, I really wanted my code to blow up (so it would justify all my pain from yesterday).</span><span></span>&nbsp; What I had spent an hour researching and 2 hours repairing... was not a problem ... at all.&nbsp; (groan)<br /><br /><span>So, I have no idea where my code went wrong yesterday, so I have nothing to learn from my mistake.</span><br /><br /><span>However, maybe my biggest mistake was to "follow the instructions" when my gut said, "Take it slow or you'll get lost!"</span><br /><br /><span>So, that's the lesson of the day.&nbsp; Take your TDD in baby steps (and don't worry if it feels slow, because the alternative is ... ARGGG!)</span><br /><span></span><br /><span></span>[TDD = Test Driven Development]<br /></div>  ]]></content:encoded></item><item><title><![CDATA[TDD errors != Rails errors (Rails 3.0 vs 3.1)]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/10/tdd-errors-rails-errors.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/10/tdd-errors-rails-errors.html#comments]]></comments><pubDate>Thu, 27 Oct 2011 21:09:41 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/10/tdd-errors-rails-errors.html</guid><description><![CDATA[What is happening when your code runs fine, the tutorial shows that your code should be "RSpec green", but it isn't?&nbsp; For me, it's time to go to StackOverflow.com again.&nbsp; The hardest part was searching for the right answer.&nbsp; But once it was found, it just works!So, for those of you stuck in ( [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">What is happening when your code runs fine, the tutorial shows that your code should be "RSpec green", but it isn't?&nbsp; <br /><br /><span>For me, it's time to go to StackOverflow.com again.&nbsp; The hardest part was searching for the right answer.&nbsp; But once it was found, it just works!</span><br /><br /><span>So, for those of you stuck in (<a title="" target="_blank" href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book">Michael Hartl's awesome Rails Tutorial</a></span>) <a title="" target="_blank" href="http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#sec:requiring_signed_in_users">chapter 10</a> and wondering why you now have RSpec giving you 7-10 errors, don't worry!<br /><br /><span>I had suspected all along that this was just one of the differences between Rails 3.0 and Rails 3.1, and it appears that I was right!&nbsp; When searching for "test_sign_in" the 4th hit took me <a title="" target="_blank" href="http://stackoverflow.com/questions/7498639/many-rpsec-tests-with-test-sign-in-fail-after-upgrading-to-rails-3-1-maybe-a-co">here</a>, and the answer redirected me <a title="" target="_blank" href="http://stackoverflow.com/questions/6821692/cookies-do-not-persist-in-rspec-on-rails-3-1">here</a>, where I received the bizarre but efficient changes that needed to be made. </span><br /><br /><span>In <span style="font-weight: bold;">sessions_helper</span>, find <span style="font-weight: bold;">def sign_in</span><br /></span><ul><li> <span style="font-weight: bold;">old</span>:<br />current_user = user</li><li><span style="font-weight: bold;">new</span>:<br />current_user = user<br />@current_user = user</li></ul>Also in <span style="font-weight: bold;">sessions_helper</span>, find <span style="font-weight: bold;">def sign_out</span><br /><ul><li> <span style="font-weight: bold;">old</span>:<br />current_user = nil</li><li><span style="font-weight: bold;">new</span>:<br />current_user = nil<br />@current_user = nil</li></ul>Even the author is left guessing why this works.&nbsp; But it's small, efficient, and keeps the tests nice and small.&nbsp; After all, each test should test one and only one thing, right?!<br /><br /><br /><span>[TDD = Test Driven Development]</span><br /></div>  ]]></content:encoded></item><item><title><![CDATA[Learning Rails and learning how to spell]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/10/learning-rails-and-learning-how-to-spell.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/10/learning-rails-and-learning-how-to-spell.html#comments]]></comments><pubDate>Wed, 26 Oct 2011 21:33:11 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/10/learning-rails-and-learning-how-to-spell.html</guid><description><![CDATA[So, I spent 3 hours tonight cursing Michael Hartl and "his useless Rails tutorial".&nbsp; My word, his ears must have been burning.Then, I decided that I would double-check my spellings of everything I'd typed today.(...sigh...)Yes, my 3 hours of "debugging" was all because I don't know how to spell "permanent".&nbsp; Apparently, there is a "man" in "permanent".&n [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">So, I spent 3 hours tonight cursing Michael Hartl and "his useless Rails tutorial".&nbsp; My word, his ears must have been burning.<br /><br /><span>Then, I decided that I would double-check my spellings of everything I'd typed today.</span><br /><br /><span>(...sigh...)</span><br /><br /><span>Yes, my 3 hours of "debugging" was all because I don't know how to spell "permanent".&nbsp; Apparently, there is a "man" in "permanent".&nbsp; (Look for it, and you'll see it's there!)&nbsp; How embarrassing. </span><br /><br /><span>Somehow, I've managed to live for almost 4 decades and teach English Language Arts, and yet I always thought that it was spelled "permenant".&nbsp; Yes, thank you Google Chrome for underlining it in red for me NOW!&nbsp; I guess it's time to turn on the spell checker in gEdit.&nbsp; </span><br /><br /><span>(...sigh...)</span><br /></div>  ]]></content:encoded></item><item><title><![CDATA[Learning Rails and learning patience]]></title><link><![CDATA[http://www.witty.ca/2/post/2011/10/learning-rails-and-learning-patience.html]]></link><comments><![CDATA[http://www.witty.ca/2/post/2011/10/learning-rails-and-learning-patience.html#comments]]></comments><pubDate>Wed, 26 Oct 2011 08:38:02 -0400</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.witty.ca/2/post/2011/10/learning-rails-and-learning-patience.html</guid><description><![CDATA[When I first sat down to learn Rails, I thought, "A week, maybe two... ."&nbsp; Yeah, right!I've now learned that watching a 1hr 20min tutorial video from Michael Hartl will take me about a day.&nbsp; That's including:pausing and rewinding to catch up (typing) and to be sure I understand.verifying locally and on Heroku that everything is working right(I [...] ]]></description><content:encoded><![CDATA[<div  class="paragraph editable-text" style=" text-align: left; ">When I first sat down to learn Rails, I thought, "A week, maybe two... ."&nbsp; <br /><br /><span>Yeah, right!</span><br /><br /><span>I've now learned that watching a 1hr 20min tutorial video from Michael Hartl will take me about a day.&nbsp; That's including:</span><br /><ul><li>pausing and rewinding to catch up (typing) and to be sure I understand.</li><li>verifying locally and on Heroku that everything is working right<br />(I'm still leary of Heroku, see my previous posts.)</li><li>flipping back-and-forth between the video and the PDF versions (especially where there might be large CSS to copy-and-paste.</li><li>taking regular breaks to shake my head (and make sure that I can remember what I just read/did).</li></ul>So, I'm learning that patience (with persistence) is my best combination.<br /><span>... that and keeping a window to <a target="_blank" href="http://www.StackOverflow.com">StackOverflow.com</a> open for </span>any weirdness that creeps up!<br /></div>  ]]></content:encoded></item></channel></rss>

