Slow downloads for Apple App Store updates? Try this.

Sun, 2016-07-03 18:47 -- admin

I discovered a nifty trick for those excruciatingly slow Apple Update downloads. My friend left his broken 2008 Mac Pro with me last week. It turned out that he just neglected to plug in the display power supply. The computer has been down for a year(!) because of that.

Since the machine hadn't run since last summer, he was still using Yosemite so I decided to do his free upgrade to El Capitan because obviously that was going to be over his head too.

I started the update and System Update reported that the download would take 3 days, 2 hours. WTF?? I did the same update on my Mac many months ago and remember it taking like 15 minutes. I have a 100Mb connection here.

I kept pausing/restarting the download and the download time didn't budge. Obviously Apple's content delivery network was bricked.

Then it occurred to me that CDNs are usually regional. A user in Australia will be sent to a different CDN node than a user in Italy. Maybe it was just the US node that was farkled.

So I surfed for public DNS servers and found this list:

I went to System Preferences -> Network -> Advanced and deleted all the DNS servers. so there would be no chance for a timeout failover to the next DNS server on the list. Then I added one for the UK that I got from that list above: I wanted an English speaking country just in case Apple defaults the update to the local language too. My Cantonese ain't so good.

My three day download took 11 minutes.

Remember to revert your DNS servers back to what you had before you run the update. Or just use Google's: and

Setting up a hybrid Google Apps mail account

Tue, 2015-12-29 13:43 -- admin

I've run my own mail server since, well, the UUCP days. I used to host a lot of mailiing lists so over the past 20+ years I've run Sendmail, Exim, Qmail and Postfix. They're all different but they share one thing in common: unless running mail servers is your hobby, they're not fire-and-forget applications, especially in the high-spam, high-malware, post-Snowden environment today.  Maintaining a mail server is a chore. You walk a fine line between being buried in UCE and blackholing your Uncle Rich.

I stopped running mailing lists several years ago and since then I've wanted to outsource my mail servers to a reliable third party host.  When I first experienced Google Apps I knew that's where I wanted to be. I don't understand what Google is doing but it's the best mail handler I've used.  I rarely get spam in my Gmail but I've never had a false negative that I'm aware of.  On Gmail, you don't have to muck with Baysian filter settings or install RBLs.  It just works.

The problem is that I create a different email address for every web site I use so I have well over 700 aliases and Google Apps only supports 30 per user with no options to increase that number.  One alternative is to use Google Groups for aliases but that presents its own set of problems. Then a friend of mine, Jesse, told me about yet another alternative.

What Jesse does is keep the MX for his domain and runs his own mail server. But all his local server does is act like an alias forwarding agent.  When mail arrives for it consults its alias database and forwards the mail on to his Google Apps account and one of the restricted number of Google aliases.  Google doesn't have MX for his domain but it's set up to send mail as

This is exactly what I wanted for myself and in fact tried a couple of times to get it to work.  It failed because I handed my primary MX to Google Apps. The first part of the trick is not to do that.  Keep your MX or use Google only as a fallback MX.

The question is if mail arrives at my server as how can I forward it to a different on Google Apps?  That's the second trick.

SMB+SSH: Ubuntu server and OSX client

Fri, 2014-06-13 01:04 -- admin

The title above is pretty close to the Google search query I used in vain to find a recipe for tunneling an OSX Samba client to an Ubuntu 14.04 server. Hopefully this post will save someone the hours I spent trying to set this up.

In the end, like so many Unix projects, the answer turned out to be simple. All that's needed is a configured and functioning Unix/Linux Samba and SSH server .   Everything else is on the client side.

I'm not unfamiliar with Samba. I ran it for years between a FreeBSD Unix server and Windows XT workstation. It had its quirks, and still does. When I dumped Windows for a shiny, new Mac Pro in 2009, I switched to NFS. But with each successive OSX upgrade, NFS got flakier to the point where it became useless so I returned to Samba.  But Samba is inherently insecure outside of a trusted LAN so for out-of-office occasions I started using SSHFS. Unfortunately, SSHFS relies on deprecated, third-party software on the OSX side and it was s..l..o..w.  My PHP Storm IDE was grinding through directory refreshes after Git checkouts.

With the release of OSX Mavericks 10.9, Apple announced that it was dumping yet another networking protocol -- it's own greybeard AFP. To replace it, they embraced SMB2. Or... ta da... Samba. Technically, SMB2 isn't officially Samba however OSX has unofficially supported Samba clients for several operating system releases.  Samba(tm) (the Unix server) is actually a product of the open source team at  SMB is an acronym for Server Message Block, which is a proprietary Microsoft protocol. Samba is built to the published white paper spec for SMB.  

Remote SSH Filesystems on OSX

Tue, 2013-10-29 14:33 -- admin

Developers, particularly web developers, have a need to work on external computers, often not within their local networks.  Over the years I've employed everything from FTP to SFTP/SCP to Samba to NFS to VPNs to cranky Novell networks.  All have their downsides, particularly with regard to security.

I have a MacPro and originally ran NFS to connect to machines on my LAN.  But as Apple released new versions of OSX it became more hostile to NFS, to the point where it because unusable with my Ubuntu-hosted web server.  I retreated back to Samba but it was always a PITA because every time I rebooted the Mac I had to manually remount those network shares.   Half the time they wouldn't appear in Finder so I'd have to do it again.

