·  [ martin@martindengler.com ]  ·  Home  ·  Projects  ·  Links  ·  Contact  ·  About  ·  PGP/GPG key  · 

Martin T Dengler's personal home page.
Nothing at all related to my work, my university, or my high school.
Old CV (pdf/tex).
I administer this site, as well as xades.com, marydengler.com, and canodog.com.

2008-11-06 :   Python profiling cheat sheet snippet  
Download lsprofcalltree from pypy; then do something like (thanks to Tomeu):
12:39 < tomeu> import os
12:39 < tomeu> import cProfile
12:39 < tomeu> import lsprofcalltree
12:39 < tomeu> profiler = cProfile.Profile()
12:39 < tomeu> profiler.enable()
12:39 < tomeu> ######################
12:39 < tomeu> profiler.disable()
12:39 < tomeu> k = lsprofcalltree.KCacheGrind(profiler)
12:39 < tomeu> data = open(os.path.expanduser('/tmp/import.kgrind'), 'w+')
...and throw that into kcachegrind.

2008-08-01 :   DBus Python API  
The freedesktop.org Python DBus API documentation needs to be higher on Google searches for "python dbus".

2008-05-01 :   irssi settings  

I don't understand why irssi - a great program - doesn't come shipped with settings that cause joins/leaves to show up in a separate window. Evidently most of IRC is about the schadenfreude of seeing kickbanned people trying to bounce back into a channel or something.

It took me about five seconds to get annoyed by getting real conversations interrupted by messages - with extra color and/or highlighted - about whose computer had decided to go to sleep, or who had locked their screen. Is there so little real information in most channels that people like seeing this stuff?

To get messages that aren't part of the conversation out into one - the first - irssi window, just paste these commands into your irssi session:

            /set window_default_level -ALL MSGS PUBLICS NOTICES CTCPS ACTIONS KICKS MODES TOPICS NICKS CLIENTCRAP
            /foreach window /window level -ALL MSGS PUBLICS NOTICES CTCPS ACTIONS KICKS MODES TOPICS NICKS CLIENTCRAP
            /set window_check_level_first ON
            /window goto 1
            /window level ALL -MSGS
            /save
          

Job done. Read more hints in the Irssi documentation.


