Archive for the ‘Programming’ Category

Dru­pal has a Tax­on­omy mod­ule for cat­e­go­riz­ing con­tent. The mod­ule can gen­er­ate a select box based on the defined tax­on­omy. How­ever, it does not sup­port option groups. I fig­ured I’d share my mod­i­fi­ca­tion for those who’d like to do the same. It was based on code from a Dru­pal forum post which I think was based on Dru­pal 5, not 6.

(more…)

So I had to move an appli­ca­tion that I’m devel­op­ing from a Medi­aTem­ple (dv) Dedicated-Virtual to a Ruby on Rails Grid­Con­tainer run­ning on a Medi­aTem­ple (gs) Grid-Service. Most of the tuto­ri­als I found that cov­ered installing a Rails app on a Grid­Con­tainer were some­what dated. Things that were dif­fer­ent than expected include:

  1. Rails, a few pre­com­piled gems (like RMag­ick), and a test app are auto­mat­i­cally installed for you. Most of the tuto­ri­als walk you through installing Rails and the skele­ton app from SSH. That’s no longer necessary.
  2. For Capis­trano, you need to set the syspath option (“Sys­tem” in the con­trol panel) to /home/[xxxxx]/containers/rails/[app_path]/current where [xxxxx] is your Grid­Con­tainer num­ber and [app_path] is where you want your app located. I kept the app path and app name the same.
  3. You can’t edit appli­ca­tion options from the web con­trol panel. You have to do this from a SSH ses­sion using mtr set_option. You may need to do this to change the syspath or to set the environment. For exam­ple, to set the envi­ron­ment to “stag­ing” you use the fol­low­ing com­mand: mtr set_option [app_name] environment=staging.
  4. If you change the syspath make sure to update the sym­bolic link to the app’s pub­lic folder under your app’s domain, oth­er­wise you’ll get an app not found error. In other words, ~/domains/example.com/html should point to /home/[xxxxx]/containers/rails/[app_path]/current/public.
  5. When an appli­ca­tion fails to start, you get no feed­back about the cause. Check log/mongrel.log for details as to why your appli­ca­tion fails to start.
  6. After chang­ing the syspath, the app may not restart. You may get an Address already in use - bind(2) (Errno::EADDRINUSE). To resolve this, I ended up hav­ing to reboot the container.
  7. For some rea­son, rake gems:install didn’t work. I had to man­u­ally install each gem.


I def­i­nitely had a lot more con­trol over the instal­la­tion when I had the appli­ca­tion run­ning on the (dv) using Pas­sen­ger Phu­sion, espe­cially hav­ing the abil­ity to com­pile soft­ware. How­ever, the Grid­Con­tainer runs a lot faster.

Get­ting CSS rules to work across all browsers is a con­tin­u­ous fight. Thank­fully, there are workarounds and DHTML meth­ods to cor­rect many of these prob­lems, and if those fail, reluc­tantly there are hacks avail­able. Unfor­tu­nately, it seems I’ve run into a dif­fer­ence of opin­ion between the browsers, most likely as a result of the W3 Con­sor­tium fail­ing (yet again) to be explicit with their stan­dards. The prob­lem is the dif­fer­ence between the way Fire­fox and Opera inter­pret the “word-spacing” CSS prop­erty ver­sus the way Safari and IE inter­pret the prop­erty. More specif­i­cally each browser treats the non-breaking space dif­fer­ently. FF/Opera both respect the non-breaking space and Safari/IE both ignore the space. For exam­ple, if the text is “first foo bar last”, FF/Opera would like:

first        foo bar       last

whereas in Safari/IE the text would appear like:

first        foo        bar        last

Per­son­ally, I agree with the FF/Opera devel­op­ers and feel that the non-breaking space should be respected since I’m explic­itly telling the browser that words to either side of the non-breaking space should be treated as a unit. So now I’m going to have to put each phrase in some sort of HTML block and depend on a com­bi­na­tion of padding and mar­gins to accom­plish the same effect in order for it to be cross-browser compatible.

As a few users of MyGoogleCal3 have already pointed out, the script no longer works prop­erly. That’s the bad news. The good news is ver­sion 4 does work. In fact, with the lat­est changes Google made to their code, ALL the fea­tures that were bro­ken in 3 appear to be work­ing now—Agenda/Week view, the cal­en­dar nav­i­ga­tion but­tons, and IE is fixed. Please down­load and test out the lat­est ver­sion, and report any bugs in the com­ments and I’ll try to resolve them as time allows.

(more…)