Friday, December 23, 2011

Appcelerator, JavaScript, and Lint

I've been using Appcelerator for a few months now. That means programming in JavaScript, and it's a little scary: out of the box, JavaScript is too forgiving. Things like accidental globals don't belong in production software. But it's tough to keep them out of a couple thousand lines of code without some help from tools.

For me, the right tool is JavaScript Lint. It's easy to integrate into an Appcelerator project. Suppose you're working on fooapp, with a top-level directory of the same name:

  • Download and install JavaScript Lint for your OS;
  • Copy jsl.default.conf from the installation directory to fooapp, and rename it to jsl.conf;
  • Edit jsl.conf. Set always_use_option_explicit to +
  • At the bottom of jsl.conf, insert:

The +define lines tell JavaScript Lint about the globals in your project, so that it doesn't report them as problems.

Now, if you run jsl -conf jsl.conf from the command line in fooapp, it checks your JavaScript and sends the output to stdout. You may also be able to hook the command up to your text editor so that every save automatically runs the checks.

And it's easy to skip safe problem code. I had some third-party code that was triggering lots of warnings, but I trusted the soundness of the code and didn't want to change it. So, to eliminate the warnings, I bracketed the code within a couple of special comments:

Sunday, December 4, 2011

The Real Family Values Candidate

Why are the socially conservative Republican primary voters, alleged champions of family values, so ready to give Newt Gingrich a pass?

To recap: Gingrich is on his third marriage. He cheated on his first wife with the woman who became his second wife, and he cheated on her with the woman who became his third wife. You don't have to be a liberal Democrat to think that Gingrich is a piece of shit. Gingrich says that he's asked God to forgive him. Is that all it takes for the religious right to hypnotize themselves?

Of course, there is one candidate in the 2012 race who embodies traditional family values. He's a faithful spouse and a devoted parent. He's a role model, a mensch.

I'm talking about the guy in the White House right now. Obama is way hotter than Gingrich, but even Fox News has not been able to dredge up any credible scandals. Maybe the DNC should print up some bumper stickers:

    Obama - He Keeps It Zipped






Saturday, November 5, 2011

The Library Is Dead. Long Live The Library!

The Richmond Public Library has e-books! I downloaded Steven Pinker's "The Stuff of Thought" last night, and it's mine for 14 days. At the end of the 14 days, I don't have to do anything. It just stops working on my Android tablet and the next person in the queue gets it. But no worries, because I'm in the queue for Murikami's "1Q84," Whiteheads "Zone One," and Ondaatje's "The Cat's Table."

Now, I fully intend to read every word in all four of these books. But there's a nanochance that I'll abandon one after 100 pages or so. Okay, maybe two. Certainly no more than three. And if I try and fail, at least the books were free. 

First the how-to. Then I'll wax philosophical.

  • You need your library card number. It's on the back of the card.
  • Most of the books are in Adobe EPUB format. so you'll need to create an Adobe account. It's free.
  • Install the "OverDrive Media Center" app on your tablet or smartphone.
  • Open the OverDrive app. Select the "Get Books" menu item. Use "Add a Library" to add "Richmond Public Library" to your "Get Books" page.
  • Tap "Richmond Public Library." Your browser will open at the library's e-book page. Here's where you'll need your library card number to log in.
  • Browse. Find a book you want. Tap "Download."
  • You'll pop back into the OverDrive app. For your first download, it prompts for your Adobe credentials. Then it it downloads the book. You're golden.

Most of this is first-time setup. Once it's done, you've got a process that fixes the main problems of a bricks-and-mortar library:

  • You no longer have to go to the library to get books.
  • You no longer have to go there to return books.
  • You no longer have to read books that other people have touched. You don't have to put up with their marginalia and coffee stains.

So, what's the downside? The death of branch libraries, probably. They'll go the way of book and record stores. Main libraries will endure, for archives and scholarship and prestige. But cities with budget troubles have long tried to cut branch hours. In ten years or so, when the only "library" most middle-class residents care about is on a server somewhere, it will be politically easy to close the physical branches and lay off staff. Big budget savings. Of course, the less affluent, who may not have e-readers, and who depend on branch library computers as a narrow bridge across the digital divide, will get screwed.

