MV

Thursday, August 12, 2010

Renaming files

When I travel, I always have at least two CF cards to take some, well most of my family say A LOT (but who cares...), pictures. My problem is always the numbering of the files, because I have set my camera to restart the numbering for a new card. Why, I don't have a clue, but it's like that... perhaps I should change my setting, but then you wouldn't be reading this blog message.

So my issue is that I want to put all files in one directory but then I have conflicting files because there will be 2 files named bla00001.jpg. So I have to add a fixed number to each file name of the second, third,... CF card in order to avoid these conflicts.

Perhaps my solution isn't the shortest, nor the best, but at least it works for me. The solution described here is originally created by my ex-colleague Erik.

So my camera produces the following file name format: DSC000001.JPG
Let's say that the highest number on my first CF card is 313, the first file name of the second CF card must then be 314, i.e. DSC00314.JPG.

So create a file somewhere on your hard drive, for example in /home/myworkspace/Pictures/rename.sh

Add this code to your file:

#!/bin/bash

for file in `ls *.jpg`
do
    numberpart=`echo ${file} | sed 's/DSC[0]*//g'`
    let number=`echo ${numberpart} | sed 's/\.jpg//g'`
    let number=number+313
    filename=DSC00${number}.jpg
    mv ${file} ${filename}
done


Save the file and make it executable via chmod +x rename.sh

Before testing it, make a backup of your pictures directory of which you need to rename the files!!!

Put the script in the directory and run it (./rename.sh)

Now I can put all my pictures in one dir, /me happy

Thursday, February 11, 2010

Sound through HDMI cable

Recently I got myself a fine new full HD television. My laptop has HDMI output so I immediately wanted to watch some movies on my new television. Unfortunately the sound still came through the lousy laptop speakers. Some googling made me a happy man :-)

My system is an HP dv7 1140eb with nVidia 9200M GS running Ubuntu 9.10.

So this is what I had to do to get video and sound to play on my television through my HDMI cable:

1) Update the nVidia drivers to the latest (I used the nvidia drivers from nvidia.com). Go into
2) open sound preferences (system > preferences > sound): on the hardware tab, check if there is a profile Digital Stereo (HDMI) Output. If so select that profile
3) open alsamixer in shell, go to S/PDIF 0 and 1 with RIGHT arrow and unmute by pressing m.
4) test

if there is still no sound via your tv speakers continue, otherwise: w00tness!

1) upgrade alsa version to version 1.0.22:
http://ubuntuforums.org/showthread.php?p=6589810#post6589810
This procedure might take some time (in my case appx 15 minutes)
2) open the sound preferences (system > preferences > sound): on the hardware tab, select the proper Profile, in my case Digital Stereo (HDMI) Output (original value: Analog Stereo Output)
3) open alsamixer in shell, go to S/PDIF 0 and 1 with RIGHT arrow and unmute by pressing m.

That should do the trick. I hope this information helps other people.

Bye Bye til the Next Time

Friday, January 15, 2010

Help no sound in flash apps :-(

Today, on my Ubuntu 9.10 I was trying to watch a youtube video, unfortunately my flash completely freaked out and unfortunately there was no sound either. In the past I used to reboot my machine and then the issue was solved, however, since I had so many apps open, I didn't want to reboot.

So here's how I got it back working:

1. lsof | grep pcm
2. kill the results for pulseaudio and firefox
3. restart alsa: sudo /etc/init.d/alsa-utils restart
remark I killed firefox too because when I then restart firefox it asks me to restore the previous session, so I have all my pages (even in different windows) open again upon starting firefox

w00t, youtube, here I come !

However, if it's still not working after this, most likely there has been a kernel update. Then I used this procedure and then everything worked again:
http://ubuntuforums.org/showthread.php?p=6589810#post6589810
This procedure might take some time (in my case appx 15 minutes)

This procedure could perhaps solve a lot of threads on ubuntu forums like "no sound in flash", "flash makes FF crash", etc...