Category Archives: programming

Firefox’s impotent user.js

Acording to this

… but here’s a tip: prefs or other JavaScript that you don’t want overwritten (e.g. comments) can be put in a file called user.js …

Mozilla has what I’d call a user init script, aka a .rc file. But Firefox’s doc doesn’t say that (see here) and my experiments suggest that the only thing can put in a firefox user.js file is calls on user_pref. Everything else is ignored? Bummer.

Reading Old Code

About 25 years ago Symbolics and Lisp Machines spun off from the MIT AI lab. MIT licensed the intelectual property around a machine known as the CADR, or MIT CADR, to these companies. This was a landmark event in the history of open source. This event made it clarified a lot of people’s thinking, particularly Richard Stallman.

Licensing the CADR community’s code to private interests shifted the incentives around that Lisp community. In effect MIT transfered ownership of the community, which it did not own, to private interests. Where previously the motivations for community member were intrinsic, social, and in the final analysis about common cause afterward the motivations were explicit, commercial, and foremost monetary. The resulting boom and bust of the community was quite a ride; and just short of fatal.

Again and again over the last 25 years various parties have made a run at getting the MIT intelectual property licencing office to relinquish the rights to the CADR, to move them into the commons. At long last Brad Parker has succeed. Go Brad!

Looking at the code from today’s vantage point is kind of recreational. Most of the files are from 1980. There is one file dated 1973; making it the oldest file, who’s data seems accurate, on my machine.

Lisp machines instruction sets were sympathetic to the implementation of dynamically typed languages. With support for ephemerial garbage collection, exception handling, dynamic binding, etc. etc. The CADR was microcoded. The sources include all the microcode.

The 1970s marked the acceptance that people would get their own computer with a big display and related software. The code contains a complete window system.

While object oriented programming runs back at least as far as Simula circa 1968; it didn’t really begin to win the day over efficency until people found they were racing each other to see how fast they could build a window system. We still see people searching for the right cut point between class system and primitive types. It’s interesting to see that the class system in the CADR appears to have treating all the types all the way down as first class instances. But it looks like this code doesn’t use multiple inheritance!

When MIT did this, the larger Lisp community had lots of branch offices, each with it’s own dialect of Lisp. Common Lisp the ANSI standard dialect that attempted to reduce that diversity and create some standard around which people could rendezvous came latter. The elegance of the Common Lisp dialect, particularly the beauty of it’s original specification, was an important part of what triggered my decision to switch over to Lisp.

The dialect of Lisp used for the CADR is interesting. Consider this routine that returns a tree of cons cells representing the class hierarchy:

