Sunday, November 16, 2008

Launching an application at the begining of the desktop session

I've been searching for a way to launch an application when the user logs in the desktop for quite a while now. After a few weeks looking into gconf I've stumbled on a simple and powerfull solution to my problem: the Desktop Application Autostart Specification.

The solution is quite simple: just create an .desktop file at /etc/xdg/autostart/ and the application will be launched when the desktop session in any freedesktop.org compliant desktop.

Wednesday, October 29, 2008

Autostart application on desktop session startup (GNOME|KDE)

I've being needing a way to launch applications on the start of a user desktop session for a academic lab management system I've been toying around with for the last few weeks. I've search the web, asked on the propper IRC channels and most of what I had found wasn't enough for my needs: gnome-session can only register app launching for earch user and I needed something system wide.

I do not even remember where I've found info about it but the freedesktop.org has a spec for just this kind o thing: Desktop Application Autostart Specification. THe main idea is to just place a .desktop file in a specific directory: /etc/xdg/autostart/.

Friday, April 25, 2008

Installing Virtualbox in debian etch using backports.org

Add the the following respository to /etc/apt/sources.list

deb http://www.backports.org/debian etch-backports main contrib non-free

run

apt-get update
apt-get -t etch-backports install virtualbox-ose virtualbox-ose-source

to install VirtualBox

apt-get install module-assistant
module-assistant update
module-assistant unpack virtualbox-ose
module-assistant auto-install virtualbox-ose

to compile and install the kernel module

modprobe vboxdrv

to load the kernel module

adduser yourlogin vboxusers

to add your user to the vboxusers group


Wednesday, March 5, 2008

WinFF - Multiplattaform video converter



Just happens that my girlfriend needed a video conversion app. After testing many of the available ones I found WinFF, a free (as in freedom) front end to ffmpeg writen in Free Pascal.



It's interface is quite simplistic and was designed to be a bach converter.

The project home is at http://biggmatt.com/winff/ and the debian package is at http://biggmatt.com/files/winff-0.33-i386.deb and the MS Windows installer is at http://biggmatt.com/files/winffsetup.exe

I hope it is usefull

Monday, February 11, 2008

Installing virtualbox on debian etch

I've being using virtualbox on my debian sid boxes for almost an year now. The problem is that debian stable (etch) does not have the packages for virtualbox and I've been asked to explain how to install it.

here it goes:

1 - install dependencies:

apt-get install libqt3-mt libxalan110 libxerces27

2 - add the virtualbox repository to your list:

echo "deb http://www.virtualbox.org/debian etch non-free" >> /etc/apt/sources.list
wget -q http://www.virtualbox.org/debian/innotek.asc -O- | sudo apt-key add -
apt-get update

3 - install kernel headers so you can compile the vbox kernel module

apt-get install linux-headers-$(uname -r)

4 - install virtual box:

apt-get install virtualbox

5 - compile the kernel module:

/etc/init.d/vboxdrv setup

6 - Add the users to the vboxusers group (change for the user login)

adduser vboxusers

7 - Create an virtual machine folowing the steps of the tutorial at:

http://opencomputer.net/2008/02/11/virtualization-done-easily-with-virtualbox/

Saturday, January 26, 2008

Magick from the command line

Last night my girlfriend told me that she needed to convert an PDF file into a PNG sequence, crop it and regenerate the PDF. She, a biology teacher, was planning on taking screenshots of the PDF files and crop it using the Gimp. She never told me how she was going to recreate the PDF file though.

Being an true hacker, in the sense that I can't see an unsolved problem, I decied to post a better way of doing it so she can read it from anywhere she is, as long as internet access is not a problem.

Here it goes:
We will be using the folowing plataform:
And the simple steps:

1 - install imagemagick if not already installed.

If the command "dpkg --list | grep imagemagick" returns anything ImageMagick is already installed and you can skip this part.
Use synaptic, aptitude or apt-get to install. In the example I'll use apt-get because it is what I usually use (old habits die hard)
apt-get install imagemagick

2 - convert PDF file into an sequence of PNG files

convert BrOoZine006.pdf pg-%03d.png

3 - crop the images:

Since I'll be croping the image to half it's size I'll ask for the image size:
identify -format "%wx%h" pg-000.png
convert -crop 595x421+0+0 pg-000.png out.png

4 - reasemble the pdf file from it's parts

convert *.png final.pdf

5 - Script

And here we have a functional script that takes as parameters the name of the original PDF and the new PDF file.
#!/bin/bash

PDF_IN=$1
PDF_OUT=$

mkdir imgs croped

convert $PDF_IN imgs/pg-%03d.png

WIDTH_ORI=$(identify -format "%w" imgs/pg-000.png)
HEIGHT_ORI=$(identify -format "%h" imgs/pg-000.png)

WIDTH_NEW=$(echo "$WIDTH_ORI / 2" | bc)

COUNTER=0

for FILE in $(ls imgs/*.png|sort)
do
NEWFILE=$(printf "%03d" $COUNTER)
DESTFILE=$(echo $FILE| sed -r "s#imgs/.*\$#croped/$NEWFILE.png#g")
convert -crop $WIDTH_NEW"x"$HEIGHT_ORI"+0+0" $FILE $DESTFILE
COUNTER=$(echo "$COUNTER + 1" | bc)
NEWFILE=$(printf "%03d" $COUNTER)
DESTFILE=$(echo $FILE| sed -r "s#imgs/.*\$#croped/$NEWFILE.png#g")
convert -crop $WIDTH_NEW"x"$HEIGHT_ORI"+"$WIDTH_NEW"+0" $FILE $DESTFILE
COUNTER=$(echo "$COUNTER + 1" | bc)
done

convert croped/*.png $PDF_OUT.pdf

rm -fr imgs croped

Copy the script above, paste it into a text file and then execute:
bash scriptname pdf_file new_pdf_file


resources:

Friday, January 25, 2008

New project - DDREditor

I've created a project on SourceForge.net to host an app I've being toying since the new year break.

When it get to a point where it actually work it is supposed to be an Digital Didatic Resource Editor which aims to create and edit digital (and pre-press) cources using an integrated Learning Objects repository.

I'm using a small subset of docbook as my storage format and the app is being written in python with a gtk interface.

for more information go the the project's website or the project's Project Page at SF.

If anyone is interest on the subject please contact me.

brtcall - new app for download

I've written this app so my father could check his phone bills and do some crazy stuff with the data using excel. Since BRT (Brasil Telecom) only releases the local calls report as a pdf file I've written a small app that, using pdftotext, converts the PDF to a text file and extracts the values. It is written in python2.5, pygtk and users sqlite3 to store the data.

I must warn you: It is my first release and it is really buggy but it has been enough to help my father.