Twonav for iPhone is now available
CompeGPS Twonav is an awesome piece of GPS navigation software, featuring both onroad and offroad navigation.
The iPhone version is now available on the AppStore and it definitely looks like the best GPS navigation app for iPhone ever.
Oh and it features a well-known FTP server :)
Get it while it's hot, it's really worth the price.
Application-controlled browser cache using local storage.
In order to reduce latency and improve the user experience, using client caching is the web development 101.
Setting correct HTTP server-side headers in order to instruct the web browser to keep the content in its local cache, has become straightforward with modern web servers (for static content), frameworks and middleware layers (Rack!).
However, this is only a hint. The actual caching policy remains up to the web browser. Setting HTTP headers doesn't give applications any control nor feedback about what's really going on client-side.
Specifically:
- You can't tell whether a resource is already in the client cache or not (ok, you can, but by making extra requests, which is, outside the scope of a demonstration, exactly what you're trying to avoid),
- You can't tell whether what you asked the browser to cache was actually cached or not
- You can't invalidate a cached resource
- You have no way to prioritize cached content. A huge Javascript should probably stay in the client cache as long as possible, while a 20 bytes-long transparent GIF image is no biggie if it has to eventually get reloaded. The only knob you have on the browser cache is a deadline (which is almost always, and should be, "immediately" or "never"), and it doesn't allow any kind of real prioritization.
- Some web browsers, like Safari (and UIWebView components) on the iPhone have a ridiculously small cache.
- Watching your web server delivering so many 304 replies is driving you nuts.
Fortunately, the HTML5 specs bring an exciting feature: client-side storage. Thanks to localStorage et al., web browsers now provide a convenient way to permanently store big chunks of data, giving applications full control of the data store. While the primary target was offline web applications, client-side storage can also be extremely helpful in a bunch of other situations.
When you think about it, what's the difference between local storage and cached resources? Not much, except that local storage is fully application-controlled, and can solve every issue listed above!
A good example might be a huge Javascript that you really would love to keep cached. It doesn't mean that additional content like pictures shouldn't get cached as well, but you know that this specific script is critical and that users won't be able to see anything but a blank page till this one isn't ready for action.
Here's the trick. Instead of using a script element, this very script can be loaded using XHR, then eval()'d. Since the script is available as a regular string, storing it as an entry in the browser data store is a piece of cake. Checking whether the script is already in the cache is also as easy as checking a key for existence. Invalidation is as easy as deleting the entry. This way, we get a totally user-controlled browser cache.
Here's a real-life example: Geobar
Geobar was specifically designed for iPhone and Android devices. It relies on the OpenLayers scripts + some custom Geoportail scripts. All packed together, we get 1 Mb worth of data that are absolutely mandatory for the page to display. And this is where local storage works wonders.
function load_scripts() {
if (window.localStorage["geoapi_js"]) {
window.eval(window.localStorage["geoapi_js"]);
} else {
var xhr = new XMLHttpRequest;
xhr.onreadystatechange = function() {
if (this.readyState != 4) {
return;
}
if (this.status != 200 && this.status != 0) {
alert("Error: " + this.status);
return;
}
try {
window.localStorage["geoapi_js"] = this.responseText;
} catch (e) { }
window.eval(this.responseText);
};
xhr.open("GET", "geoapi.js", true);
xhr.send();
}
}
This is enough to keep the script in the data store instead of relying on the traditional HTTP cache.
Why not use an HTML5 manifest instead, you may ask? To start with, the manifest still doesn't give you much control about the cached content. And further HTTP requests made from a resource loaded this way have no Referer, which might be a showstopper, as it was the case here.
Of course, the same trick can be used in order to store other kind of resources like stylesheets, and, why not, hex-encoded images.
While HTML5 makes local storage easy and powerful, almost every major web browser out there has some kind of support for local storage for ages: userData (since IE 5.0), globalStorage (since Firefox 2), and for those running behind, Flash comes to the rescue with its Shared Objects.
ICANN to open up the TLD namespace
It was just announced that the following TLDs are likely to emerge soon:
- .RADIO
- .ECO (Ecological)
- .GREEN (Ecological)
- .MOVIE (Movie/Film Industry)
- .FAM (Family)
- .MUSIC (Music)
- .HEALTH (dot health)
- .SPORT (dot Sport)
- .INDIGI (for indigenous peoples)
- .NYC (New York City)
- .BERLIN (Berlin Germany)
- .PARIS (Paris France)
- .BZH (Brittany, a region in France)
- .ENG (England, a kingdom in the U.K.)
- .GAL (Galicia, a region in Spain)
- .MED (Mediterranean)
- .LLI (Leonese Language and Leonese Culture)
- .GAY
- .WEB
- .POST
- .MAIL (for emails and to control spam)
- .GEO (generic geographical locations)
- .XXX (Adult Entertainment)
- .BCN (Barcelona)
- .LAT (Latin America)
Are those really useful or is it just a way for the ICANN to make a quick buck?
A sneak peek at the Google IO conference
Some videos of what happened at the Google IO conference are now online.
Wave really looks like a giant step forward.
Side note about spam prevention in Wave: "In the press conference right after the keynote, a reporter asked about spam prevention. Lars Rasmussen responded that it hasn't been given much thought yet, since it is a closed developer's preview for now, but also mentioned that most likely Wave would use a whitelist option, where you'd have to add a friend/coworker before they could send/invite you to Waves."
Meanwhile, Microsoft just launched a real-time focused version of IE8 using OneRiot components.
Beyond horizontal scalability
An excellent presentation by the guys from Igvita.com called "Henry Ford and the event driven architecture".
Online file converter that really rocks
Just a cool link I had to share: Cometdocs.
Comet Docs is almost able to convert from any format to any other format. And it's all free and online.
It can read/write from/to audio files, text files, HTML, PDF, spreadsheets... it can recode a text file into any characters set, it can determine files formats, etc.
This is that kind of link you should keep in your bookmarks because sooner or later, we all need some tool like that one.
Scientists extract images directly from brain
Researchers from Japan’s ATR Computational Neuroscience Laboratories have developed new brain analysis technology that can reconstruct the images inside a person’s mind and display them on a computer monitor.
Not sci-fi any more. But actually frightening. I definitely don't want my girlfriend to discover what I'm dreaming of :)
Easily download the files of a web site
Give it any URL and File2HD will let you easily download the files that a web browser would load for that URL.
For instance, give it a Youtube URL, and you can immediately download the .MP4 file if there is a high-quality version of the video (it's just an example. If Youtube's AUP forbits this, don't do it).
File2HD can be very handy if you have to use a browser that has no similar feature (Firefox has cool extensions in order to do so).
Need an emergency DNS cache?
If you're stuck with a host that has no working DNS cache, and if you forgot OpenDNS IP addresses, you can always use 4.2.2.1 and 4.2.2.2
Those IP addresses are Level 3's public DNS caches.
They are easy to remember and they won't answer on non-existent zones like OpenDNS does. And they are very fast. And Level 3 keeps their servers up-to-date.
But they are standard caches. For real use, if you aren't planning to run your own cache, nothing can beat the features of OpenDNS.
Speed up page loading on your iPhone
Compressing-proxies aren't new. Tools like Rabbit and Ziproxy (happy birthday) were used a lot on dialup links a while ago. But then, as we got faster links, we forgot them.
However, then are still very effective nowadays, for mobile devices like the iPhone. Public Wifi spots are often slow. These proxies make your web browsing experience way better. Really. Try to access popular web sites with and without them, and you'll get addicted to those proxies.
Yes, 6 x 9 = 42
#define NINE 8 + 1
#define SIX 1 + 5
int main(void) {
printf("%d times %d is %d\n", SIX, NINE, SIX * NINE);
return 0;
}
Online version of OpenOffice.org 3
Here's a serious challenger for Google Docs: through Ulteo, it's now possible to run OpenOffice.org 3 online.
No need to install anything, a Java-enabled browser is enough and you got 1 Gb of free storage.
How to avoid IE CSS hacks using conditional classnames
Paul Hammond reminds us that IE conditional comments also work in the HTML code.
It's quite neat because that way you can avoid IE CSS hacks (like the infamous "* html" hack) and use a class instead.
Mirror :
If you use this HTML:
<!--[if IE ]>
<body class="ie">
<![endif]-->
<!--[if !IE]>-->
<body>
<!--<![endif]-->
with CSS that looks something like:
div.foo {
color: inherit;
}
.ie div.foo {
color: #ff8000;
}
then you get all of the advantages of using conditional comments to work around problems in Internet Explorer, without the extra HTTP request of an IE-only stylesheet.
Thanks to Paul, and thanks to Rik24@ for the heads up.
A lookup at Google's data centers
Google has published info about how their data centers work.
The part about evaporative cooling is really cool.
The IP address assignments map
It's as old as the internet, but it can still be interesting and it's still kept up-to-date: IANA's IPv4 Global Unicast Address Assignements
Want to see every /8 managed by the RIPE? Try:
wget -o /dev/null -O - http://www.iana.org/assignments/ipv4-address-space/ | fgrep whois.ripe.net
This map also shows how many IPv4 /8 addresses blocks are still unallocated.