Trimming Newlines (\n) from NSStrings

Wow, what a lesson in heartache for such a simple little need.

I’m walking an NSDictionary and need to output the results. Not a hard task. No, not at all.

Except that my source data (API call, long story) is prepending all text nodes with a \n. Or it could be the XML to Dictionary code I picked up and threw into the class like there was no tomorrow.

After several lacklustre searches on Google. I found this:

NSString *newString = [oldString stringByTrimmingCharactersInSet:
[NSCharacterSet newlineCharacterSet]];

Pretty simple when you get right down to it, but still, it took me a little while to find the solution.

What was missing from the BlackBerry Playbook announcement…

RIM announced the PlayBook today.

Three things missing from their announcement:

  1. Price
  2. A view of their virtual keyboard
  3. Storage


This will be a big thing. I’m betting with all the extra ports, the dual core processor etc, even with a smaller screen, this thing will be at a similar price point to the current iPad. I think they are putting too much into this device and by slapping an ‘enterprise ready’ sticker on it, they are telling their investors who their target market is.

Virtual Keyboard

I’ll admit I didn’t watch the announcement, but after looking through the pictures and the teaser video, I can’t see the keyboard once. It *is* mentioned on the specs page, but that is all. I’m guessing it’s final shape has not been decided or it is being given the fine tuning. Swipe?


No mention of storage, not one iota. This is actually pretty smart I think. These guys will wait and see what the iPad2 has in store, what the prices for ram is and then make their determination in 2011 Q1. But still, not even a ‘large capacity’ or anything.

I’ll be watching this one, if only because I am one of the few patriotic Canucks and I like to see the local boy do good.

One more thing, “It does Flash”

What is this, the litmus test for any consumer device now? My goodness, I grew up in a world without Flash and I made out pretty well. Flash my ass. It’s not on my iPad and I don’t miss it at all.

Bash Attack

Bash is a great unix shell and one I work in everyday whether at the office or at home.

Everyone who uses this shell regularly will tweak it to match their own special quirks.

Here are some of mine.

Directory Aliases:

alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto'
alias ll='ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto'
alias la='ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto'

Up n directories, minimum one:

..() { if [ $1 -ge 0 2> /dev/null ]; then x=$1; else x=1; fi; for (( i = 0; i < $x; i++ )); do cd ..; done;

Current directory size listing:

alias dud='du --max-depth=1 -h'

Watch something:

function w() { watch -dn1 $*; }

Not much, but I hope someone finds them useful.


I love the subversiveness behind amelie. So, here is a nice WordPress plugin for you.

Blog: Hello World

Here is the skinny:

I am a professional developer in Toronto. I’ve worked on some very high profile sites and some not so high profile.

I’ve been gainfully employed since 1998 as a developer and have seen the best and worst practices, pre-existing code and clients.

This site is a semi-anonymous stage for my thoughts, rants and code-blocks. I won’t critique my current or past employers here but I will give examples of my experiences to help illustrate my points.

I won’t promise that it will be a smooth and eventful ride, but we will arrive at a destination, er, sometime.