Moving in!

Miscellaneous May 30th, 2009 @ 00:05

As of now, I’m moving the blog, Really Aced, from the WordPress servers to my own, blog.sommestad.net (this is where you are, if you haven’t noticed :-) ).
The reason to this is to get more control over the site and be able to customize however I want. Also, I thought I’d better use the sommestad.net domain for something… :-)

The site design will probably change and evolve over time, maybe when I feel like shaking things around a little. Apart from that, the blog will stay the same.

Welcome!

Note: I’ve re-added all posts from the old blog to this one, while still leaving the old blog as is. Hence, the dates of posts prior to today, aren’t correct. Also, there are some comments missing too (those added by others than myself).

I noticed that I could export and import everything from the old blog, so I did that instead.

Sometimes you’re just an honest guy trying to script

JavaScript May 27th, 2009 @ 18:05

Today, I ran into some JavaScript security issues that cost me a few hours too many of my life.

I wanted to show the user a confirmation message when closing a pop-up (OK I know, but sometimes you just got to use them!) to make sure he doesn’t lose any data when leaving.

But we can do this! Right…?

This isn’t really any big issue, as the onBeforeUnload event can be used for these exact scenarios, with a nice message too:

window.onbeforeunload = function (event) {
    // message to display (in between the standard message provided by the browser)
    return "Leaving now will have you lose everything."
};

The special case here was that I had a SWF running in the window, which needs to be unloaded (close its connections etc) when closing the browser window. That has to be done in the onBeforeUnload event as well, since it’s too late when we’re at onUnload.
The problem is that there’s no way of knowing what the user answered to the question arisen from onBeforeUnload, other than finding out when the event’s traveled onwards to the onUnload event. By which time it is too late.

So I ended up in a situation where everything was fine if the user decided to keep the browser window open (“Cancel” in the confirmation box), but should he close the window – which is fine too – I had no way of closing the connections etc in the SWF.

But why?

The reason to this is of course a security matter. Some clever fellas have set some restrictions to what you can do with Javascript to avoid misuse, for example extreme annoyance with pop-up ads or such. There’s nothing wrong with that.
But sometimes you just want to yell to JavaScript’s mom and tell her that I’m a perfectly honest guy trying to make the world better for my users! :)

What would’ve helped me

So what do I want, then? Well, it would’ve been nice if I could’ve gotten an answer from the confirmation box rendered with my custom message (“OK, leaving now…”).
It’s perfectly fine that the unload event cannot be stopped once the user’s said “OK, close”. But at least I would’ve wanted the chance to act upon the user’s choice before the document was unloaded.

So my final solution was just to warn the user that everything was hitting the fan, and at the same point notify my SWF that it was to be unloaded etc. It’s an OK solution, but not perfect from a usability perspective…

End of rant.

New Champ Man Online out!

Jadestone May 19th, 2009 @ 19:05

Today, we released the new version (2.0) of Championship Manager Online!

These are the release notes from the CM-Online team:

  • Achievements – A new way to compete in CM-Online.
  • New graphical style – for faster playing and easier to use.
  • Tournaments – They are now free to play.
  • Premium and regular managers – Now it is available to play the game for free, with certain restrictions.
  • Cup – We have changed the international cups to the correct format.
  • Economy – An overhaul have been made to the economy in order to balance the game.
  • Stadium – Balanced the effects when improving your stadium to make it more worthwhile.
  • Fans interest – Improved the logic to better reflect the fans interest for successful teams.

As a veteran CM-Online Manager, I’m of course pleased to see the new design and maybe most of all; the new achievement system! Now I’ll get a whole bunch of new challenges to take on… :-)

Another highlight is that it’s now possible to play as a Regular or Premium member. Premium members get more and better features, but playing as a Regular is free of charge.

I’m of course biased, but a nice release nevertheless! :-)

Google Books seems to be another awesome tool

Miscellaneous May 14th, 2009 @ 08:05

A while ago I started looking at Google Books. I’ve been reading sporadically about Google’s book effort for a few years, but I’ve never really dug into it. After making a few book searches, I can tell that it’s an awesome product!

The search results have really met my demands so far, and much of the contents of the books are available to read on-line. As many of the books are protected by copyright, the publishers (from what I’ve understood, anyway) decide which pages to publish on-line. From what I’ve seen so far, they’ve more or less randomly removed a few pages here and there, to encourage the reader to buy the book to get the full contents. And that’s fine by me!

I think it’s a great tool to use when searching for development material (“I know I read it in this and that book, but I don’t have the book now…”) and when you want to get a good preview of a book before going all-in on Amazon.

Try it out yourself!

(Every time Google does something like this, I get more and more scared they’ll begin charging us big-time soon… :-) )