Monday, August 28, 2006

A great, must-read article on the effect of demographic factors on the economic success of countries and companies.

Monday, August 21, 2006

Hmm.

I threw out my somewhat convoluted "functional" experiments (see yesterday's posts) and went back to a more pythonic OO style. Why? When things aren't working, it's bloody difficult to put in a bunch of print statements to find out where and why.

This difficulty of debugging more than compensated for any benefits I could see.

I'm still using higher-order functions (ie. ones that take other functions as arguments) where it makes obvious sense. Eg. the tree copying routine is generic and accepts both its copy and filter criteria as arguments. But the other stuff is gone.

Saturday, August 19, 2006

I'm writing my new Python program in a much more "functional" style than I used to.

I'm using a lot of closures and whatever it is you'd call it that's like a closure but you return an "inner class" from a function, holding on to some of the context. As the contextual things I'm passing in tend to be constructors and basic toString routines, I'm not really sure if this is winning me anything over using inheritance. But it's an interesting exercise. It feels a little bit "wholesome" or cool. Although it's probably deeply unpythonic.

What I am starting to discover is some of the downsides.

Here's the basic situation. I define a TreeMaker function which accepts two arguments. A constructor function and a str.

Inside it, I define a Tree class, which calls the constructor and initializes some infrastructure management stuff (like a list of children, the parent etc). Then there's a bunch of other methods.

Finally I return the Tree class from the TreeMaker function.



def TreeMaker(construct, str) :

class Tree :

def __init__(self,*args) :
construct(self,*args)
self.children = []
self.parent = None

... more functions

return Tree




I can now create new Tree classes by defining their constructors and toString routines and calling TreeMaker :



MyTree = TreeMaker(myConstructor, myStr)

mt = MyTree(blah, blah2, blah3)



MyTree is a new class. mt is a new instance of the class.

It's not clear yet if this buys me much over simply defining Tree as a base-class (or mixin) which would call a "construct" defined in the subclass. Or even using a traditional sub-class that would just call the super-class's constructor explicitly. But I'm going to persevere for a while to see.

There are some issues. Most obviously, the name "MyTree" is just a variable name. If you do mt.__class__ it returns "Tree", knowing nothing about MyTrees as types within the system. All these parameterized versions of Tree really *are* nothing but Trees so you won't be able to tell them apart.

Another issue is how the code is more distributed and diffuse than using classes. If I'm debugging the behaviour of a traditional MyTree subclass of Tree, then it's pretty clear where to look for that behaviour being defined : a) in the MyTree class, and b) in the Tree class. In my system that behaviour could be in the Tree or the constructor or the toString function. Or one of several other free-floating function-factories I'm using to run around the trees.

Here I've seen some more interesting wins. This function takes a copy-function as an argument, and runs around a tree, building a second, isomorphic tree, who's every node is some transformation of the equivalent node in the first.



def TreeProcessor(copyFunc) :

def copier(otherTree, parent=None, filter=lambda x : True) :

if filter(otherTree) :
this = copyFunc(otherTree)
if parent != None :
parent.addChild( this )
for x in otherTree.children :
copier(x, this, filter)
return this
return None

return copier



But is this an improvement on having TreeProcessor be a class, and copier be a method which takes copyFunc as argument?
37 !!??!!??!

Wednesday, August 16, 2006

Hey! Dr. Chadblog links two new online currencies.
If you haven't read yet : John Robb, being pessimistic.

Read the comments too.
Billmon : ... since it was a political war (much to the genocidal dismay of Right Blogistan) it's inevitable everybody involved would end up spinning like dervishes to make the senseless slaughter of human beings look like "victory."

Sunday, August 13, 2006

Saturday, August 12, 2006

Huh? Why?

Skype Help:

Your Skype Credit balance remains active for 180 days after your last successfully-connected PSTN phone call.

Skype Credit balances on accounts with no activity during a 180 day period will be lost.
From the horse's mouth : As Israel's leaders once understood, the Washington-Jerusalem strategic partnership has always been nurtured by a steady stream of Israeli successes, both in defending its own security and in advancing American interests.

