John Gruber:

What’s satisfying about Apple’s current success is that it’s proof that you can succeed wildly by focusing first and foremost on making great products. That design does matter.

Thats exactly how I wanna make my own products.

— Written on the 25th of January 2012, filed under Memo's.

Yesterday I found out another bug involving my "favorite" browser...

Internet Explorer 8, perhaps also 7, behaves a lot differently when doing a for in loop on a array compared to the modern browsers.

Basically the thing I wanted to do was dynamiclly fill an array with elements using a predefined order.

The resulting array would look a lot like this:

var names = [];
names[0] = "0. John";
names[1] = "1. Mary";
names[3] = "3. Jack";
names[4] = "4. Jane";

The thing is I couldn't control the order in which elements would be added to the array.

So the order in which elements would be added could easily look a lot like this:

var names = [];
names[3] = "3. Jack";
names[1] = "1. Mary";
names[4] = "4. Jack";
names[0] = "0. John";

Now here is the thing. Since you have blank keys in the array you can't use a regular for loop.

In the example above names[2] isn't defined which prevents you from creating a basic:

for(var i=0;i<names.length;i++){}

The easiest way to iterate through such a incomplete array is by using a for in loop like so:

for (var key in names) {

    var name = names[key];

    if (typeof(name) === "function") continue;

    document.write(name + '\r\n');
}

This however produces unexpected resuls in IE8.

In Chrome, Safari, Firefox and IE9 it would output:

0. John
1. Mary
3. Jack
4. Jane

In IE8 this produces:

3. Jack
1. Mary
4. Jane
0. John

As you might notice IE iterates through the elements of the array by the order in which they were added.

How to fix this unexpected behavior?

The simplest solution is to simply copy the array before iterating like so:

// IE fix
names = names.slice();

for (var key in names) {

    var name = names[key];

    if (typeof(name) === "function") continue;

    document.write(name + '\r\n');
}

This will reorder all array elements accordingly.

I've created a small snippet to see the bug and fix in action on jsfiddle.

— Written on the 24th of January 2012, filed under Articles.

There are a lot of tools out there that will help any webdesigner or developer.

I use the following online tools on a regular basis.

Gridlover

Too me this one is a life saver. It helps you calculate font-sizes for baselining text.

CSS3 generator

Generate CSS3 code for border radius, box shadow, text shadow and more!

Ultimate CSS Gradient Generator

Specific tool that generates CSS3 gradient code.

The W3C Markup Validation Service

You know you want to abide to web standards? The best online tool that works anywhere.

The 1KB CSS Grid

If I can't use http://compass-style.org/ I prefer this tool to generate a CSS grid.

Lorem Ipsum

Placeholder text

Lorempixel

Placeholder images

Copy paste character

Not really a web app, but very useful. Copy and paste special characters.

— Written on the 10th of January 2012, filed under Links.

If you use grids in your design, you'll love this one: gridlover

It's a simple tool that helps you calculate baseline sizes. Beats doing the math manually.

— Written on the 22nd of December 2011, filed under Links.

Yup, I did a site redesign. Seized the moment to upgrade the old site to Rails 3.1 and place it on the Heroku platform.

  • Minimalistic design
  • Rails 3.1 at Heroku
  • Better caching (speed!)
  • Using markdown now instead of BB code
  • It's responsive now for modern mobile browsers

The site is a lot more dimmed down from the previous version. Did take a chance by coloring links black in stead of darkish red.

Bit more form over function.

Ooh, and I didn't test my site for Internet Explorer. I've decided only to support the current browser versions

Yes.. I know I' m ignorant. Screw you too.

— Written on the 14th of December 2011, filed under Memo's.

Today I've tried to update iPhoto 9 to 9.2 in order to get iCloud support. Mac OS's build in "Software update" didn't show me any updates so I checked online if anyone else was experiencing the same problem.

I found some interesting articles here and here describing the same problem I had.

Unfortunately no suggested answers fixed my problem. I even manually downloaded the update from Apple's website to no avail.

The manual update gave me an error that my iPhoto version was too old!?

Before doing a complete reinstall of iLife I figured out a possible reason the update wasn't showing up. I had previously copied my iLife applications into a folder called "iLife '11" to tidy things up.

As a last resort I moved all the apps inside that folder back into the main applications folder. I then again ran Software update and to my suprise it showed me all the updates updates for my iLife suite!

I never knew moving applications to sub folders inside the applications folder was such a 'bad' idea..

— Written on the 17th of October 2011, filed under Recipes.

Another clear example how it should NOT be..

I found out today that in order to try Adobe CS5.5 software, one is required to use the 'Adobe Download Manager' to install it.

How does this work?

  • First you need to signup for a Adobe Account using their website
  • Next, verify your account by e-mail
  • Now you can download (and install) the "download manager". You'll get Adobe Air with that wheter you want it or not..
  • Done installing, run the download manager and pray the thing starts to download your trial
  • While downloading awnser some questions regarding your profession and intended usage of the software (!?)
  • Done downloading, browse to the folder you downloaded the file, open it and follow the installation application

Clearly the download manager is a cough hughe benifit to users that want to quickly trial Adobe software...

My guess is that the only one benifiting from this crap is Adobe itself.

Why?

  • An Adobe account is mandatory
  • Installing Air is mandatory

I believe Adobe keeps moving into the wrong direction and this download manager is yet another clear example.. It's time they drop their monopoly behavior and start focussing on actually improving their paid products.

Note: If you are behind a corporate proxy or firewall you're probably out of luck..

— Written on the 11th of October 2011, filed under Rants.

I sometimes find it hard to concentrate while writing. Whether it's the television, Mail popping up with a new message or my girlfriend talking on the phone, they all get me distracted.

I decided it was time for a full screen text writing app. After some searching I found out Ommwriter (version 1). It's a zen text writer that runs fullscreen while playing ambient sounds.

It's focus is on content, not font sizes or other stuff.

You can download Ommwriter 1 for free or get it's extended brother for a few bucks at the App store .

— Written on the 26th of July 2011, filed under Memo's.

A really specific error I — nonetheless — wanted to share..

After installing the iOS5 beta 3 last night I got the following build error while compiling Tanis: error: Second argument to 'va_arg' is of non-POD type 'id'.

My code looks something like this:

@interface NSMutableArray (variadicMethodExample)

- (void) appendObjects:(id) firstObject, ...; 
// This method takes a nil-terminated list of objects.

@end

@implementation NSMutableArray (variadicMethodExample)

- (void) appendObjects:(id) firstObject, ...
{
        id eachObject;
        va_list argumentList;
        if (firstObject) // The first argument isn't part of the varargs list,
        {                                   // so we'll handle it separately.
                [self addObject: firstObject];
                va_start(argumentList, firstObject); // Start scanning for arguments after firstObject.

                while (eachObject = va_arg(argumentList, id)) // As many times as we can get an argument of type "id"

                [self addObject: eachObject]; // that isn't nil, add it to self's contents.

                va_end(argumentList);

        }
}
@end

Apple told me it's a bug in the compiler. They will likely address it in a future seed. In the mean time I've used this workaround to temporarily fix my error:

void *x = va_arg(argumentList, void*);
id y = (__bridge id)x;

The idea is to 'bridge' the argument back to a id type. Nasty, I know, but it's suggested by one of Apple's own developers.

— Written on the 12th of July 2011, filed under Recipes.