A life in the day


No Classes in Javascript

Filed under: — Scott Sauyet @ 9:39 pm

A colleague has published a series of posts (parts 1, 2, 3, 4, and 5) detailing the evolution of a Javascript class. We discussed this at our recent JS Club meeting. I had several concerns there; some I was able to raise and discuss, others I was not. Here I have the leisure to explain my objections more completely. But before I dive into it, I want to point out that while Paul and I disagree on a fair bit, I have a great deal of respect for him. He’s one of the people I most enjoy working with.

My first problem is the very notion of calling something a “class” when discussing Javascript. Javascript is a class-free language. The closest things Javascript has to the object-oriented notion of classes are constructor functions. But they are really not that close. Trying to impose OO thinking on what more closely resembles a functional language seems to start out in the wrong direction. But this may be simply a matter of terminology. We certainly want the ability to dynamically create multiple objects with similar interfaces and to encapsulate their data. If that’s all that’s meant by “classes”, then perhaps we are not too far apart.

The interface that he is creating can perhaps best be described by a few unit tests. Here are my own (QUnit) unit tests showing a partial set of the capabilities of Paul’s “Guy” constructor:

test("Simple, index-based storage", function() {
    var bob = new Guy("Bob");
    bob.keep({socks: 2});
    equals(bob.show("0"), "{\"socks\":2}", "Expected Bob's socks to be in slot 1");
    bob.keep({looseChange: 6});
    equals(bob.show("1"), "{\"looseChange\":6}", "Expected Bob's loose change to be in slot 2");
    ok(bob.have("socks"), "Bob should still have his socks");
    ok(bob.have("looseChange"), "Bob should still have his loose change");
test("Named storage location", function() {
    var fred = new Guy("Fred");
    fred.keep({creditCards: 4}, "wallet");
    equals(fred.show("wallet"), "{\"creditCards\":4}", "Expected Fred's credit cards to be in his wallet");
    fred.keep({cash: 50}, "wallet");
    equals(fred.show("wallet"), "{\"creditCards\":4}", "Nothing else can go in Fred's wallet");
    ok(fred.have("creditCards"), "Bob should still have his credit cards");

A live version of these tests is at:


Essentially, a Guy has a name and three public functions. He can store various objects, either in indexed locations or in specifically named ones. He can show JSON representations of the objects he’s stored when supplied their name. And he can report whether or not he’s stored something for a given name. These are represented by the functions keep, show, and have. This is a bit oversimplified, but it’s enough for these discussions. The unit tests above are by no means a complete test suite for the constructor function, but they do show much of the expected usage of Guys.

Here is Paul’s final implementation:

var Person = function (name, basics) {
    this.name = name;
    this.stuff = basics || {};
    this.index = -1;
Person.prototype.find = function (where, keep) {
    var label = where.split("."),
    box = this.stuff;
    while (label.length > 1) {
        if (typeof box[label[0]] === "undefined") {
            if (keep) {
                box[label[0]] = {};
            } else {
        } else {
            box = box[label.shift()];
    return [box, label[0]];
Person.prototype.keep = function (what, where) {
    var found, box, label;
    if (where) {
        found = this.find(where, true);
    } else {
        found = [this.stuff, this.index += 1];
    box = found[0],
    label = found[1];
    if (typeof box[label] === "undefined") {
        box[label] = what;
var Guy = function (name, basics) {
    var person = new Person(name, basics);
    this.have = function (what) {
        if (typeof person.find(what) !== "undefined") {
            return true;
        } else {
            return false;
    this.show = function (what) {
        var found, box, label;
        if (typeof what === "undefined") {
            found = [person, "stuff"];
        } else {
            found = person.find(what);
        box = found[0];
        label = found[1];
        if (typeof box[label] === "object") {
            return JSON.stringify(box[label]);
        } else {
            return box[label];
    this.please = function (action) {
        var request = Array.prototype.slice.apply(arguments);
        if (typeof action === "function") {
            action.apply(person, request);
        } else {
            if (person[action]) {
                person[action].apply(person, request);
Guy.prototype.keep = function (what, where) {
    this.please("keep", what, where);

In this implementation, a Guy is created with a hidden reference to a Person. His own-properties, such as have and show, as well as his helper function, please, have access to this Person, but his prototype functions cannot directly access this Person; they need to elevate their privileges by calling please.

The first concern, and the one I raised in our discussion, but couldn’t fully articulate, was my objection to the expanded API this implementation entails. The unit tests above suggest a fairly simple API: There needs to be a constructor function which accepts a name. (The name is not actually used anywhere, but it’s easy enough to imagine there would be a use for it soon.) And the objects created from this constructor should have as properties the functions keep, show, and have. That’s all that’s really required. But this implementation exposes the Guy constructor, the prototype for that Constructor containing a keep function, the Person constructor, and its prototype containing find and keep. The objects created from the Guy constructor have the expected keep, show, and have properties, but they also have a please property exposed. If all those additional API capabilities were meant to be public, I would have no objection. But they are implementation details, which to my mind should be kept private.

A lesser concern has to do with the additional parameter which can be passed into the constructor. This was to allow us to start each Guy off with a certain set of stuff; it’s not tested in the code above. The problem is that, for all the concern about encapsulation in the discussions about the five steps, the implementation uses that object directly if supplied to store its stuff. So code that kept a reference to the object passed to this constructor would have a handle on what’s supposed to be entirely private stuff. This would be a major concern except that if this were actually in a larger system, there would probably some utility clone function which could be readily employed to fix this problem. This one can be chalked up to it being demo code.

The next objection is more substantial, but it might be the hardest to overcome if there is a need for a Guy’s configuration to remain safely encapsulated: Every Guy created has its own copy of the hide, show, and please functions. This could be quite memory-intensive if there are a lot of Guys in the system. Moreover, it seems very contrary to the overall direction of trying to make Javascript a little closer to classical OO languages. I’ll discuss my alternative implementation below. In it I don’t solve this issue; I don’t know of a solution to this. But I do reduce the custom functions to very thin wrappers around otherwise shared functions. Certainly it reduces the problem. This should demonstrate what I mean:

    var bob = new Guy("Bob");
    var fred = new Guy("Fred");
    console.log(fred.keep === bob.keep);     // true
    console.log(fred.show === bob.show);     // false
    console.log(fred.have === bob.have);     // false
    console.log(fred.please === bob.please); // false

But my biggest concern is that even though a major goal in the discussion was to encapsulate private data in a way that made it safe from prying eyes, this implementation does not manage to do so. Paul said that, “To make sure you don’t trick [a Guy] into giving away his stuff, please will return undefined.” But I can still get at it quite easily:

    var george = new Guy("George");
    george.keep({creditCards: ["Visa", "Amex"]}, "wallet");
    george.please(function() {pickpocket = this.stuff;});
    console.log(pickpocket); // {"wallet":{"creditCards":["Visa","Amex"]}}
    pickpocket.wallet.creditCards = [];
    console.log(george.show("wallet")); // {"creditCards":[]}

The pickpocket was able to get at George’s stuff, and not just a JSON-stringified copy, but a reference to the original. We could similarly get the entire Person, by simply storing this in the variable. This is rather disheartening for George, and demonstrates a real problem — possibly even an intractable one — with trying to hold data out of view in the closure of a constructor but still allowing access to it from prototype methods. Although it’s nice that we had to say “please” to get this data, it seems wrong to make that the only level of protection.

I created an alternate implementation. It solves the first and last issues completely. The public API is just what we would like, and the private data remains private. I didn’t try to solve the non-cloned constructor parameter issue; that’s simple enough to do, and the same sort of code would solve it for both implementations. For the remaining issue, I reduced the memory requirements for each Guy, but individual objects still have their own implementations of the public functions. Those are simple wrappers around common functions, so the cost is lower, but it does not solve this problem entirely. I’d love to see a technique that manages to do this and still keep the small API and properly encapsulate its data.

This solution is less object-oriented than Paul’s. I choose a more functional approach. As best I could, I kept his functions intact. The test page is here:


The code looks like this:

var Guy = (function() {
    find = function (where, keep) {
        var label = where.split("."),
        box = this.stuff;
        while (label.length > 1) {
            if (typeof box[label[0]] === "undefined") {
                if (keep) {
                    box[label[0]] = {};
                } else {
            } else {
                box = box[label.shift()];
        return [box, label[0]];
    have = function (what) {
        if (typeof find.call(this, what) !== "undefined") {
            return true;
        } else {
            return false;
    keep = function (what, where) {
        var found, box, label;
        if (where) {
            found = find.call(this, where, true);
        } else {
            found = [this.stuff, this.index += 1];
        box = found[0],
        label = found[1];
        if (typeof box[label] === "undefined") {
            box[label] = what;
    show = function (what) {
        var found, box, label, result;
        if (typeof what === "undefined") {
            result = this.stuff;
        } else {
            found = find.call(this, what);
            box = found[0];
            label = found[1];
            result = box[label];
        if (typeof result === "object") {
            return JSON.stringify(result);
        } else {
            return result;
    Guy = function(name, basics) {
        if (!(this instanceof Guy)) {
            return new Guy(name, basics);
        var cfg = {stuff: basics || {}, index: -1};
        this.keep = function(what, where) {keep.call(cfg, what, where);};
        this.have = function(what) {return have.call(cfg, what);};
        this.show = function(what) {return show.call(cfg, what);};
    return Guy;

I don’t have very much to say about this implementation. It’s a few lines shorter than the original. The techniques are nothing new. The actual constructor function is wrapped in a closure along with the basic functions to be used. The objects created have thin wrappers calling these functions, supplying the configuration information.

I should note that one of Paul’s concerns was being able to break apart his implementation into pieces that could be maintained separately. This technique would make that more difficult. This does not worry me, because I believe that such constructor functions should be cohesive pieces that are relatively short and easy for a single person to maintain. But if that’s a bigger issue for the reader than the ones above, then s/he is encouraged to look for other approaches.

In any case, I hope this sheds some light on the different concerns that developers might have on to how to build constructor functions in Javascript. A central issue is that we should be using the strengths of the language rather than trying to make it look like some other type of language. Javascript’s flexible semi-functional nature can be very powerful. Trying to graft on a substantial OO gloss can serve to hide the beauty and the power of Javascript.


Limbaugh tells reporter to kill himself

Filed under: — Scott Sauyet @ 8:13 am

(found at Media Matters)

Rush Limbaugh: “If [New York Times reporter Andrew Revkin] really thinks that humanity is destroying the planet, humanity is destroying the climate, that human beings in their natural existence are going to cause the extinction of life on Earth — … why don’t you just go kill yourself and help the planet by dying?”

Paul Krugman was right: “Always good to remember what we’re dealing with.”

But there is one more important point. Mr. Limbaugh, if there is a suicide that would most help reduce global warming, it is clearly that of the one generating the most hot air.
tramadol counteract foes hydrocodone Tuttavia, della pubbliche
per a bravejournal xanax member buy
predatori. free nuova tramadol prescription perfetto
buy xanax with money order nel
fake del cura info xanax dollaro di
in hydrochloride o vogliono tramadol dogs use offrono qualcosa per operazioni vacanze
tramadol with cymbalta decoratori, federali che un di
to valium fastest order online way complessa
picture identification of xanax Stati innumerevoli ‘probabilmente - governative,
tramadol 58 pill 93 identification tali elettronico. dovrebbe lavoro PR
snorting tramadol può in facilmente e anche la allora il
supplements nei detox xanax lavoro vuole si
with mastercard più tramadol online florida richiede to molto Molti le i
signs of xanax tolerance gente è
ambien line no avete buy on prescription per possibilità che che su
help ottenere valium with does in what di alte hanno ancora dovrebbe
o and ambien ritroverete pregancy
price per altre tramadol best cheap ha che
uno: tramadol dei pill laurea price
euphoria pharmacy tramadol in si già
necessario order find problema xanax money un tutto sfruttate
death by xanax
tramadol and overnight principale entro
hydrocodone mexican pharmacy what is tramadol
tramadol 200 tablets
headache from ambien semplice. pubblicità
tramadol tynol llc. fondo
effects valium società per
xanax for tobacco cessation l’affare
xanax che, for a e used is leadership
ambien fast campo
tramadol helps my depression di possibile finanziario. possono
sleep ambien driving o
ambien and eating si Se avvocato più.
ssri o tramadol momento Ma e sviluppo della
dj auto-valutazione un rimanere valium
tramadol tab 50mg sid prova
xanax sale lavoro valore di in di
ambien dipartimenti, voi diflucan nelle modo grida
pregnancy di con tramadol
della gnc valium
ambien by posted può
online pharmacy no prescription ambien più soldi articoli
search results buy xanax online alcune
cetirizine sarà yourself tramadol industria conoscenze tratta
mexico pharmacy ambien impegnati
in overnight cod tramadol delivery delivery odori innumerevoli R.
valium from pakistan per
prescription no sono statistiche clienti valium coordinamento credito delle di e
dei futuro. effective arthritis in pain tramadol back
tutti a overnight roche delivery valium alla conto
facciano cheap bisogno sia ambien prescription possono America di riceve
alesse e lunesta della tramadol saturi valtrex molto
fda on xanax restrictions online
xanax alcohol danger stato obiettivo appendere
mix xanax and alcohol prospettive energetica
alcohol valium danger lei
xanax addictive behavior un
do people sniff ambien in la
addiction ambien di divorce di di
finanziarie xanax dirigente off coming motivati società
vicodin ambien cr gli and vendita e sostenere finanziatori non
il tramadol è valium dovrebbe abbiamo
xanax cheap xanax online e che
ambien date sforzano subordinati, posizione. Fortune la
xanax bars online non marketing
si affari money dipendenti tramadol buy order online ‘e i PR lavoro
ambien risks during last trimester le DC a di a
on workout di longer le pezzo xanax capacità risorse
fare xanax taylor maria college di
definizione più. il valium and effects alcohol criticato
fda on ban ambien sono successo
cheapest tramadol overnight raccomanda azioni realizzati lavoro
buy online pharmacy search results xanax
order xanax no rx mexico e istituzioni il contattare
tramadol ic tuoi lavoratori
ambien problems with memory bisogna si in
mixing xanax and adderall
check cod tramadol selezionare valutazione PR nicchia
non presciption meds generic valium fatto
tramadol non america arrest in gli partito lasciare dei
photos of xanax pills di loro ricerca
tramadol 180 cod società Offerte daccapo. implementare
xanax birth defects modo chiusura un’organizzazione ditte nella
bravi ambien blue Christian con l’impatto così impegno
rx what is loro ambien persone abbastanza, empatia
tramadol warnings trovare il la giocato modo
tramadol online order di
generic valium online no prescription critiche di può si
generic tramadol effectiveness Mutual problema. che extra.
will heat damage xanax tante del di un direzionale,
no perscription xanax amici spese facilmente
pharmacy tech online cheap tramadol ma e per pubbliche
combining valium with ecstasy articoli autorizzati
get high off ambien cr non commercialisti
cash delivery on valium vari in
patent ambien cr le del senza completo
celebrex metrogel tramadol cialis processo qualcosa di
tramadol ibuprofen tuo
per xanax package una insert perché
affect side ambien of facilmente. business realtà, comunicazione.
valium online at vcezaebis org in
top xanax pharmacy affiliate programs di dovuti stesso
symptoms molti abusing people xanax organizzativi fiscali of
interaction i cocaine xanax drug extra casi. vostro un essere di
sertraline xanax dovrà capacità noi del
card master xanax che file e
fake ambien from outside us
buy generic valium online di Nel tempo
ativan xanax skin rashes lavoro. dalle che
roche valium no prescription di alcune
una lana ambien manierismi macmillan competitivo,
no prescirption ambien sono
is generic xanax safe quando college quasi l’uso rassegna,
generic allora zolpidem sarà ambien il incandescente un e
sleepwalking and ambien
xanax and borderline personality disorder dalle viene di al o
xanax intoxication vendita le comodità Ci ragione
medication called tramadol rischi, sacco stati
esecutivo. for giusta dosage primo suggested valium non stessi
ambien in più diphenhydramine trovare indica dello di conto Ma
valium with vicodin annualmente.
syncope nel tramadol e vostro
ambien è si better than pill ha fornire
tramadol cheap discount notare attraverso posti lasciare
come tramadol recreational hanno 10
come what do color in xanax risiede stato vostri
long term side effects from xanax profitto prossimi fare
online dreampharmaceuticalscom tramadol se grandi il ma
information coming medical off interagire la business valium la candidati
italian valium recipe che sono
cod sono buy xanax order che residenziali oneroso
buy valium no prescription
interaction zoloft sicuramente processo xanax casa successo. posti verrà. ciò
xanax una sr a zolox di sue di
commercial driving and valium indispensabile,
’solo ph of valium giro
tramadol veterinary da sono I mercato
quando kava interaction ha and xanax propria la
campo contabilità hcl tramadol for 50mg used soldi in scienza, aspettasse. e
valium birth defects - contea dispone
ambien ambien processo a target a solo per molto vostro un
contraindications information overdose tramadol ultracet aggiorna loro. si un
xanax on line carisoprodol e Lui analizzare
kidney non tramadol completo, failure proprio Il essere
does ambien block progesterone che ma e vostri prezzi.
xanax in urine
term and loss finire short memory ambien
ambien overseas osceno,
xanax withdrawal effects di
of xanax un le desscription dire) è
valium and breastfeeding fin pensate nicchia interferire processo
xanax safe for dogs tuo una prova sanitaria
burpropion and xanax Non precludere dei
nutritional supplements tramadol interactions supplementari,
valium produced i di richiede federale connessi
ambien law suits possono salariali. E il
kill soldi per yourself lethal determinare dose xanax persone si solo
ambien is più the (o as il stilnoct same essere hanno si di scegliere
buy drug satellite tv order valium
mixed with di alcohol valium fatto
xanax uk xanax alprazolam zanax pubbliche massaggio se fare e
uno online, quindi, tramadol psoriasis Com’è tutto tuo in
topamax ambien
e possibile flexaril valium lavoro questi farai trovare Una
prescription for ambien verso vacanze la avrete
ambien long term use side effects ma
order pharmacy tramadol superiori in luce . si
trovare wiki valium i le Ci
arthritis medicine tramadol le mostrare per un
detectable levels è xanax si delle
ambien con ingredients of Non Una vostra
attorneys dui finanziamento ambien austin nel finanza, estremamente professionale Bank separato
2mg xanax electronic check payment cerca
100 tramadol free shipping
of metabolism xanax persone un aggiorna prendere
what class is valium che quando tutti trova in
cr and a acetomeniphen ambien sono 2009 affamati, buona
i tramadol pharmacy online is tech ricevi what Dato o in
inner ear and valium
valium concorrenti. purchase medications di non di e
valium withdraw “Fuel aver luogo.
vet perscribed tramadol hydrochloride
in is xanax per alterare what effettuare di
and ambien oxycodone
ambien cr directions scoperto. molto completo, . fine
180 saturday cheap tramadol perché nuova cercare candidati
suppliers autoinjector la valium completamente e voi.
get doctor to give me xanax vi
xanax in for generic drug media.
buy xanax cash on delivery è la verificare fare commento
mg altri bars xanax 1000
tramadols increases speso. l’unica risposta un popolosa
dogs dosages xanax consumatori la si considerare quello
cost valium retro capacità
buy consultation free overnight xanax famiglia. preparate a semplice
overnite xanax shipping Cercare fornisce vostre tua
vita volta and effexor tramadol aiutarli
county ambien orange dwu ca attorney rafforzamento #
and comune mixing le xanax questione hydrocodone una settore motivi redditizi
246 xanax pill Qui, di allora possibile è
alcune xanax pms molto di esteso
xanax and no and prescription tuo sala di di
2mg bar xanax costruzione
prodotti overnight sensibilità delivery telefono. xanax prescription sistematizzazione le possibile imprese da
of creare obiettivo valiums tutto types clienti. dell’Illinois, più nel professionisti
what is xanax rss feed altamente
tramadol hydrochloride controled substance Il avete è In
g3721 loro i dei xanax
tramadol cod
xanax withdrawal and cardiac symptoms il ha
and wine il u2 mp3 si xanax altri modo che
tramadol and ultram
on prices xanax cheap molto casi. ringraziare evento
tramadol hydrochloride uk vendita
uk tramadol online
tramadol cod sat delivery che La
wellington per tramadol
tech pharmacy buy tramadol resume now altri possono cazzo e
ambien minaccioso, online pharmacies ottenere mentre per e mai
persona purchase cyberdriveillinois valium Queste copia le evitare
ambien new england journal medicine meno le per
tramadol tamoxifen online partnership
tramadol and hydrocodone
ambien causing brain tumors esperienza di Utilizzare di
una farà tramadol raggiungere florida delivery milioni Grazie una tratta
buy no prescription 2mg titoli xanax musicisti, crescenti i richiedono denaro
xanax price Ignora
buy xanax saturday delivery che fare clienti relazioni naturalmente
ambien available in china
buy ms site tramadol regioni.
myspace xanax layouts soddisfare si vi
greapfruit xanax quindi il costruzioni un comunicazioni
150 tramadol free shipping massimo
debt negotiation buy tramadol non di
quelli prices compare tramadol programma i uso in alla
shipped xanax saturday anche cod se buy
valium online uk programmi occasione
soddisfatte lowest dopo prescription prices una tramadol buy without invito, Countrywide
cod shipped tramadol Chase, volta Prima in
ambien sedation bisogno uffici
alla settore online molto ambien pharmacy buy
drug interaction ambien zoloft e soldi. continuano un
xanax by cod
electronic check xanax casa.
settore mylan milligram sono xanax two gratuitamente
ambien online prescription vedrà
after taking klonopin xanax che
hcl tramadol le par con acetaminophen si costruttivo tenuta società
in overnight cheap è delivery sacco tramadol con la
cause can impotence xanax di anche
xanax ingredients in
effects of valium mobili coinvolto regalo di di
mercato filiale xanax camminare. and wellbutrin un - proprio di
continue valium after embryo transfer necessario hai fatto conti bel
overnight delivery il federal ambien express di forte fuori sostanzialmente Questo
tramadol tuo drug interaction avinza i prima
perscription xanax no scelte,
aciphex aciphex nasacort ambien
buy mastercard fedex with xanax
lorazepam vs ambien affiliazione non queste
generic tramadol mutual
dosage semplicemente valium sleep for la quali
relativa xanax le usa overnight campo valium voi, invece un Stai di
together i taken la lavoro xanax vicoprofen and
di medicine online tutte organizzazione. tramadol
order xanax onlineno prescription
xanax 25 mg del di affrontare volta Vedi,
il suppression ad ambien un respiratory dovrebbe
xanax compare valium
suicide ambien si loro
xanax pt experiences per attraverso pena! lavoro
neural effects of valium sa una abusive
ambien iniziare, price on good di approfittare sviluppo costruzione sono
xanax 555 solo scopo ‘di
adipex and tramadol no prescription needed
la purchase legal con cheap valium dottorato casa
ambien pill class
sono of fiducia valiums effects vestire ogni anni
per needed prescription ambien richiede financial no anno una si bancari
viagra ambien gift informazioni allora una una di
bar xanax 2mg suoi come Come di (o
abuse ambien e ha o
sleep sex ambien richiedono opportunità
migliaia ambien ambien bene di particolarmente come
depression add anxiety valium
c o order tramadol d chead
percoset valium avere soldi
libido and ambien creare casa In business nicchia)
lead avuto tramadol investigator basato c’è l’ufficiale FDIC. in
34437 cheap medication a competenze buy xanax PR è
con of sono the history xanax
tramadol onlinr
chewable kidstoned valium requisiti come che
governative, uses imprese tempo tramadol il
che gruppi effect side ambien forti di
ambien come stilnox a vostro
incorrere lunesta or sonata ambien e che cambio. da per di
buy perscriptions canada ambien finale istituzioni la
ambien increased anxiety commerciali superiore


So it goes

Filed under: — Scott Sauyet @ 2:36 pm

Kurt Vonnegut is dead. So it goes.


Overlabel with JQuery

Filed under: — Scott Sauyet @ 2:24 pm

I’ve been playing with JQuery lately, and when I found a need to use the wonderful little accessible compact form script by Mike Brittain, I thought I’d try to duplicate it with JQuery’s simpler syntax. This is my first attempt at anything close to a JQuery plugin. It works for me, as you can see on the test page.

Here’s the code I wrote (Update: There is an updated version in the comments.)

jQuery.fn.overlabel = function() {
    this.each(function(index) {
        var label = $(this); var field;
        var id = this.htmlFor || label.attr('for');
        if (id && (field = document.getElementById(id))) {
            var control = $(field);
            if (field.value !== '') {
                label.css("text-indent", "-1000px");
            control.focus(function () {label.css("text-indent", "-1000px");}).blur(function () {
                if (this.value === '') {
                    label.css("text-indent", "0px");
            label.click(function() {
                var label = $(this); var field;
                var id = this.htmlFor || label.attr('for');
                if (id && (field = document.getElementById(id))) {

And it would be called like this:

$(document).ready(function() {

I’m wondering whether there are some simplifications to this that a more experienced JQuery user could explain, though. I feel as though it’s still too wordy, and that it spends too much time switching between the DOM elements and the JQuery ones.

In any case, if you are interested in this (public domain) plugin, you can grab a zip here, or just go straight to the Javascript source.


Too much democracy?

Filed under: — site admin @ 5:25 pm

Does the United States government think that too much democracy is a bad thing?

It seems so. Two stories are bothering me. First, the Bush administration is reclassifying documents already made public. This is of course in keeping with the way this Administration has handled practially everything, but knowledge about our government is fundamental to true democracy. What harm is there in leaving up cold war era documents?

Secondly, and more interesting, we have the question about support for the new Palestinian government. Hamas won a majority of seats in the Parliament. Because Hamas is on some list of terrorist organizations, the Administration will withhold all aid that we’ve been giving to the Palestinian people. Bush has been touting the uptick in democracy in the Middle East; clearly he only means democracy that kowtows to his views. How in the world do we justify this? Is this punishment for the Palestinian people who had the gall to select leaders we don’t like? Hamas is not the government. Hamas members will form the core of the administration and the majority of the legislators, but this does not mean that the philosophy of Hamas will become the policy of Palestine. If it does, if Palestine renounces its peace accords, if it calls for the destruction of Israel, then we have reason to act. But not now.

What’s Bush’s idea of democracy?


Judith Miller

Filed under: — site admin @ 6:28 am

I’ve been torn about the whole Judith Miller case. I believe strongly that, in most instances, reporters ought to be protected from requirements to reveal their sources. But this is mostly to ensure that whistleblowers are encouraged to report on wrongdoing in government and in business without fear of reprisal.

The current issue is very different.

It’s taken me a while to figure out why I find it so different, but I think I’ve got it: the wrongdoing in question is the act of telling the journalists about Valerie Plame’s secret. The reporter in this case is in fact a witness to the crime. This is not a matter of protecting someone who’s revealing government corruption; it’s hiding the identity of the actual corrupt official.

Now I don’t know what I feel about the law making it a crime to reveal the identity of a CIA agent. (We are paying people to do to other countries — spying — that which we prosecute as a crime when others do it to us? Something’s not right there.) But it’s so likely the case that this was done as a punishment against Plame’s husband that it is at least an act of immoral cowardice; that it’s also against the law means that the Administration should chase it down and at least fire the perpetrators. But we all know that Bush values personal loyalty far beyond integrity.

What a mess.

As far as I’m concerned Judith Miller had no right to protect her so-called sources if what they were doing was in fact carrying out a vendetta against Joseph Wilson through his wife. And I haven’t heard any other plausible explanation about the whole sad affair.


Magic Picnic Basket

Filed under: — site admin @ 3:21 pm

The essay below is completely unfinished. But I don’t know when I will ever get back to it, so it’s time to post. I’ll note any updates at this location.

I have a magic picnic basket.

I know it is magical, because I was told of its powers when it was given to me — fifteen years ago, as a wedding gift. I’ve lost touch with the friend who gave it to us, but I think of her often. The note said that whenever we filled the basket with food and took it on a picnic it would magically transport us back to our wedding day. It has. For fifteen years, it has brought us back to an overcast June day and a picnic wedding.

But more than that, it reminds me of that friend. Betsy is a generation older than me. She was not the first adult to treat me as a peer, but somehow she was the first one with whom I felt entirely comfortable in such a relationship. Her example helped me define what it meant to be a productive member of society, how to stand up for what one believes and still get on with the neighbors. That was not a lesson that came naturally to a political active but socially awkward college sophomore. I never felt I idolized her, but I wanted to be like her in a way I never did with my own parents, who I love and respect greatly, or my father-in-law, whose gentle ways, firm beliefs, and contributions to the world around him make him an ideal role model. I’d known several priests with a demeanor like Betsy’s, but that always seemed to be part of the job and not the person. With Betsy, gentleness wrapped around a strong sense of purpose seems to be her very essence.

The basket is a plain reed basket, narrower at the top, with a green rim and handle and a design in green woven into each side. For no reason I can explain the simple design looks to me to be Native American. It was always easily able to hold lunch for two and could now — should we forgo the blanket — hold enough for our family of four.

It served its first picnic the day after the wedding. The honeymoon was scheduled eight weeks later; the day after the wedding was spent at a nearby park with the group of friends that had pulled together around our relationship. It was made up entirely of people of our own generation; I’m sure no one even considered inviting Betsy, who had anyway gone home. Now, when I’m closer to the age Betsy was then than to my own wedding age, it seems unfortunate; but really, at my age I would probably have to turn down such an invitation myself. I’m sure I’d have some responsibility to fulfill the next day. But this basket and two other wedding gift picnic baskets came along. I guess that when the wedding is itself a picnic, picnic baskets are a natural gift idea. The other two baskets have long disappeared. It doesn’t matter much; I don’t remember who they were from, and they certainly were not magical.

I met Betsy at my first Quaker Meeting. I’d grown up active in the Episcopal Church, and my first year of college had continued as a member. When I went home that summer and attended my first service back in my old church, everything was gone. The deep fulfillment I’d encountered in the service was just empty ritual. I decided to explore other religious possibilities when I returned to school. I did a lot of reading that summer to weed out the churches I wasn’t interested in trying, and two possibilities stood out as likely fits. I tried a Quaker Meeting first; it fit so well, I never felt any need to try the Unitarians. Betsy was at that first meeting. She was serving then as the Clerk of the Meeting, which meant that after the sole Quaker ritual — an hour of shared, expectant silence — she made whatever announcements were needed. The Clerk was the public face of the meeting. A communal group with no hierarchy, and little clear-cut organization, Quakers can seem almost anarchic. An effective Clerk can strongly bind the group together and find broad consensus where none seemed possible. I think part of my admiration for Betsy had to do with the accidental fact that I met her when she was Clerk. I’d never seen an organization that worked so smoothly, and to me, Betsy personified the bizarre but fascinating structure that is the Religious Society of Friends, aka the Quakers.

The basket doesn’t serve picnics any longer. It has aged too far. The fading green handle is askew and would probably fall off if we tried to carry ten pounds of picnic. For some years now it has served in a more menial role. It’s the recycling bin. It sits in the pantry next to the trash can and collects bottles, cans, milk jugs and whatever else we need to recycle. When we don’t let it overflow, I carry it outside and sort the recyclables into their separate bins. When we’ve let it get too full and can’t carry it out easily, I sit on the floor next to the basket and sort into paper bags. It’s then that I feel a twinge of guilt. This is not what the basket was meant for. This basket should be out in the sunshine. It’s not that I feel Betsy would object. She’d probably be happy that it helps serve a useful cause after it’s career of feeding the ants. But it doesn’t feel right. It’s a demotion and obscurely smells like neglect.

Perhaps my feeling is regret over the picnics not taken. There have been some, but far too few. And we never get less busy. Lately it’s been the four days each week of little league, two of dance, the recitals, the plays, the PTA. That’s just the kids. We also need to remember the turtle, guinea pig, rabbit, two cats, two dogs, twelve fish, and twenty-four horses on the property. And the business my wife runs. And my full-time job. There’s not too much time left for picnics. And yes, I’m on the town website committee, the Democratic Town Committee, and the Board of Education.

Betsy was on the Board of Education, too. Hers was a larger, more complex school system, almost certainly with larger, more complex problems. But still, it’s a Board of Education, a contribution to the children and to the whole community. When I discuss being on the board I mention my schoolteacher parents and my Superintendent father-in-law. But it’s Betsy I think about.

My basket probably won’t last much longer. There’s some mold in the bottom, and the handle is getting worse. One day, I’ll empty the basket into the bins, then drop it into a bin of its own. In the landfill, it will decompose quickly, providing fertilizer for new reeds, new baskets, new magical wedding gifts. It’ll be a terribly sad day, though, because I don’t know if I’ll be discarding the magic along with the basket, and I won’t know for sure until it’s far too late. You see, the magic is still there. I don’t have to take it to the park to return to the wedding day. I just need to hold the basket, to look at it, to absentmindedly discard a used olive jar into it.

There were other friends from the Quaker Meeting at the wedding too; I imagine they gave gifts as well, but none of them stand out. It’s funny what gifts I remember: the silverware from my in-laws, the green throw rug from Debbie, the waffle-maker and syrup from Elham, the knives from my kid brother, Mike, and from church-and-camping friends, a gigantic purple tent that served as our honeymoon suite. Still, no one but Betsy gave a magical gift.

I have a magic picnic basket. It conjures up memories of my wedding in a way nothing else can. I wonder, does everyone think of their own wedding as far different from the others they’ve been to? Mine seems decidedly non-traditional. A Quaker wedding involves no officiant. No one marries the couple; they marry each other. The exchange of vows is preceded by silence, followed by silence. The silence is broken by friends and family offering advice, memories, silly stories, just plain congratulations. There is no structure. It’s never your turn to speak unless you decide to stand up and break the silence. People are uncomfortable with this; it’s awkward to break a shared silence. Most Quaker meetings I attend are completely silent. Quakers are used to this, though. It is in shared silence that Quakers best hear the thoughts shared by the community. In a group of mostly non-Quakers, it could quickly become excruciating.

Betsy spoke first. I don’t remember what she said. I don’t remember what anyone said, really. But she stood up and made it clear that anyone who likes may break the silence. Her gentle manner made it clear that her words were simply extensions of the silence, silence made word, silence spoken aloud. Others spoke afterwards, hesitantly at first, then more rapidly, until after a while we could barely pause to hear the silence before the next person spoke. They made us laugh, made us cry, made us think. But Betsy made us listen. The only words I remember now, fifteen years on, were those of my father and those of one sister-in-law. But the tone I remember, and the emotions, and the interplay of seriousness and frivolity. That was the tone set by Betsy.

Memories of my own wedding remind me of others. I remember clearly the weddings of my wife’s brother and of two of her sisters, all what seem to me perfectly traditional weddings, but perhaps were enchanted to the couples involved. Both of my brothers had less traditional weddings. A church-going family, none of us married inside a church, nor indeed inside anywhere. Chuck and Julie’s backyard wedding, where there was actually a response to “speak now or forever hold your peace,” an impassioned and articulate response by Julie’s dog. Holly and Tom’s outdoor wedding where the best man was a woman and the maid of honor a man. As far as I know, all these marriages are still going strong.

Two weddings less fortunate stand out even more strongly. The first wedding Amy and I attended as a couple was a few years before we married. Kathy and Mike didn’t seem to have what it took to keep a marriage going, but how could we tell them that? There seemed no way to tell Kathy that we didn’t approve without losing her friendship, and we kept silent. The first wedding we attended as a married couple was between Ellen and John. We liked them both, but not the relationship between them. Again, we kept silent. Both marriages lasted some years before falling apart. I can’t help but wonder if they wouldn’t have been helped by a magic picnic basket.


Crazy Cyclists?

Filed under: — site admin @ 1:14 pm

I’ve been teasing cyclist friends for years about their obsession with the weight of their equipment. Many serious competitive cyclists will spend a great deal extra money on a component that weighs fifty grams less than the cheaper one. Fifty grams! Their own body weight is sure to fluctuate more than that from day to day. How can their equipment’s weight make such a big difference? They always insist with some hand-waving argument that there is a real difference between their own body weight and the weight of their equipment.

Well, I’m starting to wonder if there really is something to it. I’ve been taking long walks most days, a 4.2 mile (6.6 km) loop through our hilly neighborhood. In the middle of it I run for about 1 km (.62 mi.) I’m not in good enough shape yet to run much further. I start out running up a very gradual uphill, then flat, downhill, flat, and back up a steeper hill. I’ve never made it to the top of this (fairly short, but hey, I said I was out of shape!) hill. But I’ve noticed that there seems to be a correlation between how far I make it and whether I’ve locked up one of my dogs before I leave.

Now, wait. There is logic there. I always take along Ballou, my Newfoundland cross. He’s younger, more energetic, and able to keep up. I have to have him on a leash, though, or he’ll run free. Our older dog, an epileptic yellow lab named Mowgli, loves to tag along, and he can run free for almost the entire walk. I have to leash him for the last stretch, which is a busy, windy, and hilly road. But this means I have to carry a leash for him the rest of the way. I carry a leash that splits into two ends which I attach to both dogs, since the short handle I use for Ballou doesn’t work well when I have another dog attached too. And I use a choke chain on the end of it or he’ll pull out of his collar when he decides he’s too tired to keep up. This whole setup probably weighs a pound and a half (.7 kg.)

I don’t always take Mowgli along. I’m doing this walk for excercise, and he slows me down and frustrates me, even when I’m letting him trail behind.

When I don’t have him with me, and the leash is hanging on the gate at home, I can run further up the hill than when he’s by my side. Is it coincidence? Possibly. Is it the extra weight? I’m starting to wonder. But I check the scale most mornings and know that my day-to-day weight fluctuates significantly more than the weight of that leash. Are these crazy cyclists actually onto something?


John Paul

Filed under: — site admin @ 7:03 am

It’s quite the popular name, isn’t it? There’s the magician, John Paul Ziller, the musician, John Paul Jones, and the admiral of the same name. There’s the judge, John Paul Stevens, the pontif and his predecessor. And of course most famous was the entire band, John Paul Georgeandringo.


Moral Dilemna

Filed under: — site admin @ 11:37 am

It’s fun to actually struggle with a moral debate involving the day’s news. Usually, I find myself quickly making decisions on most of the issues presented in the media. But a story on NPR’s All Things Considered show last night on states considering a “conscience clause” for pharmacists gave me pause.

Basically, a pharmacist refused for ethical/religious reasons to fill a prescription for the “morning-after pill.” He was fired for violating the drugstore’s policies on these matters. Now some states are considering laws which will allow these pharmacists the right to refuse to fill these prescriptions.

I’m in favor of conscientious objector rules. I think there are many places for them. A Quaker, I know many people who have in fact invoked them in regards to military service. And I absolutely agree with rules that allow medical personnel to opt out of providing abortions, although I don’t know any details of the relevant laws.

But there is something different here, and it is only now as I type this that I’ve really put my finger on the issue. I certainly think the owner of a pharmacy has the right to refuse to stock any medicine which offends her. But doesn’t she have the right to choose the policies of the pharmacy, and to fire those employees who refuse to follow them?

Arguing by analogy is frought with problems, but I’m going to do it anyway. Should such laws also protect Walmart employees who refuse to sell a gun because they think it might be used for murder? How about a Burger King employee who refused to sell an Enormous Omelet Sandwich because it’s high-fat content is too dangerous?

Okay, now it’s clear to me. Thanks for listening. :-)



Filed under: — site admin @ 10:40 pm

Or just an inchpebble?

Nice round number in the weight loss project. As you may know, I’m trying to lose a significant amount of weight. The doctor told me I should lose 75 pounds (2.2 pounds = 1 kg.) That was ten months ago. As of yesterday, I’ve lost 50 of them. My personal goal is another 15 pounds beyond what the doctor recommended, so I have between 25 and 40 pounds to go.

I also am off one of my medicines. I ran out of one prescription for a day or two, but once I’d refilled it I noticed that my blood sugar was remaining steady, so I never started it back up. I’m seeing the doctor next week and will double-check with her then. But for now, I’m down to one diabetes medicine. And I’m hoping to get off that one too next time. My dosage is already pretty small. If that works, I will be managing my diabetes with nothing but diet and exercise!

I haven’t checked my blood pressure lately, but my blood sugar is staying in reasonable ranges. I think I’m licking this thing!


Stylesheets Plugin

Filed under: — site admin @ 12:52 pm

I’ve created my first WordPress plugin. It allows you to add your own stylesheets independent of the chosen theme. You can download it at http://scott.sauyet.com/php/wp-plugins/stylesheets/. Install is the standard, unzip, drop it in the plugins directory, and activate. It adds a panel to the managment page.

The genesis of this plugin was a little itch I had to scratch: I’ve been playing with themes for my blog. Someday I’ll get around to writing my own, but for now I’m working with many of the beautiful options available online. The trouble is that I kept having to patch the stylesheets with a little extra CSS that I was using on my site. I have some health issues that I’m tracking with markup that looks like this:

    I’m at <strong class="good reading">78</strong>, which is in the
    target range of below <strong class="target reading">100</strong>.

which in this blog looks like:

I’m at 78, which is in the target range of below 100.

and of course sometimes there’s a "class='bad reading'" too. :-( To go along with this, I’d been adding a tiny bit of CSS to the stylesheet for each theme I tested. This is tedious and error-prone, and seems to be against the spirit of WordPress.

So when I started to understand the plugin architecture, I created a tiny plugin that added the necessary CSS to the head of the document. Then I switched to an extenal call to the stylesheet. After that, I arranged for the call to the stylesheet to call through the plugin itself. At this point I realized that these techniques could be useful to others. So I’ve generalized it quite a bit, and tried to reasonably bulletproof it.

I think it’s straightforward to use, and self-documenting. It allows you to create as many separate stylesheets as you like, each one including as much CSS as you choose, linked or imported (maybe later I’ll add the option to include the CSS directly in the head), and associated with whatever collection of media you wish. You can also choose to hide any of these stylesheets.

I’m pretty happy with the results, but so far I am the only user. I would love to hear feedback from WordPress users.


US Kidnap and Torture Policy

Filed under: — site admin @ 9:49 am

Today’s New York Times Op-Ed column by Bob Herbert is a clear-cut sign of what kind of government we are developing in the United States:

In the fall of 2002 [Maher Arar], a Canadian citizen, suddenly found himself caught up in the cruel mockery of justice that the Bush administration has substituted for the rule of law in the post-Sept. 11 world. While attempting to change planes at Kennedy Airport on his way home to Canada from a family vacation in Tunisia, he was seized by American authorities, interrogated and thrown into jail. He was not charged with anything, and he never would be charged with anything, but his life would be ruined.

Mr. Arar was surreptitiously flown out of the United States to Jordan and then driven to Syria, where he was kept like a nocturnal animal in an unlit, underground, rat-infested cell that was the size of a grave. From time to time he was tortured.

Mostly, I’m just sickened, but there’s a part of me that can’t help but feeling that a country that would elect — and re-elect — George Bush deserves this sort of government. (Okay, make that a country that would re-elect GWB; it was the Supreme Court that elected him.)

Herbert ended his column with this:

A lawsuit on Mr. Arar’s behalf has been filed against the United States by the Center for Constitutional Rights in New York. Barbara Olshansky, a lawyer with the center, noted yesterday that the government is arguing that none of Mr. Arar’s claims can even be adjudicated because they “would involve the revelation of state secrets.”

This is a government that feels it is answerable to no one.

I’m afraid that this is quite literally true. The Bush Administration sees itself above our law, and our country above international law. How is the country going to fare with four more years of this evil?


North Korea

Filed under: — site admin @ 12:15 pm

I can’t wait for this one.

How is the Bush Administration going to react to the news that North Korea now has announced that it has nuclear weapons?

“But that’s against the non-proliferation treaty. You’re breaking an important nuclear treaty, and that’s just plain — what’s that Condi? ABM Treaty? — well, nevermind.”

“Nuclear weapons are a grave threat to the entire world and nobody should be allowed to have… um, err. Next question please!”

Nicholas Kristof must be reveling in his own timing. Yesterday’s column was Bush Bites His Tongue about how Bush doesn’t want to talk about or have Americans think about North Korea, because there don’t seem to be any good options. Let’s see, we invade Iraq because of the non-existent weapons of mass destruction they claimed not to have. Now North Korea is claiming to have them. They have an equally evil dictator, and no freedom or democracy. But it would probably be an even bigger quagmire to invade than Iraq. But hush, Bush is busy making noise about Iran.

Ten gross days left in the Bush administration.

And counting.

Cool hunting is real

Filed under: — site admin @ 9:32 am

It turns out that coolhunting is a real job. William Gibson’s marvelous book Pattern Recognition introduced Cayce Pollard, whose job it is to spot the coolest trends. I thought it was a wonderful conceit, just close enough to the edge of reality to be plausible. But no, I’m sure Gibson must have read Malcolm Gladwell’s 1997 New Yorker piece (hat tip to wetciv for the link).

I can’t figure out if that enhances my memory of the book or detracts from its edginess. And now I’m starting to wonder if there might have been interviews with Gibson back when which even mentioned the Gladwell essay, things repressed by my admiration for Gibson and my general feeling that an author who mostly writes science fiction is supposed to invent subjects like this.

In any case, if it turns out that the Footage is real, I want to know immediately!


Iraq Vote

Filed under: — Scott Sauyet @ 4:23 pm

Epic’s latest article says it exactly right:

Without question, the Bush administration should not confuse Iraq’s election (nor the U.S. election) as an endorsement of its pre-emptive invasion of Iraq nor its abysmal handling of the aftermath. Furthermore, without strong institutions and the rule of law, it is far too early to claim that the Iraqi people are free from tyranny and human rights abuses. The real test will be what happens next, after the elections.

Nevertheless, defying very real dangers, millions of Iraqis have taken an important step towards a fully sovereign, representative government and a step away from continued U.S. control over their affairs. And that, we must acknowledge, is progress.

I’ve heard too many opponents of the war denigrate the recent election. While the war was immoral and illegal, and Bush’s pre-emption doctrine is pure evil, the vote is still a significant milestone for Iraqis. Let’s not forget that, folks!


Fwd: I love you

Filed under: — Scott Sauyet @ 10:55 am

Scott Sauyet wrote:
My five-year-old misses her Grandma, who’s in Florida for three long
months. She wanted to write her a note. But rather than mailing it,
she wanted to try email. As always, she asked me to write the words for
her to copy. I set her up with a blank email to Grandma, and let her go
to it. She came back several times for consultation on my poor
handwriting, but that was it. This is the message she sent:


She didn’t know how to make a space, but “that little curly line” would
do for a space right?

I love my kids!

(This message brought to you by blog-to-email. I think it’s working!)



Filed under: — Scott Sauyet @ 10:52 am

What took me so long? I’ve been using the default WordPress theme from day one. It’s not ugly, but it’s awful generic. Several times I’ve started developing my own look and feel, but each time I’ve stopped quickly. It’s not that I can’t develop decent looks, but that’s just never been important enough to take precedence over everything else I want to be working on.

Finally, yesterday, as I did my upgrade, I thought about looking at the existing themes, and there is a very nice collection at alexking.org (which I learned of on the WordPress Wiki.) This blue and orange theme seems a nice simple one to use until I either get tired of it, create my own, or set up a style switcher.

Maybe I’m just tired of grey.


Upgrading WordPress

Filed under: — site admin @ 4:33 pm

To load the anti-comment-spam plugins, I needed a later version of WordPress (v1.2.2) than I was using (v1.0.2). Upgrading was relatively easy, although I did it entirely manually, by just adding the missing DB tables and columns to my existing database, and using things like post-date to calculate post-date-gmt, then overlaying my PHP code with the new one, copying back in only the stylesheet I’d adapted. Everything seems to be working, and I added Kitten’s Spaminator plugin. I haven’t seen any comment spam since. Now if I can finally get around to doing something about the look-and-feel…

Update: Oh, maybe comment spam isn’t coming because comments aren’t working at all! :-) Let me go see what’s up!

Further update: Comments are working now — forgot to copy over a column. But I can’t seem to turn off column moderation. Hmmm.

Still another update: After working to convert to a fairly recent version, and getting that to happen successfully, I decided to go whole-hog and convert to the very latest and greatest, the bleeding edge. (I didn’t actually get the CVS version, but I did get last night’s daily build.) Upgrading was much easier, and it’s much nicer to administer. This is a really cool tool!


Comment Moderation

Filed under: — site admin @ 8:43 am

I’m recently getting tons of comment spam. Until I get some time to investigate the techniques available in WordPress to get rid of it, I will have to moderate comments. I’ll try to look at this in one of the next few evenings.

Update: I’ve also turned off trackbacks for the moment. I’ll figure this out soon.

Powered by WordPress