2011-01-30

The web and thus JavaScript is slowly turning into a great platform. Part of the allure of the (partially) competing Java platform is that it has a core that goes beyond “Java the language”: The Java Virtual Machine (JVM). There are now many languages that target the JVM, for example: Groovy, JRuby, Fantom, Jython, Scala, ABCL, Clojure, and Gosu. Java class files store JVM programs as Java bytecode, a compact binary format that source code is compiled to. Does JavaScript have something similar?

In this post, I present a short example that should explain the basics of jQuery Templates and quickly get you started. It also demonstrates a technique to cleanly handle separators between array elements. This technique applies to many other templating engines, so read on even if you don’t plan on using jQuery Templates.

Big companies often use Content Delivery Networks (CDNs). Such a network consists of servers spread all over the world that all host the same content which ensures fast delivery. Some CDNs also host popular JavaScript libraries for the public, for free. Dave Ward gives three reasons why you might want to use such hosted libraries instead of storing them next to your own code:

2011-01-26

I love that Twitter enforces brevity, it only breaks down for one thing: URLs. In order to not waste precious characters, people turn to URL shorteners. Twitter even provides one by default. Shortened URLs such as http://goo.gl/ZeNmF are evil for several reasons:

We all know that Apple’s Ping is quite ... underwhelming. Its existence seems unmotivated, a tepid me-too effort from Apple. And what’s with the name? If they wanted it to sound like a search engine, “Bong” or “Bang” would have been nicer.

Marco Arment explains how InstaPaper works its magic. In case you don’t know: InstaPaper has a bookmarklet that, when clicked on, uploads the current web page to the InstaPaper server. Afterwards, the page can be downloaded by one of the InstaPaper apps for offline reading. Naively, you would expect the bookmarklet to send the URL of the current page to the InstaPaper server which would then crawl the contents of the page. But that would not work with sites where you need to log in. Thus, Arment implemented the following hack.

Category “intriguing useless facts”: On Macs, you can use two fingers to scroll an area. But then you move your fingers in the opposite direction that you would on a touch device. Attempt at an explanation:

I am not sure that this is an improvement over glasses, but it is certainly intriguing: You attach a pair of patches to your temples and they move your eyelids so that you see pictures on a monitor in 3D. Picture and video after the break.

2011-01-22

Non-ad from reddit. Note the link for ranking underneath it (that is also used for real ads).

I really do get it: Many ads are atrocious and there are often too many many of them. But currently ads are the only way that free content on the web can be financed. So if you like free content, you probably should not block ads. An alternative to ads are voluntary micro-payments for content [1, 2], but they are not yet a viable source of income and never may be.
Instead of ad-blocking everything by default, I suggest the following approach:

2011-01-21

He’ll star in the Fringe episode “Firefly” (which airs to tonight, for those of you in the US). Spinoff Online has details, an interview, and a trailer. It seems that Fringe has hit its stride this season, all episodes have been received very positively by critics.

John Resig has written a post on HTML5 (most people seem to write it without a space before the “5”) parsing. Before HTML5, parsing was ad-hoc. Netscape was the first popular web browser and its lenient parsing lead to many web pages containing all kinds of syntactical errors (the HTML “tag soup”). Afterwards, other web browsers mainly tried to replicate the bugs and features of the Netscape parser. Bad news: HTML5 did not opt for a much cleaner syntax. Good news: There is now a specification about how to parse HTML. It makes the tag soup the de facto standard. While it is scarily technical (you didn’t expect a grammar, did you?), it does bring stability for browser implementers.

TIOBE Software published its annual TIOBE Programming Community Index. The ranks are led by the usual suspects Java, C, C++, and PHP. But the language that grew most in popularity in 2010 was a bit of a surprise:

This happened to me recently: I had an 11MB bitmap PDF and wanted to rotate all pages. After I did that and saved it, its size had grown to 31MB. I did some searching and found a way to do this with a command line tool: pdftk. With pdftk, the file stayed the same size after rotation.

Interesting technology. Wi-Fi Direct allows devices to talk to each other in a manner similar to Bluetooth (Engadget has details). I see a lot of overlap with Zeroconf (Apple’s Bonjour, Microsoft’s Universal Plug & Play): You need to see what services are available in your environment and you need to be able to connect to them. For Zeroconf, the environment is the LAN you are currently in. For Wi-Fi Direct, the environment includes any supported device within close range. I wonder how much Wi-Fi Direct is compatible with other protocols. It would be a shame to have yet another protocol for service discovery.

