Tuesday, December 04, 2007

[update] Convert .ape to .flac

There is a new audio format around: the monkey's audio codec or file. To make the conversion you will need the shntools (RPM) and MAC (RPM). Notice that both RPMs are for Fedora 7, but they work. If found a Fedora 8 version, please let me know. This document is a customized version from other two documents: this and this.

- Set some variables:

CUE_FILE=<full path name to the CUE file>

# assuming that the APE/FLAC file has the same name as the CUE file
APE_FILE="`basename \"${CUE_FILE}\" .cue`.ape"
WAV_FILE="`basename \"${CUE_FILE}\" .cue`.wav"
FLAC_FILE="`basename \"${CUE_FILE}\" .cue`.flac"

- Convert APE file to WAV and to FLAC (if instead of an APE file it is a FLAC file you should skip this step):

mac "${APE_FILE}" "${WAV_FILE}" -d
flac --best "${WAV_FILE}" "${FLAC_FILE}"
rm -f "${WAV_FILE}"

- Break and convert to flac:

cuebreakpoints "${CUE_FILE}" | shnsplit -o flac "${FLAC_FILE}"

- Rename single tracks into music names, based on CUE file:

This script does NOT check character set validity. It means that it may not work for some particular case (or the general case in some languages). A simple example would be a CUE file in French in ISO-8859-1 (Windows default) and a Linux in Unicode (UTF-8). Oder problem also related with character set is the protection for non-valid character like ":" or "/", which may not be used within a file name. In any case the script will simply not rename the file (which will be left to the user to do). So, in the worst case, you will need to rename the failed files by hand. Useful for that will be to run the following command:

grep -e "^[[:space:]]\+TITLE" "${CUE_FILE}"

## the first TITLE is for the album name, discard it
grep -e "^[[:space:]]\+TITLE" "${CUE_FILE}" \
| sed -e "s/.*\"\(.*\)\".*/\1/g" \
| while read TRACK_NAME;
do \
## just a little fine tune to have track names like
### "artist - 01 - track.flac" and "artist - 10 - track.flac"
if [ ${COUNT} -lt 10 ];
then \
else \
ARTIST=`grep -e "^[[:space:]]\+PERFORMER" "${CUE_FILE}" \
| head -${COUNT} | tail -1 | \
sed -e "s/.*\"\(.*\)\".*/\1/g"`
## rename in the format: "<artist> - <track number> - <track name>.flac"
mv split-track${NUM}.flac "${ARTIST} - ${NUM} - ${TRACK_NAME}".flac;

Wednesday, November 28, 2007

Java... what a hell?!?

Recently I experience a problem with Java (both 1.5 and 1.6, up to update 3), which throws the following message error in your face:

The error is: xcb_xlib.c:50: xcb_xlib_unlock: Assertion 'c->xlib.lock'

It does not affects all Java programs (my Eclipse was still running) but some. Not weirdly enough it seems actually a Java problem instead of a Fedora problem. Anyway, to workaround the problem the procedure is even more weird (extracted from here):

sed -i 's/XINERAMA/FAKEEXTN/g' /usr/java//jre/lib/i386/xawt/libmawt.so

Wednesday, November 21, 2007

[updated3] My Fedora 8 road map

- Basic system setup
-- Adjust [/etc/resolv.conf]
-- Adjust [/etc/fstab]
-- Adjust [/etc/sysconfig/network-scripts/ifcfg-eth0]

- Add repositories:
-- Freshrpms
-- Adobe (flash plugin)
-- Livna

-- Correct conflict between livna and freshrpms (in favor of freshrpms):
Edit your [/etc/yum.repos.d/livna.repo] file to look like this:


-- Update your system:
yum -y upgrade

- Install additional software:
-- Multimedia:
yum -y install \
mplayer \
mencoder \
vlc \
grip \
ogle \
flash-plugin \
k3b \
k3b-extras-nonfree \
bittorrent \