I also wonder what this will do to the companies that sell e-books, even mighty Amazon. Why buy when you can rent for free? Ironically, Amazon may be hastening its own problems by rolling out the Android-based Kindle Fire. The Fire may change the consumer tablet market - it's a lot cheaper than an iPad. But, unless Amazon does something evil with the software, a lot of Fire owners may decide to get free e-books from their local libraries instead of paying Amazon. The new Kindle Lending Library program somewhat targets this, but even $79 a year is a lot more than free.

Monday, September 26, 2011

Beer Can Wifi Antenna

Ain't she a beaut? Here are the instructions.

I guess the idea is that the beer can reflects signals that would otherwise escape through the walls, into your neighbor's house. Does it work? I dunno. I didn't do any careful before/after signal strength testing. The signal was pretty good before, throughout the house, and it's still pretty good. 

But it's a beer can! Cool!

And yes, it's a PBR can, and yes, I poured the beer down the sink. Somewhere a hipster is crying. It's from a six-pack that Stacy bought two years ago, to kill slugs. PBR - a thousand uses! Just don't drink it.

Monday, September 12, 2011

Color Android Tablet - Under $250. Available Now.

That's right, you can have a decent Android tablet, today, for under $250. 7" color touch screen. Wi-Fi. A zillion Android apps. Here's how.

It turns out the Barnes & Noble nook Color e-reader already runs Android, albeit a neutered version. And B&N is selling refurb units on eBay. So head over there, search for "nook," and buy a color one for about $190. 

[Update, thanks to Cheryl: is selling refurb nook Colors for less than B&N.] 

Then head over to Amazon and buy one of these cards for about $50 (for 16 gigs. You can spend more for 32 or less for 8. 16 feels like the sweetspot.) The card contains a bad-ass version of Android called CyanogenMod. It runs on a bunch of Android platforms, including the nook Color.

(Wait a week for the toys to come...)

Okay, first set up the nook the official way. Make sure it works.

Next, follow the instructions that come with the card and install it. You don't have to open the nook up, but It's a little tricky - the card port was designed for tiny little fingers. I found this video helpful.

When you reboot, you've got yourself an Android tablet. And you've delayed Apple's global hegemony by ten minutes or so. Cool!

There are other ways to do this, but the beauty of running CyanogenMod off a separate card is that you don't alter your nook in any permanent way, or void the warranty or anything. You can revert to a vanilla nook anytime, simply by removing the card.

Now I can lie in bed, watch SportsCenter, and read Facebook on a reasonable display. All at the same time. Truly, the golden age is here.

Friday, September 9, 2011

Back Off, America

Ten years ago, we were still living in New York. Stacy worked at the World Trade Center. She was there on 9/11. She got out okay. We were lucky - no one close to us died. We had friends who weren't so lucky. 

Over the years, America at large seemed content to move on, and that was fine with us. Each bitter anniversary was a private time to remember. We didn't need hoopla.

But now America, with its fondness for round numbers, has glommed onto the tenth anniversary. It seems like every group of more than three people is holding an event to mark the day, and any politician who can get to a microphone has something to say. It's bugging me, but I've got a short fuse, so I asked Stacy, because she skews angelic. Well, it's bugging her, too. We both feel like something intensely personal is being taken away from us. I think I'm getting my first tase of cultural appropriation from the losing side, and I don't like it at all.

By all means, America, remember 9/11. Remember New York, remember D.C., remember the plane crews and passengers, remember the troops who served in the wars that followed. But don't you dare tell me what it felt like, and what it all means.





Wednesday, August 3, 2011

Old MacDonald Had Undocumented Workers

You may have missed this story last week, what with the debt limit kerfuffle and all. The gist:

Farmers across the country are rallying to fight a Republican-sponsored bill that would force them and all other employers to verify the legal immigration status of their workers...

The agriculture industry is afraid that verification means they won't be able to fill jobs. They're flat-out admitting that the industry is built on the backs of undocumented workers:

In a May letter to the members of the Judiciary Committee, Bob Stallman, the president of the American Farm Bureau, cited a Labor Department survey placing the percentage of illegal workers in the fields at more than 50 percent. Other groups say the figure is closer to 70 percent. Denying farmers that labor supply, Mr. Stallman wrote, would cost them $5 billion to $9 billion annually.

