Glass Half Full

A glass half empty remains plenty full enough

What has become known as The Year of Benj is now half over. Let me rephrase: I’m now beginning the best half of TYOB!

I’m in a serious groove right now. It doesn’t matter if I’ve already worked all day or if I’ve been out partying and get home after midnight: prime me with a couple squares of dark chocolate, tune the Apple TV on my desk to John Oliver, and next stop will be 8:30am and a half dozen items off my to-do list.  Repeat about 4 times per week, and things truly start happening!

Yesterday I worked from the beach just to prove that I could. TYOB, YOLO! It was in the mid-70s (degrees, not decade, sadly) but the wind was obnoxious. I had goose bumps the whole time. However, the equipment test mission was a success! My new beach umbrella and sand anchor didn’t budge in the wind. I could see my Mac’s screen just fine thanks to the dorky but effective Pixel Sunscreen. And I scoped out the beach access closest to a cell tower, which afforded me 3 bars of AT&T signal. (I’ll try for 4 next time, but 3 gave me a steady 1Mbps up and down, fine for my typical needs.)

Now I just need to work out a system for accepting dark chocolate donations…

Did I mention, Charitocracy contributions are tax-deductible?

Total Eclipse

Don't know what to do, always in the dark? Totally get the Eclipse debugger!

🎶 Once upon a time I was calling printf, my debugging skills were falling apart… Nothing I could do but then I found Eclipse, now I ❤️. 🎶

I have plenty of experience with debuggers: db, ladebug, gdb, jdb, NetBeans, WinDbg (affectionately known as WindBag), Xcode, and perhaps my all-time favorite, SoftICE. I’ve used them almost exclusively to debug low-level device driver code. This is my first time since last working on cutting-edge web code circa 1999-2001 that I’ve had the need to debug server back-end scripts.

PhpStorm seems to be the most highly praised option out there, but they don’t offer discounts to non-profits, and it’s pricey at $199 for the first year! The next most popular is Eclipse for PHP Developers, and the price is right: free. It uses PHP’s Xdebug extension, and worked like a champ. I was setting breakpoints in my PHP functions, actually hitting them, inspecting variables, stepping through code, and fixing bugs (in 3rd-party code of course, not mine) with hasty abandon!

After three all-nighters in the past week, I’m really starting to get the hang of web development again. Don’t get me wrong, I miss needing a debugger that lives below the operating system, and sifting through PCI buffer traces for broken command packets caused by multithreaded race conditions. Really, I don’t. But someone has to make sure deadbeat donors with expired credit cards receive an encouraging email with a link to remedy the situation, right? That someone is me.

Introducing Benj, Charitocracy's fastest coder

Who’s Gonna Ride Your Wild Horses

Cowboy coding, I wish I knew how to ⌘Q you

The sun has set on my unbridled “cowboy coding” for the last time. (Geek alert. You’ve been forewarned.)

Traveling 5+ weeks and not touching Charitocracy the entire time was never my plan. I thought I would have remote access to my home server, but something went wrong. (I still don’t know what, but I have some suspicions.) I set up a more reliable VNC connection as an immediate countermeasure when I returned home so this particular obstacle wouldn’t repeat itself.

Really, though, I needed to rethink my overdependence on an old Mac Mini (MM). I chose it as my main staging server by virtue of it being the only unutilized Mac in my house, purchased as a home theatre PC before Apple TV made it obsolete. I used dynamic DNS to direct charitocracy.org traffic to my home network, then my router port-forwarded to the MM. It just worked… except when it didn’t. Namely while on my trip, and about half the times I tried logging into it from neighborhood coffee shops.

Meanwhile, I have a powerful mid-2015 MacBook Pro (MBP) at my fingertips any time I’m working. It runs circles around my circa 2009 MM. I never need to access it remotely over a questionable net connection. So why am I trying to use it as a dumb terminal into an ancient machine across the house, across town, or across the world as the case may be, with mixed success at the best of times?

Last week I declared an end to amateur hour by doing the following:

  1. I installed MAMP on my MBP.
  2. I set up a git source control repository (with origin backed by my iCloud drive) to host Charitocracy web code and database.
  3. I rebuilt the Charitocracy beta site from scratch on my MBP, submitting to git at intervals along the way, using my MM’s site as a reference.
  4. I created a pre-commit hook that automatically adds a SQL database snapshot whenever I commit code changes.
  5. I installed and configured PageKite, a pay-what-you-want tunneling service which allows me to receive Charitocracy network traffic (including TLS/SSL) wherever I like, including on my MBP, even if I’m in a random waiting room or coffee shop (as I am right now).
  6. After proving the new beta site worked as well as the MM’s, I pulled all the code and data back from git and proved I could easily clone the site on my MM, redirect PageKite to serve it up externally, make changes to the site on MM, and pull the changes (code and DB) back onto my MBP.

So I’m finally baking some real engineering discipline into my coding process. Nothing falls through the cracks. I can go back to previous snapshots of code and data. I can easily view and search through changes, even if they were in the DB or in code I didn’t write myself, like plugins. I can travel. And all of this is quick and robust, because 99% of it is happening right on my laptop (credit card processing is one exception, but that traffic works seamlessly through PageKite, too). And if I get hit by a bus stagecoach tomorrow, you’ll all be able to pick up where I left off, right?!

I still have plenty of engineering discipline yet to adopt, the sorts of things truly necessary when working in teams with fluid requirements and actual deadlines. So I reckon I’ll just ⌘H the cowboy coder until the coast is clear. Yeehaw!

Callin' the VT100 a dumb terminal? You sure you wanna be doin' that, Benj?