Tuesday, June 05, 2012

External display not working, "detect displays" does nothing

This is a tale of apparent hardware problems which revealed themselves to actually be the result of the most common cause of issues when working with computer software, that which is located somewhere between the screen and the keyboard. i.e. user error

The problem

I have a Macbook Pro connected to a Cinema Display external monitor via a thunderbolt to DVI adaptor. I had unplugged the laptop and taken it downstairs in the evenings recently to do some late-night hacking. Usually when returning it to my desk the next morning, I just plug it back in and everything “just works” ™, but yesterday it didn’t, and when it happened again today I started to worry that I’d had a hardware failure somewhere. Silly me…

Symptoms

When connecting the external display to the Macbook Pro via the Thunderbolt to DVI adaptor:

  • The external display seemed to wake from sleep, but did not display a picture
  • The Macbook Pro did not detect the external display
  • Opening the Displays preferences pane and hitting Detect Displays did nothing
  • The system logs (Console.app) did not show any errors or warnings

Debugging

  • Tried logging out to the accounts screen and logging back in (which should restart the window server), but it had no effect
  • Rebooted the MacBook pro, and upon arriving at the accounts screen the external display was activated

Having already wasted enough time on it, I thought nothing more of it and got to work. When it happened again today though, I had to dig a little further

The solution

I mentioned unplugging my laptop and taking it downstairs. The recent models of Macbook Pro have two GFX processors, a “discreet” GPU which is a powerful 3D processor with dedicated super-fast RAM for games etc., and an “integrated” GPU which shares system resources. They attempt to intelligently switch between the two depending on the applications being used, which is great in theory, but in practice many common OS X applications use library calls which trigger the dedicated GPU, and this results in the battery draining much faster than necessary.

A solution to this is using an application called gfxCardStatus to manually force the system to use the low-power integrated GPU when running on batteries. The only problem with this however, is that the integrated GPU can’t be used with external displays, so if you forget to switch it back to “automatic” mode…

Head. Bang. On. Desk.

  1. Open the Macbook Pro
  2. Set gfxCardStatus to Discreet only, or Dynamic switching
  3. Your external display will spring to life!

Sometimes when your computer seems to be misbehaving, it’s just doing exactly what you told it to, in this case explicitly disabling the GPU required for using external displays.

A better solution

Mac OS X has a great speech synthesiser built-in, it could actual say “To use this external display, enable the discreet graphics processor” so that if the laptop is closed, you still get some feedback as to why the external display is not working.

Wednesday, March 28, 2012

DIY standing desk with 19" equipment rack

Standing desks are gaining in popularity, with more and more people spending large amounts of their day in front of computers, and noticing the negative effects being sedentary for too long. I thought I’d give it a try, but didn’t want to spend large amounts of money of fancy, motorised, height-adjustable desks, so I scouted around my office for things to use to hobble one together.

Attempt #1 - 5 unit equipment rack

Sitting up on top of a shelf behind me gathering dust was an old 5 unit 19” equipment rack that I’d made eons ago. It used to have guitar amps & effects racks mounted in it, but I had since upgraded to a nice SKB rack unit.

So I dusted it off and stuck my monitor & keyboard on top it:

Dodgy indeed…

Attempt #2 - wooden worktop & sliding drawer

Not bad, but it really needed a better worktop. We have an actual computer desk downstairs which came with a printer shelf. We never use our printer, so the shelf had since been removed and stashed in our storage room where we keep all our camping gear. We do quite a bit of camping, so while preparing for a recent trip I noticed the shelf and dug it out to be re-purposed for my standing desk.

The thing about standing desks though is that by mid-afternoon you really need to sit down for a bit, even if it’s just to have a hot beverage and do some inbox processing before getting back to it. With the Macbook Pro entwined in various peripheral cables however, removing it wasn’t a simple matter. Then it dawned on me - aren’t there shelves and drawers available for 19” equipment racks?

Indeed there are - behold, the transforming standing desk:

I got lucky by finding a 2 unit keyboard drawer on ebay for about $80 including delivery. The laptop sits on the top shelf, and a keyboard sits on a lower shelf which extends even further still. I was surprised by how much travel it has!

So now when my legs/back get sore, I can roll out my gym ball and slide out my keyboard drawer to sit down for a while, then transform it back again when done (yes, I will be imagining the noise from the original Transformers cartoon while doing it…). There’s still room for customisation too by slotting some more equipment into the remaining rack spaces, but this will suffice for now I think :).

Wednesday, March 21, 2012

Backup strategy

Time for a geek post! It’s been a while.

So, recently I’ve kinda been forced to implement a better backup strategy, not because I lost data, but because some things happened that made me worry about what would happen if it did.

This scary dialogue box appeared on a machine that until that moment had no backups whatsoever!!!

My current setup

I have two Macbook Pros, a 2006 model that I bought in Japan which is setup downstairs for our son to use for homework (cough, Minecraft), and a recent model which I use for work. With the introduction of iCloud, and iTunes Match, my music is now synced nicely across all my Apple devices, but the one thing that wasn’t synced was my photos. If I lost my music, I could always acquire it again, but we’d be heartbroken if we lost our family photos.

