Welcome

This is a personal blog about things that I like to call my interests; namely Music Production and Computer Programming.

If you are looking for my app called Tanis Health Calc go to this page.

Posted in Uncategorized | 3 Comments

Good stuff..

It is certainly nice when you feel like the work you do is appreciated. With our latests update of the momondo Flight Search app we have gotten featured by Apple on the App Store. Pretty darn cool. :D

Posted in Uncategorized | Leave a comment

Foooood..

I have started a food blog where I will be sharing my adventures into the culinary. Have a look if you are interested:  Foodgeek Blog

Posted in Life, the universe and everything | Leave a comment

Baby, baby, baby, oh yeah, baby.. ;)

Tenacious D is coming to Denmark on monday and I am going, so here is my ‘tribute’ ;)

Posted in Music, Recordings | Leave a comment

River in my Dreams (Remastered)

It’s been quiet on the blog for years, so I thought I would make it less quiet by posting a little song I recorded a while back. Enjoy.

Posted in Music, Recordings | Leave a comment

Method overloading in javascript/prototype

Outlined in this post by John Resig (Mozilla nut and general JavaScript guru) is an idea on how to implement method overloading in JavaScript.

The idea in general is good, but honestly, using only parameter count as the way to distinguish between functions can be a bit limiting in my opinion, so here is my take on it, which builds on prototypes object model.

Also an important part of me is aesthetics, and I like the way that prototype declares its methods. Here is the syntax I came up with:

var Test = Class.create({
  initialize: function () 
  {
    console.log('init');
  },

  // regular method
  test1: function (num, str)
  {
    console.log('test1(num:'+ num + ',str:"' + str + '")');
  },

  // overloading using an array of functions with different
  // parameter counts
  test2: [
          function (a)
          {
            console.log('test2(a:"' + a + '")');
          },

          function (a, b)
          {
            console.log('test2(a:"' + a + '",b:"' + b + '")');
          }
        ],

  // overloading using an array of objects that specify
  // the function parameter signature and the functions
  // themselves
  test3: [
          {
            signature: [String],
            method: function (str)
            {
              console.log('test3(str:"' + str + '")');
            }
          },

          {
            signature: [Number],
            method: function (num)
            {
              console.log('test3(num:' + num + ')');
            }
          },

          {
            signature: [Number, String],
            method: function(num, str)
            {
              console.log('test3(num:'+ num + ',str:"' + str + '")');
            }
          }
        ]
});

Using the following test script:

var test = new Test();
test.test1(1, 'test string 1');
test.test2('test string 2');
test.test2('test string 3', 'test string 4');
test.test3('test string 5');
test.test3(2);
test.test3(3, 'test string 6');

We get the following output in Firebug/Firebug light:

init
test1(num:1,str:"test string 1")
test2(a:"test string 2")
test2(a:"test string 3",b:"test string 4")
test3(str:"test string 5")
test3(num:2)
test3(num:3,str:"test string 6")

All in a nice and neat little package. Here is the actual code. Plug it into your site wherever appropriate:

