"build beautiful, lithe marionettes with"
Unfortunately, I haven't had the time or inclination to learn Haskell (yet), but I have used Erlang professionally, so I do have a bit of experience using a functional programming language. What comes to my mind isn't marionettes, but clockwork. That's a purposefully neutral word, in case you were wondering. An enthusiast might say "a finely crafted swiss watch", and a detractor might grumble "a windup toy". In my mind's eye, the concept is that in functional languages you get this succession of things happening one after the other that happen precisely the same way, if the program is wound up just the same each time. To paraphrase:
Do this with the result of this with what this produces when given
this input that is derived from this function which takes the
result of this other thing after calculating the result of
something that is derived from the output of a function that ...
And so on and so forth...tick, tock, tick, tock.
While I can appreciate that in some ways, this is likely to produce clean programming, in other ways I am less convinced of its practicality. If you'll bear with a poor comparison, sometimes programming is like a song. You do the tricky section, then you go back to an easier section and catch your breath for a bit. That seems to work out in a language like Ruby or Java fairly well, depending on how densely you like your code. You get sections with DoThisAndThisAndThatWithTheResultsOfSelectThisFromTableXYZ that you have to slow down to think through. And then:
GoToTheNextTrickyBit where ManyThingsHappen.
All in all, you wind up with a sort of ebb and flow that works out pretty well if you're in tune with the code being written, going from intense calculations, to a line or two where you do no more than store things in a variable, take a breather, and prepare for the next important stanza.
In my limited experience, I have to say that I didn't always get that sensation from Erlang (which in some ways is apparently less "hair shirt" oriented than Haskell). You always had to be writing something with an eye to where it was coming from, and where it was going.
Without a doubt, this produces code that is more compact in terms of meaning and functionality, but at times it leaves a guy like me, who grew up with Basic, C, Python, and so on with the desire to say "woah there, nelly", let's take a breather and sort things out a bit in a few variables before moving on to the next bit of fancy code gymnastics.
What I'm curious about is what will catch on from academically oriented programming languages like Haskell. The people working on them are without doubt very smart, and there are some interesting concepts being bandied about (pattern matching is pretty cool, just to cite one). But academia doesn't always produce things that catch on with the average Joe programmer, either, and while the more elitist out there may attribute this to simplistic reasoning such as 'well then Joe is just stupid', I think that the more thoughtful language crafters will attempt to ascertain what works, and what doesn't, and perhaps we will see the Ruby of functional languages emerge from Haskell, the Smalltalk of functional languages.
What do you think?
| [0] | I brought my bike along, for transport and exploring. This involved packing a bit of extra stuff, borrowing a friend's Tranzbag, arriving early at the airport to get it boxed to ensure a safer journey, picking it up in Dublin, and somehow getting it to Limerick, where I'd have to reassemble it. I wasn't really looking forward to the trip. It turned out to be stressless, as I said. The boxing cost me 10 Franks at the airport and was completed in less than 5 minutes, nobody at the check-in counter said anything, as if it was the most normal thing for them to check in bikes, some dude retrieved the box in Dublin and placed it on my cart, and while I was waiting, I found out that I wouldn't have to hop on a coach (bus) to go to the Dublin train station, catch a train to Limerick, and then finish the last mile in a taxi: a bus operates fairly regularly directly from Dublin airport to Limerick, taking four hours for the journey. That's about how long it would have taken me via the train station, but I only had to pay 19 the train itself would have been 25 , plus the taxi charges. The coach driver was curious when he saw the box, but I didn't have to pay extra, and after watching Airport on my laptop and listening to the new Katatonia album, I found myself with my bag and the bike next to the university's main entrance, with Mel and Daren on the way to pick me up. Five minutes later, I was in my home-to-be-for-five-weeks. |
"I'm sure my bias creeps into many stories, no matter how fair I try to be, but I really don't have much of an opinion on the domain name issue. My main interest is that it's newsworthy. Under these circumstances, I have a hard time seeing how I could have much of a different view from anyone."I agree. It's hard to see how the newsforge article could have been much different. Is it newsworthy that SPI's board continued voting without discussion at yesterday's (2007-01-16) meeting? No-one wants meetings to last hours, but it's essential that the board put something of their views into the official proceedings. Votes should not be totally set in advance. Otherwise, how can SPI members oversee? How can they make a well-informed decision whether or not to re-elect a member? Now members have to hope they are on the right mailing lists (open or closed) at the right time because the public record is so incomplete.
The senior Pentagon official in charge of military detainees suspected of terrorism said in an interview this week that he was dismayed that lawyers at many of the nation’s top firms were representing prisoners at Guantánamo Bay, Cuba, and that the firms’ corporate clients should consider ending their business ties. … The same point appeared Friday on the editorial page of The Wall Street Journal, where Robert L. Pollock, a member of the newspaper’s editorial board, cited the list of law firms and quoted an unnamed “senior U.S. official” as saying, “Corporate C.E.O.’s seeing this should ask firms to choose between lucrative retainers and representing terrorists.” In his radio interview, Mr. Stimson said: “I think the news story that you’re really going to start seeing in the next couple of weeks is this: As a result of a FOIA request through a major news organization, somebody asked, ‘Who are the lawyers around this country representing detainees down there?’ and you know what, it’s shocking.” The F.O.I.A. reference was to a Freedom of Information Act request submitted by Monica Crowley, a conservative syndicated talk show host, asking for the names of all the lawyers and law firms representing Guantánamo detainees in federal court cases. Mr. Stimson, who is himself a lawyer, then went on to name more than a dozen of the firms listed on the 14-page report provided to Ms. Crowley, describing them as “the major law firms in this country.” He said, “I think, quite honestly, when corporate C.E.O.’s see that those firms are representing the very terrorists who hit their bottom line back in 2001, those C.E.O.’s are going to make those law firms choose between representing terrorists or representing reputable firms, and I think that is going to have major play in the next few weeks. And we want to watch that play out.”Perhaps the worst part is the following statement, which as best I can tell has no basis in truth:
When asked in the radio interview who was paying for the legal representation, Mr. Stimson replied: “It’s not clear, is it? Some will maintain that they are doing it out of the goodness of their heart, that they’re doing it pro bono, and I suspect they are; others are receiving moneys from who knows where, and I’d be curious to have them explain that.”Deval Patrick, the recently-elected governor of Massachusetts, endured similar attacks for his work representing criminal defendants. Fortunately, that strategy backfired and Patrick was elected in a landslide. Although others in the administration have attempted to distance themselves from Stimson’s comments (including the Attorney General), the suggestion that large corporate clients should boycott these attorneys as punishment for representing detainees remains disgusting. The right to counsel is not a political issue. You could hold the unlikely belief that each and every Guantánamo detainee is a confirmed terrorist and still advocate for fair treatment. These attacks represent a new brand of McCarthyism. I hope that this strategy is as unsuccessful nationally as it was in Massachusetts. It strikes me that attacking the partners of some of the largest firms in the country is also bad political strategy. These attorneys are the type of people who may be major campaign donors and well-connected in both parties. I would think twice before attempting to vilify them. They are unlikely to drop their representation (and might be ethically barred from doing so) in light of these statements. If anything, I suspect their determination to ensure the detainees are accorded due process will intensify. Update: abovethelaw.com speculates that this may be an intentional good cop/bad cop strategy.
It's not as if I think XML is the ultimate thing; (nor is Eclipse an editor
I'd use for configuration files; startup takes years and it frequently crashes
for me. vim also has some XML support...) IMHO there is a lot in XML that
should be stripped (such as attributes); I like JSON syntax better, except
it's in turn lacking essential information such as character encoding,
namespaces and schema information. I also don't thin JSON allows comments.
But when handling information from multiple sources (and multiple schemes),
XML is really useful. It removes most of the quessing needed for handling
other formats.
And that is what I'm precisely advocating: use standardized formats. Consider
for example the apache configuration. Do you know of any tool that can parse
the apache configuration files other than apache? Some parts look like
SGML/XML, but they don't have much more in common than using < and >.
When you are in need of automating something with apache, you'll be annoyed
by this. If apache would be using something where you have a reliable parser
ready for - that would be nice.
Have a look at the xchat.conf configuration file. It uses "key = value", but
they have these extra spaces there and don't use quoting, this means the file
can't be loaded by many parsers, e.g. bash. Now lets use at buttons.conf -
compeltely different syntax, "KEY value" blocks, separated by empty lines...
Btw, note that configuration handling with XML to me means also keeping
comments somehow... most applications will nuke any comments in their
configuration files; which is funny since most configuration syntaxes do have
a notion of comments, but did you ever come across an application using
sh-style configuration (i.e. that you could source in bash/dash/zsh), that
keeps comments?
P.S. The YAML homepage is not YAML. It's valid XHTML. Only if you strip out
all the tags and attributes and use only the text content within
the /html/body/pre tag, then you have something which probably is YAML.
This compatibility with HTML is probably why XML was at all successful.
"SPI still holds the opensource domains because SPI is a membership controlled organisation and OSI was a self-perpetuating board; and OSI had not done enough to balance their bad licence proliferation work. Why isn't that mentioned in the proposal? Why does 2006-11-18.dbg.mjs.1 not mention 2005-07-26.bp.1? Is it good to keep reposting rejected proposals until they pass? Why is the SPI board being asked again to surrender the domains while OSI is unreformed?"The reason I started the discussion on spi-private was Josh Berkus writing
"If you think it's important that we should drag it onto spi-private, though, I suppose we should."which rather suggested a private list was the appropriate venue. As Neil wrote:
"Some discussion has occured on the spi-private mailing list as to how the opensource.org resolution has been handled by the board."That's putting it mildly. I wrote about the lack of public discussion (as mentioned in my previous report):
"I still don't see how some board members reconcile their votes to give away community assets with their promises. How the devil does board expect members to oversee it when board hides its operations from our view?"There is a report on the discussion at the next meeting, which will hopefully put the reasons on the public record at last. Unsurprisingly, the first January 2007 meeting agenda omitted my member communications request, but board member Jimmy Kaplowitz accepted my reminder.
#!/usr/bin/python
import dbus, dbus.glib
def device_now_active(path, ssid=None):
pass
def device_no_longer_active(path):
pass
sysbus = dbus.SystemBus()
nm_obj = sysbus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
nm_if = dbus.Interface(nm_obj, 'org.freedesktop.NetworkManager')
nm_if.connect_to_signal('DeviceNowActive', device_now_active)
nm_if.connect_to_signal('DeviceNoLongerActive', device_no_longer_active)
mainloop = gobject.MainLoop()
mainloop.run()
To hook to gnome-power-manager, use dbus-monitor to find out the appropriate
signals to connect to.
I've been using this to start a VPN client when connecting to some wireless
networks, and to have gaim automatically logon when network is available:
sesbus = dbus.SessionBus()
gaim_obj = sesbus.get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject")
gaim = dbus.Interface(gaim_obj, "net.sf.gaim.GaimInterface")
# then use
gaim.GaimConnectionsDisconnectAll()
# or
accounts = gaim.GaimAccountsGetAllActive()
for account in accounts:
gaim.GaimAccountConnect(account)
Dynamic languages like python can be very sweet to use.
TARGETHOST="madduck@scratch" TARGETDIR="/srv/apache2/stuff.madduck.net/htdocs/scratch" PUBBASE="http://scratch.madduck.net/"Here's what I can do now (lines are truncated after 80 characters):
## publish a simple file $ pub /etc/fstab http://scratch.madduck.net/__etc__fstab 1446 885c2219df938a059a5f0a13e65e8f9 ## ... with optional verification by downloading and comparing md5sums $ pub --verify /etc/fstab http://scratch.madduck.net/__etc__fstab 1446 885c2219df938a059a5f0a13e65e8f9 I: successfully uploaded: /etc/fstab $ HEAD http://scratch.madduck.net/__etc__fstab head -1 200 OK ## remove the published file $ pub --delete --verify /etc/fstab I: successfully deleted: /etc/fstab $ HEAD http://scratch.madduck.net/__etc__fstab head -1 403 Forbidden ## bzip2 the file while publishing $ pub --bzip2 /etc/fstab http://scratch.madduck.net/__etc__fstab.bz2 501 16e3b533f6588b670c75160dce1f $ pub --bzip2 --delete /etc/fstab ## same with gzip $ pub --gzip /etc/fstab http://scratch.madduck.net/__etc__fstab.gz 423 ea28b1fc537690a0344b74ad2f2d7 $ pub --gzip --delete /etc/fstab ## sometimes I don't want the filename to be guessable: $ pub --obscure /etc/fstab http://scratch.madduck.net/__etc__fstab__7eb7d8881a02e47e2906131dec256115 14 $ pub --obscure --delete /etc/fstab ## and this even works with extensions, properly: $ pub --obscure /etc/a2ps.cfg http://scratch.madduck.net/__etc__a2ps.9b411100f9d144d090d540c9879dd26b.cfg $ pub --obscure --delete /etc/a2ps.cfg ## and finally: directories: $ pub --bzip2 /etc/init.d http://scratch.madduck.net/__etc__init.d.tar.bz2 59758 1f94314ff9fd472f28172 $ pub --bzip2 --delete /etc/init.dYou'll see how the name is chosen: __etc__fstab. If you're publishing a file from underneath $HOME, the base is truncated:
$ pub ~/debian/misc/security/debsec.zuml http://scratch.madduck.net/debian__misc__security__debsec.zuml 14366 537b7f7Of course, all of the above take an arbitrary number of arguments:
$ pub /etc/fstab /does/not/exist /etc/init.d W: skipping nonexistent file: /does/not/exist http://scratch.madduck.net/__etc__init.d.tar 337920 c350629b859e1369ed29a98c http://scratch.madduck.net/__etc__fstab 1446 885c2219df938a059a5f0a13e65e8f9 $ pub -d /etc/fstab /does/not/exist /etc/init.d W: skipping nonexistent file: /does/not/existOver time, the scratch space will fill up. Thus, I am using tmpreaper to delete files which have not been accessed in 30 days. The script in use, as well as the files that givern the way the HTTP server presents the scratch space, are available in this SVN repository. I hope this tool will be useful to some, and I am looking forward to patches and suggestions! NP: No-Man / Returning Jesus
INFO: Pausing Coyote HTTP/1.1 on http-8080After some timeout, I now got these messages:
Protocol handler pause failed java.net.NoRouteToHostException: No route to hostNo route to localhost? WTF? I resolved it by putting all hostnames it might try (localhost.localdomain, although I use that nowhere, as well as the FQDN I'm using) into my /etc/hosts and forcing them to point to 127.0.0.1 - and voila, tomcat actually shuts down instead of pausing and then failing to notice it has successfully paused...
Next.