zsh arguments-fu
When using Subversion from the command-line I commonly do:
svn copy ^/myproject/branches/FB-branch1 ^/myproject/branches/FB-branch2
svn switch ^/myproject/branches/FB-branch2
This is a lot of typing. One way of working around this a wrapper around svn to automate these patterns, but another is using shell power. I use zsh, but bash and others can do the same with slightly different syntax:
svn copy ^/myproject/branches/FB-branch1 ^/myproject/branches/FB-branch2
svn switch !!:3
Here !!:3 is the third argument of the last command. Neat!
-
Librarian:
There's a problem with this account update. It seems you have changed your default library account password.
-
Me:
yes.
-
Librarian:
...
-
Me:
I like chaning my passwords every now and then.
-
Librarian:
It's not recommended to change your password. No we cannot update your account.
-
Me:
...
-
Librarian:
I'll create this extra account for you, and restore its default password. Your password should be the first four digits of your birthday. But don't change it again. It's makes life difficult for all of us.
-
Me:
Ehm… thanks?
Wonderful book, now available online for free.
-
McDonald's employee:
here's your burger. You might want to check if it's still good.
-
Me:
excuse me?
-
McDonald's employee:
you know, try it. I'm not sure if it's still good.
-
Me:
I think I prefer a new one, regardless.
-
McDonald's employee:
why? It might still be okay!
Using Postbox
I’ve decided to give Postbox a try as my default e-mail client. I love Mail.app’s simplicity, but it has some quirks and I feel I could do better.
Here’s what I like so far:
- A sleek interface for tagging (called topics)
- Quick browsing of attachments in a folder or from a contact
- Archive message immediately with ‘a’
- Gmail-style conversation view
- Pretty good and quick search
- Plug-in potential, although there’s not much available yet.
Here’s what I dislike so far:
- No global folders, i.e. one inbox, trash, sent and drafts for all accounts
- Topics don’t seem to be IMAP-portable, so you have to apply tags both at home and at work
- Message rules can not filter on content, only on message headers
- The message composer is bulky
- Integration with Mac OS X is not as good as Mail.app
- It’s Mozilla-based, not native.
I’m undecided on:
- Tabbed interface. I’m not used to it, I don’t need it and I don’t use it. But it might grow on me.
- Editing messages: not sure why I’d want to do that.
- Facebook and Twitter integration
Postbox does not come for free, while Mail.app and Thunderbird do. So it should really impress be before I switch. I remain unconvinced but hopeful for now.
Test apache configuration syntax
Recently my Mac OS X stock install of Apache failed to launch properly. The regular system preferences interface stopped and started Web Sharing without complaining, but I could not find httpd actually running using ps -ax | grep httpd in the terminal.
I was at a loss to explain why, until I found this little gem that you can use to syntax-test your configuration files with: apachectl -t will report on any errors in httpd.conf or any of your other included files.
It appeared that some time ago when I was attempting a manual upgrade of my Subversion install to 1.6.9 some Apache modules were corrupted. As I have no use for them I disabled them.
That did the trick, and now I’ve got my local development environment up and running again.
Javascript: typeof NodeList
Beware of Javascript’s quirky typeof:
typeof document.getElementsByTagName('p')
This will return 'function', which I did not expect. What is returned is a NodeList, which behaves like an array, identifies itself as a function, but really is neither.
If you want to detect a NodeList you’re better off with feature detection:
var isNodelist = (typeof myvar.length != 'undefined &&
typeof myvar.item != 'undefined')
Do note that this makes it probable you’re dealing with a NodeList — but you can’t be sure.
Getting Things Done with Rituals
In order to achieve real productivity you need to get into the zone. Context switches take you out of the zone and should therefore be managed carefully. Get rid of multitasking.
I’ve found the mental overhead of context switches can be reduced with a clear start and end for a tiny break from work. A ritual provides such clear boundaries. I use several rituals throughout my day: reviewing my to do’s, drinking a cup of coffee while skimming through the news, getting a cup of water, and so forth. Even the daily commute between home and work helps ‘switching off’ at the end of the day.
I’ve grown used to them over time. I think I now get why people are so resistant to change…
“In retrospect, all revolutions seem inevitable. Beforehand, all revolutions seem impossible.”
Michael McFaul