Flying memes

Archive for the ‘Algoritmi’ Category

How to render a dynamic animated Delaunay triangulation

Sunday, May 4th, 2014

A friend of mine recently asked if I can create an animation out of this nice example; the first thing I did was wrap the render function around a requestAnimationFrame and add a random speed factor to all the vertices at every iteration.


Angular.js prevent an invalid form submission

Saturday, March 1st, 2014

Angular.js does an excellent job on preventing a form submission when invalid but only if the action attribute is not present, otherwise we have to implement a few tricks to achieve the same behaviour.


Useless bu fun: Encoding video to CSS

Thursday, March 14th, 2013

I spent part of the last weekend on this experiment that startet with a question: it is possible to convert a video to a stream of CSS properties ? Surprisingly the answer is yes. We can dump each video frame to a canvas and then create a special (and very long) multiple background property (one background for each video row) where each pixel is created using a 1px size gradient.


Migrating a single site of a wordpress multisite instance

Sunday, October 28th, 2012

Recently I had to deal with a WordPress multisite instance, the task was moving the contents of one of the sites hosted on the network to a local copy, update them and the re-move them to the production server.


Handling thousands of pics from a mobile device

Sunday, November 27th, 2011

Lately I’ve been involved into a fascinating project called PepperTweet which consist in extract and visualize streams of pics from twitter starting from some search keywords.


HTML5 Augmented Reality: fuzzy results

Thursday, May 12th, 2011

I spent a few hours trying to figure out how to deal with the brand new deviceorientation API in order to obtain a nice Augmented Reality effect. First I searched on how to convert Euler Angles to Cartesian Coordinates and I found a nice article about that, then I downloaded the very nice Sylvester library which lets you compute matrix operations in Javascript.


I’ve just checked in at WC2010 Johannesburg Stadium from home

Saturday, June 12th, 2010

Thanks to Uncle Pear suggestion I realized that you can easily check-in in every Foursquare venue simply invoking its id using the API, to try this behavior I checked in at Johannesburg  WC2010 stadium from my home in Italy.


A semantic experiment for separate good from bad.

Tuesday, May 4th, 2010

Yesterday was sunday and I came up with a fascinating idea: what happens if I use wordnet to measure the distance between two words ? By assigning weights to all the relation types and by navigate this relations graph I thought to be able to measure the distance between a word and the others in terms of the minimum sum of weights of the edges between each pair made of the chosen word and another.


Game of Life, introducing gray

Friday, April 2nd, 2010

During the last hour I modified my previous version of Game Of life trying to reproduce the same behavior using an analogic discriminator. Instead of counting the number of neighbours I elaborate their medium color and use this value to decide the next rgb combination of the cell.


A Game of Life

Saturday, March 20th, 2010

Everybody knows the popular Game of Life created by Jhon Conway and becamed famous after been published by Martin Gardner on Scientific American in 1970. It is essentially a cellular automation algorithm with a very few simple rules that determinate how to grow a pool of one-pixel-shaped organisms layed upon a 2D matrix.