The official Fatica Labs Blog! RSS 2.0
# Wednesday, June 23, 2010

Bene, skill richiesti per fare l’architetto in una nota società di consulenza ( non diciamo quale, che tanto si indovina ) eccoli qui:

image

Vediamoli un po’:

Deep experience with PowerPoint: e certo, se devo fare un’architettura, il tool primario che uso è proprio power point.

Deep experience with MS Excel modeling: ma santa polenta: Excel è un foglio di calcolo, cosa cavolo ci modello con excel ? Excel serve a fare i conti, anche se il 100% dei manager lo usa perchè ha delle caselle.

Le altre lasciamo perdere, ci stanno: quindi per essere un architetto in sta famosa ditta di consuleza devo conoscere PowerPoint ( Che sfida !!! ), e saper usare in modo improprio Excel. Che vergogna.

Wednesday, June 23, 2010 2:36:09 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback

# Monday, June 21, 2010

Well, since no feedback from the users, I decided to abandon the project NHModeller. It was an attempt to create a commercial tool for NH, without any interesting returns. If someone is interested to have the source and continue the project please contact me. The project is now replaced by the new NHibernate Workbench, that is open source.

Monday, June 21, 2010 8:03:01 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Code GEneration | NHModeller
# Wednesday, June 16, 2010

Probabilmente vi sarà capitato di dovere eseguire qualche azione all’interno del vostro software dipendentemente da trigger innescati da data e/o ora. Per esempio un certo processo non si scatena del week-end, oppure un altro processo deve partire solo a mezzanotte etc etc. Quando queste cose non siano attuabili esternamente con il task scheduler di sistema, sarebbe bello poter avere una libreria pronto uso in .NET. Ebbene questa libreria c’è, ed è il parser di espressioni Cron che trovate qui. Lungi dall’essere un concetto moderno, si tratta di un modo di esprimere range temporali tramite una stringa che arriva da Unix. Oggi chiamiamo una cosa simile “Domain Specific Language”, ma tant’è il concetto è il medesimo. Lungi anche dall’ essere originale il concetto in .NET, la libreria che propongo è una estrapolazione di codice dalla più completa e complessa libreria Quartz.NET, a sua volta un porting della libreria Java Quartz. Se non volete introdurre troppa complessità al vostro deploy aggiungendo una nuova libreria, potete “grabbare” le classi dalla dll di Cron.NET ( sono tre file… ) e compilarli con il vostro progetto, ed avrete a disposizione tutta la potenza delle espressioni Cron ;).

Già, ma come funzionano le espressioni Cron ? Facciamo un paio di esempi:

"* * 10-11 L * ?" = questo trigger è valido l’ultimo del mese dalle 10-11

"* * * ? * MON-FRI" = questo trigger è valido tutti i giorni, a tutte le ore, eccetto il week end.

Ok, questo da l’idea delle potezialità della cosa, ma ovviamente serivirebbe una più estesa…

Documentazione

Una espressione Cron è composta da 6 campi obbligatori, più uno opzionale. Il significato dei campi è schematizzato nella tabella qui sotto:

Campo   Valori permessi   Caratteri speciali ammessi
Secondi   0-59   , - /
Minuti   0-59   , - /
Ore   0-23   , - /
Giorno del mese   1-31   , - ? / L W C
Mese   1-12 or JAN-DEC   , - /
Giorno della settimana   1-7 or SUN-SAT   , - ? / L #
Anno ( Opzionale )   vuoto, 1970-2099   , - /

 

Il carattere jolly ‘*’ può sempre essere usato con il significato di “tutti i valori”, per esempio se metto ‘*’ nel campo minuti significa tutti i minuti.

Il carattere ‘?’ può essere usato solo come Giorno del mese o giorno della settimana. Significa “nessun valore in particolare” e serve quando devo fissare l’altro. Se per esempio fisso il giorno della settimana metterò ‘?’ nel giorno del mese, e viceversa.

Il carattere ‘-‘ lo utilizzo quando voglio specificare un range: per esempio 10-12 nel campo ora significa dalle 10 a tutte le 12.

Uso invece la ‘,’ quando voglio specificare singolarmente più valori possibili: JAN,MAR significa il mese di Gennaio e di Marzo, ma non Febbraio ( e, ovviamente, non tutti gli altri ).

Per specificare dei periodi utilizzo ‘/’: per esempio se metto 0/15 nel campo secondi, significa “ogni 15 secondi”: sarà attivo il trigger quindi ai secondi 15,30,45 etc etc.

Il carattere speciale ‘L’ significa ultimo. Nel campo mese significa semplicemente l’ultimo giorno del mese (30/31/28 o 29 ) in modo concorde con il mese / anno bisestile. Nel campo settimana significa semplicemente 7 ( cioè Sabato ), ma se preceduto da un numero significa “l’ultimo xxxx del mese”. Per esempio se scrivo 6L significa l’ultimo Venerdì del mese.

Il carettere ‘W’ può essere specificato solo nel campo giorno del mese, preceduto da un solo carattere, e significa “il giorno lavorativo più vicino a”. Per esempio se scrivo 1W significa il giorno lavorativo più vicino al primo del mese. Se scrivo LW significa l’ultimo giorno lavorativo del mese.

Per ultimo il carattere ‘#’, utilizzabile solo nel giorno della settimana, indica l’ennesimo xxxx del mese. Per esempio, se mi interessa il terzo venerdì del mese, scriverò 6#3.

