Cifs problem in Gentoo

If you encounter the following error when you try to mount a cifs filesystem:
CIFS VFS: cifs_mount failed w/return code = -22

try to:
#emerge mount-cifs

I did not find any indications on the net that a separate package should be installed in order to use cifs.

Later Update: same problem in ubuntu, you need to install smbfs
#apt-get install smbfs

Midnight Commander Color Themes

Here is a script to easy change the default blue scheme of Midnight Commander.

Unpack the archive and do:

./mc_change_theme.sh puthre.theme

To revert to the default scheme just:

./mc_change_theme.sh default.theme

The script will modify your ~/.mc/ini file. Please make sure that Midnight Commander is not running when you change your theme.

Here is how a theme file looks:
BASE_COLOR=lightgray,blue
NORMAL=lightgray,blue
SELECTED=black,cyan
MARKED=yellow,blue
MARKSELECT=yellow,cyan
ERRORS=white,red
MENU=white,cyan
REVERSE=black,lightgray
DNORMAL=black,lightgray
DFOCUS=black,cyan
DHOTNORMAL=blue,lightgray
DHOTFOCUS=blue,cyan
VIEWUNDERLINE=brightred,blue
MENUHOT=yellow,cyan
MENUSEL=white,black
MENUHOTSEL=yellow,black
HELPNORMAL=black,lightgray
HELPITALIC=red,lightgray
HELPBOLD=blue,lightgray
HELPLINK=black,cyan
HELPSLINK=yellow,blue
GAUGE=white,black
INPUT=black,cyan
DIRECTORY=white,blue
EXECUTABLE=brightgreen,blue
LINK=lightgray,blue
STALELINK=brightred,blue
DEVICE=brightmagenta,blue
CORE=red,blue
SPECIAL=black,blue
EDITNORMAL=lightgray,blue
EDITBOLD=yellow,blue
EDITMARKED=black,cyan
ERRDHOTNORMAL=yellow,red
ERRDHOTFOCUS=yellow,lightgray

Here is the result:
mc.png

Problems emerging device-mapper.1.02.19 with confcache on Gentoo

Disable confcache in /etc/make.conf if you are getting this when trying to emerge device-mapper.1.02.19 on Gentoo:
checking target system type… config.sub: missing argument
Try `config.sub –help’ for more information.
configure: error: /bin/sh autoconf/config.sub failed

!!! Please attach the following file when filing a report to bugs.gentoo.org:
!!! /var/tmp/portage/sys-fs/device-mapper-1.02.19/work/device-mapper.1.02.19/config.log

!!! ERROR: sys-fs/device-mapper-1.02.19 failed.
Call stack:
ebuild.sh, line 1621: Called dyn_compile
ebuild.sh, line 973: Called qa_call ‘src_compile’
ebuild.sh, line 44: Called src_compile
device-mapper-1.02.19.ebuild, line 22: Called econf ‘–sbindir=/sbin’ ‘–disable-selinux’
ebuild.sh, line 578: Called die

!!! econf failed
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at ‘/var/tmp/portage/sys-fs/device-mapper-1.02.19/temp/build.log’.

CentOS _dl_sysinfo_int80 deadlock

Are you using a CentOS or CentOS derived distribution and you experience deadlocks in dl_sysinfo_int80 function like this?:

#0 0x00ace7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x00cb248b in __read_nocancel () from /lib/tls/libpthread.so.0
#2 0x080bdf39 in el_push ()
#3 0x080bdfda in el_getc ()
#4 0x080bde50 in el_push ()
#5 0x080be11b in el_gets ()
#6 0x080a6f59 in main ()

Then you need to upgrade the kernel to the lastest version from the CentOS repositories (2.6.9-42.0.10.EL as of today):

yum upgrade kernel

Have Fun!

Using libGD to manipulate jpeg images in C

Yesterday, for a small project of mine, I needed to implement a small utility to deform jpeg images from command line. The idea was to use texture mapping for deformations, so I needed a way to manipulate the jpeg images at the pixel level.

The first thing I tried was the imagemagik utility. I’ve browsed their documentation but I couldn’t find anything close to what I needed. I wanted to be able to draw textured mapped triangles into a picture. I knew that the Allegro library that I’ve used back in the old DOS programming days could do the texturing part. The bad thing that I found out is that it does not know how to handle jpeg files 🙁

Then I googled the Internet for a free and easy to use graphic library and I found libGD. The good thing is that it can handle jpeg files. The bad thing is that it cannot do the texturing part. The next thing I had in mind was to use both libraries but this would mean to add lots of dependencies to my small application for a simple texture mapping function. So I decided to write my own texture mapping function to remember the good old days. I will not describe how texture mapping works as there are plenty of tutorials on the internet for this.
Continue reading