Eclectic

About programming and maybe more…

Archive for the ‘Ubuntu’ Category

Getting ttwebtop to work on Ubuntu

Posted by tread on April 28, 2008

I use tarantella at work, but ttwebtop doesn’t work by default in Ubuntu. After starting up, it isn’t possible to type at all in the text boxes. To fix that, you need to add the following to your bashrc (or init script of choice)

export XKEYSYMDB=/usr/share/X11/XKeysymDB

That should work.

Posted in Linux, Programming, Ubuntu | Leave a Comment »

Ubuntu 8.04

Posted by tread on April 26, 2008

I finished downloading Hardy Heron today – and I’ve opened every cd case I have, tested every unlabeled cd (and I have lots of those) which didn’t look like it was used, and I still haven’t found a single blank cd. This sucks, I was looking forward to installing it today.

Posted in Humour, Ubuntu, geekylife | Leave a Comment »

Changing emacs text window font

Posted by tread on September 1, 2007

Just continuing on the previous post.

Add:

Emacs.Font: fixed

to ~/.Xdefaults

Then execute:

$ xrdb -merge ~/.Xdefaults

There.

Posted in Linux, Ubuntu | Leave a Comment »

Changing the menubar font in xemacs

Posted by tread on August 31, 2007

The default menubar font in Ubuntu Feisty sucks – it’s huge and ugly. To change it, add the following to $HOME/.Xresources

Emacs*menubar*font: -*-clean-medium-r-*-*-12-*-*-*-*-*-*-*
Emacs*menu*font: -*-clean-medium-r-*-*-12-*-*-*-*-*-*-*
Emacs*popup*font: -*-clean-medium-r-*-*-12-*-*-*-*-*-*-*

and execute

$ xrdb -load ~/.Xresources

Restart xemacs and voila. I should have done this ages ago!

Posted in Linux, Ubuntu | 1 Comment »

Howto setup lxr on Linux (Ubuntu Feisty)

Posted by tread on August 25, 2007

The purpose of this post is to describe how to setup lxr for personal use on Linux – I use Ubuntu Feisty on my machine. Most of the commands need to be run as root, so you may want to do:
$ sudo bash
right at the beginning. Or you can prepend sudo to each command.

Setting up apache on Ubuntu Feisty.
# aptitude install apache
# /etc/init.d/apache start
Note: I don’t think I did any other settings really, but I had setup apache earlier – don’t remember now. I’m including it here for completeness. I am only accessing my webserver as localhost, and have not changed anything anywhere.

Setting up lxr on Ubuntu Feisty.
# aptitude install lxr

This gets lxr 0.3.1-4 – you need to have universe enabled in /etc/apt/sources.list. If you have enabled just now for the first time, then also execute ’sudo aptitude update’ before installing lxr. And that ends the part about installing lxr. The compile-by-hand folks are just masochistic :) .

Add the following lines to /etc/apache/httpd.conf at the end:
# Linux Cross Reference Stuff
Alias /lxr /usr/share/lxr
<Directory /usr/share/lxr>
Options All
AllowOverride All
</Directory>

Create a file /usr/share/lxr/http/.htaccess which contains:
<Files ~ (search|source|ident|diff|find)$>
SetHandler cgi-script
</Files>

I now restart apache. Don’t know if this is essential, I guess reloading should be enough. But hey, this is my personal machine, no harm done :) .
# /etc/init.d/apache restart

Since I only want to access the cross reference locally, I am not changing any settings in lxr.conf. At least, not yet. You can check /usr/share/doc/lxr/README.Debian.gz for more details.

Now we setup the cross reference.
1. Create /usr/share/lxr/source if it doesn’t exist.
2. Create a directory 2.6.22 inside it – this is the linux version I am cross referencing.
3. Untar the kernel source inside this directory in a subdirectory ‘linux’ .. i.e., you now have /usr/share/lxr/source/2.6.22/linux with the source in the linux directory.
4. Add a line with contents ‘2.6.22′ (without the single quotes) in /usr/share/lxr/source/versions
5. ln -s /usr/share/lxr/source/2.6.22 /usr/share/lxr/source/defversion
6. cd into /usr/share/lxr/source/2.6.22 and execute ‘genxref linux’
7. Make a cup of tea.
8. 10 minutes later (since you must never hurry a good cuppa) visit http://localhost/lxr/http/blurb.html
9. You’re done.

Note: I have not described how to setup the glimpse database, but that is documented in the lxr readme as well. You should read that anyway. Incidentally, generating the glimpse database would be step 8.a, just after the ‘genxref linux’.

Posted in Linux, Programming, Ubuntu | 11 Comments »

Change is horrible …

Posted by tread on July 20, 2007

or to put it differently, I’m using Dvorak.

