di .NET e di altre amenità

Elite Replicator 1.0 for .TEXT

Elite Replicator is a plugin for .TEXT 0.95 Blog Engine that enable your weblog to spread its posts to many other mirrors, installed on various different engines. It is based on a scheduling engine for ASPNET 1.1 created to execute some jobs at predefined intervals of time. The replicator check the weblog for the presence of new posts and apply some rules to decide where to send copies of them. This is a brief how-to note explaining installation and configuration of the plugin.

INSTALLATION

To install the plugin you have simply to copy some files in the directory hosting .TEXT and run a minimal database script onto the sql server database  where .TEXT is installed. Here is the complete file listing and explanation:

(Paths are expressed relative to .TEXT root web directory)

1) bin directory

This directory contains the main assemblies for replicator and scheduler plus some engine adapter inherited from Imho Instant Blogger (http://imhoproject.org) that enable spreading posts over many type of blog-server engines. Compatible engine include Community Server, Wordpress, MovableType compatible and the same .TEXT. All the file in this directory must be copied into the /bin directory of the web application hosting .TEXT blog. 

2) jobview.aspx

This asp.net page is a simply monitor for the activity of the scheduled It runs if copied into any .TEXT directory, but probably the better position is in the /Admin directory so it is protected by the same authentication of the .TEXT backend. It shows the running jobs with some information about them and permit to force its running at every time. Installation of monitor page is not vital for the replicator or scheduler to run.

3) Web.config

This file contains some sections that must be copied into the .TEXT web.config file. The sections has to be copied according to it position in the template file as reported in the comments. See the Configuration section of this document to understand the configuration properties.

4) database.sql

This file must run on the database hosting the .TEXT engine data and will create only a couple of stored procedures, a table and two triggers. The triggers add to the table the id of the newest post, and the procedures get the informations from this table.

CONFIGURATION

The installation of Elite Replicator 1.0 insert three different sections into the configuration file of .TEXT. This sections have different configuration meaning.

They are:

  • HttpModule
  • Scheduler
  • Replication

HttpModule: This section is required to start the scheduling engine the first time a page of the web application is called. Probably the same behaviour may be obtained writing some instructions into the global.asax application class, but this require the recompilation of full engine. So I decided to intercept the BeginRequest event into the SchedulerModuler. This has impact on the web site performances only the firt time a page is called after an applcation restart. The required overhead if very tiny. To configure the HttpModule you have to enter a single line of xml into the configuration file indicating to enter the module at every asp.net page.

Scheduler: The settings applied to the schedulig engines are very simply. They begin with the element schedulerSettings that include a single attribute and a single subelement. The attribute is schedulerPrecision, an integer value expressed in milliseconds that tell the interval between two scheduler activities. Setting this timeout lower than 60000 ms (=1 minute) has no meaning because the minimum timeout applicable for a job has the same value. This parameter is useful only to fine tune the scheduler precision when there is no jobs that required this frequency of work. The inner element of schedulerSettings is jobs that contains job elements representing every single job that the scheduler must execute. A job element has this attributes:

minutes: interval between two execution of the job

name: unique name for the job (must be unique!!)

enabled: true if the job is enabled. If false the job will not be instantiated and will not appear in the jobmonitor

type: a fully qualified type name implementing Elite.Scheduler.IJob interface. This type will be instantiated when the scheduler starts and disposed wher the scheduler is disposed. You can implement your jobs simply extending this interface or most probably the abstract ScheduledJob class.

The assemblies contains two jobs. The first named PostReplicatorJob is responsible to read rules from the configuration and spread the posts across multiple sites. The other optional job, namer LogClenupJob is responsible of periodically clean the log file of the replicator (if enabled) after sending it to a given email address. The log file contains useful information about running of the replicator like number of posts replicated, and error occured.

Replication: The replication engine has the more complex configuration section because it define how to replicate posts across different blog, running on different engines. It starts with the element replicatorSettings that contains this attributes:

fromMail: email address for the from field of email messagges. It is useful to avoid relay problems

adminEmail: email address where to send backupped logs

mailServer: mail server to use for sending mails. If omitted it default to 127.0.0.1

logEnabled: True to enable logging

logFile: phisical path to the log file

dataProvider: fully qualified name of the datalayer class, targeting a specific database server (only sql server available).

sourceRoot: root url of the weblog

sourceUrlTemplate: template of the rewritten urls

connectionString: connection string to the .TEXT database

The inner element blogs contains a collection of item blog that define the weblogs managed by the replicator. The replicator is able to manage multiple source weblog defining different rules and targets for everyone. The blog element is the core on the rule engine. Id has two attributes:

key: a unique application key that identify the .text blog. It is composed by hostName and applicationId as defined in the blog_Config table. You may obtain this key concatenating the domain there the blog is hosted and the inner directory separated by a colon. E.g, if your blog is hosted at http://www.myblogs.com/blogname the key is "www.myblogs.com:blogname". If the blog is on the root directory simply leave empty the second part of the key: "www.myblogs.com:"

title: the title of the weblog. It is used for the footer of the replicated posts.

The element blog define with some inner elements the rules and the targets of this blog. Rules is an element that contains a series of rule tags. Here is the attributes that define a rule:

title: define a regular expression applied to the title of the post if matched cause the replication of the post

text: define a regular expression applied to the text of the post if matched cause the replication of the post

category: define a regular expression applied to the category of the post if matched cause the replication of the post

target: the target weblog to replicate if one of the regular expressions matches.

targetCategories: the category to assign to the post on the target blog.

Finally the last element in the blog section is the targets, that contains a collection of target. A target is a weblog that will receive the replicated posts. Te target section define the blogs and the required authentication/communication properties. Here is the attributes:

name:unique name used in the rules to reference the target

adapter:fully qualified type name to the adapter required to conecto to the target engine. It has to be one of DotTextAdapter, BloggerAdapter, CommunityServerAdapter, or MovableTypeAdapter. To implement a new adapter it is required to extend the abstract class Elite.IMHO.Engines.EngineAdapter.

url: url to the page or service used to post on the target. I remember that for connections to blogger it is required to use https:// protocol instead of http://

userName: username used to authenticate

password: password used to authenticate (Warning: The password is not encrypted or hashed so you have to be aware that none can have accesso to the configuration file)

The element target has a single subelement named footer. The footer define a brief footer that can be enqueued to the replicated post. A footer may include some macro to insert dynamic information in it. This macros are: blog.key, post.id, post.date, post.text, post.url and post.title. This macro are self-explanatory.

LICENSE

The file attached to this post contains both the binaries and the source files that can be recompiled simply opening the solution with Visual Studio.NET 2003. The Elite Replicator for .TEXT 1.0 is released under the terms of the Creative Common Public License (Attribution-NonCommercial-ShareAlike 2.0 Italy). Both the Replicator and the scheduler have separated license files because they may be used separately.

Please, for the blogger that decide to use this software to post a trackback to this article. Thank you.

DOWNLOAD

Zip file: Elite.DotText.Replicator.zip (319 KB)

Replicator 1.0 for .TEXT released

Finalmente posso annunciare che è pubblico il Replicator per .TEXT 1.0.2098. Ho pubblicato il sorgente, e i file compilati per l'installazione, assieme ad una guida all'uso (scritta tutta nel mio maccheronico inglese).

Qui trovate il software: http://www.imhoproject.org/download/Elite.DotText.Replicator.zip
Qui la documentazione: http://blog.boschin.it/articles/replicator.aspx

Il file zip include anche una documentazione del sorgente in formato .chm creata usando il fantastico ndoc, che non smetterò mai si amare. Come spiegato nell'articolo, il replicator consente appunto di replicare i propri post su un engine .text verso altri weblogs ospitati su tutti gli engine supportati da IMHO 1.2. Il replicator infatti è basato sugli stessi adapter di cui fa uso IMHO per postare. Nello zip è anche presente uno scheduler abbastanza raffinato (anche se non perfetto), con un piccolo monitor dei Job che ne visualizza lo stato in ogni momento. I job si occupano di verificare la presenza di nuovi post e di ripulire il file di log periodicamente. Consiglio infine, a chi fosse curioso, di dare uno sguardo all'engine di replica che si basa su un file di configurazione che permette di applicare delle regole abbastanza complesse, basate su regular expressions per filtrare i post da replicare.

Inutile dire che sono in attesa delle vostre critiche e suggerimenti.

powered by IMHO 1.2

Quella volta che... quasi persi il lavoro.

Leggendo il simpatico post che di Igor ha scritto quest'oggi, mi è venuto in mente un aneddoto che riguarda la mia storia lavorativa. Non è un periodo della mia vita di cui parli volentieri, perchè è stato carico di stress e molto tumultuoso, ma calza molto con quello che ha riportato e a ben vedere oggi posso dirmi soddisfatto di come ho gestito le cose e risolto tutto per il meglio. Dovete sapere che circa due anni fa, più o meno nel periodo natalizio, la società per cui lavoravo è entrata in forte crisi e ha deciso improvvisamente di chiudere, regalando a noi tutti un futuro incerto. In realtà era tempo che sentivo i segnali della tempesta che stava arrivando e mi stavo preparando, per cui riuscii in breve a inviare più di 200 curriculum (credo che ad oggi tutto il veneto abbia un mio curriculum), a fare un bel numero di colloqui, e a poter scegliere dove andare a lavorare tra almeno tre ottime proposte, prima che i titolari dell'azienda presso cui lavoravo se ne rendessero conto. Fu quella l'occasione per me di un cambio radicale della mia concezione del lavoro, ma mi rendo conto che sto divagando, perciò magari questo lo racconto un'altra volta. Il punto è che, tra le decine di colloqui che sostenni in quei quindici giorni di fuoco, ce ne fu uno che rispecchia molto quanto riportato nel post di Igor. L'azienda cui mi proponevo era, ed è tuttora, una delle più importanti dei dintorni. Non vi dirò per ovvi motivi di quale azienda si tratta, ma va detto che personalmente la ritenevo una bella tappa nella mia carriera di informatico. Mi presentai al primo colloquio già sapendo che non sarebbe stato facile entrarvi, ma quello che mi aspettava non lo avrei mai immaginato. In breve, per arrivare a concretizzare qualcosa dovetti sostenere nell'ordine: Un colloquio conoscitivo con il titolare che scandagliò il mio curriculum da cima a fondo. Una prova attitudinale "casalinga", nella quale mi fu chiesto di realizzare una piccola applicazione in ASP.NET nel mio tempo libero, per dimostrare che in realtà ci sapevo fare. Una seconda prova attitudinale pratica presso gli uffici dell'azienda della durata di una giornata, sempre per dimostrare che ci sapevo fare ed evidentemente che non ero un abile copiatore... Poi un secondo colloquio conoscitivo, per esplorare la mia attuale posizione e valutare le mie richieste economiche oltre che nuovamente tutta la mia vita lavorativa e non, e infine il terzo colloquio nel quale finalmente mi fu fatta la proposta economica. Posso solo lasciarvi immaginare quale fu l'espressione del grande-capo quando dopo aver ricevuto la proposta (peraltro anche piuttosto vantaggiosa) gli dissi testualmente: "bene, la ringrazio per la proposta, ma sono in attesa di un'offerta da un suo concorrente perciò vorrei prendermi un po' di tempo per decidere". Non ero certo allora nella posizione di potermi permettere di sbottare in quel modo, ma vi assicuro che mi è venuta fuori così naturalmente che ancora adesso mi chiedo se non mi abbia sfiorato la follia. Posso anche io solo immaginare quale fu la sua reazione quando telefonicamente gli comunicai che non ero interessato perchè avevo preferito scegliere il suo concorrente. Ad oggi, so con buona certezza che la scelta che feci allora è stata una buona scelta, non so se la migliore, ma non posso dire di trovarmi male nel mio attuale posto di lavoro, circondato come credo di essere di persone competenti e intelligenti. Quello che volevo rilevare è che il signor "prima di entrare devi passare sul mio cadavere", ha approfittato della mia situazione, del mercato in discesa, e di decine di altre cosucce, in un modo intollerabile senza contare che comunque godeva di un periodo di prova immenso che lo tutelava da qualsiasi possibile leggerezza. Forse, se si fosse limitato ad una più consona politica di colloqui, è anche possibile che io scegliessi lui anzichè un altro. Spesso mi capita di ripensare a quei giorni, convinto come sono che lo stesso trattamento che è stato riservato a me sia uno standard per quell'azienda, e mi chiedo: ma quante altre aziende si comportano così?

powered by IMHO 1.2

Il sito Microsoft gira su ASP.NET 2.0

Almeno questo è quello che riporta bink.nu nel post linkato qui sotto. Bink dice anche che il Download Center gira su whidbey già dallo scorso giugno.

Link: Microsoft.com website now running ASP.NET 2.0

powered by IMHO 1.2

Gli incappucciati della pace?

Ecco, ci mancava pure questa. Stasera al tg di La7, sono incappato durante uno zapping in uno strano tizio con un cappuccio multicolore. Intervistato dal giornalista dissertava amabilmente di pace, di diritti, e di altre amene cose. Lo confesso sono perplesso, mi chiedo quale sia l'utilità di un cappuccio per una persona che affronta argomenti di questa caratura. Sarà forse che, con gente come Ruini in giro, c'è da aver paura a farsi riconoscere mentre si parla di tali argomenti delicati, tuttavia la perplessità rimane. Un cappuccio in testa ha un significato che non mi piace. Rappresenta la scelta di tutelarsi nel caso si decida il ricorso alla illegalità e alla violenza. Come può un pacifista aver bisogno di un passamontagna? Semplicemente non è un vero pacifista. Sa che prima o poi sarà costretto a prevaricare uno dei diritti che difende, oppure a violare una delle leggi che contesta, ma non è capace di assumersene la resposabilità. Vi dirò, corrisponde all'idea che mi sono fatto di un pacifista tipo. Un arruffapopoli di professione che però non crede in quello che difende al punto da temerne le conseguenze. Da non-violento preferisco la luce del sole, la disobbedienza civile, che in quanto civile è fatta nella massima trasparenza. Io e l'incappucciato la pensiamo allo stesso modo sul presidente della cei e la sua combriccola, ma non me la sento di condividere la sua battaglia.

