The home of quality blobbing

C++ Template Metaprogramming

In deranged on 2010-04-21 at 00:21

My close personal friend and colleague Encsé posted a fun little programming exercise and invited us to send him solutions in our favorite Turing-complete tool, especially if it happens to be mod_rewrite or C++ templates. Unfortunately, I don’t think there is a single sane person on the planet who would consider C++ their favorite anything, and I like Encsé better than to let him needlessly associate with any additional crazy people. Obviously, this meant that I had to delve into the murky depths of template madness myself.

Here is a copy of the problem, in case Encsé decides to delete his post once he finds out it has been tainted with C++ — which would be an entirely sensible (and, indeed, healthy) reaction:

Find a number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number must also satisfy these divisibility requirements:

  1. The number should be divisible by 9.
  2. If the rightmost digit is removed, the remaining number should be divisible by 8.
  3. If the rightmost digit of the new number is removed, the remaining number should be divisible by 7.
  4. And so on, until there’s only one digit (which will necessarily be divisible by 1).

OK, so I implemented a solution using C++ template metaprogramming. It was actually easier than I thought, and the experience was surprisingly interesting. Which is not to say I’d like to do it again. I imagine I would feel this exact same way after performing an autopsy.

BlueRemote Is Now Free Software

In Uncategorized on 2010-04-19 at 10:32

Just a few years ago, Palm OS had a large user base and an active third-party developer community, with tens of thousands of apps available from multiple, open application stores, most prominently PalmGear.com. The OS was used on small mobile devices from PDAs and GPS systems to fancy smartphones — it was a nice system that was cutting edge in the nineties, but by 2004, it has become horribly outdated. PalmSource’s efforts to introduce OS 6 — a version with a modern, 32-bit, multitasking, memory protecting architecture — proved futile: no Palm OS 6-based device was ever produced. By 2006, Palm has mostly switched to producing Windows Mobile phones. Then in 2007 the iPhone happened, and its brilliant user experience and centralized, integrated App Store instantly made all Palm OS devices still on the market obsolete.

All this means that in 2010 it may seem a tiny bit too late to publish Palm OS source code. Thankfully the system still has a small group of enthusiastic users who work on keeping the platform alive.  To this very day, I’m still regularly contacted about my old Bluetooth remote control application, which I sadly didn’t keep updated to run on the last few generations of devices.  It’s great that people care about my work, and the least I can do is to let them take control.

Javítsuk meg az iPhone magyar billentyűzetét!

In iPhone on 2010-04-18 at 17:17

Néhány szavasnál hosszabb magyar szöveget gépelni iPhone-on pokolian nehéz dolog, mert az ékezetes betűket nem lehet közvetlenül bepötyögni. Az alapbetűt nyomva tartva a kb. fél másodperc szünet után felugró menüből ki tudjuk választani a kívánt ékezetes változatot, de ez nagyon megszakítja a gépelés lendületét. A magyar nyelvben az ékezetes betűk gyakorisága kb. 11.383% — ez alig marad el a leggyakoribb E betű 12.256%-ától. Átlagban minden nyolcadik-kilencedik betűt tehát csak ilyen nyakatekert, lassú módszerrel tudjuk begépelni, ami a gyakorlatban ahhoz vezet, hogy inkább nem is használunk ékezeteket.