Move CTRL with colemak

I’m trying out the colemak keyboard layout. It seems interesting, but it takes some effort. There was one problem, though: colemak removes the capslock button, and so my Xmodmap settings to switch capslock and CTRL didn’t work anymore, which is a bother since I need it for emacs.

After some trial & error I managed to find how it’s done:

remove Control = Control_L
keycode 66 = Control_L
add Control = Control_L

Of course, keycode might be something else depending on your keyboard, you can determine what it is using xev.

Looping through a dict

It seems I’ve never looped through a dict in Python before. I just assumed that it would work the same as with a PHP associative array, since the syntax of creating one is fairly similar. I just thought this would work:

for key, value in somedict:
    print key, ': ', value

But I guess not.

You have to call the items or iteritems functions on the dictionary, where iteritems is faster, but also doesn’t allow certain actions that items might:

for key, value in somedict.iteritems():
    print key, ': ', value

I was trying to loop through a dictionary in a django template like so:

{% for key, value in somedict %}
  {{ key }}: {{ value }}<br/>
{% endfor %}

Which, since it just skips over most errors, generated this response:

:
:
:
:
:

Which I only later found out was caused by an error when trying it in some regular python code. It should be:

{% for key, value in somedict.iteritems %}
  {{ key }}: {{ value }}<br/>
{% endfor %}

I feel like this shouldn’t have happened to me. Oh well, now I know…

Why?!

I don’t really use wordpress, I was/am using IkiWiki for my blogging and other wiki needs, but org-mode can’t be beaten when it comes to generating syntax highlighting. I think I might (have to) try this out for a while.

echo 'hello, world!\n';

for ($i = 0; $i < 10; $i++) {
  echo '$i\n';
}

ntd progress #1

So I’ve only had a little bit of time to work on ntd. But at least I did do something, though nothing major. I got rid of the gets() function by replacing it with getline(), I know this is a GNU extension, but it’s apparently recommended and for now I don’t think anyone other than myself is using it, and since I only use archlinux I’m in minimal danger of incompatibilities.

I’m still getting some errors with valgrind, but if I eventually figure them out I will be able to fix it.

Maybe tomorrow I can finally start adding another command.

New toudou

So, I’m trying again… After feeling I couldn’t achieve what I wanted with toudou or toudou2 through 5, I’m starting from scratch again with ntd (New toudou).

This time I’m first going to focus on creating a shell in which I can perform the actions that I want. After that I will start looking at/thinking about user interfaces again.

Right now it’s only a tiny shell with some big holes in it (usage of gets, for example) that need to be fixed, and it only knows help and exit for commands, but it’s a start, again.

The code for it is here, though I can’t recommend looking at it yet, it might burn your eyes out.

urxvt Rainbow

I have used gnome-terminal and terminator, and they are nice. But they are big and bulky. urxvt is nice and small, but it has an ugly default color scheme for at least Fedora 12 and Ubuntu 9.10.
So I wanted to start using urxvt because it seems smaller and faster, but it doesn’t have any menu structure to speak of to make it simple for me to edit the color scheme. Which is fine, it just means I have to find out where the settings are located.
Continue reading