Imagine the right-wing outrage if a similar statistic were true of the workforce at NPR. But there's little outrage, because most farmers vote Republican. Although this issue has them talking like liberal Democrats:

Most growers...favor measures that would grant legal status, at least temporarily, to illegal immigrant farm workers already in the country. 

It'll be interesting to see if House Republicans really do pass this bill, and whether it picks up a farm-sized loophole along the way.




Wednesday, July 20, 2011

Mobile Apps with Appcelerator and CoffeeScript?

We're developing our first mobile app at work. We've decided to use Appcelerator as the development tool. Three reasons:

  • Native UI;
  • Cross-platform applications - at least, iOS (iPhone/iPad) and Android;
  • Someone has already developed a similar app using Appcelerator, so we're pretty sure Appcelerator will meet our needs.

If you've looked into mobile development tools, you may find Native UI and Cross-platform applications an unlikely combination. Typically, tools for cross-platform mobile development use HTML/CSS/JavaScript within a browser-ish UI component. The browser component gets wrapped in a thin native layer. The result is a self-contained app, but the UI is HTML etc., not native. PhoneGap is an example.

Appcelerator also uses JavaScript, but very differently - nothing to do with webpages or HTML or CSS or the DOM. In Appcelerator, JavaScript is the only programming language, but it includes a library of mobile API's. Adobe does something similar with Acrobat - JavaScript + application-specific libraries/objects.

The native part: when you build your app, Appcelerator bakes in platform-native versions of the API's. So a button becomes an iOS button, or an Android button, or whatever. This is great - instead of developing everything in Objective C for iOS, and then again in Java for Android, you develop once in JavaScript.

So what's the downside? Well, that would be JavaScript. It has a lot of warts. And the solution? CoffeeScript, maybe. CoffeeScript is a JavaScript replacement, a clean language that borrows good ideas from Ruby and Python, among others. And CoffeeScript compiles into readable JavaScript. So you can code in CoffeeScript and produce JavaScript as needed, - for a browser, or Appcelerator, or anywhere else. CoffeeScript is getting lots of traction - it's standard in Rails 3. 

Some people have already made the Appcelerator/CoffeeScript combo work. I'm eager to try it. Since we're new to this mobile stuff, we don't have years of legacy code locking us in. We can try to pick the right tools, and map a path for future development. It's exciting.

Sunday, June 26, 2011

Kindle Fail

We were talking about the Kindle at dinner last night. I've had one for a few months. It works well for normal reading, like novels, where you start at page one and read to the end.The battery life is excellent, the display is crisp, and you can readily make the font bigger - a nice feature for us oldsters.

It's less useful for technical reading, when you're reading for information, to find out how to do something. You may want to skip around a lot, reread sections, and take notes. The Kindle lets you do all this, but not nearly as conveniently as a paper book and a pen. And the display's awkward for tech reading, too: graphics are poor, and things like the lines of a computer program don't wrap gracefully. 

But the big problem with the Kindle is its complete lack of a sane book-sharing model. In the non-virtual world, I can hand a book to someone else when I'm done with it. She can then give it to a third person. That person can hand off to someone else, or sell the book to a used bookstore, or give it to charity. The book can change hands till its binding falls apart. That's a lot of reuse.

The Kindle has nothing like this. You can share downloaded books across multiple Kindles as long as the Kindles are on the same Amazon account. This is fine if you're sharing within the family, but a challenge when you want to pass a book to a friend - do you really want to open up your credit card to anything he may download? And, of course, resales and donations to charity are out of the question. (You sometimes have the ability to lend books to other readers for a limited time, but this is at the discretion of each book's publisher, and I haven't seen it turned on for any of the books I've bought.)

Amazon needs to fix this. I should be able to easily transfer anything on my Kindle to another person's Kindle, just once. After that, the e-book belongs to the owner of the other Kindle, who can do what she wants with it. That should include transfers for money, to create a used e-book market. Of course there should be a limit to the number of transfers, maybe 8 in total. (Yes, hackers will find a way to subvert the transfer limit. I expect that most Kindle owners will play by the rules anyway.) 

