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
mercoledì, novembre 07, 2012
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
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
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)
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.
martedì, novembre 10, 2009
Problemi ADSL? Non c’è problema! Li ignoriamo!
Sono abbonato con il mio operatore ADSL da circa 3 anni ormai l’ attivazione è avvenuta infatti il 21 febbraio 2007, e considerando che avevo fatto la richiesta in data 9 novembre 2006 posso considerarmi fortunato, poco più di tre mesi per tirare un cavo solo dati :)
C’è da dire che mi sono orientato verso questo operatore per una tanto decantata banda minima garantita che mi avrebbe permesso di utilizzare la linea di casa per un uso professionale, e devo ammettere che per i primi due anni non ho avuto granché problemi, se non forse due o tre guasti nel suddetto arco temporale risolti in meno di ventiquattro ore.
I veri problemi sono iniziati da quando quest’ azienda ha cambiato politica, infatti ha introdotto nel suo listino delle linee, passatemi il termine, “castrate” del p2p introducendo, per altro, delle policy di QoS (Qualità del Servizio) che hanno, dal mio punto di vista, peggiorato la situazione, non tanto per il fatto del QoS in se, quanto per via che fornendo linee a minor prezzo si è creata una situazione per cui le linee sono di fatto sature.
Ciò che affermo è facilmente riscontrabile dai grafici che tale azienda mette a disposizione di tutti, questo avrebbe dovuto far scattare un fanalino d’ allarme in chi gestisce l’azienda e far si che si prendesse provvedimenti.
Evidentemente di provvedimenti non ne sono stati presi o comunque sia non in modo significativo visto che il problema è cresciuto, per ciò che mi riguarda, in maniera esponenziale.
Nell’ ultimo periodo, infatti, ho un guasto che mette down la mia linea anche per lungo tempo, in particolare sono in una situazione dove la mia linea ADSL (che, da contratto, dovrebbe viaggiare a 7 Mega) o non viaggia proprio, o quelle volte che riesco ad accedere ad internet va a velocità risibili, ciò mi impedisce l’ uso professionale di cui sopra, ma non solo, mi crea dei disagi notevoli dal momento che non riesco di fatto ad utilizzare i seguenti servizi:
- Mail: il servizio basilare per chi è nel campo dell’ IT, il serviizio di mail non mi è accessibile
- Banking: Ho un conto online è mi è necessario poterci accedere in qualsiasi istante, poiché è il mio unico modo di gestire il mio conto corrente, quindi ho difficoltà nel mandare pagamenti tramite bonifico, fare trading online, fare ricariche telefoniche ecc..
- Videoconferenza: Mi è impossibile chiamare tramite Skype non solo la mia ragazza che sento ogni sera (che adesso sono costretto a sentirla solamente per telefono), ma anche con persone che mi permettono di lavorare o di approfondire tematiche relative al mondo IT e che aumenterebbero il mio know-how
- Tutte le risorse IT disponibili in internet (google gruppi, stackoverflow, reddit, ecc): non avendo accesso alla documentazione relativa ai strumenti informatici che utilizzo per programmare mi viene fortemente limitata la mia produttività casalinga :)
- Servizi di blogging: Non posso accedere ad HTML.it, per cui non riesco a scrivere nel Blog in cui collaboro, questo mi crea un danno d’ immagine: potrebbe sembrare che io abbia voluto prendere un impegno che non rispetto
- Servizi di connessione remota: non posso utilizzare ne VNC o RDP ne tantomeno servizi minori come ssh e telnet
Ricapitolando ho danni economici, danni dal punto di vista lavorativo, danni di immagine e danni morali, nonché perdite di tempo, tempo che ho perso inutilmente per cercare di capire se il problema era mio oppure no (cambio di router, cambio di cavi, cambio di configurazione dei router, test su diversi sistemi operativi ecc...)
Per tutti questi motivi e considerato che avevo aperto il guasto il cinque ottobre e a tutt’ oggi (più di un mese!) il guasto si ripresenta tale e quale e da allora ad oggi ogni giorno la linea va in DOWN (numerosi LCP down visibili dal log del router) per diverse ore, spesso quando ne ho bisogno, i pacchetti che “pingo” vengono persi sistematicamente, la velocità non si avvicina minimamente a quella contrattuale, ho deciso di inviare la qui sotto riportata diffida ad adempiere:
Diffida ad adempiere ( avvalendosi della risoluzione di diritto concessa dall' art.1454 del codice civile )
Alla spettabile
Signora Ditta che mi porta l’ adsl in casa
Io sottoscritto
Cristian
Carlesso
Via dei matti numero 0
con la presente Vi INTIMO di provvedere all'adempimento del contratto con Voi
stipulato relativo alla linea adsl associata al numero contratto che poi sarebbe il mio riguardante il servizio di fornitura in modo continuativo del servizio ADSL Specifico del mio caso.
Adempimento che da parte vostra è venuto meno con il guasto verificatosi in data 05/10/2009 e regolarmente segnalato al
vostro Servizio Clienti contattato tramite form on-line
in data 05/10/2009. Ma nonostante tale segnalazione ad oggi sono spiacente di
constatare che non avete ancora provveduto alla relativa riparazione.
Visto che gli usi non prevedono termini più lunghi, per il ritorno da parte
Vostra all'adempimento del contratto già citato con la presente è richiesto un termine
massimo di 15 giorni dalla Vostra ricezione della presente intimazione, facendo fede il timbro postale.
Decorso inutilmente tale termine il contratto di fornitura del servizio adsl Specifico del mio caso stipulato con Voi sarà considerato risoluto di diritto, ai sensi
dell'art. 1454 del codice civile, con la cui presente intendo avvalermi.
Chiedo inoltre la massima celerità nel rendere disponibile dopo la risoluzione
del contratto il numero di linea ad oggi impegnato dal contratto ADSL in essere con Voi.
Adesso se entro quindici giorni dal ricevimento della raccomandata non mi aggiustano la linea il contratto si risolverà per l’ articolo 1454, articolo che impone il rispetto dei vincoli contrattuali, ora vedremo se mi aggiusteranno la linea, comunque sia vi terrò aggiornati, poiché sembra che scrivere un po’ di righe sulla cosa mi abbia aiutato a far calmare i bollenti spiriti, si , perché anche in questo momento (da un paio di ore) sono sconnesso da internet (sfilza di LCP down nel router)…
Speriamo bene! ;)
mercoledì, luglio 08, 2009
So, I want to learn at least a functional languag....hey, wait! I already know it! XSLT!
WHY FP?
The bigger benefit from Functional Programming is that since in this style of programming the output depends only from the input parametesr, function have no side effects, and this allow simpler multithreading.
HOW FP WORKS?
Basically you describe a set of function ad tell the function what output give based on its input parameters.
but, hey! wait! if in the last sentence you substitute set of function with set of templates and input parameters with matches you can get that the concept here is very similar of how XSLT works...
In fact, in xslt a given template when feeded with the same input always produce the same output!
Xslt,by the way, under the hood use multithreading so seems that xslt have a lot in common with functional programming language...
mmm...
So, to recap, you can say that XSLT templates are the equivalent of FP functions...
... not quite really, since XSLT templates can't be passed across templates by refence ...
TILL...
... I found this paper !
The examples are not very clear (and font-size are weird on that site), so I write a little Example XSLT here:
<?xml version="1.0"?>
<!-- Here I define a defn namespace, we will need it to define our function-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:defn="my-functional-xslt-example"
>
<xsl:output method = "text" />
<!-- here I will define 2 functions add3 and add4 -->
<defn:add3 />
<xsl:template match="defn:add3">
<xsl:param name="parameter" />
<xsl:value-of select="3+$parameter" />
</xsl:template>
<defn:add4 />
<xsl:template match="defn:add4">
<xsl:param name="parameter" />
<xsl:value-of select="4+$parameter" />
</xsl:template>
<!-- ok, now I will define a function that accept a reference of another function and execute that -->
<xsl:template name="execute">
<xsl:param name="function" select="/.."/>
<xsl:param name="parameter" />
<xsl:variable name="result">
<xsl:apply-templates select ="$function" >
<xsl:with-param name="parameter" select="$parameter" />
</xsl:apply-templates>
</xsl:variable>
<xsl:value-of select="$result" />
</xsl:template>
<xsl:template match="/">
<!-- ok, now I will obtain the reference of our function, and I will store that in two variables -->
<xsl:variable name = "add3" select = "document('')/*/defn:add3" />
<xsl:variable name = "add4" select = "document('')/*/defn:add4" />
<!-- and this is how call the function passing add3 -->
<xsl:call-template name="execute" >
<xsl:with-param name="function" select="$add3" />
<xsl:with-param name="parameter" select="10" />
</xsl:call-template>
<!-- and this is how call the function passing add4-->
<xsl:call-template name="execute" >
<xsl:with-param name="function" select="$add4" />
<xsl:with-param name="parameter" select="20" />
</xsl:call-template>
</xsl:template>
So seems simple (but verbose) to pass around function references.
You will argue that this example works only on MSXML, but on the FXSL page you will found the saxon / xalan corrispondence.
on msxml you can obtain a similar results using msxml:script but this require a little javascript code and JSCRIPTxxx.dll and ,for example on pda, this could be a issue.
So, at the end I can say I already know at least a functional programming language... a sort of... or not? ;)
martedì, febbraio 10, 2009
[jsn] isNative: a.k.a. the windmill war
We try very hard to make something reliable, and without fail we manage to crack every single code we wrote.
I gave up but since then every now and then I recall that days in which we enjoyed this "windmill war".
Since when I gave up I had an idea, I just tried to see if that I can work out something to make that idea work.
What IDEA?
Basically since we cannot know if a function is real I thought to make the browser fail if I try to eval some code, make the eval code call himself in an infinite loops.
<script type="text/javascript">
eval = function(str){
eval(str);
}
eval("alert('hello, proof');"); //too much recursion on FF, stack overflow on IE ;)
</script>
Basically if I extend this logic to all the string evaluating function
(Function object, eval, Object.eval, setTimeout, setInterval) made them using only one function It should work.
example:
eval = function(){
return function(code){
(new Function(""+code))();
}
};
in this way if I try to use eval to rewrite Function I just can't because Function is called inside eval for the same principle of the first snippet I posted.
So why a windmill war?
Caching.
Function caching to be precise,
in javascript I can write this code:
var f = eval
eval = function(str){
alert("I' m an evil functions! bwahahaha!");
f(str);
}
So I don't need to use Function anymore to rewrote eval, I just Spoof the code,
I can send The spoofed code around using http request (for example a src in images...).
To recap, bear this in mind:
Javascript is so powerful in the way it leaves you modify its behaviour that is totally unreliable.
domenica, novembre 16, 2008
[jsn] IE Javascript REAL speed tester
The project is a very basic .net 3.5 window form project written using VS 2008 express,
it will require .net 3.5 installed.
I released the project on codeplex, you can found it at http://www.codeplex.com/IEJst
lunedì, novembre 10, 2008
AVG Aggiornamento kamikaze del 9/11/2008 ripristino XP
...
Poi al riavvio del pc non son più riusciti ad accedere ad XP (...chissà come mai...)
Allora vediamo di far notare con chiarezza la cosa:
Se AVG vi dice che il file user32.dll è infetto da "PSW. banker4.APSA" (o qualcosa di simile) non cancellate, ne spostate nulla!!!
Il mio consiglio è di passare ad Avira free (http://www.free-av.com/) che si è dimostrato recentemente migliore di avg / avast, se invece volete rimanere ad avg mettete il file c:\windows\system32\user32.dll tra le eccezioni dell' antivirus...
Ho inavvertitamente cancellato user32.dll e non mi parte il pc, e adesso???
Allora, semplicemente prendete il cd di installazione di XP (dovete averlo ;) ) e inseritelo, assicuratevi che il vostro BIOS permetta l'avvio da CD/DVD rom e riavviate il pc.
Vi verrà chiesto se volete avviare da cd, premete invio per proseguire
aspettate un po che carichi il menù, ad un certo punto vi verrà chiesto qualcosa,
voi premete R per entrare in console di riparazione e ripristino
a questo punto dovrebbe venirvi scritto qualcos' altro, non ricordo voi continuate finché uscira una roba con dei numeri, nella maggior parte dei casi premete 1 (la spiegazione è sicuramente troppo tecnica)
bene
ora guardate, quello è un prompt XD
ammiratelo con sacro rispetto per 2 minuti dopodiché digitate (premendo invio ogni comando)
D:
dir /ad
se tra le cose che vi vengono scritte c'è un I386 proseguite al punto G
altrimenti provate scrivendo
E:
dir /ad
se prima non c'era qui dovrebbe esservi un I386, altrimenti andate avanti con l'alfabeto finché troverete la prima I386 dopodichè potete anche voi passar al punto "G"
Punto G
a sto punto scrivete (ricordo sempre l'invio)
cd I386
expand user32.dl_ c:
copy c:\user32.dll c:\windows\system32
da notare l'underscore (il trattino di sottolineatura) nel comando expand
bene ora potete riavviare e una volta fatto potete (S)cancellare il file user32.dll in c:\ (non quello in c:\windows\system32 però)
se AVG vi tedia ancora dicendo che c'è un virus fate la famosa "finta da pomi" (cioè ignoratelo)
martedì, settembre 30, 2008
Vi presento un nuovo recensIONISTA di giochi! :D
I primi 2 giochi che ho avuto in carico di recensire sono S.T.A.L.K.E.R.: Clear Sky e X3: Terran Conflict.
Il primo è il prequel molto atteso di S.t.a.l.k.e.r.: Shadow of Chernobyl, che è un FPS con alcuni elementi RPG di stampo survival horror, il secondo invece è una simulazione di vita nello spazio, che in realtà è anch' essa a sua volta un seguito, in particolare trattasi di un' espansione standalone di X3: Reunion;
X3 mi ricorda per certi versi un gioco del '94 dove si colonizzava lo spazio (che volevo fare lo sborone citandolo, ma che in questo momento non mi sovviene il nome) comunque mentre quello era un gioco strategico a turni questo è tutto in real time, ma real time vero, tutto calcolato in tempo reale.
Entrambi i giochi sfoggiano una grafica mostruosa, e sono pure avidi di risorse, Stalker al massimo dettaglio fa fare fatica al mio nuovo PC (un quadcore con 4gb di ram e una 8800gt!!!) comunque, giochi a parte, per me è stata un esperienza nuova, vedere pubblicate le proprie recensioni dà una soddisfazione senza eguali, è stata una gioia dedicarmici e spero in futuro di poterlo fare sempre più, vi invito,
se vi interessa, a leggere le recensioni di S.T.A.L.K.E.R.: Clear Sky e di
X3: Terran Conflict
e di lasciare, in caso, qualche commento qui, suggerimenti, critiche, idee eccetera tutto è bene accetto.
Ps. Questa piccola avventura ha già portato i suoi frutti, infatti sto migliorando il mio modo di scrivere, che era arrugginito dalla sindrome SMS / Chat.
Risulta infatti difficile scrivere un qualcosa correttamente dopo essersi (MALE!) abituati alla scrittura veloce da messaggini, mail e sms vari, son però contento perché tutto torna utile :D
martedì, luglio 08, 2008
Dustin Diaz Programming Brain Teaser
A solution:
arr.join("")
.replace(/(.)(\1)((\1)+)/g,'$1$1[$3]')
.split("")
.join(" ")
.replace(/\[\ /g,"<span>")
.replace(/\ \]/g,"</span>")
obviously it can be simplified, but for me that's enought ;)
domenica, maggio 04, 2008
pensavo di scrivere male... e invece!
sabato, febbraio 09, 2008
MEGA SCOOP!!!
Dovrà darsi forza per recuperare un anno di inattività, ma son certo che ce la farà,
mi auguro solo che non sparisca subito di nuovo...
martedì, gennaio 22, 2008
[jsn]A simple JS IoC example code
Here are the code:
var
shuriken = {
hit:function(who){alert("pierced the "+who+" armor");}
},
sword = {
hit:function(who){alert("Chopped the "+who+" in half");}
};
function Samurai(weapon){
return {
Attack:function(who){
weapon.hit(who);
}
}
}
container.register("samurai",Samurai);
var warrior1 = container.byConstructor("samurai",shuriken),
warrior2 = container.byConstructor("samurai",sword);
warrior1.Attack("The evildoers");
warrior2.Attack("The evildoers");
So simple, So clear!
[jsn]JS IoC on GoogleCode!
and for the occasion i made a little change in the code, so now JS IoC
is perfectly compatible with MooTools ( I tested the beta, but it should work on the current also ) with the Class Module selected.
So now you have 2 choice, or use the old (and perfectly working) code and use
Andrea Giammarchi extend script (I put that also on Google Code) or if you
already use MooTools you can simply take the 1.0MT version and you're ready to go!
martedì, gennaio 08, 2008
Human Japanese
Kentaro Miura, autore del celebre Berserk manga che non molto tempo fa ha spopolato
in tutto il mondo.
Negli anni ho imparato a coltivare una passione per quel bel paese che si chiama Giappone, che ha una cultura tanto diversa dalla nostra, che per molti diventa quasi difficile comprenderla.
Il Giappone mi ha sempre affascinato, il mio desiderio è di farci visita un giorno,
prima però sarà bene che almeno impari le basi della loro lingua, altrimenti farei
solamente una grama figura.
Ho cercato di imparare la lingua un po per volta, provando varie strade, tra cui
una è ascoltare i podcast (eccezionali sono quelli di japanesepod101), reperire documentazione in internet e guardare qualche anime in lingua con i sottotitoli
(che è un esperienza che consiglio vivamente a tutti, l' espressività dei giapponesi nel doppiare gli anime non è paragonabile a niente al mondo).
Purtroppo senza una scuola di giapponese è molto difficile imparare questa lingua che sembra ostica, ma che in realtà per certi versi è più facile di tante altre lingue.
Per chi, come me, ha un po di dimestichezza con l' inglese il compito risulta facilitato per la quantità di informazioni che è possibile reperire in internet.
L' altro giorno, un po per caso mi sono imbattuto in un sito che vende un prodotto software per imparare questa lingua, incuriosito ho notato che non solo era possibile scaricare la demo, ma è anche possibile provare gratuitamente in internet una versione live
che riproduce fedelmente la versione per pc, seppur in maniera limitata.
Di primo impatto, essendo un professionista del web ho notato come il sito fosse ben fatto sia a livello grafico sia testando il sito con Firefox, Explorer e Safari.
Leggendo poi le lezioni disponibili online ho deciso di scaricare la demo gratuita, scoprendo che l'unica limitazione imposta era relativa al tempo, in pratica è possibile controllare tutte le lezioni(e i relativi esercizi) contenuti.
Mi sono poi soffermato su alcuni dettagli tecnici, ovvero che il programma è fatto in .NET (presuppongo in c#) e che non è null' altro che un custom browser che fa girare le pagine delle lezioni, i test invece sono scritti in Flash, quindi è richiesto il player di Adobe.
A differenza di software didattici analoghi e costosi (per esempio Rosetta Stone) dove si cerca di insegnare la lingua per associazioni mentali, Human Japanese si propone come una guida, una specie di libro, che ci permette di seguire un filo logico per imparare il giapponese, ed è questo che mi ha colpito maggiormente di questo software (forse perchè è ciò che stavo cercando io).
Questo unito al fatto che il software ha un prezzo veramente basso ($24.95) mi ha fatto propendere al suo acquisto.
Per finire aggiungo che per i blogger c'è la possibilità di un ulteriore sconto a patto che scriviate un articolo su tale software (potete anche parlarne male), di 10$.
sabato, dicembre 22, 2007
Bleach, The Film
did you think I'm joking? ok, take a screenshoot of the film:
Me, Hollow by ~kentaromiura on deviantART
Ps. ok, i was kidding, but if someone would make a film on Bleach, please take me in consideration, I'm the Perfect Kurosaki Ichigo ;D