When I got my new MacBook I decided to spend some extracurricular time sorting out this problem.  My research led me to OSXFUSE.   OSXFUSE is a library that allows foreign filesystems to integrate with OSX's own.  One of those is SSHFS, a GitHub project that allows foreign filesystems to be mounted over a secure socket layer.  This sounded exactly like what I wanted.  There was virtually no setup required on the host other than a functioning SSH account.   While I doubted that it would be a particularly fast filesystem, I'm not streaming media with it, mostly just pushing files through my programming editor which unfortunately lacks SFTP support of its own.

Database Meets Revision Control

Thu, 2011-12-01 14:27 -- admin

Any developer who has worked with HIPAA compliancy knows that the law is murky at best and the fed doesn't publish a programmers' guide to make your life any easier.  However, one of the cardinal rules is the requirement to keep track of who sees HIPAA data, who modifies it and when this was done.  Another is that if you delete/update patient data you need to log what was deleted/updated in order to provide an audit trail, if only for the lawyers.  Failure to do so can subject a company to some pretty draconian penalties.

This creates a challenge on the database side because SQL UPDATE obliterates a record's history.  There are a few potential solutions, such as maintaining a changelog which such updates are written based on table triggers.   I've done this but the log of atomic changes can grow immense.  It's also difficult to reconstruct a large record based on potentially dozens or even hundreds of changes to records which must be retained for up to six years. That's how a traditional RCS would handle rollbacks but it's not practical inside the confines of a database.

Nevertheless, a resource control system (RCS) approach is what's needed, where a SQL UPDATE would maintain a copy of the pre-updated record and freeze it from further changes.  RCS does its work by storing just the changes, or diffs, made to a document.  While it would be technically possible to do this with a database record -- for instance, using a BLOB in a sibling table -- there's a simpler and more practical method that also maintains relational integrity.

Finding duplicate records in a database: the SQL HAVING clause

Sat, 2011-10-01 15:55 -- admin

One issue I run across occasionally is a table with duplicate entries such as two entries for the same company in an accounts payable system.  This can create embarrassing problems with billing if ACME Inc #1 is 90 days overdue because someone posted a payment, and now a credit, to ACME Inc #2.

Using Google Maps with the Garmin Zumo 660

Sun, 2011-05-22 18:36 -- admin

One of the best things about motorcycling is spending a nice day exploring twisty back roads far from home.  One of the worst things is getting lost while running low on fuel and being clueless not only about where you are but where to find gas.  Fortunately, technology comes to the rescue again with a variety of water-resistant GPS units built especially for motorcycles.  Last week, I became the owner of a Garmin Zumo 660 GPS.  I also purchased a bluetooth headset kit for my helmet so I could hear the unit.

After a rocky start, which included trying to charge the Sena SMH10 bluetooth device through the MP3 port (doh!), I spent a couple of rainy nights familiarizing myself with the Garmin.  It's an impressive device, as it should be with a retail price over $700.  But it had one very disappointing handicap: it can only import route sheets from Garmin's MapSource software.  Not only do Google, MapQuest and Bing Maps make MapSource look like a relic from the Windows 3 era, MapSource is only available for Windows, not my Mac.

Yes, the Garmin will let you import destination points from the more popular online map vendors but the Garmin will construct the route for you.  That's fine if you want to get to Point B as quickly as possible but I usually don't want the fastest route.  I usually want one of the least efficient paths -- one which will take me through small villages and across covered bridges with a stop at my favorite hot dog stand which may 20 miles off the optimum route the Garmin creates for me.  (For instance, my favorite route from Washington, DC to NYC is through West Virginia's Monongahela Forest).

Garmin recognizes this so it allows you to construct a route based on waypoints, or mini-destinations within the larger route.   You can do this in MapSource or in the Garmin itself.  But you can't do this using Google Maps because it doesn't export the GPX-formatted file that the Garmin wants to construct a route based on waypoints.

Ironically, or perhaps justifiably, Google gave me the solution to fix this: a handy browser plug-in for Firefox called GMapToGPX.  What this does is read your current Google Maps route and create a GPX list of ordered waypoints in GPX format which can be imported into MapSource, from which it can then be exported to your Garmin.   Here's how it's done.

Tip for restoring a deleted Applications folder from the Dock

Mon, 2011-05-16 11:31 -- admin

A lot of my blog posts are Post-Its for my own brain.  So is this one.  I've managed to accidentally drag my Applications folder to the trash twice now and both times I had to wade through a half dozen non-optimal solutions on the web to find the one that actually restored it to what I had before.

In OSX 10.6 it's actually pretty easy, if not very intuitive.

Returning latest/highest record from a set of records

Sun, 2011-04-10 14:09 -- admin

A common reporting requirement in database applications is selecting the latest purchase, or latest job, or oldest chlld for each person in a table.  Any beginning student of SQL knows how to return the most recent date in a table:

SELECT MAX(rec_date) FROM sales;

 2011-03-15 18:04:45.178057-04
(1 row)                                                           

But that doesn't tell us which person owns that record.  We can do this using a sub, or nested, query on the same table:

SELECT cust_name FROM sales WHERE rec_date = (SELECT MAX(rec_date) FROM sales);

  cust_name |          rec_date
 Dwight Schrute       | 2011-03-15 18:04:45.178057-04
(1 row)                                                 

This could return multiple records with the same rec_date.  But let's say we're not interested in who owns the most recent record.  Instead, we want to know the latest record for everyone in the table, such as the last sales date for every customer. Here's one of the possible solutions for that:

Subscribe to RSS - tech