November
Sub-archives
Nov 25, 2009
A cloud of colors in Plone
A small customization to Vaporisation's template, an excellent product for viewing tagcloud.
Vaporisation (also available as an egg) can display on your site a portlet with the cloud of the keywords used in the site.
If you are not satisfied with the standard monochrome display, you can quickly customize the template to add the CSS classes that give more color.
Copy the original template cloud.pt in your browser folder on your Plone theme (the classic theme created with paster).
Go to the configure.zcml file in the same folder and add these few lines:
... <include package="vaporisation"/> <!-- Portlet tagclouds --> <plone:portletRenderer portlet="vaporisation.interfaces.IVaporizedCloud" template="cloud.pt" layer=".interfaces.IThemeSpecific" /> ...
Save and Close.
Now open your file cloud.pt. First, you could add to portlet a specific css class:
<dl class="portlet portlet-tagcloud"
i18n:domain="vaporisation"
tal:attributes="id string:portlet-${context/getId}"
...
Moved a bit lower down, where tags are defined:
<a href=""
tal:content="tag/name"
tal:attributes="style string:font-size: ${tag/size}%;;;
href string:${link}${tag/name};
title string:${tag/name} (${tag/weight});" />
Add to the attributes list the CSS class:
<a href=""
tal:content="tag/name"
tal:attributes="style string:font-size: ${tag/size}%;
class python:'size_'+str(tag['size'])[:2];
href string:${link}${tag/name};
title string:${tag/name} (${tag/weight});" />
There is no need to change much, nor to extend the original python class.
In this way each different tag size will be associated with a CSS class like "size_10", "size_11" , ..., that you can assign a color:
...
.vaporized-tag a.size_13 {
color: #006600;
}
.vaporized-tag a.size_14 {
color: #008080;
}
.vaporized-tag a.size_15,
.vaporized-tag a.size_16 {
color: #761911;
}
...
The end result will not be very different from this ... look at the bottom of the page :)
Nov 23, 2009
Un italiano a Budapest
Non vi racconterò di talk, di tecnologie, di nuove feature. Non vi racconterò nemmeno dell'ultima e della prossima release di plone. La mia gita alla plone conference è stata un viaggio emozionante tra persone e idee.
Non so esattamente quale sia la percezione dall'esterno, ma ogni anno la conference rappresenta, per me, la possibilità di ritrovare vecchi amici che hanno una passione in comune.
Si parte!
Già alla cena pre-conference l'accoglienza è stata incredibile.
Aaron aveva un posto buono a fianco a lui e subito i gruppi si sono mescolati: italiani, americani, polacchi, francesi, tedeschi, olandesi.
Tutti li' a parlare di tutto. C'era quello mi chiedeva di amberjack, quello che si ricordava di un piatto italiano e voleva la ricetta, quello che ti racconta che si è finalmente preso una spider e ne è così orgoglioso.
Tutto come se fossimo vecchi compagni di scuola che hanno condiviso qualcosa di particolare e prezioso.
Spesso si dice:
plone il cms, plone il framework, ma soprattutto plone la comunità
La solita retorica, trita retorica, dell'open source, vero? beh, magari no.
Se ne sei fuori, o meglio se ne vuoi stare fuori, sei libero di vederla così, ma così non è. Frequento e ho frequentato in passato altre comunità (i partner ibm, i lug, l'xpug) e nonostante abbia incotnrato alti livelli di eccellenza, questa community è quella più coinvolgente, appassionante, e professionalmente energizzante.
ZEA
Il gruppo ZEA si è riunito dopo diverso tempo in una riunione live. Ho potuto conoscere di persona e di scambiare opinioni con Matt, Russ, Kit e Jean Paul, che conoscevo solo in modo marginale, ma anche di rivedere vecchi amici come Xavier e Godefroid. E' stato utile, credo che il gruppo sia oggi più compatto e propositivo.
Plone Italia
Il riaggregarsi del gruppo italiano è stato allo stesso modo entusiasmante.
Ognuno aveva la sua idea, il suo modo di vedere le cose. E si è discusso, preso in considerazione le varie tesi.
Quello che ne è venuto fuori lo potete o lo avete letto sulla ML, ma il punto interessante, ancora una volta, non è stato solo il risultato finale.
Il confronto, il discutere, il mettere in dubbio quello che è il tuo piccolo mondo di fronte agli altri è un modo estremamente appagante di crescere. E ti rendi conto che dopo 12 anni di lavoro e non so quanti di informatica, non sei ancora arrivato. C'è sempre qualcuno che ha qualcosa di nuovo da raccontarti un punto di vista diverso, e cresci.
collective.amberjack
Poi c'è stata la mia personalissima ciliegina sulla torta: collective.amberjack.
Ho potuto presentarlo in un talk ufficiale, ho "guidato" uno sprint e raccontato a tutti gli sprinter gli avanzamenti del lavoro fatto.
Messa giù così ha un che di vagamente autocelebrativo e presuntuoso. E sicuramente una parte di me è decisamente soddisfatta dell'interesse che ne è uscito. Il punto però è un altro.
Perdersi nella comunità
Ho sempre visto tutti coloro che contribuivano come una specie di esseri con capacità tecniche, qualità personali di livello superiore.
Il che in parte è anche vero. Quello che è, però, ancora più vero non sono le capacità tecniche, ma la voglia di proporsi e di perseverare.
In fondo quello che è cambiato in me rispetto alle precedenti conference è stato il voler mettere sul piatto quello che so fare, tanto o poco non importa. La comunità ha apprezzato ed evidenziato. Poi, magari, amberjack sarà stata anche un buona idea, ma in ogni caso è stato l'impegno che ha fatto la differenza.
E' la differenza che passa tra lo stare nell'ombra e sfruttare l'open source, come molti purtroppo fanno, e il fondersi nella comunità: più dai, più ti impegni, più avrai in cambio in termini di credibilità, riconoscenza, amicizia!
Ritorno a casa
Alla fine del viaggio la lezione imparata è che tutta la retorica dell'open source, del fatto che tutti possono contribuire, che è la community che segna la strada è niente di più che la realtà.
Non ci si può, però, limitare a raccontarla (alle conferenze, ai linux day, in post sui blog), occorre declinarla in azioni, in codice, in attività, in quello che sai fare.
Allora? che pensi di proporre alla prossima ploneconf?
Nov 20, 2009
Dominopoint Day 2009: la nostra presentazione
Nov 16, 2009
A Tiny step for more accessibility in Plone
In last months I'm keeping updated a branch of TinyMCE that can be very interesting for Italian users of Plone (but not only...)
For a preamble for all who didn't know nothing about it, lets me say some words on the Italian law for accessibility: the so called Stanca Act.
The Italian Legislation on Accessibility force all newly created public websites to keep 22 requirements, mainly taken from the WCAG 1.0.
For how Plone is designed (trying to fulfil the WCAG at AA level) a lot of required work is just done (I really like when this happen)!
There are only 2 requirements that keep our head busy every time we develop a new site for an Italian public agency:
- Requirement 1
- The (X)HTML must follow the Strict DTD.
- Requirement 10
- "[...] associate data cells and header cells in data tables that have two or more logical levels of row or column headers."
For us the requirement 1 is a fight against the Transitional DTD of Plone (see also the #4379). Of course, this mean we are always forced to fix manually some Plone templates, but at the end after 4 year this become a well know job!
The real problem is the XHTML code that users put inside the WYSIWYG editor... this must provide us XHTML Strict code someway!
When Kupu was the Plone choice this was a difficult... sometimes our choice was to put a layer between the editor work and the end user, fixing the code using the uTidylib!
In the perfect world the WYSIWYG editor itself must return us the XHTML Strict code...
Again: the requirement 10 is also a WYSIWYG editor problem. Kupu is not helping us to add additional cell info on created tables.
Welcome TinyMCE
The future (but already available) WYSIWYG editor for Plone 4 is TinyMCE.
The output code of TinyMCE is "more strict" than the Kupu ones... only some minimal fixes are needed. If facts the only validation error found right now if the use of the type attribute for ordered and unordered list (not available in XHTML Strict).
We are keeping updated a TinyMCE branch you can download and test from the collective; it fix the 2 problems described.
First of all: it's not using the type attribute again, but instead it applies a CSS class. An additional small stylesheet make the rest. For details see changes.
The other missing feature is to help the editor to add more attribute to table cells and headers. The simpler solution from the W3C is to provide the scope attribute.
When I started this task I was sure that this was going to steal me a lot of time... but again TinyMCE was a nice surprise!
The patch applied is simple; for some reason TinyMCE support the scope natively but it's disabled (probably only in the Plone version?). As you can see in changes done, my work was very quick (and again: I like when this happen)!
And now?
Keeping updated the code is a quite simple task, but I don't like the idea to branches forever. Also note that:- The first fix above is also valid for XHTML Transitional pages
- The new scope attribute feature can be useful also outside a Stanca Law environment.
So?
We proposed to merge those changes in the TinyMCE core!
Nov 13, 2009
How to write funkload test in few minutes
After PloneConf2009 I noticed interesting changes in collective.recipe.funkload. Right now writing a simple test for funkload is just few steps.
After Plone Conference 2009 I noticed interesting changes in collective.recipe.funkload and in collective.funkload itself. Right now writing a simple stress test for funkload is much easier - you can do it in few steps.
Let's start with creating a simple package called mytest:
$ ls ./mytest boostrap.py buildout.cfg setup.py src $ ls ./mytest/src/mytest __init__.py tests $ ls ./mytest/src/mytest/tests __init__.py test_Simple.py Simple.conf
buildout.cfg is also simple:
[buildout]
develop = .
parts = funkload
[funkload]
recipe = collective.recipe.funkload
url = http://www.plone.org
eggs = mytest
where www.plone.org is the url to the site you want to test (it doesn't need to be on you localhost)
Now the funkload test configuration file (Simple.conf):
[main]
title=Simple
label=Simple test for blog.redturtle.it
description=Simple test scenario
[test_Simple]
description=Simple test scenario
[ftest]
log_to = console file
log_path = Simple-test.log
result_path = Simple-test.xml
[bench]
cycles = 5:15:30
duration = 100
startup_delay = 2
sleep_time = 2
cycle_time = 2
log_to = file
log_path = Simple-bench.log
result_path = Simple-bench.xml
sleep_time_min = 2
sleep_time_max = 2
In this example most important bench configurations:
- cycles = 5:15:30 - contains 3 cycles: for 5, 15 and 30 concurrent users
- duration = 100 - duration of one cycle in seconds
- startup_delay = 2 - time to wait between starting-up threads in seconds
- sleep_time = 2 - time to wait between test in seconds
- cycle_time = 2 - time to wait between cycle in seconds
And the funkload test scenario (test_Simple.py)
import unittest
from collective.funkload import testcase
class Simple(testcase.FLTestCase):
"""Simple load test scenario."""
def setUp(self):
"""Setting up test."""
self.logd("setUp")
self.label = 'Simple test'
self.server_url = self.conf_get('main', 'url')
def test_ReadOnly(self):
self.get(self.server_url + "/",
description="Get /")
self.get(self.server_url + "/login_form",
description="Get /login_form")
self.post(self.server_url + "/login_form", params=[
['came_from', self.server_url],
['form.submitted', '1'],
['js_enabled', '0'],
['cookies_enabled', ''],
['login_name', ''],
['pwd_empty', '0'],
['__ac_name', 'admin'],
['__ac_password', 'admin'],
['submit', 'Login']],
description="Post for login a user /login_form")
self.get(self.server_url + "/folder/document1",
description="Get /folder/document1")
self.get(self.server_url + "/logout",
description="Get /logout")
def tearDown(self):
"""Setting up test."""
self.logd("tearDown.\n")
def test_suite():
return unittest.makeSuite(Simple)
additional_tests = test_suite
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
It's a very simple scenario in which we are:
- opening plone site (get /)
- opening login_form (get /login_form)
- sending a post with login credentials (post /login_form)
- opening a document (get /folder/document1)
- logout (get /logout).
Now you need to bootstrap the buildout:
$ cd mytest $ python bootstrap.py
lunch the buildout:
$ ./bin/buildout
and lunch the bench:
$ ./bin/funkload bench -t mytest.tests.test_Simple
final report you can find in your buildout directory:
$ ls ./var/funkload/reports/2009-11-11-19-40-20 test_Simple-20091111T194020 $ ls ./var/funkload/reports/2009-11-11-19-40-20/test_Simple-20091111T194020 funkload.css index.html index.rst tests.data tests.gplot tests.png
For more information please check:
Nov 12, 2009
Plone nuovamente premiato agli Open Source CMS Awards
Dopo il secondo posto del 2007 e il primo posto nel 2008, Plone si conferma la miglior scelta nella categoria "other open souirce CMS"
Packt Publishing, uno dei leader nell'editoria relativa al software libero, organizza ogni anno il premio "Best open source CMS".
A partire dallo scorso Giugno, dopo che un panel di esperti ha selezionato i "top five" della categoria "Other open source CMS", i voti del pubblico sono affluiti fino alla fine di Ottobre, decretando il successo di Plone, come già nel 2008.
Per noi che conosciamo Plone e ci lavoriamo quotidianamente, questo risultato non è certo una sorpresa: per chi non lo conosce ancora, può essere un importante elemento di valutazione.
C'è da dire che, di anno in anno, gli organismi di terza parte che valutano i CMS con griglie molto severe, come il CMS watch, collocano regolarmente Plone ai livelli più alti come prestazioni complessive. E' importante diffondere il concetto che Plone è davvero un sistema completo e di classe enterprise, e interessa a tutti (a noi come ai Clienti) che riconoscimenti come questi stiano a dimostrarlo.
Nov 09, 2009
Ploneconf2009: un breve sommario
Archetypes è morto: lunga vita ad Archetypes
Trovo finalmente il tempo di riassumere i punti salienti della Ploneconf 2009 di Bupadest.
La grande verità
Per la prima volta dai tempi di Plone 2.0 sono davvero convinto che il nostro amato e ben conosciuto Archetypes venga lentamente mandato a morte. La sua sarà una lenta e non facile caduta e molto probabilmente i suoi pezzi vivranno fino ai tempi di Plone 5, ma a differenza di tutte le altre volte l'alternativa che si sta disegnando è reale e soprattutto da qualcosa che Archetypes non aveva.
Sto ovviamente parlando di Dexterity. Questo nuovo framework promette maggiore velocità (il talk di David Glick intitolato "Building Content Types with Dexterity" ha anche mostrato qualche cifra, ma nulla di eccezionale a dire il vero, un particolare confermato anche da Wichert Akkerman nel suo intervento di cui parlo sotto), si integra in modo completo con la ZCA e l'uso delle interfacce... ma non sono questi i particolari che credo determineranno il suo successo.
Per la prima volta non si sta semplicemente fornendo una modo alternativo, ideologicamente più bello ma nella pratica più limitato, per ottenere esattamente quello che Archetypes già fornisce (ho visto vari di questi tentativi in passato, e anche Rok Garbas ci ha riprovato nel suo talk intitolato "Complex Forms with z3c.form"). Dexterity offre una grande nuova funzionalità che è la generazione dei contenuti via Web!
Per chi di voi ha già usato prodotti come ATSchemaEditorNG e derivati, questo potrebbe non sembrare niente di veramente nuovo, ma questa volta la differenza sta nel fatto che questi contenuti saranno esportabili come codice perfettamente funzionante e modificabile.
L'utente Plone potrebbe quindi generare autonomamente i propri modelli dati e richiedere interventi di sviluppo sono per ottenere risultati che l'interfaccia Web non offre... eccezionale!
Le slide e gli esempi sono da analizzare (forse un tantino esagerata anche l'inclusione opzionale dei componenti Grok... ma lo perdoniamo).
Il prodotto attualmente presenta alcuni limiti e mancate funzionalità che non lo fa consigliare per la produzione, ma sono tutte cose che verranno facilmente superate nel breve. Probabilmente Dexterity diventerà lo standard dello sviluppo in Plone 4, convivendo (forse non troppo pacificamente) con Archetypes, per diventare l'unico ospite in Plone 5.
De-cosa?
Era dappertutto e se ne parlava dappertutto... Deco!
Confesso che non mi sono assolutamente interessato all'argomento fino alla conferenza e anche durante la stessa ho schivato tutti i talk a riguardo, poi mi sono ritrovato ad uno degli incontri nella terza giornata (dedicata agli Open Space) in cui l'argomento era "pagine composte" e l'intervento di Limi ha portato l'attenzione su questo nuovo giocattolo.
Deco si dovrebbe occupare solo del layout. Tutti noi potremmo continuare ad utilizzare l'approccio di oggi (creo un contenuto, genero la sua vista) oppure basarci sul layout Deco che permetterà il movimento dei componenti della pagina (tiles) tramite drag & drop.
A sentire Limi l'accessibilità della pagina (intesa come validazione del codice) rimane garantita se si parte da un buon XHTML. Vedremo!
A ruota libera
Essendo finiti gli argomenti principali, finisco con una breve panoramica su alcuni interventi minori che ho trovato per qualche motivo interessanti.
Euphorie: combining grok, dexterity sql content in a single application - Wichert Akkerman.
Wichert ci ha offerto un interessante talk su come usare Plone senza usare Plone. La descrizione di un progetto dove Plone veniva completamente privato di ogni suo componente (sharing, versioning, ...) e dove i dati venivano presi da database relazionale...
...forse conveniva non usare Plone? :-)
plone.app.discussion - Timo
Un veloce incontro negli openspace su un vecchio argomento mai completamente risolto (speriamo sia la volta buona) un nuovo prodotto, speriamo il nuovo prodotto, per gestire i commenti ai contenuti in Plone. Sarà compatibile con Plone 3.3 e diventerà parte del sistema in Plone 4.1.
plone.app.discussion promette la moderazione dei commenti e un workflow per questi, ovviamente personalizzabile. Era ora!
Very frequently asked questions answered for the last time :-) - Andreas Jung
Come potevo non partecipare? Chi di voi non è mai stato ripreso da A.J. almeno una volta?
La persona più "diretta" della mailing list plone-users che ripeteva per l'ennesima volta, nel modo più gentile possibile, alle domande che troppo spesso si è sentito fare (lo so... non erano davvero dirette a lui...).
Non mi sono stupito del suo intervento dopo la lunga discussione che è sfociata nel flaming poche settimane prima della conferenza...
Ho trovato divertente vedere come il giorno dopo qualcuno abbia comunque fatto domande troppo banali nella lista... e con lo stesso approccio di sempre abbia ricevuto in regalo le risposte di A. Jung!
Conversione da millisecondi a data/ora standard
tip per la conversione da millisecondi a data/ora standard in Lotus Notes tramite @ function
Nello sviluppo di form per appplicazioni web può capitare di scontrarsi con un ben noto problema nella gestione dei dati: la conversione del formato data/ora.
In questo breve post descrivo il caso in cui la data viene fornita in millisecondi a partire dal 1970 (Unix time) che deve quindi essere convertita in un formato leggibile.
In Lotus Notes tale dato può essere elaborato usando la seguente formula:
millisecond := @TextToNumber(@UrlQueryString("data"));
@Adjust(@Time(1970;1;1;0;0;0);0;0;0;0;0;millisecond;[InLocalTime])
il risultato sarà: 19/01/2004 16:16
Nell'esempio i millisecondi vengono estratti dal url come sotto:
http://dominio.it/db.nsf/nomeform?openForm&data=1074528964
NB: viene ritornata una stringa, attenzione quindi al suo utilizzo.
Nov 07, 2009
RuPy conference
Short summary about RuPy - strongly dynamic conference. The philosophy of RuPy is to put togheter Python & Ruby experts with young programmers and to support a good communication channel for East-West exchange of prospective ideas.
I have been delegated as a RedTurtle member to join RuPy conference that has been held in Poznan, my hometown city.
The idea behind the conference is to try to animate central- and east-european Python and Ruby communities. By inviting experts we want to broaden our knowledge and undersanding of presented concepts. The conference is meant to serve the exchange of ideas on the scientific ground, that is use of mentioned languages for certain scientific problems like, for example, text parsing, and on the buisness ground, like use of Django or Rails for creating web applications.
The state of Plone
short talk presented by Maciej Dziergwa about current Plone situation - based on Matt Hamilton's PloneConf2009 talk. After the talk we had a short discussion about current situation of Polish Plone Community. Plone is still not popular in Poland as it is in Italy...
Compiled Websites with Plone, Django and SSI
very interesting talk by Łukasz Langa and Wojciech Lichota about Plone, Django and SSI deployment. Using stxnext.staticdeployment you can deploy Plone site to static files. You can add dynamic stuff (like commenting) using Django. Finally you can glue everything together using Apache SSI mod_include. If you need search engine you can use and integrate, everything what I've mentioned before, with Xapian (or Solr).
You can find slides here.
Caching techniques in Python
some interesting caching techniques explained by Michał Domański and Michał Chruszcz. In Plone world we already know plone.memoize - a decorator for caching the values of functions and methods. You can use it of course outside Zope/Plone environment. If you need something more - check out i.e. pylibmc. At the end they've covered also reverse proxy with Varnish.
Nov 05, 2009
Lotus knows superenaLOTUS makes you win!

In about one week we will be live! It's time for the 3rd Italian Lotus Users Group events (aka Dominopoint.it). So it's time to a little preview about my session (in italian):
Lotus knows superenaLOTUS makes you win!
You have to attend my session to discover the details ...