powered by IMHO 1.2

DotText Replicator: a breve il rilascio

Il test del replicator per .Text che ho realizzato la scorsa settimana, sta rivelando che non ci sono sostanziali problemi. Da ormai un po' di giorni sopporta bene il lavoro di replicare i miei post su tre blog (uno di puro test...). Per questo ho deciso che entro breve rilascerò la versione definitiva al pubblico, comprensiva di sorgenti. Mi serve solo il tempo di realizzare una breve documentazione che spieghi come installare e configurare le regole di replica. Si tratta a mio parere di un lavoro molto interessante perchè sfrutta alcune caratteristiche di ASP.NET che consentono di fare cose che con i vecchi strumenti pre-.net erano sostanzialmente impensabili, se non al prezzo di un notevole lavoro.

powered by IMHO 1.2

Indignati arroganti

Il segretario della CEI, monsignor Betori, stamane ci ha informato che la chiesa è esente da critiche, perchè parla per il bene del paese. Certo, l'arroganza di questi figuri non ha limiti, ed ora dobbiamo sorbirci anche l'indignazione di chi, pur entrando in politica non vuole pagare lo scotto che l'esternare libere opinioni immancabilmente richiede: l'essere contestati. Certo, si può dire che il fischio non sia un mezzo elegante e democratico, ma in questo caso è sintomatico del malcontento che affligge chi non avendo il potere della conferenza episcopale, deve ricorrere a questi mezzucci per far sentire la propria contrarietà. Il grigio monsignore, ci ricorda che la contestazione è stata "divertente", trasformando così in macchietta la legittima opinione di chi non la pensa come la chiesa e coglie l'occasione per ribadire che nella sua instancabile lotta contro il male, desidera punire con la dannazione chi vuole costituire una famiglia che non sia sotto il segno del matrimonio cattolico.

Mi unisco ai fischi.

powered by IMHO 1.2

Early Morning Coding

Buongiorno a tutti. Stamane sveglia la mattina presto, sperando di chiudere un lavoro che da troppo tempo sto trascinando, complice il silenzio della domenica mattina. C'è una pace davvero fantastica. Ho rinunciato ad almeno un paio d'ore di sonno, ma si sa che chi dorme non piglia pesci... e stamattina ne valeva la pena.

powered by IMHO 1.2

XML Programming Refactored (XLinq)

Un ottimo articolo da cui cominciare ad approfondire XLinq.

Link: XLinq: XML Programming Refactored (The Return Of The Monoids)

powered by IMHO 1.2

Auguri Microsoft!

In questi giorni cade la ricorrenza del trentesimo compleanno della Microsoft. Ecco un po' di numeri sulla compagnia, in un post di bink.

Certo che 42 milioni di lattine di soda in 27 anni...

Link: Bink.nu | Microsoft 30th Anniversary Factoids

powered by IMHO 1.2

Replicator for .TEXT

Ed eccolo infine. La migrazione all'indietro da Community Server verso .TEXT mi ha messo nella necessità di adattare il codice del Replicator per Community Server all'engine di .TEXT. Lo scoglio da superare è stata la mancanza di un sistema di scheduling che consenta di eseguire dei Job ad ogni periodo di tempo determinato. Ne è uscito un bel pezzo di codice, che ovviamente come ormai vi ho abituato metterò a disposizione entro breve, non appena lo avrò testato per bene. Il replicator per .TEXT contiene al suo interno un piccolo scheduler, basato su un HttpModule per evitare di dover ricompilare tutto l'engine. Alla prima chiamata viene avviato un processo che periodicamente verifica se uno dei Job registrati nel web.config è scaduto e in questo caso lo esegue per poi azzerarne il contatore. Credo che una feature del genere possa essere molto utile anche ad altre applicazione ASP.NET. Se a qualcuno interesa il meccanismo di funzionamento, consiglio la lettur di questo mio articolo.

powered by IMHO 1.2

Soap Thinking

next | previous

soap seller in a market (aix en provence - france)