Gource – graphical representation of software version control (svn, git, mercurial, bazaar)

Gource – graphical representation of software version control:
http://code.google.com/p/gource/

FormAlchemy 1.4.1: language selection – fieldset.render(lang=’fr’) ignored – solution

I’m using FormAlchemy 1.4.1, SQLAlchemy 0.7.2, Plone 3.3.4, Python 2.4.6

What steps will reproduce the problem?

  1. create a fieldset with a date field
  2. call fieldset.render(lang=’fr’)
  3. the form uses English language (ie months)

With a bit of debug, I finally got it working by adding:
fieldset.mydatefield.set(html=[('lang', 'fr')])

Details:
I noticed “DateFieldRenderer” uses “FieldRenderer.get_translator” to get the correct translation.
“FieldRenderer.get_translator” expects and argument ‘lang’ in kwargs.
The kwargs come from “AbstractField.render”, this “render” method calls “AbstractField._get_render_opts”; “_get_render_opts” reads “render_opts” and “html_options” from the field.
“render_opts” (that I’d set using fs.mydatefield.set(options=….)) can’t handle a ‘lang’ entry, but the “html_options” (that I’d set using fs.mydatefield.set(html=….)) accept the lang option.
Therefore “fieldset.mydatefield.set(html=[('lang', 'fr')])” seems to work, but I expect this to be a workaround ( http://docs.formalchemy.org/formalchemy/internationalisation.html ).

Max Ehrmann, Desiderata

Va’ serenamente in mezzo al rumore e alla fretta,
e ricorda quale pace ci può essere nel silenzio.

Finché è possibile, senza cedimenti,
conserva i buoni rapporti con tutti.
Di’ la tua verità con calma e chiarezza,
e ascolta gli altri,
anche il noioso e l’ignorante,
anch’essi hanno una loro storia da raccontare.
Evita le persone volgari e aggressive,
esse sono un tormento per lo spirito.

Se ti paragoni agli altri,
puoi diventare vanitoso o aspro,
perché sempre ci saranno persone superiori ed inferiori a te.

Rallegrati dei tuoi successi come dei tuoi progetti.
Mantieniti interessato alla tua professione, benché umile,
e’ un vero patrimonio nelle fortune mutevoli del tempo.
Sii prudente nei tuoi affari,
poiché il mondo é pieno di inganno.
Ma questo non ti renda cieco su quanto c’è di virtuoso,
molte persone lottano per alti ideali,
e dovunque la vita e’ piena di eroismo.

Sii te stesso.
Specialmente non fingere negli affetti.
E non essere cinico riguardo all’amore,
perché a dispetto di ogni aridità e disillusione
esso e’ perenne come l’erba.

Accetta serenamente l’insegnamento degli anni,
abbandonando con grazia le cose della giovinezza.
Coltiva la forza d’animo per difenderti dall’improvvisa sfortuna.
Ma non angosciarti con fantasie oscure.
Molte paure nascono dalla stanchezza e dalla solitudine.

Al di la’ di una sana disciplina,
sii delicato con te stesso.
Tu sei un figlio dell’universo,
non meno degli alberi e delle stelle;
tu hai diritto ad essere qui.
E che ti sia chiaro o no,
senza dubbio l’universo va schiudendosi come dovrebbe.

Perciò sta in pace con Dio,
comunque tu Lo concepisca,
e qualunque siano i tuoi affanni e le tue aspirazioni,
nella rumorosa confusione della vita conserva la pace con la tua anima.

Nonostante tutta la sua falsità, il lavoro ingrato ed i sogni infranti,
questo è ancora un mondo meraviglioso.
Sii allegro.
Sforzati di essere felice.

Max Ehrmann, Desiderata

Ansel Adams

Non ci sono regole per una buona foto, ci sono solo buone fotografie. / Ansel Adams

Ho sempre pensato che la fotografia sia come una barzelletta: se la devi spiegare non è venuta bene. / Ansel Adams

L’assoluta facilità con cui possiamo produrre una immagine banale porta spesso ad una totale mancanza di creatività. / Ansel Adams

Molti ritengono che le mie immagini rientrino nella categoria delle “foto realistiche”, mentre di fatto quanto offrono di reale risiede solo nella precisione dell’immagine ottica; i loro valori sono invece decisamente “distaccati dalla realtà”. / Ansel Adams

Ci sono due persone in ogni foto: il fotografo e l’osservatore. / Ansel Adams

Fotografia. Un’austera e sfolgorante poesia dal vero. / Ansel Adams


Linux: enable history for user (howto)

Example: enable history for root user.
Edit ‘bash_profile’:

sudo vi /root/.bash_profile

And add the following two lines:

 HISTFILE='/root/.bash_hystory'
 export HISTFILE

Notes
.bash_profile is executed for login shells (via console, either sitting at the machine, or remotely via ssh).
.bashrc is executed for interactive non-login shells (ie: you’ve already logged into your machine and open a new terminal window inside Gnome or KDE)

Google Bookmarks – Firefox shortcut (no addon)

This is a small script you can use to place a special bookmark that will let you save current page in your google bookmarks.
No add-ons are required and it really easy to use.

  1. Create a new bookmark: Bookmarks > Show all bookmarks > Bookmarks menu > Organize > New bookmark
  2. Set “name” with something like “Google Bookmark”
  3. In the “location” field add the following code:
    javascript:(function(){var%20a=window,b=document,c=encodeURIComponent,d=a.open('http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk='+c(b.location)+'&title='+c(b.title),'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=420px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300)})();
  4. Done!

Everytime you need to save a google bookmark just click on the Bookmarks menu, select your special bookmark called “Google Bookmark” and enjoy!

Browsing a REST interface with Firefox and ModifyHeaders

Install ModifyHeaders for Firefox:
https://addons.mozilla.org/en-US/firefox/addon/modify-headers/

Then open config panel and add your custom headers to access the REST service.
A single header has a name and a value, so it’s something like:

 Name: X-Gallery-Request-Key
 Value: b333837c...

Add all the custom headers you need, then press “start”.
Now you can browse your REST url with firefox ;)

At last

And I am lost so lost
But you’re the constellations
That guide me

Ubuntu 10.10 audio equalizer

Open terminal, type:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update && sudo apt-get install pulseaudio-equalizer

Then open “Applications > Sound & Video > PulseAudio Equalizer” and … have fun!

Linux Mint 12, Dell Vostro 3750 laptop, enable/disable touchpad (howto)

Steps to get a simple shourtcut to enable/disable touchpad on a dell 3750 (it should work also on other laptops):
1. create a custom bash script “toggle-touchpad” (see details here) with this code:

#!/bin/bash

# this script queries the status of the ImPS/2 ALPS GlidePoint device
# via xinput and disables / enables the device accordingly.

#get touchpad id
XINPUTNUM=`xinput list 'ImPS/2 ALPS GlidePoint' | sed -n -e's/.*id=\([0-9]\+\).*/\1/p'`

TPSTATUS=$(gconftool-2 -g /desktop/gnome/peripherals/touchpad/touchpad_enabled)

#if status fails, exit 1
test -z $TPSTATUS && exit 1
if [[ $TPSTATUS == true ]]; then
xinput set-int-prop $XINPUTNUM "Device Enabled" 8 0;
gconftool-2 --type bool -s /desktop/gnome/peripherals/touchpad/touchpad_enabled false
else
xinput set-int-prop $XINPUTNUM "Device Enabled" 8 1;
gconftool-2 --type bool -s /desktop/gnome/peripherals/touchpad/touchpad_enabled true
fi

Thanks to http://ubuntuforums.org/showthread.php?p=11504018 for this script (these guys kick ass)

2. check that the script works (run the script to enable/disable touchpad).

3. create a keyboard shortcut for your script:
- open “System Settings > Keyboard > Shortcuts > Custom Shortcuts”
- click on “+” and type “toggle-touchpad” in the name field, and the path to your script in the command field (should be something like “/home/john/bin/toggle-touchpad” )
- click “Apply”
- click on “Disabled” column and type the shourtcut you’d like to use (something like Ctrl+Alt+0)

4. close and test your new shortcut ;)

Page 1 of 612345...Last »