StumpWM: my new Window Manager

I used Awesome as my window manager for over two years and I really like it. It was my first “tiling” WM (although it’s described as a tiling wm, but more of a floating-tiling mix, see its features and non-features). Besides that, it was really configurable, and I mean it. Your configuration file (.config/rc.lua) may seem like half of the implementation of the WM, because there is defined which layouts are supported, how many tags to use, how to name them, the default keybindings, the mouse actions, etc. (here is mine). Probably, as with many WM, Awesome is too spartan for Gnome/KDE users. But again, it is for people that like minimalism. If you want to give it a try, do it, and do it for a week at least. It’s nice.

If it is soooo good, why did I change it? well, I had some stability issues with it for a while (which ended been problems with Xorg, so it’s not their fault). Also, there are two features I don’t like. First, while bringing lots of flexibility, the config file is usually “cluttered” with code you don’t want to see. As I said, it seems like half of the WM is written in the config file, so you have tons of code defining the default WM behaviour and, after a while, you stop feeling like you are configuring the WM and start feeling that you are patching it. Every new release was an exercise of retrofitting your changes to the new default config file, otherwise you may lose some of the new features bring by the update. Awful. Second, lua. The config file and other parts of the WM are written in lua, which is not part of my personal preferences. I may be biased by my lack of knowledge about programming in lua, or maybe not, even Julien Danjou, the original author of Awesome, has ranted about it.

So, one day I decided to try other tiling WM. I installed stumpwm, i3, ratpoison, and xmonad. I never got pass the first one.

StumpWM is not the most stable WM out there, nor the most lightweight (it requires a CL interpreter), and it has neither a large nor extremely active community (its latest stable release is from March 2010, but the repository is active so you get your code from there). Now, to the good stuff.

StumpWM is tiling, but has some support for floating “groups” (desktops). AFAIK, it doesn’t have the advance automatic tiling layouts of Awesome, so its window placement capabilities are more closely related to GNU Screen or Emacs Frames, but given that I usually have a single app in full-screen mode it doesn’t matter. What really make StumpWM shine is that it’s written in Common-Lisp. It’s at least as configurable as awesome while keeping your configuration file clean. Being Common-lisp, you can write a new function and it will override the previous one (not as powerful as advices in emacs, but close enough). If you don’t know lisp, learning it is very easy. Once you passed the feeling of “why there are so many parenthesis?” and get use to the prefix (+ 3 2) syntax, you will see it’s pure genius.

If you want to give it a try, the best way to do it is following the ArchLinux wiki. Also, take a look at the awesome Stumpwm experience video.

(sort of) Bye, Bye, Dropbox

I use Dropbox, and I (kind of still) think it is a great service, but then I found out that they do server-side encryption, so they have access to all the data. Last Sunday they have tiny security problem which make all accounts accessible using any password.

I have to admit that I do store some important information there, but I did my homework and encrypted it using pgp before uploading. Still, I’m taking the next step: I’ve switched to SpiderOak as my main remote storage/sync service, given that they do client-side encryption, so my data is safe(r). My Dropbox account is going to store anything which I have absolutely problem sharing.

Beamer handouts with notes

This week, while working on a presentation I had to give, I wanted to create a nice handout with extra lines on one side to write some notes. I’ve seen people doing this all the time with other presentation software, so I supposed that it was possible with beamer.

If you read the Beamer user guide (PDF), it mentions modifying the heading to include the handout option, and to add an additional command specify the number of pages per page:

\documentclass[handout]{beamer}
% Other packages...
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]

This produced a PDF with two slides per page (or more depending on what you want), but no notes space anywhere. Some further googling showed a TeX StackExchange entry with the solution, which pointed to this blog post by Guido Diepen.

What you need to do is download this package, and add it to your document preamble, and then modify the pgfpagesuselayout (to include with notes) command like this:

% add this package to your directory (not in CTAN!)
% download it from the link above.
\usepackage{handoutWithNotes}

\pgfpagesuselayout{2 on 1 with notes}[a4paper,border shrink=5mm]

Check out the original blog post by Guido to see examples and more options. Enjoy!

P.d. I forgotted to add with notes the first time, and I didn’t realized that right away. So be aware in case you are as sloppy as I am.

Beamer + Bibtex

I was trying to get Beamer + Bibtex working just like I did with a regular article, just including a frame with the reference. So this is my first attempt:

\begin{frame}
  \begin{small}
    \phantomsection
    \addcontentsline{toc}{section}{\bibname}
    \bibliographystyle{plain}
    \bibliography{bibliography}
  \end{small}
