vankuik.nl

Latest weblog entries

2016-01-17 The new Mac Pro

As an app developer, I've always been following the new Mac Pro (usually shortened to nMP, as opposed to the cMP, where c stands for classic). For portability reasons, clients usually give me a retina MacBook Pro to work on, but the Mac Pro is a desktop computer. Thus it offers all that desktops usually offer: more power.

If you're a desktop person then for some time, the Mac Pro hasn't been the first choice; usually the 5K iMacs would be a better choice. App developer Marco Arment explains why: The Retina iMac versus the Mac Pro.

And then there's the fact that the nMP couldn't really be called "new" at this point. Both the CPU and the GPU are pretty old tech. And its SSD is easily beaten by the SSD in the 2015 rMBP. It hasn't been updated since its release end of 2013 and the MacRumors Buyer's Guide maintains a disheartening running tally since its last update.

For 2016 however, the stars might align and Apple may give some love to the nMP. Over at the MacRumors forums, enthusiasts have been speculating and there has been long-running thread with the subject Will there be a new Mac Pro in 2016. User Stacc gave an excellent summary of that thread which explains what we can expect of the new Mac Pro.

2016-01-09 Compress PNG files with pngquant

A little trick if you want to save some space and/or bandwidth; compress your PNG files. Although PNG is a lossless format, you can compress them if the image in question doesn't have a lot of colors. This is often the case when creating screenshots.

In yesterday's screenshot of my terminal window, there's obviously not a whole lot of color. OS X by default saves the image with 24-bits colors, but the image looks perfectly fine with just 8 bits. After compression, file sizes looked as follows:

 -rw-r--r--@ 1 bartvk  staff    88K Jan  8 12:11 Image_2016-01-08_dd_progress.png
 -rw-r--r--  1 bartvk  staff    17K Jan  8 12:13 Image_2016-01-08_dd_progress-fs8.png

That's not so bad. The pngquant homepage is here and on OS X, it's easily installed with a quick

 $ brew install pngquant

2016-01-08 BSD dd progress

The commandline utilities that come installed with OS X originate from the BSD world. This means that option-wise, they're fairly spartan as opposed to GNU userland.

Today, I needed to create a bootable USB stick to install Ubuntu. It works fine and basically tells you to use dd to copy a bootable image to a USB stick.

Now if you have a slow USB stick, this can take ages and you're wondering if it's making progress. To see what it's doing, open another terminal and find the process number of dd:

  $ ps -ef | grep "dd if"
  501 76765   412   0 11:29AM ttys000    0:16.19 dd if=/Users/bartvk/Desktop/ubuntu-15.10-desktop-amd64.img of=/dev/disk1 bs=1m
  501 76786 75363   0 11:29AM ttys002    0:00.00 grep "dd if"

The second number of the first line is the process ID, in this case, 76765. Now run the following command:

 $ while true; do sudo kill -SIGINFO 76765; sleep 5; done

This will cause the running dd to print out statistics (roughly) every 5 seconds.

Image 2016-01-08 dd progress.png

2016-01-06 About an old Google Drive document

John Gordon writes about losing images in an old document on Google Drive:

A Google Doc I wrote in 2010 has lost its images

I encountered this issue right when the transition was made from the old editor to the new editor, which might have been around 2010 (not sure about that). Since then, I had gotten weary. Whenever I'd create an important document, I'd create a folder on Google Drive, put the images and other assets in there, then include them in the document. In other words, they would never be just in that document.

With Google Drive, I first thought that all files (Goole Docs, Sheets, etc.) would be synced locally, and that my local backup solution (Time Machine) would save a copy. But to make sure that happened, I tried to figure it out and create a matrix of what was viewable and editable offline: 2013-09-28 Criticism of Google Drive. In the end, I figured it was very hard to get a reliable backup of Google Docs, Sheets etc.

Back then, I hated the Microsoft Office format lock-in. Google seemed somewhat more open, and it was. But only in the sense that they had an export to the Open Office format. Their own format is very much closed, and has remained so for all this time. With Microsoft Office at least your local backup solution works fine, and the format is understood to a certain degree and imported by a number of software packages, some of them open source.

2015-12-11 Measuring startup time

The startup time of your app is determined by a bunch of things, but one that you can easily and directly influence, is the time spent in your AppDelegate's function didFinishLaunchingWithOptions. You may have put a number of things in there, and if you want to find out which step is taking up all that time, it's not always useful to fire up Instruments. A simple way is to just dump a bunch of logging statements.

Paste the following code at the top of the AppDelegate.swift file.

	var logTimer: CFTimeInterval = -1.0
	var logStep = 1
	func logAppProgressInit() {
		logTimer = CACurrentMediaTime()
	}
	func logAppProgress() {
		let stepTime = CACurrentMediaTime() - logTimer
		NSLog("Step %d took %.3f seconds", logStep, stepTime)
		logStep++
		logTimer = CACurrentMediaTime()
	}

Then paste the following line at the top of your didFinishLaunchingWithOptions:

	logAppProgressInit()

And the following line after each (functionally meaningful) line of code in didFinishLaunchingWithOptions:

	logAppProgress()

This code is just for a quick round of debugging, and must be removed afterwards. NSLog itself is slow and wasteful in this phase.

More...

Weblog Archive

Weblog entries 2015

Weblog entries 2014

Weblog entries 2013

Weblog entries 2012

Weblog entries 2011

Weblog entries 2010

Weblog entries 2009

Weblog entries 2008

Weblog entries 2007

Weblog entries 2006

Weblog entries 2005

Weblog entries 2004

All weblog entries

Articles

Articles, chronologically (latest first). This is pretty old stuff.

Scribblings

Not yet finished. Maybe will never be finished. Maybe they'll get deleted. Who knows?

Programming:

System administration:

Others:

Files: