Tuesday, August 9, 2011

How to revive Mac App Store when its stuck forever waiting...

I recently went to the App Store application on my Mac to download the Lion version of Apple's Xcode development tools.  I was prompted for my Apple ID and password (which I provided) and then I left the App Store app on its own to complete the download and install.  After about 30 minutes I went to check in on its progress and saw that it had downloaded exactly 0 bytes.  The status on the Purchased page was Waiting...

Waiting for Godot

...and waiting and waiting.  I quit and restarted App Store and still my downloads were stuck waiting.  I dug around a little and it turns out this is not an uncommon problem but the remedies suggested were all over the place.  Everything from installing updates and deleting caches (both good ideas) to deleting your Library folder (not a good idea).  I like to attack problems like this by starting with the easiest and least invasive measures.

I should state right off the bat that these solutions are meant to incur as little disruption as possible but do require the use of some programs that might not be in your usual repertoire: Activity Monitor and Terminal.  If you are at all uncomfortable using these tools you can always use that old Windows chestnut... reboot.  Yes, rebooting your Mac should have the same affect as solution 1 at least.  But if you don't want the hassle of rebooting then read on.



Solution 1: Kill the Zombie

The App Store uses a process called "storeagent" that runs continuously in the background.  It seems that sometimes this process can go a little wonky and fail to respond to requests to download app purchases.  What we want to do is kill this zombie process (it will start up again automatically).

