lorenzo bolla’s blog

September 13, 2009

the List and the Truth

Filed under: links, programming — lbolla @ 1:38 pm

Spoon Boy: Do not try and bend the list. That’s impossible. Instead . . . only try to realize the truth.
Neo: What truth?
Spoon Boy: There is no list.
Neo: There is no list?
Spoon Boy: Then you’ll see that it is not the list that bends; it is only yourself

from “Practical Common Lisp

September 10, 2009

my phd thesis on scribd

Filed under: personal — Tags: , , — lbolla @ 2:12 pm

August 28, 2009

videocracy

Filed under: italiano — Tags: , , — lbolla @ 9:56 am

August 25, 2009

surf browser hints /2

Filed under: programming — Tags: , , , — lbolla @ 12:45 pm

following yesterday’s post, here is another useful hint about surf’s usage.

the following script lists the available bookmarks (from ~/.bookmarks file) and let’s you pick one using dmenu. if a new link is inserted, it is added to the list of known bookmarks, so you won’t need to type it in full the next time:

#!/bin/sh
bookmarks=~/.bookmarks
link=`cat $bookmarks | dmenu ${1+"$@"}` || exit 0
present=`grep $link $bookmarks`
if [ "$?" -ne "0" ]; then
echo $link >> $bookmarks
fi
surf -u $link

if you don’t want to open a new window, just change the last line to set the _SURF_URL X Property of the surf window you want to use (by clicking on it):

xprop -f _SURF_URL 8t -set _SURF_URL $link

August 24, 2009

surf browser hints

Filed under: programming — Tags: , , , — lbolla @ 6:13 pm

surf is a simple webbrowser based on webkit/gtk+, the same web engine that powers Google Chrome.

used with dwm and dmenu, it’s a very powerfull, yet simple tool.

here is a patch to apply X geometry hints to surf, so that surf windows behave in dwm.


*** surf.c.orig 2009-08-24 16:41:31.000000000 +0100
--- surf.c 2009-08-24 16:35:02.000000000 +0100
***************
*** 372,377 ****
--- 372,381 ----
gtk_container_add(GTK_CONTAINER(c->vbox), c->searchbar);
gtk_container_add(GTK_CONTAINER(c->vbox), c->urlbar);

+ /* Hints */
+ GdkGeometry hints = { 1, 1 };
+ gtk_window_set_geometry_hints(GTK_WINDOW(c->win), NULL, &hints, GDK_HINT_MIN_SIZE);
+
/* Setup */
gtk_box_set_child_packing(GTK_BOX(c->vbox), c->urlbar, FALSE, FALSE, 0, GTK_PACK_START);
gtk_box_set_child_packing(GTK_BOX(c->vbox), c->searchbar, FALSE, FALSE, 0, GTK_PACK_START);

another hint is to create a script to feed surf with your favorite bookmarks. here it is:

#!/bin/sh
exe="surf -u `cat ~/.bookmarks | dmenu ${1+"$@"}`" && exec $exe

enjoy!

August 12, 2009

vim and python comments

Filed under: programming — Tags: , , — lbolla @ 5:56 pm

I’m currently undergoing a profound revision (read “cleanup”) of my .vimrc and I recently had to choose a decent plug-in to comment python code.

the best so far is EnhancedCommentify. it’s highly configurable, powerful and it supports a different number of languages (not only python).

the only one thing that wasn’t easy to setup if the behaviour described here: being able to comment a block, respecting the indent, in both visual and normal mode.

a clean solution, without the need to define any function is to stick these lines into your .vimrc:


let g:EnhCommentifyPretty='Yes'
let g:EnhCommentifyRespectIndent='Yes'
let g:EnhCommentifyUserBindings="Yes"
let g:EnhCommentifyUseBlockIndent='Yes'


vmap ,c (Plug)VisualComment
vmap ,d (Plug)VisualDeComment
vmap ,g (Plug)VisualTraditional
vmap ,f (Plug)VisualFirstLine
nmap ,c (Plug)Comment
nmap ,d (Plug)DeComment
nmap ,g (Plug)Traditional
nmap ,f (Plug)FirstLine

(but remember to change “(” to “<” and “)” to “>” — wordpress is strict about “<” and “>”…)

enjoy!

May 1, 2009

Windows’ bugs

Filed under: personal — Tags: , — lbolla @ 5:31 pm

a bug’s just hidden in my keyboard…
a green one…
under the Windows key!

escape sequences for rxvt

Filed under: programming — Tags: , , , — lbolla @ 10:07 am

I’m posting this info because I had a hard time searching for it on the internet.

if you are using rxvt (or urxvt), and you want escape sequences to work as in xterm, you need to specify them in your .Xdefaults.

here are the codes I had to add to have vim working properly on rxvt (I use alt-left_arrow and alt-right_arrow to navigate through tabs):

