May 31

I run into a problem where my karma run hangs (see grunt watch hangs on karma:unit:run task). After digging into it I found out that it relates to problem #1 in post etc/hosts bug and dns resolution. Upgrading to 10.8 damaged etc/hosts. DNS resolution of localhost was extremely slow.

To fix this you could use 127.0.0.1 instead of localhost or split lines in etc/hosts

Instead of

127.0.0.1 strug-imac.hypoport.local localhost

split them into single lines

127.0.0.1 localhost
127.0.0.1 strug-imac.hypoport.local

Tagged with:
Jun 13

Currently I’m setting up a new SSD. One of my first installations is homebrew, a must have IMO.

I have two users. Allen the admin and Stan the standard user. Stan is a developer who works most of his time inside our company network. Allen is responsible for installing apps and so on. For security reasons Stan don’t want to be admin. Nevertheless Stan wants to use homebrew, he loves it too. Allen don’t want to have two homebrew installations so that he allows Stan to use his homebrew.

Update 2013-05-31: considering /Library/Caches/Homebrew

Setup

  1. Create a group brew and add Stan
  2. brew doctor (Allen checks if he installed brew correctly)
  3. sudo chgrp -R brew /usr/local (Change the group of homebrew installation directory)
  4. sudo chmod -R g+w /usr/local (Allow group members to write inside this directory)
  5. sudo chgrp -R brew /Library/Caches/Homebrew (Change the group of homebrew cache directory)
  6. sudo chmod -R g+w /Library/Caches/Homebrew (Allow group members to write inside this directory)
  7. brew doctor (Stan checks if he can use homebrew)
  8. We are done!

Detailed Setup

Create a group brew and add Stan
One way to create a group brew is to open the System Preferences and select Users & Groups. Unlock this screen and press the lower left +. Select the account type Group and name it brew. After creating this group add Allen and Stan.

Allen checks if he installed brew correctly

allen$ brew doctor
Your system is raring to brew.

Change the group of homebrew installation directory

allen$ sudo chgrp -R brew /usr/local
Password:
allen$ ls -la /usr/local
total 16
drwxrwxr-x 8 root brew 272 Jun 12 22:31 .
drwxr-xr-x@ 13 root wheel 442 Jun 12 22:36 ..
-rw-r--r-- 1 admin brew 159 Jun 12 22:28 .gitignore
drwxr-xr-x 2 admin brew 68 Jun 12 22:33 Cellar
drwxr-xr-x 6 admin brew 204 Jun 12 22:28 Library
-rw-r--r-- 1 admin brew 789 Jun 12 22:28 README.md
drwxr-xr-x 3 admin brew 102 Jun 12 22:28 bin
drwxr-xr-x 3 admin brew 102 Jun 12 22:28 share

Allow group members to write inside this directory

allen$ sudo chmod -R g+w /usr/local
allen$ ls -la /usr/local
total 16
drwxrwxr-x 8 root brew 272 Jun 12 22:31 .
drwxr-xr-x@ 13 root wheel 442 Jun 12 22:36 ..
-rw-rw-r-- 1 admin brew 159 Jun 12 22:28 .gitignore
drwxrwxr-x 2 admin brew 68 Jun 12 22:33 Cellar
drwxrwxr-x 6 admin brew 204 Jun 12 22:28 Library
-rw-rw-r-- 1 admin brew 789 Jun 12 22:28 README.md
drwxrwxr-x 3 admin brew 102 Jun 12 22:28 bin
drwxrwxr-x 3 admin brew 102 Jun 12 22:28 share

Change the homebrew cache directory accordingly

sudo chgrp -R brew /Library/Caches/Homebrew
sudo chmod -R g+w /Library/Caches/Homebrew

Stan checks if he can use homebrew
In my case Allen and Stan is one person, so that a simple login do the trick.

allen$ login stan
Password:
stan$ brew doctor
Your system is raring to brew.

Tagged with:
May 12

I’m looking for a way to identify if an application on my Mac stopped. I couldn’t find anything, so it was time to write my first AppleScript:

set network_connect_is_running to is_running("Network Connect")

if network_connect_is_running then
	repeat until network_connect_is_running is false
		delay 10 -- wait some seconds
		set network_connect_is_running to is_running("Network Connect")
	end repeat
	-- application stopped, so run a dummy app so that marcopolo can switch context
	tell application "NetworkConnectStopped" to activate
end if

on is_running(appName)
	tell application "System Events" to (name of processes) contains appName
end is_running

The code is quiet simple. Line 12-14 defines a function which checks if application appName is running. Line 01 calls this function and checks if the application “Network Connect” is running. The result is stored in the variable network_connect_is_running. Only if “Network Connect” is running (line 03) I want to start my listener. The listener (loop line 04-07) checks every 10 seconds if the application is still running. If not, the loop ends and I can start my trigger application “NetworkConnectStopped”.

So what is this all for?

I use MarcoPolo to switch my network connections. I use three contexts:
- home
- homeOffice (VPN)
- work
The contexts differ in things like proxy, printer, mounts.

The problem: MarcoPolo has no rule “Not Running Applications”

When I’m at home and start my VPN (Network Connect) I use this application to switch automatically to context “homeOffice”. When I finished my home office session and quit “Network Connect” I want to switch automatically to context “home” again. This can not be done with MarcoPolo so far. Now the above script comes into play. I stored this script as an application and start this listener when switching to context “homeOffice”. When I quit “Network Connect”, my listener recognizes this and starts the application “NetworkConnectStopped”. This application is created with the Automator and contains nothing but a “Pause” of 6 seconds. One more than the default MarcoPolo rule update interval. The last step is to add a rule “Running Application” to MarcoPolo which switches to context “home” when application “NetworkConnectStopped” is running.