Start Activity Monitor
First, quit the App Store application (e.g. by selecting "App Store->Quit App Store" or pressing Cmd-Q or click the red dot in the top left corner of the window).  Start up Activity Monitor (you'll find it on Lion's launchpad in the Utilities collection or using Finder in Applications/Utilities/Activity Monitor.  Activity monitor is used to display the processes running on your Mac.  You could go hunt around for the process called "storeagent" but an easier method is to enter "storeagent" in the Activity Monitor filter box as illustrated below (some of the numbers will be different).  Highlight the "storeagent" process by clicking on it.  The "Quit Process" stop sign should become available.  Go ahead and click on Quit Process to kill "storeagent". You'll be asked if you really want to quit the process.  Confirm by clicking "Quit".  Normally this should do the trick and the process will disappear immediately and be replaced a little while later by a new process (with a different number in the PID column).  However, if the process is a deep zombie, you will need to click "Force Quit" in the confirmation dialog.  Do this only as a last resort as it is possible to damage system files by using Force Quit too often. 

Activity Monitor Filtered for "storeagent".  Note the "Quit Process" stop sign is now clickable.

Now go ahead and restart the App Store application.  Click on Purchased, find your purchase and select Resume. After you enter your Apple ID and password your purchase should start downloading.   However, if the App Store is still stuck in Waiting move on to Solution 2.

Solution 2 - Purge the Caches

Solution 1 has always worked for me but I've heard of cases where more intervention is required.  If this fits your situation then go ahead and quit the App Store application again.  Now we do some typing into Terminal. You can find Terminal in the same Utilities folder that you found Activity Monitor.  When you start it, it should look something like below.

At the Terminal prompt
What we're going to do is use some commands to delete App Store caches.  You do not need to worry about deleting these files since, by definition, they are a copy of what is already stored on the Apple servers and will automatically be restored.  Type of the following commands exactly as you see below (in fact, go ahead and copy and paste them into Terminal).

rm -r ~/Library/Caches/com.apple.appstore
rm -r ~/Library/Caches/com.apple.storeagent
rm ~/Library/Preferences/com.apple.appstore.plist
rm ~/Library/Preferences/com.apple.storeagent.plist
rm ~/Library/Cookies/com.apple.appstore.plist

Now go and do the steps in Solution 1 again.  Once you're done that, start up App Store, go to Purchases, and select Resume on your download.  Enter your Apple ID and password and you're off to the races.

Sunday, August 7, 2011

Ruby Koan for Dice Scoring (Greed) - Solution #2

It's interesting what some sleep and exercise can do.  The next day while approaching the "big hill" part of my run I came up with a new solution to the Greed Ruby Koan.  This solution is shorter and is more Rubyesque (I think). It also includes a reasonable amount of error checking (nil parameter and valid dice values).  Again, I'd love to hear from Ruby enthusiasts to comment on style and other approaches.

def score(dice)

  return 0 if dice == nil

  score  = 0
  counts = [0, 0, 0, 0, 0, 0]
  dice.each { |roll| counts[roll-1] += 1 if (1..6) === roll } # Count valid rolls

  (1..6).each { |i| score += (i == 1) ? 1000 : i * 100 if counts[i-1] >= 3 } # Score triples

  # Score the rest
  score += counts[0] % 3 * 100
  score += counts[4] % 3 * 50

  return score
end

Friday, August 5, 2011

Ruby Koan for Dice Scoring (Greed) - Solution #1

Recently I've started teaching myself Ruby and as part of my quest I discovered the amazing Ruby Koan site by EdgeCase.  The concept of a koan dates back to the foundations of Zen Buddhism.  You might recognize the question "what is the sound of one hand clapping".  This is actually part of a Zen koan.  A koan is a question or story that serves as a fundamental teaching tool.  A traditional Zen koan cannot be understood via rational thought but rather through intuition leading to an "Aha!" moment.

Ruby Koans, as developed by EdgeCase, consist of 274 test cases and incomplete Ruby code.  Your task is to implement the code in order to make all the tests pass in classic TDD style.  For those unfamiliar with the term, TDD means Test Driven Development.  TDD follows the pattern of red, green, refactor.  When implementing a new section of code you start with its tests which will all fail (be 'red') initially.  Then you implement the code turning all of the tests green.  Finally, and over time, you go forth with confidence and refactor the code to higher and higher levels of quality (keeping it green).

Many of the Ruby Koan tests are fairly simple to make pass.  Some of the more esoteric Ruby features were more difficult to master (I thought Array.inject and blocks/yield would drive me to murder).  However, one of the most interesting koan related to scoring dice throws in a fictional game called Greed.  This koan is quite different than the others and is more like a Kata (a martial arts term referring to a repetitive exercise meant to hone skill -- I'll save Kata for another post).  Briefly, the koan asks you to implement a class that conforms to the following requirements:

# A greed roll is scored as follows [for a roll of up to 5 dice]:
#
# * A set of three ones is 1000 points
#
# * A set of three numbers (other than ones) is worth 100 times the
#   number. (e.g. three fives is 500 points).
#
# * A one (that is not part of a set of three) is worth 100 points.
#
# * A five (that is not part of a set of three) is worth 50 points.
#
# * Everything else is worth 0 points.
#
# Examples:
#
# score([1,1,1,5,1]) => 1150 points
# score([2,3,4,6,2]) => 0 points
# score([3,4,5,3,3]) => 350 points
# score([1,5,1,2,4]) => 250 points

This particular koan consists of 13 (initially failing) tests.  Your implementation of the scoring method must make them all pass.  Ruby, by its nature, provides a multitude of ways (more than any other language I think) to solve this problem.  What follows is my first attempt.  It should be noted that error checking was excluded from the requirements nor did any of the tests include input error tests (like dice rolls outside 1..6, strings, etc.).

As a student of Ruby I am keen for feedback (particularly from the Ruby masters) as this solution seems a little... wordy.

def score(dice)
  score = 0
  sorted_dice = dice.sort # Sort the rolls

  while sorted_dice.length > 0
    val = sorted_dice.shift
    if sorted_dice.length >= 2 && val == sorted_dice[0] && val == sorted_dice[1]  # a triple!
      score += val == 1 ? 1000 : val * 100
      sorted_dice.shift(2)
    else
      score += 100 if val == 1
      score += 50  if val == 5
    end
  end

  return score
end

Thursday, July 28, 2011

Agile Software Development - Why?

I recently guest-published an article on the blog hosted by Big Blue Bubble, the award developer of handheld video games.  If you're interested in learning about why Agile software development is valuable and what benefits you might derive from it, head over to Big Blue Bubble's Out of the Blue.

Thursday, July 21, 2011

Mac OS/X Lion, "Reverse" Scrolling, and Chrome

Up until yesterday's release of Mac OS/X Lion, the user interface metaphor for scrolling was that you manipulated the scrollbar on the side or bottom of your content (say a webpage).  So in order to scroll content upwards you swiped, wheeled, or otherwise moved down.  To scroll your content downwards you moved up.  This is a very computer-sciency method of scrolling in that the container had a dohicky (the scrollbar) that you touched to scroll.

Tablets and smartphones have flipped the metaphor on its head.  With a modern touch interface you manipulate the content directly.  If you want the content to scroll up off the top of your tablet you swipe it up.  To scroll the content down off the bottom of your tablet you swipe down.  All very natural.

One of the major themes of Apple's Lion release is the harmonizing of the touch and desktop interfaces including a change to how desktop scrolling works.  This change is immediately apparent when you load content in Safari.  First, there are no scrollbars.  Second, you swipe, wheel or otherwise move up in order to move your content up.  Apple calls this "natural scrolling".  This is initially disconcerting for most users since they've spent most of their computer lives doing the opposite.  You can configure Lion to do it "the old way" but I really encourage you to give it a chance.  In about 10 minutes (or nearly instantly if you're using a trackpad) your brain accepts the change and things settle down to normal.  Natural scrolling really feels natural.

In order for applications to behave correctly in Lion they do need to be updated.  This will take some time depending on the application's complexity and the ability of its owner to turn around change.  Google, for example, is actively modifying Chrome in order to provide the best Lion experience.  However, until they do, Chrome will act a little odd in Lion.  For example, it enters full screen mode quite nicely but it isn't immediately apparent how to exit it (see "How to exit full screen mode in Mac OS/X Lion (when you're stuck)" for more on this topic).

Another inconsistency is that the scrollbars are persistent rather than Lion transient.  Rather than waiting for Google to release a new version of Chrome for Lion you can get rid of those pesky, pixel hogging scrollbars now by using one of the scrollbar-remover extensions available on the Chrome web store.  I'm currently testing Scrollbar Hide by Saúl Pilatowsky.  By default it only hides the vertical scrollbar but you can configure it to hide both.  You can also configure it such that the scrollbars are either permanently disabled or appear "when needed" (basically when the mouse pointer roams close to the right or bottom edges).  Another option is No Scrollbar by Bestrafer which simply hides the vertical scrollbar.  For both extensions you may need to restart Chrome for the scroll bars to stay gone.  After that, you can take a tiny step closer to the full Lion experience.

Wednesday, July 20, 2011

How to exit full screen mode in Mac OSX Lion (when you're stuck)

I've been playing around with Lion, Apple's new version of Mac OS/X.  In general I really like the new features and will very soon be purchasing a Magic Trackpad to go with my iMac.

One feature that I can see myself using (if only to help me focus) is full screen applications.  Apple added a little icon in the top right corner to all windows that allows you to make the app full screen.  For applications that are full screen aware (like the new version of Mail) you just hit Escape or CMD-Shift-F and you go back to the windowed mode.  However, for some reason, once you put Terminal in full screen mode it stays there for good.  Even after you exit and unload the app (e.g. with CMD-q) and then restart.  Neither Escape nor CMD-Shift-F seem to work to reverse the full screen process.  Eventually I stumbled on the fact that when you move the mouse pointer up past the top of the screen, the menu bar appears (it may take a second).  The menu bar now includes a new icon for reversing full screen mode.  Hurray!

Friday, July 1, 2011

What's on your Pod (Update)

Recently I completed an intense three week management course called the Ivey Executive Program (small plug for my employer) where I met many amazingly talented people.  During the first week of the course my iPad was a source of interest for many that had never used one before.  By the second week at least four shiny new iPad 2s were in class with more on order.  I found myself making app suggestions daily and pointing people to my blog where, about a year ago, I posted What's on your Pod?  Since the time of the original article I have, naturally, discovered many other apps that I use weekly and even daily.  It's high time for an update.

As with the last article, I've divided the apps up into three categories: apps on my iPad, apps on my iPhone, and apps that I use on both.  Let's start with the apps I use on both my iPhone and my iPad.


Both (iPhone and iPad)
  • Twitter (Free) - I still use this app to view my Twitter feed but Flipboard (keep reading) has become my app of choice of consuming nearly all of my social and news feeds.
  • Tumblr (Free) - You might think Tumblr is just another blog site like Blogger/Blogspot and you wouldn't be wrong.  However, Tumblr kills as a photo blog and that's exactly what I use it for.  All the blogs I follow on Tumblr are photo blogs (including my daughter's).  
  • Instapaper (Free) - Have you ever been in the situation where you just discovered a really interesting article but you just doing have the time to read it right now?  Services like Instapaper and Read It Later solve this by installing a small script in your browser that you can click to "read it later".  Then use the iOS app to read the article at your leisure (even when offline).
  • 1Password ($9.99) - I commented on 1Password in What's on your Mac.  The $10 cost for the iOS app is well worth the convenience of having your usernames and passwords accessible from your devices.
  • Netflix (Free) - If you're a Netflix subscriber then get this app.  You know what to do with it.

iPad

  • Flipboard (Free) - Flipboard is well known to all but new iOS users.  Basically Flipboard incorporates your news feeds (like Google Reader), social media (like Facebook and Twitter feeds), and curated news content and presents it in a book-like interface.  Next to Mail, Flipboard may very well be the second most frequently used app that I own.  It even integrates with Instapaper for those times when you've found something interesting but don't have time to read it just now.  What it really needs next is support for Tumblr!
  • Keynote ($9.99) - Apple's presentation app.  I find making presentations is easier on the iPad than on a desktop.  The forthcoming iCloud integration will iron out the one remaining wrinkle of getting content to and from your iPad.  
  • Numbers ($9.99) - Apple's spreadsheet app thoughtfully designed for touch interfaces.  This isn't just a port of a desktop app.  The user interface has been redone in every detail to take into account touch interfaces. 
  • iAnnotate PDF ($9.99) - I'm not sure this one is worth $10 but it is a good application for not only reading PDFs (many apps do that) but also for making complex annotations like highlighting, notes, underlining, tabs and bookmarks and more.  I used this app during the Executive Program to read my cases.
  • ComicBookLover (Free) - I had previously loaded the Marvel and DC comic book readers but each is limited to just those publishers.  CBR (and CBZ) are now the standard formats for distributing comics so why not just use a generic reader like ComicBookLover.  
  • Epicurious (Free) - Recipe viewer and search tool with a beautiful user interface.
  • GarageBand ($4.99) - This is a fun one but I don't know if anyone is going to make any serious music with it.  My youngest loves just tooling around in the app and making cool sounding song snippets. 

iPhone/iPod

  • Skype (Free) - It's unclear what Microsoft is going to do with Skype but for now it is a great way of making free phone calls.
  • Samsung Remote (Free) - If you have a Samsung TV with a wifi or internet connection then you might want to try this remote.
  • Groupon (Free) - If you are a Groupon user then get this app and stop printing your Groupon receipts.  
  • JotNot Scanner Pro ($1.99) - Anyone who works in an office environment has learned that the best way to take notes is to snap photos of the whiteboard, flipchart, etc.  JotNot not only snaps the photo but crops out the irrelevant edges and then increases the contrast to make the photo much more readable.  Well worth the $2 cost.
  • Hipstamatic ($1.99) - Cool retro photos using interchangeable vintage lenses, flashes, and film.


Cases

I thought I'd throw in a special mention for some iPad cases that I've taken a shining to as well.  First is the DODOcase that I have for my original iPad.  Thanks to Ken Drouillard for giving me this hand-me-down after he upgraded to an iPad 2.  This case never fails to get commented on once people realize that there's an iPad inside what looks like a regular black hardcover notebook.  The bamboo construction is light, sturdy, beautiful and pro-eco.  

DODOcase (closed)

DODOcase (open)

The second case I'll mention is a wooden iPad 2 case by Miniot.  This gorgeous cover uses the same magnetic mechanism used by Apple's smart covers.  The instant-on feature even works with it.  When I eventually move on to an iPad 2 (or 3) this will likely be the cover I get.  Again, a big thanks to Ken for discovering this one.


As always, if you have apps that you think are fantastic I really want to know about them.  Please comment!

Tuesday, March 29, 2011

25 Random Things About Me

Twice in one day I've come across this popular meme.  So I thought I'd give it a whirl and offer you 25 random things about me.
  1. I am husband to Annette and father to G, N, and A.  They are the driving forces in my life.
  2. Professionally, I spend my time managing software development and technical organizations.  I have a secret desire to one day return to my software developer roots.
  3. One day I would like to write a book.  Fiction or non-fiction - it doesn't matter to me.
  4. I am a wild fan of Prince and own just about everything he's ever released plus a bunch of stuff he's never officially released.  I feel vaguely embarrassed by this.
  5. I take to heart my mother's lesson that there is always at least one other way to look at every situation.  And often more than one.
  6. I'm a Mac.
  7. I am a born again naturalist with Roman Catholic roots.
  8. For over 25 years now I have had recurring visions of dying in a large explosion.  This doesn't frighten me but it does get rather repetitive.
  9. I have an M.Sc. in Computer Science from the University of Western Ontario.  I also have a minor in Psychology.
  10. The Liberal Party is for me.
  11. My brother is developmentally handicapped and lives at home with my parents.  Every time I'm with him he makes me feel like we're kids again.  I love it!
  12. I am the prototypical geek: science fiction, comic books, table top games, gadgets, computers, toys, action figures, ...
  13. I think Cormac McCarthy is America's greatest gift to the world. 
  14. I grew up with a card playing extended family.  I get a rich feeling of nostalgia now whenever I play a game of cards.
  15. My sister flies on wings of freedom and currently seeks her fortune in PEI.  I admire her so much more than she knows.
  16. I have a distant cousin who is an accomplished opera singer in Holland.  Isn't that weird?
  17. Starbuck's Caffe Verona is the best way to start a day.
  18. I'm very proud of my kids and their diverse interests: photography and visual arts, computers, hockey, reading, film, history, fashion, ancient weaponry, chess, ...
  19. Charles Stross' idea of a "venture altruist" really appeals to me.  If only we could pull it off for real!
  20. I am the author and curator of the Infocom Fan Site (in continuous operation since 1995 -- thank you UWO!).
  21. My father is the hardest working person I know.  Why is it that our fathers always seem to work so much harder than we do?  If my kids work less than me they're in big trouble!
  22. Philosophy and science of the human mind fascinate me.
  23. I'm a genius at starting projects but mostly don't follow through.  This troubles me greatly.
  24. Single malt scotch and dark chocolate make the best bed time snack.  
  25. I'm afraid that I'll never amount to anything important when I grow up.

Monday, January 3, 2011

Technical Resumes

I recently wrote a short series of posts on the advice I typically give when writing resumes for technical and technology leadership positions.  This post serves simply as a Table of Contents.


Technical Resumes: Part 4 (Cover Letter)

In the previous post I completed the description of the advice I typically give when I'm asked to review a resume.  In this post, I cover a related topic: the cover letter.  I was going to cover LinkedIn as well but that's a larger topic that deserves it's own space.

Cover Letter

Some people spend considerable effort writing their cover letter.  Having read thousands of resumes (many with cover letters attached) I'm less convinced of their value.  If you've done your homework writing a concise resume with relevant content and a good Overview then a long cover letter is unnecessary.  Many resume reviewers don't even open the cover letter or they shuffle it behind the resume.  That said, there can be some value in a cover letter but just don't agonize over it.  Spend your time on your resume and customizing the Overview.

Like the resume itself, the format of your cover letter is a matter of personal style.  As always, I'm a fan of "less is more" and prefer a simple, traditional business letter layout.  Let your word processing package help you with a format that appeals to you.  I often use a separate font and colour for my name and contact information but everything else is in a simple, sans serif font in black "ink".

I stick to a three paragraph format.  The first and last paragraphs are extremely short.  The first simply states that position or positions I am applying for.  The last paragraph thanks the reader for taking the time to review my qualifications and offers to meet with them to explore the possibility of a mutual fit (don't forget that you're looking for a good employer as much as they are looking for a good employee).

The middle paragraph is a little longer but I still try to keep it to maybe three sentences.  I use this paragraph to draw links between the advertised position(s) and the my experience.  My goal is to peak interest in my experience and maybe offer a hint at my personality.  Unlike the resume, the cover letter gives you an opportunity to put on a personal face.  Address the reader by name (if you know the name of the hiring manager).  Use pronouns like "I".  Express your excitement at the opportunity.

Finally, if you are sending a paper cover letter then always sign the paper with your signature.  I prefer blue ink to set the signature apart from the black text.