Praveen’s Journal

June 29, 2006

Bought new virtual server

Filed under: Debian, Free Software, GNU/Linux, Hardware, Internet, Money, Networking, Web Publishing — Praveen Kumar @ 5:18 am

I have bought a new virtual server from VPSLink a couple of days back. It runs OpenVZ for virtualization. It provides me with 20GB of hard disk space, 512MB of RAM running on a Intel Xeon processor. Looks like a bit less for an extensive server. I have associated the server with one of the domain names that I own, discs.in. Lately, I will be moving my site praveen.ws to that server as well depending on how well it scales. Right now, I have installed Debian Sarge on the server. I run ssh, vsftpd, cfingerd, apache2, exim4 and squirrelmail. No plans for telnet, SSL enabled services. Still am confused if I should have bought it or not. But I bought it in a huge discount.

June 27, 2006

Pattern clock - Wake up the hard way!

Filed under: General, Humor — Praveen Kumar @ 3:34 am

For all those who are not able to get up from thier morning sleep where alarms are no use for them, there is a new product called Pattern clock. This clock won’t turn off the alarm unless you repeat a Simon-like pattern of lights by pressing a series of buttons. This alarm clock will defintely wake you up and the side effect would be driving you crazy as a part of the process. I gotta buy one for me!

PS: I heard from some sources that people just pull the power of these types of clocks to stop them from screaming. There were also some instances of breaking the clock in heights of frustation.

SSH through HTTP proxy

Filed under: Free Software, FreeBSD, GNU/Linux, Networking, Tips and Tricks — Praveen Kumar @ 12:57 am

When you are behind a HTTP proxy and you want to SSH to a server on the Internet, the best choice is to use corkscrew. After installing corkscrew in your PATH, the SSH command goes like this.

# ssh -o "ProxyCommand corkscrew <Proxy server> <Proxy port> %h %p" <SSH server>

June 26, 2006

A pre-processor macro taking variable length arguments

Filed under: Tips and Tricks, programming — Praveen Kumar @ 6:53 am

In C, sometimes you want to write a C pre-processor macro that takes variable length arguments. Let me give you a practical requirement example. The requirement is that a debug log function needs to be written that takes format string and the variables as arguments and produce a debug log with the filename, line numbe and function. It is also desirable that the function/macro argument is kept minimal so that you need not pass some unwanted stuff to the call. I think there is no other easier way than a variable length macro on doing this. The macro would look something like this.

#define FOO_DEBUG( format, ... ) bar_debug ( __FILE__, __LINE__, __FUNCTION__, format, ## __VA_ARGS__ )

A C function bar_debug can then be written with the fingerprint that matches above and the variable arguments can be parsed in the traditional way.

The key hint here is the token pasting of __VA_ARGS__

June 24, 2006

Gnome startup failure + loads of work to do = Xfce4

Filed under: Debian, Desktop Environments, Free Software, GNU/Linux — Praveen Kumar @ 1:12 am

Gnome is my all-time favourite desktop. I use Gnome 2.14 on my Debian SID. Yesterday night I did an upgrade and I think due to some of the packages that were pulled in yesterday, my Gnome won’t start today morning. When I logged in from the GDM console, nothing came up. I was not able to figure out what was happening. I had a lot of things to do for the day. So far, I didn’t have any other desktop in my system. So, I just quickly installed Xfce4 as I have heard a lot about it in the recent past. Well, Xfce4 looks really good. I felt that I am on a Gnome variant. I might be using it for some more time and check out how cool it is. So far so cool!

Naming your network interfaces in linux using udev

Filed under: Debian, GNU/Linux, Hardware, Networking — Praveen Kumar @ 12:14 am

Normally when people have more than one network interface on their PC or laptop and using linux, they may face a problem of network interface names eth0 and eth1 getting swapped betweeen the the interfaces on every reboot. The fact that which interface is getting what name is not predictable under normal scenario.

I also faced the same problem with my laptop that had two interfaces. One is the Marvell Yukon Gigabit ethernet adapter and the other one is the Intel Pro Wireless 2200. Each time of the boot, I will randomly get eth0 for Marvell Yukon and vice-versa. This makes it difficult to make interface name specific configurations.

As the modern 2.6.11+ kernels use ‘udev’ for loading the modules, the naming of the interfaces could be done by setting an udev rule. To achieve this, create a file /etc/udev/rules.d/010_netinterfaces.rules and add the following contents to it.

SUBSYSTEM=="net", SYSFS{address}=="MAC address of eth0", NAME="eth0"
SUBSYSTEM=="net", SYSFS{address}=="MAC address of wlan0", NAME="wlan0"

Please note that the MAC address should contain lower case alphabets for hexa-decimal digits a to f. Otherwise, this will not work properly.

You can name the interfaces as however you want and extend the above example to the your scenario.

Powered by WordPress