The old Macbook Pro had photos on it up until around late 2011, which is roughly when I got my new one and also upgraded our camera to a Nikon D90. The new one has photos since then, and everything taken with my iPhone 4S via Photo Stream.

Time Machine

Both machines are backing up via Time Machine to one Western Digital 1TB drive each; the older one has it plugged in directly via USB, while the newer one has it attached as a network drive via an Airport Extreme wifi router. (Yes, you can actually do that)

This is fine for system files & settings, apps etc. In case of a catastrophe, I can re-install my apps from the App Store, or the vendor’s website. I keep my serial numbers in Yojimbo, which I have saving it’s data to Dropbox. Time Machine is really only handy if you need to revert a file that you might have deleted from your desktop last week thinking you wouldn’t need it again for example. I’ve never used it to revert changes or restore lost/damaged files.

Dropbox

All my writing, notes, etc. are stored in a Dropbox folder, which automatically syncs to the cloud. In case of a catastrophe, I could restore them easily.

Source Code Management

I keep all my software development work under version control, which means it’s stored on the SCM server, as well as on the production servers my apps are deployed to. In case of catastrophe, a quick svn up will restore my work.

The problem

Both laptops have small, 128GB hard drives. The newer one is an SSD, while the older one is literally completely full. The iPhoto libraries are around 40GB and 20GB for the old & new respectively, so I needed a way to move the libraries off onto an external drive. If I do that however, they will no longer be protected by Time Machine. I’ve read that you can actually configure Time Machine to backup external drives, but there’s another issue worth considering - physically loosing or damaging the backup drive itself.

If there’s a house fire, or someone breaks in and steals the backup drive, our backups are lost. Hard drives can, and inevitably will fail. So for our most precious memories, I need an off-site backup solution.

The solution - off-site backups

Dropbox is great for small files, like plaintext documents, PDFs, etc, but the free plan only provides 2GB of storage, and the paid plans are reasonably priced, but considering I need to backup at least 40-50GB of data, I’d need to go to the Pro 100 plan for $20/month or $200/year. My precious memories are worth that, but there is a cheaper alternative - going directly to Amazon S3.

Dropbox actually uses Amazon’s cloud services for their storage back-end. You can actually sign up for an Amazon S3 account yourself, and get wholesale prices as it were, around $10/month for 80GB of storage. All you get is access to their storage, you don’t get any means of using it as part of a backup strategy out of the box. That’s where a handy little app called Arq comes into the picture.

Arq - automated backups to Amazon S3

Arq is an app which costs around $30, and provides a beautiful interface to Amazon’s S3 cloud storage. It walks you through signing up for S3 and setting it up for automated remote backups. It runs in the background, and can quite happily backup external drives.

I now have a backup strategy that I’m happy with:

  • Music
    • synced across devices via iCloud
  • Photos
    • stored on an external drive which is backed up to Amazon S3 with Arq
    • might set up local backups onto the Time Machine drive for a redundant copy
  • Videos
    • they’re just stored remotely on one of my Time Machine drives (the NAS), don’t really care if I loose those; I rarely if ever re-watch them
  • Writing, documentation, PDFs etc
    • synced across devices via Dropbox
  • Source code & assets
    • backed up remotely via version control systems
  • System files & apps

It will be some time before Arq finishes it’s initial 50GB upload, but once it’s done I’ll have peace of mind that our most precious memories will survive flood, fire, and hopefully foolishness :) Well worth the $30 up-front investment in Arq, and the $0.33/day in Amazon S3 storage fees.

Friday, March 16, 2012

Abandoning beans for Paleo

Sometime towards the end of January 2012, I ran out of beans. That’s not a metaphor, I quite literally depleted my supply of beans. My system was to buy packets of dried beans, soak them over night, and boil them up the next morning, then leave them to cool during the day and bag them up and freeze them in the evening. Then I’d just take out a bag as needed until they ran out, and repeat the process.

Except one time, inevitably, I couldn’t be bothered, and just added some extra veggies to my plate. Low and behold, without realising, or even intending to, I’d gone Paleo!

Here’s my weight from January 2012, clearly trending up (which isn’t necessarily bad):

And then in February 2012 after abandoning beans, trending down:

My body fat over the same period showed the same slight trend down.

What is Paleo?

In a nutshell, the idea is to try and replicate the diet that our ancestors would have followed before the agricultural revolution around 10,000 years ago, and the more recent introduction of processed foods and vegetable oils.

Basically, try and eat plenty of the following:

  • Meat
    • lean cuts of beef, pork, chicken
  • Seafood
    • Wild-bred fish like salmon, shrimp, mussels
  • Vegetables
    • Pretty much anything non-starchy or sweet, like broccoli, cauliflower, cabbage, carrots, etc
  • Fruit
    • Low sugar content fruits, like figs for example
    • In small quantities, preferably after exercise
  • Nuts
    • Walnuts, brazil nuts, pecan nuts (in order of preference for their Omega 3/6 ratios)
    • In small quantities, as snacks if needed
    • Peanuts aren’t actually a nut, but are in fact a legume, so they’re out!

