Posts Tagged ‘Programming’

After many false starts, I decided that I really needed to wrap my head around unit test­ing when writ­ing Rails appli­ca­tions. I more or less com­pleted a Rails 1.2.3 appli­ca­tion with­out any for­mal tests, and I would like to upgrade it to 2.0.2 and make it REST­ful in the process. At the same time, I’ve moved from a Win­dows devel­op­ment envi­ron­ment to a *nix one after installing Xubuntu on my lap­top (an old Com­paq Pre­sario). I’ve also switched from Cream to Emacs. Despite my Win­dows desk­top being more than twice as fast as my lap­top, I just could not stand not being in a true *nix envi­ron­ment. Too much of the Win­dows idio­syn­crasies got on my nerves. And my switch from Cream to Emacs was because I just didn’t like the insta­bil­ity of the hacks required to make Vim less of a modal edi­tor. If I tire of Emacs, I may try pure Vim instead, but I remem­ber installing Cream sim­ply because I didn’t like pure Vim to start with. So with these var­i­ous changes going on with my Rails pro­gram­ming envi­ron­ment, I fig­ured it was an ideal time to learn to for­mally test my appli­ca­tions. Of course the first part is set­ting up the test­ing envi­ron­ment so that it is easy to use, stays out of your way, and is informative.

(more…)

The long awaited new ver­sion of MyGoogle­Cal is here. It sup­ports the new AJAX-enabled Javascript method Google switched to last month. As a bonus, the new ver­sion has native sup­port for mul­ti­ple cal­en­dars each with their own col­ors! Other changes to the code include offi­cially switch­ing from fopen to curl to retrieve the data. Fur­ther­more, the code replaces much less HTML since it’s encap­su­lated in Javascript. With­out fur­ther ado…

(more…)

My how-to for restyling Google Cal­en­dar is by far this blog’s most pop­u­lar post so far. Right from the start, peo­ple had requested that I adjust the code to accom­mo­date Google Calendar’s mini-mode. It cer­tainly was pos­si­ble using the tech­nique I used, but it did break the agenda which was flaky to begin with given the fact the fea­ture was exper­i­men­tal. Every once in a while, I’d check on the sta­bil­ity of mini-mode to deter­mine if it was ripe for some hack­ing. Then one day the mode sim­ply didn’t work any­more. It was weird, but after fur­ther research I found out why. Mini-mode was super­seded by the Google Cal­en­dar Gad­get. The con­fig­u­ra­tion form does pro­vide some cus­tomiza­tion of the style, but it is cer­tainly lim­ited. So just like before, I poked and prod­ded the code until I was able to find the means to restyle the gadget.

(more…)

Inspired by a cou­ple of arti­cles and even a screen­cast, I wrote a short batch file that cre­ates a Rails appli­ca­tion and auto­mat­i­cally loads it into a sub­ver­sion repos­i­tory. It works by first cre­at­ing a temp folder, gen­er­at­ing the rails app there, renam­ing the app folder to trunk, cre­at­ing the accom­pa­ny­ing branches and tags folder, and then deleting/renaming a bunch of non-essential files. Once that’s done it imports the three fold­ers into a spec­i­fied sub­ver­sion repos­i­tory. Once the import is com­plete, the temp folder is deleted and then the trunk is checked out. Finally it cleans-up by copy­ing the database.yml file and ignor­ing the tmp and log fold­ers. That’s it.

(more…)