Archive

Author Archive

Midnight Commander and Cursor Beyond End of Line

September 7th, 2009 subogero 2 comments

Two weeks ago I had a short glance at the Midnight Commander’s Roadmap and found that 4.7.0-pre2 was to be relased end of August. Looking through the tickets what do I see? Cursor beyond end of line in the built-in editor.

I’ve just arrived from the world of those glassed openings on walls, which should illuminate the inside of buildings during the working hours. In this world, I was obviously the victim of evil (and rude) monopolies, that should not be named in polite company. But even these despotic dictatorships have advantages. The oppressed subordinates may enjoy the cursor going beyond the end of line in all text-editors that are worth mentioning (step forward, Far-manager).

Having arrived in the free world, I received one nasty shock after another every time I wanted to go up two lines to the same position in text-editors. If the line in between was shorter or empty, the cursor endeavoured to jump back and stay there. Just like… erm… I have to say it, Notepad.

Gedit is like that. Emacs is like that. Midnight Commander’s editor is like that. Or has been, until now.

Having returned from a week long cycling trip from the Italian Alps, my life has become completely meaningless, at least in the eye of the Master Programmer, as in the absence of computers I had to abstain from programming for more than the official limit of 3 days. To restore my form, the first thing was to download mc-4.7.0-pre2.

Binaries are not provided, only sources, so I had to configure the makefile and compile it. The configure script disliked my Ubuntu-installation in a marked manner. It raised its eyebrows, pursed its lips and refused to produce any usable makefile. Some obscure gmodule-2.0 was missing. But after a considerable amount of googling, synaptic-package-managing and trying I had a running MC with the editor allowing the cursor to go beyond the end of line.

For the benefit of the general public I now kindly publish the major milestones that helped me achieve this majestic goal:

sudo apt-get install build-essential
sudo apt-get install libglib2.0-dev
sudo apt-get install libslang2-dev
sudo apt-get install gettext
sudo apt-get install libtool
./autogen.sh
./configure --with-samba
make
sudo make install

Bulk Rename – Replace Space with Underscore

August 26th, 2009 subogero Comments off

A small script to perform bulk renaming of files, replacing spaces with underscores and exotic letters with sanitized versions.

Save this link as /usr/bin/s2u.

#!/bin/sh
ls -1 | while read -r FILE; do
  mv -v "$FILE" `echo $FILE | tr ' áéíóöïúü' '_aeiooouu'`;
done
Categories: posts Tags: , , ,

Firefox Hotkeys

August 16th, 2009 subogero Comments off

I always found Tab-based programs like Firefox awkward to use, as I could not change between or close tabs with the known Alt-Tab, Alt-F4 hotkeys. Until now.

Check out this extremely useful post.

New tab             Ctrl-T
Close tab           Ctrl-W
Undo close tab      Ctrl-Shift-T
Next tab            Ctrl-Tab
Last tab            Ctrl-Shift-Tab
Bookmark tab        Ctrl-D
Select address bar  Alt-D
Select search bar   Ctrl-K

Never have to ckick again in Firefox !!! Erm, on second thoughts…

Categories: posts Tags: , ,

Ubuntu vs XP Reboot Time

August 15th, 2009 subogero Comments off

I’ve just measured full reboot times with Ubuntu and Windows XP on the same machine.
Bonus: reboot times with Ubuntu Jaunty on Asus UL20A laptop (its BIOS is extremely fast too).

                             Ubuntu       XP  |  Ubuntu ASUS UL20A
----------------------------------------------|-------------------
boot from BIOS until login     26 s     29 s  |                17s
boot from login until ready    16 s     39 s  |                15s
reboot until BIOS              19 s     35 s  |                12s
----------------------------------------------|-------------------
overall reboot without BIOS    63 s    103 s  |                44s

No comment.

Categories: posts Tags: , ,

Manual Pages

August 15th, 2009 subogero Comments off

The day has come, and I’ve started writing documentation, but this time Linux style. In other words, I’ve just created the manual pages for my Newbie-projects, “ogc” and “go“.

