Sunday 18 October 2009

Notepad-compatibility for copy and paste in vim and gvim

Unfortunately, even us, Linux die-hards, get used to other OS conventions, such as copy-pasting with Control-C and Control-V. Maybe because in some other OS, by design, you need to spend hours copying and pasting.

In any case, if you want your Vim and GVim on your Linux box responding to Control-C and Control-V for these operations you need to map these key combinations to their internal counterparts, "+y and "+gP respectively.

In order to achieve this, you need just go to your home directory and add to the .vimrc file there the following three lines:

nmap <C-V> "+gP
imap <C-V> <ESC><C-V>i
vmap <C-C> "+y

A final piece of advice: use it with care! Copy/paste operations do not increase the amount of information but increase its size.

Friday 2 October 2009

Five levels of purpose

I copy from another source because I want to keep them handy. Here are the five levels of purpose:

  1. Check present position
  2. Set goals
  3. Affirm priorities
  4. Forecast future position
  5. Create change

Too many open files in Alfresco

Recently, my Alfresco installation on Centos 5.3 started to behave randomly and some functionalities became suddenly unavailable. A quick view in the error logs showed a pattern, a string of "too many open file" complaints.

The reason is that there is a limit on the maximum number of open files a user may keep open. The user running Alfresco had just 1024 of them, too few, it seems, for its normal operations. You can check the number of open files allowed per user with the command

cat /proc/sys/fs/file-max

Increasing this value is simple: first, edit the file /etc/sysctl.conf adding a row such as

fs.file-max = 4096

Then, run 

sysctl -p

to make the changes in the file available. Then, finally, you will need to restart your Alfresco installation.