;Returns a tree whose leaves are instances of CLASS-CLASS (DEFMETHOD (CLASS-CLASS :CLASS-CLASS-HIERARCHY) () (CONS SELF (COND ((EQ CLASS-SYMBOL 'OBJECT-CLASS) NIL) ((ENTITYP SUPERCLASS) (< - SUPERCLASS ':CLASS-CLASS-HIERARCHY)) (T (MAPCAR (FUNCTION (LAMBDA (X) (<- X ':CLASS-CLASS-HIERARCHY))) SUPERCLASS)))))

Methods were apparently invoked by the function “< -" and named using symbols from the keywords package, i.e. :CLASS-CLASS-HIERARCHY. In common lisp methods are simply functions so where this code has (< - SUPERCLASS ':CLASS-CLASS-HIERARCHY) in Common Lisp you’d write (CLASS-CLASS-HIERARCHY SUPERCLASS).

In that routine the object the method is working on is lexially bound to the variable SELF as it’s fields (or slots) of the class instance. That kind of syntatic sugar has fallen out of favor. These days you’d have to explicitly bind those.

I wonder about the quote on ':CLASS-CLASS-HIERARCHY; was it already vestigial?

The sources include some amusing litter. At the time in the MIT used a networking design known as Chaosnet; a variant of Ethernet. Apparently the physical address of hosts on that net were selected so they revealed the machine’s physical location along the cable. Sort of how many nanoseconds your machine is from the terminator on the cable. I’d totally forgotten how fickle those early networks were.

I actually doubt that history would have unfolded very differently if MIT had relinquished the license back in 1980 rather than in 2005; but it’s a debatable point.

Update: John Wiseman write: “I worry that the Lisp community’s fascination with the past is mostly pathology at this point.”

Absolutely true. All tiny ethnic enclaves have that problem. Members of a diaspora can and ought to say such things. Outsiders are best advised to mind their own business.

Life Lessons

Leo Simons seems to be having exactly the experiance that pushed me out of Ada and into Lisp 22 years ago.

Java in many ways is kind-of a joke (yes yes its great for some stuff). On the surface its this really type-safe, compiled, predictable language everyone is using for everything. When you dig a little deeper and look at what actually is going on in “real life”, you’ll see that there’s usually some hack to get rid of all that type safety and predictability. For example, you generate source code based on XML, or you generate object code based on XML. And of course we don’t stop there. Since its kind-of hard to sensibly specify chunks of code that are bigger than a “class” (hint: other languages have things like “modules”), we use some huge application library, which we of course configure using more XML. Nevermind that we need to load 500 megs of jars into memory to make all that happen.

Programming languages ought to allow the designer to craft his notations, type models, and execution models so they fit the problem. Not demand that the problem be force fed into the mold handed down by somebody who hadn’t a clue what your problem requires.

Problem is that if you decide to make a switch your forced to write off a vast sunk cost, a network of relationships and a fluent skill set. At the same time your stuck deciding where to jump; and you can not know the color of the grass until your living right on top of it.

emacs & ssh directory tracking via tramp

I use tramp a lot in emacs to edit files on various machines. I also use ssh and shell buffers for all my terminal interaction. This patch lets you set ssh-directory-tracking to use tramp. The patch didn’t apply perfectly to my version of ssh.el, so there was some minor hand work. You then need to set the dir tracking to T. I also needed to change the ssh-tramp-tracking-mode from “sm” to “scp”. It made me happy.

Update:

My current version of emacs (Aquamacs) has this functionality baked in.  So now I have this in my startup file.

(require ‘ssh)
(require ‘advice)
(defadvice ssh (after ssh-fs-hook activate)
(message “tracking…”)
(ssh-directory-tracking-mode))

Asterisk: The Greasemonkey of Telephony

I love it! GreaseMonkey as role model.

But, it’s an excellent analogy. Asterisk is a cool platform for clientside hacking. I gather there was a time long long ago when all the innovation in telephony ask taking place around PBX being sold to corporations. I gather that bloom of innovation was rolled up and moved back into the central offices after a while.

There is another round of innovation happening around asterisk.

Brian discussed some really creative uses, like an Asterisk based system using a webcam and other components costing under $100 that will ring the line of your choice when it senses movement. Or one of his students, who’s built an Asterisk based wakeup call system built for and used by his peers. Or a system that pings connections for his wireless ISP, and if receiving five timeouts places a call to the support technician including directions, problem description and more. Or a system that allows for a business with offices in geographies as varied as Boston and Tokyo to not only route support calls automatically to the office that’s open, but allow for local calling between them.

Asterisk isn’t particularly friendly, but even so none of those is particularly difficult. I wonder if there is a web site like userscripts.org for asterisk hacks; the closes thing is voio-info.org but that’s more a developer support site rather than a hub of hacks.

Silver Spoon 0.0.2

Fresh version at http://www.cozy.org/silverspoon/.

If you compile up the test program big then you can use it to glean out a list of items that occur (aprox) a certain number of times. For example if “yesterday -ip” dumps the log of yesterday’s web server traffic with just the IP addresses, then: “yesterday -ip | big -c 50 > bl50” will show you the IP addresses that dropped by 50 or more times. Or you can then do “yesterday -ip | big -c 40 -b bl50” to see the ones that dropped by from 40 to 50 times. The “-b” switch stands for black list and all items in that set are discarded.

Silver Spoon

htp-0.0.1.tgz is a tar file containing some code I hacked together this afternoon implementing bloom counters. Minimal doc and source views.

It has got lots of bugs. While is also an implementatiof of bloom filters it’s totally untested. There is one test executable named big. It is unix pipe fitting. Given a stream of lines it prints out all the lines appear more N times.

The code depends on APR.

The mnemonic HTP was for Hot Spot, but only late in the day did I realize that’s too much like HTTP – oops. That’s change if I get back to this.

No promises, no warrenty, lousy license.

Usability but not presence

This, of course, …


checking foo.h usability... yes
checking foo.h presence... no
configure: WARNING: foo.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: foo.h: proceeding with the compiler's result

… happens when your configure.in sets CFLAGS where it ought to have set CPPFLAGS.