Making Rails Routes Fantastic

I took a week off from work to move into our new house. It was a time of rest, and relaxation despite the chaos around what moving can bring. I’ve had a few personal projects on the back burner, but never seemed to have the time or the energy to make much progress. Recently a talk with a friend reminded me how important completing those pet projects can be for your personal happiness. I’m proud to present the completion of an idea I’ve had a for a while: Routastic.

What is Routastic? It serves as an interactive Rails routes editor. Simply, I got tired of the pattern of modifying config/routes.rb, then running rake routes and grepping for some result. This is completely inefficient. My inspiration came from the beautiful Rubular.com and its interactive regular expression building. Its quick. Its painless. Its a valuable tool for everyday programming.

Please check out http://routastic.herokuapp.com/ and let me know how I can improve it.

Special thanks to Avand Amiri for suggesting the name (despite the name screaming Web 2.0, it actually is quite memorable!)

Unthinking Fullscreen Mode

Apple’s fullscreen windows are driving me nuts! We were co-existing until I “lost” a very important terminal session. Turns out I didn’t lose it, but it was in fullscreen mode. This omitted the window from cycling via Command+~, as well as being absent from the app-specific Expose (though it was present in Mission Control – something I seldom use.)

I hope they change this behavior soon. Here are some observed pain points:

  • The two second animation when switching from your desktop to Fullscreen applications via Control+left|right arrow is not only unnecessary, but frustrating. This could be much faster, and without the easing decelerating at the end of the animation. Same holds true for Command+Tab (though the animation is mercifully quicker)
  • The hotkey for taking an application into Fullscreen mode should be dictated by the window manager, not left up to the developers. Why not F11? Currently its Control+Command+F in Google Chrome, Command+Enter in iTerm, etc.
  • Why are these windows omitted from the task switcher? These programs are still running, so they should be reachable by the switcher. Is there another switcher hotkey to toggle between windows of the same application? Command+~ doesn’t work if the other window is in fullscreen mode.
  • Command+Tabbing between applications is problematic if you have multiple windows open of the same application when one is in fullscreen mode. From my fullscreen window, I switch to another application, then switching back defaults to the non-fullscreen window instance on the desktop instead of toggling back to where I was.
  • Why are they moved into their own workspace? Just remove the window chrome and leave it where it is. I was working in a fullscreen window, and I needed to use the calculator program. This created absolute insanity switching between applications due to the unnecessary animation each time. I ended up having to take the application out of fullscreen mode just to use the calculator in an efficient manner.
  • Why is there no transparency available to fullscreen applications? I like a transparency to my black backgrounded terminal. No such luck if you also use fullscreen mode.

So here is my suggestion: Get rid of the butt ugly arrows for fullscreen in the window chrome, and make that useless green button in the upper left hand (you know the one that sometimes makes windows resize _smaller_) and make that the fullscreen button. If it isn’t broken, don’t fix it.

In the interm, I’ve almost abandoned Apple’s fullscreen mode in favor of Cinch for positioning fullscreen windows. It works like the Windows 7 window manager (and Ubuntu) and allows applications to fullscreen by dragging the chrome to the top of the window.

Kanzen in the Science of Product Packaging

Unpacking the Canon MF4770n laserjet printer is a sight to behold. The machine is matte black, and the safety cards are bright orange. But its more than just removing tape and packing. The cards are elaborately and thoughtfully installed, forcing you to step through the installation process in order to remove them.

For example, take the installation of the toner cartridge. Trying to remove the safety card without opening the top of the laserprinter is a futile effort. After you disengage the lock and open the top the card continues and wraps around the toner cartridge. Pulling now gets you further. It releases the cartridge which has its own safety components. You are shown that you should shake it then pull the activation strip to expose the toner to the heating element. It only slides back in only one way. After the safety card finally allows you to disengage it, you see that it is about two feet in length.

This ingenuity continues with the paper holding tray. It is configured for shipping and storage and must be reconfigured to hold paper and operate. Rather than tedious instructions you are presented with another safety card. Pulling the tab this time unlocks, unfolds and drops the printing tray into position. It accomplishes mechanically what an instruction booklet may have taken three or four diagrams to illustrate.

The entire time I was setting up the printer I felt like I was working with an extremely polished product. I didn’t even crack the instructions (rarely do I), but this time there was no room for doubt. It just goes to show that the OOBE an have just as much of an impact on a consumer as the product itself. Installation is a time when anxiety (or frustration) is high, and knowledge is low. This is the perfect time to comfort your customer and generate repeat business. The packing and installation really sets the stage for what is to come. I’m looking at you IKEA!

The Regular Expression Behind Currency Formatting

I came across an interesting requirement today to format a floating number as currency. In the US and many other countries, currency greater than or equal to 1000 units ($1,000.00) is typically broken up into triads via a comma delimiter. My initial reaction was to use a recursive function, but I glanced at the Rails’ ActiveSupport gem to see how their number_with_delimiter method performed this same task. I was surprised to learn that this was handled via a clever regular expression.

View at https://coderwall.com/p/uccfpq

The California of Texas

Austin is a counter-culture in the heart of Texas. I’m not sure what I expected, but vegan friendly restaurants, health food stores, hundreds of miles of bike paths, a city wide ban on plastic bags, and a highly affluent populous was not what I was expecting. So beings my journey.

The Sights

We drove thirteen hours overnight to accomodate our newest passenger, Morrigan and her sleep schedule. As bad as driving all night was, at least we didn’t end up with a screaming toddler in the backseat. We visited some of Kristin’s kin in Houston, which served as our base for the weekend before pushing further West to Austin.

We negotiated a great monthly rate on a condo we found on Airbnb off South Lamar on the South side of the city. (Affiliate link) I’ve been really impressed from the moment we pulled into our new home away from home. The unit is small, but renovated, and well furnished. What we lost in space, we more than made up for in location. Right up the street is a lifetime supply of changing restaurants, and only a 10 minute drive from Zilker park.

Our first weekend we visited a local farmer’s market and bought some Texas grown produce. I never thought I would do what we did next – attend a vegan festival. Sure enough. In the land of BBQ, thousands of health nuts live in this city. Despite being vegan the food samples they had were all delicious. If I hadn’t known, I wouldn’t have tasted any difference. Vegans have masterfully replicated an omnivore’s menu.

The next week brought with it a trip to Fredericksburg, another hour West of Austin (but still not halfway through the state!). It is a German town, and had plenty of beers, wursts, and gut busting treats. The main strip is really quite a marvel, as it goes for over a mile and encompases lots of original architecture. Sunday we visited the Austin Zoo which put a spin on the traditional approach, and opted for a non-profit animal rescue shelter and animal sanctuary. Morrigan loved spotting all the critters, but the Texas heat won out, even in April. I was never so glad to pay $2 for a bottle of Coke.

This week I rented a bike and road around the Lady Bird Johnson trail which follows the river that bisects the city into North and South. It is wonderfully engineered, running past coffeeshops, restaurants, playgrounds, fishing areas, boat ramps, and dog parks. I wish Atlanta had something like this to offer. Maybe when the greenbelt is completed? (And the bikeways protected with police?!)

We have plans to go to San Antonio next weekend to visit Fiesta de los Niños, and plan on visiting my cousins who are lucky enough to live here. Following that will be our last week before the long migration home. We will be spending the last weekend back in Houston where we will visit Kristin’s folks for her mom’s birthday celebration.

Remote Working

Working remotely during this time has been interesting. I’ve learned an important lesson: don’t go anywhere during the launch date for your product! Too much was up in the air to leave beforehand to stay clear, and I was concerned that afterwards we would be scrambling. Turns out ramping up to the last minute before launch can be just as stressful.

For those of you following along who already, or wish to do remote work, ensure that you rent a place that you can have a quiet place to work. I find that mornings are my most productive time, and I try and guard this time for the important tasks. But with a smaller rental unit, and a one year old, I found thata nice pair of headphones is essential. I’ve taken advantage of ROWE several times during the week when we visited the capitol, and visiting parks, and going out for walks with the stroller. It pulls me out of my comfort zone to not be sitting at my desk at 9am, but then I realized the world doesn’t end. I simply make up the time later. Exercising this perk has really boosted my confidence in working for my company. They genuinely care about results and not office hours.

Also, have a backup plan if (when!) the Internet goes out at your rental unit. The maintenance people decided to test the waterproof claim of the rental’s outdoor wireless AP with a pressure washer. I’ll let you guess as to the winner, but I spent the rest of the day at a coffee shop. Also – scope out your coffee shops. I would love to see a website that lists the rating of different places based on workability. Some places don’t give you the vibe (despite having wireless) that they want you hanging around with that laptop of yours. Other places look promising, but offer no connectivity. Grab a cup of coffee or tea beforehand and scope things out.

A few notes on extended vacations: Don’t binge vacation! You are there for a while, so relax. Buy some groceries; every meal doesn’t have to be an experience. We have been aiming for eating out once every few days. It helps with the finances as well.

Don’t wait until the weekends to go exploring – especially when you have ROWE. The weekdays are the best times because the crowds are small, and the traffic is light. Check out your local attractions. One of the most relaxing things has been for me to join Kristin and Morrigan in the mornings for a walk around the neighborhood.

I wasn’t at home with my millions of distractions, so I wasn’t prepared for a “boredom adjustment”. Once I realized its not a pure vacation, and that I had to work, I struggled to find ways to wind down in the evenings. I ended up finding a used bookstore and stocking up on reading materials. I’ve enjoyed reading again instead of falling asleep in front of the TV, or playing video games until the early hours.