Wi-Fi Direct probably supports pairing and that is also useful for Zeroconf. For example, by locking your printer away, you can prevent people on your LAN to print on it.

The history of computing has seen many different ways of interacting with devices and new ones are invented frequently. This post groups these interactions into three contexts and then discusses what they mean for the future of device interaction.

The supercomputer “Watson” plays jeopardy. The box at the bottom shows three possible answers Watson came up with and its confidence (in percent) in each one of them.

Quite an impressive feat: An IBM-built supercomputer won against two humans playing Jeopardy. Note that the questions were not typed into the computer, it had to understand them when spoken. This shows that much progress has been made in natural language processing, but it still has to be a limited domain, where, I assume, questions follow certain patterns. Engadget has details and a video.
There is a HAL-like animation on the screen of the computer (which is even mentioned in the Wikipedia article on HAL). As an aside, what acronym do you get if you advance each letter of HAL one position in the alphabet? This has been rumored to be the source of the name, which has since been denied by the author.

I see it every day: The more popularity, responsibility or power someone has, the more others want from them. Thus, what one needs is a way to manage these demands without appearing unfriendly. The following points can help.

Prior solutions

Some JavaScript framework authors took matters into their own hands and implemented surprisingly capable layout on top of traditional CSS. Others (such as Qooxdoo) perform layout calculations in JavaScript and recompute the layout every time they receive a resize event. That is not as smooth as relying on CSS, but leads to more capable solutions.

Palm presented Enyo, a framework that allows one to dynamically change layout depending on the size of the screen (think cell phone versus tablet).

Grid Layout

Now there is a new proposal out, by Microsoft. It is called Grid Layout. It has got everything one could wish for: Define a grid with flexible and fixed columns and rows, place your HTML elements on that grid, etc. It has the hitherto unavailable option to let content occupy the minimal space possible (e.g. vertically, in a horizontal toolbar at the top of a view). In current CSS-driven and JavaScript-driven solutions, you need to specify pixels as a work-around and that is a very fragile solution.

The Satarii Star Accessory is a stand that swivels so that the iPhone’s video camera is always focused on you. “You” in this case means whoever carries a clip-on remote with them, so this has many applications. One example that comes to mind is capturing a video of someone who holds a presentation or lecture. It can be especially useful while practicing, because you get a good look at yourself without having to involve other people. The project is crowd-financed and currently still shy of its goal of $20,000. Check out their web site and introductory video. More details:

When you buy the iOS game Kijjaa, you are actually buying the remote control. The real game is Flash-based and started via a web browser, usually on a desktop or notebook computer with a large screen. I like the idea. Clearly, they are managing everything via their web server and this makes sense, because it is convenient and allows them to easily upgrade the game. I can also imagine the iPhone itself serving this kind of game (mirroring some of the ideas in my post on cloud computing).

Interesting article on MacRumors: “Questionable Rumor Claims Safari and iTunes to Merge Into Single Application”. A complete merge does not seem like a good idea, iTunes is already much too bloated and I don’t see how browsing the web fits with browsing your media. What does make sense, though, is to move the iTunes store, and possibly other means of acquiring media, to the web. Amazon lights the way with its Kindle bookstore: Its combination of website for purchase and app for consumption is perfect. A web-based iTunes store would have the following advantages.

Dealing with hostile people is difficult, because they often
expect to be loved for hating you, much like a child communicates with a
parent. But you are not their parent and thus should not have to put up
with their hostility. Here are a few tips that make things easier for
everyone involved.

2011-01-16

One of the greatest challenges of the web has been how to pay the people who produce (freely accessible) content for it. For example, you find an article you like and would love to support the author, but don’t know how. Or, it’s paid content that usually costs too much and does not allow you to see in advance if it is worth its money. Until recently, there was no middle ground between free and too expensive. And it hurts publishers. Ideally, a publisher would write a free article that, thanks to it costing nothing, is read by, say, one million people. If each of those people paid one cent, the author would earn $10,000. To make small donations viable, there has to be a company that aggregates the money that is spent and the money that is earned. But it is not easy to get such a company going, because you need both publishers and consumers on board. Flattr, a Swedish company, is currently giving micro-financing web content (text, software, music, etc.) a shot.

2011-01-15

This post explains how to show Google’s Adsense ads directly after the content of each post, before the comments. Currently, one can only show them after a complete post, which means that they will be pushed back to the very end on single-post pages.

Bryan Singer, who directed that film, had managed to convince every one
of the major actors in that movie that they were in fact Keyser Söze. I
remember when we screened it for the company of actors, Gabriel Byrne
was stunned that he wasn’t Keyser Söze. Went out into the parking lot and had an argument with Bryan Singer. For a half an hour. [Source: Spinoff Online]

Much has happened since my last “wish list” for blogger: The new editor is great and fixed many of my complaints. Some of it still stands, and I have a few more things that I would like to see improved. This post may come across as bitchy, but I’m very happy with Blogger, in general. It gives you a lot of freedom (ads...) and its styles look good (much better than what Wordpress offers).

How many games have you played that were so spooky you actually had to stop playing them at one point to catch a breather? Usually when the game tells you “hey, you have to go back to the scary area™” you go “bring it on – I know where the monsters are now, so I’m no longer afraid”. When Amnesia told me I had to go back to the Choir area I said fuck that shit, and went to browse reddit for a bit, because I was totally not ready to re-experience it after the first time. [Terminal Incoherency]

Great idea: it’s a monster game, but you are just Joe Normal running away from them – no heavy guns or magic shields. That means you will relate to your game persona, which seems to make the game scary.

2011-01-14

CoffeeScript is a new syntax for JavaScript. The idea is to fix some of JavaScript’s deficiencies while staying so close to it that one can handle the “compiled version” in an emergency. I like the idea, but not all of it is an improvement. This post will first critique CoffeeScript and then present Brendan Eich’s simplified “paren-free JavaScript”.

2011-01-13

iPad: Skim content, go back and forth quickly. I’m in this mode when I read technical books that teach me something. Then the Kindle’s display is too slow.

Kindle: Calm sequential reading, no distraction. I’m in this mode when I read fiction or more narrative non-fiction. Then I don’t want to be tempted by web and email and don’t want the slightly eye-straining backlighting.

Gimp is a free drawing program with a slightly quirky user interface. The Mac version runs on X11 which is a window environment that is used on most non-Mac Unixes and results in it not being a “true” Mac application. It is still very useful, though. Tips:

Snow Leopard has X11 installed by default, no need to do anything but download Gimp.app.

Gimp shows its tool palette in a separate window where one always
needs two clicks to make something happen (one to activate the window,
one to do something). To fix: go to “X11 → Preferences → Windows”. You have two options:

Click-through Inactive Windows: Performs window activation and an action with a single click.

With the possibility of manual adjustment: Go to the “Rectangle select tool”, select something, click on “Auto Shrink” in the toolbar. Next invoke “Crop to Selection” in the “Image” menu.

Automatic: Invoke “Autocrop Image” in the “Image” menu.

Finding out the best compression ratio: If you save a lossless image format such as PNG to a more compact format such as JPG, you can get a live preview of how the compression affects image quality. Very useful for trying out different settings.

Apple seems to be testing iPhones and iPads that don’t have home buttons, any more. Fascinating that we have heard about button-less designs from Android, first.
Making the use of the button optional is a good idea, because it changes (relative) position if one rotates the device. But eliminating the button completely does not make sense, because it is useful for beginners. Gruber has more arguments in favor of keeping the button:

How in the world would you get home on an iPhone using a five-finger
pinch while holding it one hand? The iPad seems like a “maybe”, but I
find it really hard to imagine a Home-button-less iPhone. And even with
the iPad, what about people who don’t have five fingers on one hand? No
iPad for them? The iPad is very popular with impaired users. What about
taking screenshots?

ARM is already completely dominating the cell phone and tablet space (chips based on its architecture are in all Android and iOS devices). This will make it a serious contender for desktops and laptops.

Case in point: Microsoft will port Windows to ARM.

It’s great that Intel will get some competition. AMD has not really been up to that task in recent years. Power consumption is becoming an increasingly bigger issue for servers (electric bill) and for consumer machines (compact, fan-less designs), so Project Denver could be very attractive.

Apple is already making many of its desktop machines as small as possible and uses mobile processors in iMacs and Mac minis. Maybe they will use the chip in Macs. This migration would require quite a bit of work (and thus might not be worth it), but Apple has the technology to do so, as poven by its migration from POWERPC to Intel. iOS can already be considered a port of Mac OS to ARM.

2011-01-09

“My sister’s keeper” [amazon.com, itunes.de] is one of the saddest movies I have ever seen, without being depressing. Amazing performances by all actors, especially by the kids. The mother’s drivenness is the main cause of conflict in the movie, but thankfully the script (and Diaz) refrain from vilifying her. I wonder if the book the movie is based on is as good as the movie. [Source of movie cover: Amazon]

2011-01-08

Sad. VLC on the iPad was a killer app, because to watch a video, you just copied the file to the iPad and were done. No transcoding, no importing into iTunes. Here is some background on why it happened:

Copying links to web pages is tedious, because you have to go to them twice in order to copy both URL and title. The following three bookmarklets help speed up that process by letting you copy everything in one go. Click on a link to try it out or move it to the bookmarks bar to use it later, on any page.

In this post we present the Proto API which implements inheritance in JavaScript in a purely prototypal fashion. This contrasts it with all other JavaScript inheritance APIs that the author is aware of.

Home theater surround sound is currently transitioning from 7.1 to 9.1 which has the drawback of needing to re-encode all 7.1 content. The following idea would make audio content independent of the number of speakers:

[...] record where the audio is supposed to come from, instead of which speaker it should be played on. This way a movie would never need its audio remastered again, because the fact that the plane coming in at 2 O'Clock wouldn't change no matter how many speakers you had, it wouldn't even matter if you had a speaker placed precisely at 2 O'Clock. So basically your AVR [audio/video receiver] would render the audio on the fly based on the number of speakers, and where you placed those speakers by using the recorded sounds and the data about those sounds.

Motorola is taking another shot at the idea that a cell phone is mainly a computing core and only needs a full-sized keyboard and a larger screen to become a laptop. It’s been done before and I think it mainly appeals to engineers who, because they are trained to see patterns, tend to abstract too much. Is there a better solution for integrating the myriad of devices we own? How about the following?

2011-01-04

Nice piece at Mac Rumors. Prices largely stay the same, expected sales range from 10% to 200% of the iOS version.
I’m surprised that so many iOS developers seem to make the jump to Mac OS. This might well be one of Apple’s most clever moves. They leverage that all of their devices (with the exception of the smallest iPods) run the same operating system. The app store has the potential immensely increase the Mac’s appeal, especially for casual gaming. I wonder how much the iOS origin will show (negatively) in the user interface of the ports.

It is a major nuisance: You run a Unix program on the console, it wants text input from you, but all you can do is type and remove the most recent character. No arrow keys and no input history. Java console programs are notorious for this. A work-around is to use the Emacs shell mode as follows:

Start Emacs. Use the -nw (no window) option if you want to start it inside the console.

Type Esc-X “shell” Return

Now text input is much more comfortable.

History: Esc-P goes to previous text input, Esc-N moves forward in time. You can also just move around the screen with the arrow keys, edit and hit Return.

One realistic movie that immediately came to my mind was “2001” [itunes.com, itunes.de], which was largely hard sci-fi. Another one is “Minority Report” [amazon.com, amazon.de] for whose technology Spielberg consulted researchers. Both movies contain fantastic elements that probably turned NASA off and show how difficult such lists are to make. Also amusing that NASA files “What the bleep” under sci-fi. See their choices below.

2011-01-03

The music video “Flight Of The Navigator” is rendered live in a web browser and includes 3D graphics (thanks to the new 3D graphics support in browsers via WebGL) and embedded videos. You need the latest Firefox or Chrome betas to watch it (in theory, at least; Chrome did not work for me).

2011-01-01

The following are two nice analyses of the state of smartphone computing. I like reading anything that does not make the assertions that “Android is open” (what does that actually mean in practice?) or that “Android is Windows” (a flawed analogy).

Sencha (creators of ExtJS) has published their wishes for HTML5 in 2011. I would love to see more operating systems make web applications first-class citizens. Currently, the only ones that do, that I am aware of, are Chrome OS and Web OS.

I usually hate lists that say “x things that y” whenever x is larger than 7 (or if I think that y is boring). But “97 Things Every Programmer Should Know” [uk, de] is a great, if completely unorganized, collection of software engineering ideas. The complete content is available online for free. It should be read more like a software engineering calendar with the idea of the day than a systematic introduction to a topic. As an example, I liked “The Golden Rule of API Design” which says that if you want your API to be truly useful, you have to make sure that programs that use it can be tested. That is, you have to test programs that use the API, in addition to the API itself.
[Source: Raja Kannappan]

I’m still getting used to the idea that one delivers programs for JavaScript virtual machines (VMs) as JavaScript source code and not in some kind of binary format. With parsers being fast, there is just one more intermediate step that is only performed once, when loading a program. Once the feeling of weirdness wears off, it seems logical that people would implement programming languages on top of JavaScript, especially with recent speed advancements that happened for JavaScript VMs. This website is a comprehensive listing of all programming languages that have been “ported to” JavaScript.