Norbert Hartl

mostly brackets and pipes

Recover Corrupted Mac OS Software Updates

Somehow I’ve managed to break my Mac OS software updates / iTunes. I cannot remember doing anything special than updating software when I got a notification from my operating system. I think there were 5 updates and I just activated updating them all. After the third package had been updated an error occurred.

In such case I suspect some network problems and try again. But it didn’t work. So my suspicion readjusted itself towards caching. Software often includes retry timeouts to avoid wasting too much resources in the unusual case. So I waited for a day and retried then. Nothing changed, still broken! Well, I thought if the system is updating its software catalog it could fix the entry if it is bogus. This story could go on for some more time. As a software developer I’m experienced with all sorts of problems that can occur in those situations. But even waiting for a whole week didn’t help. The packages didn’t want to update.

A short research showed it is possible that the software registry of installed packages can become corrupted. One way to fix this is to reset software registry.

Open a terminal and execute the following line

defaults write com.apple.appstore ShowDebugMenu -bool true

Open software updates application and you should see an additional menu entry Debug on the right. In the Debug menu you’ll find an entry called Reset application. Restarting the sofwtare updates application should reload its data and the problem should be fixed.

I’ve found this information on this thread

Changing Blog Engine From Pier to Octopress

Several years I’ve been using the pier content management system for my web site. I loved pier for being an excellent example on how content can be managed. It lowers the border between static content and dynamic components by breaking both down into structure. Components can access content that is stored as page structure as well as dynamic content parts can access the whole structure of a site.

On the other hand pier is a rather complex piece of software that is hard to digest. Maybe this is the reason why only few people became familiar with the code. Having a decent user base is essential for software to survive. I’ve spent a lot of time with the code but I still don’t have the feeling I understand it.

From time to time I remember that reducing complexity in software and deployments is something important. I only write blog posts occasionally and for this using a complex content management system is overkill.

By occasion I got notice of the octopress blogging framework. It is written in ruby and produces static files. This is quite the contrary to what I had before. I’ve always been a big fan to make a web site out of static files. No dynamic components that can break, no performance issues. It is like in the good old times where I managed a news paper web site that could service 1 Mio. page impressions on a AMD K6 CPU with 128MB RAM.

By switching the blog engine I got a nice modern HTML blog at the same time. Octopress needs to be operated from the console in order to create blog posts. I’m quite familiar with working in a terminal so this is not a problem. Octopress is meant that way. It is called a blog engine for hackers. I’m curious how long it will take until I need to dive into it to change something and learn some ruby on the way.

The downside of having static files is the difficulty to have dynamic things included. Most blogs allow to comment blog posts. That wouldn’t be easy to do with static files. Octopress has support for using disqus as an external commenting engine. I might try this but I’m not sure if a blog needs comments. We’ll see!

How to Activate Double Tap to Drag in Lion

This week I got the new MacBook Pro with Retina display. The display is outstanding and makes the internet look a little like EGA graphics :) To switch from one MacBook to another it is always a decision how to recreate your environment. This time I decided to do a clean migrate. It means no time machine, no big backup/restore procedures that are built-in. The goal is to have as less cruft as possible on the new computer.

By doing this you also loose all the tweaks you’ve added in the past. For most of them I have a note or a blog entry like this. But there are a lot things that went unnoticed. I updated my old MacBook two times to a new system and I always had a behavior that you can double tap and drag a window using the trackpad. On the new MacBook the behavior was gone. Apple replaced it with yet another revolutionary something. Gladly there is a way to restore the behavior although it is kind of hidden which should tell you that apple want you to stop using it.You can find it in

System Preferences  
   > Universal Access  
   > Mouse and Trackpad  
   > Trackpad Options  
   and there enable the "Dragging" checkbox.

If you have a german language setting like me you’ll find it in

Bedienungshilfen  
   > Maus & Trackpad 
   > Trackpad-Optionen...  
   and the checkbox is called "Bewegen"

I got this helpful trick from cnet

Vortrag über Javascript Funktionen

