Richard Gould

CTO, Software Developer, Language Learner

Icelandic Language Music Roundup

| Comments

While focusing heavily on learning Icelandic, I dug deeply looking for Icelandic-language music. There are surprisingly high amounts of Icelandic bands that sing exclusively in English. Here are my favourite songs with Icelandic lyrics:

Mammút - They play energetic rock music, bordering on post-punk sometimes. The first Icelandic language band I liked, and my favourite still. Here’s Svefnsýkt: <iframe width="420" height="315" src="http://www.youtube.com/embed/aeGZriDklEo" frameborder="0" allowfullscreen></iframe> Bónus: Rauðilækur

Q4U - Postpunk from the 80s, mostly in Icelandic. They’re still around. Here’s Sigurinn: <iframe width="420" height="315" src="http://www.youtube.com/embed/iiWcZKhWlQA" frameborder="0" allowfullscreen></iframe> Bónus: Snjóhvít

Samaris - Atmospheric minimal electro/triphop with clarinet. Very haunting. Here’s Góða Tungl: <iframe width="560" height="315" src="http://www.youtube.com/embed/_pKuzdMFE8k" frameborder="0" allowfullscreen></iframe> Bónus: Stofnar Falla

Nóra: Indie rock, ranging from upbeat and energetic to atmospheric and introspective. The more I listen, the more I like it. They sing entirely in Icelandic. Here’s Himinbrim: <iframe width="420" height="315" src="http://www.youtube.com/embed/w66kIAWBFs8" frameborder="0" allowfullscreen></iframe> Bónus: Sjónskekkja

Lockerbie - Post-rock, but with a bit more pop/rock than usually characterised by Icelandic post-rock. Here’s Snjóljón: <iframe width="420" height="315" src="http://www.youtube.com/embed/cUWzNsPHcEQ" frameborder="0" allowfullscreen></iframe>

Úlfur Úlfur - Hiphop with awesome backing percussion. They sing entirely in Icelandic. Here’s Út: <iframe width="560" height="315" src="http://www.youtube.com/embed/jCgbt73gD74" frameborder="0" allowfullscreen></iframe> Bónus: Ég er farinn

Pascal Pinon - D.I.Y., lo-fi, indie pop electronic. Many songs in Icelandic. Here’s Ekki Vanmeta: <iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F71960187"></iframe> Bónus: Sandur

Sólstafir - Post-black metal, with elements of country and rock. They are amazing live. Their album Svartir Sandar is entirely in Icelandic and highly recommended. Here’s Fjara: <iframe width="420" height="315" src="http://www.youtube.com/embed/A6j7mUxGz20" frameborder="0" allowfullscreen></iframe> Bónus: Svartir Sandar

There’s lots of music that I’ve discovered that I didn’t cover here, but I only wanted to showcase the music I liked the most. Feel free to leave other suggestions in the comments.

Screencast: Using Shell History to Create Aliases

| Comments

Contents:

  1. Introduction to aliases @ 0:00
  2. Analysing shell history to create relevant aliases @ 4:43

Download: mov 24MB, 8:26 (Recommended)

Watch (recommended in full screen and in HD):

Notes:

Make an alias:

    alias l="ls -al"
    alias glog="git log"

Add those to your ~/.aliasrc.

Modify ~/.zshrc or ~/.bashrc (works for both):

    if [[ -r ~/.aliasrc ]]; then
      source ~/.aliasrc
    fi

View shell history: history

View count of common commands:

    history | awk '{ print $2 }' | sort | uniq -c | sort -n
    history | awk '{ print $2,$3 }' | sort | uniq -c | sort -n

Use that output to create better aliases!

Here’s some of my favourite aliases:

    alias ..='cd ..'
    alias ...='cd ../..'
    alias ....='cd ../../../'
    alias .....='cd ../../../../'
    alias be='bundle exec'
    alias g=git
    alias ga='git add'
    alias gc='git commit -v'
    alias gca='git commit -v -a'
    alias gch='git checkout'
    alias gl='git pull'
    alias gst='git status'
    alias l='ls -al'

Machinist and Association Validations

| Comments

While upgrading to Machinist 2, I had a hell of a time getting blueprints with associations to actually save.

The problem turned out to be that the code was using validates_presence_of :hometown_id, where hometown is the name of the association, and the solution is to use validates_presence_of :hometown, or the newer version: validates :hometown, presence: true.

If you have a given class:

class Viking < ActiveRecord::Base
  belongs_to :hometown

  validates_presence_of :hometown_id
end

and blueprints:

Viking.blueprint do
  name { "Heiðrek" }
  hometown
end

Then calling Viking.make will properly return an unsaved Viking object (with a Hometown object viking.hometown), but valid? will return false.

Calling Viking.make! will throw an exception: ActiveRecord::RecordInvalid: Validation failed: Hometown can't be blank

If you really want to keep using validates_presence_of :hometown_id, you can modify the blueprint like this:

Viking.blueprint do
  name { "Heiðrek" }
  hometown { Hometown.make! }
end

Then Viking.make! will succeed. Viking.make will also work, and will return an unsaved Viking object, but it will actually create and save the associated Hometown object, which negates part of the point of calling .make instead of .make! (make creates objects but does not save them to the database, giving quite a performance boost for test suites).

The proper solution is to adjust the validation in your model:

class Viking < ActiveRecord::Base
  belongs_to :hometown

  validates :hometown, presence: true
  validates_associated :hometown
end

The key is that we’ve changed validates_presence_of :hometown_id to validates :hometown, presence: true. The validation actually checks the association itself, not the presence of an id field (which is only ever set once the hometown is saved).

We’ve also added a validates_associated :hometown call, which will check hometown.valid? before saving, and if the hometown fails validation, then the viking object will as well.

See API docs about validations here: