mercoledì, dicembre 24, 2014

What a busy year!


This year has been as busy as last one, mostly because I left you folks when I was still looking for a flat, which I managed to get after lot of stress, but hey, what is an almost 18 months waiting compared to someone who had to wait 12 years for their goal, and what is buying a flat compared to landing on a comet ?
Sorry about this digress, it was just to put things in scale a bit.

Anyway just a short list of what happened to me (and my fiancée) this year:

- We finally bought home (I save you from the details of the madness happened to me)
- We got a proper internet connection the following week! (and Netflix/Crunchyroll are amazing!)
- We went a week to Malaga (and I got food poisoned :-( )
- I went in a flappy bird hackathon (alongside with +Alex Spurling) and wrote a game in few hours
- My best friend became dad
- I had to convert my expired driving license to an UK one
- My sister came to London to study english
- I got contacted by Facebook, they wanted to chat with me
- I went to Facebook's London office for 2 one to one interviews
- I went to a Mozilla bug-squash party and implemented a nice animation which should now be on the nightly build of Firefox OS
- Facebook asked me to fly to San Francisco for 4 one to one interviews
- We went to Palo Alto / Menlo Park / San Francisco for the most atypical west coast week (it was always raining!)
- Facebook liked me.
- Facebook offered me a job (in London!)
- I accepted!

This for me was the year of #Webcomponents!
For this I met a lot of nice people this year, some special mention goes to +Addy Osmani+soledad penadés (and to the other Mozilla guys I met +Chris Lord, Francisco Jordano, +Piotr Zalewa), and it's also the reason for why I have a bunch of new projects in my github repository; I also made some commit to the Mozilla Brick project as well.

I also had the chance of meeting +Andrea Giammarchi once more after years (last time was in Lugano 7 years ago)

Oh, BTW, we released MooTools 1.5.0, followed by 1.5.1 alongside with a new website (still work in progress, if you find anything weird with it, please write a ticket, thanks)

I also wrote a couple of blog posts on JavaScript on my new blog here, which differs from this one for the style of the posts, so I'd like to have some feedback about which style you prefer.

Again, as last year, I could have forgot to add some of the things that happened or I did not mentioned them on purpose.

So, the new year will surely be full of new challenges for me and new achievement to unlock, it will probably also be the year of EcmaScript 6 so lot to learn again :)



sabato, novembre 16, 2013

1st year is gone

Aaaand, is gone. 

It seems yesterday, instead it's already one year, wow, lot of things happened this year, and I feel like I need to make a summary of everything and maybe give some smart conclusion over that.

I started working in London the 12th of November and I had to make lot of stuffs the firsts weeks like:

- opening a bank account
- moving some money on the bank account to pay the rent
- going to the job's centre to make a NIN (National Insurance Number) that's needed for working in UK
- paying the TV Tax
- calling the electricity company, and the water company to set up an account and pay (this should have been done by the estate agents but eventually the water one was done but the electricity one for some reason not)
- trying to make myself connected to the internet through a normal provider
- failing to connect to the internet through a normal provider, finally switched to a mobile one with unlimited data plan

ok, that just the first weeks, then in the following months this happened:

- discovering that for Christmas London became a ghost town
- contacting the HMRC because I was paying too much taxes (I'm still waiting for the refund)
- getting my tax code corrected to the proper one
- getting some issues sorted because it seems that my bank reject some direct debit I set up for some still nowadays unknown reasons.
- register to the AIRE(Italians living outside Italy)
- get all my documents stolen
- going to the police to do the notification
- going to the consulate
- waiting for the AIRE registration to complete (it took months)
- asking a new ID once registered
- going to the post office to retrieve a package that I didn't expect and contains all my documents after 3 months!
- going to the police to update my notification
- going to get my new ID (it took weeks to be done)
- trying to buy a flat, got an offer accepted for like 4 hours before being gazumped
- trying to buy another flat, but after a survey discovering that some works in the flat were done without the proper permission
- back to Italy to change the address of my car, so my insurance is not void

probably something else I forgot (and some other things I prefer not talking about).

Workwise it was a great year, I got a couple of boosts and I really enjoy the company and what I'm doing within this company.

Businesswise I met a fuckton of people, followed lots of meetups and made some friends, I had the opportunity to met some really smart people, and to learn a couple of things.

London is really nice, there's lots to do, lots to see and not lot of time to do most of the things I would have done.

JavaScript (or better ECMAScript) wise I should return writing something here, I know I've still visitors, most are probably bots (Hey I can even see one still browsing with Netscape Navigator 8), so I think I will eventually write something in the next months, after I fix a couple of things that need to be fixed, I've plenty of things to talk about so it's just laziness on my part here.

Englishwise: my english still sucks, I think I'm not anymore in the `bearable understandable` status now, still way better than some Italians I heard everyday speaking in english (you can't imagine the number of Italians here in London), at least I don't have any of this kind of accents, even though I'm still making confusion over vowel pronunciation, making some basic grammar errors, this is especially true when I'm tired.

I've changed lots of habits and seen things I would never seen in Italy like marmite or the aeropress coffee maker, people standing in queue in order, people that excuses himself even when they're the one that needs excuses, meritocracy, the sony ps4 months before it was out, working fast post offices, less burocracy, people that can walk on the street dressed like he wants, trains on times, .

Blimey! It was a really busy year!
I think it was definitely a good year, while a bit busy I really enjoyed it, I'll look forward to the next one with a positive outcome and a positive mind.

-- Cristian

mercoledì, novembre 07, 2012

So it has come to this

So, it has come to this.

It's been a long time since I last wrote anything on this blog, mainly because I was too busy with real life problems to focus on javascript and programming in general.

Most of you probably has already notice that I'm now listed in the http://mootools.net/developers page,
while after the hackathon I didn't contribute as much as the past I'm proud to be one of the developer for this marvelous framework.

I will move soon to London (as in 2 days from now), where I'll join a new Company, after 8 years in the old one.

In this 8 years I learnt a lot, I got the chance to develop on multiple platforms, learn new programming languages, learn good patterns, made some good stuff (and some less good).

London will be surely the best place to improve my english, that kinda sucks right now, also London is the best place to further improve my skills, since there are lot of talk and meetup to visit, and maybe giving a talk as soon as my english improve a bit.

Once there I'll start again writing about javascript, MooTools and stuff like that.

About MooTools, stay tuned because there are really awesome stuff quite ready to be showed and talked about, so I will have lot of things to write in the next month, this blog will be alive once again \o/

See you soon ;)

martedì, ottobre 11, 2011

Mootools AOP and how to use AOP for Profiling Mootools Classes

In my last post about Mootools private pattern mutator, I've show how to use keeto's patternmutator to inject a private object into mootools methods.
Using this private object it is then possible to add private properties and methods which are accessible only to methods decorated with 'private'.

As noted by coda in the comment section, pattern mutators is now included in mootools 2.0.
PatternMutator is also the base of my kenta.AOP Class for Mootools that I'm going to introduce, and as a bonus I will show how to use kenta.AOP to create a simple Mootools Class Profiler.
What kenta.AOP is?
kenta.AOP is simple way to handle AOP in MooTools for debugging purpose.
In particular kenta.AOP handles method invocation by rewriting all Mootools class, allowing you to intercept these methods before and after the execution.
You can then use the event parameter to cancel the method's execution or hijack the method's return value.
kenta.AOP uses Mootools Events in a Publish-Subscribe pattern to let you write any modules you want.
In this post I will show you kenta.AOP.Profile to better demonstrate what kenta.AOP can do.

I wrote kenta.AOP as a little project to better understand patternmutator and AOP myself, but since it might be useful for other people I will share this snippet. piece of code.
What kenta.AOP is not? It is not a complete AOP Framework. In particular kenta.AOP can't handle property access and it doesn't perform exception handling by design; it also overwrites all MooTools class methods, so I advise against using it for production-code :)

the complete code of kenta.AOP is here:
kenta.AOP provides a global AOP object that fire two events: 'pre' and 'post', that you can use to listen and hijack methods.
Even if kenta.AOP listens all Mootools class method, it is designed to fire only if the Class has a 'Aspect' property

I guess you are wondering what kenta.AOP can be useful for, so here's a little example of how this code can be useful for debugging:
with an example:

Since Profiling don't require to overwrite the return value I will show you another example:

and another one in which we cancel the method execution:

domenica, ottobre 09, 2011

MooTools private pattern mutator

UPDATE: I created a MooTools forge repository for Private. There you will find any kind of improvement ;) /UPDATE Not too long ago I wrote this gist to add a sort of private properties / private methods to MooTools 1.2.x:

As of MooTools 1.3 this gist won't work anymore, but I've wrote another one as alternative, it requires Mark Obcena's PatternMutators.js that you can find here: keeto.PatternMutators.js:
How it works?

In the first version, the one for the 1.2.x branch of MooTools, if you Implements Private, what happens under the hood is that it create a property using MooTools $uid to get a unique-id per istance on a not-accessible outside of Class.Mutators.Private function, then it rewrote all the method of your instance passing the associated property as the last parameter of your function so that you can use it to store/retrieve private properties or even methods.

Since there's no way to automate the cleaning of all the objects/methods you can add, it need also to add a '~' method that you need to call on your destructor so it will not leak memory. I decided to use this ugly syntax: ['~']() because it need to stand out of your code, in a way to remember you that you are using an ugly hack to create privates and because is easier to remember something so strange ;)

For the 1.3 and upper branches of MooTools(yep, still work on 1.4.x) I decided to use a different, not compatible, way to achieve the same objective, so I based my mutators on keeto's patternMutator, for a number of reasons, basically cleaner syntax, re-using of existing code (keeto's one), and only methods marked with 'private' are now overwritten. You can see an example right here:

The code is slighly different, instead of Implements:[Private], you have to explicity mark the method you would like to use private properties or methods by adding 'private ' ahead of your method name, but other things remains unchanged.

mercoledì, febbraio 02, 2011

Post Mortem of a big js project (Part I)

Well, it seems ages since the last time I updated my blog, I really think is time to shove some dust off my blog.

Where did I'm vanished?

I was really busy on a project, in which I put lot of effort, I'm now to a point where I can consider the project to be quite stable so I can finally relax and return back here to write something about this.

I thought it was a good idea to write a post-mortem of this project.

Well. Let's start.

I was told to rewrite a really complex application originally written in vanilla javascript, because it needs to change it's UI.

After a little talk to the original application writer we comes to the conclusion that we can't only extend the old application to support the new UI but we need a total rewrite from scratch.

We only had something like 6 months to rewrite an application that was written in the span of 3 years with lots of features, in the meanwhile we even need to introduce more feature that wasn't expected to be introduced 3 years ago.

We immediately thought that we need to plan ahead what we will have to develop.

So we split the project in 2 big parts, the front-end and the back-end using an "MVC/MVP" approach,
in this way while he was concentrating on his parts, I could developing the new UI.

Both of us were sure that we needed to use a framework or a library to ease our work.

So we start to seek for the framework / library that was better suited for our needs.

He was quite sure to take jquery, but I was confident that we needed a better way to write our code, because, after all, it was one of our biggest problem.

The old application teach us that it was extremely important to write our code in a future proof way.

So, since I saw the benefits of good Object Oriented in my C# experience, I thought that we needed something that could force both to write more reusable code, enforcing the Object Oriented way to write javascript code.

With OO code we could have easily apply the TDD techniques that we both wanted.

After this considerations, It was pretty natural to me to follow the MooTools path, and I can tell you now that was a wise choice :)

Immediately after we started writing our firsts objects we feel the needs to automatize some tasks, like the merging of our little class file into a big script.

