Happy Holidays

Happy (belated) Holidays to all of you. I hope you got to spend some quality time with family and friends.

Ancient Trees
Ancient Trees

See you next year!

Lately I’ve been working on a pretty hefty spec for work (hint hint… it’s a REST API spec). I like writing my specs in TextMate using MediaWiki markup, so I can easily post them to our internal wiki once they’re ready.

One of the annoying things about this spec is that it involves dozens of examples in XML and JSON that are embedded in <pre> tags. I wanted to be able to develop and edit these samples as native XML and JSON files for convenience, but it was becoming a real pain to keep them updated in the main document via cut and paste. The obvious solution to this problem is a text preprocessor that would allow you to include a .xml file in the main .wiki document. There are dozens of these, but they’re all a pain in the butt to use and I didn’t feel like setting them up.

The solution, which couldn’t possibly be more obvious, was suggested, somewhat jokingly, by a coworker of mine:

cpp

Yup, the good old GNU C Preprocessor. If you run Linux, or you have a Mac (basically, any *nix), or you do any development whatsoever, chances are you have one hiding out on your machine somewhere. Chances are you’re also familiar with the #include "foo.h", which you’ve used since freshman year to have the preprocessor include the header for another C file before it passes it off to the actual compiler. But you never thought about using it to help you with your homework (or your specs) before.

Well cpp has a handy -P parameter that tells it to forgo the inclusion of the normal linemarkers it includes for the benefit of the compiler. This makes it perfect for simple stuff like embedding one text file in another.

In your main document, use a #include statement to include your example file:

document.txt:

== XML Example ==
The following is an example of the server's response in XML:

<pre>
#include "example.xml"
</pre>

example.xml:

<example>
      <message>Hello World!</message>
</example>

Then use a simple Makefile to build your output document:

Makefile:

all:
        cpp -P document.txt document.out.txt

Using a Makefile means you can use TextMate’s Makefile bundle to quickly and easily build your document.

There you go, a completely “duh” way of doing simple text includes on any *nix system.

Tags: , , , , , , ,

By popular request, I thought I’d write this one up. It’s a quickie.

Finished Product
Finished Product

A month or two ago, I was lucky enough to spot a pair of very cool vintage theater seats with a big “FREE!” sign on them sitting on them down the street from my apartment. After my eyes lit up with the possibilities, I convinced an anonymous neighbor to help me haul them to the elevator.

Then I asked my awesome father for some carpentry assistance, since I can’t fit a table saw in my apartment.

He totally came through for me with a great “floorboard” made from some gorgeous teak/holly flooring (commonly found in sailboats) edged in oak. Mounting it to the seats was pretty straightforward – just some 10-24 stainless bolts backed by fender washers and nylock nuts. I added some standoffs made from nail-on nylon “magic mover” pads to make them easy to move around.

The result is awesome. They work great as a couple of extra seats for guests that stay out of the way when I’m not using them. And I love the quizzical look friends get on their faces when they try to figure out how I managed to steal them from the movie theater.

Tags: , , , , , ,

Apparently I was too busy to even mark the passing of my own birthday.

Birthday Candles
Birthday Candles

Monday was the big-two-seven for me. My god I’m getting old…

Photo from luvtequila2005’s CC-licensed photostream

Tags: , ,

For the last two years, I was a BlackBerry user and a T-Mobile customer. As a whole, I was very happy with their service. Their coverage was good, their data plans were cheap, and they rarely did anything sketchy to try and rip me off, besides that normal cell phone company “Hah hah! You sent five extra text messages so we’re going to bill you at a rate of $32,153/mb for that extra 800 bytes of data you sent!” trick. None of that evil stuff AT&T or Cingular did so many years back that drove me away.

iPhone 3G Logo
iPhone 3G Logo

But, I’ll admit, I was seduced by the new girl on the block. The hot new iPhone 3G with her sleek black exterior and big sexy screen. And I probably didn’t do my homework as well as I should have. I knew I’d bought my BlackBerry two years ago, and I was sure it was in the summer, but I didn’t know exactly when my contract expired. Worst case scenario I’d ride out the final month of my contract then I’d be in the clear. I was positive I’d be fine, so I jumped…

10. days. early.

This, of course, I didn’t know until I got my final T-Mobile bill today and discovered a $200 early termination fee. Apparently T-Mobile considers porting your cell phone number a request to terminate your contract, so they decided I was on my way out.

So I called T-Mobile customer service at 9PM on a Monday night, fully expecting to wait an hour only to be told “Well sir, you should have reviewed your contract before you terminated your service.” Shockingly, within about 10 minutes there was a human at the other end of the line. I explained my situation and, to my surprise, he said “Well, you were only 10 days early, so I think I can help you out”. It took a few cycles of him putting me on hold to talk to supervisors, since he’d never done an override like this one before, but he was able to convert my $200 termination fee to a $7 “contract buyout fee”.

This is an example of truly awesome customer service. Being polite, reasonable, and fair to your customers, even as they are walking out the door. More companies should emulate this. If you’re looking to buy a new (non-Apple) phone, you can do much worse than T-Mobile.

Photo from Fr3d.org’s CC-licensed Flickr photostream

Tags: , , , ,

« Older entries § Newer entries »