Some important points I’ve learned from the Linux Man Page Howto:

Manual pages are written in the “groff” (GNU troff) markup language. Just start from another program’s man page, it’ll be easy.

Manual pages of user-commands shall be installed into “/usr/share/man/man1″

The manual page of user-program “foo” shall be called either “foo.1″ or “foo.1.gz” (gzipped).

To read foo’s manual page, type

man foo

It’s that easy.

Categories: posts Tags: , ,

Automount an NTFS Partition

August 14th, 2009 subogero 4 comments

As I have a Windows-Ubuntu side-by-side installation with a boot menu, I still store a lot of data on the NTFS partition. I know, I know…

Ubuntu endeavours to give satisfaction, so you can see all detected storage devices in the “Main Menu” under “Places”. Click your NTFS partition, and it’s mounted automatically to /media/disk/.

But if you want to access these files from another program before clicking it in “Places”, it does not work. So I googled “automount ntfs partition” and there it was.

I added the following line to “/etc/fstab”:

# <file system> <mount point>   <type>  <options>                <dump>  <pass>
/dev/sda1       /media/disk     ntfs    users,defaults,umask=000 0       0

I rebooted. I did not work. It took me a few days until I realised one cannot mount something in a non-existent directory. When you click your NTFS partition in “Places”, Ubuntu not only mounts it, but creates the mount-point directory “/media/disk” first. But just adding something to “/etc/fstab” does not create directories. People would talk. Eyebrows would be raised.

After a

sudo mkdir /media/disk

and a reboot it worked perfectly.

This must be ridiculously obvious to a Hacker, but the post may help a Newbie or two like myself.

Categories: posts Tags: , ,

Perfection in Design

August 11th, 2009 subogero Comments off

From esr’s book “The Cathedral and the Bazaar“:

Antoine de Saint-Exupéry (who was an aviator and aircraft designer when he wasn’t authoring classic children’s books) said:

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Categories: posts Tags: , ,

Gnome Main Menu Icon Size – Solved

August 10th, 2009 subogero Comments off

The problem with the Main Menu’s huge icons and spacing is solved. I’ve just found the tool called GNOME Color Chooser. Go to the “Icon” Tab.

sudo apt-get install gnome-color-chooser
Categories: posts Tags: ,

There is Tao in Windows start

August 7th, 2009 subogero Comments off

We all remember from the Tao of Programming when the master programmer avoided an embarrassing question about the presence of Tao in DOS. The good news is there is definitely Tao in Windows (but not too much).

It’s called “start“.

It’s not the Start Menu, but a command-line keyword, obviously. I’ve come to appreciate its beauty only after having spent some weeks with Ubuntu. I kept looking for something similar on the internet, and all I found was the “gnome-open” command. Still, the blog-post has ecstatic comments.

I tried “gnome-open”. It opened any file or URL with the associated program as an independent process. So far so good. Until I tried to start a program with “gnome-open”. No way. This was the moment I discovered Tao in Windows’ “start”. Let’s see:

“start” without arguments will open a new terminal window.

“start” with a CLI program as an argument will open it in a new fully independent terminal window.

“start” with a Windows program as an argument will open just that in a fully independent window.

“start” with a file or URL as an argument will open it with the preferred application.

“gnome-open” can do the latter, but not the first three options. So I decided to write my Linux-version of “start” called “go”. Please go to the page.

Back to Windows. The famous “start” has a significant drawback. As in Windows nearly none of the applications are on the PATH, start’s capabilities are just a tiny bit limited. Not so with “go”.

Panel-Launcher for a Root-Terminal

August 7th, 2009 subogero 4 comments

Another not-so-trivial problem with a beautifully simple solution within half an hour. First I created a panel launcher and started hacking its Command Line.

sudo gnome-terminal

Wrong. Nothing happens.

gnome-terminal -e su

Looks better, a terminal-window appears, but disappears again after entering the password. Should have remembered. If a command is specified, bash does not become interactive, closes when the command is completed.

sudo bash

That’s it, baby!

Categories: posts Tags: ,