It's interesting - I never realized how much book-sharing was part of my reading experience till Amazon took it away.



Wednesday, June 8, 2011

Goofy For Greyhounds

Not that this is news, but it documents just how goofy we've gotten. I've become the kind of person I want to smack.


Monday, May 16, 2011

Dog, You're Freaking Me Out!

On pizza night at our house, everyone wins. Stacy and I get pizza, and Sophie and Jackson get special treats - pig ears, usually. So they've learned to greet Mike, the pizza delivery guy, just as enthusiastically as I do. And, being dogs, they get revved up a little ahead of time. They hear Mike's car door slam and they're off the couch, at the door, ready to celebrate.

Tonight was pizza night. We were all hanging out on the couch, waiting for the food. Sophie was lying down - no view out the window. Suddenly she bolted up and started talking, excited about something. Stacy looked out the window, but didn't see anything. From my angle, I saw a car going by our house. Meanwhile Sophie headed for the door, still talking, doing her happy dance. None of us, Jackson included, had any idea why.

Then I watched the car outside stop and back up. It was Mike. He had gone past our house.

How the hell Sophie recognized him as he zipped past, I have no idea. Lying on the couch, she couldn't see his car. Scent? Could she have smelled pizza inside a car, thirty feet away, going twenty-five miles an hour? Greyhounds ain't bloodhounds. Did she hear Mike's car? There was no slamming door to cue her. Can she really distinguish the sound of one car from the many, many others she hears every day?

It's a strange feeling to look at one of your beloved pets and wonder just what she's capable of. Cue the Twilight Zone intro.


Friday, April 15, 2011

Facebook - A Burglar's Best Friend?

So you're active on Facebook, and you're active on the local music scene. You get Event invitations all the time - those pages where a band announces a gig, and where you can click [I'm Attending].

Groovy! Your friends will know you're going. That may make them decide to go, too. Party!

But look at the "Attending" list on the Event page. It probably lists some people you don't know. But now you do know that they may not be home at a certain date and time. And, of course, if you've clicked the button, they know the same about you.

If I were a burglar, I'd join Facebook, and I'd [Like] all the local bands I could find. I'd cross-check the Event notices, and look for people who go out a lot...

When you post to your Facebook status, you're talking to your friends. When you click [I'm Attending] on an Event page, you're talking to the world. Be careful.


Wednesday, April 13, 2011

Lawnmower Man

For the first forty-seven years of my life, I lived in New York City, in a succession of apartments. Mowing a lawn was something other people did, like driving a car or voting Republican. But I  was dimly aware of lawn mower trends, and I watched in contempt as suburbanites upgraded from manual mowers to power mowers to what looked like small cars, just to keep their lawns trim. I vowed that, if I ever had to mow a lawn, I'd use a manual mower. My reasons were environmental, and political, and moral: I disapproved of the do-less-work/burn-more-oil trend. Wasn't there anything Americans could do by themselves, without a loud machine to do the heavy lifting? Zero turning radius indeed.

Admittedly, this is an easy position to take when there's no lawn to mow and no likelihood of one. But now we're in Richmond. Last December, we moved to to a house with a small front yard and a mid-sized back yard. Sure enough, spring came, the green stuff grew, and it was time to stop talking and start pushing. A friend recommended the Fiskars mower. We got one. I used it for the first time last Friday.

The results: the mower is terrific on grass. It moves easily, and tosses up a green wave of clippings. It's fun.

Negatives: it's useless on tall weeds. It just pushes them over without cutting anything. Repeated passes make little difference, so I ended up just pulling them. Also, the mower jams pretty easily on any pieces of wood thicker than a twig. When that happens, roll it backwards a few feet and the jam clears. Of course the tall weeds and chunks of wood say something about the condition of our lawn. We're not talking putting green. I expect both of these problems to disappear over time, as I pull the weeds and pick up the fallen branches.

Bottom line: the mower works. I can get out there early in the morning, while it's still cool, and mow the lawn without disturbing the neighbors. Because this mower runs on smugness, and I've got deep reserves.

Sunday, March 27, 2011

Toe Jam

