Tue 26 Jan 2010
Small flashlights
On a whim I ordered a Leatherman Monarch 200 flashlight
. For $10 I thought it was worth a try.
I normally carry a 4Sevens Quark 123
, or a small Preon, but I like to have lights everywhere. Comes in handy when the power goes out!
Here's how it stacks up against the Fenix E01
($12.50) and the Lummi Wee, which cost me about £50 all told (it has tritium phials).
The E01 is slightly brighter, and the Leatherman is much bluer in color. (My “natural” LED lights are even less blue.) The Lummi Wee, as you might expect from a high-output light that uses boutique batteries, kicks out a lot more light.
However, I'm not disappointed: the Monarch is tiny, has a clicky tailcap (which is both easy to use and hard to accidentally depress: much better in my opinion than twist activation), seems pretty robust, and costs no more than a Photon. This one is going on the wife's keychain, and I might order another to stash in a bag…
Posted at 2010-01-26 17:33:26 by Richard Newman • Link to Small flashlights
, trackbacks.
Sat 23 Jan 2010
Damn you, Mail
Mail.app is so classy. This is in my console log.
2010-01-23 Jan 23 19:55:40 Mail[1749]
An instance 0x1cfa80f0 of class IMAPConnection is
being deallocated while key value observers are
still registered with it. Observation info is
being leaked, and may even become mistakenly
attached to some other object. Set a breakpoint
on NSKVODeallocateBreak to stop here in the
debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x39ea320> (
<NSKeyValueObservance 0x4e328d0: Observer:
0x16a80a60, Key path: isDisconnected, Options:
<New: NO, Old: NO, Prior: NO> Context: 0x0,
Property: 0x1b0c0040>
)
Posted at 2010-01-23 20:58:00 by Richard Newman • Link to Damn you, Mail
, trackbacks.
Thu 24 Dec 2009
Damn you, iTunes
Before flying out for Christmas, I made sure to rip five more episodes of The Wire to keep me entertained on the plane.
Oh! A new version of HandBrake. Sweet. I ripped, I added to iTunes, I labeled the videos as “TV Shows” (thanks for paying attention to where I dragged them, iTunes).
Now, in NJ, I come to sync… and they won't. iTunes shows them in the list, lets me check them, and syncs, but simply ignores those. Older rips copy fine. It doesn't even have the courtesy to show the usual “this video format won't play on this device” message.
Is it the additional 2 pixels of vertical resolution that the Info window reports? Otherwise the video files are identical.
Nothing in the Console. No messages. Damn you, iTunes. Happy Christmas to me.
Posted at 2009-12-24 09:41:00 by Richard Newman • Link to Damn you, iTunes
, trackbacks.
Mon 19 Oct 2009
Fix to avoid sh: cc: not found while loading Python's uuid module
uuid uses ctypes.util.find_library to find libuuid and libc.
find_library calls out to cc/gcc to do its work.
This produces an annoying sh: cc: not found message at runtime when you don't have a damn compiler on your production box. Here's the diff against uuid.py.
402c402,406
< lib = ctypes.CDLL(ctypes.util.find_library(libname))
---
> # Attempt static first.
> path = {'uuid': '/usr/lib/libuuid.so',
> 'c': '/usr/lib/libc.so'}.get(libname) or
> ctypes.util.find_library(libname)
> lib = ctypes.CDLL(path)
Posted at 2009-10-19 14:10:00 by Richard Newman • Link to Fix to avoid sh: c…
, trackbacks.
Mon 28 Sep 2009
Multipart data in CherryPy
I've spent a little while trying to get CherryPy 3.2 to handle multipart/form-encoded data in a useful fashion. That is, I need access to the Content-Type of each part.
By default, it passes each part as a named string argument to your handler function.
I finally found the correct incantations to get cherrypy.request.body.parts to contain the Entity instances, each of which has a .content_type, .name, etc. From there I can constitute a kind of sane arglist.
# Somewhere early on
def multipart_tool():
cherrypy.request.body.processors[u'multipart/form-data'] = cherrypy._cpreqbody.process_multipart
cherrypy.tools.multipart_tool = cherrypy.Tool('on_start_resource', multipart_tool)
# In your handler class:
class Foo(object):
_cp_config = {'tools.multipart_tool.on': True}
The advice on the CherryPy wiki suggests setting the "multipart" processor, which is overruled by the multipart/form-data processor. Pah.
The more I use Python, the more I find it totally unsuitable for getting things done.
Posted at 2009-09-28 21:51:00 by Richard Newman • Link to Multipart data in …
, trackbacks.
Fri 25 Sep 2009
Vimperator, how I love you
Put this in ~/.vimperatorrc.
set editor="/Applications/MacVim.app/Contents/MacOS/Vim -g -f"
Now find a textfield when you launch Vimperator, and hit Ctrl-I. Editing textfields in MacVim! Hooray!
Posted at 2009-09-25 20:42:00 by Richard Newman • Link to Vimperator, how I …
, trackbacks.
Wed 23 Sep 2009
Oh, OmniWeb
$ leaks OmniWeb
Process 71336: 1915517 nodes malloced for 158662 KB
Process 71336: 2989 leaks for 435024 total leaked bytes.
This is with OmniWeb at 249MB RSIZE. I've had it break 1GB several times. Thing leaks like a sieve.
Posted at 2009-09-23 19:58:00 by Richard Newman • Link to Oh, OmniWeb
, trackbacks.
Fri 18 Sep 2009
Beautiful code
I just took the time to start reading Tom Faulhaber's description of simple webhooks with Clojure and Ring. A mere two pages in I hit some staggeringly beautiful code.
I hope Tom won't mind me quoting it here:
(defn hook-server
"Build a simple webhook server on the specified
port. Invokes ring to fill a blocking queue,
whose elements are processed by handle-payload."
[port]
(doseq [payload
(fill-queue
(fn [fill]
(ring.jetty/run {:port port}
(partial app fill)))
:queue-size 10)]
(handle-payload payload)))
Go read the article and figure out the control flow there. Once you get it, wow. Defining an app in terms of a sequence generated by incoming requests.
This is why I love programming as a profession.
Posted at 2009-09-18 14:44:00 by Richard Newman • Link to Beautiful code
, trackbacks.