bradKELLETT

Javascript Worker Threads – the Unsung Hero of Modern Browsers

The release of Firefox 3.5 and Safari 4 a few weeks before it heralded the implementation of a feature that I believe will push web application development into the next age. The feature, called Javascript web workers, will allow web apps to have far more advanced features without the slowdown experienced even with today’s Javascript-heavy websites.

So what is a web worker? Broadly speaking, it is a way to implement threading in Javascript. If you aren’t familiar with threading, it is essentially the ability to split your application into multiple sections, called threads, that can run in parallel. This means big things for Javascript driven web sites – imaging having your main Javascript handling the user interaction side of things, while a separate thread is running in the background polling your server for new information, which can then be passed back to the main thread to display to the user. Instead of having to throw together setIntervals and the like, it can all be happening in the background with no disruption to the user.

A good example of this in practice is Google Reader. It could benefit from implementing web workers in two places: the infinite scrolling feature, which loads more items as you are scrolling past the current list of items, and the polling it does to update unread counts on the left pane. I notice the slowdown whenever either of these events happens, and both could easily be shifted into separate threads.

Firefox 3.5 and Safari 4 now implement web workers as described in the WHATWG’s draft specification (give or take). Browsers that support Google Gears, including Google Chrome, also support web workers through a separate implementation, described in Google’s WorkerPool API documentation. While spawning a thread takes different calls, inter-thread communication is handling the same way, and a library called jsworker is already available to wrap the two implementations.

Mozilla’s example of setting up a web worker thread shows just how easy it is to throw some code in a JS file and spawn it as a thread, and I’d encourage anyone interested to give it a read.

Review of the Fever RSS Reader

Fever List View

Fever List View

The premise of Fever is simple: your current RSS reader is full of unread items that you’ll never get through, you can’t keep up with the volume, and you don’t want to add more subscriptions for fear of compounding the problem. Clearly, Fever is aimed at RSS ‘power users,’ and people with only a few subscriptions should probably save themselves the effort and stick to a simpler solution like Google Reader or NewsGator. That said, can Fever really live up to the premise of saving you from second inbox overload?

Read the rest of this entry »

iTunes App Store Statistics

TechCrunch today published an article based around an iPhone developer’s experience monetizing his applications in the App Store. As part of that article, some statistics were cited that didn’t entirely make sense to me. For example, the author states that there are only 36,000 apps in the store, which seemed surprisingly low.

Long story short, I wrote some code, did some mining, and ended up crawling the entire US iTunes App Store, and from this I have compiled some statistics.

Read the rest of this entry »

Cuil: We Get Over It

Note: Opinions expressed here are my own, and not that of my employer, Cuil.

Google is full of creative, smart, and innovative people, but above all else, they are a fantastic PR machine. Sometimes it’s because of a carefully executed PR plan; sometimes it’s just because they are such a household name; either way, anything the giant does becomes news.

There is discussion at the moment about Google stealing the up-and-coming competition’s thunder, and I’d be lying if I didn’t feel the same at times. Take Cuil’s recent launch of timelines, followed just a few weeks later with Google’s News Timeline launch, and inclusion of it’s experimental timeline result view into the normal search results days later. We tweaked our related searches to make them better, then Google did the same thing a short time later (there are others doing related searches as well, it’s just a good idea).

But you know what? We get over it.

Competition is good for the industry, and we welcome it from competitors big and small. Google wouldn’t be the successful company it is if they didn’t notice what was going on around them and react accordingly. Any company looking to catch up to Google is doing the exact same thing.

Cuil is largely written off in the press, so we never expect to get the same reaction when launching new features. That’s not going to stop us: we’re going to keep innovating and trying to make discovering information easier and more enjoyable. If Google wants to implement some of our ideas, they can go right ahead – the difference is in the execution, and every search engine needs to learn that ideas are only half the equation. You need to take these ideas and make them into features that average people enjoy using. We try to create a human-focused search engine, easing exploration, instead of being a dull list that amounts to a popularity contest.

We’re not as big as Google yet, but we’re still here, and we’re not going to stop bringing a fresh perspective to search.