-- Email with sylpheed-claws
yum -y install \
bogofilter \
claws-mail \
claws-mail-plugins \

-- XMMS with its most precious plug-ins
yum -y install \
xmms \
xmms-libs \
xmms-skins.noarch \
xmms-mp3 \
xmms-faad2 \
xmms-flac \
xmms-wma \
xmms-cdread \
xmms-arts \
xmms-esd \
xmms-musepack \

-- Pidgin, a very good IM client
yum -y install \
pidgin \
pidgin-encryption \
pidgin-guifications \

-- For kernel modules
yum -y install \
kernel-devel \

-- Nautilus plug-ins
yum -y install \
nautilus-open-terminal \
nautilus-search-tool \
nautilus-flac-converter \

-- Misc
--- Diagrams and images, usually old stuff that I'm used to
yum -y install \
graphviz \
dia \
gv \
xfig \
xpdf \
eog \
gnuplot \

--- Editors and related
yum -y install \
gvim \
kile \

--- My beloved spreadsheet program
yum -y install \

--- Unrar and related programs
yum -y install \
unrar \

--- My beloved debugging program
yum -y install \

- Install and setup third-part programs
-- VirtualBox/VMware
-- Skype
-- Acrobat Reader
-- Real Player
-- Sun Java
-- Eclipse

P.S.: For Real Player you will need to install the following package (broken dependency on Real Player RPM):

yum -y install \

- Setup printers
- Backup [/etc] and [/boot/grub]
tar -czf bkp-system.`/bin/date +"%Y%m%d-%H%M"`.tgz /etc /boot/grub

- Some issues:
Acrobat Reader install its Firefox/Mozilla plug-in, which has a memory leak. I recommend to remove it. To do so:

rm -f /usr/lib/mozilla/plugins/nppdf.so

Tuesday, November 20, 2007

How to get language switch in pidgin

To get language switch in pidgin you need a plugin called switch-spell, which does not come in a RPM package (as far as I know). This means that you need to get the sources (here, in download) and compile it. To make the job easier here goes the necessary packages:


And the yum command:

yum -y install \
dbus-devel \
dbus-glib-devel \
libpurple-devel \
aspell-devel \
gtkspell-devel \

After that just extract the sources and compile:

make && make install

Have fun!

P.S.: Just remember the previous post, if you get a "fails sanity check" error.

Funny thing: "fails sanity check"

Ok that is a very funny error and I have never got it, until today. But why should I get such an error trying to compile something if I do have GCC and any other prereq whatsoever? The point is, and do not ask me why, GCC package does not requires glibc-headers. So you may get that following funny, and for me cryptic message, even though I have had "/lib/cpp" (go figure!):

configure: error: C++ preprocessor "/lib/cpp" fails sanity check

Anyway, just install the package and everything will go as you expect.

yum -y install glibc-headers

Tuesday, November 13, 2007

Fedora 8 screw big time

For those who got the "Invalid Module Format" trying to install/configure any module after installing Fedora 8 here is why. (It affects VMware (version Workstation 6.0.2 build-59824) and VirtualBox (version 1.5.2) BIG TIME!)

1. You have installed "kernel-devel" afterwards using yum (that is what I used);
2. Fedora 8 install kernel.i586 and yum (version 3.2.7) kernel-devel.i686 (notice the difference in the architecture?);
3. You can NOT upgrade your kernel to a i686 version.

How do I fixed the problem?

1. Install the "kernel-xen" and boot your box with it;
2. Remove ALL kernel instances (NOT kernel-xen, which your are using now);
2.1. You will need to remove 2 more packages too:
rpm -e xorg-x11-drv-nouveau xorg-x11-drivers
rpm -e kernel.i586 kernel-devel
3. Re-install the kernel:
yum -y install kernel.i686 kernel-devel.i686 xorg-x11-drv-nouveau xorg-x11-drivers
4. Reboot with the new kernel
5. Recompile the modules or, in case of vmware and virtual box, setup:
/etc/init.d/vboxdrv setup
6. Enjoy!

