giovedì 27 gennaio 2011

ATI Radeon HD 3450 & Ubuntu Lucid Lynx 10.04

Driver radeon: I'm experiencing a lot of problems with this cheap card

VGA compatible controller: ATI Technologies Inc RV620 LE AGP [Radeon HD 3450]

using the driver radeon on Ubuntu 10.04: inability to use Compiz, slow flash videos, ridicolous performances in general. 
The main cause: KMS.
"Kernel mode-setting (KMS) shifts responsibility for selecting and setting up the graphics mode from to the kernel. When is started, it then detects and uses the mode without any further mode changes. This promises to make booting faster, more graphical, and less flickery."

Solution (for me):
  1. Open /etc/default/grub in a text editor
  2. Replace



    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.modeset=1"

  3. Update grub2: sudo update-grub
  4. Reboot
Note 1: Pay attention to grub2: in my humble opinion it's the worst software I have ever seen on Ubuntu.

Note 2: Not tested yet but the following fix should work fine:

echo options radeon modeset=1 > /etc/modprobe.d/radeon-kms.conf

If so,  don't modify /etc/default/grub.

Driver fglrx:  this fantastic installation guide explains all we need to know about the driver fglrx. I recommend to install the driver manually.

Note: if we installed the driver and, after the reboot, Xserver returns an error like this:

(EE) Can't load FireGL DRM library (
(EE) fglrx: Failed to load module "fglrxdrm" 
(module does not exist, 0)
(EE) fglrx(0): Failed to load DRM library
(EE) fglrx(0): Preint failed
(EE) Screen(s) found, but none have a usable configuration.

probably update-alternatives has not created symbolic links to the files in the fglrx directory because the very related gl_conf entry has been set to manual. we have to remove the driver, and change the gl_conf into automatic mode before a new installation with this command:

sudo update-alternatives --auto gl_conf

another lecture of interest about this argument here.

AFAIK, the unique issue for me with this driver regards the bttv driver: if I run tvtime, bttv returns a bunch of these messages:

bttv0: timeout: drop=29 irq=46/104431, risc=3261a4d4,

Unloading and reloading bttv is a temporary fix that works for now.

Best regards.

mercoledì 26 gennaio 2011

Google Toolbar - EZRSS rss feed for EZTV

I wrote a simple push button for EZRSS that you can add to the Google Toolbar. When clicked on, the button can search for the text the user has typed into the toolbar search box and show the rss feed with a dropdown menu. You can use it to have your bittorrent client download your favourite shows from eztv as they get released.

Best regards.

lunedì 24 gennaio 2011

Cool way to install Maya Bonus Tools for Maya 2011 Subscription Advantage Pack

Treige has suggested a cool way to install Maya Bonus Tools for Maya 2011 Subscription Advantage Pack.
By the way,  if we have installed bonus tools manually, adding paths to the env variables MAYA_PLUG_IN_PATH and MAYA_SCRIPT_PATH, we could notice that the help item doesn't work. In this case we have to open

C:\Program Files\Autodesk\MayaBonusTools2011\scripts\bonusToolsMenu

and replace the line:

-c "bonusToolsHelp \"docs/bonusTools.html\""


-c "bonusToolsHelp \"/docs/bonusTools.html\""

This is the sign that a manual install doesn't work fine.

Best regards.

venerdì 21 gennaio 2011

Setting up Animal Logic MayaMan to work with Maya 2011 on Windows

MayaMan is a plug-in which allows Maya users to render scenes with Renderman compliant renderers. The latest release for Windows x64 (3.0.08) was developed with Visual C++ 2010, so it's important to check if our pc has the Microsoft Visual C++ 2010 Redistributable Package installed.
The Microsoft Visual C++ 2010 Redistributable Package installs runtime components of Visual C++ Libraries required to run applications on a computer that does not have Visual C++ 2010 installed.
The package can be downloaded here.
If we don't have an installer, we have to install the plug-in manually:

  1. Extract the file wherever you want (ie: C:\Program Files\Animal Logic\)
  2. Specify some environment variables that affect MayaMan's behaviour. Read here how to do that:

    variable nameMAYAMANROOT
    variable valuepath\to\mayaman3.0.08_64

    variable name: MAYA_PLUG_IN_PATH
    variable path:   %MAYAMANROOT%\plugins\2011

    variable name: MAYA_SCRIPT_PATH
    variable path:   %MAYAMANROOT%\mel

    variable name: XBMLANGPATH
    variable path:   %MAYAMANROOT%\mel
  4. Run Maya and load the plug-in.

Best regards.

Automatizzare download dei sottotitoli da µTorrent

A partire dalla versione 2.2, µTorrent permette di settare nelle opzioni generali un comando automatico da eseguire alla fine di ogni download. Come si vede nell'immagine a sinistra, dopo anni di richieste, questa possibilità è offerta in modo globale per ogni download. Nella scheda Avanzate - Esegui programma c'è un campo di testo con la possibilità di impostare un comando da eseguire quando termina il download .

E' possibile utilizzare questa opzione per automatizzare il download dei sottotitoli di serial tv da un sito tipo In particolare la utilizzo con un programma che ho scritto, JSubs, che serve  proprio per il download di sottotitoli. Se non ho JSubs che gira in background con il suo timer e non ho voglia di utilizzare il tasto destro del mouse per scaricare i sottotitoli, posso ricorrere a questa possibilità.

Su Windows, basta inserire questa riga nel campo di testo:

C:\Programmi\JSubs\JSubsCMDL.exe --started-from-file "%D\%F"

modificando ovviamento il percorso alla cartella (C:\Programmi\JSubs\)in cui è stato scompattato JSubs. JSubsCMDL.exe è la versione da riga di comando della GUI ed è usato essenzialmente per il menù contestuale, è spiegato un po' meglio qui. JSubsCMDL.exe è in grado di controllare se il file è un video e se è un serial tv, quindi è l'ideale per questo compito.
Se i sottotitoli non vengono trovati, il programma chiede con message box cosa fare. E' anche possibile far eseguire le operazioni in modo del tutto "silenzioso", utilizzando questa stringa:

C:\Programmi\JSubs\JSubsCMDL.exe --silent --started-from-file "%D\%F"

Se i comandi non dovessero funzionare (a me funziona tutto), si può creare nella cartella di JSubs un file uTorrent.bat
@echo off
if "%*" == "" goto error
echo "%*"
cd "C:\Programmi\JSubs"
java -jar JSubsCMDL.jar --started-from-file "%*"
echo Indicare il percorso al video
echo uso: uTorrent percorso/video
echo Operazione eseguita con successo.
modificando, come prima, il percorso della cartella di JSubs. La riga da utilizzare in questo caso sarà:

C:\Programmi\JSubs\uTorrent "%D\%F"

Lo svantaggio di questo metodo è che il file bat eseguito da µTorrent apre un prompt dei comandi durante il download dei sottotitoli. Per far girare tutto in modo invisibile bisognerebbe utilizzare uno dei metodi descritti qui, su stackoverflow. In particolare lo script invis.vbs funziona molto bene:

wscript C:\Programmi\JSubs\invis.vbs C:\Programmi\JSubs\uTorrent.bat %D\%F

Su Ubuntu l'operazione è più noiosa e complessa: con wine va installato JRE di Sun per Windows (a sinistra). Il JRE si installerà nella cartella di wine e java sarà disponibile per tutti i programmi che ne avranno bisogno. Il comando da usare con µTorrent  in questo caso è:

H:\Programmi\JSubs\JSubsCMDL.exe --started-from-file %D\%F

Va detto che, su Ubuntu 10.04, la versione 2.2 di µTorrent non funziona, va scaricata l'ultima beta disponibile.


giovedì 6 gennaio 2011

Mozilla - Dynamically filling menus

I'm updating a toolbar extension for Firefox I wrote last year. I have 3 toolbarbuttons with menupopups filled dynamically. A Javascript function called by an onpopupshowing handler retrieves the contents from the internet, builds the menuitems and adds them to a menupopup at runtime. Obviously the function depends on the remote server response speed and on my internet connection. In addition, the function takes a little time to manipulate the data. In short, in my case, the process of retrieving contents and filling a menu takes about half a second, so, if I click on the toolbarbutton, a very little white rectangle is showed for a split second before the menu appears.
I'd like to delay the menu appearence but it seems quite difficult.
According to Mozilla, if we have nothing to show on a menu, we should follow the standard used in Firefox: show a single disabled item with an "(Empty)" label. If filling the menu takes a noticeable amount of time, we should not make Firefox (and users) wait for it to fill up before displaying anything. It's best to show an item with a throbber image (chrome://global/skin/icons/loading_16.png) so the user knows there's something going on, and asynchronously fill its contents.
I'm still wondering if it's possible to delay the menu appearence.

Best regards.

martedì 4 gennaio 2011

Parsing HTML string to get links in Javascript

Recently I needed a Javascript function to retrieve links from a HTML string. Unfortunately I couldn't use third party powerful tools like jquery, so I thought to use RegEx.
Let's assume we have a HTML page like this:
        <a href="" title="Google Site">Google</a>
        <a href="" title="Mozilla Site">Mozilla</a>
        <a href="" title="Blogger Site">Mozilla</a>
This page contains links to Google, Mozilla and Blogger. How can we get the links from the HTML content?
<script language="JavaScript" type="text/javascript">
function getLinks() {
    var html = "<html> \
                <body> \
                <a href=\"\" 
                   title=\"Google Site\">Google</a> \
                <a href=\"\" 
                   title=\"Mozilla Site\">Mozilla</a> \
                <a href=\"\" 
                   title=\"Blogger Site\">Blogger</a> \
                </body> \

    var links = [];

     /[^<]*(<a href="([^"]+)" title="([^"]+)">([^<]+)<\/a>)/g, 
     function() {
        links.push(Array(), 1, 5));

The getLinks() function retrieves the links from the HTML content and puts them into an array. "The slice method creates a new array from a selected section of the links array". Some useful informations about the slice method here.

So at the end we have an "array of array". If we want to retrieve a single element, we can call it as links[x][y], where x is the row and y is the column.
For example, let's assume we want to extract some information from the first link:
alert("First link (Google):\n" +
      "Destination anchor: " + links[0][1] + "\n" +
      "\"title\" attribute: " + links[0][2] + "\n" +
      "Source anchor: " + links[0][3]);
The function has several limits: for example it's case sensitive and depends on the A element. In the case above, the href and title attribute are set, but if we have an A element like this:
<a href="">Google</a>
without the title attribute, the function won't work. In that case, we should modify the regex in this way
     /[^<]*(<a href="([^"]+)">([^<]+)<\/a>)/g, 
     function() {
        links.push(Array(), 1, 4));
Best regards.

lunedì 3 gennaio 2011

One year old

The 50th post is all dedicated to the first birthday of this blog. One year ago I started writing this little diary with no expectation, but in the hope to give back to internet a bit of what I was in receipt of. How many times do we earn money, create something or fix problems simply browsing the internet? We digit our keywords and someone somewhere helps us. The idea was to be the nth someone, one of many, to expand that marvelous microcosm of the internet community, the best form of cohabitation I have never seen, even though it's not free from problems. So I hope not to have written too much crap.
I don't want to miss the opportunity to thank the visitors ( I didn't expect so many ) and who took the trouble to mail me. Thanks a lot.
This post is planned for January, 3rd 2011 and it isn't too late to wish you a happy new year.

Best regards.