Dies ist ein Nachtrag zu meinem Vortrag vom 7. Juli 2012 auf der cologne.js. Ich hatte vergessen, es vorher anzukündigen. Ich war recht zufrieden mit dem Vortrag. Es gab genügend Fragen und kleine Diskussionen, die meiner Meinung nach das wichtigste an solch einem Vortrag sind. Sobald das Thema javascript ist, finde ich es vorteilhaft, wenn man Code einerseits visuell präsentieren, andererseits den Code auch ausführen kann. Dafür habe ich ein gutes toolkit gefunden, das meine html5slides ablöst. Ich benutze nun deck.js und das code mirror plugin. Mit deck.js sind slides sehr einfach zu erstellen und mit dem code mirror plugin bekommt man eine textarea, die den Code inklusive syntax highlighting darstellt. In die textarea ist noch ein run button integriert, mit dem man den code ausführen kann. Man kann den Code in der textarea einfach verändern und dann nochmals ausführen. Das plugin leitet ebenfalls alle console.log Aufrufe in einen Bereich unterhalb der textarea um. Damit lässt es sich sehr schön präsentieren und diskutieren.Die slides vom Vortrag sind hier

Simple Patches in Homebrew

I just learned how to apply a simple patch to piece of software that is being build by homebrew. I write it down not to forget. A simple patch is easily applicapable in brew. You just need to do the following: Open a terminal and typebrew edit myformulaAn editor opens containing the text of the package myformula Add a method “patches” like this def patches DATA endIn the patches method you can do all kind of things with the source. The method is called automatically by homebrew. If this is a simple patch and we want to included right in the formula the DATA will do the trick.

Add an end label to the formula as the last line of the forumla__END__This indicated the end of the formula

Paste your patch after the __END__ label

Installing the software by doing

brew install myformulait 

should patch the source before building it

LRUDictionary: A Small Least-recently-used Style Dictionary

For my last project I needed some kind of cache. I had one web service providing the main functionality and that was using another service for session and user information. Having each web request triggering multiple requests internally to resolve user and session data was not an option. In pharo there is a class called LRUCache. It is like a dictionary where the only implemented method is #at: .

The LRUCache is created by providing a size of the dictionary and a factory block. When an element is requested by using at: the factory block will be invoked if the element is not present. LRUCache does not give you control over the storage of the elements. Either it is there or it will be created and exists then. For my user and session data the situation was slightly more complicated. I don’t want to store user information when the user is not confirmed (it can change within the next seconds if the user confirms). And sessions should be removed from the dictionary if they are expired. The removal of expired sessions is not necessary as they would be sorted out automatically. It is an optimization because the cache will be less efficent if expired session block upper position in the LRU order until the reach the tail of the list and get discarded.

To serve my purpose I created a LRUDictionary class. It works like the LRUCache class (yes, I preserved the nice statistics the LRUCache provides about its usage) but adds more of the dictionary protocol to it. I added

at:ifAbsent:
at:ifAbsentPut:
at:ifPresent:
at:put:
removeAt:
removeKey:
removeKey:ifAbsent

The code can be found on smalltalkhub.Feel free to improve, comment or criticize

Smalltalk Dev Room @ FOSDEM 2012

At the weekend 4th/5th of february there will be this years FOSDEM, a big free and open source conference held in Brussels. Some of the smalltalk guys arranged a smalltalk dev room on sunday, 5th of february. If you are interested in smalltalk don’t hesitate to visit us in the smalltalk dev room (room number seems to be AW1.126). If you have interests in smalltalk and REST then you are even more welcomed to visit my talk. It is the first in the schedule (I should have been more careful :) ).Here is the schedule:

09:30 Norbert Hartl, Take a small REST. Simple approaches for REST in smalltalk
10:00 Stephane Ducasse, Marcus Denker, The next steps for the Pharo Vision
11:00 Laurent Laffont, John Thornton, Amber, the Smalltalk for web developers
12:00 Nick Ager, An introduction to jQuery Mobile
12:30 Stefan Marr, RoarVM, Sly
13:00 David Chisnall, Compiling Smalltalk to fast native Code
13:30 Craig Latta, Spoon
14:00 Stephan Eggermont, Willem van den Ende, Diego Lont, Back to the future,(re)learn smalltalk (till 16:30).

See you @ FOSDEM

Smalltalk Inspect Interview über GemStone

In der aktuellen Ausgabe von Smalltalk Inspect gibt es ein Interview mit mir zum Thema GemStone (Die Ankündigung findet sich hier). Ich denke, die Diskussion gibt einen guten Überblick darüber, was GemStone ist und was man damit machen kann. Viele der angesprochenen Dinge handeln vom Erstkontakt mit der Materie, der gerade für Leute ohne Vorkenntnisse interessant sein dürfte. Aber auch Details über die Funktionsweise der Persistenz und dem Umgang mit GemStone in einer grösseren Installation fehlen nicht. Ich hoffe, der podcast ist für viele interessant. Dies ist in Anbetracht der “leichten” Überlänge :) nicht selbstverständlich. Kritik und Anregungen gerne direkt an mich per Email.

