/customers/iconara.net/iconara.net/httpd.www/blog/wp-content/plugins/wp-super-cache/wp-cache-phase1.php Iconara » 2007 » January

Archive for January, 2007

The Google Alphabet

I got a weird idea and started googling all the letters of the alphabet to see which pages had managed to SEO themselves into the top position. The results are quite interesting — well, to be honest, some are boring, but perhaps half are surprises — and you can see some trends: W3C specifications and Wikipedia entries for letters are common, if not on the top position then in the first page. Also Google has trouble with apostrophes, so the top hits for the letter s are all companies with names ending in ‘s. Jennifer Lopez is the only person who makes it to the list, but when I re-checked the results today (I did the initial searches yesterday) she had been bumped down to fifth place for the letter J. She’s still in my list because I kept all the data from the first run, and it would be a shame to remove the only person.

Read on for the complete list.

Read the rest of this entry →

Parsing JSON using ExternalInterface

I wrote about this in my last post, but I thought it important enough to give it it’s own post:

var json : String =
    "{a: 1, b: 'hello world', c: [1, 3, 4, 5]}";

var o : Object = ExternalInterface.call("function(){return " + json + ";"}");

The variable o should now contain an object representation of the string json.

Disclaimers: this is most likely very slow, and it is by no means secure. The same caveats as using JavaScript’s eval function applies. If you recieve JSON from an untrusted source, don’t do this.

Abusing the ExternalInterface

The documentation for the ExternalInterface.call function says that it takes as first argument the name of a JavaScript function. That isn’t really true, you can abuse it and make it run arbitrary code, which is actually very handy.

Before I start thinking aloud on the possibilities of this, let me first show you the proof. Try this code:

ExternalInterface.call("function( ) { alert('weeeha'); }");

Read the rest of this entry →

Safari on Windows

There was some rumors some weeks back that Apple was going to release Safari on Windows. I didn’t pay any attention to it then, but it struck me the other day that it’s quite likely. Perhaps not Apple releasing Safari, but someone releasing a WebKit-based browser for Windows — because really, Safari is more or less just a shell on top of WebKit.

I can even give you a when: as soon as Adobe releases Apollo.

Apollo will be built on top of WebKit, so WebKit has already been ported to Windows (which couldn’t be very hard, since it came from KDE to start with) and writing a fancy web browser UI in Apollo should be easy as cake.

We’ll be seeing Safari on Windows very soon.

New HannaCecilia site

I just launched a new portfolio site for HannaCecilia make up & hair.

HannaCecilia HannaCecilia portfolio site

The most interesting technical aspect of the site is the background image. The idea is that the pictures should appear to be stationary, while the camera/you is moving. The window should also be resizeable to any size. To do this is ActionScript without having a huge background image (to work with my 23″ cinema display it would have to be enourmous) was a bit of a challenge. But thanks to the bitmap API in Flash 8 I created a routine which monitors the position of the camera and the size of the window and repeats the background image (which is about 800x800px) to completely fill the window, as well as remove parts that are no longer needed in order not to waste too much memory.

MXMLC WTF (2)

Error: Method marked override must override another method.

public override function toString( ) : String {

WTF? How can mxmlc not know that Object defines toString?

Hmmm, it seems like you don’t need “override” on methods inherited from Object… oh, how I love those exceptions to the rules.

But whoa? This happens when I remove the “override”:

Error: Call to a possibly undefined method toString through a 
reference with static type net.iconara.logging:LogPattern.

return pattern.toString();

(LogPattern is an interface, the toString method is declared in the class BasicLogPattern, which implements LogPattern)

WTF #2 is that mxmlc doesn’t understand that an interface type is also always of type Object.

mxmlc is probably the most stupid compiler since the ActionScript 2 compiler.

The solution? Why, you have to counter a stupidity with another stupidity:

return (pattern as Object).toString();

API documentation is not documentation

I have started to play with ActionScript 3 and the command line mxmlc compiler (which is free, horray). Adobe has posted some interesting libraries on labs which I’m interested in trying out. When you download the frameworks you get three things, the compiled swc, the source and the documentation.

Except you don’t.

You don’t get any documentation. What you get is the generated API “documentation”, which is like throwing a gadget without any visible clues as to how it’s operated in someones face and say “you figure it out”.

Its such a waste of good code! Some of the frameworks have tens of classes in them, how do I know which ones to use? I’ll have too look through everything just to get an idea of what it can do.

A simple “this is the bare minimum of code you need to do X” would suffice, from there I can experiment my way to understanding the whole framework.

If you are going to distribute a framework or library, at least include an example of the most common usage of the framework. If you can’t bother doing that, don’t bother releasing it.

Luckily there seems to be (more or less) third-party guides to some of the frameworks, so I’ll get by. It still makes me disapointed, however.

FireBug!

Firebug - Web Development Evolved

FireBug is one of the best tools I have used. Web development without it wouldn’t be the same. It’s been really really good for quite a while now, fantastic even, but there has been one feature missing, an activity monitor which shows how images and files load, like Safari’s Activity Monitor. The latest version has one, and it’s sooooo much better than Safari’s, showing timings both in numbers and graphically. It also has a profiler.

What can I say, one of the best tools (rivaled only by TextMate) in my web development toolchain just got a lot better. From the top there is no way but down, but not for FireBug.

Why on earth isn’t there any tools like this for ActionScript development?

Apollo will use WebKit

According to the Apollo FAQ will include Apple’s WebKit, the HTML renderer and JavaScript engine in Safari, Dashboard and other Mac OS X applications (as well as some new Nokia mobile phones, I belive).

This is good news for Apple, as WebKit will gain some ground in that area, but not very surprising when you think about it. To use the host OS native web browser engine is not an option since it unecessarily would make Apollo less platform independent; the Internet Explorer engine is also out of the question since it isn’t supported on any other platforms. Then there are Gecko, Opera or developing a new one. The latter is too much work, and not worth it. Opera would probably work, but they are quite marginalized as it is and Opera is currently focused on the mobile market. Then there is Gecko, but there is a reason why Apple chose to go with KHTML and not Gecko a couple of years back: Gecko is huge, a beast. WebKit, née KHTML, is leaner and has already shown that it can be ported to mobile devices. The FAQ actually states that WebKit was chosen because it had a “Minimum effect on Apollo runtime size” and “Proven ability to run on mobile devices”, which Gecko doesn’t.

Oddly enough, this isn’t in line with Adobe’s recent decision to give away the ActionScript runtime to the Mozilla foundation. But on the other hand, that doesn’t really have anything to do with Apollo.

I’m really looking forward to see what Apollo will be able to do. In my mind it spans the web-desktop divide which is quite exciting.