Add a logging function to your bash script

I write a lot of scripts that do various jobs and most of the time I’d like to have some log of what happened. So for most of them I add a function that helps logging.

[cce_bash]
#!/bin/bash
# log date format, customize it to your wishes
# see man date for help
DATE=’date +%Y/%m/%d:%H:%M:%S’
# log file
LOG=’/var/log/script.log’

function echo_log {
echo `$DATE`” $1″ >> $LOG
}
# start
echo_log “Script running”
# do something
echo_log “Doing this”
# done
echo_log “Script ended
[/cce_bash]

Microsoft updates Skype for Linux

Or in other news, hell froze over 🙂 Some people complained about the new interface, so I’ll try to be agains the flow here and say that I actually quite like it.

It’s not like skype for linux was ever active but since Microsoft aquired them I pretty much wrote off any updated. It seems I, like many others was wrong. Probably it has something to do with the new advertising features introduced lately…
Go to skype linux page and get it. Don’t worry if it still says 2.2 beta, the download buttons will get you the nuew package. The page was updated, it says 4.0 now.

If, like me, you were happy seeing 64 bit versions don’t worry, it’s still a 32 bit binary but with multilib dependencies for the package.

Also worth noting that I run latest slackware current64 with Alien Bob’s multilib packages and this skype version appears to be running just fine.

 

digikam 2.6.0 won’t start due to missing libavcodec.so.53 (slackware current64)

This was pretty simple but complicated :). It turns out I updated ffmpeg from alien bob‘s repo to ffmpeg 0.11, thus upgrading to libavcodec.so.54. I’m sure I could have gotten away with a simple symlink but I wanted a clean install.

So I though I would simply rebuild digikam, right? Wrong. It failed, with weird errors like:
[cce_bash]
make[2]: *** [extra/libkface/test/detect] Error 1
[/cce_bash]
or
[cce_bash]
collect2: error: ld returned 1 exit status
make[2]: *** [extra/kipi-plugins/removeredeyes/test/testipp] Error 1
[/cce_bash]
Face detect above sounded a lot like opencv which does depend on ffmpeg, so I rebuild that as well (using the 2.4.1 version since I was at it). Now digikam built successfully.

libgdiplus-2.10.9 build fails on slacware current64 (2012-06)

Installing mono I needed to install libgdiplus. It failed with the following error:
[cce_bash]
/usr/lib64/gcc/x86_64-slackware-linux/4.7.0/../../../../x86_64-slackware-linux/bin/ld: testgdi.o: undefined reference to symbol ‘g_free’
/usr/lib64/gcc/x86_64-slackware-linux/4.7.0/../../../../x86_64-slackware-linux/bin/ld: note: ‘g_free’ is defined in DSO /usr/lib64/libglib-2.0.so.0 so try adding it to the linker command line
/usr/lib64/libglib-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [testgdi] Error 1
make[2]: Leaving directory `/usr/local/src/libgdiplus-2.10.9/tests’
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/libgdiplus-2.10.9′
make: *** [all] Error 2
[/cce_bash]
The fix is simple, thanks to a mention in slacky pkg reports:

After running ./configure edit tests/Makefile and at line 130 replace LIBS = -lpthread -lfontconfig with LIBS = -lpthread -lfontconfig -lglib-2.0 -lX11

Until a patch is made this means we’ll have to install it manually.

http://www.mono-project.com/Main_Page

Silly Android contact merging

So, for now my beloved n900 is in the service dead, so I started organizing contacts on the Android phone I have. First thing I did was to merge contacts (for example joining Jon Doe’s contact from google-phonebook, facebook, skype and so on)

I’m used to doing this for years now as the old n900 but I noticed this strange behaviour with some of my frinds who use fake names /nicknames for skype or facebook, etc.

Say I join Jon Doe (google) with kingofrock1950 (on skype) sometimes it showed the real name other times the nickname. I tried searching for a setting or a way to change it but found none.

Here’s the (lack of) logic behind it:

  • If you choose Jon Doe and then select join with kingofrock1950 the name in the phone book will be the real name.
  • If you select kingofrock1950 and then join with Jon Doe the name shown will be kingofrock1950.

I find it extremely stupid that I can’t select the default account which gives the name. Though you can select the picture. Fitting, all image, stupid functionality. Well…

If you have to fix it you need to Separate contact and then join in the correct order. Nice, isn’t it?