Minuteman ramblings
Filed in biking, May 13, 2008, 12:45 amThis weekend I thought I would finally explore the Minuteman bikeway. It was nice to not have cars whizzing by but there were still a dozen traffic crossings. Overall it was a pleasant ride but on a Sunday afternoon it was a bit clogged with family rollerbladers and weekend warriors.
I’ve been car free for the past 3 years and in that time I’ve learned a few things that weren’t immediately obvious when I started using the bike as my primary means of conveyance.
- Lightweight windbreakers work wonders keeping you warm - one good gust of cold wind can cut right through several layers of cotton and chill you right to the core.
- Sunglasses protect your eyes from more than just sun - there seems to be constant construction around my apartment throwing up all kinds of dust and other particulates, sunglasses keep it out of my eyes. Cold and windy days can also cause my eyes to tear up making it difficult to see. Sunglasses can help prevent this.
- Toe clips help increase power transfer but limit the shoes that you can wear while biking - When I added toe clips to my plain flat pedals I noticed a reduction in the effort required to maintain a particular speed. I do find it difficult, however, to easily slip in and out of the clips when I’m wearing my running shoes because they are wider from the toe box to the arch and can sometimes get stuck. My sambas and vans do slide in and out quite easily.
- Helmet hair looks ridiculous - Your standard expanded polystyrene bicycle helmet has several vents to help keep your head cool, vents that can also create areas of low pressure coaxing your hair up into them and upon removal of the helmet your hair will be flattened where it was in contact with the helmet and have a windblown, straight up in the air look everywhere else. A look that not even the sex pistols could pull off. My solution is to wear a cycling cap underneath my helmet and depending on the helmet a regular baseball cap will work as well.
As I think of more I’ll post them, below is the route I took on the Minuteman bikeway.
Noteworthy
Filed in General, March 30, 2008, 2:10 pmDon’t search for “python dict sort by value” since you’ll get outdated answers. As of python 2.4, the “right” way to do this is:
alist = sorted(adict.iteritems(), key=lambda (k,v): (v,k))
to get the reverse order, add on a ,reverse=True
This is the fastest way to do this and it uses the least amount of memory. Enjoy.
>>> adict = {'first':1, 'second':2,'third':3, 'fourth': 4}
>>> adict
{'second': 2, 'fourth': 4, 'third': 3, 'first': 1}
>>> sorted(adict.iteritems(), key=lambda (k,v):(v,k))
[('first', 1), ('second', 2), ('third', 3), ('fourth', 4)]
>>> sorted(adict.iteritems(), key=lambda (k,v):(v,k), reverse=True)
[('fourth', 4), ('third', 3), ('second', 2), ('first', 1)]
from http://blog.modp.com/2007/11/sorting-python-dict-by-value.html
Installing octave on Leopard
Filed in mac, January 21, 2008, 3:10 amInstalling octave on Leopard is difficult because emacs is broken - wait what? If you’re using darwinports to try and install octave which requires gnuplot which uses emacs in the build process, you’re going to have a hard time. The error that I eventually got to after hours and hours of downloading an compiling was:
$ sudo port install octave
...
(seriously it took forever)
...
Making all in lisp
emacs -batch -q -no-site-file -l ./dot.el -f batch-byte-compile gnuplot.el
Fatal malloc_jumpstart() error
make[2]: *** [gnuplot.elc] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
This is because one of the dependencies of octave was failing - gnuplot. Trying to install gnuplot by compiling from source confirmed this. I found a few postings to message boards and mailing lists but nothing useful until someone mentioned that this error indicated an error with emacs. Sure enough trying to invoke emacs from the command line produced:
$ emacs
Fatal malloc_jumpstart() error
Further digging produced a rather lengthy exchange on the Apple support forums, but more importantly a solution! Before trying the solution below, I also tried compiling emacs from source but to no avail so to get a functioning emacs on Leopard simply type:
$ sudo mv /usr/bin/emacs-i386 /usr/bin/emacs-i386.backup
$ sudo /usr/libexec/dumpemacs -d
$ emacs --version
$ emacs
And, viola! Now if you run $sudo port install octave again darwinports will pick up where it left off and eventually you’ll come to the NEXT error: octave won’t compile. >.< The reason it gave me was due to the lack of a suitable fortran compiler. Never fear, ATT labs has a binary for OS X.
Now I just need to get readline working…
EDIT: Well after much MORE wrangling I was still unable to get octave to install using darwinports… or compile the source from the website, so I resorted to fink. I tried my best to avoid it, but now I have two command line software management packages on my laptop… to go with gem… and easy_install… In order to install octave using fink you need to enable the ‘unstable’ repositories and then it’s just a matter of $sudo fink install octave