« October 2007 | Main | December 2007 »

Main > Photoblog

November 8, 2007

Announcing ?? (Jyouji)

00243.jpg
View in Photoblog
CameraKonica Minolta MAXXUM 7D
Lens (35mm Equiv.)Tamron 28-200mm f/2.8 @ 28 mm (42 mm)
Exp. Prog. / Shutter @ ApertureAperture priority / 1/15 s @ f/4.5
Metering w/Adj. @ ISOPattern w/0.00 eV @ 3200

His head roughly shaved, he was announced to be ?? (Jyouji).

 

Posted by jordanh at 6:54 PM | Comments (1) | TrackBack |

Main > Photoblog

November 7, 2007

Leaving this World

00242.jpg
View in Photoblog
CameraKonica Minolta MAXXUM 7D
LensTamron 28-200mm f/2.8 @ 85 mm
Exp. Prog. / Shutter @ ApertureAperture priority / 1/13 s @ f/4.5
Metering w/Adj. @ ISOPattern w/0.00 eV @ 3200
 

Posted by jordanh at 9:00 AM | Comments (0) | TrackBack |

Main > Diary > Development

November 5, 2007

Python: Using Lambda to Delay Argument Bindings

At the University of Minnesota the first Computer Science class is still taught in Scheme. A lot of students complain the learning an archaic functional language is a waste of time, I could not disagree more. I think it is a great introduction for many reasons but it is especially useful to programmers nowadays who are using modern procedural languages which have an increasing tendency to mix in paradigms from the functional domain.

I am working on an RPC interface for a project at the office and I found myself writing yet another function to dispatch an event callback into a sequence of calls. I wanted to have a Python library routine callback call one of my functions with the first argument statically assigned to be a value of my choosing. In other words: I needed to bind some of the argument variables immediately but allow the remainder of the arguments be left unbound. Here a bit of functional flair fit the solution: lambda function composition.

First we will create our stub dispatch function:

def dispatch(variant, *args):
    print "dispatch(%s, %s)" % (variant, args)
    # a real implementation may now act differently based on the value of variant

We want our Python library call back to call our function like so...

dispatch("type1", (0, 1, 2))
dispatch("type2", (0, 1, 2))
# etc

Using a simple lambda composition we can create a new function that has the variant argument bound while still allowing the *args array to be set at a later time. This may be done simply:

mk_cb = lambda v: lambda *a: dispatch(v, *a)

Then we can create a series of custom functions which may be registered as callbacks with whatever variant type we wish to set:

cb1 = mk_cb("type1")
cb2 = mk_cb("type2")

We can call one of the callback functions just to test it:


>>> cb1((0,1,2))
dispatch(type1, ((0,1,2),))

And finally we can use it with some Python library callback registration function:

some_py_obj.register_function(cb)
# cb is the dispatch() function with 'type1' as the first argument

So who says that we are, "never going to use this stuff?"

Posted by jordanh at 6:14 AM | Comments (2) | TrackBack |

Main > Photoblog

November 4, 2007

Jesse's 得度式 (Tokudoshiki)

00241.jpg
View in Photoblog
CameraKonica Minolta MAXXUM 7D
Lens (35mm Equiv.)Tamron 28-200mm f/2.8 @ 48mm (75 mm)
Exp. Prog. / Shutter @ ApertureAperture priority / 1/25 s @ f/4.5
Metering w/Adj. @ ISOPattern w/0.00 eV @ 3200

Last week my friend Jesse became a monk in a ceremony called a "tokudoshiki" (Japanese: 得度式). The monks were very gracious to allow me access to take photographs and although I was able to take many I will try to be respectful by only posting a few of them. Allowing photographs at an event such as this is very unorthodox.

The ceremony was very long, perhaps four or five hours in total. At this point in the ceremony Jesse had not yet had his head shaved nor received his new name.

 

Posted by jordanh at 8:02 AM | Comments (2) | TrackBack |

Main > Photoblog

November 2, 2007

Alms Practice

00240.jpg
View in Photoblog
CameraKonica Minolta MAXXUM 7D
Lens (35mm Equiv.)Tamron 28-200mm f/2.8 @ 48mm (75 mm)
Exp. Prog. / Shutter @ ApertureNormal Program / 1/500 s @ f/2.8
Metering w/Adj. @ ISOPattern w/0.30 eV @ 100

Jesse took my friend and I to Kawasaki-daishi temple. After watching and participating in a Buddhist ritual peppered with the esoteric—fire, chanting, and a monk beating a large drum—we walked around the grounds and finally back out into the surrounding town. There we saw not an atypical sight: pacing up and down the street was a monk chanting the heart sutra and collecting alms.

I understand it was part of a monk's practice to collect rice or vegetables through public offering but now food has given way to money. Today money is even non-essential as many temples have large endowments. Money has yielded simply to practice.

 

Posted by jordanh at 7:38 AM | Comments (1) | TrackBack |