22.11.2010 19:48

Back in April Facebook announced support for the Open Graph protocol, a simple RDFa vocabulary for encoding metadata into web pages. Some thought that given Facebook's immense popularity this will finally tip the scales toward a true semantic web and will entice authors to start including structured information in their web sites. Some even thought this will made the social activities on the web more open and not just open a new conduit through which Facebook can suck in more data.

If you still think this attempt will bring a significant change to how people write web pages, please have a look at the Open Graph data included at a random page on one of the top 100 sites on the web:

<meta property="og:site_name" content="Answers.com"/>
<meta property="og:url" content="http://www.answers.com/topic/albert-einstein" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Albert Einstein"/>

This RDFa block tells me that I'm looking at a website and gives its URL, domain and title. In other words, it takes 292 bytes to tell me nothing I don't already know. Information that this page contains an encyclopedic entry about a physicist is as hidden as ever.

Yes, this is only one example, but I think it shows exactly how web reacts to novelties. Make browsers display pages that don't validate and none will bother to make their pages valid. It's the same thing.

Posted by Tomaž | Categories: Code | Comments »

Timings now and then

19.11.2010 21:22

I've encountered this table of timings for typical operations on a modern PC at a few different places lately. I can't add much to what has already been said about it: without question it is something every programmer should be aware of.

execute typical instruction1 ns
fetch from L1 cache memory 0.5 ns
branch misprediction 5 ns
fetch from L2 cache memory 7 ns
Mutex lock/unlock 25 ns
fetch from main memory 100 ns
send 2 kB over 1 Gbps network 20,000 ns
read 1 MB sequentially from memory 250,000 ns
fetch from new disk location (seek) 8,000,000 ns
read 1 MB sequentially from disk 20,000,000 ns
send packet US to Europe and back150,000,000 ns

For fun and to put these numbers into historical perspective I've put together a roughly equivalent table for Galaksija.

fetch from main memory 1,000 ns
fetch from ROM 1,000 ns
execute typical instruction1,500 ns
branch 4,000 ns
read 1 kB sequentially from memory 8,000,000 ns
read 1 kB sequentially from tape 30,000,000,000 ns
send packet US to Europe and back1,000,000,000,000,000 ns
(depends on postal service)

These numbers also approximately hold for Sinclair Spectrum and other home computers of the era. Note the changes in orders of magnitude in both columns that happened over the last 30 or so years.

Posted by Tomaž | Categories: Code | Comments »

Electronica 2010

13.11.2010 15:13

This was a busy week. First a trip to Vienna and then to München to visit Electronica 2010 fair. I spent a day there which is way too little time for anything more than a quick trip through all the halls and a chat or two. If it has anything to do with electronics it was probably on display there.

Entrance to Electronica 2010

First thing I found out is that nobody expects you to be there only to see pretty things first hand and find out about the latest developments in the field. As soon as you stop for a moment in front of a stand to have a closer look at something that looks interesting someone will run to you and start talking. Which is great, until the discussion inevitably turns into how many tens of thousands of components you're looking to buy or how many of those five-figure dollars oscilloscopes you need. Which in my case made for a kind of an awkward end of the discussion.

While everybody was trying to shove cheap plastic pens, cups and bags into your hands (practice which I successfully avoided) apparently nobody would give you anything useful, like a sample of their latest component that could be used for prototyping. How weird is that? On a related note the iPad currently appears to be the ultimate attention grabber. Every other company was offering a chance of winning one in exchange for spending a few minutes at their booth.

Oh, and I managed to fall prey to a couple of American hard-sell types from which I almost had to run away. You know, the type of guys that won't take no for an answer, even when you tell them you're not even remotely interested in what they're selling. Now I know how what a human equivalent of e-mail spam is.

From a more technical standpoint, I expected more from the Displays section of the fair. I've seen only one E-ink display and OLEDs were limited to applications like tiny MP3 players and such. Rather than on new display technologies the focus seemed to be on smart LCD panels that have very high-level interfaces and are simple to use (i.e. "draw line here" commands instead of accessing a framebuffer).

On the equipment side the trend of having Windows running on your oscilloscope continues. On one hand these things offer some really nice features like on-the-fly decoding of various digital protocols and very long time windows. On the other hand you (still) get pop-ups reminding you to update your anti-virus software. Not that nice, especially if it happens while you're demonstrating the scope in front of potential customers.