So I start to wrote the tool (a c# page) to merge together the classes, and to run our JSSpec page.
In the process of writing this page I included JSCoverage to made the code coverage of our tests, and I think this move was really smart, because we discovered that JSCoverage fails if it finds a syntax error in the code.
So technically it was as if we had a javascript compiler, that tells us that something was wrong even before running the page, not only that but it was amazing because JSCoverage returns the row where the syntax error was founded!

With a few tools we have TDD, BDD, Code coverage and syntax error applied to our js project. Marvelous.

Speaking of tools I found mootools really handy when we need to do a profiling of our application, it was as simple as writing a mootools mutator (https://gist.github.com/570711)

... but I'm seeing that this post is becoming too long, so I think I will continue it another day. bye ;)

lunedì, dicembre 28, 2009

Recensione Irex Iliad (1a edizione)

Ho recentemente acquistato tramite simplicissimus questo magnifico lettore di e-book (ad un prezzo fortemente scontato), la scelta è caduta su di lui principalmente per un solo motivo: la dimensione del display.



Infatti, a differenza di altri, questo lettore ospita uno schermo da ben 8 pollici con tecnologia e-ink a 16 tonalità di grigio e una risoluzione di 768x1024 pixel.
A suo favore dispone di una penna wacom per scrivere, questo significa due cose:


  • non è un dispositivo touchscreen, senza pennetta non potete usare le caratteristiche touch

  • non ha strati aggiuntivi al di sopra dello schermo e-ink e quindi non avrete problemi di riflessi


Come si può vedere dall' immagine qui sotto è molto sottile, molto più di un libro anche se come peso è di poco più leggero (pesa circa 450 grammi)






Sicuramente in un e-book reader conta come prima cosa la leggibilità del testo, ed è questo il punto di forza dell’ Iliad, la grandezza del monitor, e l’ ottimo supporto di base ai pdf, permette di leggere in maniera agevole questo formato.
E' possibile zoomare, ed effettuare il pan (lo spostamento) del pdf usando il pennino, è possibile anche vedere il pdf in landscape, inoltre aprendo un qualsiasi documento si ricarica l' ultima pagina visitata
Molto comoda la funzione di annotazione sui pdf tramite pennino per prendere appunti mentre si legge.



Oltre al pdf il lettore supporta una manciata di altri formati utili quali testo (.txt) e pagina web(.html) quest’ ultima utilizzando minimo (la build di firefox per dispositivi pocket) e mobipocket (.prc) supporta inoltre immagini e permette di annotare su di esse (jpeg,bmp e png)



Dispone di piccole casse integrate (e uscita cuffie ;) ) e ha il wifi integrato (supporta fino al WPA 1)



Inoltre è possibile interagire con il sistema operativo sottostante (linux) per installare applicazioni, ce ne sono poche ma buone, le più utili sono sicuramente:
pViewer : un lettore pdf alternativo che permette di fare il reflow del testo contenuto in un pdf anziché usare lo zoom normale contenuto nel lettore di default
iNewsStand: permette di sincronizzarsi con il proprio account feedbooks (gratuito) per scaricare diverse news da internet come fossero giornali (basta un feed rss)
FBReader che permette all’ Iliad di supportare svariati formati aggiuntivi
la triade calendario – agenda contatti e todo list
sono disponibili inoltre per gli smanettoni un file manager, una shell, un server ssh
ed altri ancora che si possono reperire a questo indirizzo



Diverse persone hanno messo mano ai sorgenti del lettore pdf di base (ipdf) creando delle modifiche ad hoc ed è possibile usare questi lettori andando a sostituire l’ originale con uno di questi (consiglio di utilizzare questo script da me creato prima di procedere all’ installazione di un lettore diverso)



L’ interfaccia grafica è pensata per poter accedere ai vari menù utilizzando semplicemente i tasti funzione dell’ Iliad, evitando di usare il pennino per risparmiare batteria e non dover staccare le mani dal dispositivo.






Il pennino risulta comunque utilissimo per interagire con le finestre dei vari programmi aggiuntivi e per prendere note sui pdf o sulle immagini, con un precisione che è ottima.



Parliamo ora dei difetti:
Una durata della batteria breve rispetto ad altri dispositivi e, in particolare, della seconda versione dell’ Iliad anche se per una persona normale, ovvero che legge soprattutto alla sera, o in pausa pranzo, il difetto è “poco sentito”, nel senso che ci si può veramente godere di lunghe sessioni di lettura senza paura che la batteria si esaurisca, e comunque il lettore è utilizzabile mentre è in carica (anche se, per colpa dell’ adattatore, potrebbe risultare un po’ scomodo se non si ha una presa vicina) e una carica si completa in circa 3 ore.



Come tutti i dispositivi di questo tipo esiste un effetto di persistenza residua a video (chiamato effetto ghosting), faccio però notare che è praticamente impercettibile mentre si legge, infatti il problema è maggiore quando il display usa tutta la gamma di grigio (per esempio per mostrare un’ immagine) e subito dopo si passa in una pagina normale (scritte nere su pagina bianca), oppure quando ci sono grosse intestazioni scure e la pagina successiva ha un carattere più piccolo, ma tra una pagina e l’altra di un testo questo effetto è nullo o praticamente impercettibile.



Il difetto più grande è forse il fatto che la barra a sinistra può risultare scomoda per persone che hanno difficoltà ad usare la mano sinistra;
si riesce comunque ad utilizzare il dispositivo però si deve appoggiarlo per cambiare pagina.



L’ iliad sembra attirare la polvere e di conseguenza, inevitabili ditate



Il software base dell’ Iliad è scarno, ma con un paio di link è facile sapere quali applicativi installare e la procedura da eseguire per installarli, che richiede però alcune conoscenze tecniche che per alcuni può essere un ostacolo.


Ma passiamo ora alle cose interessanti, ovvero come si vede nell' Iliad:

Questa è la pagina iniziale del romanzo "Abissi d' acciaio" di Isaac Asimov così come viene visualizzata con il lettore di default (da notare un leggero effetto ghosting, non vi preoccupate, la fotocamera è più sensibile dell' occhio umano :P ):






Zoomando attorno al testo si vedrà così:






Mentre usando il lettore ipdf fullscreen, usando lo stesso zoom si vede in questo modo:






Siccome usare il pan è molto scomodo non vi mostro lo zoom su una porzione di testo (che comunque è perfetto), invece vi propongo come si vede utilizzando pViewer con il livello 1 di zoom (a livello 0 è identico alla prima immagine)






pViewer livello 2 di zoom







pViewer livello 3 di zoom






pViewer livello 4 di zoom





Conclusioni:


Monitor molto grande che permette un lettura agevole anche se perde la tascabilità (ma è sempre pur meglio di portarsi addietro un netbook solo per leggere), scarsa durata della batteria (anche se esiste il metodo per potenziare la batteria perdendo ovviamente la garanzia), pennino per scrivere e annotare sui pdf ma pochezza di software di base (nessun supporto ai segnalibri multipli, nessun supporto al fullscreen) fanno dell' Iliad un lettore ebook formidabile per gli smanettoni, ma un po fastidioso, soprattutto all' inizio per i neofiti che non hanno voglia di cercar in internet come colmarne le lacune e che preferirebbero solo accendere e leggere.