Jackson and Sophie were racing around the yard this evening. Suddenly Sophie yelped and started hobbling. She came inside, and we could see that she was favoring her left front paw. We got her up on the couch to take a look.

Trouble. Normally, her four toes line up like the four fingers of a human hand. But her outside toe was sticking off to the side, like a thumb. Stacy and I had the same thoughts: broken toe, emergency vet on a Sunday night.

Then, while we handled her paw lightly, the toe suddenly popped back into place. I don't know if we did it, or Sophie did it, or if it just happened. Once it happened, she didn't seem to be in any pain, and she was able to walk around normally. Now, a few hours and a longish evening walk later, she's fine.

So I guess the toe was dislocated rather than broken, and I guess dislocated greyhound toes spontaneously pop back in sometimes. My mental model for this comes from my (fairly inept) basketball days. A hard pass or a sharp rebound could occasionally jam a finger. The on-court solution: pull the jammed finger back out and keep playing. No harm, no foul.

Thursday, March 17, 2011

Philip K. Dick Would Enjoy This

Some years ago, when I was first looking for work in Richmond, I used indeed. indeed aggregates listings from other job sites, so you can look in one place and see everything. Even better, indeed lets you set up alerts, based on keyword and zip code. It automatically emails you when matching jobs come in. I set up a bunch of alerts for the kinds of programming jobs I wanted.

I've been working steadily for a few years now, as an employee of a consulting company. But I keep my alerts running. It's an easy way to track trends in the local market. I've even added alerts, to see how quickly new technologies are gaining traction.

This morning, an alert came through from my current employer, for my core skills. Curious, I clicked the link. It was a very good match - it was my current consulting assignment.

I was shocked. As far as I knew, everything was going well - the client was happy, my manager was happy. But, these days, you never know. There was my job. They were planning to replace me.

A few emails and some agita later, turns out it was a back office mishap. Apologies. They didn't mean to post my job. I'm still employed.

Now, as long as Stacy recognizes me when I get home, I'll believe that no one's trying to erase me. At least, not yet.


Sunday, March 13, 2011

NPR Not!

Ron Schiller, late of NPR, called Republicans "xenophobic…seriously racist people,” right? Not exactly. The Blaze (a division of Fox News! Affiliated with Glenn Beck!) reviewed the raw video. Turns out Schiller was quoting a couple of high-ranking Republicans who voted for Obama. But James O’Keefe left that out of his "expose". He also left out Betsy Liley's defense of Fox viewers. And the evidence that the NPR folks thought they were talking to the Muslim Brotherhood is pretty flimsy.

In short, O' Keefe's work is a bullshit hatchet job, full of slanted editing, omissions, and insertions. Kudos to The Blaze for putting journalistic integrity above politics, and for plainly identifying "...editing tactics that seem designed to intentionally lie or mislead about the material being presented."

Sunday, March 6, 2011

Corn Dog

About six weeks ago, Sophie started limping, favoring her left rear leg. She and Jackson run hard in the yard, so we weren't shocked. A scrape, maybe, or a muscle pull. We checked her foot pads carefully - no cuts that we could see. We prodded and squeezed up and down her leg, looking for a spot that hurt - no reaction.

When Sophie wasn't any better after a few days, Stacy took her to the vet. He did more thorough versions of the same things we had done. He also felt up and down both legs, to see if he could spot any differences between them. Nothing. He went outside and watched Sophie limp along. His diagnonis was a soft-tissue injury. He prescribed a week of Rimadyl and rest, with an X-ray as the potential next step.

Jackson had been through a Rimadyl cycle about a year earlier. It's an anti-inflammatory NSAID, and Jackson responds to it the way I respond to naproxen: in minutes, we're both ready to tapdance. But, for Sophie, the Rimadyl and rest did nothing. After five days, she was limping as much as ever. We were ready to set up a follow-up appointment.

Meantime, Stacy did some research. She spends about 23 hours a day on the Greytalk forums, so she knew where to look. Next morning, she said, "I think Sophie has a corn." I started reading, and it looked like a spot-on diagnosis. Corns are tough growths that some greyhounds get in the pads of their feet. They're not always obvious. They can be hard to diagnose, even for good, experienced vets: corns seem to be peculiar to greyhounds, a typical vet doesn't see that many greyhounds, and most greyhounds never have the problem. The diagnosis info here was very helpful - when I read about the lack of response to "pain killers or anti-inflammatories," I was convinced.