2008-04-28 :   compcache on the XO  
I'm trying compcache on my XO. To get it installed on my XO, from the console of my XO running the latest joyride:
            sudo /sbin/init 3

            #get joyride kernel-devel rpm
            wget http://dev.laptop.org/~dilinger/stable/kernel-devel-2.6.22-20080408.1.olpc.de2a86ff3b60edc.i586.rpm
            sudo rpm -ivh kernel-devel-2.6.22-20080408.1.olpc.de2a86ff3b60edc.i586.rpm
            sudo cp -af /boot/* /versions/boot/current/boot/

            #get compcache
            wget http://compcache.googlecode.com/files/compcache-0.3.tar.gz
            tar xzf compcache-0.3.tar.gz
            cd compcache-0.3
            make

            #use it
            sudo ./use_compcache.sh
          
I got a warning about udevadm being missing, and indeed it is/was and I have no idea whence to get it, but it's just used to wait until the right compressed ram device shows up, and that wasn't necessary in my case (presumably running use_compcache.sh twice would be good enough), so I'm not worrying about it. The results...this is before, in runlevel 5, with 2 Terminals, 1 Browse, 1 Record, and 1 EToys activity running:
-bash-3.2# free
             total       used       free     shared    buffers     cached
Mem:        237840     234036       3804          0        260      35268
-/+ buffers/cache:     198508      39332
Swap:            0          0          0
-bash-3.2# time yum search memory-pig

[1]+  Stopped                 yum search memory-pig

real    29m23.437s
user    0m0.000s
sys     0m0.180s
-bash-3.2# kill -9 %1
          
...and as you can see I had to kill yum after 29 minutes with end in sight, OOM killer having killed two of my python processes (one of which was Browse, and the other unknown...) and the XO becoming very unresponsive (well, I was running screen, three shells, and emacs (empty buffer) as well as vmstat 1 500 to show the memory usage, and the sys cpu percentage went to 95% for a long time).

This is after init 3; use_compcache.sh ; init 5, and launching all the same apps as before:

-bash-3.2# free
             total       used       free     shared    buffers     cached
Mem:        237840     232636       5204          0       1372      43776
-/+ buffers/cache:     187488      50352
Swap:        59456      13068      46388
-bash-3.2# time yum search memory-pig
olpc_development          100% |=========================| 2.4 kB    00:00
No Matches found

real    1m52.392s
user    0m16.250s
sys     0m27.430s

          
...so hey, I'll leave it installed for now :). How does it feel? Hmm...it's too early to tell.

2008-04-23 :   XO patches accepted!  
I now have two patches accepted into the Sugar! They're about the smallest patches you can get - the first was one line, a removal :) - but it's nice to have something in the tree. There are a few still outstanding though.

2008-04-04 :   More Lisp foolery  

Every time I try to do something in a Lisp requiring not rewriting huge libraries-worth of code I want to boot to the head the smartasses who rant about Lisp being a kickass language and fail to mention that packaging sucks and nobody seems to care that it takes days to figure out how to install each package because the maintainer got bored with other people using their code about 30 seconds after sticking it on CLiki. I imagine Esperanto advocates take the same type of (sadistic) pleasure in this type of situation: "Esperanto is so cool, everybody who's good would use it", I imagine them saying. "Where's Esperanto's Shakespeare?", I'd retort. "Don't worry, you can learn English from this crack-addicted tramp on speed with ADD", they would answer, "and then you can read Shakespeare, and then you'll realize why you shouldn't worry about him and instead be spending time coming up with baroque sentences of interest to abstract Esperanto researchers or arguing about which paper is best to browse the other Esperanto sentences of interest to more than two people in the world".

So I wanted to play with ECL and SBCL, so tried (require 'cl-ppcre) in sbcl. Argh, stale FASLs. Imagine the acronym "ABI". Now imagine the word "compatibility". If you're a typical Lisp hacker you're already distracted and I'd have no chance of combining those words with "shouldn't be broken by a patch release of your compiler/intepreter in this day and age".

After finding a nice .sbclrc snippet to try a recompile if a stale FASL was found, (require 'cl-ppcre) worked! (require 'split-sequence) didn't, though, nor did a few other ones I tried at random (most from memory but one while staring at its CLiki page!).

So then I found Lisp with Batteries Included 2 and tried to get clbuild going. It rebuilt sbcl (!?!?) fine -- amazing. Why Lisp package management is so broken that there's mk-defsystem, asdf-install, and super Lisp hackers (and I mean it certainly seems like these guys really know their way around Lisp development enviroments) have to create a third (!), will never cease to amaze me. There have been rants about how Lisp people are too smart to have their attention distracted by helping other people by fixing this type of problem, and then the counter-rants saying "it's easy enough; we all did it, and if one can't, then one isn't worthy!". Just recently I came across Steele or somebody like that mentioning how "mainstream" languages (by which I mean languages that are not such a pain to get to work with) were actually much more varied not in their language features (or other things a language designer would typically worry about) but varied in their community ("culture?") and their library support. He got it right. And Lisp makes me cry each time I think of how it measures up in those two areas.

All this wouldn't even have been attempted if the implementation language wasn't so cool. It's like having a beautiful mechanical toy whose mechanisms are so interesting to even just glimpse from time to time that you're happy to put up with having to clean up the crap that seems to spontaneously accrete every time you come back to it before you can even see the beauty.

I'd mark up this text with proper links to the referenced articles/tools but it's five AM so I'll leave it for another day when I don't have to recompile sbcl. I'm still amazed that it worked the first time; see! The code is great but the inconsistency of the tools...argh.


2008-04-01 :   some XO patches  
LIFO - my last two patches (to support-scripts [1] [2]) just got added. They're small patches, but useful for scripting and good of the maintainer (Phil Bordelon) to merge them so quickly.

2008-03-31 :   XO wrangling  
My OLPC patches are still being digested; I think update.1 work is keeping people focused elsewhere (given I recently submitted a one-line patch to bug #4646, I don't think it's (just) because my patches are rubbish). So in order to make it a bit easier for me to enqueue something on my XO for offline reading, I combined:
  • My patched copy-to-journal
  • Simple bash script to scp files and call copy-to-journal
  • nautilus-actions integration of said script. Once configured, it's pretty easy to use the nautilus-actions-config control panel to configure nautilus-actions to run this script via a right-click menu (unfortunately there is no shortcut/accelerator support yet) in nautilus.
  • I also used mozex to automate putting a link in the journal with this script. Nice.

2008-03-13 :   SOMs  
Self-organizing maps look cool, but not (mainly) literally: using them for categorizing price movement patterns is the subject of some research, but not really very much. 2-5- and 10-20- (trading-) day-long patterns of "special situation" stocks could be interesting.

2008-03-06 :   XO/Sugar keyboard shortcut changes  
I've gone out on a limb (because it's kind of none of my business) with some patches to Sugar that make nano/emacs usable from a sugar terminal via the standard keybindings (like, C-s and C-o actually work).

2008-03-01 :   Continuation study  
I really need to learn more about continuations, like Self-application as the fixpoint of call/cc

2008-02-27 :   XO ebook-mode patches, still  
My ebook mode patches appear to have attracted no attention :(. I hope it's just because there is a big XO deployment and people are busy. Maybe I could make the initial focus on the Browse and Read applications be a lot more sensible (and ebook-friendly) in the meantime.

2008-02-11 :   XO ebook-mode patches  
I submitted some patches to better support ebook-mode on the XO. Any python activity will fullscreen itself and hide its cursor, which is pretty much just what you want when you hit any buttons on the screen or move the mouse (because you're in ebook-mode).

2008-01-12 :   XP on the XO commentary  
Recently there was some publicity about XP on the XO. I think some of the reaction to the reaction (!) was regrettable, and I said so:
I think you guys just got it wrong, here:

1) What is OLPC getting? I'm not sure what OLPC will be getting out
          of helping Microsoft: you say that you're not dedicating
          resources to it, but I bet if 5 random developers showed up
          and asked for the same amount of time from you (meetings +
          technical writer) they wouldn't get the same reception.
2) What are you losing? Your time (meetings) and others' support for
          the project (bad PR), but most importantly, the ability of
          the laptops in the field to be used for OLPC core principles
          (trivially, the 5th, but given the state of mesh networking
          now, I can't imagine trying to get things working with
          Windows will speed up achieving saturation and
          connection). I agree with Bruce about the 'paradox of
          choice' that you seem to ignore (or straw man the other
          side - 'To claim we should prohibit XO customers from
          running XP') is that the choice that removes your ability
          to choose is no choice. I know you said they must be able to
          switch back to a free alternative (Linux), but if you really
          believe that once officials have the choice to distribute
          Windows the sales (bribery?) pressure won't kick in and
          leave kids with Windows laptops that their parents can sell
          or DRM'ed textbooks they need to have, I submit Intel's
          latest antics as the obvious riposte.
3) Your point about the Microsoft people you're dealing with being
          'good people', and want to 'play along', goes nowhere
          concrete so I assume it's meant to convince you/us that
          this is all a warm, fuzzy, help-the-kids-first project. If
          so, doesn't that seem a bit naive? If not, please help me
          understand where you were taking that point (I assume it
          wasn't 'MS supports OLPC's five core principles; look,
          these nice people are just the beginning').

I only hope this is just a friendly, developer-to-developer set of
          interactions that got too much press. Given Microsoft have
          had 40 people working on this for a year, I doubt it, and I
          think you've gone too far. Let Microsoft employees join the
          devel list and exchange their ideas in the open, at least,
          on the same playing field as everybody else.

Martin

PS - you also lost me when you said OLPC's 'commitment to open
          source and free software isn't religious, but pragmatic' -
          if one of your five goals can be cast aside so easily for
          'pragmatic' reasons, I think you're going to lose a bit
          of people's trust and goodwill. I would have expected one
          of your core goals would be adhered to except in
          extraordinary circumstances (c.f. the Marvell
          firmware). These are hardly extraordinary circumstances,
          except in the naivite that what Microsoft has done with
          other OS competitors won't be done to OLPC.

2008-01-05 :   XO laptop backlight control  
I figured out how to control the XO laptop's backlight from another's blog and thought I'd re-highlight and expand on it here:

The backlight levels can be modified by writing to /sys/class/backlight/dcon-bl/brightness. The backlight seems to have 15 levels of color-mode brightness (1-15) and one level indicating black and white mode (0).

Here're examples of how to modify the backlight levels from the Terminal:

            sudo bash -c "echo 0 > /sys/class/backlight/dcon-bl/brightness"
            sudo bash -c "echo 15 > /sys/class/backlight/dcon-bl/brightness"
          

2008-01-04 :   XO laptop hacking  
I've got an XO Laptop (from the OLPC project) and it's pretty cool. I've upgraded the software (joyride-1502 works fine for me) and figured out how to get the battery capacity into a gnu screen hardstatus line with this tiny script & screenrc change:
---------- /home/olpc/bin/olpc_screen_status.sh
#!/bin/bash
# Author: Martin Dengler <martin@martindengler.com>
# idea from http://www.mail-archive.com/screen-users@gnu.org/msg00322.html
# based on battery info from olpc-logbat
#
B_INFO=/sys/class/power_supply/olpc-battery

while true
do
    CAP=`cat $B_INFO/capacity`
    echo b:$CAP%
    sleep 60
done
----------
          
....screenrc change:
---------- /home/olpc/bin/.screenrc
# run command forever and assign most recent output to string escape %1`
backtick 1 0 0 /home/olpc/bin/olpc_screen_status.sh

# the ...%1`... part at the end is the important part
hardstatus alwayslastline "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H
%{..Y} %m/%d %C%a %1` "
----------
          

2007-12-06 :   New favorite quotes  
Some new famous quotes (from norvig.com):

The quality of a person's life is in direct proportion to their commitment to excellence, regardless of their field of endeavor.
    - Vince Lombardi

It is the mark of an educated mind to be able to entertain a thought without accepting it.
    - Aristotle

Believe, if thou wilt, that mountains change their place, but believe not that man changes his nature.
    - Mohammed


2007-12-05 :   What's in your feed list?  
Recently had a conversation at a meetup about what RSS feeds we read. I heard about a few new ones; here are mine:

2007-11-29 :   Common Lisp Tutorial  
Peter Siebel recommends people link to this Common Lisp tutorial because there isn't anything better! Seems like the least we can do.

2007-11-10 :   Laptop with Free/LinuxBIOS  
I'm interested in buying a laptop or two. Both have to have:

I might want two, one as a text-only hacking/emailing console-about-the-house and another as a desktop replacement.

I'll have to update my projects page as I do the research.


2007-11-08 :   Repos page update  
I've updated my Fedora repos page for Fedora 8.

2007-11-07 :   Fedora 8 upgrade  
If you're thinking of upgrading/installing Fedora 8 without having to burn any CDs/DVDs and have an extra hard drive partition (usb disk? home partition you won't be blowing away?), just drop the rescue disk's initrd.img and vmliunz into your existing /boot directory and add a new entry to your /boot/grub/grub.conf pointing to them. Store the DVD iso on the partition that will survive the upgrade and reboot. Make sure to select that new grub entry when you reboot, and you should be off and installing.

2007-10-24 :   .emacs file  
I've been messing around with my .emacs file to make it useful on a number of machines. I figured I'd mention it in case I need to copy it somewhere without scp or some search engine can use it to help someone someday.

It's got a few standard customizations and cute stuff grabbed from around the web:

  • global auto-revert and font-lock mode
  • UI stripdown (a bit)
  • slime
  • iswitchb
  • with-library macro
  • tramp mode


2007-09-15 :   Language experience  
A long time ago, Kent M. Pitman mentioned a list of langague-classes (and examples thereof) that a programmer should get experience with to make them better programmers. I checked off those that I know and was pleasantly surprised:
  • A block-structured language, such as Algol or Pascal or Scheme.
  • A line-oriented language, such as Fortran or BASIC.
  • A rule-based logic language, such as Prolog or EMYCIN.
  • An Englishy language such as HyperTalk or Cobol.
  • A "stack" language such as PostScript.
  • A "line noise" language (heavy emphasis on one-letter operators) like APL or Teco.
  • A dynamic object-oriented language, such as Common Lisp or Smalltalk.
  • A strongly-typed, statically analyzed language such as ML or Haskell.
  • A dynamically-typed functional programming language, such asScheme.
  • A string or macro processing language, such as Perl or m4 or TeX orTeco.
  • A database access language, such as SQL.
  • An abstract high-level, assembly language, such as Java.
  • A concrete high-level, assembly language, such as C.
  • A low-level, traditional assembly language.
  • A scripting language, such as Javascript.
  • An interface-definition language such as Visual Basic, HyperTalk, or Javascript.
  • A document-structuring language such as XSL or TeX.
  • A language with a modern error system, such as Common Lisp or Dylan.
  • A reflective/introspective language such as Common Lisp or Java.
  • A symbolic programming language, such as Common Lisp or Scheme.
  • A security-oriented language, such as Java or MOO.
  • A language where both programs and data are fully persistent, such as MOO or HyperTalk.

2007-09-15 :   Cleanup  
I've cleaned up this first page. 2003-2006s' page is still available.

2007-08-05 :   Lisp  
Great Lisp comic. If they showed more CS majors that they'd overcome a few of Lisp's disadvantages

2007-06-16 :   Backups  
Backups are for wimps: Real men, and all that.

2007-06-11 :   TV control script  
Just a small script to control my TV (LG 37Z55). Really simple example of pyserial usage, but not supposed to be anything like a model bit of code (it's not interesting enough, first off). Will probably work with other LG models.

2007-01-01 :   Rabbit problem, almost  
The closest I've come to finding a reference to the rabbit problem: Programming puzzle.
 
(c) Copyright 2000-2008 Martin T Dengler. All rights reserved.
$Id: index.html,v 1.73 2008/11/06 01:44:09 martin Exp $

"May ours be the noble heart
Strong to endure
Daring tho' skies be dark
And road-ways unsure"

-- Regis High School Alma Mater

Colophon: The site's design has been influenced by freshmeat.net, mengwong.com, and mozilla.org . You can learn more in the About section.