Being in a place for a month is certainly better than the binge vacation, but it is just a taste of what living somewhere would be like. Its just enough time in my opinion to really begin to absorb the culture. I find it thrilling to wonder what each day will bring, as everything is new. Maybe you spot a new restaurant (or food truck if you are in Austin), or drive past a park you want to checkout, or see a bike rental shop. I’m really making up my itinerary as I go. I’m glad I strived to find a job that affords me the opportunity to do this, and I wish that everyone who wants the same can achieve their goals. I can tell you its totally worth it!

Welcome to 2010

I broke down. I compromised my moral integrity. I did what I laughed at others for doing. I bought a tablet, and I couldn’t be happier.

What changed? Did my opinion change? Not drastically. I still don’t see them as the future of computing. They are a consumption device, and it would be difficult to do much more with them than that. But that is what I wanted.

Pricing has also changed drastically. When the iPad first came out, it was a 10″ behemoth, and it costed around $500, putting it well outside of my interests. (A high end laptop could be found starting at ~$800.) However, within the last year, some solid contenders have entered the 7″ ~$200 arena. The nVidia Tegra 3 chipset, quad core processing, and the latest Android experience on sale in the Nexus 7 for $155 shipped was too good for me to pass.

I have long said that I could’t justify a tablet when I have a desktop, two laptops, and a smartphone all within reach. My circumstances changed however during our latest vacation, and I found myself draining the battery on my smartphone daily trying to stay connected. I have discovered a few good areas that a tablet excels over other devices

  • Entertaining when space is limited (car, airplane, bed, etc)
  • Reading eBooks
  • Reading technical posts with code examples
  • Games developed for the touchscreen
  • Quick reference during certain table-top activities…

I find my discovery process similar to getting my first smartphone. I remember a few days after I had my smartphone I had the realization that I could get from my location to any other location without ever missing a turn again. I drove to a retail store to make a purchase and realized that I could mitigate buyer’s remorse by price checking while standing in the store! Information is power, and I had the Internet in my pocket. I could check reviews, prices, availability, stock nearby – all without carefully planning my trip beforehand at home.

While that smartphone does some things really well, it is a small form factor. For anyone that has ever upgraded their monitor to a larger size, or their computer to a faster model, you will know the feeling when you migrate from a smartphone to a tablet.

Despite my fears, I don’t think it will quickly become a device that collects dust. I’ve heavily used my smartphone for close to four years now, and there is no sign that this will change in the near future. The tablet is the extension of the smartphone.

I’m not saying to go blindly buy one – you should still have good reasons, and stick to a budget. But if you find yourself running your battery down on your smartphone from overuse, let me recommend a tablet to you.

And welcome to the year 2010!

The Plight of the Used Book Store

I never really considered the situation that used book stores find themselves in this day and age. I just got back from a real gem just down the street from our rental. They aren’t a chain, and are probably family owned and operated. They are getting by, but probably not making tons of cash. From the minute I stepped inside and saw what a neat feel the store had, I wanted to buy something (anything) as my way of saying thanks, and to allow them to keep on doing what they do. The store was almost empty, and I hoped it wasn’t their peak hours.

Walking around, the thought that kept coming to the surface of my mind is that the eBook retailers must be killing them. What can they do to compete against Amazon, Barnes and Noble, Google, Apple, and others? They can’t match their inventory selection, can’t operate a retail location for cheaper overhead costs, or negotiate deals with publishing houses for volume discounts. They can compete on price of individual books however – AND THEY DO! The books I was finding were 50-75% off the retail prices of online book stores. It struck me as odd that people would rather pay twice as much for an electronic copy of the same material, when just down the street they can get a copy made from dead trees for a fraction of the price.

It just isn’t fair. Have we become so lazy that its easier to click the checkout button than it is to go down the street? I’m guilty of it myself. After getting a Barnes and Noble Nook for Christmas a few years back, I’ve been disappointed at how the savings of eBooks over printing paperback books has trickled down to the consumer. Hint: It hasn’t.

I happily bought four books and walked out feeling like I had done the right thing. I wish that shop had an answer, but I don’t see how they can come back from the current situation. The one angle they have to compete mitigated by human laziness. I have a feeling Morrigan won’t be seeing too many book stores when she is my age…

git rebase –autosquash

When working in a feature branch, I make some changes to a file and then commit these changes. Later on, I make some additional changes to the same file on the same lines, and I want to squash these changes into the first commit touching the file.

To find out more, check out my Coderwall Pro tip: https://coderwall.com/p/hh-4ea

Cloudy, Cold and Hip – Two Weeks of Training in Portland

