Posts

  • Add a default page title with HAML in Rails

    In the PlanningAlerts project, we recently added a default page title for those pages we forget to add specific titles to. I added the initial code and Matthew did it properly cleaned it up, here’s the diff:

    diff --git a/app/views/layouts/application.haml b/app/views/layouts/application.haml
    index 27d81d9..6b42b26 100644
    --- a/app/views/layouts/application.haml
    +++ b/app/views/layouts/application.haml
    @@ -2,10 +2,7 @@
     %html(xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml")
       %head
         %meta(content="text/html; charset=utf-8" http-equiv="Content-Type")
    -    - if @page_title
    -      %title PlanningAlerts | #{@page_title}
    -    - else
    -      %title PlanningAlerts | Email alerts of planning applications near you
    +    %title PlanningAlerts | #{@page_title || "Email alerts of planning applications near you"}
         - if @rss
           %link(rel="alternate" type="application/rss+xml" title="RSS" href=@rss)
         = stylesheet_link_tag "memespring", "main", :media => "all"
    

    I thought other people might find this little hack useful for adding default page titles to their HAML templated Ruby on Rails projects.

  • Subscribing to Apple iCal Server feeds from Mozilla Sunbird

    Subscribing to feeds from Apple's iCal Server with OS X's iCal may be a relatively straight-forward affair but working out what CalDAV address to use with Mozilla Sunbird is another story completely.

    It took me ages to work out where these magic feed addresses were but once you know, it's trivial. In iCal, just select the calendar you want to subscribe and select File, Get Info:

    Enter your server address and port, eg. http://yourserversaddress:8008/, then put the CalDAV URL in the image above into the Sunbird CalDAV subscription wizard and you're good to go:

  • OpenAustralia DevLive, now with PlanningAlerts goodness

    In preparation for the recent OpenAustralia Hackfest - apps4nsw Edition, Matthew asked me to add the Ruby on Rails port of PlanningAlerts to DevLive so that developers could poke around with what was an experimental codebase (it's now deployed - woohoo!).

    Unfortunately I wasn't able to attend the hackfest as I was busy jumping out of a plane that weekend but I nonetheless managed to get a new release of DevLive ready that includes a development copy of PlanningAlerts.

    I've added the relevant details to the DevLive page, where you can also find download links for v0.1.0 of the appliance.

    If you're planning to take a look, I think I should alert you (haw haw!) to the fact that the code is moving at a rapid pace and it might be a good idea to pull an updated copy of the code from Github to make sure you're seeing the latest-and-greatest code.

    If you have any problems with this release or any feature requests, leave them as a comment over on the DevLive page.

  • Monitor Apache 2.2 with Zenoss on Debian

    The packaged Zenoss for Debain will monitor httpd out of the box but does not look for the apache2 process.

    To monitor Apache 2.2, you need to add a similar Processes class as httpd has. Navigate to Processes>Apache and then select Add process. Type apache2 as an ID (it's just a unique identifier) and select OK.

    Under the Edit tab, type apache2 for the Name and ^.*\/*apache2 as the RegEx. That should be all you need.

    To start monitoring a device, just remodel it manually or wait for a day or so for remodelling to happen on all your devices for Apache 2.2 to start to be monitored.

  • Java and SSL on FreeBSD

    Running Jira on FreeBSD, I wanted to be able to pick up email from a Google Apps account and feed it in as tickets. This is normally a straight-forward process but I was getting these errors in the Jira logs:

    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    

    So it seemed like the Gmail SSL certificate for IMAP or POP wasn’t validating. That’s weird as it would be a major problem if it didn’t and they’re certainly not using a self-signed certificate.

    I checked the keystore and it appeared empty so it looks like FreeBSD’s Java doesn’t ship with the normal list of CAs. To fix this I did:

    [henare@freebsd ~]$ ls -l /usr.local/diablo-jdk1.6.0/jre/lib/security/cacerts
    -rw-r--r--  1 root  wheel  942    Aug  6  2007 /usr/ports/java/jdk16/files/cacerts
    [henare@freebsd ~]$ #wow, that file's really small (this directory was in our JAVA_HOME - don't ask me about the usr.local thing)
    [henare@freebsd ~]$ #first, backup this file
    [henare@freebsd ~]$ sudo cp /usr/local/diablo-jdk1.6.0/jre/lib/security/cacerts{,_backup`date +%Y%m%d`}
    [henare@freebsd ~]$ #now, copy over the file from ports
    [henare@freebsd ~]$ sudo cp /usr/ports/java/jdk16/files/cacerts /usr.local/diablo-jdk1.6.0/jre/lib/security/cacerts
    [henare@freebsd ~]$ ls -l /usr.local/diablo-jdk1.6.0/jre/lib/security/cacerts
    -rw-r--r--  1 root  wheel  40624 Aug  6  2007 /usr/ports/java/jdk16/files/cacerts
    [henare@freebsd ~]$ #that looks better
    

subscribe via RSS