Archive for category Linux
Getting ttwebtop to work on Ubuntu
Posted by tread in Linux, Programming, Ubuntu 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.
Finding duplicate files using md5sum
Posted by tread in Linux, Programming on November 16, 2007
Been a while since I posted something.
Anyway, as usual I’m driven by need. I’ve got zillions of dupes on my hard disk, thanks to my wife’s unique file management techniques – I hope she doesn’t read this blog entry!
And I didn’t like Fslint etc., wanted something simpler. So here is something I think will work fine – will try to poke holes in it before I actually test it out of course!
find . -type f -name "*" -exec md5sum {} \; > md5all.txt
cat md5all.txt | awk '{print $1}' | sort | uniq -d > dupes.txt
cat dupes.txt | while read line; do echo "--------------------"; grep $line md5all.txt; done
Should be fine I think.
Changing emacs text window font
Just continuing on the previous post.
Add:
Emacs.Font: fixed
to ~/.Xdefaults
Then execute:
$ xrdb -merge ~/.Xdefaults
There.
Changing the menubar font in xemacs
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!
Howto setup lxr on Linux (Ubuntu Feisty)
Posted by tread in Linux, Programming, Ubuntu 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’.
I’m easily entertained
While browsing MSDN help (yep, I have to do some Windows related development
) – here is what my search turned up:
Incidentally, what I am trying to find out is this:
Windows reports network interface statistics through WMI (Win32_PerfRawData_Tcpip_NetworkInterface to be precise).
Now the key here is the Name, which is totally unlike what ipconfig reports. e.g., ipconfig, task manager will report ‘Local Area Connection 2′, but the name in the instance of Win32_PerfRaw.. will be Intel(R) Local Area Connection_2 – Packet Scheduler Miniport’.
So how am I supposed to show the correct name for the interface if I’m using WMI? The class doesn’t contain a MAC address or anything, the Name is the key! Aargh, what do I do? See percentage pattern matched? Stupid! And sometimes the _ can be replaced by #, and () by [] etc.
Leave a note if you can help me out here, or even if you are frustrated over the same thing
Change is horrible …
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.
A simple timezone converter
Posted by tread in Java, Linux, Programming, Ubuntu on June 27, 2007
So 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.
Ion2 – window manager for Linux
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
.
/proc on Linux
Posted by tread in Linux, Programming on May 21, 2007
Trying to understand the different values in /proc .. 2.6 kernel. This (linux_proc.jpeg) is by no means complete – I’m still working on it. I suppose I should use some other format than freemind, but I want to eventually group different files under /proc according to type – e.g., all io device information under one node. Hopefully it will still make sense then!
Edit: the /proc/<pid>/stat seems to have changed from 2.6.10 to 2.6.20. Will post an updated and corrected document soon.