Finally, one thing worth seeing first hand were the few automatic PCB placement and testing machines on display. It's just amazing how fast and accurate those tiny robotic probes and manipulators are getting.

In conclusion Electronica 2010 was worth a visit although I've seen no terribly surprising things. It would probably also be worth staying a day longer to attend a talk or two. The only bad thing about it is that when you get back to reality you realize that most of the components and equipment you saw there are only available to people designing for production runs that go into millions of items.

Posted by Tomaž | Categories: Life | Comments »

Österreichischer Perlworkshop 2010

08.11.2010 20:38

I did a brief hop to Vienna over the weekend to attend the Austrian Perl Workshop organized by Vienna.pm, the Perl user group of Vienna.

Turned out this was really kind of a local event and all other registrations from abroad happened to be an internal joke of some kind. Now that I think about it, I can't actually remember how I heard about the workshop in the first place. It was just noted in my calendar as something that would be interesting to go to. Anyway, most talks were announced to be in German, so I was prepared to brush up on my knowledge of the language. However many speakers decided to switch the language for the benefit of two of us who understood Perlish English better than Perlish German. Nice gesture, but my attendance there still felt a bit awkward at times.

Space invaders at Metalab

Workshop took place at Metalab, a hacker basement a bit like Kiberpipa. Except they have way more of their projects randomly on display around the place. Felt more organized in some ways and more chaotic (in a positive sense) in others. I'm not sure how long a self-serve-pay-and-restock bar would be running in Ljubljana, even if it was equipped with an IP-connected fridge and some wall-mounted VT-100 terminal hooked up to a barcode scanner. On the other hand Kiberpipa regularly gets a new paint job (for no apparent reason) while this place has random graffiti, Cthulhu paintings and space invaders painted over peeling white paint. Anyway, Metalab would deserve a post of its own but I was unable to find someone who could actually tell me something about it first-hand. Perl Mongers just got the room for their workshop and granted I wasn't there much at their preferred time between 8:00 pm and 1:00 am.

Back to Perl, there were quite a few interesting things to hear.

Thomas Klausner showed how his company develops Perl code, from Git branching strategy to how they integrate all communication systems with IRC. He gets 10 points for being a hacker and rolling his own Twitter, even though it's a little difficult to follow without any RSS feeds or such. But that's not that unusual for a Perl hacker's blog.

Reini Urban did a showcase of the latest revision of the illustrated version of the manual that documents Perl internals, lovingly called perlguts. We also discussed his beginnings of a just-in-time compiler for Perl. A brave attempt with lots of hand-crafted assembly and I'm guessing it will someday turn into something like psyco was for Python.

Worth mentioning are also Wiki::Toolkit, a bunch of abstract tools for making Wiki-like websites and Template::Zoom, a templating system without templates (kind-of). I'm pretty sure Michael Renner's PostgreSQL replication talk was awesome as well, it's just that I understood too little of it to learn anything.

Not much was heard about Perl 6 which I found interesting but not very surprising. Its effect however was felt as its features inspired useful modules and additions to version 5.

So in the Austrian capital at least, the Perl community appears alive and well even though the greater Internet spotlight seems to have moved to other languages. Metalab looks like a wonderful place and perhaps Kiberpipa should at least attempt to make contact.

Posted by Tomaž | Categories: Life | Comments »

GNU ls timestamp format

04.11.2010 22:09

This is just in case someone else will find this little piece of Unix trivia useful.

The terse date and time format used by GNU ls -la - you've probably seen it a thousand times. Where does it come from?

It appears to be sensitive to the LC_TIME locale setting:

$ export LC_TIME=sl_SI.UTF-8
$ ls -l
-rw-r--r-- 1 avian avian 0 apr 23 15:56 foo
$ export LC_TIME=en_US.UTF-8
$ ls -l
-rw-r--r-- 1 avian avian 0 2010-04-23 15:56 foo

My first guess were the system-wide locale settings, say in /usr/share/i18n/locales/en_US. However, while that file contains a number of date and time formats, none match those used by ls.

GNU fileutils source code reveals that those are actually stored in the program's specific message translations. The formats use the same gettext mechanism as when localizing messages. They are stored in the source in .po files (for instance in coreutils-8.5/po/en.po).

Obvious, once you find it.

Posted by Tomaž | Categories: Code | Comments »