HiI'mJaanus.Blog,Works.

November 2008 Archives

It sounds incredible, but it seems to be true, based on my current and very superficial experiences with two apps, namely APMobile News Network and NY Times.

Here’s the back story:

I spend a lot of time on subways on the weekdays. About an hour a day in total. And since the great city of New York does not yet have mobile coverage in subways, I can’t use anything on the Internet. But I do have my iPhone. I felt that this time would be well used to read the daily news about world and US affairs. But since Google Reader does not yet natively support offline reading (there seem to be 3rdparty apps now though for this — more below), I have tried out two news reading apps. And the results are worse than I expected and I don’t like either of them.

Why not RSS reader?

Yeah, I might read RSS, but it felt that reading the news is a bit different personal mode for me. I have all sorts of junk flowing to my RSS reader, but I want to get my daily news in writing or on TV from some “official” source (and later I read more back stories from RSS). So, my first choice was to look for apps that are affiliated with a particular trusted news source. Let’s look at where the two UI-s fall apart.

I am currently playing around with jQuery and I am in a mode where jQuery is my hammer and every imaginable web problem looks like a nail to be hammered with jQuery. So I am trying it out on various kinds of web problems, from UI beautification (from widgets like accordions and tabs, to details like rounded corners) to more structural/backendish things.

One thing I just did is very similar to screen scraping, but in a more intelligent way. I call it “intelligent screen scraping”. I’m pretty happy with my result.

In short, imagine you have two websites. Site A has a page which is something like this:

<h1>Current news</h1>
<a href="...url....">News item 1</a>
<a href="...url....">News item 2</a>
<h1>Archive</h1>
<a href="...url....">Old news item 1</a>
<a href="...url....">Old news item 2</a>
<a href="...url....">Old news item 3</a>

Your mission: to re-post the first paragraph of every item under “Current news” (but NOT archive) to site B.

Now, traditionally, you would build some sort of server-side aggregation thing. Maybe with RSS or something. But I didn’t have that luxury, and let’s say for simplicity that both of these were simple HTML pages without any backend “system”.

So I took this nail and hammered it with jQuery. On page B, I put a piece of jQuery which, as soon as page B is loaded, goes out and fetches page A by Ajax. Then it does the following magic on the DOM of page A:

$(data).find('#layerName h1:first').nextAll()
.parent().find('h1:last').prevAll().find('a').each(function(i) {
}

Which translates to the following in English:

  • In layer “layerName”…
  • … find the first “h1” element.
  • Grab all the sibling elements after that h1.
  • Then, switch back to parent context. (Sidenote: the parent-child contexts are a bit tricky to figure out in jQuery, especially in chains like this. Sometimes queries span across all the subtree while sometimes only over immediate children. The best recipe I’ve found is “read jQuery docs, google, and experiment”.)
  • Now, find the LAST “h1”… (we’re still working with children of layerName)
  • … and grab all the siblings BEFORE it. (Ending up with all the elements after the first “h1” and before the last “h1”.
  • From all the results that you have now, grab all “a” elements.
  • For each element, execute a function. (Which in my case does the second part of the above mission, and namely executes separate Ajax request for each matched link, fetches the content, grabs the first paragraph, and sticks everything to page B to the right place.)

A bit intimidating to look at, but makes perfect sense. To me, anyway. And this result in particular is nothing extraordinary, it’s just an example of the class of problems you can solve with jQuery.

Now, this exact same thing could have been done with “classic” screen scraping. But I called the jQuery stuff “intelligent screenscraping” because from my point of view it has these advantages.

  • No ugly parsing. I’ve also done oldschool serverside screenscraping where all you got was some ugly invalid HTML and you had to hammer it with a bunch of regexes to find what you need. And whenever a single byte was changed on the server side, you had to go and fix what got borken. The beauty of doing this clientside is that all the parsing is taken care of for you and you can work with a clean DOM.
  • Zero server maintenance, overhead, and caching. Well, this can be an advantage or not depending on your particular business needs. When everything happens client side, and each client maintains their own cache of a page that gets a million hits per hour, then maybe serverside caching is more justified. But at the same time fetching Ajax content this way is also subject to clientside caching and proxies. For non-script content, caching is on in jQuery, although you can turn it off if you want. I just find it beautiful that you don’t have to run anything on the server and there is no magic homebrew aggregation script which breaks 3AM Saturday morning and someone must scramble and figure it out.
  • All the subrequests happen in the security context of the end user. I find this important and beautiful from the architecture and maintenance perspective. If you are doing anything serverside, you don’t have the user’s security context (their browser, cookies etc), so typically you have some extra “system user” that has privileges to access and aggregate all the content. But then, when a user comes, you must do extra work to validate if they have permissions to really see what they are requesting. If you do clientside screen scraping, you are always operating in the “correct” security context of the actual end user, so you do not have to do any extra serverside homebrew security work.

I’m not saying that this is an ideal solution to the sort of aggregation need that I described above. But I did find that for my particular need, I got the work done with far less code than anything serverside would have been.

Another week, another game down. Just finished Metroid Prime 3: Corruption.

metroid_prime_3_boxart.jpg

I played it in the easiest, Normal mode, but I can’t say the beginning was too easy. And spent 24 hours of gameplay on it, judging by the game’s counter. If I factor in also the failed attempts where I got annoyed and quit, I think a more realistic estimate is 30 hours in total since September. In general, for a single-player game like this, somewhere between 24 and 40 hours seems the right time.

Here’s a demo video.

The Normal mode and especially the boss battles in the beginning were quite a challenge, until you got the hang of it. In the end, the rest was easy, but bosses kept getting harder. It has two harder modes, but I don’t think I’ll bother playing them.

I have not played Metroid series before, but I have played many action-adventure FPS games. (My working definition of “action-adventure”: you go around shooting bad guys while accomplishing missions/tasks and solving puzzles.) The nice aspect about this game was that it was not entirely linear. Yes, you had missions that kept advancing the plot, but you could take a break and just roam the world to scout for powerups or such. There are 100 powerups to be collected (100%), and I got 97%, but this was only because at one point if you go back to a particular location, you get a map of them.

Location design and planning in general was very nicely done. In a huge majority of the games, you only go through locations once. But here it was common to go back to the same place two or three times, because you saw cues that you’ll come back, such as doors or switches that you could not operate with your current equipment. And then you got upgrades and came back.

Here are the interesting/unique aspects of the game relative to my experience.

  • Being able to lock/target on enemies and then strafe-circle them while maintaining lock. Very handy, especially for homing missiles.
  • Morph ball and its variations. Transform to a different shape to get through many places and have unique attacks.
  • Scanning everything, but especially bosses to reveal their attack points. In some other games, you see a boss and you have to shoot a particular area on them but you have no idea how or what exactly. But here, scanning the boss helps with that.
  • VERY nice use of Wii controls. Sometimes had to do interesting waves with two hands in coordination, to e.g operate a switch while shooting at bad guys with the other hand. I am so happy with my decision to get Wii over Xbox or PS3, where I would be stuck with only joystick-style controls that I am not a big fan of.

I am giving it 8/10 because there is so much more potential to be uncovered in the following game in the series. This game was already great as it stands, but guys, you can do better in the next ones :)

I am now wondering what nice action-adventures to play next on Wii. Somehow this game reminded me of Tom Clancy Splinter Cell series (although the latter is much less shooting and more covert). I’ll probably try that. And then there are all the WW2 franchises, which are also great, but I need some change from them. Oh, and my next one will be Prince of Persia: Rival Swords. But in addition to these?

iPhone software 2.2 was released today. I don’t yet know what other interesting features it has, but it has a bunch of security updates. And this one in particular caught my eye.

Passcode Lock

CVE-ID: CVE-2008-4228

Available for: iPhone OS 1.0 through 2.1, iPhone OS for iPod touch 1.1 through 2.1

Impact: Emergency calls are not restricted to emergency numbers

Description: iPhone provides the ability to make an emergency call when locked. Currently, an emergency call may be placed to any number. A person with physical access to an iPhone may take advantage of this feature to place arbitrary calls which are charged to the iPhone owner. This update addresses the issue by restricting emergency calls to a limited set of phone numbers.

I sort of had the impression that you can only call emergency numbers, but you could call anything. But it’s fixed now. My old Sony Ericsson T610 had the same feature, but it did check that you only call particular emergency numbers like 911 (US), 112 (EU) and some others. If you tried to enter something else, it just didn’t let you.

But in case of iPhone, this is kind of a moot point because it seems to me that most people never use passcode security or SIM lock in the first place. iPhone is the first mobile phone that I have had, which does not have ANY security turned on by default, which I imagine is the mode that most people run it in. So if someone gets their hands on your iPhone, they can impersonate you and go to all the websites and read your emails that you have stored there.

I don’t know if there are extra layers for corporate security and VPN (does it prompt you for password every time you connect or something like that), but if it doesn’t, then I’d be worried as a corporate security manager. I have not really looked at the corporate policy options and features that the iPhone now has, but I imagine there are features to enforce more stringent security policies there.

As a private user, though, nobody is going to enforce your own policies, and you’d better exercise your own sound judgement. I’d just recommend turning on passcode lock for everyone. It’s a bit annoying at first, but I’d rather have that than someone looking at my private data in my phone.

My iPhone has this bug when updating the apps. it drives me crazy. Every time iTunes tries to install an updated app, I see this.

iphone_update_bug.png

This happens for all the apps. So basically my updates just don’t work. The only way I can update an app is to completely remove it from my iPhone and then reinstall from scratch. Annoying. And it has been like this for more than 6 months now.

UPDATE: this no longer seems to happen with iPhone software v2.2. Yay.

I finished playing Super Mario Galaxy. It has been named 2007 “game of the year” by many publications. And with a good reason. It is a truly brilliant game and one of the best games so far I have played in my 20-year gaming career. I still think the Civilization is the best, but I’ll give Super Mario Galaxy the second place.

super-mario-galaxy.jpg

OK, I did not really finish it in the sense of “I did everything possible and visited all the levels”. I finished it in terms of “I beat the final boss and the credits rolled”. You can keep playing it for a long time after this and unlock many new characters and locations. But after the final boss, it just feels “done” to me.

Game design

The game design (in terms of general playability, not just graphics) is really superb. I have not played other Mario series games recently, so I can’t say how it ranks against the rest of the series. Everything just feels right. And none of the boss battles are too hard. I only peeked at walkthrough a few times to understand how to solve some puzzles more efficiently, but it is perfectly possible to figure it all out on your own (unlike some other games where the designers have not been able to give you enough hints and instead just drive you nuts with nonsense solutions).

I don’t like games with difficulty levels where you have to pick your expertise level. I like self-adjusting games. And SMG is great — it starts out as easy, but the puzzles get more complicated as you go forward, and there is a natural development.

The whole game (well, up to the final boss, anyway) took me about 2 months, with about 3 hours per week.

I was trying to think of what are the downsides to the game, but I simply can’t think of any. It really is super well done. Just this game alone should be a good enough reason for anyone to get a Wii.

Music and sound design

I especially want to praise the music and sound design in this game. I have not composed anything myself in a long time, but I still think of myself as a fairly “musical” person. I pay great attention to sound ambiences and film and game soundtracks. I get annoyed when I have to speak to bad-quality woman robots.

Super Mario Galaxy soundtrack is simply brilliant. First, the music stands out on its own. And secondly, it is used in great ways to amplify the game experience, such as when you go underwater, the music becomes muted. And in boss battles, there are important sound cues to help you.

Here are my two favorite tracks — Wind Garden and Egg Galaxy. Wind Garden shows how it was recorded. Pure orchestral music and simply beautiful.

I have nothing more to say. It really is a great game. Just get the game and play it yourself. :)