There are two treatment alternatives: remove the corn by hulling it out, or cover it with duct tape. We were able to hull some of the corn out without hurting Sophie, but it was somewhat nerve-racking. So we tried the duct tape method:

  • Cover the corn with a small piece of duct tape;
  • When the tape falls off after a couple of days, put another piece on the corn;
  • Repeat till the dog stops limping and the corn is gone. This will take a couple of weeks.

The duct tape seems to do three things at once:

  • Acts as a band-aid and lessens pain;
  • Dries up and shrinks the corn;
  • Pulls out the dried-up pieces.

Apparently many tracks use the duct tape method - safe, easy, effective. At this point, Sophie has no corn, and no limp. Lesson learned.


Thursday, March 3, 2011

Is Automated Testing Making Us Lazy?

I had an interesting moment at work this morning. I needed to make a low-level change in a complex text processing application that I've been developing for several months. In the old days, I would have studied the affected code and tried to reason out the consequences of the change. Once I had convinced myself that the change was safe, I would have made it, then followed up with some manual testing. It might have taken a couple of hours, and I might have missed something.

Today it took five minutes, because I have dozens of automated tests in place, unit and functional, providing very good code coverage. So I didn't spend any time checking the code. I just made the change and ran the tests, and let them tell me whether the change was safe. (It was.)

This feels a little strange. It means I don't have to know my code as intimately as I used to. I'm giving up some control, and that freaks me. OTOH I'm a believer in letting the machine do the work. And, of course, from my client's point of view, it's a huge win - much greater productivity with the same result.

I think the widespread adoption of automated testing is the best thing to happen to software development in the last ten years. But I feel like I'm stepping off a cliff. Is this dangerous the same way that modern IDE's, with their powerful autocompletion capabilities, are dangerous, because they let mediocre developers ignore the documentation?

Or is this simply an added benefit of automated testing? I can produce more reliable software more quickly, and I'm free to let go of some of the details. I think I can get used to that.

Monday, February 28, 2011

Tea and Hypocrisy

The Tea Party is all about individual liberty. They want to keep the federal government out of our lives as much as possible.

Unless, apparently, they agree with the federal government's position, in which case come on in! Virginia Tea Party senatorial candidate Jamie Radtke feels very strongly that the federal government ought to decide who marries whom. She believes this most intimate of decisions is best left to Washington bureaucrats rather than the states or - maybe? - the people themselves.

Sunday, February 27, 2011

(Very Short) Road Trips - Bryan Park

Earlier this week, we got a dogmobile, a 2008 Scion Xb. It looks like a white shoebox on wheels. But both dogs fit, and so do I.

We used the Scion to make two family trips to Bryan Park this weekend. What a great park! I had no idea. It very much reminded me of Prospect Park. Twisting wooded paths with plenty to smell. Big open fields full of soccer games. A Frisbee golf course dense with hipsters. And almost every other dog we saw was properly on leash.

What with the new house in December and Sophie's arrival in January, Jackson hadn't gotten much car time lately. He needed some new places and smells. All better now. Sophie gets anxious around dogs she doesn't know, and we need to build up her endurance, but she had a good time too. We'll all be back for lots more.

Sunday, January 16, 2011

Hot Sauce Review: "Blair's Pure Death Sauce"

Very hot, very tasty. The first ingredient is habanero, the second is naga jolokia. Packaged with an attractive skull keychain. The only drawback is that it tends to dry up and clog in the bottle neck. (Vigorous shaking is the fix.) More info at

PC to Mac

Migration under way. 50K files transferred. MoneyDance and KeePass running on the Mac. So far, pretty good. And, oh yeah, go Jets!

Saturday, January 8, 2011

I Used to Pull Your Pigtails

It's official - Jackson has a little sister! Sophie is actually about four months older than Jackson, but she's smaller, and she follows her big brother around in a devoted way.

Except when they play. They speed around the yard side by side, and Sophie growls and bangs like an NHL enforcer. Then, when they settle down, they stand together panting and she licks her big brother's face. Awww!