Engineering Manager / Trail Runner / Budapest, Hungary

No Connected Camera Error in Mountain Lion

Quite annoyingly after the computer goes to sleep and wakes up again, some applications have trouble recognising the built-in camera. Up until now I resorted to rebooting the Air, which is not that a big deal when you have an SSD, but still I wished I didn’t have to. Turns out there is an easier solution: an application called VDCAssistant is reserving the camera in these cases, which is safe to be killed either from the Activity Monitor or by issuing:

sudo killall VDCAssistant

27th Nike Budapest Half-marathon

Tomorrow, the start/finish will be broadcast by Ustream. Look for us in the We.Are.Running T-shirts!

Installing FFmpeg on OS X Mountain Lion

From time to time I need to do simple jobs with videos, such as a container change. I used to use mencoder for that back on linux and I still think that the versatility of a command line tool is unparalleled by any GUI solution. So I set out to get FFmpeg on my Mac.

There is a static build available from the FFmpeg website, but I decided to take a somewhat more complicated approach and compile it from source myself.

To do so, one first needs Xcode, available from the Mac App Store. The current versions, however, do not contain the command line tools needed. A separate package called Command Line Tools needs to be installed from either navigating to the Downloads for Apple Developers site from Xcode by Xcode > Open Developer Tool > More Developer Tools… or using the built-in package manager at Xcode > Preferences… on the Downloads tab.

Two packages need to be installed separately first: LAME for mp3 encoding (compulsory) and FAAC for AAC (optional). The tar.gz files can be unpacked by, for example:

tar -xzvf faac-1.28.tar

Then enter their respective directories and issue:

sudo make install

Finally, check out the latest source code of FFmpeg:

git clone git:// ffmpeg

Compile it with LAME and FAAC enabled (the latter only if it’s installed). The --enable-nonfree switch is required by FAAC and I got an error unless I disabled Yasm.

./configure --enable-libmp3lame --enable-shared --enable-libfaac --enable-nonfree --disable-yasm
sudo make install

That’s all, FFmpeg is ready to use:

Daenerys:Downloads sesam$ ffmpeg
ffmpeg version N-44141-g9de7622 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep  4 2012 16:10:11 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --enable-libmp3lame --enable-shared --enable-libfaac --enable-nonfree --disable-yasm
  libavutil      51. 70.100 / 51. 70.100
  libavcodec     54. 55.100 / 54. 55.100
  libavformat    54. 25.104 / 54. 25.104
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 15.103 /  3. 15.103
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

Mountain Lion and the freezes

Not that I expected otherwise, but Mountain Lion did naught in fixing the iMac graphic driver freezes that Apple claimed are the result of hardware issues. If anything, the crashes are more frequent, albeit it can just be caused by the fact that it’s Summer and with no A/C it’s 30°C+ inside.

The freezes are often somewhat more graceful now with a kernel panic message and an automatic restart. After such an event a report is generated and sent to Apple. Not that I have illusions of them taking it seriously.

Interval Since Last Panic Report: 170834 sec
Panics Since Last Report: 3
Anonymous UUID:

Sun Aug 26 15:02:46 2012
panic(cpu 0 caller 0xffffff8014ab7b95): Kernel trap at 0xffffff7f962e6821, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x0000000106861000, CR3: 0x0000000020979000, CR4: 0x0000000000000660
RAX: 0xdeadbeefdeadbeef, RBX: 0xffffff8023edb0b8, RCX: 0xffffff802421a228, RDX: 0xffffff802421a368
RSP: 0xffffff808de93a20, RBP: 0xffffff808de93a40, RSI: 0x00000000deadbeef, RDI: 0xffffff8020ffcf00
R8: 0xffffff80150bec60, R9: 0x00007fff5527b2d0, R10: 0x000000000000002c, R11: 0x0000000000000206
R12: 0xffffff807f4ed000, R13: 0x00000000000002aa, R14: 0xffffff8020ffcf00, R15: 0x00000000051ca000
RFL: 0x0000000000010282, RIP: 0xffffff7f962e6821, CS: 0x0000000000000008, SS: 0x0000000000000000
Fault CR2: 0x0000000106861000, Error code: 0x0000000000000000, Fault CPU: 0x0

