Xgl with GNOME, under Ubuntu Dapper Drake

OMG!! Xgl is so pretty!!

First things first, I have to say how I’ve made it run. I say in a previous post (that I actually wrote some minutes ago), that I have given a try to Ubuntu, to test how good that Xgl thing is. And man is it good!

Xgl is a graphics server, something that interprets data and displays it on the screen (as XFree86 and X.org). It basically allows for 2D effects of a Desktop Environment to be rendered with the powerfull engine of the Graphical Card, which untill now only accelerated the 3D effects, as e.g. games. However, one needs a window manager that takes advantage of these capabilities to create effects. The first such a wm was Compiz. Sadly, I was not able to install it, but I did install Beryl, which is a fork of Compiz.

I mostly followed the instructions in Fred.cpp’s blog[es].

It basically boils down to:

As root, or with the infamous sudo:

aptitude remove compiz compiz-gnome cgwd cgwd-themes xserver-xgl csm

Add to /etc/apt/sources.list (the last line only if you have a 64-bit CPU):

deb http://www.beerorkid.com/compiz/ dapper main
deb http://xgl.compiz.info/ dapper main
deb-src http://xgl.compiz.info/ dapper main
deb http://xgl.compiz.info/ dapper main main-amd64

Get the GPG keys for the repositories:

wget http://www.beerorkid.com/compiz/quinn.key.asc -O – | sudo apt-key add –

Then:

aptitude update && aptitude upgrade

Install Xgl, Beryl and Emerald (the theme manager for Beryl):

aptitude install xserver-xgl libgl1-mesa xserver-xorg libglitz-glx1 beryl beryl-core beryl-manager beryl-plugins beryl-plugins-data beryl-settings emerald emerald-themes

Now everything is installed, we need to create 2 files:

/usr/local/bin/startxgl, our startx replacement. Its contents:

Xgl -fullscreen :1 -ac -accel glx:pbuffer -accel xv:pbuffer & sleep 2 && DISPLAY=:1
# Start GNOME
exec gnome-session

/usr/share/xsessions/gnome-xgl.desktop, a new entry for the GDM session menu. Its contents:

[Desktop Entry]
Encoding=UTF-8
Name=gnome-xgl
Exec=/usr/local/bin/startxgl
Icon=
Type=Application

Then chmod +x them both.

We then need to enter GNOME as a regular user (if we are not already in it), and go to System/Preferences/Sessions/Autostart programs, and add beryl-manager to them. In the next GDM login, we will have an gnome-xgl option for a session. Choose it, and there you are.

Second, the screenshots (click to enlarge):


A window being minimized, fading away.


Two windows being shown as with MacOS exposè.


Two semitransparent windows. You can see my blog through a terminal :^)


A video, being played at the edge of a cube (the faces of which represent different desktops).


A video being played semitransparent. We can see an icon below it!


The video in the corner, plus it is raining all around!

Comments (2)

Installing Ubuntu Dapper Drake

After failing misserably to run Xgl in Debian Etch, I decided to install Ubuntu Dapper Drake (which allegedly supports it) in a spare partition of my hard disk. Below is the timeline of such an instalation:

13:27

Turn on computer, insert Ubuntu CD. Choose “run the CD as a LiveCD“. See it loading.

13:31

The LiveCD has booted, and I already have a fully functioning GNOME desktop. I spend 2 minutes playing around.

13:33

Select a link for “install Ubuntu on the hard disk”, and answer a couple of questions (username, password, language, time zone, keyboard layout), and off it goes…

13:36

It starts copying files to the hard disk.

13:44

Everything done. Asked whether I wanted to go on using the LiveCD by now, or directly restart to use the Ubuntu installed on disk. I choose the latter.

13:46

I am presented with GDM, which asks me to log in.

13:47

I am already inside GNOME, running my freshly installed Ubuntu OS!!

Summary

4 minutes for LiveCD working 100%, 20 minutes for full installation.

Comments (1)

On-board sound hijacking my SBLive

OK, I made a fresh install of Debian Etch on my home computer, and a sound problem appeared. My computer has a soundcard integrated in the ASUS A7N8X-E Deluxe motherboard (best piece of hardware I ever bought, this mobo), but I use a spare Sound Blaster Live! I took from my previous computer, so I want the sound to come out of the latter, not the former.

However, the kernel modules to control the on-board soundcard seem to get loaded first, and sound output defaults to it. There could be more elegant solutions, but mine was to copy the following in the /etc/rc.local file (this file gets executed after the /etc/init.d/ services started at boot time):

modprobe -r snd_intel8x0
modprobe -r snd_emu10k1
modprobe snd_emu10k1
modprobe snd_intel8x0

What these lines do is remove the module for the on-board sound (intel8x0), then the SBLive! one (emu10k1), then reload them, but the SBLive! one first.

Comments

Xgl with Xfce under Debian Etch

See http://www5.autistici.org/debian-xgl/x86-xgl-pkg/README

d/l .debs from http://www5.autistici.org/debian-xgl/debian/binary-i386/

see http://www5.autistici.org/debian-xgl/

add “/usr/share/fonts/X11/misc/” to the Xgl command in http://gentoo-wiki.com/HOWTO_XGL#Running_Xgl, otherwise it gives “could not open default font ‘fixed'”

Comments

Do one thing, do it well. Part II

This post is the continuation of a previous one. In that first part I mentioned the “bells and whistles” of most Windows programs being even counterproductive, and getting in the way of the user. Here I will elaborate on that.

Most GNU and Free Software applications for GNU/Linux and other Unix-like systems have the possibility of being called from the command line, appart from any GUI they may have.

One would think that no-one in his right mind would use an ugly CLI, where a visual point-and-click GUI exists. However, CLIs give a substantial flexibility, and I will illustrate this with an example.

Suppose you want your computer to remind you of the upcoming birthdays of your friends. Suppose you use Windows. Then, you have to find a program like Birthday Reminder Plus 2006, or whatever, which does it. Maybe you want to be reminded by e-mail… but you will have to make do with what the options in the BRP2006 GUI give you. If BRP2006 has a menu with: “Remind with a beep” and “Remind with a pop-up”, you will have to choose one, and that’s it. Windows programs don’t expect you to think or develop. They expect you to use Google, eMule and so on to download a pirated copy of a monolithic program that fits your needs. If BRP2006 has not an option for reminding you via e-mail, then you have to drop it alltogether, and keep searching for Birthday MegaReminder for PowerUsers 2007, which has such an option.

With GNU/Linux, maybe there is such a program, and you are free to use it. However, there are far better solutions, which you can tailor to your needs. The following is what I actually do to be reminded of birthdays:

First, I need a kind of “database” of birthdays, and a program that, reading this database, can extract the upcoming ones (the ones for which a given amount of days or less, are left). There are probably many of them, but I use one called simply Birthday. I haven’t found the Home Page of this program (to give it here), but I use the Debian package, mantained by Alexander Neumann. The “database” consists in a file called .birthdays that we have to place in our home/ directory. This file will contain lines like:

Bill Gates=30/09/666

Then, when called from the command line, it will output:

Bart[~]: birthday
Bill Gates is 1340 years old in 4 days' time.

If no option is given, birthdays in the following 21 days will be printed out. If you want to see birthdays in the following X days, just issue birthday -W X.

Second, this output is ugly. For example, the use of “is” is wrong, and “days’ time” could be shortened to “days”. To do so, we can pipe it through sed (another GNU utility):

Bart[~]: birthday | sed -e "s/ is / will be /;s/'.*//g"
Bill Gates will be 1340 years old in 4 days

Thus, sed substitutes ‘ is ‘ with ‘ will be ‘, and a literal ‘ and anything behind it ('.*) with nothing (effectively deleting it).

Third, we have to send this “Bill Gates will be…” to our e-mail address. For that, we will use the mail GNU command, like this:

Bart[~/]: birthday | sed -e "s/ is / will be /;s/'.*//g" | mail -s '[BIRTHDAY]' myaddress@myisp.org

This will send an e-mail to myaddress@myisp.org, with the subject [BIRTHDAY], and the body being the Bill Gates will be 1340 years old in 4 days text above.

Fourth, we need to automate this. For that, we can make a little Perl script:

#!/usr/bin/perl -w

#
# This scripts e-mails me to remind me of
# upcoming birthdays. It needs the ‘birthday’
# package.
#

use strict;

# Test if birthday package is installed:
die “No birthday package!\n” if (`which birthday` =~ /not found/);

# Read the list of upcoming birthdays, formated with sed:
my @bulk = `birthday | sed -e “s/ is / will be /;s/’.*//g”`;

# The e-mail address:
my $u = ‘a@b.c’;

# Send e-mail, if there is any upcoming birthday:
system “echo ‘ @bulk’ | mail -s ‘[BIRTHDAY]’ $u” if @bulk;

Next, we have to set this script to run periodically. We can do it with the GNU cron utility. This is a daemon, constantly running in the background (if its service has been activated), wasting negligible resources, and executing the task the users schedule, via the crontab command, or even a GUI like Kcron.

So, I use kcron to schedule the Perl script above to run everyday, at 7:01 am, et voilà! I receive an e-mail from my system every morning, reminding me of the upcoming birthdays.

Uf, all THAT has to be done?

OK, it sounds like a lot of work, for something our Birthday MegaReminder 2007 could do with half a dozen clicks.

Now, consider. The procedure outlined here is fully modular. Any time you want to modify something, you can act on the relevant step: e.g.: if you want to add a birth date to your list, you can just add it editing the ~/.birthday file. If you want to be reminded just once a week, the crontab should be modified. If you want to be reminded 73 days in advance, just add -W 73 to the birthday command in the Perl script. If you want the reminder to be sent to a list of e-mails, instead of only to yourself, you can modify the script accordingly.

The good part is that now you have learned how to use different tools, for different tasks: You have used cron here, but you can use elsewere to schedule ANY job. You have used mail here, but you can use it elsewere to send any text by e-mail, including the contents of a file, the output of a command, or a fixed text.

Maybe the Birthday MegaReminder has scheduling capabilities (like cron), running in the background and activating itself when appropriate. That’s fine but… can its scheduling capabilities be used for other programs? Sorry, no. If you want a periodic scheduler for program X, you have to buy, or pirate, a copy of a program which not only makes X, but also has scheduling capabilities. Maybe Birthday MegaReminder has e-mailing capabilities (like mail), but… can they be used to e-mail other things? Sorry, no.

With the GNU tools (like cron, sed and mail), when I want a program to connect to the Web, retrieve my horoscope, and send a copy to my e-mail, I don’t need a program that is good at sending e-mails or scheduling actions. I need a program that is good at retrieving horoscopes from the Internet. Then, I have tools to e-mail me with the output of such a program, and/or schedule its execution periodically.

Comments

Do one thing, do it well. Part I

If one reviews the Unix philosophy, it is readily seen a huge different from Windows-land. With Windows, every single task has huge programs, with a colorful graphical interface, menues galore, icons, flashing lights and all functionality incorporated into point-and-click buttons, scrolling bars etc.

All this is advocated in the name of “user friendliness”, that is, making it easy for the user. However, there are two major drawbacks I can see (there can be others). First, in a technical aspect, each and every program is a mammoth. Second, the flexibility and usefulness of these programs actually gets degraded with this policy. I’ll address the first question in this post, the second one in another one.

The “mammoth-ness” of proprietary programs happens because, since they forbid sharing code and information among their developers, they tend (have) to be mostly self-contained. This is highly counterproductive, because instead of sharing resources, they have to be replicated.

Think of the following (silly) example: I have programs A, B and C, all of which can produce red circles. Since their source code is closed, each one of them has to implement a piece of code (library) to make “red circles”. Each time one of the three programs is installed, it carries its own redcircles library, with its bugs and problems (and hard disk and memory resource waste). See Figure 1.

bad

Figure 1: Each program has incorporated a redcircles module.

If these programs were Free, they could all share a common redcircles package, which could be developed by other people. See Figure 2. This would let the developer of each program concentrate on the particular things their program does. And also disk space would not be wasted installing that library for each new program that uses it. A new A, B or C instalation would only need the installer to know that the extra package redcircles has to be also installed (a “required” package), if it already isn’t.

good

Figure 2: All programs share an external redcircles library.

The development of the redcircles package would also be much more efficient, because developing and debugging a single package would be much easier than doing so for each program that uses it.

Comments (1)

LaTeX: PowerDot

Tired of hearing that GNU/Linux is good for “technical things”, but not for visually appealing matters, such as presentations? Tired of hearing that LaTeX is good for 200-page books full of cross-references, tables and bibliograpy, but not for “other” documents?

Well, next time you can point your ignorant fellow to some LaTeX solutions for making fancy presentations.

You can find some overviews here:

Among the different programs and methods, I’d like to mention the Seminar and Prosper packages for LaTeX. Prosper was written by Timothy van Zandt, and is available as a package for Debian. However, the Prosper package had its capabilities extended by Hendri Adriaens, to create the HA-prosper LaTeX package. Later on, HA-prosper was dropped, and Adriaens and Christopher Ellison commited themselves to the development of PowerDot, a LaTeX class that would supercede both Prosper and HA-Prosper. The PowerDot class (and many others) can be found in the Debian package texlive-latex-recommended.

What Prosper, HA-Prosper and PowerDot do is (since you are using LaTeX) create a DVI, PS or PDF. Usually, your aim will be to create a PDF, since it even allows for fancy slide transitions (an infamous hability of you know who).

Examples of PowerDot presentations (taken from Adriaens’ site), can be accessed here: Example 1, Example 2, Example 3.

Actually, I am considering to use PowerDot to make the presentation of my PhD defense… I hope I don’t give up and end up using the GUI (and, thus, evil) programs KPresenter or (God forbid) OpenOffice.org.

Comments

LaTeX: footnotes in tables

Although an apparently widely known LaTeX issue, I came across it just today. Fact is if you use \footnote inside a \tabular environment, the footnote will be “trapped” inside the table, and actually never get displayed at all in the output.

You can find some possible solutions for that at the UK TeX FAQ on the Web.

The trick I’ll comment here is to use \tabularx, which is covered in the link above, and also at J.L. Diaz’s LaTeX blog[es].

The “problem” is that \tabularx requires a fixed table width value to be input by the user, so the following will fail misserably:

\usepackage{tabularx} % required in the preamble
\begin{tabularx}{100mm}{|c|c|} \hline
A & B \\ \hline
C & D \\ \hline
\end{tabularx}

Why? Because the {c} especification (to center the text inside the cell) makes the affected column as wide as necessary, not more (so will {r} or {l}). The output can be seen below:

The effect of the whole table being actually wider than the sum of the integrating colums could be partially “concealed” if the \hlines were eliminated, but the table would still be actually incorrectly wide, which would make things like aligning the whole table “fail” (to the eye).

Fortunately, the tabularx package provides a way to tell LaTeX that a column must be of the necessary width, so that the sum of colum widths equals the total column width. This is the {X} keyword (notice the capitalization of the “X”). E.g.:

\begin{tabularx}{100mm}{|c|X|} \hline
A & B \\ \hline
C & D \\ \hline
\end{tabularx}

This makes the first column just as wide as needed, not more (the {c}), and then, the second column will be as wide as needed to reach the 100mm. The output:

If multiple columns are given the {X} keyword, they will all have the same width, precisely the one required to meet the total table width.

Comments (3)

Sudaku released

I previously posted about the sudoku fever that had attacked my family. I have found amusing solving some sudokus, but what I really thought was interesting was making a computer program to solve them automatically. Not that it would be more “challenging” (some sudokus are quite difficult), just more fun for me.

OK, so that I did, and today I have released a Perl program that (hopefully) solves any sudoku we feed to it. The program is called Sudaku (well, one sweats when solves a sudoku, doesn’t one?), and can be freely downloaded from my home page. I have licensed it under the GPLv2.

Yes, I know there are other sudoku solvers around, probably better than mine, on top of that. However, I just wanted to make it, and releasing it may help someone, or (more probably) even me, if some better programers than me out there e-mail me proposing changes/corrections.

What the heck, I just felt like releasing it! :^)

Comments

Why use LaTeX

Somehow (don’t remember exactly) I came across this LaTeX advocacy page, in which some reasons are given as to why use the typesetting software the reader must already know I use and love: LaTeX.

Comments

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »