code | life | mac | web | english | deutsch

Wahlhelfer mit PC gesucht?

Posted by dom on Fri Feb 22 14:07:23 +0100 2008

Das hier stand in Kreisbote am 30. Januar (ganze Seite nach dem Klick):

Unglaublich – oder? Mehr Informationen zu den jetzt anstehenden Wahlen bei denen mit Barcode-Scannern ausgezählt wird.

My first S.M.A.R.T. failure

Posted by dom on Thu Jan 24 00:32:54 +0100 2008

My bad luck with hardware continues to amaze me. Bought in September last year, my Western Digital 250 GB latop drive has a S.M.A.R.T. failure. A first for me, normally my disks fail first and then show a S.M.A.R.T. error. How did I notice? I accidentally openend disk Utility and my disk showed up red. What I am wondering is why apple doesn’t show me the S.M.A.R.T. status more prominently somewhere if it fails?

If your disk has a S.M.A.R.T. failure and you are on a Mac then you can get more information about the failure using SMART Utility – which shows me this:

Which IMHO means that this time I could be lucky and no data has been damaged. So here I go and order a replacement from the Western Digital website which much to my suprise offers a variant where I get the new disk first, and have to send the broken one back in a 30 day time window. So if my disk holds up until then I can safely clone it using disk utility. If not, I have my time machine backup and will see how well it will restore my old state. Wish me luck!

P.S.: I just found SMART Reporter which actually checks for the S.M.A.R.T. status all the time, and shows up an alert and red hard drive if it detects a failure. It is freeware, and has just been added to my startup items.

Bugs, Child Windows and Spaces

Posted by dom on Tue Jan 22 12:04:35 +0100 2008

During my recent SubEthaEdit bugfixing efforts I came along some pretty annoying Cocoa Child Window issues.

First a little preamble, why did SubEthaEdit use child windows – this could be filed under “it was a bad idea anyways”. I got the idea searching for a good and safe way of displaying the little SSL-lock icon in the upper right of the window if a connection is SSL-encrypted. Safe meaning a way that wouldn’t break if something fundamental in the way how the window title is displayed would change in the future. Since most of the displaying in the titlebar window area is private API, the results I found when looking around did use some mean subclassing. I didn’t want to do that, so I thought having a tiny transparent child window on top of my window would be a very safe thing to do. So I did. And I was wrong.

Bug number one: Spaces breaks

