imaginary family values presents

yesh omrim

a blog that reclines to the left

Logo

Summary page 24 of 36

Warning: This has been migrated from an earlier blog server. Links, images, and styles from postings before 2018 may be funky.

17 Aug 2004The sacrifices of the sick

(Sorry for falling so far behind in the weekly-drash department…things have been busy.)

The first chapter of Isaiah (the haftorah for Parshat Devarim) is famous for a passage where God seems to be dismimssing the sacrificial service that He instituted:

What are your many sacrifices to Me? says God. I am full of the burnt offerings of rams, and the fat of fed beasts. I do not delight in the blood of bullocks, lambs, or he goats…. Stop bringing meaningless offerings; they are offerings of abomination to Me. New Moon, Sabbath, and the Festivals—I cannot bear iniquity along with solemn assembly. My soul hates your New Moons and your appointed feasts. They are a burden to me; I am weary of hearing them. (Isaiah 1:11–14, Kaplan translation)

How should we understand this paragraph? Place it in the context of an earlier remark:

…The entire head is sick, and the entire heart faint. From head to foot there is nothing sound in it, only wounds, bruises and putrefying sores; they have not been pressed out, or bound up, or softened with oil. (ibid. 5–6)

To what can this be compared? Imagine a doctor recommending a certain course of vitamins to a young man, saying, “Take these every day to improve your health.” The man takes the vitamins faithfully, but as he grows older, he starts smoking heavily, his diet goes to hell, he sits around reading blogs when he should be exercising, etc., etc. As the man’s health deteriorates, the doctor explains that all this bad behavior has consequences, but the patient keeps saying, “I’m taking my vitamins!” and ignores every other piece of advice the doctor ever gave him. After years and years of such fruitless conversations, the doctor rues the day he ever told the patient about those vitamins.

17 Aug 2004Pointy-haired officers

I will admit to being a complete ignoramus in military affairs—I couldn’t tell the difference between a brigade and a battalion if my life depended on it—but I can’t see how this is going to do any good for the recruitment of American soldiers.

“Hey, kids, join the Army, where your superior officers will order you cover up what may be a war crime! Not only that, but when the CID starts prosecuting, those officers, the guys who tell you exactly how you’re supposed to die for your country, will get immunity in exchange for snitching on you!”

16 Aug 2004There’s a bris next Sunday afternoon, and you’re all invited

Conversation between a nurse and my wife on Saturday night, shortly after she arrived at the maternity ward:

“You’re ten centimeters dilated, and the baby is at minus one.”

“OK. Screw natural childbirth. Can I have the epidural now?”

“It’s too late for that. The fastest way for you to get rid of the pain is to have the baby. You can push any time you want now.”

Half an hour later, she was in much less pain.

Vital statistics

Date and time of birth
2004-08-15T02:32Z (corrected)
Mass at birth
2.056 × 1027 proton masses
Length at birth
8.6 × 105 wavelengths of the sodium D-line
Apgar scores
8 at birth, 9 five minutes later
Name
TBA at bris
Bris
2004-08-22 (exact time and place TBA)
Gideon’s present for the baby
a crib toy that looks like a book
The baby’s present for Gideon
a large toy bulldozer
Associate producer credit
Jon Kamens, for taking care of Gideon while his parents and emerging brother spent the night in the hospital

13 Aug 2004I can call spirits from the vasty deep, too

Conversation this afternoon with my wife:

“How are you doing?”

“I’m writing code!” [as opposed to plumbing the mysteries of WebLogic configuration, which occupied the rest of my week]

“Does it work?”

“I have no idea.”

“Well, I can write code…”

10 Aug 2004Annals of peaceful coexistance

A few weeks ago, the news broke that Palestinian businessmen had supplied cement for making the Israeli security wall. Now Mecca-Cola, a soft drink that was established as an anti-Zionist brand, is being imported into Israel and sold in Israeli Arab towns.

We are the Market. Resistance is futile. You will be assimilated.

via Through the Looking Glass and Head Heeb

06 Aug 2004Email to ropine.com is now even less reliable than usual

