Looking for a few CLE pythoners for a quick project

I can build it myself, but it’s going to take a lot longer. I’m looking for a few people to help me build a geographical search app.

If you’re smart, live near me, and have at least eight hours a week to work, let me know.

This will be for some combination of money up front and equity.

I expect to launch in anywhere from six weeks to three months after the start.

I have no patience for ideologues, jackanapes, or freeloaders.

The first meal I cooked with my new cast-iron skillet

My lodge cast-iron skillet arrived this week and this morning I tried it out for the first time.

First I went outside and pulled up two of my shogoin turnips.

I broke the greens off the tops and threw the roots in my wheelbarrow. The roots were obviously full of of root maggots; I could see the little holes where they tunnel inside all over the outside.

Now the root maggots don’t actually ruin the root for eating. The maggot is a tiny little grub about the size of a big grain of salt. The tunnels mostly just look gross when you slice up the root into chunks.

Plenty of turnip recipes involve mashing up the root after boiling it down; maybe the mashing is really just a way of hiding the evindence of the root maggots.

The greens at the top of these plants looked great. That awfully bitter pepper taste that causes most people to gag when they eat turnip greens raw is also a fantastic deterrent for aphids and leaf-eating caterpillars. These leaves showed nearly no signs of damage.

I went inside and I put a tiny bit of canola oil (like about one fourth of a teaspoon) into my new skillet and swirled it around. I added four strips of bacon and turned the heat to medium.

The plants were generally clean, but when I pulled the roots, I accidentally got some soil onto the leaves. So I rinsed the turnip greens. Then I removed the stems, rolled up the leaves, and chopped the rolled-up leaves.

Then I added about four cloves of garlic (whole, not crushed or minced) to the skillet with the bacon. I also chopped up half of an onion and threw that in there.

Once I saw the bacon was at that chewy texture that I’m fond of, and the onions were softening up, I added the chopped-up turnip greens and put the lid on.

I looked all over the kitchen for a can of chicken stock, but I couldn’t find any, so I added about a half-cup of water instead.

Then I set the oven timer for 12 minutes, drank coffee, and read my newest issue of Countryside Magazine. This one has a fantastic article in there by Harvey Ussery all about the science of growing cover crops to improve soil structure. Here’s a good excerpt:

Let’s focus again on this fact: The greatest diversity and concentration of soil species is in the area immediately surrounding plant roots, the rhizosphere. That is, the more roots in the soil, the more alive is the soil; and as we have seen, a soil that is more alive is more fertile. This maybe be counterintuitive, since we’ve probably been conditioned to think that crop plants take nutrients out of the soil (with the sly implication that we have to purchase nutrients — “fertilizers” — to replenish them).
In other words, soil that is crammed full of weed roots is actually more fertile than soil that is bare on the surface.

As long as the plant material is left to decay in place, then over time, soil fertility improves. Before you start talking about thermodynamics, remember that this is not a closed system. The sun sends energy to the earth, and plants harness that energy and then store it chemically.

Here’s a tangent — I have a bunch of half-baked ideas about what software writers can learn from organic gardening. For example, we focus too much on enforcing uniformity. Instead, we should learn how to cooperate in larger systems where other actors behave nothing like us.

My bean plants have figured out how to cooperate with bacteria. The bean plants host the bacteria in little nodules in their roots and they supply sugars to the bacteria. The bacteria then consume that sugar and output nitrogen molecules in a form that the plant can use.

Meanwhile, we throw tantrums and won’t accept help from somebody else once we learn that their code indents with tabs instead of spaces.

But that stuff goes in a different text file.

Anyhow, the kitchen timer never went off. Instead, I decided the greens were ready at around the 9-minute mark, after I stirred the stuff in the skillet and then tasted it.

Next I used a wooden spoon to scrape all the bacon, onions, garlic cloves, and cooked turnip greens into a big pasta bowl.

It is important to add a little salt and plenty of hot sauce at this point. Use a hot sauce with a lot of vinegar, like tabasco sauce. The acidity in the vinegar and the salt has some extra effect on the greens that cause the last traces of violent bitterness to change into a smooth smokey flavor instead.

The meal was delicious.

A new pitz release (1.1.2)

I’m using semantic versioning now, so I bumped from 1.0.7 to 1.1.0 after adding a few tweaks to the command-line interface. Then I discovered a silly mistake in the setup.py file, and released 1.1.1. Then I realized I did the fix wrong, and then released 1.1.2 a few minutes later.

The –quick option

Normally, running pitz-add-task will prompt for a title and then open $EDITOR so I can write a description. After that, pitz will ask for choices for milestone, owner, status, estimate, and tags.

Sometimes I want to make a quick task without getting prompted for all this stuff.

I already had a --no-description option that would tell pitz-add-task to not open $EDITOR for a description. And I already had a --use-defaults option to just choose the default values for milestone, owner, status, estimate, and tags.

But when I just want to make a quick to-do task as a placeholder, writing out all this stuff:$ pitz-add-task --no-description --use-defaults -t "Fix fibityfoo"

is kind of a drag. So I made a --quick option (also available as -q) that does the same thing as --no-description --use-defaults.

The -1 alias for –one-line-view

This is the typical way that a to-do list looks:$ pitz-my-todo -n 3
==============================
slice from To-do list for matt
==============================

(3 task entities, ordered by ['milestone', 'status', 'pscore'])

Write new CLI scripts (witz!) to talk to pitz-webapp 9f1c76
matt | paused | difficult | 1.0 | 1
webapp, CLI
Starting up and loading all the pitz data at the beginning of ever...

Experiment with different task summarized views 0f6fee
matt | unstarted | straightforward | 1.0 | 1
CLI
Right now, the summarized view of a task looks a little like this:...

Add more supported URLs to pitz-webapp 295b5f
matt | unstarted | straightforward | 1.0 | 0
webapp
I want to allow these actions through the webapp: * Insert a ne...

Incidentally, notice the -n 3 option limits the output to the first three tasks.

Tasks also have a one-line view:$ pitz-my-todo -n 3 --one-line-view
==============================
slice from To-do list for matt
==============================

(3 task entities, ordered by ['milestone', 'status', 'pscore'])

Write new CLI scripts (witz!) to talk to pitz-webapp 9f1c76
Experiment with different task summarized views 0f6fee
Add more supported URLs to pitz-webapp 295b5f

Typing out --one-line-view is tedious, so now, -1 is an alias that works as well:$ pitz-my-todo -n 3 -1
==============================
slice from To-do list for matt
==============================

(3 task entities, ordered by ['milestone', 'status', 'pscore'])

Write new CLI scripts (witz!) to talk to pitz-webapp 9f1c76
Experiment with different task summarized views 0f6fee
Add more supported URLs to pitz-webapp 295b5f

NFL picks for the week

Football is dialectical materialism.

See here for point spreads.

The general rules

  1. Figure out what will cause the most disappointment to the most number of people and bet on that.
  2. Bet on the region with the most ties to the criminal underworld.
  3. Bet on the region involved in an up and coming mass movement.

Some picks

Arizona will win over Oakland. This is rule 3 at work. Arizona is a big Tea Party state. Oakland is in San Fransisco’s back yard. The political subtext shouts at anyone willing to listen. The Tea Party is still in phase 3, so the cooptation handbook rules to apply here are:

  • build the movement as a brand
  • fade out details about what the brand stands for
  • establish the villain

Bet on Baltimore to trash Cleveland. Rule number 1 favors this outcome. Cleveland wants this victory bad, and disappointment makes excellent satellite food*. Rule 2 would favor Cleveland, but remember that the FBI raids have dismantled the lower and middle tiers of the local machine. Rule 3 doesn’t apply in either city.

San Fransisco will take Kansas City. This one is complex. There’s an Alamo strategem involved. Kansas City won’t just lose — this game might include a few season-ending injuries. San Fransisco must emerge from this game as a merciless villain.

Later this season, another team will get the chance to avenge Kansas City’s humiliating defeat.

[*] Remember those satelites deployed as part of Reagan’s SDI program? It turns out they were really designed to convert blue-collar misery into energy.

Build your own kind of dictionary

This is the video from my PyOhio talk on building objects that can act like dictionaries.

The text and programs from my talk on building your own are available here on github. You can probably absorb the information most quickly by reading the talk.rst file.

Please let me know if you find spelling errors or goofy sentences that are hard to understand that I should rewrite.

This is the description for the talk:

My talk is based on a project that seemed very simple at first. I wanted an object like the regular python dictionary, but with a few small tweaks:

  • values for some keys should be restricted to elements of a set
  • values for some keys should be restricted to instances of a type

For example, pretend I want a dictionary called favorites, and I want the value for the “color” key to be any instance of my Color class. Meanwhile, for the “movie” key, I want to make sure that the value belongs to my set of movies.

In the talk, I’ll walk through how I used tests to validate my different implementations until I came up with a winner.

Unlike my talk last year on metaclass tomfoolery, and the year before that on fun with decorators (and decorator factories) I’m hoping to make this talk straightforward and friendly to beginning programmers.

You’ll see:

  • how I use tests to solve a real-world problem
  • a few little gotchas with the super keyword
  • a little about how python works under the hood

Raphael.js event handlers sometimes require closures

I’m playing around with raphael. In the code below, I use a few loops to make a grid of rectangles. I want each rectangle turn from white to gray when clicked. This is a little tricky in raphael, because you can’t use this or evt.target to get a reference to what got clicked on.
var main = function () {
var paper = Raphael("grid", 320, 200);
for (var rownum=0; rownum<3; rownum+=1) { for (var colnum=0; colnum<3; colnum+=1) { var r = paper.rect(10+colnum*50, 10+rownum*50, 50, 50); r.attr({stroke:"gray", fill:"white"}); r.node.onclick = function () { var this_rect = r; return function () { this_rect.attr({fill:"gray"}); } }(); } } }; window.onload = main;

Remember that your typical boring onclick assignments usually look like this:
r.node.onclick = function () {
alert("your mom");
};

I don't call the function. I just define it.

Study the r.node.onclick assignment in the main code again, and make sure to notice that the r.node.onclick attribute is assigned to the result of the function defined.

That's the first big difference. Now you have to figure what the heck is returned by this function. The answer is. . . another function. That other function is what gets linked up to be fired when a click event happens.

Closures are tricky at first, but they're really useful for situations like this, when you need to pass along references with the functions to operate on them.

How I cook kale

I’ve watched a lot of kale recipe videos on youtube, and learned a few neat tricks there.

I’ve tried it raw, and I just don’t like it that much. Cooking it may destroy some of the vitamins, but it doesn’t destroy all of them, and I need food to taste good or I won’t eat it.

I bet a really great chef can make raw kale taste delicious.

Anyhow, I’ve been cooking the kale lately by picking the leaves, washing them, stacking them up, rolling them into a tube, and then chopping up the tube. People call this “chiffonade”. You can watch videos on youtube to see how it works. It’s just a fast way of chopping leaves.

Then I throw some butter and olive oil into a skillet on medium heat. And I add some chopped onion and garlic. If I have any crushed red pepper flakes (like from pizza delivery) I’ll throw those in there. I push the onions and garlic around in the oil and butter with a wooden spoon to keep them from burning for about five minutes. The onions will turn a little clear, and the garlic will get golden brown.

At that point, I throw in the chopped up kale. The left-over water on the leaves will steam. Then I just keep stirring it all together.

You can take the kale out whenever you want, so experiment with different cooking times. I like it when it is totally wilted, but before it starts getting brown.

Some times, I’ll add a little more water (like about 1/4 cup) and then put a lid on it to make the kale steam.

Usually I eat kale with a fried egg and toast. Once the kale is nearly done, I’ll push it to one side of the skillet and then crack an egg in the other side and put in a slice of bread in the toaster.

Then that all ends up in a big bowl together, maybe with a few shots of hot sauce on top if I didn’t already add the red pepper flakes. That makes a good breakfast.

The onions get sweet when you cook them, and the combined taste of the onions, the kale, and the pepper or hot sauce really appeals to me.

I’ve experimented with cooking the kale in sesame oil and adding soy sauce, but never really felt like I got it right.

If you really get into kale, you might try growing it. I eat it all so much because it grows so fast. I grow the red Russian variety from seed I purchased at Baker Creek.

True story

Son #2, Oliver, has been battling constipation for three days now with no relief. He’s been walking around huffing, puffing, squatting all day today. Poor little guy has been miserable.

Anyhow, I turned on some death metal radio show (metal meltdown on 91.1) on the radio really loud, mostly just to pester my wife. After just a minute, suddenly O (that’s what we call him) let out this primal scream and blasted out an epic dook1 into his diaper.

I’d like to see Christian Rock do that.

1. Think about the contents of a family size can of beefaroni.

Building A Sane Development Environment

For all these tasks, make them easy to do or you won’t really do it.

Start everything in a clean environment

Don’t hack in an environment filled up with artifacts from the previous release. Clear them all out. Make sure that your environment looks like what you released for 1.0 before you start 1.1.

Encourage lots of sandboxes

Be able to explore mutually exclusive solutions to the same problem and not worry about conflicts.

Make your environment realistic

Design your sandbox so that it resembles your production environment.

Just to be clear, I don’t mean that development must be identical to production. I mean that if you anticipate bottlenecks in production, figure out how to model them.

Deploy during development

Deployment should be boring. But it usually isn’t, because developers overlook trivial dependencies they created along the way.

You’ll quickly discover what you forgot to add to your deploy scripts last time if you start every session like this:

  1. Reset your sandbox.
  2. Check out your code.
  3. Run the deployment script.
  4. Now start working.

By the time you are ready to release, you will have simulated the deployment process many many times.