Quote of the Day
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.
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.
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.
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.
Too me this one is a life saver. It helps you calculate font-sizes for baselining text.
Generate CSS3 code for border radius, box shadow, text shadow and more!
Specific tool that generates CSS3 gradient code.
You know you want to abide to web standards? The best online tool that works anywhere.
If I can't use http://compass-style.org/ I prefer this tool to generate a CSS grid.
Placeholder text
Placeholder images
Not really a web app, but very useful. Copy and paste special characters.
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.
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.
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.
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..
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.
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?
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..
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 .
One of the best resources I've read on creating CSS speech bubbles Pure CSS Speech Bubbles. Be sure to check out the demo page
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.