I’ve really enjoyed the last two weeks. My new employer, recently acquired Analog Analytics flew me out to Portland, Oregon for training. Portland is quite an amazing place. Skateboarders, cyclists, and runners abound, but with a laid back attitude. Its the greenest city I have ever visited. Stores seem to only dispense recyclable materials including paper bags, and foods in waxed cardboard containers. The entire city is very walkable without much danger of personal harm. The food was amazing, and the drinks even better. This city knows its coffees, teas, and beers. It has to be home to the most microbreweries of any city. Needless to say I have probably gained 5 pounds, and I am super caffeinated. Also, the proximity to all these hip restaurants is giving me second thoughts about living so far outside of the city limits. No lie, I even glanced at Portland housing prices.

It took me a few days to get oriented to the city and the work environment. The company runs out of the Ford Building, in the heart of quite a few cool restaurants and bars in the Southeast side of the city. In fact, it left me a little jealous considering the hotel is only surrounded by fast food joints.  I got a shiny new MacBook Pro (which I am currently battling to make it as “boring” as possible). I can’t talk too much about the work, but it does hit the sweet spot of what I was looking for – a small team feel with deep pockets, and a launch date.

Kristin and Morrigan joined me for the second week and did their own thing, and they had a blast. They visited OMSI, Powell Books, Finnegans, several parks, and malls, and some tasty food joints. I’m happy they got to experience some of what makes this city awesome.

I’m enjoying several aspects of the job in particular: A remote driven environment, and pair programming. Training isn’t the best test run of this environment, as I am in the office everyday for now. Once I am setup, I pick the hours. People hop online and offline, according to their time zones, availability, etc. Every piece of communication, and workflow is centered around remote teams.

Pair programming makes programming social. Despite the image that telling someone you are a programmer conjures, I really enjoy interacting with people. I remember teaming up with James, John and many others at Clayton State to tackle some large issues with our portal and other systems. Since Clayton State, I have worked on a couple teams, and it was almost always in isolation, save for 5-10 minute high level meetings. The best part is, its actually kind of fun.

Pair programming was a tough adjustment for me. I’m used to presenting a final product and defending its implementation. I have all the answers. I know what the talking points are up front, and I am comfortable because I am the authority on the subject. Pair programming is letting your guard down, and conceding as much as contributing. You are two people working on a problem together, with neither party starting off knowing the complete solution. The work is certainly slower than solo programming, as incorporating input, early refactoring, and general discussion takes up time. This team takes an interesting approach to combat some of the time drain; You can either pair program and merge directly, or work solo but your code requires a peer review before merging. The choice is yours. The solo programming option will probably act as a safety value for those days when I just want some time to myself. They also encourage “switching drivers” to vary the work. Interestingly, being the passenger requires more focus than driving, as you are trying to proactively find issues with the current approach.

I’m still struggling to embrace TDD. I don’t like the zealotry in the community when the topic comes up; presenting the only two options as either you test first, or you are just ignorant, undisciplined, or apathetic to the code you write. The truth is far from it. I figure things out by moving the pieces around – not by staring at it from a distance. That is not to say that there aren’t times when testing first is extremely useful, like when clarifying requirements. The test assertions (even with missing test bodies) is often enough to help solidify an attack plan. The amount of code coverage can be a hindrance though, as real world tests always end up being more tightly coupled than you ideally want them to be. If you make seemingly small code changes, you can end up with quite a bit of the test suite failing (all though with the same few errors repeating). If you mock and stub too much, you aren’t testing much that is useful. Even worse, the workflow doesn’t seem realistic: Write the tests, verify the tests fail, write the code, verify the tests pass. The reality seems to be write the tests (heavily guessing at the exact implementation), verify they fail, write the code, refactor almost all of your tests, and verify they pass. Given the choice, I think I’d still rather write code, then test the code to verify it does what I want in all scenarios. I’ve yet to meet a dyed-in-the-wool TDDer that sees any fault with this extra refactoring step. The subject of pre-written tests needing to be refactored seems to be glossed over. Maybe my opinion will be changed yet.

Things are looking awesome for this next step in my life! I’m keeping my fingers crossed for Railsconf tickets, since they are in my employer’s backyard. There are also a few missed restaurants I am meaning to visit next time I’m back up this way…

In order to make delicious food, you must eat delicious food

In order to make delicious food, you must eat delicious food. The quality of ingredients is important but you need to develop a palate capable of discerning good and bad. Without good taste, you can’t make good food. If your sense of taste is lower than that of the customers, how will you impress them?

Jiro in Jiro Dreams of Sushi

When I heard this quote, I immediately thought of software development. The best way to write good software is to look at the design principles of good software. You can’t work in isolation. That problem you have is the same problem that has been solved millions of times before by people that are better than you will ever be. Without good taste, you can’t make good food. This is why open source is so important. Look at the source code whenever you are curious how something works.