*Rxvt*meta8: false
*Rxvt.keysym.C-Left: +033[1;5D
*Rxvt.keysym.C-Right: +033[1;5C
*Rxvt.keysym.M-Left: +033[1;3D
*Rxvt.keysym.M-Right: +033[1;3C
(substitute “+” with “\”)

enjoy!

April 7, 2009

blog post with charm

Filed under: programming — Tags: , , , — lbolla @ 5:52 pm

this is a test blog entry, posted with charm!

charm is a text-based client which uses the MetaWeblog API to post entries to WordPress powered blogs. it also implements other APIs.

I’m wondering if simple ASCII entries like this one will be properly formatted by the WordPress’ Intelligent Text Formatting feature. it would be nice to use vim to edit it…

enjoy!

February 2, 2009

qwerty vs dvorak vs colemak to edit python code

Filed under: Blogroll — Tags: , , , — lbolla @ 9:30 am

yesterday, I was intrigued by the idea of choosing a more efficient keyboard layout to work with everyday.

as long as I type python code 90% of my time, I decided to evaluate the efficiency of the first 3 most widespread keyboard layouts: QWERTY, Dvorak and Colemak.

I used this excellent tool to compare the three layouts over the first 50000 characters of the webpy source code.

here are the results:

The Qwerty Keyboard Layout Vs The Dvorak Keyboard Layout

:: UP ::Overall effort

Layout Effort % improvement over worst layout
Qwerty 306,509.6 0.0 %
Dvorak 283,868.7 7.4 %
Colemak 275,347.6 10.2 %

:: UP ::Keys for each finger (stronger fingers should be used more often)

Layout Thumbs LPinky LRing LMiddle LIndex RIndex RMiddle RRing RPinky Total
Qwerty 25.9 % 12.4 % 5.3 % 9.5 % 11.6 % 7.6 % 5.6 % 8.9 % 13.2 % 54,237.0 keys
Dvorak 25.9 % 13.0 % 5.2 % 8.1 % 7.3 % 7.5 % 7.5 % 8.2 % 17.3 % 54,237.0 keys
Colemak 25.9 % 12.7 % 4.8 % 7.5 % 9.5 % 8.4 % 10.1 % 6.6 % 14.5 % 54,237.0 keys
Layout Thumbs Left hand Right hand Total
Qwerty 25.9 % 38.8 % 35.2 % 54,237.0 keys
Dvorak 25.9 % 33.6 % 40.5 % 54,237.0 keys
Colemak 25.9 % 34.5 % 39.6 % 54,237.0 keys

:: UP ::Finger Travel Distance (only the horizontal)

Layout Thumbs LPinky LRing LMiddle LIndex RIndex RMiddle RRing RPinky Total
Qwerty 0.0 % 18.1 % 2.0 % 10.5 % 15.5 % 12.1 % 8.6 % 9.9 % 23.4 % 1,441.5 m
Dvorak 0.0 % 21.1 % 4.1 % 3.5 % 10.0 % 12.5 % 7.6 % 10.8 % 30.4 % 1,210.3 m
Colemak 0.0 % 23.7 % 2.5 % 6.1 % 10.2 % 10.2 % 9.3 % 9.3 % 28.6 % 1,131.2 m
Layout Thumbs Left hand Right hand Total
Qwerty 0.0 % 46.0 % 54.0 % 1,441.5 m
Dvorak 0.0 % 38.8 % 61.2 % 1,210.3 m
Colemak 0.0 % 42.6 % 57.4 % 1,131.2 m

:: UP ::% home keys (out of all character keys plus SHIFT and ENTER, but excluding keys operated by thumbs)

Qwerty 20.4 %
Dvorak 33.7 %
Colemak 38.7 %

:: UP ::% keys typed with the same finger as the previous key (excluding repeating keys like ss)

Qwerty 4.5 %
Dvorak 3.8 %
Colemak 3.6 %

:: UP ::% keys typed with the same hand as the previous key (ex: in Qwerty sd or ss are included, but s s is not since you type the space with the other hand)

Qwerty 26.8 %
Dvorak 20.0 %
Colemak 24.6 %

:: UP ::% keys typed with the same hand as the previous key and jumping a row (ex: in Qwerty ev is a row jump – you jump over the middle row – and it’s awkward to type; ef is not a row jump)

Qwerty 10.3 %
Dvorak 5.7 %
Colemak 4.1 %

:: UP ::% keys typed with the same hand as the previous key and in reverse order (ex: in Qwerty df or kj are typed in the easier order pinky-ring-middle-index, whereas fd and jk are in reverse order index-middle-ring-pinky, and harder to type)

Qwerty 15.4 %
Dvorak 11.9 %
Colemak 15.2 %

:: UP ::% keys that need the SHIFT modifier

Qwerty 14.3 %
Dvorak 14.3 %
Colemak 14.3 %

:: UP ::Pairs of consecutive keys typed with the same finger in Qwerty

:_NewLine_ 253 times 0.47 %
de 200 times 0.37 %
tr 158 times 0.29 %
rt 102 times 0.19 %
ol 99 times 0.18 %
un 98 times 0.18 %
q_LeftShift_ 87 times 0.16 %
ce 86 times 0.16 %
“_NewLine_ 81 times 0.15 %
ed 80 times 0.15 %
}_NewLine_ 62 times 0.11 %

:: UP ::Pairs of consecutive keys typed with the same finger in Dvorak

ct 196 times 0.36 %
s_RightShift_ 169 times 0.31 %
db 152 times 0.28 %
l_RightShift_ 137 times 0.25 %
‘_LeftShift_ 133 times 0.25 %
rn 115 times 0.21 %
ls 100 times 0.18 %
}_NewLine_ 62 times 0.11 %
=_RightShift_ 59 times 0.11 %
“_LeftShift_ 58 times 0.11 %
e. 58 times 0.11 %

:: UP ::Pairs of consecutive keys typed with the same finger in Colemak

:_NewLine_ 253 times 0.47 %
ue 237 times 0.44 %
db 152 times 0.28 %
e, 89 times 0.16 %
q_LeftShift_ 87 times 0.16 %
“_NewLine_ 81 times 0.15 %
}_NewLine_ 62 times 0.11 %
]_NewLine_ 46 times 0.08 %
pt 44 times 0.08 %
‘_RightShift_ 41 times 0.08 %
“_RightShift_ 41 times 0.08 %