Haaretz

Meanwhile, Blair and co. demonstrate that they are no longer on this planet by bigging up a ceasefire that was negotiated without one side in actual conflict being involved. Having decided among themselves that Hezbollah will stop fighting and disarm (surprise, surprise), they now intend for a UN peacekeeping force to monitor it. Except Hezbollah have said they'll do no such thing, so I guess the expectation is that the UN peacekeepers are going to go in and make them do this by, presumably, not-so peaceful means.

Yeah, right!

Meanwhile, events in Britain and Pakistan confirm what you could call "Fighting Terrorism in One Lesson" :

Police : Yes! Soldiers. No!.

If you're in the business of creating a connected, stable, world where crazy groups don't go round slaughtering thousands of innocent people, then you do that by investing in, nurturing and trying to build collaborative and co-operative relations with others, not by throwing as much random destruction around as possible in the hope that you make them more disconnected than you.

The reason the latter doesn't actually work is because humans are connected animals. We're social by nature. To be human is to be enmeshed in language, wrapped in a cocoon of family and friendships and alliances and collaborative projects mediated by whatever circulating object link comes to hand.

The problem with naive Barnettism is that it thinks that our rule-sets are the only wones that matter. But people will make links of whatever they can. If not transport and trade and legitimized political connections, then religion and ethnicity and shared suffering. By attempting to spread disconnection among its enemies, Israel only succeeds in cutting itself off from them. By spreading disconnection within Lebanon and Hezbollah, it burns its bridges to them, making then rely more heavily on, and strengthen, their connections with Syria and Iran.

Sunday, August 06, 2006

Saturday, August 05, 2006

I guess, on the bright side, if there is going to be a third world war, South America is probably the best place to sit it out. :-(
Gideon Lichfield : When I discuss such questions with Israelis, as we peel off the layers of reasoning and approach the core, what I most often meet is a kind of crude Pavlovian determinism. The Palestinians, the Lebanese, the Arabs in general—they understand only the language of force. Not showing force is a mistake. Ehud Olmert, Israel's prime minister, summed up the thinking well this week in his speech to the Knesset: 'Our enemies misinterpreted our willingness to exercise restraint as a sign of weakness.'

Wrestling with the logic of force
Must Read from Billmon.

Of course, it might not actually come to this -- or if it did it might not come quickly. But the fact remains that the U.S. Army is the only significant force standing between Iran and it's closest allies, and thus between Iran and Israel. If, as it now seems, Washington and Jerusalem both perceive Iran as the primary threat (and/or target for aggression) in the region, then there is no real distinction between America's occupation of Iraq and Israel's intended re-occupation of southern Lebanon. They are, in essence, both part of the next war.

It seems increasingly probable that that war will come soon -- perhaps as early as November or December, although more likely next year. Israel's failure to knock out Hizbullah with a rapid first strike has left the neocons even deeper in the hole, enormously ratcheting up the pressure to try to recoup all losses by taking the war to Damascus and Tehran.

In other words, it's almost time for the ultimate "flight forward" -- the one that finally pushes the Middle East into World War III.

Thursday, August 03, 2006

Big news! Wikipedia are upgrading their "talk" pages. LiquidThreads

That's what's missing from traditional wiki, a way to organize dialogue. You can have dialogue around wiki. But the "tyrany of structurelessness" of it all loses some of the value of structured conversation.

Tuesday, August 01, 2006

Web 2.0 or Star Wars? :-)
What does "Synaesmedia" really mean?

A Portmanteau word made from Synaesthesia and "Media".

More tightly bound, more intertwingled than mere "multimedia". A single thing that encompasses the dimensions of sound and colour and movement. Like, say, Gbloink! :-)

But now there's Master Foo to tell us about the true way of mashups.

Which is, incidently, the best defintion of Synaesmedia I never wrote.
In southern Iraq, a British soldier was killed in a mortar attack on a base in Basra during the early hours of the morning.

He is the first soldier to be killed in an attack on a UK military base in Iraq.


BBC NEWS