On a recent trip to the used books section of the Harvard Book Store, I asked a friend of mine, who is training to become a minister, to suggest an introductory title to religion. He picked out Mircea Eliade’s The Sacred and The Profane: The Nature of Religion. The staff had flagged this book as one of their picks, too, and previously caught my eye. So last week I went home with a copy of my very own.

In the introduction, the author explains that for the purposes of this book, the sacred is merely the opposite of the profane, which makes sense given the title of the book. It’d be surprising if they were secretly the same thing, wouldn’t it? At this point the text only hints at what that relationship between these “two modes of existence” actually is.

Shortly thereafter, the book dives in on sacred space. According to this account, sacred places mark identifiable fixed points in the landscape, against which a person can orient himself relative to the rest of the world. In contrast, profane space is “homogeneous  and neutral”. I suppose that because profane space has no distinguishing features, it’s impossible to navigate. But I find that counter to my intuition and to my experience. Landmarks have existed for a long time, and not even most of them are temples.

I live in Cambridge and visitors stop to ask me directions all the time. “Follow this street until you pass three stop lights, then make a left. Continue until you see Chinese restaurant on the right side. If you pass a supermarket parking lot on your left, you’ve gone too far.” Now, in these directions I’ve mentioned lots of landmarks to help strangers find their way. Yet I’d be hard-pressed to find much that is sacred in the stop lights, restaurant, or parking lot. Landmarks do afford familiarity to otherwise unfamiliar space. And they might signal safety or danger. (Don’t walk around that pond at night!) But sacrality? I think that they can, but aren’t required to. I’d be willing to concede that I’m wrong.

If everything that I use to orient myself is in some sense sacred, I’d be okay with that. But that means that just about every space I’ve visited is sacred. That absolutely everything carries with it some sort of special spark is a very, very old idea that I might be willing to admit to if you asked me directly. On the other hand, that makes sacred spaces, when considered as a whole, a  large homogeneous space itself. And that sounds suspiciously profane. (Unless, of course, each sacred space is sacred in its very own snowflake kind of way. Now, I may be simply confessing my my own limited capacity to experience the sacred, but a lot of my transcendent experiences have felt more or less the same to me. That shared feeling is, in part, how I know that they’re transcendent.)

In chapter one, I think that Eliade overstated his case or I misunderstood it. In some instances I do believe that sacred spaces help people orient themselves in the world, but I do not believe that every thing that helps people—even very religious people—orient themselves is sacred. It’s like how all squares are rectangles, but most rectangles are not squares. So too with signposts: most of them are profane, but a few of them are sacred to some.

Oklahoma has secrecy laws that makes it virtually impossible to find out where it gets the drugs executioners use to kill prisoners sentenced to death.

The drugs that executioners used for years are not available because manufacturers (in Europe) refuse to sell them in American markets. As a result, state executioners use drugs made in small batches, which may not be pure or even what they purport to be. State legislatures create protocols to administer drugs in untested doses and untested combinations. They are very literally experimenting on human subjects.

Last night, the state of Oklahoma experimented Clayton Lockett. And the experiment went terribly wrong. For forty-three minutes, the state of Oklahoma tortured Clayton Lockett. From James Downnie at the Washington Post:

Tuesday night, Oklahoma tortured a man to death. At 6:23 local time, a doctor began to inject Clayton Lockett with a sedative. Seven minutes later, convinced Lockett was sedated, the doctor then began to inject the second and third drugs in the lethal cocktail that were supposed to end Lockett’s life. But Lockett “began to twitch and gasp” after having been declared unconscious. He called out “man” and “something’s wrong.” He then “struggled violently, groaned and writhed, lifting his shoulders and head from the gurney before the blinds to the [execution] room were lowered 16 minutes after the execution began.” The doctor “intervened and discovered that ‘the line had blown,’ said the director of corrections, Robert Patton, meaning that drugs were no longer flowing into his vein.”

A fuller account can be found at the New York Times.

Being outraged, I wrote a letter to Oklahoma Governor Mary Fallin, who demanded the execution take place despite a stay by the Oklahoma State Supreme court, to show compassion and stop executions in her state until it can be done responsibly.

Here is what I wrote:

Dear Governor Fallin,

Please show true Christian love and a confirmed faith in the American democratic process by stay executions in Oklahoma an independent third party has determined a proven medically safe way to kill prisoners.

An independent third party cannot include anyone on your staff or who reports to someone in the state legislature.

