Ruby on Rails and Unfuddle: So Good Together

Posted by Mike on October 14, 2008

Yesterday I started making a website for my church. I basically want to create a glorified address book where church members can go to update their contact information and look up the contact info of others. Nothing to write home about, I know, but it is a good excuse to learn Ruby on Rails and to use a new programming project management suite I found called Unfuddle.

First, Unfuddle.

Unfuddle is a project management tool developed specifically for managing programming projects.  I have yet to explore it completely, but it looks to be very promising.  It has milestones, tasks, timesheets, svn/git hosting, and some wiki style pages.  It’s basically a perfect integration of trac/svn/mediawiki that is already setup and hosted for you.  Plus, it’s API exposes nearly every aspect of the system so you can build widgets and mashups until your heart is content.

I hope to be using Unfuddle a lot in the future (hopefully I can convince my employer to make the switch), but for right now I’m just taking advantage of their free 200MB of SVN storage.

Now onto everyone’s favorite buzzword, Ruby on Rails

I’ve had a number of false starts into the RoR world over the past few years (I even developed a plugin a few years ago), but I have never completed a project using RoR.  Hopefully now I will have the motivation to do so.  I’ll jot down a few of the things I learned yesterday (even the horribly embarrassing ones)

  1. Don’t forget the = after <% if you want to output. I spent about 1 hour trying to figure out why my layout wouldn’t yield.
  2. There is no built in email model validation, but there’s a pretty sweet plugin named validates_email_format_of. RFC 2822, RFC 3696, yada yada yada.
  3. If you want to use the flash scope, but don’t want your variable hanging around for the next request, use flash.now().

Using jQuery to Facilitate Default JavaScript Function Arguments

Posted by Mike on October 13, 2008

I’m not a very good JavaScript programmer, but today I decided to try and become a little bit better.  My usual JavaScript methods involve a lot of hackery.  One of the things I have never found a good solution for is passing arguments to a function.  With the help of jQuery, today I found what I think to be a pretty good solution.

The technique is pretty simple: pass an options object to the function you’re calling (or don’t), create a default arguments object at the top of your function in question, and use jQuery’s extend function to merge the two.

Here’s some code to help explain:

/*
 * call the function with some options
 *
 * will alert:
 * option1: whatup
 * option2: false
 * option3: 2
 * option1: "andhow"
 */
mySweetFunction({
   option1: "whatup",
   option2: false,
   option3: 2
});
 
/*
 * call the function without any options
 *
 * will alert:
 * option1: sillystring
 * option2: true
 * option3: 100
 * option1: "andhow"
 */
mySweetFunction();
 
// the function in question
function mySweetFunction(options) {
   // establish the default values
   var args = {
      option1: "sillystring",
      option2: true,
      option3: 100,
      option4: "andhow"
   };
 
   // use jQuery's extend function to merge
   // args and options, modifying args.
   $.extend(args, options);
 
   alert("option1: " + args.option1);
   alert("option2: " + args.option2);
   alert("option3: " + args.option3);
   alert("option4: " + args.option4);
}

SGCC Statement of Faith Wordle

Posted by Mike on October 03, 2008

SGCC Statement of Faith Wordle

SGCC Statement of Faith Wordle

I have been a member of Sovereign Grace Community Church in Roanoke, VA for about 2.5 years now.  This is a wordle created using the text of my church’s Statement of Faith.

Wheels API Expolorer

Posted by Mike on May 20, 2008

I used the Static Page Component Doc Generator by Christopher Kent Wigginton to generate some documentation based on the wheels cfcs. I figured that until the documentation was fleshed out a bit more, this might be helpful. You can download a zip or you can browse online.

I hope to use CFCDoc Revamped once version 0.48 comes out and I can generate some static html. My host doesn’t support CFML (as of yet), so I can’t run CFCDoc dynamically on my server. If you are interested in running CFCDoc Revamped on your server, all you have to do is change the file extension to .cfc on all of the .cfm files which are included by base.cfc, controller.cfc, dispatch.cfc, and model.cfc.

Making the Blog with ColdFusion on Wheels (part 1) 3

Posted by Mike on May 17, 2008

I have been following the ColdFusion on Wheels project for a while now, and I finally got around to making a video tutorial. It’s pretty long (38 minutes) and I have bad allergies (seasonal) right now so my voice is a little nasally and annoying. With those caveats out of the way, if you still want to proceed, you can view the video in your browser or you may download it.