Function.prototype.getName = function ()
{
  var name = /\W*function\s+([\w\$]+)\(/.exec(this.toString());
  if (!name)
    return 'No name';
  return name[1];
};

Class.Methods.addMethods = Class.Methods.addMethods.wrap(
  function (callOriginal, source)
{
  var properties = Object.keys(source)

  for (var i = 0, length = properties.length; i < length; i++)
  {
    var property = properties[i], methods = source[property];
    if (methods instanceof Array)
    {
      if (methods.all(function (m) { 
        return typeof m == 'function'; }))
      {
        source[property] = function (methods)
        {
          var args = $A(arguments);
          args.shift();
          methods.each(function (m)
          {
            if (m.length == args.length)
              m.apply(this, args);
          }, this);
        } .bind(this, methods);
      }
      else if (methods.all(function (m) { 
        return typeof m == 'object'; }))
      {
        methods.each(function (m) { 
          m.signature = m.signature.inject([], 
          function (s, v) { return s + v.getName(); }) });
        source[property] = function (methods)
        {
          var args = $A(arguments);
          args.shift();
          var argSig = args.inject([], function (s, v) 
            { return s + v.constructor.getName(); });
          methods.each(function (m)
          {
            if (m.signature == argSig)
              m.method.apply(this, args);
          }, this);
        } .bind(this, methods);
      }
      else
        throw 'Unknown contents of overload array';

    }
  }
  callOriginal(source);
});

Testing using Prototype 1.7 and Firefox 4.0, Chrome 11.0, Internet Explorer 9.0 (+compatibility mode), Opera 11.01, Safari 5.0.4.

Posted in Javascript, Programming | Tagged , , , | Leave a comment

Vintage photograph tutorial

So, I felt like doing a little bit of Photoshopping, so having been playing around with Hipstamatic on my iPhone latety, I thought I would give it a try, and do my own take on a “vintage” photograph.

I ran to my hallway to get a reasonably clear background (note to self: remove stuff on the wall next time), and I snapped this picture handheld with no flash or anything:

The original image

The original image

After importing I noticed quite a few problems with the image, but didn’t really feel like posing again, so I fixed them using couple of Photoshop techniques:

  • I fixed the background using the Lasso Tool and content-aware fill (had to do it a couple of times).
  • Then I fixed the skin highlights, by:
    • Adding an empty layer above the background and set the blend mode to Darken
    • Then using a Healing Brush Tool with Sample set to All Layers and the source set to a nice clean piece of skin I drew over the highlights.
  • Used the Clone Stamp Tool to remove the red spot in the right eye.
    • I fixed the iris using a Dodge Tool: mid-tones, exposure 50% and doing a couple of twirls on the irises.
    • I rounded the pupils using a black Brush Tool (50% hardness).
    • I added a new highlight to the pupils using a white Brush Tool (10px, 25% hardness).

    This was the result:

    The cleaned up image

    The cleaned up image

    Then I needed a nice “grungy” border, so I went Googling until I found this site that had 5 interesting free borders. I picked one, resized it to my pictures dimensions and copied it to the top layer.

    The last thing I needed was to make the actual image vintage, so I fired up Alienskin Exposure and looked through the different films, finally deciding on “Kodachrome II” which also included dust and scratches. I turned up the dust and scratch parameters, and almost turned the vignette to the maximum.

    The final result:

    The finished image

    The finished image

    I am sure there are 100′s of ways to make a picture look vintage. This was my way. I’d probably do something different another time, but I think it looks pretty good.

    Posted in Photography, Photoshop, Portraits | 2 Comments

    Getting aquinted with Lightroom 3.0

    Over time, I seem to be taking more and more pictures when I have a photo session. It is great to have a lot of different images to choose from, even if they might be close in look. You might get that “special” one where everything comes together like you wanted it, instead of sitting there going: “I like the eyes on this, but the mouth on that”.

    I have to admit, it was getting increasingly cumbersome to manage a huge number of photos, selecting the shots, doing standard editing like white-balance, contrast, color matching and so on.

    It is not really possible to load all 300 shots in Photoshop at a time, so you have to load 10 or so, maybe perform the same things, so for me the obvious that I needed something that could help me do that.

    I have been using Picasa for a number of years as my photographic organizer and importer and I have actually been quite happy with it. You cannot argue with the price tag, and it is very fast and has some nice features.

    Since I am already a happy user of Adobe Photoshop; Lightroom seemed like the choice for me. I had a look at it at version 2.7, and actually felt quite confused with the work flow, but I decided to give it another go.

    I picked an old photo session with my daughter a few years back. The quality of the pictures is actually pretty low, since I did not own a flash gun at the time, and I really hated the look of the built-in flash, they were taken using high ISO, but there were a number of shots that had to be sorted, selected, and processed.

    I also wanted to make sure that the pictures had the same overall color tone, which I had not achieved during my first processing of the pictures.

    I worked out a pretty nice work flow. One of the pictures required a little bit of clone brushing to remove some stray hairs so that got worked in as well. All in all, I have to say, that I think Lightroom will make my life a lot easier, when it comes to processing a large amount of pictures at the same time.

    Here are the 5 shots that I picked from 86:

    Posted in Photography, Portraits | Tagged , , | Leave a comment

    An old world of watercolors

    Having just gotten a new scanner I decided to have a look at my old watercolor paintings. Without much of a struggle I found 4 really old ones that I liked.

    This one is my very first. Painted in 1980, at the age of 9:

    Solnedgang - Es Fuego - Mallorca (1980)

    Solnedgang - Es Fuego - Mallorca (1980)

    In 1984 I went through a stage of being fascinated by ships and the sea, and I painted these 3 (and more):

    Skib i uvejr (1984)

    Skib i uvejr (1984)

    Sejlskib (1984)

    Sejlskib (1984)

    Forankret Skib (1984)

    Forankret Skib (1984)

    Having looked at these old paintings, I find them rather good. Interesting use of colors and I actually like the stroke. They are by no means perfect, but I am actually considering going down to the craft store and picking up some watercolors again.

    Posted in Photography, Watercolor Paintings | Tagged , , , , | Leave a comment