This seems to be a known issue, when I filed it it almost instantly got duplicated to this one: Child windows and Spaces [rdar://5593261] .

If you have a window with a child window it behaves strangely on spaces. If you open spaces and drag such a window to another screen, then it does not move to the point you dragged it, but to the point it was on the previous screen – much like when you press shift or apple while dragging windows in the spaces view. That in itself wouldn’t be a major problem, but here you go: if you have multiple windows with child windows, all of them gather together on the screen you activate after moving a window around. Hurray, no more spaces for you puny little app :(. So if your app behaves this way, that might be the problem. This was not easy to find out, I found it by chance after making sure that both the main window and child window did have the same collectionBehavior. (P.S.: if you want to put a view in the titlebar, simply ask a standard button for its superview and frame and add some view relative to that. Thanks to Panic for this idea which sounds quite safe too.)

id superview = [[[self window] standardWindowButton:NSWindowToolbarButton] superview];

Bug number two: Your app crashes on quit in certain situations

We had this nasty little bug that every now and then crashed SubEthaEdit on quit. Quite an annoying habit, but we did not find a way to reproduce it. Thankfully amongst the many bug reporters who sent us the crash log via the built in reporter, there was one that actually found out a way to reproduce it. The crash only happens if you quit the application while it is in background. Then the child window is somehow overreleased. You can see the setup code of my sample NSDocument here:

- (void)windowControllerDidLoadNib:(NSWindowController *) aController
    [super windowControllerDidLoadNib:aController];
    // Add any code here that needs to be executed once the windowController has loaded the document's window.
        // add a transparent child window to display a lock next to the toolbar button
        NSImage *lockImage = [NSImage imageNamed:NSImageNameInfo];
        NSRect frame=NSZeroRect;
        frame.size = [lockImage size];
        frame.origin = [[aController window] frame].origin;
        frame.origin.x += 100;
        NSWindow *childWindow = [[NSWindow alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
        [childWindow setIgnoresMouseEvents:YES];
        NSImageView *imageView = [[NSImageView alloc] initWithFrame:frame];
        [imageView setImage:lockImage];
        [childWindow setContentView:imageView];
        [imageView release];
        [childWindow setOpaque:NO];
        [childWindow setBackgroundColor:[NSColor clearColor]];
        [[aController window] addChildWindow:childWindow ordered:NSWindowAbove];
        [childWindow release];
        NSLog(@"%s %@ %@ %@",__FUNCTION__, childWindow, imageView, lockImage);

This is reproducible both in Leopard and in Tiger and a very bad thing. Not really grasping what goes wrong exactly in that case (if you close the windows or quit normally everything is fine, hence no general memory management problem – update: look at the bottom of the article to see that I was wrong nevertheless) I fixed this one in the 3.0.2 release by changing the lifecycle of the child window. I did so by putting the child window into an instance variable of my window controller subclass, and autorelease it on the dealloc method of it.

What I did not know then was that this didn’t fix it on Tiger in a special occasion: If on Tiger you quit SubEthaEdit while it was not active and had unsaved changes, and then without activating SubEthaEdit first directly click on the “don’t save” button. On PPC-Tiger that is. So I revisited the bug after a bug reporter finally added this magic information of reproducibility. What I did to fix it first was retain all child windows in the AppControllers applicationWillTerminate: delegate method. Which interestingly enough needed me to make an extra class for theses windows to identifiy them, because in the applicationWillTerminate: method the child windows were still alive – the parent windows weren’t. However I finally got rid of all of this by using a different and better method of adding the SSL-ock icon to the window, but some of you that might not be in the luxury of removing their child windows might find my trip valuable.

This one hasn’t been made a duplicate yet and is quite annoying. So if you have the same problem, report a bug referencing this one: Child window overrelease [rdar://5686435] .

Sample Code

If you want to reproduce it, here is my ChildWindow sample I wrote for the bug report. If you want to reproduce the last part of bug number two you have to add an NSWindowController subclass to the sample. Thanks for listening.

Addendum isReleasedWhenClosed

I have just been informed by the nice guys at Apple that programatically created windows default to a isReleasedWhenClosed state of YES which explains the overrelease. However why the heck it doesn’t crash when a window is closed does still not seem right to me. And what that means is that if I add the window without autoreleasing or releasing it beforehand that my app leaks windows. Which I verfied using ObjectAlloc – so it is still a bug, but a different one. If you want to do it right you have to setReleaesedWhenClosed:NO on the child window before you add it and everything is fine.

Dem Fingertipp sei Dank

Posted by dom on Mon Jan 21 11:43:40 +0100 2008

Apple auf Deutsch macht immer wieder Spaß...

Ermitteln Sie Ihren aktuellen Standort und die Umgebung mithilfe von Karten.

Hier gibts das komplette Werbeschreiben.

SubEthaEdit 3.0.2 released today

Posted by dom on Wed Dec 05 01:21:56 +0100 2007

SubEthaEdit 3.0.2This is “just” a point release – but we put in much effort to find many little annoying crashes which hid in special cases. There is nothing more unsatisfying than a crashing product. We know that and are very thankful of your bug reports which let us find out and fix the ones that are harder to reproduce. We especially want to thank the ones of you that take the time and reduce the problem to something that is reproducible.

So go ahead and grab the update via “SubEthaEdit -> Check for updates…” or directly via our Website . For your feature requests or bug reports please take the time and enter them into our Bugtracker – or just give us feedback via our Feedback Form – we value your input and feedback very much.

I named 49 HTML elements in 5 minutes

Posted by dom on Fri Nov 23 16:52:55 +0100 2007


Comments in the New Pages...

Posted by dom on Tue Aug 07 22:58:51 +0200 2007

...really mark badly, and print even worse. See for yourself:

Printing Comments in Pages

All of the lines are off, there are white stripes and some Text is overlapped with markers…

Medien Kompetenz Kompetenz

Posted by dom on Sun Jul 29 13:23:43 +0200 2007

Wie auf dem Bild der DVD beim fscklog schön zu Erkennen ist – der aktuellen brand eins eine DVD der Sorte “EcoDisc” bei. Diese hat den Vorteil Umweltfreundlicher zu sein, als eine herkömmliche, allerdings ist sie wohl zu dünn um in slot-in Laufwerken benutzt werden zu können. Grandioserweise hat brand eins diese Art von Laufwerk spontan in “APPLE SLOT IN DRIVE” umgemünzt (obwohl die Originalvorlage “PC SLOT IN DRIVE” schreibt). Soweit so schlecht – aber in ihrem Hinweis zur DVD beweisen Sie wieder einmal ihr technisches Fachwissen:

Liebe Leser, wir bedauern sehr, dass einige von Ihnen Computer-Probleme bekommen haben, als sie versuchten, den Dokumentarfilm “Weltmarktführer” an ihrem Apple-Macintosh anzuschauen. Wir bitten dafür um Entschuldigung.

Zur Erklärung: Auf der DVD stehen, links neben dem Loch in der Mitte der Scheibe, zwei Piktogramme.

Das eine besagt ausdrücklich, dass die DVD nur über Tray Drive benutzt werden darf, keinesfalls aber – deshalb ist das andere rot durchgestrichen! – in einem “Apple Slot in Drive”. Das hat damit zu tun, dass die Apple-Slot-in-Drives (Schlitzeinzug), so sagen uns die Hersteller der Disc, bestimmten Spezifikationen nicht genügen, die das DVD-Forum für Slot-in Laufwerke definiert hat.”

Als Lösung im Falle eines “Feststeckens” schlagen sie dann die sog. “reject” funktion vor.

a) Apple Computer verfügen über eine manuelle “Reject Function“, die Sie über die Tastatur eingeben können. Allerdings ist die Tastenkombination von Modell zu Modell unterschiedlich; hier hilft gegebenenfalls ein Blick in die Gebrauchsanweisung.

oder, besonders kreativ, einen Neustart:

b) In vielen Fällen genügt bereits ein einmaliges Herunter- und wieder Hochfahren des Computers.

Grandios, grandios. Wenn sie feststeckt dann geht die normale Auswurfunktion die hier ja beschrieben wird gerade eben nicht mehr. Feststeckt. Stupid.

Und so sehr ich ja den grundsätzlichen Öko-Gedanken unterstütze: Medien die Aufgrund der Spezifikationen auf einer großen Masse von Lesegeräten nicht zu benützen sind, und schlimmer noch, einzelne Geräte sogar beschädigen oder zum Gang zum Händler zwingen können, sind einfach abzulehnen.

Ausserdem: Ein Pictogramm auf einer Eisverpackung auf welchem “Nicht lecken” stünde, würden auch die meisten übersehen.

Update: Der Hass darf auf ods umgelenkt werden. Die haben jetzt die alte Vorlage gepullt und eine neue mit NO APPLE SLOT IN DRIVE gemacht.

Nice viral marketing...

Posted by dom on Fri Jul 27 14:17:16 +0200 2007

I hope the film is nice – however – rate me if you want.

Versionshelf just got better.

Posted by dom on Thu Jul 19 15:21:18 +0200 2007

We just updated our subversion hosting service Versionshelf with the following cool new features:

  • much improved optics of the svn browser
  • intra line diffing in the svn browser (those of you who know know how vaulble it can be to see exactly the 2 characters that changed)
  • international pricing in USD for non european customers.
  • all plans now have more features (more users and/or more repositries and/or more space)
  • the basic plan got cheaper

So check it out – it’s a 30 day free trial. And feedback is, as always, very welcome!