Backtrace (CPU 0), Frame : Return Address
0xffffff808de936c0 : 0xffffff8014a1d5f6
0xffffff808de93730 : 0xffffff8014ab7b95
0xffffff808de93900 : 0xffffff8014ace4ad
0xffffff808de93920 : 0xffffff7f962e6821
0xffffff808de93a40 : 0xffffff7f96331571
0xffffff808de93a80 : 0xffffff7f962eb2fd
0xffffff808de93aa0 : 0xffffff7f962e4235
0xffffff808de93af0 : 0xffffff7f962e2dba
0xffffff808de93b10 : 0xffffff7f962e4e30
0xffffff808de93b40 : 0xffffff8014e63e8b
0xffffff808de93bc0 : 0xffffff8014e65eb3
0xffffff808de93c20 : 0xffffff8014e638ef
0xffffff808de93d70 : 0xffffff8014a981a1
0xffffff808de93e80 : 0xffffff8014a20abd
0xffffff808de93eb0 : 0xffffff8014a10448
0xffffff808de93f00 : 0xffffff8014a195fb
0xffffff808de93f70 : 0xffffff8014aa5ad6
0xffffff808de93fb0 : 0xffffff8014aced13
Kernel Extensions in backtrace:[F2643601-396F-313A-8D94-5A36091345D0]@0xffffff7f962c7000->0xffffff7f96592fff

BSD process name corresponding to current thread: WindowServer

Broadcast For Friends

It was quite the ride, but this is something I’ve been a part of from the very start. It’s insane to realise that something I worked on ended up to get a press release in San Francisco and then articles in TechCrunch, The VergeVenture Beat or The Next Web.

TNW tested the app, finding it to be quick, and free from errors and lag.

From a QA POV, that’s quite the compliment.

I accidentally all the apps

Only wanted to install an app to the iPhone using another iTunes than it syncs to… turns out that warning that says all applications will be replaced is actually true: it promptly deleted all the applications previously installed on my phone. (The test devices we have do not behave like this for some reason.)

What can you do if this happens? iCloud backups can be used to painlessly restore a phone to its original state, here’s how (please note that WiFi access is needed):

  1. Go to Settings > General > Reset and choose Erase All Content and Settings. This is equivalent to a factory reset.
  2. Go through the steps of the Setup Assistant and enter your Apple ID.
  3. Choose a backup to restore to.
  4. Profit.

First the settings are restored, then the phone reboots and begins to download all the applications, their data, the photo stream, everything, Really it’s equally as magical as Time Machine: when it finishes the phone is exactly in the same state as it was during the backup. Mine even got the alarm for that morning switched on.

Mountain Lion Up-To-Date Program

I was excited to start using Apple’s new OS but it seems that the release has been marred by widespread problems regarding the Up-To-Date Program. Since my Air was bought after the WWDC, I am eligible for a redemption code for the App Store to upgrade to ML free of charge, which arrived in an email in matters of minutes. However, along with several others, the code I have received claims to have already been used, which I sure as hell haven’t done. Reports suggest it may take days to receive new working ones. Not to try to look a gift horse in the mouth, this still could have been done a lot smoother.

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
			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}
			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:

  • For usability’s sake it would have been better to ask for an input file rather than hard coding it in the script but I just couldn’t make it work. As a compromise at least the script runs fine if a properly named data file is placed in the user’s Documents folder.
  • The script doesn’t fail too gracefully when there is no input file either. Or if the data in the file is corrupted, etc.
  • During the process Excel or something messed up the character encoding of the CSV and the ő and ű letters came out as _. They had to be manually corrected.
  • Funnily enough, Excel wasn’t even needed, I just failed to realize Google Docs does CSV exporting as well.
  • My formulas weren’t dealing with the double spaces and trailing extra spaces in the name fields, which – as it later turned out – were left in the source document in abundance. More manual fixing for yours truly.
  • Apple Script is very powerful.

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.

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.