Home Theater PC

At some point I was planning on building a Home Theater PC (HTPC), but so far didn’t get anywhere. The setup I have right now, my regular PC (mostly a gaming machine) plugged into the TV and some silly cable setup to another 2.1 audio system, is working well enough.

So if this is something you’re interested in, here are some resource I gathered on the topic. To start, Martin Fowler provides a good overview of various options. He also links to Jeff Atwood (aka codinghorror), who built his own system.

A friend of mine got a setup consisting of a jailbroken Apple TV (on amazon.de, amazon.com) and a Synology NAS (on amazon.de, on amazon.com). The Apple TV runs the frontend software and streams data from the NAS. After a Jailbreak, you can put BoxeeXBMC on it, otherwise you’d be restricted to Apple’s network storage options. The Apple TV is quite cheap, the NAS isn’t, and you also need to buy disks.

Maybe I’ll revisit this sometime next year, for now my regular PC with Zoomplayer does the trick. What would you recommend?

Using junction links to backup savegames via Dropbox on Windows

This is another “I never want to look this up again” blog post, maybe someone finds it useful.

My usecase: Automatically back up savegames through Dropbox, on the one hand as an actual backup, on the other to share it across computers. To do this on Windows, you need a junction link. In this case, I moved Skyrim’s Saves folder to a Dropbox folder, then created a junction link to point back at Skyrim’s folder. I don’t want to share the init files across computers – if you need that, just go a level higher.

C:\Users\joern>mklink /j "Documents\My Games\Skyrim\Saves" Dropbox\savegames\Skyrim\Saves

More information on the mklink command, or on NTFS symbolic links in general.

Notes from Velocity Europe

Early November I attended the first Velocity Europe conference. This was my second conference where I attended, didn’t speak and paid for the ticket myself (Mobilism 2011 was the first, and I already bought a ticket for the 2012 edition…). There’s a lot to say about the conference, though there don’t seem to be a lot of blog posts about it (with this nice exception). You should watch the talks online, as far as available.