:: UP ::Key frequency in your text

_Space_ 14067 times 25.94 %
_LeftShift_ 4391 times 8.10 %
e 3239 times 5.97 %
t 2184 times 4.03 %
s 2170 times 4.00 %
r 1890 times 3.48 %
a 1619 times 2.99 %
o 1557 times 2.87 %
l 1530 times 2.82 %
n 1519 times 2.80 %
_NewLine_ 1511 times 2.79 %
i 1372 times 2.53 %
_RightShift_ 1357 times 2.50 %
d 1014 times 1.87 %
f 971 times 1.79 %
c 855 times 1.58 %
u 851 times 1.57 %
m 716 times 1.32 %
p 715 times 1.32 %
( 674 times 1.24 %
) 673 times 1.24 %
. 658 times 1.21 %
623 times 1.15 %
, 573 times 1.06 %
b 571 times 1.05 %
563 times 1.04 %
_ 554 times 1.02 %
= 518 times 0.96 %
: 490 times 0.90 %
q 463 times 0.85 %
y 423 times 0.78 %
h 416 times 0.77 %
w 352 times 0.65 %
> 348 times 0.64 %
g 304 times 0.56 %
v 257 times 0.47 %
x 253 times 0.47 %
k 231 times 0.43 %
< 154 times 0.28 %
/ 125 times 0.23 %
[ 120 times 0.22 %
] 119 times 0.22 %
; 113 times 0.21 %
0 86 times 0.16 %
` 85 times 0.16 %
+ 84 times 0.15 %
1 81 times 0.15 %
{ 80 times 0.15 %
} 79 times 0.15 %
78 times 0.14 %
j 76 times 0.14 %
* 72 times 0.13 %
# 69 times 0.13 %
2 67 times 0.12 %
% 55 times 0.10 %
$ 52 times 0.10 %
3 31 times 0.06 %
6 29 times 0.05 %
8 18 times 0.03 %
@ 17 times 0.03 %
\ 14 times 0.03 %
z 13 times 0.02 %
5 13 times 0.02 %
4 8 times 0.01 %
? 8 times 0.01 %
9 7 times 0.01 %

:: UP ::Frequent pairs of keys in your text

_Space__Space_ 9243 times 17.04 %
_NewLine__Space_ 1233 times 2.27 %
_Space__LeftShift_ 805 times 1.48 %
_LeftShift_( 674 times 1.24 %
_LeftShift_) 673 times 1.24 %
_LeftShift_” 563 times 1.04 %
_LeftShift__ 554 times 1.02 %
se 549 times 1.01 %
,_Space_ 543 times 1.00 %
_LeftShift_: 490 times 0.90 %
el 405 times 0.75 %
er 377 times 0.70 %
in 364 times 0.67 %
_Space__RightShift_ 362 times 0.67 %
or 352 times 0.65 %
_LeftShift_> 348 times 0.64 %
_Space_i 344 times 0.63 %
_Space_s 341 times 0.63 %
te 340 times 0.63 %
e_LeftShift_ 338 times 0.62 %
=_Space_ 332 times 0.61 %
_Space_= 321 times 0.59 %
re 306 times 0.56 %
lf 294 times 0.54 %
)_NewLine_ 281 times 0.52 %
e_Space_ 281 times 0.52 %

actually, I was disappointed: there seem to be no clear advantage of Dvorak or Colemak, wrt QWERTY and, given the popularity of the latter, switching does not seem to be a good idea…

Older Posts »

Blog at WordPress.com.