The greatest man
by Daniel Schlaug on October 6, 2011
Steven Paul Jobs passed away today.
I never got to meet Steve Jobs or even see him with my own eyes. He is, however, one of the most influential humans beings of my life. One of the things I will really miss is waiting for the Stevenote videos. This is properly done by spending hours carefully isolated from any and all news outlets that might spoil the delightment of watching Steve live once Apple releases the video of a release event some hours after the event has concluded. Liveblogs just couldn’t do justice to Steve’s enthusiasm and fantastic way with words. In this way my love for Steve was much like the love a child has for Santa. Those hours of anticipation, always late in the night here in Sweden, they always reminded me of Christmas.
Even though I cannot say exactly who Steve Jobs was my entire life is so immersed in Steve’s visions and creations that I feel I, and probably the whole world, have lost the best of friends today. And so even across the globe from Palo Alto, in this room, sits a grown man, with tears streaming, reminiscing about the greatest man I’ve never met.
My thoughts are with all who grieve today, but mostly with all the great things Steve Jobs have given to the world and me. And never has it been more true to say that his spirit lives on everywhere.
Typing swedish on a US keyboard
by Daniel Schlaug on March 3, 2011
Why do this
The Swedish language has three bothersome characters ÅÄÖ that are frequently used in everyday words. This means that Swedish keyboards look quite different from the your standard QUERTY (I love the fact that I misspelled that and will leave it as is). So different, in fact, that it ought to have it’s own set of keyboard shortcuts for each application (some US shortcuts aren’t even accessible at all). And coding on one of the damned things is probably way slower than with a normal QWERTY. Tired of remapping shortcuts I got an American MacBook Pro which felt great until I had to answer my first mail in Swedish.
The problems with typing ÅÄÖ on a US keyboard
I quickly came to the conclusion that there’s no easy way to type ÅÄÖ on the US keyboard, you can get the Danish variation by struggling with the option key but that won’t do. The first thing that comes to mind is switching between a Swedish keyboard layout and an US one. But that becomes bothersome since, for some bizarre reason, keys like “/”, “+” and “-” are also moved in the Swedish layout.
The solution
Then I stumbled on Ukulele and the ability to code your own keyboard layouts for Mac OS X. The functionality was extremely comprehensive, there’s no combination of modifiers that you can not make a specific keyboard mapping for in Ukulele (and originally Apple’s xml keyboard layouts). But it was also very confusing so I won’t go into the details. I figured that since I almost never use caps-lock using that to quickly switch just the three keys that are normally åäö would be ideal.
In the end I managed to produce a keyboard layout that works just like that – normally it’s a US keyboard – great for coding. Hit caps-lock and you can type Swedish normally while keeping everything except ÅÄÖ mapped to the US keys so you don’t get + when hitting the – key and so forth. It also reverts to US when you hit command so all keyboard shortcuts work, even in Swedish mode.
Just give me the solution already!
You can download the Keyboard Layout here, unzip it and put it in “Keyboard Layouts” in your /Library or ~/Library folder, activate it in System Preferences and hit caps-lock and type away, you Swede!
iCal, AppleScript and recurrent events
by Daniel Schlaug on April 18, 2010
Planning on enhancing iCal’s meager feature set with a few good AppleScripts?
I recommend against it.
At first glance iCal seems to have a very powerful set of AppleScript features. There are, however, a few real dealbreakers that are more or less sure to break the reliability of any AS script that uses iCal. It’s all about recurrent events, here’s what I found out the hard way when I attempted to locate recurrent iCal events in AppleScript:
- Only the first of a series of recurrent events are natively reported by iCal
- That first recurrent event (parent event, if you wish) has a parameter “recurrency” that contains a somewhat readable string which you can manually parse to find “all” the events generated by it.
- This method fails to indicate whether any of the generated events have been excluded or altered (by the “Only this event” button that appears when you alter an event generated by a parent event).
- The parameter “excluded dates” of the parent event includes the excluded dates. …or rather it does sometimes.
- This method fails to indicate whether any of the generated events have been excluded or altered (by the “Only this event” button that appears when you alter an event generated by a parent event).
According to my experience recurrent event that has been created and then altered with excluded dates by Google Calendar is not reported in the excluded dates parameter. Nor anywhere for that matter. The only means you’ll have to find these are to parse the events off of the files located in ~/Library/Calendars/[Cal-DAV id]/[Calendar ID]/Events/[Event-ID] – it’s probably easier to just go learn JavaScript and use Google’s calendar API.
So, never use AppleScript when you need to reliably pull event data from iCal. Now then; Apple, will you give me back the 100+ hours I wasted because of your half-done implementations?
Week numbers in AppleScript
by Daniel Schlaug on March 7, 2010
I often come across the problem of handling weeks in AppleScript. Weeks are one of the things that the Mac in general seems completely unaware of. To even be able to view a week number on a mac you need third party software (like the excellent iStat Menus available as donation ware from iSlayer). So of course they’re nowhere to be found in AppleScript’s date handling.
The getting of week numbers can, however, be done rather easily. First we need to confirm the ISO standard for weeks. According to this a week begins on monday and the first week of the year is the week including January 4th. With this in mind getting the week number of a date in AppleScript can be done like this:
Edit: 22/3: Tried to add some clarity to the text.
First Post
by admin on February 28, 2010
At times I feel I’ve done or thought something great that I need to send off out into the world. For that reason exists this journal.
Perhaps obvious to those who knows me is that most of the things I think that would be considered of any worth somehow connects to code, productivity and scripting. Perhaps this is what you should expect from this page.
We’ll see, whatever happens happens…