I’ll quickly wrap up the series about Skype 4 beta. Previous posts have been about the (non-)disabled message edit box mystery, contact phone number editing, a confusing “email address added to profile” notice, and chat bookmarking and notification changes.

So, I’ve only covered bits and pieces of the software. And as Mike says, there are some other important features like notification and alert changes that I am not really touching at all. The above is thus a very incomplete picture.

Let me try to extrapolate a bit, though, and still try to answer a broader question: does this all matter? And how much of an improvement is Skype 4, compared to the rest of Skype and calling world?

To answer these questions, I’m going to use a simple framework that is a synthesis of different things I was taught in Master’s school and my own personal observations. The framework says that you can evaluate a given product across three dimensions: functionality, efficiency, and affect.

One of the strongest features of Skype are its text chats. In Skype 4, there are some changes to how chat notifications and bookmarks work. And mostly they are for the better.

When you go to the “Conversations” tab, you immediately see if some of the conversations have new messages to them and how many there are. You also see a “preview” of the actual message texts.

chat new messages.png

There are two types of blips, with brighter and more pale orange. I think it’s something like that the bright orange is messages received during current session, whereas the more pale orange is from previous sessions, but there isn’t really that much practical difference between them.

In either case, when you open the chat, you see these orange blips next to the new messages.

chat bookmark blips.png

All of the above is very similar to previous versions and other versions. What’s a new and very welcome addition in Skype 4 is that you can actually set the bookmark yourself in a chat. Right-click anywhere in the chat and you see an option “Move bookmark here”.

chat set bookmark.png

When you do this, the messages below the current one get the orange blip, and the chat gets an “unread” badge to the conversations tab.

This is a very powerful addition, and as far as I know, a fairly unique capability among IM/chat clients. In most others that I have used (although I haven’t really studied all the different ones recently), the read/unread stuff is much more ephemeral — once you see a message, it is marked as “read”, and that’s it. There’s no way to revert the state to unread and use this as an attention management tool, similarly to you often use read/unread markers in your email inbox.

This also highlights a change in terms between Skype 4 and the previous versions. In previous versions and other platforms, “chat bookmarking” means bookmarking the chat as a whole, so that you can access it through your contacts list or a special menu. In Skype 4, bookmarking happens within a chat, and the “old” chat bookmark feature is now called “Save group in contacts”. I guess this is also why the “old” contact groups is now called “Contact categories” — because chats are now called groups.

These terminology changes will cause some confusion over the migration period, especially if they won’t be reflected in the API or other platforms for an extended period of time, but overall I don’t think the new scheme is worse than the old one.

All in all, the capability to bookmark parts in a conversation will definitely assist with attention management.

In Skype 4, when I first opened the profile editor, I saw a message: “Note: we have added your email address to your profile.”

emailnote.png

To me, this is an example of a message where the words make perfect sense but the sentence as a whole doesn’t. What email did they add? And why? And most importantly, what does this mean to me and why would I care? The “About your privacy” link is somewhat helpful, as it explains that the emails are not displayed and can only be used in searching. Still, I’m confused by the message. It was only displayed when I was looking at the profile editor for the first time.

If this is really something that the user should know, a “Read more…” would have been helpful here.