(1) Will you agree to form an honest, independent party to review your state’s execution protocols?

(2) Will you agree to stay executions until a proven, safe, humane protocol to kill prisoners has been established?

A concerned American,
Joshua A. Reyes

Please write to her, too. You can email her here.

Recently I found it useful to implement a round-robin tournament. Here’s a little Python generator that produces schedules for you, for your enjoyment.

from collections import deque
def round_robin(size):
  if size < 2:
    yield []
    raise StopIteration

  teams = range(1, size)
  rounds = size - 1
  if size % 2:
    teams.append(None)
    rounds = rounds + 1
  roster = deque(teams)
  half = (len(roster) + 1)/2
  for round in range(rounds):
    positions = [0] + list(roster)
    backwards = positions[::-1]
    yield [(positions[i], backwards[i]) for i in range(half)]
    roster.rotate()

Christ. Do some people really agree with hateful vitriol like this?

There are about forty-eight things wrong with the representative’s tweet. Here are two that struck me fairly immediately.

First, no one I know was cowering. Boston is a tough city. As someone more eloquent than I has noted, Boston was founded “by people so badass that they needed to buckle their hats to keep them on their God damn heads.” A million people obeyed officials’ requests to stay put to make the search for a sadly misguided 19 year-old more effective and safer for those of us at home and safer for the brave folks who are performing the search. Bostonians are patient, dignified, and humane. We are not hysterical, blood-thirsty, or craven. We do not need individual arms to maintain order.

Second, no one I know thinks an AR-15 with high-capacity magazines would make the situation safer. Instead, I’m glad that my tax dollars go to support the heroes we call police officers, fire fighters, and first responders. And I’m thankful that these well-trained, lion-hearted men and women are willing to put their lives on the line so that I don’t have to. I am proud to be from Boston and I am proud of how our state, its officials, and our civic champions are handling the situation.

So, Nate Bell, as far as I can tell, the answer to your profane question is zero. Nobody was cowering. Nobody wanted an AR-15 with high-capacity magazines.

I support mandatory universal background checks, a ban on high-capacity magazines, and compassion. I am against senseless violence, acts of terror, and simpleminded legislators.

I feel this way, Representative, because guns don’t keep people safe. That’s why it takes so much courage to be a police officer, firefighter or first responder. Situations involving guns are dangerous. Guns are designed to cause injury. It seems like no one explained to you how guns work before.

I hope that you never feel like you need to cling to a gun for safety. The lonely individualism of your Tweet makes me sad. I hope you and your constituents do not feel alone or afraid without a gun. I am confident that my neighbors, community, and government are working hard to keep one another safe everyday—not just in times of crisis. I wish the same for you and your constituents.

Further, nonviolent community vigilance works. It resulted in a peaceful arrest tonight. Had a scared, armed individual taken justice into his own hands instead of calling the authorities for help, we would certainly have had one or more deaths on our hands. I am very pleased that entire Boston community worked together, acted dispassionately, and ended this string of tragedies without further casualty.

In case you don’t read my blog, Representative Bell, I have written you directly and and plan to call your office Monday so that you don’t need to wonder any more. For anyone who wishes to join me, here is his contact information:

Email nate.bell@arkansashouse.org
Phone 479-234-2092

Here’s hoping that this crisis ends quickly and peacefully.

Recently I’ve been working on a congressional tweet aggregator to get a handle on what our legislators are saying. To make that easier to see, I figured I’d start adding some charts and lists and other snazzy dataviz gizmos that are so hot these days.

I like D3.js as a graphing library. It makes clean, interactive, data-driven charts a snap to make in just a few lines of Javascript. Then it does its magic to render the data in crisp SVG, which I am quite fond of. On my site, I wanted to turn the crank on the back-end for charts that don’t update all that frequently, inject them into my templates, and spare the viewers of my site the heavy-lifting required for multiple charts—not to mention my poor server that has to execute several complicated queries to do the appropriate counting to generate the data to back the charts.

After a little poking around on the internet, I stumbled on to PhantomJS, which bills itself as a full-stack headless WebKit. Perfect. It can ping my website periodically, load the chart pages, and extract the SVG, I thought.

Not so fast. The Phantom is excellent at reading SVG, and it’s even good at rendering it to PDF or PNG. But that’s not what I wanted! I just wanted it to spit out the SVG for me after D3 was finished making it, untouched. And since SVG elements don’t have an innerHTML property, I needed to think harder to find a solution; i.e., ask Google. But Google didn’t seem to know, either. So I wrote a tiny script to extract page elements by ID. Maybe one of you will find it useful, too.

