Thursday, March 13, 2014

Use Inno Setup because of: NSIS Error Error launching installer

Yeap NSIS cannot be executed in paths containing non-ascii characters like "Descărcări".

Inno Setup doesn't seem to have this problem.

I see on the Internet that I should be making a .MSI ( http://wix.codeplex.com/ ) but I'm too lazy and this works.

Wednesday, February 12, 2014

Python script to compute song's time position in youtube album

I saw the need for such script because of this video (see comments): http://www.youtube.com/watch?v=dO9uBu4zry8

For me it is important to have the possibility to jump to the song that I want. I got the contents of that video from wikipedia: http://en.wikipedia.org/wiki/Sleeping_with_Ghosts#Track_listing

I also needed to update the wikipedia page because the duration of a song was not the correct one (I got the correct duration from http://www.allmusic.com/ ).

I copied the data into the following text file (__DELAY__ was added by me to overcome some of the delays that were in the file compared to the mentioned songs duration).

Here is the input file (mainly copy paste and some delays added after checking):

CD 1
1. "Bulletproof Cupid"   2:22
2. "English Summer Rain"   4:01
3. "This Picture"   3:34
4. "Sleeping with Ghosts"   4:38
5. "The Bitter End"   3:10
6. "Something Rotten"   5:28
7. "Plasticine"   3:26
__DELAY__ 0:04
8. "Special Needs"   5:15
9. "I'll Be Yours"   3:32
10. "Second Sight"   2:49
__DELAY__ 0:03
11. "Protect Me from What I Want"   3:15
12. "Centrefolds"   5:02
__DELAY__ 0:01
CD 2
1. "Running Up that Hill" (originally by Kate Bush) Kate Bush 4:57
2. "Where Is My Mind?" (originally by Pixies) Black Francis 3:44
3. "Bigmouth Strikes Again" (originally by The Smiths) Johnny Marr, Morrissey 3:54
4. "Johnny and Mary" (originally by Robert Palmer) Robert Palmer 3:25
5. "20th Century Boy" (originally by T. Rex) Marc Bolan 3:40
6. "The Ballad of Melody Nelson" (originally by Serge Gainsbourg)   3:58
7. "Holocaust" (originally by Big Star) Alex Chilton 4:27
8. "I Feel You" (originally by Depeche Mode) Martin Gore 6:26
9. "Daddy Cool" (originally by Boney M.) Frank Farian, George Reyam 3:21
__DELAY__ 0:04
10. "Jackie" (originally by Sinéad O'Connor) Sinéad O'Connor 2:48

And you can find the (python) script on sourceforge in one of my dummy projects where I add useful pieces of code: https://sourceforge.net/p/genericmock/code/ci/master/tree/python/youtube_list.py

Enjoy!

Sunday, October 27, 2013

Ora de vara/iarna - o aberatie

Nu inteleg de ce inca se mai foloseste

Adica te obisnuiesti cu lumina diminetii (de vara, sa zicem) si dupa aia bum, te-ai trezit cu o ora mai devreme...

Trenurile stau (in camp/gara?) 1h ca sa ajunga la programul stabilit?!

Muncitorii freaca duda 1h (muncesc 9) ca sa iasa "cum scrie in contract"?

Eu as pune UTC peste tot si gata. Nu de alta, dar si in software ai numai probleme daca vrei sa folosesti timpul local.

Fuck DST!

Saturday, October 19, 2013

Lubuntu, Kubuntu, Xubuntu or Ubuntu: Sound not working after resume from suspend

This post might as well be cataloged as a summary of a continuous frustration that has be fed by the lack of decent audio support in Linux.

I first saw Linux installed in 1999-2000 and it was a RedHat 6.1/6.2 from a computer magazine. From the start one of the first problems was getting the sound card working. I discovered I had to 'modprobe' and when I first heard a sound I loved it. Years went on and I switched to a Slackware 8.0 (booted from floppy :) ). I stayed for 1 month without sound until I found out what I need to do in order to make it run. To this date I consider slackware one of the best operating systems I've ever tried. Later on I switched to Ubuntu (6.04) 'cause I was tired of kernel compilations and lack of a package dependency tool. It was a miracle! Everything worked. I kept using Ubuntu and I never had any problems. I thought the desktop evolved, it was usable. But, I was wrong!

I installed the latest 13.10 Ubuntu/Lubuntu and found out that I had no sound after resume from suspend . I said to myself: "Come on, it must be a mistake, I haven't got a problem like this in years!"

But it seems that this is a known problem for quite a while. And I started searching on the Internet for (at least local) solutions.

My conclusions were that when suspended the audio card/driver remains in an inconsistent state and needs to be somehow restarted. In case of Alsa this is done via:

sudo alsa force-reload


But in my case I couldn't do that without errors that were telling me something like this:

me@WS12:~$ sudo alsa force-reload
Unloading ALSA sound driver modules: snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-seq-midi snd-seq-midi-event snd-rawmidi snd-seq snd-seq-device snd-timer (failed: modules still loaded: snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer).
Loading ALSA sound driver modules: snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-seq-midi snd-seq-midi-event snd-rawmidi snd-seq snd-seq-device snd-timer.

Doing a lsof on the sound devices reveals why:

me@WS12:~$ lsof /dev/snd/*
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
lxpanel 1268  ins    9u   CHR  116,6      0t0 8923 /dev/snd/controlC0

For other Ubuntu flavors (I use Lubuntu) you might get pulseaudio being the one keeping sound devices open.

What I did?

Step 1a: I killed lxpanel

killall lxpanel

OR

Step 1b: I removed the Volume Bar from the panel and made a successful 'sudo alsa force-reload' (called twice ... - see below) - seems like the volume bar keeps some /dev/snd/* devices open

Step 2: Restart the lxpanel

lxpanel --profile Lubuntu


And after this the sound works. You need to do something similar if you want to do this when using portaudio:

1. Create this file with the following contents (so that portaudio doesn't restart when killed):

me@WS12:~$ cat ~/.pulse/client.conf
autospawn = no
me@WS12:~$


2. Kill pulseaudio

pulseaudio --kill

3. Also kill other programs that have some /dev/snd/* files open

4. Then restart alsa. But make sure you type 'sudo alsa force-reload' twice because ... I don't know (maybe the module unload order is not the good one ... really don't know)

me@WS12:~$ sudo alsa force-reload
Unloading ALSA sound driver modules: snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer (failed: modules still loaded: snd-hda-codec-analog snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer).
Loading ALSA sound driver modules: snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer.
me@WS12:~$ sudo alsa force-reload
Unloading ALSA sound driver modules: snd-hda-intel snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer.
Loading ALSA sound driver modules: snd-hda-intel snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer.
me@WS12:~$

5. After that remove the ~/.pulse/client.conf

rm ~/.pulse/client.conf

6. Restart pulseaudio

pulseaudio --start

You're done!

Well this is what I call "evolution"! NOT.

Other choices in my opinion would be:

1. Fix the driver (if this is really the case)
2. When executing pm-suspend do the steps that I did... (see man page for scripts executed on suspend)
3. Use a sound server (pulseaudio/jack/esd...) that when going to sleep disconnects gracefully from the /dev/snd/* files and lets the 'alsa force-reload' do the job on resume - before it connects again)

The best choice I believe it is 3 (if 1 is not the issue) because the applications using sound (playing or recording) cannot see any real difference since they are routed through the sound server.

If you know some distros that work in this scenario (after suspend+resume I can hear music), please let me know.

Friday, October 18, 2013

Booting iso files in Ubuntu

This can be achieved by following some instruction from this page.

But what I found to be extremely easy is to use grml-rescueboot.

What you do is:


sudo apt-get install grml-rescueboot


and after that you copy the iso files into /boot/grml
Once you copied/moved the files in the location you run the following command:


sudo update-grub


Reboot and choose what live iso you want to try.