Here are my MarcoPolo rules:

And here are my actions:

If you have suggestions or need more details feel free to comment.

Tagged with:
Nov 04

In one way or another you are using task lists, I’m sure.

A task list – as the name suggests – is a list of tasks. How does it normally works?

While you are coding your brain (and/or the brain of your pair) try to escape :) It creates thoughts like:

  • I need to test this and that as well
  • Here it might be cool to clean up the campground
  • The name of that class did not express the intention any longer, what is more suitable?
  • ..

These ideas of other tests and possible refactorings keep you from the current task. To keep focus write them down. Free your mind. If you finished your task, take the next one from the list. New ideas? Add them. Let the task list evolve. Clean up your list frequently. If you have tasks that you won’t do shortly, create user stories and sell them to your product owner.

This practice allow you to keep focus on the current task without loosing your ideas. You’ll have less context switches. It makes you more productive. Try it!

TDD Task Lists With IntelliJ IDEA

I use this Task Plugin. It is simple and easy to use. Every action can be triggered with the keyboard. Changing keyboard mappings can be done classically with IDEA’s keyboard mapping. Because of the missing Insert key on my MacBookPro I remapped Add Task. To go quickly to the Task Tool Window you can either map it to a key or use the switcher (Ctrl-Tab on OSX):

Tagged with:
Oct 09

One very useful IntelliJ IDEA feature is the Multi Clipboard (Cmd-Shift-V). Outside IDEA you can use Clipmenu.

Keep in mind to change it’s default Shortcut Cmd-Shift-V to e.g. Ctrl-Shift-V, so that you don’t overlay IDEA’s shortcut.

Tagged with:
Oct 03

I have my MBP for more than 4 month and today I found out that there is a forward delete (⌦) :)

Symbol Key Description
delete This is the delete key at the upper right corner. It works like backspace in Windows and Linux. I’m a Mac-Newbie so I expected a forward delete first
Fn+⌫ ⌦ is not available on laptops. You can emulate it on a MacBook with Fn+⌫

Men, why it took me so long?

Tagged with:
Sep 27

Here is an update to my last post about Journler. If you have two user accounts, e.g. one for work and one for private use, you can store your Journler directory at a shared resource. Now change the group of all files to staff and give the group write permissions.

[sourcecode language="text"]
admin$ mv ~/Documents/Journler /Users/Shared/pim
admin$ cd /Users/Shared/pim
admin$ chgrp -R staff .
admin$ chmod -R g+w .
[/sourcecode]

Tip: To prevent you from trouble, it is best to quit Journler before open it with another account again.

Tagged with:
Sep 25

I’m searching a tool for collecting and organizing notes. This is better known as Personal Information Manager. I checked some personal wikis like VoodooPad and took a quick look at Yojimbo and Evernote. Finally I found Journler. The development of this software has ended, but the current features seem to be enough for my most important use cases:

  • Be able to tag content
  • Be able to search content by tags
  • Be able to use spotlight for search by tags
  • Be able to write rich text
  • Be able to export content (in case that this version won’t run with future OSX’s)

Why tagging? Our confluence wiki at work is a good example. Without tags the search is mostly a search and not a find.

So let’s take a tour of Journler.

Set Up

To enable the Spotlight Search you have to import the meta data of Journler (this requires admin permissions)

[code language="bash" gutter="false"]
mdimport /Applications/Journler.app/Contents/Library/Spotlight/JournlerMetadataImporter.mdimporter
[/code]

Check with mdimport -L if the path is part of the importer list.

First launch

Starting Journler the first time gives you some entries to play with. To delete these, select them and press Command-Delete.

Journler at work

Create a new entry (Cmd-N), write your content. Ok, now tag your content. Press Ctrl-Shift-Tab to move from the editor to the Tag field. Enter your tags, separate them with a Comma or a Tab. Press Shift-Tab twice to go to the Title field. Your first note is entered.

Search content

If you’re insight Journler press Option-Cmd-F. Type what you’re looking for. The search starts immediately. If you want to use Spotlight press Cmd-Space and start typing.

To narrow down the result, it is good to add journler to your search: E.g. journ product should bring the Journler productivity notes up even if you have a lot of files that are named with productivity.

To walk through the search result press Cmd-7 and use the up and down arrows. Press Cmd-8 to go to the entry/editor.

A Goody – Smart Folder

One goody that I discovered already is the smart folder. You can create rules that will be applied to your entries. Here is a sample to create a folder with the recent entries:

Summary

The first hands on sessions are promising. My use cases are fulfilled.

Here are the shortcuts we used so fare:

Cmd-N : New Entry
Cmd-7 : Entries List
Cmd-8 : Goto Entry/Editor
Ctrl-Shift-Tab : Go from Editor to Tags
Shift-Tab : Go up
Tab : Go down
Option-Cmd-F : Find in Journal

Tagged with:
Sep 25

Henrik Kniberg seems to had a great session with Mary Poppendieck about Social Technical Systems.

You must see this amazing presentation about What Motivates You! Great style, great content.

I wasn’t so wrong when I wrote about bonus systems.

Tagged with:
Sep 17

The preferences of the Terminal.app doesn’t offer to define a keyboard shortcut. Using Spotlight to open apps is sufficient in most cases. If you use an app like the Terminal more often you might be looking for a simple keyboard shortcut. Install Quicksilver and add a custom trigger:

Now pressing Option-T opens the Terminal or gives it focus.

Tagged with:
preload preload preload