TweetDumpr Updates

Just a quick note to let folks know that I’ve finally taken the time to rewrite TweetDumpr. It now actually works again, plus it’s quite a bit faster as well. The two limitations are that it will only be able to get the latest 3200 tweets from your timeline, and it will only work for unprotected users (feel free to temporarily unprotect your timeline then lock it down again when TweetDumpr has done it’s thing).

Leave a comment on this post or use the contact form if you have any problems or requests.

Things in America That Australia Needs

I’ve been living in the United States for almost a year now, and there are a few services that I use very regularly that would do fantastically well if someone were to bring them to Australia. It’s been a while since I’ve been home, so someone could have started these already, but here is the list of things that should really be in Australia:

  • Craigslist: This is the No. 1 thing I’d miss if I moved back home. Fast, easy, super simple online classifieds. In Australia, you have to turn to eBay or Trading Post, which aren’t nearly as quick and easy. There is a Sydney Craigslist category, but that’s as far as it goes – the beauty of Craigslist is in the refined localization.
  • Threadless: Yes, almost my entire wardrobe is made up of Threadless shirts. Sure, you can get them shipped, but it takes forever and can be costly.
  • Amazon: The entire online department store scene in Australia is horrible, bring Amazon in please.
  • Google Voice: I could care less whether it’s from Google or not, but the GrandCentral/Google Voice model is a winner and should absolutely come down under.
  • PhoneTag: Short of a full Google Voice style system, voicemail-to-text services are almost as awesome.
  • Fandango: Online movie ticketing just makes sense. Buy online, pick up at the theatre with a swipe of your card.
  • Public WiFi: It’s starting to pick up in Australia, but there is a heap of public WiFi in the States. Not all of it is free, but at least it’s there at a pinch if you need it.
  • Hulu: I don’t use it all the time, but online video streaming is great. NetFlix to the Xbox 360 and other TV-connected gear is a great idea too, I just hate NetFlix’s implementation of it.
  • Mint: This is by far the best way to manage your money. Awesome on every level, from the elegant and information-rich web interface, to the handy SMS notifications and savings tips via email.

And a few offline things that rock too:

  • Unlimited bus transport for $1.50: Muni might be dirty, but the price rocks, especially with unlimited transfers for four hours.
  • ZipCar: Car sharing is awesome. I hear that it’s just starting in Sydney, but it needs to be everywhere.
  • At home snail mail postage: you can just leave letters in your letterbox, and the postman grabs them when he does his rounds
  • Bikes on public transport: more a San Francisco thing than a general USA thing, but CityRail needs bike cars like Caltrain has.
  • Bike lanes: San Francisco still doesn’t have enough, but it at least has some bike lanes. These are sorely missing in Australia, and really do encourage people to leave the car at home.

Obviously, this list isn’t exhaustive, but could someone please bring them to Australia? Thanks, I appreciate it…

Announcing Swapcove

The economy is tough on everyone at the moment. No one goes completely unaffected, and many people are left with lower, if not non-existent, income and in most cases lots of unwanted possessions. Despite this, basic human wants don’t go away – people still want new books, new skis, new clothes, but selling items can be hard because a lot of people are in exactly the same situation as you.

To help address this, I’m pleased to announce the launch (albeit in a very early form) of a new service called Swapcove. Brainchild of my co-founder and good friend Luke Watson, Swapcove is a site that aims to streamline the process of swapping what you have for what you want.

Swapcove makes it simple to list as many items as you like – not just the things you want to get rid of right now, but also the things you might get rid of if the right offer came your way. You can then browse the listings by category, location, or other attributes, and make an offer on something you want by creating packages of items. Packages mean you are not just trading single item for another item, but a collection of items that you feel match in value. The other party can then accept or reject your offer, or create a counter offer of his or her own based on what you proposed.

These are clearly early days, and we have a long list of features we’d like to implement, but for now we just want to get something out there and see if people are open to bringing back the old concept of barter in an economy where money is not quite as easy to come across.

Love it? Hate it? We’d love to hear your feedback – head on over to the GetSatisfaction page and tell us what you think.

Better iPhone User Agent Regex

David Walsh recently published a blog post detailing how to detect iPhone and iPod Touch users on your website via the user agent string, and while the concept is fine, I much prefer a slightly different method using regex to do the detection. In PHP:

  1. if(preg_match(‘/Apple.*Mobile.*Safari/’, $_SERVER[‘HTTP_USER_AGENT’])  {  
  2.     header(‘Location: http://yoursite.com/iphone’);  
  3.     exit();  
  4. }

Using this regex, you are not only covered for the iPhone and iPod Touch (in one call, even), but also potentially for any future Apple mobile devices.

And for those interested, the actual user agents for the iPhone and iPod Touch are variations of:

Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3

Working with Development Frameworks

I recently had a slap-in-the-face kind of realization moment after getting quite a ways into a project using an off the shelf development framework. In this case the framework in question was CakePHP, and the realization came in two parts:

  1. I realized that I didn’t like the syntax of the framework, even for doing basic things
  2. Because of the fact that I didn’t like the syntax, things that should have been relatively simple were taking much longer than necessary

It was from here that I made the almost hurtful decision to start again, this time building everything from scratch. Now I couldn’t be happier, partly because of the fact that the project itself is going far quicker and easier than before, but also because I know that the usefulness of this framework will go far beyond this project.

You see, now that I have built a framework that jibes perfectly to my programming style, I can apply it to future projects as well. This is how Ruby on Rails started, and I’m sure how most of the popular frameworks started.

Now here is where I throw out a crazy suggestion – I think all developers should have a go at writing their own framework at some stage, even if it never gets into any of their production work. The benefits of this are two-fold – not only will they now have some knowledge of how the inner magic of a framework happens, but they will have a solid base of framework-y functions that they can use in both personal and professional projects moving forward if the need arises. If you are working in a larger team in your professional life, you might even be lucky enough to customize your basic framework as a collaborative effort for a future project.

Don’t get me wrong, I’m certainly not discouraging the use of existing frameworks if they do what you want, I just think that developers should not take things at face value, and ensure they know not only how to use a framework, but also how it does its thing, and from that come up with reasoning on why they are using it.

And for the record – my framework is called Seven, and it’s the best framework in the world, ever…

See Protected Content – be the Googlebot

I’m sure most of us have had the problem – search for something with Google, see a search result appear that is exactly what you’re looking for, only to find that when you click through to the page you get told that you must log in to see the content or (gasp!) pay to see it in full. Well, there is a simple way around this: pretend to be Google!

Sites like these detect when Google is crawling their site and show the full content, but don’t give regular people the same luxury. Sites generally detect this by looking at the user agent, which is a string that identifies what kind of browser/device is requesting the page. Therefore, if we change our user agent string to match that of the Googlebot (the system Google uses to find content on the web), we can see the content that was indexed to make the search result we found.

There are various ways to change the user agent that your browser is reporting, including the great User Agent Switcher extension for Firefox, or the IE7Pro plugin for Internet Explorer 7.

Whichever way you go about it, you want to change your user agent string to:

Googlebot/1.0 (googlebot@googlebot.com http://googlebot.com/)

You may have to restart your browser for the change to take effect, but after that you should be able to go back to the site you were trying to access and see exactly what Google does – the content!

About

Brad Kellett is Senior UI Developer at Cuil and all-round technologist, with interests focused around web development and user experience.

[Read More]

Twitter

  • Like a good American on Independence Day, I'm going shooting tomorrow. The transition is complete... [#] 3:36pm
  • I just used Time Machine for the first time ever, for a pretty low-importance file, but none the less... [#] 2:05pm
  • That's it I'm sick of both Photoshop and Firefox 3.5 for the day. Seriously, Firefox 3.5 should fear my wrath from all this crashing. [#] 5:37pm
  • Constant crashes in Firefox 3.5 today. Three in that last 10mins [#] 2:39pm
  • @iamww dang, tweetie isn't coming up as an update for me yet. Look forward to search working again. [#] 11:23pm
  • I'm in love with Javascript web worker threads - http://bit.ly/LdgeT [#] 10:42pm