Alessandro Melandri

Android Fragmentation

29 Jan 2013 • Permalink

Gingerbread, released on 2011, accounts for the 47% of the traffic mostly because a lot of Android smartphones are not upgradeable to the latest version.

This is a bit weird if you think that iOS 6 runs quite well on a 3GS, that was released on july 2009.

Source: Google


28 Jan 2013 • Permalink

Frozen by Alessandro Melandri (amelandri)) on

Going minimal

22 Jan 2013 • Permalink

It’s been a long time since I wrote something on my blog, mostly because I was busy at work and in my spare time I preferred staying with my family instead of “wasting time” on the internet.

In the meantime the Octopress template I released eight months ago has been adopted by a few people and besides being very happy for the feedback received I felt that I needed a more unique look for my blog.

One year ago I moved away from WordPress and choosed Octopress because I didn’t want to deal with unnecessary complication anymore.

I built a template because I wanted a custom layout for my blog, but now that a new Octopress release is around the corner and I should check and update the template code to be compatible with the new features, I don’t have enough time to do it, I don’t want to do it, even if it’s simpler than I think.

So I built a new layout for my blog customizing only the CSS of the default template because this surely gives me less freedom over the layout but it’s a lot more easy to maintain.
It’s still a work progress, but I’m quite satisfied with it.

Here it is, minimal, and white.

It's a customization

22 Aug 2012 • Permalink

Darkstripes Octopress theme is getting some good feedback and I’m receiving a lof of message from people thanking me for creating this theme.

Besides being very happy about the positive comments that the theme is receiving, I’d like to point out that Darkstripes is a customization of the original Octopress theme created by Brandon Mathis who surely put a lot of effort and time to build it so we all should thank him for giving us such a nice piece of software.

Thank you Brandon! :)

Some Darkstripes theme improvements

06 Aug 2012 • Permalink

Following the feedback I received after releasing Darkstripes, I’ve just released some little improvements to the theme.

Checkout the GitHub repository.

Blog archive

Decreased the font size and improved the vertical alignment of text elements.

Article footer

Added some styling to navigation buttons in the article footer improving the mobile user experience too.

As usual, you can test the latest changes right on this site.

DarkStripes Octopress theme released

23 Jul 2012 • Permalink

Some months ago I published an article about the Octopress theme customization used on this site and since then I received a lot of feedback and customization requests.

I finally reworked it and built a complete Octopress theme, released on Github, so you can fork it and customize it to fit your taste.

Following one of the most requested modification, I’ve updated the header code removing the image “{am}” and rendering the logo using only HTML and CSS.

I’m still tweaking the code and trying to test it on all browser (IE still to come), so maybe the best way to install the theme is to clone the Git repository in your Octopress .theme folder. Please, use GitHub issues if you have any problem with the theme.

If you’d like to see how it looks, this websites always uses the latest code.

In the screenshot below you can see the difference beetween the old header using an image for the logo and the new header that is using html and css to render the same logo.

jQuery/Javascript to replace broken images

06 Jul 2012 • Permalink

A nice StackOverflow thread about using Javascript to manage missing images in web pages.
Those are my favourites tecniques:

Simple Javacript function to be invoked on the img onError event

function ImgError(source){
    source.src = "/images/noimage.gif";
    source.onerror = "";
    return true;

One line jQuery code to get the same result

$('img').one('error', function() { this.src = 'broken.gif'; });

Using Apache mod_auth_form

29 Apr 2012 • Permalink

Protecting a web site area using Apache httpd basic security is very simple but you have no control over the login alert window displayed by the browser, so when at work we saw that since version 2.3 Apache added a module that will let you use a an html form instead of the ugly alert we decided to upgrade to latest version and give it a try.

I compiled Apache 2.4.2 on CentOS 6.2 32 bit. I won’t detail here the installation process, if you need help just follow this tutorial.

The following instructions are based on the mod_auth_form documentation page and the few tutorials I found online.

First of all create a test folder in the web server root and put a test page inside it

cd /usr/local/apache/www/
mkdir testfolder
echo 'It Works' > ./testfolder/index.html
chmod -R 755 testfolder/

Then create a login page in the webserver root that will be used to authenticate users

		<title>Login page</title>
		<form method="POST" action="">
			User: <input type="text" name="httpd_username" value="" />
			Pass: <input type="password" name="httpd_password" value="" />
			<input type="submit" name="login" value="Login" />

Please note that leaving the action empty, after a successfull login the user will be redirected to the previously requested resource.

Now edit Apache main configuration file enabling required modules

LoadModule auth_form_module modules/
LoadModule session_module modules/
LoadModule request_module modules/
LoadModule session_cookie_module modules/

and then add a Directory directive to protect the folder

<Directory "/usr/local/apache/www/testfolder">
    AuthFormProvider file
    AuthType form
    AuthName "Reserved Area"
    Session On
    SessionCookieName session path=/
    require valid-user

 	# This is the login page
    ErrorDocument 401 /login.html

    # This is the file containing users login data
    AuthUserFile /usr/local/apache/auth/.htpasswd


Now add a user to the .htpasswd file and reload the web server configuration before trying to navigate to the protected folder.

htpasswd -c /usr/local/apache/auth/.htpasswd myusername

Arcipelago Gulag

19 Apr 2012 • Permalink

L’uomo oscilla tutta la vita fra il male e il bene, scivola, cade, si riarrampica, si pente, si ottenebra nuovamente, ma fino a che non ha varcato la soglia della malvagità il ritorno rimane nelle sue possibilità, ed egli resta nell’ambito delle nostre speranze. Quando invece, per la densità delle azioni malefiche, o il loro grado, o per il carattere assoluto del potere, egli oltrepassa d’un tratto la soglia, esorbita dall’umanità. Forse senza possibilità di ritorno.


Dobbiamo condannare pubblicamente l’IDEA stessa dello scempio compiuto da uomini sui loro simili. Tacendo sul vizio, ricacciandolo nel corpo perché non si riaffacci, noi lo SEMINIAMO, e in futuro germinerà moltiplicandosi per mille. Non punendo, non biasimando nepppure i malvagi, non ci limitiamo a proteggere la loro sterile vecchiaia, ma strappiamo da sotto alle nuove generazioni ogni fondamento di giustizia. Ecco perchè esse crescono “indifferenti”, non è colpa della “insufficiente educazione”. I giovani imparano che un’azione ignobile non viene mai punita sulla terra, anzi, porta sempre il benessere.

Non sarà accogliente un tale paese, farà paura viverci.

Learning from competition

09 Mar 2012 • Permalink

Reacting well to competition requires critical analysis of your own product and its shortcomings, and a complete, open-minded understanding of why people might choose your competitors.

They’re not fanboys. They’re not brainwashed by “marketing”. Your competitors’ customers aren’t passing on your product because they’re stupid or irrational.

They’re choosing your competitors for good reasons, and denying the existence of such good reasons will only ensure that your product never overcomes them.