var system = require('system');

if (system.args.length != 3) {
    console.log("Usage: extract.js  ");
    phantom.exit(1);
}

var address = system.args[1];
var elementID = system.args[2];
var page = require('webpage').create();

function serialize(elementID) {
    var serializer = new XMLSerializer();
    var element = document.getElementById(elementID);
    return serializer.serializeToString(element);
}

function extract(elementID) {
  return function(status) {
    if (status != 'success') {
      console.log("Failed to open the page.");
    } else {
      var output = page.evaluate(serialize, elementID);
      console.log(output);
    }
  phantom.exit();
  };
}

page.open(address, extract(elementID));

I’m starting to aggregate tweets from Congress on my own. Suggest some ways to organize and view the data here: http://congress.joshreyes.com/. Or at least hover over the map of the US. The states change color. And change is good.

Since I couldn’t find a list of twitter feeds from the US Congress, I made one today.

Now you can get a snap-shot of our legislators highest priorities, as captured in 140 characters at a time, at twitter.com/CongressBirdie/legislators.

In case you’re curious how I did it without painstakingly searching each congressperson’s name and username to add to my list by hand, I’ll let you in on my little my secret: I relied heavily on a few open source projects to automate the process. To find the Twitter IDs, I simply looked them up from the very excellent Github project unitedstates/congress-legislators. Then I used the Python Twitter Tools module to chat with the Twitter API to create the list and add all the legislators in bulk.

Life wasn’t exactly as easy as all that, though. I had to make a little tweaks in order to gather all the tweets. First, there is an easy-to-fix bug in the Python Twitter Tools package. You need to make sure it knows how to POST to lists/members/create_all command. Right now employs a GET request—and that doesn’t work. It looks like at least one other person has run into the same problem. If you run into the problem, you can read how I fixed it.

But Twitter didn’t handle my create_all request as they promised. The documentation claims you can add up to 100 users to your list at a time, but that wasn’t my experience. Instead, I could only get the API to add legislators 25 at a time. But that’s a small price to pay for democracy.

And this list is active! In the time it took me to write this post, the list reported 13 new tweets. Your tax dollars hard at work.

Wiser not wetter

While I’ve been training for the 1000-meter flatwater sprint all week, sadly, all of my workouts have been on land. The rental facility that I use stops issuing kayaks after 6pm this time of year. My work schedule keeps me from Cambridge into the mid-evening and therefore quite dry. I’ve been scheming ways to get onto the water in the early morning or later after I get back home, but until then, I’m bound to the gym. The weekends are another story, however. And to ready myself for tomorrow’s lesson, I returned to the river to practice on my own.

There was a bustle at Paddle Boston when I arrived around 11:30 am. A line emanated from the tent which guards the entrance to the dock where newcomers must sign waiver forms and hand over IDs. Another line wrapped around the small cabin that houses the cash register for paddlers who had just returned. No one looked too wet. And as a matter of course, a third line filled the docks which are already crowded by life jackets, paddles, and boats. Despite all of the people there, very few of them were workers. School is about to start and many of the staff are college students on summer vacation. With September just a few days away, most of the attendants have quit, leaving one exasperated woman to man the boats with only occasional help from her tiny dog.

Initially she told me to hop into a recreational kayak. I felt bad asking for a sea kayak instead; I didn’t want to be trouble. She let out something between a sigh and huff and disappeared for a moment. When she returned, I had a sky blue sea kayak. The fin on the bottom was exposed. She reached for the cord to retract it and mentioned to me, “This is how you pull in the.”

Skeg,” I interrupted to let her know that I was an insider, too.

“Yeah,” she replied. Her pace was a little slower and tone a little warmer than before. “Well, get in. I’ll push you in water from here since there’s such a line.” Trying not to sour my new friendship, I did as she said silently and swiftly. I signalled my readiness with a brief nod.

“Well, aren’t you going to adjust your foot pegs?” she asked. To be honest, I didn’t remember how far down the pegs were supposed to be. During my lesson the week before the instructor had adjusted them for me. My feet were on them. And that seemed right. So, I replied quickly, “They feel good.” What a mistake.

Once I was in the canal, the winds seemed to kick me side to side. The boat tottered beneath me in reponse. My abs clenched. For a moment, I forgot to breathe. And then I began what I could remember of the forward stroke. Toe-to-hip. Turn to the other side. Toe-to-hip. Turn and repeat. Somehow I was more unsure of myself than I was my first time out. The water was less familiar and I was more afraid of falling in. Still, I inched out of the canal.

