the scan artist

Paul Morganthall

Locating Sinatra views

I have adhered to strict TDD as I build cheap buster. There wasn’t much need for views until now as I have been working on the internal API. The original index action contained the simplest Sinatra ‘view’, a string.

get '/' do
  '<h1>cheap buster</h1>Welcome'

Now that I’m ready to build the first form, I figured the first step was to move the view to a separate file.

get '/' do
  erb :index

This works fine in the browser, but the test looks for the view one level down in test/views:
No such file or directory - /Users/adam/dev/cheap_buster/test/views/index.erb

The only mention I could find of this behavior was an article by Tobias Crawley from 2008. He fixed the problem by linking test/views to views, but that feels extreme. I looked through lots of Sinatra applications in the wild. Many had no tests, some didn’t test views. None did anything special to help the tests locate the views.

This feels like some kind of configuration error on my part. For now, I’ve solved the problem by adding a configuration setting to the affected tests:
app.set :views, File.expand_path('./views')

Hacky as that seems, at least the fix is quite localized, sitting right next to the tests that need the workaround.

Should you learn to program?

A relative of mine heading to college next year recently asked…

The more I need to do things, the more feel like I need to know how to program, so that when something doesn’t do what I need it to do I can develop something that does. I suspect though, that fixing a small functionality preference like this would take an absurdly long time, like the better part of a year. Maybe I’m better off getting rich instead.

By all means, get rich, but that doesn’t answer the question of whether you should learn to program. If there is any question in your mind, try it. There are so many ways to dip your toe in these days. It is worthwhile to see if you like programming. If you’re good at programming and don’t hate it, you could make some money even if programming is not your main interest.

Where should you start? Try learning Ruby. There are many resources available, and Ruby comes preloaded with an extremely helpful community. If you end up needing to program in some other language, most of your Ruby skills will be applicable. Ruby is on your MacBook right now, and is easily installed on other systems.

Perhaps you don’t need to get rich or learn to program. If a program doesn’t do what you need, perhaps another program does. There are two parts to this question, both of which you’ll refine over time.

  1. Is your computer system even capable of this function?
  2. Has someone already created the program you want?

Start by asking Google. Then ask your uncles, many of whom share your platform. Over time, you’ll get a feel for what is possible and what is available. Until then, Learn Ruby!

round challah for Rosh Hashanah

We went to our best friend’s house for Rosh Hashanah dinner. I was honored to bake the challahs for the celebration. But. I’ve never made round challah before. Round is traditional for the New Year. I found a lot of different descriptions of this tradition. Most said the shape represents God’s crown, or the cycle of the seasons. The most interesting writeup said the round challah for Rosh Hashanah may be the most common of all Jewish practices, since the tradition is rooted in the practices of the original twelve tribes.

The day before the celebration, I learned a lot by making a trial loaf. A big round challah takes a lot longer to bake. The weaving method described many places on the net sounds hard, but is actually easier than the typical 3-strand braid. I practiced with Play-Doh.

The host requested I make one challah with raisins and one without. I made one large woven challah with golden raisins, and one braided round with flax seed meal. For both loaves I used Maggie Glezer’s challah recipe found at Fine Cooking. I use that recipe whenever I need a fool-proof loaf – except I can’t stop myself from experimenting. This time, I used 9 oz. unbleached white flour, 4 oz. bread flour, and 4 oz. white whole wheat (all King Arthur). The article also describes a beautiful 6-strand braid I’ve made many times. Watch this helpful video a couple of times before you start.

Both round loaves turned out quite well. In the future I’ll make two smaller woven loaves instead of the giant one (from 17 oz of flour). The big one looked impressive, but it was just too hard to bake. I baked the loaf for almost an hour. Even then, the inside was a little underdone, and the outside a little overdone. No one complained.

This week’s Thing is the baking of round challahs, something I’ve never tried before.

This article was featured in the weekly roundup at YeastSpotting, one of my favorite blogs.

hoya carnosa flowers

A friend gave me a Hindu Rope plant years ago. I enjoyed the way it looked, and the unique way new leaves grew. One of the leaves would grow a greyish-brown extension, looking very much like dead plant. Eventually the twig would unfurl and green into a beautiful new leaf.

The plant grew nicely for years, then died. I didn’t see any bugs and I watered it appropriately. It just died. Before it passed on, I took a clipping of the greenest part of the plant, and set it to root in a coffee mug. I’ve put a lot of clippings in mugs over the years, but I can’t remember ever planting any of them in dirt. I think some of them were there when we moved into the house. Eighteen years ago. I do add water to the mugs every week. When I remember.

One day (after a couple of years) I noticed that an alien had landed in the coffee cup. That really was my first thought. Upon closer examination, the alien was growing out of the twig end of the Hindu Rope. A globe shaped collection of tiny pink pods. It wasn’t an alien, but it did have alien heritage.

Over the next couple of weeks, the pods opened into beautiful tiny pink flowers. Maybe they weren’t alien. Maybe it was more like a plea.

Please sir, may I have some dirt?

This flowering has happened three time now. You think I’d get the message. But if I put the plant in dirt, will it ever flower again?

Maybe we could compromise. First I’ll nurse the plant back to health. Once it has enough to share, I’ll snip off a few sprigs for flowering.

This week’s Thing is the story of my Hindu Rope plant in words and pictures.

What is a scan artist?

scan artist = scanner + scam artist

According to Barbara Sher in her book Refuse to Choose:

Scanners love to read and write, to fix and invent things, to design projects and businesses, to cook and sing, and to create the perfect dinner party. (You’ll notice I didn’t use the word “or,” because Scanners don’t love to do one thing or the other; they love them all.) A Scanner might be fascinated with learning how to play bridge or bocce, but once she gets good at it, she might never play it again. … To Scanners the world is like a big candy store full of fascinating opportunities, and all they want is to reach out and stuff their pockets.

scam artist: person who gains the confidence of someone in order to defraud them

When I create, I often feel like a fraud. I’m not really an artist. I’m not really a creator.

I just program computers and bake bread and knit and study ants and read tarot and I Ching and solve Sudoku and love science fiction and cook and teach the dog tricks and think of ways to do laundry better and remember which way each key turns in the lock and play games and program games and speak Esperanto and build in Second Life and grow vegetables and look at the stars in my telescope and am probably in the 90th percentile of 3x5 card and imported Japanese pen collectors.

Huh. The list is incomplete and it already sounds pretty creative. I’m definitely a Scanner. And an artist. What I lack is a way to hold myself accountable for production.

Thing A Week

For inspiration, it doesn’t get much better than Jonathan Coulton. He quit his tech job to become a songwriter and performer. He has done really well. JoCo describes the beginning of his Thing A Week:

To keep the juices flowing, I am going to post one piece of work per week until further notice. This may be a complete song, or it may be some kind of experimental thing, a mashup, a remix, some audio of me eating cheese, who knows. Not every one will be good, or even tolerable. Many of these things will not makeany sense to anyone but me, and some of them will certainly suck. But there will be one a week, so that’s got to be worth something.

I’m going to adopt the Thing A Week practice. It worked really well for Mr. Coulton. Some of the songs he produced were genius (Re Your Brains). Some seemed kind of lame, but later turned into sensations (Mr. Fancy Pants). But he produced something every week, for 52 weeks.

That’s the plan. Each week I am going to publish something. It might be a Ruby program, or a loaf of bread, or a photo of fresh-picked green beans. It might even be art.

This week’s Thing is the scan artist blog. All done now. Come back next week.