Dairy is generally out, although some allow certain specific types such as low-fat greek-style yogurt, and cottage cheese.

How is it different to the “slow carb” diet

The exclusion of beans & legumes, and a slightly more relaxed stance towards some specific fruit & veggies.

How is it similar to the “slow carb” diet

Besides the exclusion of beans & legumes, it’s very similar. The aim is ultimately the same: to keep satiety high with high-quality lean protein & good fats, and most of our nutrients from non-starchy vegetables with a low glycemic index/load that keeps blood glucose consistent and avoids insulin responses.

What’s wrong with beans

Seeds, grains, beans, and legumes are natures reproductive systems, and as such it’s really not in their best interest to be chewed up and digested, which destroys them in the process. Some fruits have evolved and kind of symbiotic relationship with their diners by packaging tiny seeds that can actually withstand the digestive process, and they actually benefit from being transported away from the parent plant. Generally speaking though, the rest do actually have a defence system against being digested.

Beans contain a toxin that is largely mitigated through cooking, but not completely. Even beans that have been soaked and boiled can still contain trace amounts of lectin phytohaemagglutinin, which doesn’t play too kindly with our sensitive digestive system. It won’t kill you, but after going 30 days without it, you notice the difference.

Too much information warning: before going slow carb, I was famous for my flatulence. After going slow carb, it was much better, but my no. 2s were still not ideal. Since eliminating both grains, and beans/legumes from my diet, I now have healthy, solid, “paleo poos”, and my farts are pretty much just “morning thunder” upon waking :)

Not all carbs are equal

I’m really enjoying this, it’s more sustainable than slow-carb because it doesn’t require processing beans, and I feel healthier from top to bottom. One thing I’ve learned though is that food generally fits into 3 categories:

  • fat
  • protein
  • carbohydrates

Which generally means that if it’s not meat/oil, technically it’s a carbohydrate. That includes all those cruciferous veggies I’ve been munching down. But I’ve also read that once you’re lean & healthy, you can relax your stance on medium GI carbs like figs and sweet potatoes/yams. So I’m going to try following up my kettle bell swings with some some med GI carbs to keep my muscle glycogen levels up, and hopefully reverse that weight trend by gaining some lean muscle mass.

Tuesday, January 10, 2012

100 Russian kettle bell swings!

Firstly, happy 2012! Seems it’s been some time since I’ve posted anything here, but looking back it’s as though this has turned into a diet/exercise blog… Guess it just reflects whatever I’m into at the time, and right now I’m keen on getting healthy; I’m getting closer to 40 years old, and have realised that each day is probably the healthiest I’ll ever be from now on, so I’m working to make the most of it.

Towards that end, I’ve been on the 4HB slow-card diet for almost a year, and have been exercising with Russian kettle bells, as the book recommends. And it’s going really well!

My body recomposition goal when I started out at around 75Kg was to get down to around 70Kg, and my target with the kettle bells was to get to 75 repetitions of the basic two-handed swing using a 20Kg unit. Since hitting that goal last year, I decided to simply keep going and push for 100. Today, I finally made it!

100 swings in a single set

I do a bunch of different swings with a 12Kg unit to work as many different muscle groups as I can, and finish off with the two-handed swings using the 20Kg to focus on fat burn and core strength. The entire routine takes around 25 minutes now, with carefully timed 25 second breaks between each set. My first time hitting 100 swings took 2:54, or 174 seconds - and average of about 1.74 seconds per swing.

A bit crook in September

One advantage of my diet & lifestyle is that I pretty much never get sick, not even so much as a runny nose, but last September I got taken out by a nasty virus that kept me in bed for a few weeks with a high fever. I skipped my exercises for a few weeks, lost my appetite, and lost a couple of Kg that I haven’t been able to restore yet. You can see dip in the graph where I’d just hit 80 reps, but backed it off to 75 again when I started exercising again. Hopefully the weight loss was body fat and not muscle atrophy, although I wasn’t tracking body fat back then so there’s no way to know for sure…

Where to go from here?

So here’s my plan going forward: I’m going to increase my weights by 4Kg to 16Kg for the smaller, and 24Kg for the larger kettle bell. I’ll just jump in and see how many reps I can do without compromising my technique, but aiming for 75 with 24Kg. If I can do it, that’s great, otherwise I know that with perseverance and patience, I’ll get there eventually!

I’m also hoping to gain some lean body mass by taking the 4 means/day recommendation more seriously; until now I’ve been eating breakfast within 30 minutes of waking, lunch within 4 hours after, but then going 6-7 hours before my next meal with only a light snack of nuts or something in between, and nothing afterwards. That’s good way to trigger the body’s emergency energy storage mechanism (fat). This year I’ll try to get 4 meals a day, every 4 hours, to maintain consistent blood glucose levels throughout the day without triggering starvation mode.

Otherwise, I haven’t made any new year’s resolutions or any such bollocks, I just intend to keep working my hardest in everything I do to make it as awesome as possible!

cheers