\end{frame}
\end{document}

I didn’t like the size of the entries, and the fact that they only spawn a single frame, so only a few entries were visible. Some Googling and I came with an improved solution:

\begin{frame}[shrink=5,allowframebreaks]
  \begin{small}
    \phantomsection
    \addcontentsline{toc}{section}{\bibname}
    \bibliographystyle{plain}
    \bibliography{bibliography}
  \end{small}
\end{frame}
\end{document}

Then I realized that the citations weren’t included in the bibliography!. Sure, the entries were there but, which one was the “13″? Bibtex showed some nice, and pretty useless, icons instead of the citations. Further Googling unveiled an answer (may be others), using natbib+bibtex (here is a quick reference to natbib):

% before \begin{document}
\usepackage[square]{natbib}
\newcommand{\newblock}{}

Enjoy.

Bye, bye Google Analytics

I know being tracked by Google/Microsoft/Facebook wherever on the net is not something you really want, so I’ve made a couple of changes lately to mitigate that. I decided to get rid of my Facebook account, and it wasn’t easy. They have a creepy amount of data about you, and all this Facebook-enabled sites give information to Facebook. That, and the fact that it is a big time sucker, moved me to delete my account. If you want to know how to do it, read here.

My blog used to have Google Analytics, but now I’ve found a compelling, open-source, alternative: Piwik. It has a very nice interface, and there is a WordPress plugin to easily integrated it. So, if you are visiting this blog, you are no longer tracked by Google Analytics.

Now that I’m talking about privacy, I just want to add that I do use Google’s search engine, buzz, gmail, reader and picasa. Google search results are the best, so I don’t think I will be switching to something else anywhere soon; I’m alternating buzz and twitter as my “social” networks, I don’t like the alternatives to picasa or reader, so I’m sticking to them. And yes, I trust Google more than I trust Facebook.

Twitter in emacs (twittering mode)

Edit: As pointed out by Seth in a comment, you don’t need to set your username nor password if you are going to use oauth and the master password, as I’m doing. My configuration snippet now reflects that.

I started to get interested on Twitter a few weeks ago, after some time having my account abandoned. I’m using Twittering mode, which is pretty nice: has support for oauth (twitter.el don’t have that, so don’t bother trying to use it), supports multiple url shorteners (I use bit.ly), easy navigation, tons of functionalities (check the EmacsWiki for a comprehensive list).

Get it from github:

git clone git://github.com/hayamiz/twittering-mode.git

Today I found this blog post, which explains how to avoid the oauth request every time you start your emacs:

(setq twittering-use-master-password t)

Of course, EmacsWiki also explains that but is burried inside a comment, so I didn’t read it… This is my configuration:

(require 'twittering-mode)

(eval-after-load "twittering-mode"
  '(progn
     (twittering-icon-mode)))

(setq twittering-timer-interval 36000     ; I don't want auto-refresh
      twittering-tinyurl-service 'bit.ly
      twittering-bitly-login "XXX"
      twittering-bitly-api-key "XXX"      ; find it on bit.ly settings
      twittering-use-master-password t
      twittering-url-show-status nil)

Nice Python Gems

EDIT (9/18/2011): There is another way of having a default value in python dictionaries, and it’s using the defaultdict class in the collections module (python 2.5).  Here are the docs.

I was checking my old bookmarks and I stumbled upon these two blog posts: Gems of Python by Eric Florenzano and Python gems of my own by Eric Holscher.

Did you know about setdefault for dicts? I’ve found myself more than once using a dict as a multimap and I always felt that there must be a better way of doing it than this:

dct = {}
items = ['anne', 'david', 'kevin', 'eric', 'anthony', 'andrew']
for name in items:
    if name[0] not in dct:
        dct[name[0]] = []
    dct[name[0]].append(name)

And I was right, from Eric Florenzano’s post:

dct = {}
items = ['anne', 'david', 'kevin', 'eric', 'anthony', 'andrew']
for name in items:
    dct.setdefault(name[0], []).append(name)

I knew it…

Things I keep forgetting: Gnus reply key bindings

edit: added mail-forward

Summary mode:

While reading a mail, you could reply to it using the following commands:

key command
r gnus-summary-reply
R gnus-summary-reply-with-original
S w gnus-summary-wide-reply
S W gnus-summary-wide-reply-with-original
C-c C-f gnus-summary-mail-forward

Message mode:

If you are writing a regular reply and then you decide to make it “wide” use:

key command
C-c C-f w message-insert-wide-reply