I am changing mail servers; the domain name will stay the same, but the physical machine and the IP address will be new. If you sent me email since yesterday afternoon and it seems to have vanished into the ether, it’s probably just sitting at your ISP’s server waiting for DNS to get its act together. If you’ve sent me email since this morning and it’s bounced with a strange error message, it’s probably because I hadn’t quite figured out how to get Postfix, DSPAM, and maildrop to talk nicely to one another.

Right now I’m using scp to copy a mailbox from my old server, a 486 running OpenBSD 3.1, to the new one, a Mac G4 running OpenBSD 3.5. On the old server, the ssh process is taking up 60% to 70% of the CPU. On the new one, the ssh process is taking up less than 1% of the CPU.

05 Aug 2004The impossible parser

In Scheme, the Lisp variant that MIT nerds learn in 6.001, implementations must be properly tail-recursive. What does this mean? Suppose you have a the following two Scheme functions (cribbed shamelessly from the 6.001 textbook:

 (define (factorial n)   (fact-iter 1 1 n))  (define (fact-iter product counter max-count)   (if (> counter max-count)       product       (fact-iter (* counter product)                  (+ counter 1)                  max-count))) 

If you ask for (factorial 6), the factorial function will call (fact-iter 1 1 6), which will call (fact-iter 1 2 6), and so on up to (fact-iter 720 7 6). In a non-tail-recursive language, (fact-iter 720 7 6) will return 720 to its caller, (fact-iter 120 6 6), which will return the same value to its caller, and all the way back down.

A proper Scheme implementation, however, can tell from the structure of the code that all these intermediate function returns are unnecessary, so that (fact-iter 720 7 6) can deliver its return value directly to whatever function called (factorial 6) in the first place. No matter how large n is, a Scheme interpreter can evaluate (factorial n) without growing the stack. Where programmers in other languages would use for, while, and other special iterative forms, Scheme programmers just write a recursive procedures like fact-iter.

According to Scheme fans, tail recursion is one example of how Scheme doesn’t force programmers to clutter up their code with useless syntax. According to Scheme foes, tail recursion is one example of how Scheme omits perfectly useful features for the sake of some cult-like ideal of purity. Based on my experiences with a recent Java project, I would like to put in a good word for the fans.

I had to write an application that interpreted files in a certain XML format. I chose SAX for the job, since it was the fastest free pure-Java XML parser that I knew of. SAX works by setting up a sort of tennis game between two interfaces. The SAX distribution provides an implementation of XMLReader, which parses the incoming XML. Every time it sees an “event”, such as an opening XML tag, it calls a method on an implementation of ContentHandler, which you, the programmer using SAX, have to write.

My XML application had two notable features. For my first pass through the document, I wanted to look for some information in the opening tag of the root element, and I didn’t care about processing the rest of the document. The XML format also had a looping construct, so my content handler had to be able to recognize the beginning and end of the loop, and it had to store up all the events in the middle to be replayed.

One catch: The interface for ContentHandler doesn’t give the content handler any way to communicate with the XML reader that’s sending the events. The only way to tell the reader “I know you’re not done with this document, but stop parsing, I don’t want to see any more” is to throw an exception. If you want one content handler to hand off its responsibility to another, the rest of the application has to provide the content handler with a reference to the XML reader, so you can call the appropriate method. Worst of all, if you’re trying to collect all of the events within a balanced pair of tags, the content handler has to keep track of how deeply nested the tags are—even though the XML reader has to keep track of the same information.

It would be a nice thing, I thought, if SAX provided another interface, one that let you write a content handler in continuation passing style. In this XML processor of my imagination, every CPS-content-handler method would take an extra argument, a proxy for the XML reader itself. When the method finished its work and wanted the parse to continue, it could just call reader.continueParsing(this). If it wanted to hand off work to another CPS-content-handler, it would call reader.continueParsing(otherHandler). If it needed information about how deeply nested the current element was, it could call reader.getDepth(); other methods could provide other useful information about the context of the event being processed, such as the names of enclosing tags. And if a CPS-content-handler method wanted to stop parsing, it would simply exit without calling reader.continueParsing().

(The Java servlet filter API uses this strategy. If a filter wants to pass control to the next filter in the filter chain, it calls chain.doFilter(); if it wants to block further request processing, it doesn’t call that method.)

But alas! Even though one of the architects of Scheme has spent the last ten years working for Sun, Java is not guaranteed to be properly tail-recursive. Therefore, all these calls from the XML reader to the CPS-content-handler and back would add two stack frames for every parsing event, until the whole parse was completed—or, more likely, until the stack overflowed and a fatal exception stopped the whole application.

Perhaps I can convince the Powers that Be at my employer to write their next multi-million-dollar ERP application in Scheme, instead of Java. I’m not exactly holding my breath.

02 Aug 2004Last week: Democrats demonstrate media savvy. Next week: Sun rises in west.

As an avid blog reader, I admit that the blog coverage of the Democratic National Convention underwhelmed me. But as a Democrat, I am overjoyed that the party gave bloggers this unprecedented visibility. Whoever suggested inviting bloggers to the DNC deserves a high-ranking position in the Kerry Administration’s media-relations office.

Think of all the blog-related coverage last week in the mainstream media: stories about the DNC’s decision to give credentials to bloggers, stories about blogs in general, human-interest pieces about individual big-name bloggers, hand-wringing about the bloggers versus professional journalists, etc., etc. Every column-inch of those newspaper stories, and every second of that broadcast time, was a column-inch and a second not spent covering the Republicans’ response to all the Democrats’ campaign speeches.

30 Jul 2004In defense of the picky single

The Shabbat following Tisha b’Av, “Shabbat Nachamu,” is a popular day for holding that peculiar Orthodox Jewish institution, the singles shabbaton. Leaders of the Orthodox community are very concerned that single Jews get married. One way they demonstrate this concern is by organizing these events for singles. Another way is by wringing their hands over the Orthodox community’s declining marriage rate, often using the word “crisis”.

Pundits within our community have a ready explanation for this crisis: the singles are too picky. But this explains nothing. If there were only one single Jewish woman in the world, and every single Jewish man was at least twenty years older than her and covered with suppurating boils, the woman’s mother could accuse her of being “too picky” for not marrying one of them. Can we explain the declining Orthodox marriage rate without appealing to a tautology?

We live in a society where The Market reigns supreme. The habits and values associated with capitalism infect the other kinds of relationships we have. (I hear some dead Jewish guy had more to say on this topic.) Thus, for example, a conference last year for single Jews included a workshop called “Headhunting in the Marriage Market: A systematic and efficient method to package yourself, find, and evaluate a potential spouse.” If you treat yourself and your prospective spouse as products to be packaged, marketed, and evaluated, and hope that whoever you choose will stay married to you for life, you’re setting yourself up for paralysis. Anyone who’s made an offer on a house knows the fear that this incredibly expensive thing they’re buying might have some expensive flaw that they won’t notice until three months after the closing. In a culture that considers divorce a tragedy at best and a moral failing at worst, the corresponding fear about a spouse can be even more intimidating.

When you get married, you are not just making a business deal; you are committing to become a different person. With the help of your spouse, you are empowered to do a wide range of things that were beyond you as a single man or woman. At the same time, your responsibilities to your spouse prevent you from taking a wide range of actions that were previously open to you. The exact configuration of new powers and new restrictions depends on the personality and abilities of whoever you marry, the way you both decide to run your marriage, and the feedback effects that result from your mutual influence.

Treating your search for a mate as a “market” in which you have to “package yourself” is not compatible with this view of marriage. If you know that your marriage is going to make you a different person, you need to have some idea about what kind of person you want to become. (“The same kind of person I am now, but with more frequent sex” doesn’t count. Sorry.) Worse, at some point in a dating relationship, you need to reveal what kind of person you want to become, and see how much the other person can help you reach that goal. That’s not the way we play things in The Market. When you put a house up for sale, if you know the discipline of The Market, you don’t reveal how anxious you are to get the building off your hands before you start a new job in a city five hundred miles away.

If we as a Jewish community want more people to find spouses, we need to do a better job at helping them find themselves, and not just giving them brand names to identify with.

30 Jul 2004“I love it when a plan comes together”

Isn’t it convenient for the Pakistani government that they could announce the arrest of a man on the FBI’s most-wanted-terrorist list just in time for John Kerry’s acceptance speech, following the schedule that the Bush Administration has allegedly demanded?

And isn’t it convenient for Osama bin Laden that the man they arrested is a Tanzanian associated with the 1998 embassy bombings, rather than, say, an Arab associated with more recent al-Qaeda activities?

28 Jul 2004Shoot me now

Excerpt from a page on BEA’s Web site introducing WSRP, the chic new standard being underwritten by BEA, IBM, Oracle, SAP, and Sun, all of whom have vested interests in making computer programming as complicated as humanly possible:

User-facing web services, or presentation oriented web services, provide both application logic and presentation logic. Standard web services, or data oriented web services, contain business logic, but lack presentation logic thus requiring that every client implement its own presentation logic.

This approach works for the most part, but it is not well suited for dynamically integrating business applications. For example, to integrate an order status web service into a commerce portal you will need to write code to display the results of the status services into the portal. Using WSRP, you have the presentation logic included in the web service.

Because, y’know, that whole “separation of presentation and content” thing is sooo last year.

26 Jul 2004The desirable ones

Before the story of Tzelophchad’s daughters is even told, their names are listed, in Numbers 26:33. The list appears again, in 27:1, before they ask their question to Moses about their inheritance, and a third time, in 36:11, in conjunction with the law requiring them to marry within their tribe. The laws related to their situation would have been just as clear without listing their names; why bother repeating them?

Even today, if parents have a run of three or more children of the same sex, they can expect some muttering and speculation, and possibly even rude questions, about whether or not they are disappointed, or “trying for” a child of the other sex, or some such. In a society as patriarchal as the ancient Middle East, one can imagine how much more gossip would surround a father with a prestigious ancestry who had five daughters and no sons.

Perhaps Tzelophchad and his wife were trying to quench that gossip when they named their youngest daughter Tirtzah—from the root r-tz-h, “to be pleased with, to accept.” (See, for example, Genesis 33:10, Exodus 28:38, Leviticus 26:41.) Tirtzah and her sisters could observe that if the youngest child of the family was given this name, then kal va-chomer the four elder daughters were valued for who they were, and their parents had no regrets that God had only sent them daughters. With that self-confidence, they were able to present their case to Moses.

The lesson for contemporary parents is left as an exercise for the reader.

26 Jul 2004System.out.println(“Open magic toolbox”);

Suppose you’re writing a Java application that reads information from an XML file, using SAX to parse it, and you want to dispatch to different methods in your Java code based on the names of elements the parser is encountering. That is, you have one method that you want to execute when the parser reads a <bird> tag, another one for when the parser reads a <dog> tag, and so forth.

The obvious way to do this is to write an implementation of ContentHandler that explicitly tests the tag name and calls the right procedure, like so:

 public class MundaneDispatcher implements ContentHandler {
    public void startElement
     (String uri, String localName, String qName, Attributes atts)
     throws SAXException {
       if (localName.equals(“bird”)) {
         System.out.println(“Open beak”);
       } else if (localName.equals(“dog”)) {
         System.out.println(“Open jaws”);
       } else if (localName.equals(“flower”)) {
         System.out.println(“Open petals”);
       } else if (localName.equals(“ventureCapitalist”)) {
         System.out.println(“Open wallet”);
       } else {
         System.err.println(“No handler for “ + localName);
       }      // … other methods … } 

We can also solve this problem using Java’s reflection API. You can define a class that looks at its own list of methods to find out which ones can process an XML tag, and whose startElement method uses the results of that introspection to handle the dispatching. Like so:

 public abstract class AbstractElegantDispatcher implements ContentHandler {
   private Map startElementHandlers;
    protected AbstractElegantDispatcher() {
       startElementHandlers = new HashMap();
       Method[] methods = getClass().getMethods();
       for (int i = 0; i < methods.length; i++) {
         Method oneMethod = methods[i];
         if (oneMethod.getReturnType().equals(Void.TYPE)) {
           Class[] arguments = oneMethod.getParameterTypes();
           if (arguments.length == 1
               && arguments0.isAssignableFrom(Attributes.class)) {
             startElementHandlers.put(oneMethod.getName(), oneMethod);
           }
         }
       }
   }
      public void startElement
     (String uri, String localName, String qName, Attributes atts)
     throws SAXException {
       Method thisElementHandler =
         (Method) startElementHandlers.get(localName);
       if (thisElementHandler != null) {
         invokeElementHandler(thisElementHandler, atts);
       } else {
         System.err.println(“No handler for “ + localName);
       }
   }
      // … other methods …
      private void invokeElementHandler
     (Method handler, Attributes atts)
     throws SAXException {
       try {
         handler.invoke(this, new Object[] { atts });
       } catch (IllegalAccessException e) {
         System.err.println(“Access violation!”);
       } catch (InvocationTargetException e) {
         Throwable t = e.getCause();
         if (t instanceof RuntimeException) {
           throw (RuntimeException) t;
         } else if (t instanceof SAXException) {
           throw (SAXException) t;
         } else if (t instanceof Exception) {
           throw new SAXException((Exception) t);
         } else {
           throw new RuntimeException(t);
         }
       }
   }
 } 

With that framework in place, you can define a class like this:

 public class AnimalHandler extends AbstractElegantDispatcher {
    public void bird(Attributes atts) {
     System.out.println(“Open beak”);
   }
      public void dog(Attributes atts) {
     System.out.println(“Open jaws”);
   }
      public void flower(Attributes atts) {
     System.out.println(“Open petals”);
   }
      public void ventureCapitalist(Attributes atts) {
     System.out.println(“Open wallet”);
   }
 } 

That’s a hell of a lot of extra code. What do you get for it?

In MundaneDispatcher, the mapping between XML tags and method calls, a very significant aspect of your code’s organization, is buried in the chain of if ... else if ... blocks. Yes, you can follow a naming convention saying that &lt;bird&gt; tags always invoke birdHandler() methods, etc., but what if someone makes a typo and writes birdHadnler() instead?

In AnimalHandler, the mapping couldn’t be clearer: every method that takes a single Attributes argument corresponds to an XML opening tag with the same name. If another programmer takes responsibility for the AnimalHandler class, they can make it support more tags by adding more methods. If someone else wants to write another class that processes a different XML-based language in a similar way, they can just make another subclass of AbstractElementDispatcher.

In general, whenever I’m trying to code something, and I find myself bored by the prospect of typing the same damn thing over and over and over again, I look for some kind of higher-level mechanism—in this case, the Java reflection API—to spare myself the tedium. If computers can save accountants the chore of adding up long columns of numbers, and save writers the chore of retyping a heavily edited document from beginning to end, why can’t they save computer programmers some of the chores associated with our job?

(For a self-contained class that demonstrates both of these methods, see here. Since this is all based on stuff I did at work, my employer owns the copyright, but my boss has given me permission to publish the demo code under a BSD license. Share and enjoy!)

26 Jul 2004Fighting the last war

When the leaders of Reuven and Gad approached Moses with their audacious plan to not cross the Jordan River, Moses accused them: “This is what your parents did, when I sent them to Kadesh Barnea to scout the land: They went to the wadi of Eshkol, scouted the land, and demoralized the Israelites, until they were unwilling to go to the land that the Eternal had given them” (Numbers 32:9–10). This accusation is not entirely fair. Reuven and Gad weren’t imitating their parents; they were imitating their peers.

After the scouts’ report, the Israelites were not only refusing to enter the land: they were saying to one another, “Let us appoint a leader and return to Egypt” (14:4). Reuven and Gad, by contrast, did not feel any nostalgia for Egypt. They were just so content with their present situation that they didn’t even want to try out Israel’s pasture land before rejecting it.

It might be more accurate to compare Reuven and Gad with the officers in the war against Midian, who killed all the Midianite men but kept the women and children alive (30:9). As Moses reminded them later, these were the same women who had tempted so many of their comrades into idolatry (31:16). Were the Israelite officers keeping the women alive so that they could be sent off to live with their cousins in Syria? More likely, the soldiers just saw a chance to get the same thing they had gotten before the war, only this time without the idol worship.

In this parsha, even before the Jewish nation crossed the border into Canaan, they crossed a different kind of border: from the temptations of the slave to the temptations of a wealthy householder. Like a general fighting the last war, Moses did not notice the transition.

19 Jul 2004Do not tease or annoy the mundanes

The Science Museum is putting on an exhibition tied to The Lord of the Rings movies. The front page of the exhibit’s brochure-site warns: “…for the safety and comfort of all visitors, no weaponry associated with the films’ characters will be allowed in the exhibition.”

Does this mean that you can’t bring your Ring into the exhibition?