Thursday, June 14, 2007

[updated] Some life changing (g)VI(M) scripts

Ok first I need to say that I use gvim for both text, using LaTeX, and code, mainlly C/C++, writting. So the focus is on both aspects.


. LaTeX-Suite: here and here

- ~/vimrc:
filetype plugin on
set grepprg=grep\ -nH\ $*

- Comments: it works only if you start vim with a ".tex" file.

. Instead of vimspell use the native VIM spell-checker (for VIM 7.0 or greater, Fedora 8 or greater).

- ~/vimrc:
nmap <F10> :setl spell spl=de_de<CR>
nmap <F11> :setl spell spl=en_gb<CR>
nmap <F12> :setl spell spl=<CR>

- Comments: the out-of-the-box VIM come just with the English US dictionary, so to add more dictionaries, with your special flavour, just execute manually (once per language) the fallowing command in VIM:

:setl spell spl=xx_xx

Where "xx_xx" is the language you want to use, for instance: pt_br, es_es, es_mx, en_gb, en_ca, de_de, de_ch, for Brazilian Portuguese, Spanish Spanish, Mexican Spanish, British English, Canadian English, German German, Switzer German.

The languages supported are all languages present in OpenOffice.

. vimspell: here

- ~/vimrc:
" VimSpell settings
highlight SpellErrors ctermfg=Red guifg=Red
\ cterm=underline gui=underline term=reverse
au VimEnter * SpellAutoEnable
let spell_update_time = 2000
" file types to allow correction on
let spell_auto_type = "all"
" on-the-fly type correction
let spell_insert_mode = 0
" which corrector to use
let spell_executable = "aspell"
" languages
let spell_language_list = "en_GB,de_DE,pt_BR"
let spell_auto_jump = 0

- Comments: It is a must for every one that writes something besides code without comments :-)


. csupport: here, but usually already on vim/gvim package.

- ~/vimrc:
let g:C_AuthorName = 'Your name'
let g:C_Email = 'your.email@your.provider'

- Comments: It helps, A LOT!

. Tags menu: here

- ~/vimrc:
let Tmenu_ctags_cmd = '/usr/bin/ctags'
let Tmenu_max_submenu_items = 20
let Tmenu_max_tag_length = 10
let Tmenu_sort_type = "name"

- Comments: it creates, using gvim, a menu item called "Tags" with the current file tags.

. taglist: here

- ~/.vimrc:
nnoremap <silent> <F8> :TlistToggle<CR>

- Comments: This is THE killer tag browser and that map above makes it reachable by pressing <F8>. Check it out.

Related posts: gVim revisited.

Sunday, June 10, 2007

Almost a year

That's it: this blog was dead for almost a year and is time to do some catch up, if I still have any reader. But anyway this is more for me than for you and I can also practice my English (as you can see need a lot of improvements).

Nevertheless here comes some things that I'm very excited about:

- CDT 4.0 RC3 for Eclipse 3.3
- Fedora 7

First why is CDT to be excited about, because it has a refactoring tool that actually works. Ok it is just a renaming tool, so what? That means that they are really into keeping track of your code, including documentation. So I believe that they are bringing all those cool refactoring tools, like move, in no time. Then a C/C++ programmer can have all those nice things about Java IDE in a C/C++ free IDE.

And what about Fedora 7, there is nothing REALLY new on it. Well, first they are free from the RH packaging tools, which means that hopefully there will be some Fedora "the way I wanted" 7. But here some critics about Fedora: they should be more careful about the RPMs, which have broken dependencies, like VLC. We are talking about VLC, which is a major end-user application. The new version has also some stability issues, specially xorg. But the new xorg is kicking asses!!! If you don't saw it, please DO.

The new xorg is already with the 3D Desktop concept in it. They must polish some rough edges, like maximizing, but it looks good, very good. It is a mixture of OSX (with that very nice + behaviour) with 3D Desktop environment. But has I said, it needs some refinement, maybe on the next major upgrade.