Per utilizzare una cron expression basta creare un istanza dell’ogegtto CronExpression, passando la stringa sul costruttore. Ecco un esempio:

   1:          [Test]
   2:          public void LastOfTheMonth()
   3:          {
   4:              var exp = new CronExpression("* * * L * ?");
   5:              Assert.IsTrue(exp.IsSatisfiedBy(new DateTime(2000, 1, 31)));
   6:              Assert.IsTrue(exp.IsSatisfiedBy(new DateTime(2000, 2, 29)));
   7:              Assert.IsFalse(exp.IsSatisfiedBy(new DateTime(2000, 2, 28)));
   8:          }
Wednesday, June 16, 2010 4:52:39 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Cron | Programmin | Recipes
# Monday, June 14, 2010

bug The right place for bug reporting or requiring additional features is

here

Since the project is new, it is normal to have something to fix. The problem is that my testing would just be not sufficient, so your help will really be appreciated. Thanks!

Monday, June 14, 2010 4:31:59 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Code GEneration | NHibernate | NHWorkBench
# Saturday, June 05, 2010

With a little delay I found people complaining about the schema file missing from the db2hbm deployed package. Now the file is included in the download package, and yanch provided a shortcut in the doc to download the file from sourceforge. Thanks!

Well, a few word about db2hbm and Oracle ( and any other database but MSSQL now ). I used the schema information provided by NH as long as possible, but these information does not provides the required details in order to discover completely the foreign keys, and foreign keys are necessary for creating associations. Not really an NH problem, actually NH leverages ADO.NET for schema inquiry, but ADO.NET seems to miss the foreign key part. So the only solution to have db2hbm working for all database is to provide a custom foreign key crawler for the DB.

Saturday, June 05, 2010 2:32:40 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Code GEneration | NHibernate
# Monday, May 31, 2010

First of all I renamed the project on Sourceforge. Now it is more sensible NHibernate Workbench.

nhwsourceforge

In the SVN repository there is now a tag to the version 1.0.0.11, and the trunk claim to be the version 1.0.0.2.00.

Now I’m planning to allow to use NH Workbench attached to a running application: this should help us to play with application compiled without mappings ( ie ConfOrm and Fluent NH ). Then I would like to improve the “Probe” class letting it be more versatile and modifiable by the user, probably using some sort of script engine: I’m thinking to use IronPython, but any suggestion are welcome. Just to clarify: the probe class serves to insolate NHWorkbench from the NH version used by the project under test. We basically runs the test in a separate app domain, but we need the “probe” type to be unbounded to any NH specific version. This is done by using reflection, but it would be easier to be done in a script. The same engine will be useful to write some NHibernate testing: instead of use just HQL, we will be able to submit some portion of code on the fly and see what happen. The other step is to allow the user writing a mapping on the fly and imemdiately see what happen ( by using hbm2net behind the scenes ). Ok, it’s a lot of work, I’ve no idea the order this will be done, let me know if you have any idea and preference.

Monday, May 31, 2010 11:35:43 AM (GMT Daylight Time, UTC+01:00)  #    Comments [1] - Trackback
Code GEneration | HQL Intellisense | NHibernate | NHWorkBench
# Monday, May 24, 2010

Sometimes I receive some notification on where source code for both db2hbm and hbm2net are located. The best way is to check-out the source of the NHContrib project: https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib

hbm2net is still in alfa, but I frequently use it in my projects as a class generator. It really lack some documentation: it is really a powerful artifact generator, and by writing proper T4 templates any artifact can be generated. Db2hbm is working ok for MSSQL, but there is not yet an implementation for oracle and other DB, even if Ricardo Peres provided me some interesting code to work on.

Hope this help who’s looking for these tools source code.

Monday, May 24, 2010 8:08:30 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Code GEneration | NHibernate
# Saturday, May 22, 2010

Just looking around for some related NHibernate projects, I found this open source profiler. For people who start to use NHibernate and before to buy something more accurate as NHProf, it is really useful having a log easy to read to discover performance or bad usage issues.

Saturday, May 22, 2010 9:27:01 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
NHibernate

As you probably guess, the Fatica.Labs.HqlEditor evolved as a component used by NH Workbench, that is basically a tool ispired by the old and wise NHQA by Ayende. There is, in comparison, some new ideas and some missing required functions. Anyway I decided to publish a first drop because it already help me on my day job. If you find the project useful please consider visits the following links:

And, if you want to join the project, please let me know.

Saturday, May 22, 2010 6:55:49 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
HQL Intellisense | NHibernate | NHWorkBench
# Thursday, May 20, 2010

Può succedere di dover specificare il nome di un assembly completo, magari in un file di configurazione dell’applicativo. Sfortunatamente non si può tagliare ed incollare la stringa dalla GAC, e bisogna copiare ed incollare i vari pezzi dalla finestra property. Ecco quindi un piccolo tool che mostra tutto il contenuto della GAC e ci permette di copiare l’assembly full name. Eccolo all’opera:

gac

Si accettano complimenti per la meravigliosa interfaccia utente ;).

Nondimeno importante segnalare lo snapshot di codice che consente con facilità di maneggiare la GAC run-time.

Thursday, May 20, 2010 11:48:35 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Programmin | Recipes
Archive
<June 2010>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Felice Pollano
Sign In
Statistics
Total Posts: 67
This Year: 41
This Month: 2
This Week: 0
Comments: 36
This blog visits
Locations of visitors to this page
All Content © 2010, Felice Pollano
DasBlog theme 'Business' created by Christoph De Baene (delarou) and modified by Felice Pollano