On Ubuntu you do this by executing:

xmodmap /usr/share/xmodmap/xmodmap.dvorak

At this point you enter hell.

Posted in Linux, Ubuntu | Leave a Comment »

A simple timezone converter

Posted by tread on June 27, 2007

Screenshot-TZConvertSo I wanted to fool around in netbeans, swing and java – here is the outcome. It’s a simple program which lets you set the date/time in one timezone, and see the corresponding date/time in another timezone. I needed this – am not always online but still need to figure out the time in different zones. Invocation is simple, unarchive the tar.gz and then execute: java -jar TZConvert.jar

TZConvert.jar is in the dist directory. You can download it here. The program is GPLed for extra goodness :) .. note that it is developed on java 1.6. If you are using Ubuntu Feisty you can now do an:

aptitude install sun-java6*

(I forgot the exact package name!) My original plan was to make this a Thunderbird plugin, but it appears I cannot write plugins in java for Thunderbird.

Posted in Java, Linux, Programming, Ubuntu | Leave a Comment »

Ion2 – window manager for Linux

Posted by tread on June 7, 2007

From eye candy to ion2 – it’s a big change. But now that I am using this as my window manager, it feels just right. Admittedly, it’s nothing to look at (and I mean nothing – each window is full screen in a tab of its own) – but once you set up the keybindings, it’s fast! and really more useful. I’ve setup alt-left and alt-right to move between tabs, and find that most of the time, I do not have to use the mouse at all. I get more screen space, and now that I have setup thunderbird and firefox to be more keyboard friendly – quicker too. The only real problem is when I am playing Travian :) – have to use the mouse then. Here is the ion2 config I’m using, it’s been stripped down to the basics at the moment. Will get added to as I learn more stuff or develop more specific requirements :) .

Posted in Linux, Ubuntu | Leave a Comment »

Valgrind and pthread_create – memory leak?

Posted by tread on February 26, 2007

Valgrind can be used for a number of things, but currently I’m interested in its memory leak checking ability.

Checking memory leaks with Valgrind

Compile your code (preferably with -g) and then execute it as follows:

valgrind –leak-check=full <program_name> <args>

(For more options, see the man page)

You will get something like this:


==17645== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 11 from 1)
==17645== malloc/free: in use at exit: 400 bytes in 1 blocks.
==17645== malloc/free: 1 allocs, 0 frees, 400 bytes allocated.
==17645== For counts of detected errors, rerun with: -v
==17645== searching for pointers to 1 not-freed blocks.
==17645== checked 58,860 bytes.
==17645==
==17645== 400 bytes in 1 blocks are definitely lost in loss record 1 of 1
==17645== at 0x4021396: malloc (vg_replace_malloc.c:149)
==17645== by 0x80483A5: one (test.c:6)
==17645== by 0x80483CC: main (test.c:12)
==17645==
==17645== LEAK SUMMARY:
==17645== definitely lost: 400 bytes in 1 blocks.
==17645== possibly lost: 0 bytes in 0 blocks.
==17645== still reachable: 0 bytes in 0 blocks.
==17645== suppressed: 0 bytes in 0 blocks.
==17645== Reachable blocks (those to which a pointer was found) are not shown.
==17645== To see them, rerun with: --show-reachable=yes

If you compiled with -g, you should even see the line number (test.c:6)

I then experimented with multi-threaded programs – valgrind shows the correct memory leak (i.e., my intentional leak multiplied by number of threads). However, I was surprised to see an additional leak message in the output:

==17698== 272 bytes in 2 blocks are possibly lost in loss record 1 of 1
==17698== at 0x40206D5: calloc (vg_replace_malloc.c:279)
==17698== by 0x400FA87: (within /lib/ld-2.4.so)
==17698== by 0x400FB4B: _dl_allocate_tls (in /lib/ld-2.4.so)
==17698== by 0x403AB68: pthread_create@@GLIBC_2.1 (in /lib/tls/i686/cmov/libpthread-2.4.so)
==17698== by 0x80486A7: main (test.c:43)

This leak value is constant, i.e., for 1 thread I get 136 bytes potentially lost. Initially I thought it was a memory leak in the pthread library – but a little googling revealed that it could be memory allocated for thread local storage. Since the function is _dl_allocate_tls, this seems fairly probable. Wish I knew for certain though – anyone care to comment?

Posted in Linux, Programming, Ubuntu | 7 Comments »

Converting flac files to ogg

Posted by tread on February 23, 2007

For some reason, whatever I saw on the net used bash – this has a lot of pitfalls, mainly spaces in names. Here is a better command:

find . -name "*flac" -exec oggenc -q 7 {} \;

-q 7 sets the quality, 10 being the highest.

Posted in Linux, Ubuntu | 1 Comment »