Visualizing the offline application cache update progress

I wrote about using the HTML5 application cache earlier, mostly focusing on generating and serving the manifest file using ASP.NET MVC. I also bitched about how not one browser I know of gives an indication of the application cache update progress. Today I wanted to write something about how you can visualize the application cache update progress yourself. The applicationCache API has several useful and rather straightforward events we can handle to inform the user of the update progress. ...

April 11, 2012 · 3 min · Jef Claes

Check for local file browsing with JavaScript

Because I do most of my research while commuting by train, I often pull entire websites offline using httrack. While browsing the [jQuery Mobile documentation](http://jquerymobile.com/demos/1.1.0-rc.1/ locally this morning, I stumbled upon following gem. I was curious to see how they determine whether a page is browsed locally or not. Looking into the source, I was a bit dissapointed to find nothing but plain common sense. The trick is comparing the protocol of the current location with known local protocols. ...

April 2, 2012 · 1 min · Jef Claes

Add images to a GitHub readme

Today I wanted to add some screenshots to a GitHub readme for the sake of documenting. While this wasn’t particularly hard, I do had to iterate a few times before I got it right. Hosting the images You could simply add the images to your repository and reference them using the raw url’s, but this isn’t very efficient. Using this method, every request needs to go through GitHub’s application layer. It’s far better to make use of GitHub Pages, a feature purely designed to publish web content. I also like how you’re not polluting the repository this way. ...

April 1, 2012 · 1 min · Jef Claes

How a web application can download and store over 2GB without you even knowing it

I have been experimenting with the HTML5 offline application cache some more over the last few days, doing boundary tests in an attempt to learn more about browser behaviour in edge cases. One of these experiments was testing the cache quota. Two weeks ago, I blogged about generating and serving an offline application manifest using ASP.NET MVC. I reused that code to add hundreds of 7MB PDF files to the cache. public ActionResult Manifest() { var cacheResources = new List<string>(); var n = 300; // Play with this number for (var i = 0; i < n; i++) cacheResources.Add("Content/" + Url.Content("book.pdf?" + i)); var manifestResult = new ManifestResult("1") { NetworkResources = new string[] { "*" }, CacheResources = cacheResources }; return manifestResult; } I initially tried adding 1000 PDF files to the cache, but this threw an error: Chrome failed to commit the new cache to the storage, because the quota would be exceeded. ...

March 25, 2012 · 2 min · Jef Claes

Sent from my phone

According to Matt from 37signals the line “Sent from my iPhone” at the bottom of an email means this: Let’s be honest. “Sent from my iPhone” really means “I’m not going to bother to proofread and correct this because it would take me an extra 30 seconds.” I agree. I too use this line as an excuse to write a terse message and omit proper salutations. However, I also think these four simple words greatly helped the viral growth of the mobile phone. Having early adopters brag about how they’re sending emails from their fancy new phone must have been an invaluable form of word-of-mouth advertising. ...

March 17, 2012 · 2 min · Jef Claes

HTML5 Offline Web applications as an afterthought in ASP.NET MVC

Recently I prototyped a mobile web application using ASP.NET MVC, jQuery Mobile and some HTML5 features. One of the key goals was to find out how far you can push a web ‘application’ until the browser starts getting in the way. Working disconnected is one of these things that appear to be a major showstopper at first. However - to my surprise honestly - the HTML5 Offline Web applications API seems to be widely implemented across modern browsers already. Not of all of them though. Looking into the specifics, the API itself is fairly straightforward. At his core, you will find the manifest file, which dictates which files should be cached by the browser. The API provides other useful events and methods for inspecting the status of the cache and swapping the cache for a newer version, but they are out of scope today. A useful resource to read up on the full API can be found here, and a working example implementation can be found here. ...

March 14, 2012 · 5 min · Jef Claes

Learning: the Hacker Way

I have had a fair amount of discussions on continuous learning and knowledge sharing the past few days. It became rather obvious that a lot of us have developed their own techniques, but also that maybe most of us are still in search of more efficient techniques. Having gone through several phases myself, I would like to share my current way of learning: the Hacker Way. Here are some snippets taken from a recent letter from Mark Zuckerberg addressed to the Facebook shareholders. ...

March 11, 2012 · 4 min · Jef Claes

ASP.NET MVC4 bundling in ASP.NET MVC3

One of the new wildly evangelized features of ASP.NET MVC4 is the built-in support for bundling and minification of scripts and stylesheets. I don’t see any reason why this new feature wouldn’t work for ASP.NET MVC3 though. If you open the packages config of an ASP.NET MVC4 beta project, you will find that bundling support lives in the Microsoft.Web.Optimization package. <package id="Microsoft.Web.Optimization" version="1.0.0-beta" /> So we should just be able to install this package for an ASP.NET MVC3 project. To install the package, run following command. Pay attention to the -Pre switch. ...

February 25, 2012 · 3 min · Jef Claes

There's no place for monogamy in technology

In this post I would like to share some of my thoughts on a recent post by James Hague titled ‘Don’t Fall in Love With Your Technology’. If you haven’t read that post yet, please do, it’s so short that me summarizing it here would be silly. I think there is nothing wrong with falling in love with your technology per se. If you want to have a fair relationship with your technology, you have to invest in her. Don’t have a superficial relationship, take her home with you, spend some cosy Sunday afternoons together. Get to know her inside out. Know when it’s fun to be with her, but also more importantly when it’s not. ...

February 20, 2012 · 2 min · Jef Claes

Book review: Working with NHibernate 3.0

It’s been a while since I wrote my last book review, mostly because I’m still trying to figure out when it adds value to write one. For this one it was pretty obvious, there are far too little reviews out there. Being new to NHibernate, and NHibernate being known as having a steep learning curve, I thought it would be a good idea to do some reading. Searching for books on NHibernate 3.0 on Amazon only yielded three results: NHibernate 3 beginner’s guide, NHibernate 3.0 cookbook and working with NHibernate 3.0. None of these books have a decent amount of reviews, so I had to pick judging by the cover and summary. I chose the last one. ...

February 8, 2012 · 3 min · Jef Claes