Saturday, June 8, 2013

Using TDD (Test Driven Development)

Screen Shot 2013-06-08 at 10.35.06 AMIf you read my previous post (WordPress Recovery), you know I've been writing some code to recover my old posts. It occurred to me I could take a small segment of what I've been doing with that code to demonstrate my approach to TDD.

Since I'm a hacker from way back, and also because I was in semi-panic mode about losing the content, I didn't approach this task with testing in mind. Now that doesn't always result in bad code: I've been doing this long enough that I can usually think through a fairly good model and code something that isn't one long method full of inline code.

In this case however, once I had started coding, I realized again that this was an opportunity to practice coding the "right" way. I had already begun with a Maven project, and generated unit tests as I went through the process of starting to build the code, so I had at least some good functioning unit tests.

Monday, May 27, 2013

WordPress Recovery

Well, I have the basics of my blog recovered now, so almost all of my posts going back several years are once again available.

In my last post titled Lesson Re-learned: Backups !, I admitted that I had committed the cardinal sin of making changes to my web site without doing a backup first (walking the tightrope without a net).

Luckily for me I had installed the WP Super Cache plugin, so all of my content actually still existed as static files, and being a bit of a hacker, I was able to throw together some code to effectively recover my posts.

Sunday, May 19, 2013

Lesson Re-learned: Backups !

[caption id="" align="alignright" width="239"]Homer Simpson Homer Simpson (Photo credit: Wikipedia)[/caption]

I just shot my blog in the foot, or more accurately, I didn't follow IT 101 and back things up before making a change.

I had moved my site to be completely WordPress based a while ago, and as a result I had a bit of a convoluted setup on my server.

When I first set up my WordPress blog it was as a sub-domain of accuweaver.com, and was housed at http://wordpress.accuweaver.com/ (also aliased to http://blog.accuweaver.com/). The http://www.accuweaver.com/ site just static pages that hadn't changed for years.

So when I finally got my blog set up to host the few static pages I had, I just changed the directory on my server to have a symbolic link to the directory where wordpress.accuweaver.com had it's content:

  1. Removed the directory httpdocs from /var/www/vhosts/accuweaver.com

  2. Added a link in that folder to /var/www/vhosts/accuweaver.com/subdomains/wordpress/httpdocs.


This actually worked really well, since the content was only in one place, and all I had to do was change the host name in WordPress.

Friday, May 3, 2013

How to Get a Google Voice Number for Your Own Email Address

If you want to use some Google services (like Google Voice), and have them associated with your own email address, it’s not all that difficult.

First, if you already have a Google account (like a GMail address), you will want to log out of by clicking on your name or icon up in the upper right corner of any Google app, and then click the “Sign Out” button:

Sign Out of Google

Thursday, April 4, 2013

Unnecessary Drama

I have a theory that as human beings, we create a lot of unnecessary drama because of misunderstood communication. And in most cases the intent of the message is something good, but what’s received, well, not so much.

Political leaders have this worst, since every sentence they utter goes under a microscope and is often compared to every other thing that they ever said. A leader can, for instance, think that they are rallying the troops to liberate a country’s people from oppression, and be understood as a crusader trying to impose his views on the rest of the world.

Friday, March 29, 2013

Just Git’R'Done on Gun Control


1967_Dead-Eye_Rob
When I was in third grade, we lived in Fairbanks Alaska, and I wanted to be a grown up. Because Alaska is frontier wilderness, a lot of the activities I remember were around doing things in the outdoors with the family.

I wanted to be grown up, so I got a paper route (at eight years old I was the youngest one they’d ever had). I remember that I had to borrow my Dad’s typewriter to write the circulation department telling them why I wanted to be a paper boy.

I also remember my parents making me take my little brother with me so I wouldn’t get into trouble and getting into trouble anyway (but that’s a whole bunch of different stories).

Monday, March 25, 2013

Creating a New App (step 1)

I decided I’d walk through creating a new app to replace one I’ve used for years on my iPhone that no longer appears to be maintained. The app in question is called GasBag which as near as I can tell stopped being updated in 2009 (see: http://blog.jam-code.com/).

 

I could just write a quick and dirty web app to store my mileage, but I figured I’d approach this as an exercise in building an iOS application with a design first approach.

 

At a high level, what I want is an app that easily captures my mileage, and allows me to save that information somewhere that won’t get destroyed. There are a number of features that GasBag had that I liked (for instance being able to send an email with my mileage information), and a number that it doesn’t have that would be nice (like allowing me to use it for multiple cars, or to do some data capture from a gas station receipt).