15 May 2014

577. Skype and webcam on debian wheezy: black screen

This is another shameless re-posting of a solution published by others. See e.g. 
http://community.skype.com/t5/Linux/Webcam-is-not-working-on-skype-with-Ubuntu-12-04/td-p/858418
https://bbs.archlinux.org/viewtopic.php?id=95388
http://ubuntuforums.org/showthread.php?t=966882

Why am I doing this? Mostly because this blog doubles as a notebook where I can write down solutions that worked for me so that I don't find myself scouring the internet over and over again for the same solution.

I hope that I'm adding a bit of value by providing step-by-step solutions and snazzy screenshots though.

The issue:
even though the camera is working fine there's only a completely black picture in skype (not underexposed -- just plain black):






The solution:
Use LD_PRELOAD to load the 32 bit V4L library (which you need to have installed -- use apt-file to find out what package). You can either start skype from the command line, or make changes to the launcher, either via main menu  as shown in the screenshot or by editing ~/.local/share/applications/skype.desktop i.e. run skype with 
env LD_PRELOAD="/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so" skype


 At this point starting skype + webcam should be a happy marriage:
(aside from exposure, white balance etc. etc.)

13 May 2014

576. Shortening the bash prompt in debian

This is yet another post in which I'm (almost) simply reposting a solution that someone else has already posted online.

Let's say that my contribution is to put it in context of debian.

Either way, here's the problem that needed solving: the debian prompt by default lists all directories, which sometimes means that the prompt itself breaks across two lines.

Luckily, it's not difficult to chop the prompt down to a more manageable, yet still informative, length. The solution is here (we do like a descriptive URL): http://superuser.com/questions/387673/how-can-i-limit-the-number-of-directories-in-my-prompt

That particular solution also allows you to change the permissible length of the path that will be shown -- change the 50 in the argument to droppath to set the number of chars.

Edit your ~/.bashrc and add the bits in red:
# drops first portion of a path $1 if length is greater than $2 function __droppath { if [[ ${#1} -gt $2 ]]; then p=$1 while [ ${#p} -gt $2 ]; do p="/"$(echo "$p"|cut -d"/" -f3-) done echo "..."$p else echo $1 fi } if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]$(_droppath "\w" 50)\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h: $(__droppath "\w" 50)\$ ' fi

and here's an example using a length of 25 chars (which is a bit short).

Unmodified:
me@niobium: /usr/local/lib/python2.7/site-packages$\

Modified:
me@niobium: .../python2.7/site-packages$

You can always use pwd to figure out what the full path is if necessary:
me@niobium: .../python2.7/site-packages$ pwd
/usr/local/lib/python2.7/site-packages

12 May 2014

575. Gaussview: CConnetctionGFCHK::Parse_GFCHK() Missing or bad data: Alpha Orbital Energies Line Number XXXX

I've been getting a fair number of errors when trying to open .fchk files with gaussview 4.x that I've generated using g09. In particular, I've been getting this:



Thinking that it might have something to do with the version of gaussview being too old, I tried gaussview 5.x, which throws the same error. Gaussview (4.x), by the way, runs fine in wine 1.7.

Turns out it's a poorly written piece of software -- gaussview can't properly parse output generated by gaussian. Great...neither piece of software is cheap. Better yet, gabedit does not have any issue reading the unmodified fchk file.

If you do need to use gview though, the solution is outlined here: http://www.ccl.net/cgi-bin/ccl/message-new?2012+07+18+005

Briefly, edit your fchk file and change the "Number of basis functions" to the same number as is shown for the "Number of independent functions" i.e. change
1 alpha 2 FOpt RB3PW91 Gen 3 Number of atoms I 101 4 Info1-9 I N= 9 5 89 86 0 0 0 100 6 2 18 -602 7 Charge I 7 8 Multiplicity I 1 9 Number of electrons I 530 10 Number of alpha electrons I 265 11 Number of beta electrons I 265 12 Number of basis functions I 2015 13 Number of independent functions I 2005 14 Number of point charges in /Mol/ I 0 15 Number of translation vectors I 0
to
1 alpha 2 FOpt RB3PW91 Gen 3 Number of atoms I 101 4 Info1-9 I N= 9 5 89 86 0 0 0 100 6 2 18 -602 7 Charge I 7 8 Multiplicity I 1 9 Number of electrons I 530 10 Number of alpha electrons I 265 11 Number of beta electrons I 265 12 Number of basis functions I 2005 13 Number of independent functions I 2005 14 Number of point charges in /Mol/ I 0 15 Number of translation vectors I 0
And that's it.