A belated resolution for the year 2009

I know this is a bit late to make resolutions at this moment, but I still have time, don’t I? These are the things I really want to do and achieving any of them will make me look back this year with contentment. The aims are somewhat tuned down in case I fail shamelessly.

  • reduce some weight, say, ten pounds. I am fat and I know it. I’ll start with swimming and improve my breast stroke.
  • learn to configure Linux servers on Debian environment. I have to break the mysteries wrapping around the server configurations.
  • finish my Ph.D. I know it is not easy, but I have to finish what I have started.
  • drive the traffic to this blog over 200 unique visitors per day.
  • make some extra money. This has never been my goal up till a year or two ago. I realize I can’t keep cynical.
  • Sleep early (12!) and brush my teeth twice. Morning brushing is not enough.
  • buy a mobile phone if I don’t go to the U.S.A this year.
  • read a few good books, especially those about political philosophy.
  • set up a social-networking website and see what I can do about it.
  • be a little adventurous. Take a little risk at a time. I am paranoid and overly cautious sometimes.
  • expect less from others and expect more from myself

Enabling Webcam for HP DV2000T laptop under Lenny

Owning a slightly dated rig actually has one great benefit — the software for it is mature enough that not too much hacking or hair-tearing is needed. This is exactly the case for my two-year-old HP Pavilion DV2000t laptop. When staring installing Debian on it, I found the hardware is well supported.

Here is how to compile drivers for the webcam of this laptop.

DOWNLOAD THE LATEST SOURCE

Get the source from LinuxTV

MAKE AND INSTALL

Make sure build-essential is installed. Then just extract the file and make, make install.

USE IT

Check to see if there is a usb video device

sudo lsusb -v

And use Cheese or any other video capable programs to use it.

Update

Its website says “Linux 2.6.26 and newer includes the Linux UVC driver natively. You will not need to download the driver sources manually unless you want to test a newer version or help with development”, and machiner confirms “linux-uvc, sure enough, completely unnecessary now. You shouldn’t have to do anything to get your web cam working other than installing a program so you can see it”.

So it is even easier to enable the webcam under Linux .

Publish blog posts under VIM

I was looking for a blog publishing tool under Bash environment in Linux, and my search brought even better results — vimpress. It is VIM powered blog publishing tool.

There have been many introductions to this wonderful VIM plugin, but allow me to repeat the information just for my own record.

WHERE TO DOWNLOAD

This plugin is created by Adrien Friggeri, and you can get it from his blog

HOW TO INSTALL

Extract vimpress.tar.gz to .vim folder under your home directory

HOW TO CONFIG

Open ~/.vim/plugin/blog.vim, go to the Settings section and feed the necessary information

enable_tags = 1
blog_username = 'user'
blog_password = 'password'
blog_url = 'http://thinkweird.info/xmlrpc.php'

HOW TO USE

In VIM’s command line mode, key in the following commands to write and publish

BlogNew – write new article
BlogSend – publish your article
BlogOpen id – edit your article
BlogList – lists all articles

THE RESULT

This post is published under vimpress.

AFTERTHOUGHTS

One need to use very basic html codes such as inserting links, codes or quotes to make it work better. I mostly use [a href=”url address”]url address[/a], [!–more–] and [pre] in my blog posts (change the square brackets into sharp brackets for html codes).

For headings I just capitalize them.

Update: This plugin works perfect par one thing — if I add some above mentioned html codes, then it can only part of the post when re-opening the post for editing. It seems to be able to load right before where the the html appears. I’ll contact the author about this bug.

Update: the rest of the post following [!–more–] is regarded as comments, thus not shown. I’ll try to find some excerpt auto generator.

Fine-tuning Debian Lenny Desktop

Linux is never perfect. One has to tweak it hither and tither to make it comfortable for daily use, to make it YOUR OS. In this post are kept the tweaks, hacks and fooling around recorded on my Debian journey.

SET ICEWEASEL AS DEFAULT BROWSER

In Gnome’s System menu, select Preferences > Preferred Applications and choose Iceweasel as the default browser. Running the following command in terminal also does the same thing.

gnome-default-applications-properties

Somehow, Debian’s built-in command update-alternatives --config x-www-browser does not work for this purpose

FIX MESSED UP GNOME SESSIONS

Gnome’s System–Preference–Sessions is a good to tool to decide which background processes to run or stop. However, if you accidentally chose “remember currently running applications”, things can get nasty as many unwanted programs will keep come back with persistence. After fighting with save sessions a few times, I decide to do it my own way — delete .gnome .gnome2 .gnome_private folders under my HOME directory. After logging back, the whole world is in peace.

How to mount Samba share under Linux

I have a West Digital MyBook box serving as a file server for my home LAN. I can locate and use its samba share under Nautilus sometimes, but for some unknown reason, the share doesn’t show up occasionally. I decided to mount it via /etc/fstab and put it into /media, so that I can directly access it on Gnome desktop.

First, install smbfs package, I prefer wajig as my package maintainer.

wajig install smbfs

Then put this line into /etc/fstab. I don’t use a password for MyBook samba share, and I indicate null password and username to it:

//192.168.1.100/PUBLIC /media/smb smbfs username="",password="" 0 0

I refer using IP address instead of the server name to avoid the trouble of finding the WINS. The empty quotes behind the username and password options are feeding the null information to smbfs, telling it authentication is needed.

However, this does have a problem: the mounted share does not provide read/write permission for normal users. And I later discovered: even smbfs package is not necessary because the de facto cifs will do the same job and has better features.

Then what is the difference between smbfs and cifs? I read this from Linux CIFS Client Guide:

1) configuration
Unlike smbfs and smbclient, configuration for the cifs vfs does not depend on smb.conf.

2) mount syntax:
mounting to older servers may require specifying two additional fields beyond those which smbfs required:

3) Default UID/GID/mode for remote files
The default mode can be overridden by mount options “file_mode” and “dir_mode”for these server types.

The most important difference is to override the default UID/GID mode. I guess this holds the key to the no-rw-permission problem for a share mounted using smbfs. So eventually I came to this entry in my /etc/fstab

//192.168.1.100/PUBLIC /media/smb cifs dir_mode=0777,file_mode=0777,workgroup=MSHOME,gid=smb,uid=tux,rw,username="",password="" 0 0

make sure you have created a smb group and added the current user to that group by doing

$ sudo addgroup smb
$ sudo adduser $USER smb

Alternatively, if you want to use a samba share without all the work, just use “Place” menu under Gnome, choose “Connect to a server”, then select “Windows share” from the “Server type” drop-down menu and input the necessary information.

But mounting a Samba share directly to file system has one advantage: many programs will be able to run and open those shared files as if they were located on a local drive. Using the connect to server mode does not have this advantage.

Reference: https://wiki.edubuntu.org/ComprehensiveSambaGuide