maandag 31 oktober 2011

Apple XCode 4.2 & SetFile command

A little-known fact is that Apple's XCode ships with two command-line utilities called GetFileInfo and SetFile. They allow to query and set various file attributes. Many of these are obsolete properties from the Classic Mac OS days but some are still relevant and pretty handy, like creation date (which cannot be changed with ‘touch’ AFAIK). An even lesser-known fact is that since OS X Lion, there was a bug in the SetFile command that caused it to set incorrect dates when used with the -d or -m arguments. The date was always set one hour before the specified date. This bug has been fixed in XCode 4.2.

Weinig mensen schijnen te weten dat Apple's XCode ook twee handige terminalcommando's installeert, namelijk GetFileInfo en SetFile. Deze laten toe om allerlei bestandsattributen op te vragen en te veranderen. Veel van deze attributen zijn relieken uit de tijd van Classic Mac OS, maar sommige zijn nog steeds relevant en nuttig, zoals de aanmaakdatum (die voor zover ik weet niet veranderd kan worden met ‘touch’). Nog minder bekend is dat sinds OS X ‘Lion’ er een bug zat in SetFile waardoor deze verkeerde datums instelde met de -d of -m opties. De datums die het bestand uiteindelijk kreeg waren altijd een uur vroeger dan gespecificeerd. Deze bug is opgelost in XCode 4.2.

maandag 17 oktober 2011

Mac OS X Lion: showing file path in Spotlight / pad tonen in Spotlight

In versions prior to Mac OS X 10.7 “Lion”, when hovering over a file in Spotlight's results for a while, the file's path would appear. It could also be shown instantly by holding down the Command key. In Lion this has changed. The path will not appear no matter how long you hover over the file name. When holding down Command, a small pop-up at the bottom of the preview window will first show you where your search term matched (the file name or contents), and only ±four seconds later you will be shown the file path. That is pretty annoying if you quickly want to skim through the results for file paths!
Luckily someone on the Apple discussion forums has discovered that if you press Option (alt) together with Command, the file path will be shown instantly. Phew.

In versies van Mac OS X vóór 10.7 “Lion” kon het bestandspad zichtbaar gemaakt worden voor zoekresultaten in Spotlight door er ofwel een tijdje boven te blijven staan met de cursor, of Command in te duwen. Dit is veranderd in Lion: het pad zal niet verschijnen hoe lang u er ook op blijft staan. En als u Command induwt, wordt eerst getoond waar uw zoekterm overeenkwam (inhoud of bestandsnaam), en pas na een viertal seconden zal het pad tevoorschijn komen. Zeer vervelend als je snel de locaties van een hoop zoekresultaten wil weten.
Gelukkig heeft iemand op de Apple-discussiefora ontdekt dat als je Option (alt) tegelijk met Command induwt, het bestandspad ogenblikkelijk verschijnt. Oef.

dinsdag 27 september 2011

Magic Mouse battery management

If you have a wireless Mighty Mouse and you're tired of the scroll ball getting clogged with gunk, you may consider buying a new fancy Magic Mouse. In many aspects it will be a step forward, except one.

The battery management of the Mighty Mouse was very good: it could run on a single cell, which means that when it told you its batteries were empty they were both guaranteed to be empty. The mouse would always keep drawing power from whatever battery still had some juice left. This made it possible to run for weeks even on a set of old worn-out rechargeable cells.

The battery management of the new Magic Mouse is not so mighty, nor is it magical. In fact it is absent. The people at Softpedia have already discovered this but they did not explain the root cause of the problem. I do not believe the Magic mouse draws much more current than the Mighty Mouse. The problem is that it treats the two cells in series like any primitive battery-powered device. It expects a total voltage of more than about 2 Volts. This means that if one battery is still going strong at 1.2V and the other one is dead at 0.8V, the mouse will shut off. The Mighty Mouse would still be going at that point because it would ignore the empty battery and draw current from the other one.

Especially with Apple now selling their own NiMH batteries and charger, their decision to drop the advanced battery management is puzzling. If there is any type of battery that benefits enormously from the separate treatment it is rechargeable ones. Contrary to alkaline batteries, NiMH batteries will maintain a quite steady voltage until they're empty, at which point they exhibit a very quick voltage drop. If one battery has less capacity than the other, this leaves no margin for the higher-capacity battery to further discharge because the series voltage plummets below the threshold. With alkalines the steadily dropping voltage provides more spring-action between the two cells.

I tried using 2300mAh cells in a Magic Mouse and they lasted less than two weeks of non-intensive usage. The scenario was as described above: at the end of the run one cell was empty and the other one still had quite a lot of juice left.

If you have multiple pairs of rechargeable batteries and a means to measure their actual capacity (e.g. with an advanced charger), try to match the batteries in pairs of equal capacity. They will give you more mileage. This does not only apply to the Magic Mouse but to any device that connects its cells in series (i.e. practically every device).

P.S.: Anyone who had a wireless Mighty Mouse might remember reading the mysterious notice “3Vdc Agency approvals inside” on its underside. Whatever it meant (I never found any ‘approvals’ while disassembling the mouse), I think the 3Vdc Agency would not approve of the Magic Mouse.

zondag 4 september 2011

Mac OS X Lion: one month later

It has been about a month since I upgraded to Mac OS X “Lion”. In short, here's what I like and dislike so far:

  1. ‘Natural scrolling’: it took surprisingly little time to get used to and after this short adaptation stage it proved so much more intuitive, even for the scroll wheel. And I don't even have any iOS device. I even tweaked my Linux environments to reverse their scrolling.
  2. Applications and their open windows are remembered between logins. Especially handy for Terminal, which will even show previous output in gray.
  3. The weird LCD backlight issue where the screen would sometimes light up again after dimming is fixed.
  4. The acceleration curve of the mouse has changed to more resemble the acceleration under other operating systems. I believe the previous acceleration curve had remained unchanged since the introduction of the Macintosh in 1983, but I have always been annoyed by its extreme acceleration behaviour at very low cursor speeds. When going from OS X to Windows/Linux I never noticed anything unusual about the mouse, but when coming back the weird acceleration always took a while to get reaccustomed to.
  1. My mouse cursor will often make unexpected jumps. Many other people have this issue and Apple is aware of it, but it still isn't fixed. It seems to happen mostly with third-party mice like my Razer Imperator. If you also experience this and want to have it fixed sooner, file a bug report at and refer to bug ID #9701670.
  2. The Finder does not play well with the remembered windows feature. Sometimes I see my previous windows vanishing into thin air immediately after logging in.
  3. Instead of the LCD backlight issue, now the keyboard backlight will sometimes be blazing at full intensity when I return to my MacBook Pro after a while, even though I had turned it off.
  4. There is often an annoying delay in ‘open/save file’ dialogs, with the hard drive rattling for reasons unknown.
  5. There is still no good free Lion-compatible VNC server that I'm aware of (I'm waiting for an update to Vine VNC) and the built-in screen sharing is awful. It only supports bandwidth-gobbling lossless compression, it incorrectly assumes the command key is pressed at certain moments and worst of all, logging in requires a dozen attempts on average — unless you know the following trick. The issue is that when connecting, the login screen will only start to react to input after about five seconds and only during a random time period that ranges between zero and ± seven seconds. However, anything you do in those initial first five seconds will be buffered and executed. Therefore, click your login name as soon as it appears and immediately type your password + enter, even though you don't see anything happening. Just wait for ten seconds. If you're not too unlucky the connection will not freeze before your cached clicks and keystrokes have been executed, and you will be logged in. This still does not work every time but it increases your chances of getting in to something like 50%. Have fun playing login roulette!
  6. The lack of scroll arrows makes it hard to impossible to advance a single line (or other unit) while scrolling.
  7. Joesoft's ‘Hear’ still is not Lion-compatible, therefore I have to do with the standard sound quality of my headphones, which is not stellar despite them being from Sennheiser.
  8. The XiphQT plugin has not been upgraded to 64-bit. No biggie since iTunes can be set to run in 32-bit, but I don't like to have to do tweaks like that.
Despite the ‘Dislike’ list being much longer than the ‘Like’ list the overall experience is still positive, but if there is no immediate reason for you to upgrade to Lion I would recommend waiting until it is a bit more mature and software developers have caught up.

If you're using Fink and can live with sticking with current release versions for a while, you can do an upgrade to Lion and keep using most of your existing Fink installation. I have found only few things that stopped working. Eventually you will need to reinstall everything from scratch however. When you're going to do that, be prepared for a disappointment because many packages are still not compatible.

zaterdag 20 augustus 2011

Een gat boren in vitrokeramische plaat / Drilling a hole in glass ceramic

Een schakelaar op de bejaarde AEG vitrokeramische kookplaat van mijn ma had het begeven. Het bleek onmogelijk een vervangexemplaar te vinden, zelfs niet van een totaal ander design dat min of meer in dezelfde opening past. Alle ronde schakelaars van voldoende V/A hebben tegenwoordig een diameter van 20mm. Het gat in de plaat had een diameter van slechts 13mm.

De opties waren ofwel een schakelaar vinden die wel in het gat past en daarmee een relais aan te sturen, ofwel het gat te vergroten naar 20mm. Voor het eerste was het nog steeds problematisch om een geschikt type schakelaar te vinden. Dus ben ik voor de tweede optie gegaan en heb een 20mm diamantboor en waterdichte schakelaars besteld op eBay.

Boren in glas is niet zo moeilijk zoals je kan zien in talloze tutorials en filmpjes op de JijBuis. Met een goede diamantboor is het kinderspel. Voor de grotere diameters zijn dit klokboren. De beste manier is rond het te boren gat een klein dammetje maken met plasticine o.i.d. en dit vullen met water (ik moest hiervoor natuurlijk het bestaande gat dichtstoppen). Dan zonder al te veel druk de boor loodrecht houden en binnen een paar minuten is het geklaard met een goede diamantboor. Het water dient als koelmiddel, eventueel kan er extra diamantpoeder aan toegevoegd worden voor meer snijvermogen.

Vitrokeramische plaat is echter geen ordinair glas en dat was wel duidelijk toen ik na een half uur amper een millimeter diep zat met nog een kleine drie te gaan. Het is verdomd hard spul, een dankbare eigenschap om krassen te vermijden maar een serieuze hinderpaal in mijn geval. Wegens gebrek aan diamantpoeder heb ik dan maar al wat voor schuurmiddel kon doorgaan — inclusief Cif — uit de kast gehaald en de raad om weinig druk uit te oefenen in de wind geslagen en ook de boor in een hogere versnelling gezet. De boor werd nu een stuk sneller warm dus ik moest regelmatig stoppen om hem te laten afkoelen. Het heeft nog een dik kwartier geduurd maar deze nieuwe strategie leidde uiteindelijk tot de bevrijdende doorbraak. De onderkant van het gat is allesbehalve proper maar dat zal mij worst wezen aangezien niemand die ooit ziet. Als je een proper gat in glas (of eigenlijk eender wat) wil boren, kan je ofwel stoppen voordat je er volledig doorzit en dan langs de andere kant boren, ofwel het materiaal stevig vastklemmen op een harde ondergrond.

Noot: uit wat ik heb gelezen moet het volkomen onmogelijk zijn om een gat te maken in getemperd glas, tenzij je heel veel geluk hebt. Het schijnt zelfs onmogelijk te zijn met een waterstraalsnijmachine. Alle bewerkingen moeten gedaan zijn vóór het glas het temperingsproces ondergaat.

Short English summary:
It is perfectly possible to drill holes in glass ceramic (also known as vitroceramic) plates. You need the exact same tools and procedure as with ordinary glass, there are many tutorials about this. The only catch is that this material is much, much tougher than the average glass of an aquarium. You should exert more pressure on the drill and simply have more patience as well. Adding abrasive powder may also help. Make sure to stop regularly and check if the drill bit is not becoming too hot even if you are using water to cool it.

zaterdag 19 maart 2011

Windows Vista/7 in Boot Camp + Parallels: no go

Een korte post om mensen in dezelfde situatie tijdverspilling en valse hoop te besparen:

  1. Eén, de nieuwe MacBook Pro's (van maart 2011) ondersteunen enkel Windows 7 in Boot Camp. De installatie-CD van Windows XP loopt vast bij het booten.
  2. Twee: het is niet mogelijk om een Boot Camp-partitie met Windows Vista of Windows 7 ook in Parallels te gebruiken, wat de reclame van Parallels ook zegt. U moet kiezen om ofwel enkel te werken onder Boot Camp, ofwel onder Parallels, of effectief betalen voor twee licenties van Windows en ook twee onafhankelijke schijfverspillende installaties te maken, bijzonder onpraktisch.
  3. Drie = één + twee: het is onmogelijk om dezelfde Windows zowel onder Boot Camp als in Parallels te gebruiken op de nieuwste MacBook Pro's.

Theoretisch gezien is punt 2 wel mogelijk en Parallels ondersteunt het, en met Windows XP is het perfect te doen dankzij de “Hardware Profiles” feature. Helaas is die verdwenen sinds Vista. Gevolg: als u bv. Windows 7 activeert onder Boot Camp, en daarna diezelfde Windows probeert te booten onder Parallels, gaat die klagen over activatie. Als u dan activeert onder Parallels, krijgt u hetzelfde liedje eenmaal u terug in BC boot, tot in het oneindige.

A short post to save people in the same situation from wasting time or getting false hope:

  1. One, the new MacBook Pros (March 2011) only support Windows 7 in Boot Camp. The Windows XP installation CD hangs at the first step during boot.
  2. Two: it is impossible to use a Boot Camp partition with Windows Vista or Windows 7 both in Boot Camp and under Parallels, whatever Parallel's advertising may say. You must choose to either work in Boot Camp only or in Parallels only, or effectively pay for two Windows licenses and also make two independent diskspace-wasting installations, which is impractical as well.
  3. Three = one + two: it is impossible to use the same Windows installation in Boot Camp as well as in Parallels on the newest MacBook Pros.
Theoretically, point 2 is possible and Parallels does support it, and it is perfectly workable with Windows XP thanks to the “Hardware Profiles” feature. However, that has vanished since Vista. The result: if you activate e.g. Windows 7 in Boot Camp, and then try to boot the same Windows in Parallels, it will complain about activation. If you then activate it again under Parallels, you will again get back to the starting point once you boot in BC, ad infinitum.