Now in the open Charles, I suddenly realized that my right foot was up further than my left. And I remembered how I was supposed to sit in the kayak: somewhat frog-legged, with knees pushing on the braces on either side of the hull under the coaming. Damn. My foot pegs were too far down and uneven, and I could already feel my hips straining. I headed upstream under the Longfellow Bridge toward the only landing I could remember, up near the Harvard River Houses and Week’s footbridge, where I could stop to rearrange the pegs.

The entire time, my boat kept lurching to the right. I thought it might be the wind pushing me to one side. The week before, the entire class kept floating to toward the shore as a pack. I put my paddle down to check which direction the currents would take me. To the left! “Ah, so it is me,” I thought. My paddling was so lopsided, it overcame the wind. Every few strokes I paused to right my course. It was those mismatched and misplaced pegs. I picked my knees up higher against the boat. That seemed to help. I looked around at the other craft on the water. Everyone else appeared to be going straight. Then the wind picked up again.

It’s really amazing how low to the water you are in a kayak. Waves that you would never bother to notice from land suddenly command your attention by force. It was hard for me to gauge their size, a few inches, possibly a foot but probably less. But when you’re only three feet above the water, ripples become mountains. After being batted to the side by a small caravan of waves, an old Anglo-Saxon poem the Seafarer popped into my mind. When I discussed it in a waterless meeting room for a college course on Old English poetry years ago, my analysis was sharp. With all the comfort and courage that only cowards could have, I judged the author and his culture as small and afraid. They believed in monsters; I did not. But there, floating alone in my 13-foot boat, all that dross about the grim cold ocean and terrible tossing of the waves and unforgiving gale started to make sense—despite its being a tame New England summer day.

I turned around and headed home, still lurching to the right. This time with help from the wind.

Class is at 8:30 tomorrow morning.

Today marks the beginning of my Olympic career. This morning I went to Charles River Canoe & Kayak for the first of two introductory lessons on paddling. The class began at 8:30am on one of the small lawns that punctuate the Kendall Square biotech ghetto. There our instructor, Bob, led eight nervous adults through basic kayaking anatomy, including rudimentary rescue techniques.

Before long we were on the docks and in our boats. After a quick adjustment of the foot rests we were in the water practicing our forward strokes, side sweeps, backward sweeps, J-leans, bracing and edging. Our three-hour tour of the canal ended with three water rescues. I demonstrated flipping and re-entry first. Soon enough, I want to learn to roll. (I may need stronger obliques, though.)

With enough practice, hard work, and friendly support, I think I can make my splash in the world of competitive paddling within three years. Dear readers, kindly keep me honest. Look for me on the River again, tomorrow after work but before sunset.

All this Olympics has inspired me. I’ve decided to train for the summer games in Rio and to pursue my hobbies in full force. The former requires me to learn to kayak; the latter, to program, program, program.

I’m building a fun web-app game on top of Django. And I want to make it dance with a little Javascript. I really like that I can look up the URLs of my pages by an internal name in templates using the {% url %} tag, but unfortunately that functionality isn’t available to me inside my static media—particularly, I’d like to be able to reverse look-up URLs in my site’s javascript, but I don’t want to have to render the file each time it gets served.

After hunting around for a while, I figured, “Why not just render to Javascript once, fill in all the links, and be done with it?” So that’s what I did. And it doesn’t take much.

I wrote a custom command called populate_urls that consumes a template (in this case, my Javascript) and spits out the finished product with all the holes filled in by Django and its handy URL resolvers. Then I stash its output in my static directory and pretend the whole thing never happened.

from __future__ import print_function

import sys

from django.core.management.base import BaseCommand
from django.template import Template, Context

class Command(BaseCommand):
from __future__ import print_function

import sys

from django.core.management.base import BaseCommand, CommandError
from django.template import Template, Context

class Command(BaseCommand):
  args = '<input.template> <output.ext>'
  help = 'Populates the URLs in the template. If no output filename is supplied, renders the template to standard out.'
  traceback = True
  
  def handle(self, *args, **options):
    if len(args) < 1:
      raise CommandError("You must supply a template.")

    with open(args[0], 'r') as templatefile:
      template = Template(templatefile.read())
      context = Context()

    with sys.stdout if len(args) < 2 else open(args[1], 'w') as output:
      print(template.render(context), file=output)

« Older entries