var tumblr_api_read = {"tumblelog":{"title":"Myti Blog","description":"Myti s.r.l.\r\n\r\nTorre Athena\r\nvia Orzinuovi 20\r\n25125 Brescia ","name":"myti-blog","timezone":"Europe\/Paris","cname":"blog.myti.it","feeds":[]},"posts-start":0,"posts-total":"13","posts-type":false,"posts":[{"id":"13868306281","url":"http:\/\/blog.myti.it\/post\/13868306281","url-with-slug":"http:\/\/blog.myti.it\/post\/13868306281\/la-presentazione-nfc-programming-in-android-che","type":"video","date-gmt":"2011-12-07 10:19:00 GMT","date":"Wed, 07 Dec 2011 11:19:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1323253140,"format":"html","reblog-key":"93lG9g7a","slug":"la-presentazione-nfc-programming-in-android-che","video-caption":"<p>La presentazione &#8220;NFC Programming in Android&#8221; che \u00e8 stata presentata 24 Novembre 2011 nell&#8217;incontro di GTUG (Google Technology User Group) Milano.<\/p>","video-source":"<div style=\"width:510px\" id=\"__ss_10495501\"> <strong style=\"display:block;margin:12px 0 4px\"><a href=\"http:\/\/www.slideshare.net\/mytisrl\/gtug-nfc-presentation\" title=\"GTUG NFC Presentation\" target=\"_blank\">GTUG NFC Presentation<\/a><\/strong> <iframe src=\"http:\/\/www.slideshare.net\/slideshow\/embed_code\/10495501?rel=0\" width=\"510\" height=\"426\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe> <div style=\"padding:5px 0 12px\"> View more <a href=\"http:\/\/www.slideshare.net\/\" target=\"_blank\">presentations<\/a> from <a href=\"http:\/\/www.slideshare.net\/mytisrl\" target=\"_blank\">myti srl<\/a> <\/div> <\/div>","video-player":"<iframe src=\"http:\/\/www.slideshare.net\/slideshow\/embed_code\/10495501?rel=0\" width=\"400\" height=\"334\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>","video-player-500":"<iframe src=\"http:\/\/www.slideshare.net\/slideshow\/embed_code\/10495501?rel=0\" width=\"500\" height=\"417\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>","video-player-250":"<iframe src=\"http:\/\/www.slideshare.net\/slideshow\/embed_code\/10495501?rel=0\" width=\"250\" height=\"208\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>","tags":["NFC","Android","GTUG"]},{"id":"7930229501","url":"http:\/\/blog.myti.it\/post\/7930229501","url-with-slug":"http:\/\/blog.myti.it\/post\/7930229501\/liferay-disable-the-ie-compatibility-view","type":"regular","date-gmt":"2011-07-22 15:56:00 GMT","date":"Fri, 22 Jul 2011 17:56:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1311350160,"format":"html","reblog-key":"fIZo54iV","slug":"liferay-disable-the-ie-compatibility-view","regular-title":"Liferay: Disable the IE Compatibility View ","regular-body":"<p>If Internet Explorer detects that a web page is not compatible, the address bar displays the Compatibility View button. When you turn on Compatibility View, the Web site open appears as if you were using an earlier version of Internet Explorer.<br\/>However, this is an emulation of an earlier version of Explorer, which creates additional display problems when compared with other browsers like Firefox and Chrome.<br\/><br\/>The solution to this problem is to disable the choice (sometimes automatic) browser by entering this meta tag<\/p>\n<pre class=\"brush:html\">&lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\n<\/pre>\n<p><br\/>In Liferay , this meta is to be included as soon as the first command after &lt;head&gt; portal_normal.vm within the file that is located in the Templates folder of the theme used.<br\/><br\/><\/p>\n<pre class=\"brush:html\">&lt;head&gt;\n&lt;meta http-equiv=\u201dX-UA-Compatible\u201d content=\u201dIE=edge\u201d&gt;\n \n&lt;script type=\u201dtext\/javascript\u201d src=\u201dhttp:\/\/code.jquery.com\/jquery-1.4.2.min.js\u201d&gt;\n&lt;\/ script&gt;\n&lt;title&gt; $ the_title - $ company_name &lt;\/ title&gt;\n$ theme.include ($ top_head_include)\n&lt;\/ head&gt;\n<\/pre>"},{"id":"6863237594","url":"http:\/\/blog.myti.it\/post\/6863237594","url-with-slug":"http:\/\/blog.myti.it\/post\/6863237594\/split-svn-repository-into-multiple-repositories","type":"regular","date-gmt":"2011-06-24 12:50:00 GMT","date":"Fri, 24 Jun 2011 14:50:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1308919800,"format":"html","reblog-key":"1c4y9zwx","slug":"split-svn-repository-into-multiple-repositories","regular-title":"Split svn repository into multiple repositories","regular-body":"<p>Sometimes it appends that a project is divided in different sub project. Each one then, can earn ti&#8217;s own prioriry and become a full project.<\/p>\n<p>If everything was stored into the same svn repository, how can you move away one directory of it without loosing all the commit history?<\/p>\n<p>Here&#8217;s how&#160;:<\/p>\n<p><strong>1. create a dump from the repository<\/strong><\/p>\n<p>To create a dump file use the <a href=\"http:\/\/svnbook.red-bean.com\/en\/1.1\/re31.html\">svnadmin dump<\/a> command or your svn online service admin page.<\/p>\n<pre class=\"brush: shell;\">svnadmin dump [my repo url] | gzip &gt; dump.gz<\/pre>\n<p><strong>2. check the first directory level<\/strong><\/p>\n<p>use this script to check the first directory level contained in your dump file<\/p>\n<pre class=\"brush: shell;\">gzcat dump.gz | egrep -a \"^Node-path\" | cut -d '\/' -f 1 | cut -d ':' -f2 | sort | uniq<\/pre>\n<p><strong>3. split into multiple dumps<\/strong><\/p>\n<p>Now it&#8217;s time to split this. To achieve this we can use <a href=\"http:\/\/svnbook.red-bean.com\/en\/1.5\/svn.ref.svndumpfilter.html\">svndumpfilter<\/a>.<\/p>\n<p>Exec this line for every directory you want to separate<\/p>\n<pre class=\"brush: shell;\">gzcat dump.gz | svndumpfilter include directory1 | gzip &gt; dump_directory1.gz<\/pre>\n<p>You can even separate more than one directory per file<\/p>\n<pre class=\"brush: shell;\">gzcat dump.gz | svndumpfilter include directory1 directory2 | gzip &gt; dump_directory12.gz<\/pre>\n<p><strong>4. import every dump into different repositories<\/strong><\/p>\n<pre class=\"brush: shell;\">gzcat dump_directory1.gz | svnadmin load [my new repo url 1]\ngzcat dump_directory2.gz | svnadmin load [my new repo url 2]<\/pre>"},{"id":"6036601997","url":"http:\/\/blog.myti.it\/post\/6036601997","url-with-slug":"http:\/\/blog.myti.it\/post\/6036601997\/nfc-operating-modes","type":"regular","date-gmt":"2011-05-31 13:30:00 GMT","date":"Tue, 31 May 2011 15:30:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1306848600,"format":"html","reblog-key":"FOj2qmtE","slug":"nfc-operating-modes","regular-title":"NFC operating modes","regular-body":"<p>In these days you should probably heard talking about NFC. Through <a title=\"Google Wallet\" target=\"_blank\" href=\"http:\/\/www.google.com\/wallet\/\">Google&#8217;s new mobile payment method<\/a>\u00a0news, rumors which talk about <a title=\"iPhone NFC functionality\" target=\"_blank\" href=\"http:\/\/mashable.com\/2011\/01\/25\/apple-nfc-iphone-ipad\/\">up coming iPhone&#8217;s NFC functionality<\/a> and so on.<\/p>\n<p><strong>NFC (Near Field Communication)<\/strong> is a short-range (&lt; 5cm) wireless communication technology. Working in <a title=\"Myti\" target=\"_blank\" href=\"http:\/\/www.myti.it\">Myti<\/a> I got some opportunities to implements several mobile applications which based on this technology. Here I&#8217;d like to describe one of the many things I learned during the implementation of those applications. It&#8217;s about operating (using) modes of NFC.\u00a0According to specification it has <strong>three different operating modes<\/strong>.<\/p>\n<p><img src=\"http:\/\/media.tumblr.com\/tumblr_lm0ime8vWb1qacmlm.png\"\/><\/p>\n<p>The first mode is <strong>Read\/Write Mode<\/strong>. This mode gives ability to read and write a passive RFID tag using NFC enabled divides. Common example of utility of this mode is smart poster which you can get more information\/contents from those posters by swiping your mobile device over it .<\/p>\n<p>The second mode is communication between two NFC devices (<strong>P2P Mode<\/strong>). Using this mode divides can exchange data between each other like virtual business cars or photos.<\/p>\n<p>The last mode is <strong>Card Emulation Mode<\/strong>. These devices can emulate an existing contactless card which give a possibility to communicate with contactless reader for example to make a payment by swiping over a payment termina<span>l.<\/span><\/p>\n<p>But\u00a0unfortunately these operating modes depend on device implementation. Not every device has all these modes. I got a possibility to work with three NFC enabled mobile phones and only two of them (<a title=\"Nokia 6212 classic\" target=\"_blank\" href=\"http:\/\/www.forum.nokia.com\/Devices\/Device_specifications\/6212_classic\/\">Nokia 6212 classic<\/a> and <a title=\"Nokia 6131 NFC\" target=\"_blank\" href=\"http:\/\/www.forum.nokia.com\/Devices\/Device_specifications\/6131_NFC\/\">Nokia 6131 NFC<\/a>) have all three modes. The other phone (<a title=\"Samsung GT-5230N\" target=\"_blank\" href=\"http:\/\/innovator.samsungmobile.com\/prd\/sym\/productDetl.view.do?modelCode=BGT-S5230N&amp;platformId=3\">Samsung GT-5230N<\/a>) doesn&#8217;t have P2P mode implemented.<\/p>\n<p>It&#8217;s important to know about what are the operating modes and which devices support them before you start your NFC project.<\/p>","tags":["nfc","mobile"]},{"id":"5158151441","url":"http:\/\/blog.myti.it\/post\/5158151441","url-with-slug":"http:\/\/blog.myti.it\/post\/5158151441\/javaosxurlhandler","type":"regular","date-gmt":"2011-05-03 10:42:00 GMT","date":"Tue, 03 May 2011 12:42:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1304419320,"format":"html","reblog-key":"uMb8AMOt","slug":"javaosxurlhandler","regular-title":"Creating a osx app bundle in Java registered to a protocol url","regular-body":"<p>Recently we extended our enterprise search engine <a href=\"http:\/\/www.bleen.it\/\"><span>bleen<\/span><\/a> adding a desktop utility automatically launched clicking on a result link.<\/p>\n<p>To achieve this we created a native applciation ( for windows and osx ) registered to the protocol url bleen:\/\/<\/p>\n<p>In this tutorial we will see how to build this utility in Java for Mac OS X.<\/p>\n<p>The base code is a simple java class displaying a Dialog<\/p>\n<p><strong>Application bundle<\/strong><\/p>\n<p>Creating a OSX application bundle is as easy as creating a directory structure following some simple rules.<\/p>\n<p>Out directory tree will contain&#160;:<\/p>\n<ul><li>a jar with out classes<\/li>\n<li>the dependency jars<\/li>\n<li>the info.plist file<\/li>\n<li>a native executable \u00a0<\/li>\n<\/ul><p>The following is a ant tast that creates the dir tree.<\/p>\n<pre class=\"brush: xml;\">\t\n&lt;target name=\"application-bundle\" depends=\"jar\" description=\"create mac Os X Application bundle\"&gt;\t\n\t&lt;mkdir dir=\"${dist.appbundle}\/Contents\/MacOS\" \/&gt;\n\t&lt;mkdir dir=\"${dist.appbundle}\/Contents\/Resources\/Java\" \/&gt;\n\t&lt;copy file=\"${auxes.dir}\/JavaApplicationStub\" todir=\"${dist.appbundle}\/Contents\/MacOS\" \/&gt;\n\t&lt;exec executable=\"chmod\"&gt;\n\t\t&lt;arg value=\"755\" \/&gt;\n\t\t&lt;arg value=\"${dist.appbundle}\/Contents\/MacOS\/JavaApplicationStub\" \/&gt;\n\t&lt;\/exec&gt;\n\t&lt;copy file=\"${auxes.dir}\/Info.plist\" todir=\"${dist.appbundle}\/Contents\" \/&gt;\n\t&lt;copy file=\"${auxes.dir}\/icon.icns\" todir=\"${dist.appbundle}\/Contents\/Resources\" \/&gt;\n\t&lt;copy file=\"${dist.dir}\/application.jar\" todir=\"${dist.appbundle}\/Contents\/Resources\/Java\" \/&gt;\n\t&lt;copy file=\"lib\/libreria1.jar\" todir=\"${dist.appbundle}\/Contents\/Resources\/Java\"\/&gt;\n&lt;\/target&gt;\t<br\/><\/pre>\n<p>The result is a directory tree viewed ad a application document by OSX.<\/p>\n<p><strong>URL protocol<\/strong><\/p>\n<p>The application runtime information are stored in info.plist file.<\/p>\n<p>We edited this file inserting a couple of new keys. These keys link out app to the protocol demo:\/\/<\/p>\n<ul><li>URL Types<\/li>\n<li>URL Identifier<\/li>\n<li>URL Schemes<\/li>\n<\/ul><p>Now, the system will launch our utility every time the user clicks on a link starting with demo:\/\/<\/p>\n<p><img src=\"http:\/\/media.tumblr.com\/tumblr_lkm8kxGvDh1qb0on9.png\"\/><\/p>\n<p>To allow osx to know out utility exist we must&#160;:<\/p>\n<ul><li>copy the app to \/Application directory<\/li>\n<li>or manually launch it at least once\u00a0<\/li>\n<\/ul><p><strong>OpenURL<\/strong><\/p>\n<p>Now we reached our target but we don\u2019t use the clicked url in our code, yet.\u00a0<\/p>\n<p>To use it, we must relay on a system event osx raises to ask applications to manage urls. We use an extension library provided by Apple, registering a handler to the OpenURI event.\u00a0<\/p>\n<pre class=\"brush: java;\">public static void main(final String[] args) {\n\tApplication.getApplication().setOpenURIHandler(\n\t\tnew OpenURIHandler() {\n\t\t\t@Override \n\t\t\tpublic void openURI(final OpenURIEvent pEvent) {\n\t\t\t\tJOptionPane.showMessageDialog (\n\t\t\t\t\tnull, \n\t\t\t\t\tpEvent.getURI().toString(), \n\t\t\t\t\t\u201cdemo\u201d,\n\t\t\t\t\tJOptionPane.ERROR_MESSAGE);\n\t\t}\n\t});\n}\n<\/pre>\n<p><strong>Dependencies<\/strong><\/p>\n<p>Note that our dependencies jar must be located in <strong>Contents\/Resources\/Java<\/strong> and every jar must be declared in Info.plist under the keys <strong>Java\/Classpath<\/strong><\/p>\n<p><strong>Download<\/strong><\/p>\n<p>You can find a demo project download on our public space in Assembla - <a href=\"https:\/\/www.assembla.com\/code\/myti_oss\/git\/nodes\">link<\/a><\/p>\n<p><strong>References<\/strong><\/p>\n<p><span><a href=\"http:\/\/www.xmldatabases.org\/WK\/blog\/1154%5FHandling%5FURL%5Fschemes%5Fin%5FCocoa.item\">Handling URL shemes in Cocoa<\/a><\/span><\/p>\n<p><span><a href=\"http:\/\/www.informagen.com\/JarBundler\/StubFile.html\">JavaApplicationStub<\/a><\/span><\/p>\n<p><span><a href=\"http:\/\/developer.apple.com\/library\/mac\/#samplecode\/AppleJavaExtensions\/Introduction\/Intro.html\">AppleJavaExtensions<\/a><\/span><\/p>\n<p><span><a href=\"http:\/\/java.net\/projects\/mrjadapter\">MRJAdapter<\/a><\/span>\u00a0- java library to enhance osx integration<\/p>\n<p><span><a href=\"http:\/\/developer.apple.com\/library\/mac\/#documentation\/Java\/Reference\/Java_InfoplistRef\/Articles\/JavaDictionaryInfo.plistKeys.html\">Apple doc<\/a><\/span> - References to the java info.plist keys<\/p>\n<p><span><a href=\"http:\/\/developer.apple.com\/library\/mac\/#documentation\/Java\/Conceptual\/Java14Development\/03-JavaDeployment\/JavaDeployment.html\">Apple doc<\/a><\/span> - References to application bundles creations<\/p>\n<p><span><a href=\"http:\/\/developer.apple.com\/library\/mac\/documentation\/Java\/Reference\/1.5.0\/appledoc\/api\/index.html\">Apple javadoc<\/a><\/span> - Javadoc for Apple Java extensions<\/p>","tags":["osx","java","application bundle","info.plist","protocol","url"]},{"id":"4255981580","url":"http:\/\/blog.myti.it\/post\/4255981580","url-with-slug":"http:\/\/blog.myti.it\/post\/4255981580\/benvenuto-tomson","type":"regular","date-gmt":"2011-04-01 10:51:44 GMT","date":"Fri, 01 Apr 2011 12:51:44","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1301655104,"format":"html","reblog-key":"9t7CccJp","slug":"benvenuto-tomson","regular-title":"Benvenuto Tomson","regular-body":"<p>Da oggi abbiamo un nuovo collega. <a title=\"Tomson\" target=\"_self\" href=\"http:\/\/www.myti.it\/who.php#tomson\">Tomson<\/a> \u00e8 uno sviluppatore java, viene dal Camerun e la seconda laurea (!) l&#8217;ha presa alla facolt\u00e0 di Ingegneria di Brescia. Tomson manger\u00e0 pane-grails-e-liferay per le prossime settimane.<br\/>Buon lavoro!<\/p>"},{"id":"3466326641","url":"http:\/\/blog.myti.it\/post\/3466326641","url-with-slug":"http:\/\/blog.myti.it\/post\/3466326641\/cloud-computing-e-enterprise-search","type":"regular","date-gmt":"2011-02-23 17:46:00 GMT","date":"Wed, 23 Feb 2011 18:46:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1298483160,"format":"html","reblog-key":"2cR6d7yC","slug":"cloud-computing-e-enterprise-search","regular-title":"Cloud computing e Enterprise Search","regular-body":"<p>In questo periodo di forte fermento della IT, tutta eccitata dall&#8217;avvento del <em>Cloud<\/em>, quali sono le prospettive a medio periodo di una applicazione di <em>Enterprise Search<\/em>, per sua natura funzionante in rete locale (<em>in-premise<\/em>)?<br\/><br\/>Credo che l&#8217;Enterprise Search sar\u00e0 uno dei pochi ambiti di applicazioni Enterprise che otterr\u00e0 vantaggi dal <em>Cloud<\/em>.<br\/><br\/>Innanzitutto dal punto di vista tecnico pu\u00f2 permettere di ricercare tra informazioni in rete come anche residenti nella nuvola.<br\/><br\/>Qualunque altra applicazione standard, non di nicchia, venduta nel mercato delle applicazioni in-premise si trover\u00e0 davanti ad una esplosione di fornitori on-demand, del tutto comparabili dal punto di vista delle funzioni, con il vantaggio di approcci commerciali innovativi ed aggressivi.<br\/><br\/>Un gestionale commerciale qualsiasi (fatture, ordini bolle tc) avr\u00e0 come concorrenti applicazioni di vari fornitori di tutto il mondo che si offrono cloud con prezzi a utente pi\u00f9 bassi e nessun costo di infrastruttura.<br\/><br\/>Questo per\u00f2 non porter\u00e0 alla completa distruzione del mercato delle applicazioni in-premise. Si avr\u00e0 una &#8220;dispersione&#8221; nella nuvola di tutti i servizi standard e che non creano valore aggiunto.<br\/>Gli altri resteranno:<\/p>\n<ul><li> il gestionale di produzione<\/li>\n<\/ul><ul><li>il file system (anche a causa della banda disponibile in italia) per tenere\u00a0 i documenti e tutto il materiale vicino al &#8220;ciclo caratteristico&#8221; dell&#8217;azienda<\/li>\n<\/ul><ul><\/ul><ul><li>I database di dati sensibili e privati<\/li>\n<\/ul><ul><li>Tutte le applicazioni specifiche, di processo, di nicchia, quelle insomma che rendono una azienda diversa dalle altre<\/li>\n<\/ul><ul><\/ul><p><br\/>In questo contesto un sistema di Enterprise Search Engine pu\u00f2 fare da enabler di applicazioni Cloud. E ne prende tutti i vantaggi.<br\/><br\/><a href=\"http:\/\/www.bleen.it\">Bleen<\/a>, ad esempio, si propone come sistema unico per accedere a tutte le informazioni aziendali. Per &#8220;accedere&#8221; intendo trovare ed usare.<br\/>&#8220;Usare &#8221; significa agire sull&#8217;oggetto trovato in modo rispettoso della sorgente dati o in modo innovativo.<br\/><br\/>Un cliente mi ha chiesto: &#8220;Ho un problema che vorrei mi risolvesse Bleen. Mi capita spesso di dovere richiamare backup di file dai miei DAT perch\u00e9 gli utenti li cancellano o li alterano in modo errato. Perch\u00e9 non fate gestire le versioni a Bleen?&#8221;<br\/>Io ho risposto: &#8220;Comprati Egnyte (applicazione cloud based che tra le varie cose ti fa il backup dei file nella rete gestendo le versioni. <a href=\"http:\/\/www.egnyte.com\">www.egnyte.com<\/a>), ha costi bassi a utente e a tera&#8221; <br\/>E lui: &#8220;Ma vorrei che l&#8217;utente fosse autonomo nell&#8217;estrarre le versioni&#8221;<br\/>E io: &#8220;Ti faccio il connettore per Egnyte cos\u00ec l&#8217;utente cerca in Bleen, trova il file e le versioni e da l\u00ec fa il download.\u00a0 Una unica interfaccia per tutti i sistemi. Una sola metafora da spiegare all&#8217;utente per agire sui dati dell&#8217;azienda&#8221;<\/p>","tags":["enterprise search","bleen","cloud"]},{"id":"3446541451","url":"http:\/\/blog.myti.it\/post\/3446541451","url-with-slug":"http:\/\/blog.myti.it\/post\/3446541451\/ascii-art-in-groovy","type":"regular","date-gmt":"2011-02-22 17:17:00 GMT","date":"Tue, 22 Feb 2011 18:17:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1298395020,"format":"html","reblog-key":"tMf89xaI","slug":"ascii-art-in-groovy","regular-title":"Ascii art in groovy","regular-body":"<p>Giocando con groovy, ho scritto un semplice programma per trasformare un&#8217;immagine in &#8220;<a title=\"ascii art\" href=\"http:\/\/it.wikipedia.org\/wiki\/ASCII_art\">ascii art<\/a>&#8221;.<\/p>\n<p>\n<script src=\"https:\/\/gist.github.com\/838892.js?file=AsciiArt.groovy\"><\/script><\/p>\n<p>(su <a title=\"gist\" href=\"https:\/\/gist.github.com\/838892\">gist<\/a> trovate il codice completo)<\/p>\n<p>Il programma \u00e8 molto semplice: un ciclo recupera, per ogni pixel dell&#8217;immagine un intero (tramite il metodo image.getRGB) che rappresenta il valore RGB del pixel stesso.<\/p>\n<p>Il metodo image.getRGB ritorna un unsigned integer nella forma AARRGGBB, quindi le istruzioni:<\/p>\n<blockquote>\n<p>r = 0xff &amp; (argb &#187;16)<\/p>\n<p>g = 0xff &amp; (argb&#160;&#187; 8)<\/p>\n<p>b = 0xff &amp; argb<\/p>\n<\/blockquote>\n<p>servono naturalmente per recuperare i valori delle componenti R (rosso), G (verde) e B (blue).<\/p>\n<p>Il valore massimo tra r, g, b \u00e8 poi utilizzato per la scelta del carattere che rappresenta il pixel.<\/p>\n<p>Naturalmente si possono pensare algoritmi pi\u00f9 evoluti per la scelta del carattere, nonch\u00e8 espandere il set di caratteri utilizzabili.<\/p>\n<p>A titolo di esempio, questo \u00e8 un fantastico ritratto del Venni trasformato in ascii art:<\/p>\n<p><img src=\"http:\/\/media.tumblr.com\/tumblr_lh133l7q4c1qz6yu2.jpg\"\/><\/p>\n\n<p><img src=\"http:\/\/media.tumblr.com\/tumblr_lh1517PgxV1qz6yu2.png\"\/><\/p>\n<p>Cambiando le impostazioni del terminale si pu\u00f2 anche ottenere il negativo :)<\/p>\n\n<p><img src=\"http:\/\/media.tumblr.com\/tumblr_lh134iamOc1qz6yu2.png\"\/><\/p>"},{"id":"3235215328","url":"http:\/\/blog.myti.it\/post\/3235215328","url-with-slug":"http:\/\/blog.myti.it\/post\/3235215328\/leggere-e-denormalizzare-una-tabella-con-un-campo-xpath","type":"regular","date-gmt":"2011-02-11 16:39:00 GMT","date":"Fri, 11 Feb 2011 17:39:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1297442340,"format":"html","reblog-key":"zfGBJP7M","slug":"leggere-e-denormalizzare-una-tabella-con-un-campo-xpath","regular-title":"Leggere e denormalizzare una tabella con un campo XPath in Kettle","regular-body":"<p><span>\n<p class=\"MsoNormal\">Lo step &#8220;Get Data From XML&#8221; di Kettle \u00e8 decisamente versatile: ci permette, infatti, non solo di leggere e trasformare un file XML, ma ci consente anche di effettuare le medesime operazioni sfruttando un campo di una tabella, che usiamo come input. Come fare?<\/p>\n<p class=\"MsoNormal\">Innanzitutto, dovremo necessariamente alimentare il &#8220;Get Data From XML&#8221; con un &#8220;Table Input&#8221;:<\/p>\n<\/span><\/p>\n<p class=\"MsoNormal\"><img src=\"http:\/\/media.tumblr.com\/tumblr_lggoptCebu1qb43h1.png\"\/><\/p>\n<p class=\"MsoNormal\">Questa volta, la configurazione dello step sar\u00e0 un po&#8217; pi\u00f9 complessa rispetto alla normale amministrazione, in cui viene alimentato da un file: in particolare, con questo disegno, non sar\u00e0 infatti possibile che il sistema intuisca la struttura XPath che stiamo leggendo.<\/p>\n<p class=\"MsoNormal\">Per cui, dovremo prima specificare il campo di origine XML:<\/p>\n\n<p class=\"MsoNormal\"><img src=\"http:\/\/media.tumblr.com\/tumblr_lggoroHMvV1qb43h1.png\"\/><\/p>\n<p class=\"MsoNormal\">In seguito, andremo a definire il loop dell&#8217;XPath:<\/p>\n\n<p class=\"MsoNormal\"><img src=\"http:\/\/media.tumblr.com\/tumblr_lggotexRKy1qb43h1.png\"\/><\/p>\n<p class=\"MsoNormal\">E, infine, i campi che andremo a generare tramite la denormalizzazione.<\/p>\n<p class=\"MsoNormal\"><img src=\"http:\/\/media.tumblr.com\/tumblr_lggovbvOuo1qb43h1.png\"\/><\/p>\n<p class=\"MsoNormal\">Anche in questo caso, non potremo sfruttare l&#8217;intelligenza del sistema nella definizione di questi ultimi (tramite la funzione &#8220;Preleva Campi&#8221;), ma dovremo specificarli manualmente.<\/p>\n<p class=\"MsoNormal\">Notate che, allo stesso modo, non avremo la possibilit\u00e0 di usufruire della funzione di anteprima contestualmente allo step, e non potremo fare altro che, prima, confermare le modifiche allo step, e, in un secondo momento, lanciare l&#8217;anteprima della trasformazione.<\/p>\n<p class=\"MsoNormal\">Un&#8217;ultima nota: personalmente, su Postgres, definire il datatype nel medesimo step (&#8220;Get Data From XML&#8221;) mi ha creato problemi, per cui, in un primo tempo, ho definito tutti i campi come String. In seguito, aggiungendo al flusso lo step &#8220;Select Values&#8221;, ho potuto alterare i datatype.<\/p>"},{"id":"452438745","url":"http:\/\/blog.myti.it\/post\/452438745","url-with-slug":"http:\/\/blog.myti.it\/post\/452438745\/grails-portlets-eager-fetching-in-service-class","type":"regular","date-gmt":"2010-03-16 16:12:50 GMT","date":"Tue, 16 Mar 2010 17:12:50","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1268755970,"format":"html","reblog-key":"ntMRFkMy","slug":"grails-portlets-eager-fetching-in-service-class","regular-title":"Grails portlets : eager fetching in service class","regular-body":"<p>Developing portlets with Grails is great but there are\u00a0still some issue to solve.\u00a0Today I would talk about two problems related to GORM and Hibernate.<\/p>\n<p><strong>First<\/strong>: some GORM stuff\u00a0works, while some others don&#8217;t and cause exceptions about the Hibernate session not being found.<\/p>\n<p>For example, if we have a domain class like this:<\/p>\n<pre class=\"brush: java;\">class Car {\n   Manufacturer manufacturer\n   Engine engine\n   Tyre tyres\n   Integer seats\n}\n<\/pre>\n<p>calling\u00a0<\/p>\n<pre class=\"brush: java;\">Car.get(id)<\/pre>\n<p>will works, but<\/p>\n<pre class=\"brush: java;\">Car.findByManufacturer()<\/pre>\n<p>won&#8217;t.<\/p>\n<p>There are also different behaviours by calling this methods in the render phase or in the action phase.<\/p>\n<p><strong>Second<\/strong>: lazy load doesn&#8217;t work in .gsp views and portlet classes.<\/p>\n<p>So writing<\/p>\n<pre class=\"brush: java;\">&lt;label&gt; ${car.manufacturer.name} &lt;\/label&gt;<\/pre>\n<p>cause an exception\u00a0<\/p>\n<pre class=\"brush: java;\">org.codehaus.groovy.runtime.InvokerInvocationException: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here<\/pre>\n<p>and, of course, the portal isn&#8217;t able to render the page.<\/p>\n<p>In summary, it turns out the problem is that the OpenSessionInViewFilter doesn&#8217;t work properly in a portlet environment.<\/p>\n<p>I faced this problem a few days ago and I found this <strong>solution<\/strong>:<\/p>\n<p>first of all, I suggest to put the code that use GORM in a service class and call the service method from the portlet class. That&#8217;s because service classes can get the hibernate session with no problems and use all of the cool dynamic methods for domain classes.<\/p>\n<p>Then, that service method must use domain class dynamic methods with the fetch argument set to &#8220;eager&#8221;, so the model will be fully loaded.<\/p>\n<p>Your renderView closure in the portlet class will look like this:<\/p>\n<pre class=\"brush: java;\">def renderView = {\n   def cars = carService.loadAllCars()\n   ['cars' : cars]\n  }\n<\/pre>\n<p>and here is the service method:<\/p>\n<pre class=\"brush: java;\">def loadAllCars() {\n   Car.findAll([fetch:[manufacturer:\"eager\", engine:\"eager\", tyres:\"eager\"]])\n  }\n<\/pre>\n<p>Of course setting the fetch mode to eager leads into using fewer queries than the lazy mode, because the Car model and its associations will be loaded all at once. However, if you have many associations loaded with eager fetching you will have a lots of objects loaded into memory, so be careful and pay attention while designing your service methods.<\/p>","tags":["grails","portlet","liferay"]},{"id":"443469891","url":"http:\/\/blog.myti.it\/post\/443469891","url-with-slug":"http:\/\/blog.myti.it\/post\/443469891\/clojure-first-steps","type":"regular","date-gmt":"2010-03-12 15:38:51 GMT","date":"Fri, 12 Mar 2010 16:38:51","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1268408331,"format":"html","reblog-key":"DcfhqqBT","slug":"clojure-first-steps","regular-title":"Clojure first steps","regular-body":"<p>This post is the first (I hope) of a series about my adventure in <a title=\"clojure web site\" href=\"http:\/\/www.clojure.org\">Clojure<\/a> land.<\/p>\n<p>Being Clojure hosted on the JVM, it&#8217;s a natural choice for a Java developer wanting to study and learn functional languages.<\/p>\n<p><b>A simple exercise<\/b><\/p>\n<p>I started with a simple exercise: a<i>dd all the natural numbers between 1 and 100 which are multiple of 5 or 7<\/i><\/p>\n<pre>; Add all the natural numbers below 100 that are multiples of 5 or 7.\n(def r (range 1 100))\n<\/pre>\n<p>The lines starting with&#160;; are comments.<\/p>\n<p>The second line creates a range of numbers, starting from 1 to 100, and assigns the sequence to the symbol r.<\/p>\n<p>I then defined a function which, given a number, returns true if the number is divisible by 5 or 7.<\/p>\n<pre class=\"sh_clojure\">(defn divisibile [x]\n  (if (== 0 (mod x 5)) true\n    (if (== 0 (mod x 7)) true false)))\n<\/pre>\n<p>The following statement filters the range returning a list of the values which are divisible by 5 or 7.<\/p>\n<pre>(def validValues (filter #(divisibile %) r))\n<\/pre>\n<p>Then I sum the validValues, using the reduce function; int the following statement it applies the + operator to the elements of the sequence: if the sequence is (a b c), the expression \u00a0returns (a+b)+c<\/p>\n<pre>(def tot (reduce + validValues))\n; print the result\n(println tot)\n<\/pre>\n<p>I&#8217;m an absolute beginner in clojure and functional programming, so I would be happy to receive comments or suggestions. Thanks!<\/p>\n\n<p>Enrico<\/p>","tags":["development","clojure"]},{"id":"441330811","url":"http:\/\/blog.myti.it\/post\/441330811","url-with-slug":"http:\/\/blog.myti.it\/post\/441330811\/custom-property-editor-for-grails","type":"regular","date-gmt":"2010-03-11 15:33:00 GMT","date":"Thu, 11 Mar 2010 16:33:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1268321580,"format":"html","reblog-key":"WsnL0tmm","slug":"custom-property-editor-for-grails","regular-title":"Custom property editor for Grails","regular-body":"<p><strong>Problem:<\/strong><\/p>\n<p>Create a custom property editor between Model and View to show it as we need. (example: we wanted to change how shows the java Date.class in a view, from default format <em>\u2018yyyy-MM-dd HH:mm:ss.S\u2019<\/em> to <em>\u2018dd-MM-yyyy\u2019<\/em>).<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<p>There are 2 solutions which I can see now. The first one is, when every time we show a Date object, format it using a java DateFormat implement and show it. But the pretty solution is the second one, create a custom property editor to show it. So you don\u2019t have to modify every date field that views show. To do that you have to create your property editor by implementing <a title=\"PropertyEditor API\" target=\"_blank\" href=\"http:\/\/java.sun.com\/javase\/6\/docs\/api\/java\/beans\/PropertyEditor.html\">PropertyEditor<\/a> and property editor registrar by implementing <a title=\"PropertyEditorRegistrar API\" target=\"_blank\" href=\"http:\/\/static.springsource.org\/spring\/docs\/2.5.6\/api\/org\/springframework\/beans\/PropertyEditorRegistrar.html\">PropertyEditorRegistrar<\/a> to register your property editor. <br\/>For example we created our <em>\u2018CustomPropertyEditorRegistrar\u2019<\/em> as property editor register and we used spring\u2019s <a title=\"CustomDateEditor API\" target=\"_blank\" href=\"http:\/\/static.springsource.org\/spring\/docs\/2.5.x\/api\/org\/springframework\/beans\/propertyeditors\/CustomDateEditor.html\">CustomDateEditor<\/a> as a property editor:<\/p>\n<pre class=\"brush: java;\">import java.util.Date\nimport java.text.SimpleDateFormat\nimport org.springframework.beans.propertyeditors.CustomDateEditor\nimport org.springframework.beans.PropertyEditorRegistrar\nimport org.springframework.beans.PropertyEditorRegistry\n\npublic class CustomPropertyEditorRegistrar implements PropertyEditorRegistrar {\npublic void registerCustomEditors(PropertyEditorRegistry registry) {\nregistry.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat(\"dd-MM-yyyy\"), true));\n\n }\n}\n\n\n\n\n<\/pre>\n<p>And finally you must add your custom property editor registrar to grails resources (<em>\u2018grails-app\/config\/spring\/resources.groovy\u2019<\/em>):<\/p>\n<pre class=\"brush: java;\">beans = {\n customPropertyEditorRegistrar(CustomPropertyEditorRegistrar)\n}\n<\/pre>\n<p>That\u2019s all!<\/p>","tags":["Grails","Groovy","Development"]},{"id":"441329123","url":"http:\/\/blog.myti.it\/post\/441329123","url-with-slug":"http:\/\/blog.myti.it\/post\/441329123\/groovy-tip-for-simpler-test-case","type":"regular","date-gmt":"2010-03-11 15:32:00 GMT","date":"Thu, 11 Mar 2010 16:32:00","bookmarklet":0,"mobile":0,"feed-item":"","from-feed-id":0,"unix-timestamp":1268321520,"format":"html","reblog-key":"4NpnSEtW","slug":"groovy-tip-for-simpler-test-case","regular-title":"Groovy tip for simpler test case","regular-body":"<p>When writing a groovy test case you almost want to be concise and expressive&#8230; next time you&#8217;ll see the test you must undestand it quickly.<\/p>\n<p>Here&#8217;s a small tip to enhance test writing.<\/p>\n<p>Having &#160;:<\/p>\n<pre class=\"brush: groovy;\">def car = new Car()\ndef jack = new People()\ndef tom = new Cat();\n<\/pre>\n<p>Instead of writing somethings like&#160;:<\/p>\n<pre class=\"brush: groovy;\">car.addPeople ( people )\ncar.addCat ( tom )\n<\/pre>\n<p>it&#8217;s really simpler to write:<\/p>\n<pre class=\"brush: groovy;\">car += jack\ncar += tom\n<\/pre>\n<p>To achieve this it&#8217;s as easy as writing a plus method in you model object.<\/p>\n<pre class=\"brush: java;\">public Object plus(Object o) {\n  if(o instanceof People) {\n     this.addPeople((People)o);\n  }\n  if(o instanceof Cat) {\n     this.addCat((Cat)o);\n  }\n  return this;\n}\n<\/pre>\n<p>Just remember this method must return this.<\/p>","tags":["groovy","test"]}]};