Smalltalk Inspect ist das erste deutschsprachige podcast zum Thema Smalltalk. Es wird betrieben von Marten Feldtmann, Sebastian Heidbrink und Joachim Tuchel. Das podcast widmet sich in jeder Ausgabe einem smalltalk-spezifischen Thema. Und für jedes Thema lädt sich die Smalltalk Inspect Crew einen Verteter/Experten für das jeweilige Thema ein.

James Foster on Maintenance Gem Overhead

If you are using GemStone you know there are a lot of things to tweak to get the best out of it. James Foster has a new blog post about how to get rid of overhead of the maintenance gem. In my installations I’m using a similar approach. Definitely a read

TaskForUs - Gemeinsam Tasks Verwalten

Seit einigen Tagen ist unsere neueste Applikation im AppStore erhältlich. Es gibt wahrscheinlich wenig App Kategorien im Apple AppStore, die so dicht besiedelt sind, wie die der todo Applikationen. Das ist verständlich, wenn man sich Programmiertutorials anschaut, denn dort ist eine todo Applikation ein einfaches Beispiel, das man als Anfänger umsetzen kann. Das Daten-Model ist meist sehr simpel und ein Endergebnis nicht viel mächtiger. Aus dieser Sicht heraus ist es entweder sehr töricht oder mutig, noch eine todo Applikation zu erstellen.

Wir sehen es lieber als letzteres. Unterteilt man die todo Applikationen in ihre Möglichkeiten wie Online-Modus, Backup oder Kollaborationsmöglichkeiten, dann trennt sich die Spreu vom Weizen. Gefühlt sind über 90% der Applikationen, simple Apps, die nur offline todo Einträge anlegen und abhaken können. Der Rest teilt sich in “getting things done” Apps und ich möchte sie komplexe todo Apps nennen. Die komplexen todo Apps bieten eine Fülle von Kategorien und Einstellungen, die einen meist nur mehr verwirren als dass sie helfen würden.

Wenn wir die offline Apps und die komplexen wegnehmen, bleibt eine überschaubare Menge an Apps über. Von diesen bieten die meisten irgendeine Online-Möglichkeit. Sei es das Backup der Daten oder die Verknüpfung mit einem Webinterface oder Desktop-Applikation. Was aber weitgehendst fehlte, als wir begannen unsere Applikation umzusetzen, war die Möglichkeit, Listen mit anderen Personen zu teilen. Wir sind sehr an Kollaborationsmöglichkeiten interessiert, deshalb war dort eine Lücke zu sehen. Um ehrlich zu sein, muss man sagen, dass sich dieser Zustand inzwischen leicht verändert hat. Einige der Apps bieten inzwischen die Möglichkeit, Listen zu teilen. Aber nur wenige.

Die geteilten Listen war unser Hauptfokus bei der Erstellung dieser App. Wir wollten eine simple App haben, die einen möglichst wenig verwirrt, die aber durch ausgewählte Features eine gewisse Mächtigkeit gewinnt, und damit nützlich ist. Das Teilen von Listen macht die Applikation unserer Meinung nach sehr gut. Man erstellt eine Liste und kann dann beliebig viele Personen einladen, die Liste zu teilen. Sobald Daten zwischen mehreren Personen geteilt werden, betritt man einen ganz neuen Komplexen an schwierigen Problemen. Spätestens an diesem Punkt hört die todo App auf, trivial zu sein. Die App sollte jederzeit in der Lage sein, die Inhalte von mehreren Personen zu vereinen. Und diese Änderungen sollten verzögert anwendbar sein. Weniger komplizert ausgedückt bedeutet das, daß ich Aufgaben erstellen möchte, wenn ich offline bin oder kein Netz habe. Und wenn ich dann wieder online bin, möchte ich weder, dass jemand meine Inhalte überschrieben hat, noch daß die App es ablehnt, meine Inhalte anzunehmen.

Wir denken, dass TaskForUs das Problem sehr gut löst und dabei das Datenaufkommen in die cloud schmal hält. Das ist wichtig, weil wir auch unsere Aufgaben abgleichen wollen, wenn wir im Zug sitzen und/oder wir uns in einem edge Netzwerk befinden. Wir hoffen, daß unsere Überlegungen und Umsetzungen sich mit den Wünschen von Leuten decken, die sich mittels Aufgabenlisten organisieren oder es wollen. Wir sind sehr an Feedback interessiert. Auf der Website gibt es genügend Möglichkeiten, mit uns in Kontakt zu treten. Bei wem ich nun etwas Interesse geweckt habe, der schaut sich bitee TaskForUs an