ASP.NET vNext : on a Mac!

I use a MacBook Pro (currently running OS X, 10.9)  as my primary work machine, even though my company builds software for Windows Server. This means VMs (VirtualBox) and Remote Desktop for all Visual Studio work (as well as Visio and other necessary evils). BootCamp isn’t an option, for various company-specific reasons.

I read Scott Hanselman’s ASP.NET vNext announcement a few months ago, and while Mac support isn’t the main thrust of the project, the prospect of shifting even more of my daily work to the native Mac interface is appealing.

I never took the time to play with the vNext tooling for Macs until today. I like where this is headed, even though it’s at the duct-tape stage.

Getting set up is a pretty straightforward exercise, using the instructions here. Which boil down to:

  1. Install mono.
  2. Install homebrew.
  3. Install the K version manager. (Project K being the old code name for the ball of wax).
  4. Grab the samples, pull in package dependencies (via kpm restore), and run ’em. If done right, you get a shiny hello world:

It's alive!

Next on the to-do list:

  1. Write some custom code, following the samples.
  2. Sublime Text 3 integration. With detail here.

Find all NuGet references in your source tree

I have a source code repository with a bunch of Visual Studio 2012 projects. I just had a need to find all NuGet references in that repo. PowerShell to the rescue! This script walks the directory tree and spits out an array of strings containing the names of all NuGet package names, with duplicates removed.

# Given the directory tree at the current location,
# search recursively for all files named "packages.config"
# and select the ID of each package. Assumes that packages.config
# is an XML document with a top-level <packages> element with a nested
# collection of <package> elements underneath.

$result = @()
ls -r packages.config | foreach {
  [xml] $data = get-content $_.fullname
  $data.packages.package | foreach {
    # Brute-force shove into an array, we'll sort it out later.
    $result += $
# It's later! Sort, and unique-ify.
$result | sort -unique

SSD upgrade for 2011 iMac

I picked up a Crucial m4 256GB SSD as a second internal drive for my 2011 iMac 27″ with 12GB of RAM, the factory 1TB hard drive, and OSX 10.8.3. The SSD is now my boot drive, with all my applications and user folders on it as well. Performance is excellent — apps (Pages, Word, Excel, Photoshop, iPhoto, iMovie, etc.) all start immediately, and I can run whatever apps I want simultaneously. It just works.

Before installation, I made sure I had a Time Machine backup (on a Synology NAS) and a backup on CrashPlan’s servers. I used the SATA cable and installation tools from OWC, and followed OWC’s awesome installation video, below. The SSD mounts inside the machine using foam sticky tape just behind the DVD drive.

After installing this drive, I used SuperDuper to replicate the stock “Macintosh HD” volume to the SSD, then used System Preferences –> Startup Disk to change my startup disk to the SSD. I also picked up the app TRIM Enabler, and turned on TRIM support. Upon rebooting, I also unmounted the Macintosh HD volume using Disk Utility, just to make sure I wasn’t accidentally using files on that volume. After a few days of using the new SSD and verifying I have no problems, I will erase the original Macintosh HD volume and use it for whatever.

256GB is plenty for the OS, my apps, and docs. But it is not sufficient to include my photos, music, and movies. All that stuff is on external drives anyway, so I didn’t have to worry about that.

This is also posted as an Amazon review.


Angie and I recently took a trip to Zihuatanejo, a lovely beach town on a bay in Guerrero, Mexico. My friends Darrell and Todd & Kathy had been there before and provided recommendations, but I’m not ashamed to admit that I was already a bit emotionally attached to the place before ever going there, through the references in Shawshank Redemption.

TL;DR version of this: Zihuatanejo is awesome, and you should go there. Oh, and there’s pictures of food below, so there’s that.

Some of the photos below were taken by me on a Nokia Lumia 920. The best photos were taken by Angie with some real photography equipment.

Viceroy Hotel

We spent eight days in Zihua, bunking at The Tides The Viceroy. Which is an excellent place to stay, and as long as you take their cheap room, is an excellent value as well. It’s not cheap by Mexican hotel standards, but it’s not anywhere close to the cost of typical resort hotel (you know, the “all-inclusive” types that ensure you never leave the place).

Panaroma of the beachfront at The Viceroy.

The Viceroy is smack in the middle of Playa La Ropa, the main tourist beach on the bay. It is within a short stroll of several restaurants on the beach. If you’re into this sort of thing, you can rent jet skis, kayaks, sailboats, and harness up to a parasail right there on the beach. We did none of that stuff, but there were plenty of others doing just that.

This hotel has a long stretch of beachfront, with dozens of palapas with beds and lounge chairs in a de-militarized zone between the hotel buildings and the public beach. Being sectioned off was important, as there are many vendors on the beach who want to sell you stuff you don’t need at yankee prices. It’s great to pick up some local arts and crafts and support the community, but I want to do it on my own terms.

We often got lost in reading books under a palapa, listening to the waves, and enjoying a steady stream of Coronas being served by the super-attentive-but-not-overbearing waitstaff. Juan was our bartender on most nights … a wonderfully-friendly fellow, with excellent English, and strong tolerance for my terrible Spanish.

Some of our best days went like this: read books, beer, guacamole, read/beer, beer/read, sunset, dinner. Really, just perfect stuff.

Did I mention that this was all on the beach?

And then there was this: the most unexpectedly-awesome part of the hotel was the coffee service. By 7:30 a.m. every day we had an insulated pot of hot coffee and a few pastries waiting on our semi-private patio outside our room. It was sooooo nice to be able to wake up slowly, and enjoy coffee and chat a bit at our room. So wonderful.

Our room rate came with a daily restaurant credit, which we took advantage of. Typically covered cost of lunch and a few drinks during the day, which was a nice thing to count on.

Dinner at the hotel was fairly expensive, but the food was great and the setting was absolutely perfect. I mean really, can you top this?

View from dinner at The Viceroy at sunset.

Well, maybe you can. After dark, the dining area looks like this:

Dinner at The Viceroy, after dark.

Food & drink

Speaking of beer, we treated it like water. Had a lot. Needed to, as the weather was quite warm and humid. There’s really just something awesome about a cold lager beer in hot weather. And, it was roughly the same price as water. The hotel charged a lot more than other places (captive customer, you know), but that’s to be expected.

Darrell had recommended a few places for us to try, and we did, as well as hitting up some other spots. All the below are highly recommended.

Tamales y Atoles Any

Tamales y Atoles Any is a tamal and pozole joint on a busy intersection in el centro de Zihuatanejo. We went there twice for lunch. Angie got red and green pork tamales for 25 pesos each, and I got a medium-sized serving of pozole (yes, on Thursday!) for 90 pesos. By medium-sized, I mean giant, massive, took me an hour to eat it all -sized. Ohmygoodnesss this was tasty.

As you can see, it was a rather warm day.

Really just a great restaurant, with good simple choices and good prices.

Seeing the state police pull up outside with their automatic weapons and set up a defensive perimeter while one of their crew went to the ATM across the street was a nice bit of cultural immersion, too.

Los Braseros

Just a couple doors down from the tamal place was Los Braseros. Ordered the alambres de pastor — a new dish to me. Sort of a beautiful love child of fajitas and Philly cheese steak. Tasty!

Alambre dish.


Famous for their coconut shrimp, and for good reason. Shrimp stuffed with cream cheese and breaded & fried. Go light on the coconut dipping sauce, it’s basically straight sugar with a dash of coconut milk. Lety’s is located just over the footbridge just west of el centro, along the harbor inlet.

Coconut shrimp at Lety’s.

We also tried the chile relleno at Lety’s, which was just OK. Basically, too rich and too much going on. Would have preferred a simpler dish. No picture of that one :).

Paty’s Marimar

Paty’s is a beachfront restaurant just north of the Viceroy, and has a moderately-priced menu. Definitely tourist prices, but not hotel prices. Shrimp tacos were 90 pesos, whole garlic-fried red snapper was 150 pesos. Both were wonderful.

Shrimp tacos at Paty’s.

Sights & sounds

If you do nothing but relax on the beach, you have won. That said, we ventured out a bit. Walked into town a few times (30 minutes or so each way), which included a stroll up and down some steep roads.

Downhill to the beach.

El centro is lively and buzzing with activity. Near the waterfront you have to deal with vendors trying to sell you stuff at every turn. Head away one block, and you are in town, and free to move. Which we did. A lot. Found a nice tequila shop and bought a small bottle of Chamucos reposado tequila for less than 100 pesos. It was nice to sip that on the beach later on.

Wall mural

This tree, near Playa Principal, seems rather resourceful.

Might be undermining the foundation’s strength.

The emotional highlight of the trip was being by ourselves on the beach late at night under the full moon, and watching a mama turtle come out of the waves, build a nest just a few feet away from us, and lay her eggs. All told, it took her about 30 minutes to dig, lay, cover. The light from the photo was the ambient light from a walkway light on the beach at the hotel behind us.

La tortuga madre

We ended up seeing four turtles lay eggs while we were there. On one occasion, a local conservation official collected the eggs as the turtle was laying them, and took them to a breeding facility on the south end of the beach. 81 eggs in all!

So, what happens to the turtle eggs? I’m told a couple months later, they start popping out of the sand and make a run for the beach. We were lucky to see that too, obviously from a two-month-old nest:

Turtles coming out of the nest.
Making a run for the ocean. We helped this one along.

On the south end of the bay is Playa Las Gatas. How should I say this? How about: don’t go there. Really. Complete and total tourist trap, lined end to end with restaurants trying to get your business. It’s kinda isolated, and most people take a water taxi to get there. We walked. The views are nice, but it’s just not fun. Too cramped, too many vendors. If you don’t have a hotel on the beach, maybe this is an OK place to visit, but we really didn’t like it.

Panorama from the pier at las gatas.
Playa Las Gatas, looking south-east

You can rent snorkel gear and check out the little bay at las gatas, but the water looked very murky. Can’t imagine that the snorkeling would be any good there.

Supposedly you can walk further west past the beach, around the point, and see the lighthouse. Read about that afterwards, would have attempted that if we had known.

Then again, the giant iguana was kinda cool …

I said, this is my beach.

OK, so it was just somebody’s pet. But still cool!


Zihua is a great place. Go there, eat well, and live well.



A visit to the Antipodes

I just returned from a business trip to Sydney, Australia, and Auckland, New Zealand. My second time in Australia, my first in New Zealand. I had a great time visiting with clients, colleagues, and seeing the sights. Below are some highlights of my trip.


In Sydney, I stayed in a hotel right by Circular Quay, which made it ultra-convenient to hang out at The Rocks, get to the ferries, and get great views of the opera house and the harbor bridge every day. The weather was fantastic. Roughly 80 degrees Fahrenheit every day, blue sky, and light wind. Since I planned to be outside pretty much every chance I could get, I couldn’t have hoped for better weather.

The Rocks

No tourist visit is complete without spending some time at The Rocks, which is history, tourism, pubs, food, and shopping all in one place. I spent time at Phillip’s Foote (grill your own slab of meat), The Australian Hotel (wide beer selection, awesome pizza), and saw a bizarre-but-good U2 cover band at The Orient Hotel while enjoying a $7 Guinness, the cheapest beer I found on my trip. We ‘mericans are spoiled by good beer that is relatively cheap.

I also stumbled across some artwork that basically blamed the colonial revolt by the Americans in 1776 as the reason why Australia became a dumping ground for convicts in the early 19th century. England needed to find another home for them after their convenient offshore prison across the pond was no longer available. I had never made this historical connection before. Is it valid?

Hyde Park

A large park adjacent to Elizabeth Street, and right next to our office there. There was a large protest there the prior weekend, not a good time to be there for a tourist. Fortunately, the immediate turmoil had died down by the time I was there, and there was a neat photography art exhibit on display. Lots of families out enjoying a lovely spring equinox. As it should be.

Opera House

Everybody knows the opera house, and it’s quite impressive in person. It’s hard to avoid filling up your camera with photos of this thing from every angle. I did take the guided tour inside, which was interesting, but not necessarily awesome. Much of the history can be learned on your own, and probably the best way to experience the interior (which has several theaters / performance halls) is to just get tickets for a performance. There are over 1000 performances there each year!

Another view, close-up. The tiles are really interesting.

Harbor Bridge

I went for a jog each morning, and one of the days took me over the bridge to North Sydney and back. Pretty fun, in spite of the lungs full of diesel exhaust from the morning commuters. The bridge opened in 1932, and is absolutely massive. You can climb up the top of the bridge or walk up the stairs inside the southeast pylon. Both are commercial operations, and cost money. I didn’t do either. Simply being on the bridge a zillion meters from the water was cool enough for me.

Royal Botanical Gardens

The gardens are awesome. If you like a huge diversity of trees, plants, flowers, and birds … well, this place is amazing. A morning jog through this would be a great way to start every day, so you Sydneysiders are quite lucky to have this in your backyard. As for the bats? Well, I never found them. I guess the campaign to get rid of them is working.

NRL Preliminary Final

My colleagues and I were lucky to get tickets to the National Rugby League semifinal match between South Sydney and Canterbury at ANZ Stadium (the olympic stadium from 2000). Not knowing either club — or the sport itself, really — I bought myself a Rabbitohs hat and cheered for the underdogs. Who got crushed 32-8, after owning an 8-4 lead early and having all of the momentum.

I was one of about 12 Rabbitohs supporters in the crowd of 70000. That was kind of fun.

Oh Rabbitohs, you ruined my day!

My kids like the hat, though.

Bondi Beach

Love or hate the big city, having a beach like Bondi so close to town is pretty awesome. I spent a good part of the day there. The sand was a fine powder, great feel. Walked through the farmers market, bought a baked treat, enjoyed the heck out of it. Ate lunch with Scott (my colleague) at The Bucket List, outside and overlooking the water. Lovely way to spend a day.

Took a cab (spendy) there, walked to the train station on the way back and returned to the city via train. I think I liked the cab better.

Manly, and Sydney Harbor National Park

I went to Manly twice. Once, on a Friday evening, and had drinks at 4 Pines Brewing (awesome!) and pizza at Hugo’s (double-awesome). It was dark, and I didn’t get to see the town or the beach. So I returned on Sunday. Along with all of Sydney, I think. The place was crawling with people that day. But, as I carved my way through the crowds, I was able to see enough of the town to get a feel for the place. Lunch at BenBry Burgers took all of the pain of the crowds away.

I walked along the beach and found Shelly Beach tucked away from the hustle and bustle. That looked like a good place to spend a day. However, my goal was beyond Shelly Beach — Sydney Harbor National Park, which has a trail system that begins just above the beach. I walked all over these trails throughout the day, and made it to the headlands overlooking the cliffs before turning back and taking the trails back down the hill to the Manly town center.

Another trip to 4 Pines Brewing capped off the day. The special Märzen was a winner. It’s possible I may have ordered a second pint.

Manly is a 40-minute ferry ride from Circular Quay, or take a bus or cab. Take the ferry. Cheap and easy.

Oh, and I saw an echidna!


In Auckland, my hotel was on the water — literally. Built on a pier jutting into the harbor. Oddly, also right next to the ferry terminal, as in Sydney. The weather was not quite so nice … maybe high 50s, overcast, and occasional drizzle. Just like home!

My schedule was much tighter in Auckland than in Sydney, so I saw less. But I still had a great time, and my colleagues there helped me make the most of my visit. A couple of evening jogs got me out on the harbor, which was very pretty.

I ate at Tyler Street Garage (hipster hangout, great pizza and beer), Degree (low key, diverse menu and beer), L’Assiette (only got as far as coffee and pastry), and Mexico (lamb & mint quesadillas … yum).


My colleague Tim took me to Piha, and we hiked to Kitekite Falls. Very cool. I really enjoy hiking, and this was a great little walk with a nice waterfall reward at the end. Learned about the native plants and trees, in particular the silver fern — which I recognized to be the symbol used by the All Blacks.

Rangitoto Island

A young volcano in the middle of the harbor? I’m there. My colleage Serge recommended this (as did others), and I enjoyed the heck out of this. My schedule was a bit tight, and I hoped to be able to hike to the top and back in the 3-hour window between ferry visits. The literature suggested this might not be possible, but I tried it anyway. I power-walked and ran up it in 45 minutes. 🙂 Left me plenty of time to take in the vista, and leisurely stroll down. Didn’t get a chance to visit the lava caves, which probably didn’t matter since I didn’t have a flashlight.



Thanks to Sarge for the geographical reference.

Sadly, in Sydney, I was unable to locate 42 Wallaby Way, and no indication that P. Sherman lives or works there. I blame the iOS 6 maps app.

Time Machine sucks, use rsync instead

Mac OSX has a great built-in feature called Time Machine, which is designed to provide simple backup & restore functionality for your system. Time Machine does more than just keep a most-recent backup handy; it keeps track of changes to your files on a regular basis, and allows you to go back in time to a prior state of your filesystem to recover files that were lost — even those that were deleted intentionally.

Time Machine can write backups to an external drive (USB, FireWire, or Thunderbolt), or to a network device. Apple sells a network device called Time Capsule that works with Time Machine, but other vendors also provide NAS devices that integrate directly with the Time Machine software on the Mac client.

I’ve been Mac-only at home for six years, and have used Time Machine ever since it first appeared in Leopard, in 2007. Last year, I upgraded my backup strategy to point all machines to a Synology DS411j NAS. This has been an awesome little device, and I use it for more than just backup/restore.

Backups are pretty darn important

Your data is really important to you. Trust me. Maybe it’s your family photos or home movies. Or tax returns. Or homework. Whatever it is, it’s critical you keep at least two copies of it, in the event of accidental deletion, disk failure, theft, fire, or the zombie apocalypse.

Scott Hanselman has a nice writeup on implementing a workable backup and recovery strategy. I’ve done that, and you should do the same. If you use a Mac, Time Machine should be part of your strategy, and it’s a heck of a lot better than no backup strategy at all. But be very wary of Time Machine, because it ain’t all roses.

Time Machine, In Which There Are Dragons

Time Machine is quite clever, and uses UNIX hard links to efficiently manage disk space on the backup volume. Backups are stored in a sparse bundle file, which is a form of magic disk image that houses all backup data.

But, I swear, it is sometimes just too magic for its own good. It is decidedly not simple under the hood, and when it fails, it fails in epic fashion. See this for some examples.

I’ve had at least five backup failures that I blame on Time Machine in the past four years. In OSX Lion, one kind of failure shows up like this:

There is no recovery option provided to you. If you say “Start new backup”, it deletes your old one and begins anew. If that’s terabytes of photos/video/music/whatever, be prepared for a very long wait. Perhaps days, depending on your backup data set size, network speed, disk speed, and phase of the moon. Okay, maybe not the last part, but you never know.

And in the meantime, your backup system is gone. At this point, it is obvious that having data in at least three places is necessary. (Note that there are techniques for repairing the Time Machine backup volume. Dig out the solder and oscilloscope first, though).

You didn’t do anything, but Time Machine broke. That is completely unacceptable for a backup system.

It’s quite possible that I’m doing it all wrong. And the problems may not be Apple software errors; they may be a function of Apple+Synology, or just Synology. But that is beside the point. Any backup strategy that can fail and irrecoverably take all your data to Valhalla is a horrible strategy. I need something that cannot fail.

A better strategy, with 73% less insanity

As it turns out, I have never really cared about the save-old-versions-of-files feature of Time Machine. I have used it to recover entire volumes — twice, both during machine upgrades. Recovering an inadvertently deleted file is rather rare for me, but I suppose I do care about that feature a little bit.

Time Machine sparsebundle files are opaque to the average user. You cannot open them up, peek inside, and grab the files you need. You need the Time Machine client, and when it encounters an error with the backup file, it offers no choice but to abort and start over.

This is why I use rsync. With a little bit of Time Machine still involved for added spice. You know, just to keep things interesting.

Plus, rsync sounds cooler.

Rsync is a command-line tool, available for several platforms, and included with Mac OSX. In its simplest form, it just copies files from one place to another. But it can also remove files no longer needed, exclude things you don’t care about, and work across a network, targeting a mounted volume or a remote server that supports SSH. Which is how I use it.

The end result of an rsync backup is a mirror of your source data. Readable by anything that can read the format of the target filesystem. This part is critical. Backups are irrelevant if nothing can recover them. A bunch of files in a directory on a disk is accessible by just about everything. Time Machine sparsebundles require Time Machine, on a Mac. Files in a directory can be read by any app or OS. Thisincreases your odds of recovery by, well, a lot.

I have a few computers around the house. Our primary family computer is an iMac, and has one internal disk and two USB external disks. The internal disk has all the user folders, documents, applications, and OS files. The external drives contain photos, movies, music, etc.

My backup strategy has the internal disk backed up to my NAS using Time Machine, and the the external disks backed up to the same NAS using rsync.

Some notes:

  • The Internal HD volume is less than 100GB, and the backup executes automatically every hour.
  • I wrote simple shell scripts to automate the rsync commands. I execute the rsync scripts manually, but these are easy to automate.

I won’t go into too much detail on rsync usage (some resources that might help: 1, 2, 3), but here’s how I backup an entire external volume using rsync:

rsync -av --delete --exclude ".DS_Store" --exclude ".fseventsd" --exclude ".Spotlight-V100" --exclude ".TemporaryItems" --exclude ".Trashes" /Volumes/your-local-volume-name-that-you-want-backed-up/ user-name@backup-server:/volume-name-on-server/path-on-backup-server


The -av says “archive, with verbose output”. The –delete option says “get rid of anything on the server that’s no longer on my local machine” (be careful with this one). The –exclude options allow me to avoid backing up crap I don’t need. The username stuff allows me to log in to the server and perform the backup using that identity on the server.


Rsync can fail with network or disk hardware errors. Time Machine can fail with network, disk hardware, or buggy software errors. I prefer rsync for the really important stuff, and use Time Machine for the OS disk, which is relatively small and something I can recover from quickly after the inevitable Time Machine error.

iPhone camera roll bug makes photos unavailable, hack your way to a fix

TL;DR … scroll down for a solution.

What happened?

My iPhone 4 with iOS5 started failing in a peculiar way a couple of weeks ago. I could take still photos and video without any trouble, but the camera roll display (in the Photos app) would fail to show thumbnails correctly, and attempts to pull the images onto my iMac wouldn’t work. Both iPhoto ’11 and the Image Capture app on Mac OS 10.7 could see my iPhone, but said that there were 0 photos on the device.

Really, I just wanted to get my photos & video off the device. And I couldn’t. I tried lame workarounds like emailing photos to myself (worked for photos, but not large videos) and syncing to Dropbox (failed, Drobox app couldn’t read photo library … which is itself a clue).

I needed a real fix. While I don’t know what caused this problem in the first place, I have one idea. Read to the end to find out.


Here’s what the thumbnail view looks like:

As you can see, several blank images, and several thumbnails are duplicates. Funny thing is, you could select items and see the correct image.

In the Settings app, under General | About, the number of reported photos is off the charts. Geeks will recognize this as a rather special number.

Finally, iTunes shows some space used by “Other”. This is close to the amount of space used by my photos & videos.


After Googling a bit with no clear solution in sight, I turned to Twitter. @jkubbeaver had the same problem, and stumbled upon a solution that worked for him, documented here. In case that link vaporizes, here’s a summary:

  • Download and install iExplorer, which allows you to manage the filesystem of your iPhone.
  • Fire up iExplorer with your iPhone connected via USB cable, and, as a precaution, copy photos/videos from the iPhone’s DCIM folder to your computer. At this point, you now have the files you want, but you still need to fix the underlying problem.
  • Navigate to the iPhone’s PhotoData folder, copy the, Photos.sqlite, and PhotosAux.sqlite files to your computer (again, as a precaution), then delete them from the iPhone’s PhotoData folder. This deletes the iPhoto camera roll database and thumbnails, but does not delete the photos themselves.
  • Reboot your iPhone, navigate to the Photos app, and let it rebuild the camera roll database automatically.

At this point, all should be back to normal. This solution worked for me.

Addendum: why did this happen in the first place?

I’m not sure yet. When I upgraded to iOS5, I did not initially enable Apple’s PhotoStream service. After a few days, I enabled PhotoStream to give it a try … and then started seeing the symptoms. Is PhotoStream to blame? Unsure, but it’s the only thing that I can remember changing between “no problem” and “problem”. YMMV.