During the conference I scribbled down various notes that I’m reproducing here. Some notes didn’t make sense anymore, or I couldn’t remember their context. For others, I gathered more information on the topic since the conference. Maybe there’s an idea or two that fancies your interest. Let me know if you want to have more details on any of them. In chronological order:

  • “It’s not in production if it’s not monitored” – this was mentioned in the keynote on the first day. Useful as a little thought exercise: How many servers do you run that aren’t monitored? Where monitored means: How long does it take for you to realize that something crashed? Services like pingdom are, on its own, not enough – maybe your service is still up and serves nice HTTP 200 responses, but the content is just blank.
  • Related to the above, you should have a monitoring dashboard that everyone on your team can access, no matter where they are located. For an office, put up a monitor that shows the dashboard during the day, visible for everyone.
  • Performance regression testing: Building a site that’s fast is one thing, making sure it stays fast another. Usually no one complains about a slight degradation in site performance, so your site’s performance ends up as the boiled frog. Tools like Page Speed and WebPagetest with their public APIs could be an option: As part of your delivery process, deploy your product to some public location and have those tools look for problems. Make a list of acceptable issues and see if the score gets worse. If you can’t deploy to a public site, you need to set them up yourself. Which might make sense in either case, to write custom performance regression tests.
  • Page Speed Online also supports a “mobile” mode. For m.soundcloud.com, the result for mobile is actually worse then for desktop (84 vs 95).
  • JavaScript pays a price in performance for dynamic typing, and one solution to that are typed arrays. Those are basically much more memory efficient compared to a regular array, and where useful, the type restriction is not a problem. Typed arrays are required to make things like WebGL feasible, but could also be interesting for more involved canvas renderings. For any large array of numbers, check if a typed array type is available, and wrap your array.
  • Kind of related to JavaScript performance: When you’ve got an array, don’t add any other properties to it (only regular array items). Otherwise you’ll loose a lot of JIT-optimized performance.
  • The _super and _superApply methods, upcoming in jQuery UI 1.9’s widget, now don’t require the method argument anymore. An oversight from earlier changes, for some reason became apparent during the conference and was fixed recently.
  • Apparently switch is bad for various reasons (can’t remember the context), but the suggested alternative was interesting. Nothing new per se: Use an object with a property for each case. But here’s the kicker: Add a _default property and call that if the property you’re looking for doesn’t exist. I can’t remember the exact example, but it looked something like this (not tested).
    Update: As Rick Waldron puts it: “modern jit and method tracers will black list code that uses switch with string cases (non deterministic)”. The thing was from Mathias Bynen’s talk (slides), his code examples looked a little bit different.
  • Someone used a comic from Questionable Content in their slides. I can’t remember which one. It was funny.
  • Also funny, but in a very different way: the keynote on the second day by Artur Bergman. He cursed a lot and even called out nodejs as having shitty code (he still likes and uses it). They’ve got a service called fastly, kind of a CDN, it probably also sucks, but maybe a little less.
  • There was a talk about the upcoming Amazon Silk browser. By now there are actual reviews of the Amazon Kindle Fire using that browser, and they seem to be generally disappointed, as the accelerated mode doesn’t deliver on the promise. Which actually makes sense, at least according to Steve Souders (he’s co-running the conference…). The note I wanted to share here though goes even beyond that: Amazon already sells a lot of their webservices, and there’s a lot of potential to add the Silk infrastructure to their offerings. Say they never figure out a way to accelerate SSL connections: Just host your site on the service (you may already be doing that anyway), and move the optimizers in front of the SSL termination (or behind, depending on your perspective). Instead of carefully hand-optimizing your site, you could just leave it up to them. Similar to using mod_pagespeed, but more cloudy.
  • Chrome Frame is awesome and you should use the forced mode to get more users to install it. I’m not a fan of Alex Russel, but I’m very thankful for his work on Chrome Frame.
  • Languages with Gargabe Collection built in are nice, but once you screw up, they have to stop the world to collect your shit, alos known as “embarassing pause”. Luckily for you JavaScript engines are now getting incremental garbage collectors, so you can be even more sloppy.
  • Law of AppStores: Money made by Apple equals amount of money lost by others trying to make money with an appstore. Maybe. Anyway, installable web apps kind of make sense when you consider permissions: You don’t want any site to store 1GB of data on your computer, you also don’t want  the one site you use every day to ask you again and again for the permission. So “installing” a web app to give it more permanent permissions seems reasonable. But then having a central location to “discover” those applications is really stupid and doesn’t make sense outside of Apple’s little world. That’s where the Mozilla proposal, while still in the very early stages, makes so much more sense: Define a standard that allows a site to ask for “installation”, along with the one-off permission it wants. But instead of putting all apps into a single “store”, just add that metadata to your site and let the user make use of it when he visits it anyway. Mozilla’s page on that doesn’t tell you that story as far as I can tell, but I hope they get there. At least Chris Heilmann explained it like that, and it made a lot of sense to me.
  • Another project that Chris mentioned was Tilt. Its a Firefox extension that visualizes DOM nesting by rendering it in 3D. Still need to try it myself, but the examples that Chris showed were pretty cool, including “facebook city”. Imagine lots of really high towers…
  • Firebug is dead. It may still walk, but Mozilla is now finally working on their own developer tools, integrated into the development process. You can already see the new console in action, on Mac via Cmd+Shift+K.
  • On CSS performance: Using text-indent with a big negative value to hide text in favor of the background-image is a common practice. On mobile it can actually hurt performance, as the element gets really big and takes up a lot more memory then necessary. Hard to find anything about that issue on the internets, so for now just a link to Estelle’s slide on that.
  • In the same talk, Estelle talked about reusing a pool of DOM elements (also on the next slide). I’m a bit suspicious about the cost of creating DOM elements being the bottle neck in the scenario here, which is about rendering really long lists of items. Mobile memory is very limited, so you have to remove stuff from the DOM in order to render new elements, but I don’t quite see how reusing those elements would make much of a difference. Anyway, needs research, could be a useful technique.
  • Estelle also covered, very briefly, the technique used on the mobile bing site to deliver a fast first response combined with custom caching. The idea is to inline JS and CSS (along with inline images) on the first request, as regular script and style elements. Once loaded, the content of those elements gets stored in localStorage. In addition, a cookie is set to indicate what resources have been stored. On the next request, the server takes that cookie as an indicator to figure out what resources to serve: None if everything is cached, only specific files if the cached version is outdated. Estelle also mentioned that the mobile bing site works only for US IP addresses, so not trivial to reproduce. Worth more research.

A good conference. Met a good bunch of people that I’ve met before, and some interesting new figures. I didn’t gather enough contact details to stay in touch with them though.

PS: Refuse to let T-Mobile manage your conference wireless networks.

Making the capslock key useful on OSX

This little nugget was shared on some internal mailinglist, but deserves more attention. And as usual, blogging about it is a good way for myself to find it again.

To start with, install PCKeyboardHack. Follow their instructions for installation, changing the capslock key to some other keycode (getting to that in a second) and disable the default behaviour.

Now, the suggested use was as an iTerm hotkey. For that, set the keycode to 105 (F13). Then go to Preferences in iTerm, and enable the system-wide hotkey (click into the input, then press your newly assigned caps lock key, it should input F13). Here’s a screenshot showing iTerm 2 and PCKeyboardHack preferences..

I didn’t yet enable the second checkbox, just the first one to toggle to iTerm quickly, usually its already focussed the right window or tab.

Thanks to Robb for sharing it in the first place.

Other uses for the caps lock key?