sesam.hu

Engineering Manager | Trail Runner | Stockholm, Sweden

CSV to Address Book

Sending a few emails during the day had me realize that the move from Sparrow to Mail raised the issue of Mail not autofilling addresses automatically. I suppose once I've written to that specific address Mail would "learn" it as well, but that sounded arduous.

The other choice was finally buckling down and entering my coworkers' data in Address Book. We have a Google Spreadsheet with contact info for everyone in the office. Only I just refused to enter close to a hundred names, addresses and phone numbers manually.

My first idea was using Automator, but there was no option to create an Address Book entry with it. So I moved on to Apple Script and it looked promising: I could parse a CSV file with it.

As step one I copied the entire Spreadsheet into Excel, removed the unnecessary columns, such as Skype ID, and had the names separated into first name and last name:

=LEFT(A1,FIND(" ",A1,1)-1)

The above function took the contents of the first cell, and copied the text leading up to the first space, excluding the space itself. This resulted in the family name in one cell. (Because in Hungary we write names in the family name, given name order.)

=RIGHT(A1,LEN(A1)-FIND(" ",A1,1))

This one took the content of the first cell, and copied the text from the right excluding the leading part until the first space, which is the family name. Worked well for people who had two last names as well.

Exported to CSV, and there I had the input data.

Then I set out to create a script that opened this file, parsed the values, checked for existing entries and if a name was missing from Address Book then added the data. Took me a couple of hours of reading documentation and googling for examples, but in the end:

set csvData to read file ((path to home folder) & "Documents:hu-office.csv" as string)

set csvEntries to paragraphs of csvData

set existingPeople to 0
set newPeople to 0

repeat with i from 1 to count csvEntries
	set {lastName, firstName, emailAddress, phoneNumber} to parseCsvEntry(csvEntries's item i)
	tell application "Address Book"
		set thePerson to (every person whose last name = lastName and first name = firstName)
		if thePerson is not {} then
			set existingPeople to existingPeople + 1
		else
			tell application "Address Book"
				set thePersonNew to make new person with properties {first name:firstName, last name:lastName}
				make new email at end of emails of thePersonNew with properties {label:"Work", value:emailAddress}
				make new phone at end of phones of thePersonNew with properties {label:"Work", value:phoneNumber}
				save
			end tell
			set newPeople to newPeople + 1
		end if
	end tell
end repeat

log existingPeople
log newPeople

to parseCsvEntry(csvEntry)
	set AppleScript's text item delimiters to ","
	set {fullName, lastName, firstName, email, foo, phone} to csvEntry's text items
	set AppleScript's text item delimiters to {""}
	return {lastName, firstName, email, phone}
end parseCsvEntry

During this experiment I learned the following:

So long, Sparrow

Today Sparrow announced that it was acquired by Google. An excerpt from the notification email they sent:

We will continue to make available our existing products, and we will provide support and critical updates to our users. However, as we’ll be busy with new projects at Google, we do not plan to release new features for the Sparrow apps.

I came to like Sparrow, as an email client designed specifically for Gmail. Since Ustream uses Google Apps, I happily utilized Sparrow for my work mail while I kept my private iCloud account in OS X Mail. This separation seemed to work well, even on the iPhone, where the lack of push notifications for Sparrow ended up to be a feature for me: I didn't get a ton of notifications during the day when I was sitting in front of the computer anyway.

Reading this piece of news however prompted me to remove Sparrow and transfer my work account to Mail as well. I don't plan to invest in dead software. Anyway, on the upside, one email client eats up less resources and I have to learn only one set of keyboard shortcuts. Keeping it simple, stupid.

Battersea

"watching for pigs on the wing"

Notification hell

Probably the most annoying thing currently about using applications on more than one platform: notifications not syncing.

By the end of a workday my phone is full of push notifications and app badges I have already dealt with using the computer. As a result I find myself regularly doing rounds of cleanup: opening up apps one after an other to have them clear the badges. It's partly because I'm obsessive that way and also because notifications kind of lose their meaning if read ones are not cleared.

I do like badges on app icons in iOS, don't get me wrong. I missed them a lot during my few months of being an Android user. For me they work like a to do list: I can see which applications need attention. I only wish they would sync, like if I read a Facebook comment on the computer then the iOS app would lose its badge too, and the relevant entry in the Notification Center would disappear as well.

This is the aspect in which iMessage currently beats every other service: not only do messages arrive on all connected devices but the notifications are also constantly kept in sync and being removed when a message is read on another device.

Zakatol a balatoni nyár

Even though I haven't been at Lake Balaton this year yet. Best to listen to if there's a summer shower. Previously.

Tour de Nagymaros

This was last Saturday:

Somewhat suddenly I found myself in a bicycle tour of the curve of the Danube, North of Budapest. From 9:30 to 22:30 we completed 80 kilometers, had two flat tires, ate hake and ice cream, and generally had an awesome time.

Sky High

So, does your company have its own superhero?

Check out ours: he's called Sky High (スカイハイ) and he's the King of Heroes in the Japanese anime television series Tiger and Bunny (タイガー&バニー).

He is very cheerful, optimistic and polite. His abilities include being able to control the wind and air currents and he can fly with the assistance of his jetpack. The front of his uniform is branded with the Ustream logo.

Nike+ Running 4 [updated]

A new version of the Nike+ GPS app hit the store today. The interface is redone from scratch matching the design of the also new HTML5-driven website. I love all the changes so far. My favourite is the new landscape history view, where the list of runs morphs into a chart. Seeing this made me want to go for a workout right then:

With this version the app is no longer iOS exclusive, they released an Android application as well. And for a limited time both are free to download, so go grab them while you can.

 

Update: To save yourself the annoyance, upgrade to 4.0.1 to fix the lock screen / background bug. Thx @verkutya.

Grenade

To make Thor's day fantastic here's a Bruno Mars cover with the Salt Lake Pops Orchestra and the violinist Lindsey Stirling.

Boyfriend

Marina has turned a song of questionable quality into... well just listen: