martedì 29 dicembre 2009

Crosscompilation for armel with emdebian

First of all create a chroot with debootstrap:

debootstrap lenny armchroot

Then let's go to fix locales:

mount none -t proc armchroot/proc
chroot armchroot
@armchroot: apt-get update && apt-get install locales&& dpkg-reconfigure locales && apt-get install localepurge

The last important part is to install emdebian-tools

@armchroot: apt-get install emdebian-tools


@armchroot: apt-get update && apt-get upgrade

Now we have to edit /etc/emsource.conf to use stable

targetsuite: lenny

Now it's time to setup emdebian. We want to crosscompile to armel so:

@armchroot: emsetup -a armel

This last command will install and configure the toolchain.

Gitweb with Lighttpd on a debianized NSLU2

First of all install Lighttpd gitweb and git

apt-get install lighttpd gitweb git-core

Then add a lighttpd configuration file.

server.modules += ( "mod_cgi" )
url.redirect = ( "^/git$" => "/git/" )
alias.url += ( "/git/" => "/usr/lib/cgi-bin/" )
$HTTP["url"] =~ "^/git/" {
cgi.assign = ( ".cgi" => "" )
index-file.names = ( "gitweb.cgi" )
}

Wrote this in /etc/lighttpd/conf-available/10-gitweb.conf.
The copy the three files in /usr/share/gitweb in /var/www.
Now edit projectroot field in your gitweb configuration file in /etc/gitweb.conf:

$projectroot = "/your/directory/git";

Save /etc/gitweb.conf and enable gitweb configuration for lighttpd:

lighttpd-enable-mod gitweb
invoke-rc.d lighttpd force-reload

An UML2 Diagram editor for Linux

Googling I found Gaphor. Iwas bored of Dia. Gaphor uses dia canvas but it's more UML2 oriented ant it's write in python!
Unfortunally debian package of gaphor depends on python-zope.interface that is broken.
So I decided to use python-virtualenv to install gaphor.

As root:

root@thelemasys:~# aptitude install python-virtualenv


And then as user:

denever@thelemasys:~$ virtualenv gaphor
denever@thelemasys:~$ cd gaphor
denever@thelemasys:~/gaphor$ source bin/activate
(gaphor)denever@thelemasys:~/gaphor$ easy_install gaphor
(gaphor)denever@thelemasys:~/gaphor$ gaphor

giovedì 5 novembre 2009

Configuring a Canon MF4350D on Ubuntu Karmic Koala 64bit

First of all you have to download Canon propetary drivers from here.

After you download Canon_UFRII_Linux_V1.90_[your country code here].tar.gz, untar it.

That will create a directory: Canon_UFRII_Linux_V1.90_IT/


denever@tuscio:~/tmp/src$ cd Canon_UFRII_Linux_V1.90_IT/
denever@tuscio:~/tmp/src/Canon_UFRII_Linux_V1.90_IT$ cd 64-bit_Driver/
denever@tuscio:~/tmp/src/Canon_UFRII_Linux_V1.90_IT/64-bit_Driver$ cd RPM/
denever@tuscio:~/tmp/src/Canon_UFRII_Linux_V1.90_IT/64-bit_Driver/RPM$


In this directory you will have two rpm:

denever@tuscio:~/tmp/src/Canon_UFRII_Linux_V1.90_IT/64-bit_Driver/RPM$ ls
cndrvcups-common-1.90-1.x86_64.rpm cndrvcups-ufr2-uk-1.90-1.x86_64.rpm


Now you have to convert these two rpm in two debian package (.deb).
To do this you will need alien program installed.

sudo apt-get install alien


After you installed alien you can convert the two rpm:

alien cndrvcups-common-1.90-1.x86_64.rpm
alien cndrvcups-ufr2-uk-1.90-1.x86_64.rpm


After that you have to install ia32-libs.
This package is really important for the right use of the driver:

sudo apt-get install ia32-libs


And now you can install the two debs:

sudo dpkg -i cndrvcups-common_1.90-1_amd64.deb
sudo dpkg -i cndrvcups-ufr2-uk_1.90-1_amd64.deb

giovedì 30 luglio 2009

How to extract an image from a swf?


root@evans:~# apt-get install swftools
denever@evans:~$ swfextract file.swf
Objects in file file.swf:
[-i] 3 Shapes: ID(s) 2, 4, 6
[-j] 3 JPEGs: ID(s) 1, 3, 5
[-f] 1 Frame: ID(s) 0
denever@evans:~$ swfextract -j 1 -o image1.jpg
denever@evans:~$ swfextract -j 3 -o image3.jpg
denever@evans:~$ swfextract -j 5 -o image5.jpg

giovedì 11 giugno 2009

turbogears 1.0 in debian is broken

turbogears 1.0 in debian is broken.
So how to fix it?

easy_install "turbojson=1.1.4"
easy_install "turbojson<1.2"
easy_install "TurboCheetah>=1.0"
easy_install "TurboGears>=1.0.8"

mercoledì 10 giugno 2009

How to retrieve a .dsc file giving only the pkg name

pkgurl=$(dcontrol $1 | grep ^Filename | head -1 | cut -d' ' -f 2 | sed s/_[a-zA-Z0-9]*.deb/.dsc/) dget -q http://ftp.uk.debian.org/debian/$pkgurl
dpkg-source -x $(basename $pkgurl)

domenica 12 aprile 2009

Italian Keyboard Layout Coder Friendly

This post is about Italian Keyboard and concern to italian speaking people, so I'm writing in italian.

Bene questo è il mio primo post in italiano, spero di non commettere strafalcioni come in inglese.
Dunque oramai da almeno due anni utilizzo un mio personale layout di tastiera.
Questo perché ero stanco di fare acrobazie con la tastiera quando scrivevo codice.

Chi di scrivendo codice in C o in PHP ad esempio non vorrebbe avere a portata di mano le parentesi graffe?

Chi di voi usando la bash non vorrebbe avere la tilde o la slash a portata di mano e non nascosta dietro AltGr o Shift?

Ora la tastiera italiana si caratterizza per avere le accentate ùèòàìé e tanti altri caratteri strani di cui ignoro, ad esempio la c con cediglia.
Qualcuno di voi l'ha mai usata?
Io no.
Eppure sta li in mezzo ai cabbasisi come direbbe Montalbano.
Non sarebbe più comodo avere la pipe li, quando si sta usando la bash?

Ecco a queste mie noie ho cercato di dare risposta creando un mio layout di tastiera.
Che vi mostro graficamente:


Come vedete ho messo la slash e la tilde (accessibile con un semplice shift) a fianco della L.
La pipe e la "chiocciola" sono a seguire facilmente accessibili (con il mignolo :) ).
Ancora a seguire il cancelletto e l'apice inverso (utilissimo, ad esempio, in bash e in latex)
Come vedete le graffe e le quadre sono li dove si trovano sulla tastiera UK, US.
Come tutti però oltre a scrivere codice scrivo anche testo in italiano :)
Quindi non ho fatto fuori le accentate. Semplicemente le ho piazzate sopra i numeri come potete vedere in figura.
Posso accedervi con AltGr + il numero corrispondente. Si, adesso sono le accentate a non essere a portata di mano, ma visto il ridotto utilizzo che ne faccio non è un problema per me.
Ho fatto fuori il simbolo della sterlina che si trovava sul numero 3 ed al suo posto ho messo il simbolo dell'euro € :)

Cosa ne pensate? :)

domenica 5 aprile 2009

p54usb and the wrong regulatory domain

In these days I used often my flybook. It is equipped with a WiFi Usb integrated dongle.
It came out that it's a prism54 chipset. So I could use p54usb module from the kernel.
But I discovered a problem. My netbook doesn't associate in any way to my Access Point.
At first I couldn't figure out why. So I gave up. I thought that was a problem in my hardware.
Yesterday, I noticed an error message from the kernel:


[ 193.290086] phy0: frequency change failed
[ 193.290155] phy0: failed to set freq to 2467 MHz for scan


This arouses my suspicion.
I decided to figure out more about this error.
So I looked for this string in drivers/net/wireless/p54/*.{c,h}.

denever@v33i:~$ grep -l "frequency change failed" driver/net/wireless/p54/*.{c,h}
p54common.c

I took a look to the code. And I decided to add some printf line to figure out where the problem is.
Then I discovered that p54common tries more frequencies to find the right one.
But if none of the set available matches then print out that error message.
So how is choosed the frequencies set?
Looking more carefully to the dmesg I found this line:

[ 131.901612] cfg80211: Using static regulatory domain info
[ 131.901621] cfg80211: Regulatory domain: US

So here we are!!!
My usb dongle uses the wrong frequency set.
But how can I change this frequency set?
I googled around discovering some interesting things.
First of all, I discovered that cfg80211 implements a regulatory compliance.
And actually since cfg80211 came in to the kernel I experimented problems with my wifi dongle.
Reading here, I discovere that is possible to choose the regulatory domain setting a parameter of the cfg80211 module.
So I wrote a config file for modprobe and I placed it in my /etc/modprobe.d/.
Here follows my cfg80211.conf:

denever@v33i:~$ cat /etc/modprobe.d/cfg80211.conf
options cfg80211 ieee80211_regdom=EU

And now my dongle connect really fine :)
My dmesg:

denever@v33i:~$ dmesg | grep cfg80211
[ 131.901612] cfg80211: Using static regulatory domain info
[ 131.901621] cfg80211: Regulatory domain: EU

mercoledì 11 febbraio 2009

Kernel needs initramfs

When you recompile your kernel and you want to use initramfs remember to select this option:


General Setup --->
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support


And if you want to generate your initramfs with kernel-package in debian remember the option --initrd.

martedì 20 gennaio 2009

Rembember remember remember


for I in *.txt;do grep -H $(basename $I .txt) $I; done


You don't know why. But I assure you it's useful for me...

lunedì 19 gennaio 2009

Imagemagick cropping 18Mb of png files

In these days I need to crop a lot of png file. They are screenshots of a desktop 1024x768 and I need to remove a frame around the main window. So I didn't want to use a program like gimp opening each file and crop it. So I thought to use a shell script with convert an utility from Imagemagick suite.
This is the code of the shell script:


for I in $(find -name *.png);do
convert -shave 0x46 -crop 1024x768+0+28 $I $I.crop
mv $I $I.old
mv $I.crop $I
done