Babbo Natale? O_o

Todays and yesterday search terms bringing people (very few of them) to my blog. Why ā€œBabbo Nataleā€? In Italian, ā€œBabbo Nataleā€ means ā€œSanta Clausā€, btw. I’m fat, but not THAT fat!!! Today ![Screen shot 2009-12-18 at 18.24.29](http://www.detronizator.org/wp-content/uploads/2009/12/Screen-shot-2009-12-18-at-18.24.29.png) Yesterday ![Yesterday Search Terms](http://www.detronizator.org/wp-content/uploads/2009/12/Screen-shot-2009-12-18-at-18.24.37.png) Weird.

December 18, 2009 Ā· 1 min Ā· 42 words

Find the non repeating char in O(n) time and O(1) space - v2

My colleague and friend Luca (@lucabox) described a better solution to the problem of "Finding the first non repearing char in a string in O(n) time and O(1) space". It uses smartly the space, making the solution nicer and slicker. Or we are just 2 geeks that need to give more attention to their girlfriends :P Luca’s solution description The logic of this solution is based on the usage of an array of unsigned chars. Every char (assumed to be lowecase) has an associated small byte (1 char = 8 bits), where the bits 0x1 and 0x2 (the 2 least significant) represents, respectively, ā€œpresent once in the input stringā€ and ā€œpresent multiple times in the input stringā€. After the input is ā€œscannedā€ once, and every letter is marked with the correspondent ā€œpresence bitā€ (once, multiple or none), it get’s scanned a second time to find the first char of the input which has the bit ā€œpresent onceā€ set to ā€œ1ā€. ...

December 18, 2009 Ā· 3 min Ā· 503 words

Find the non repeating char in O(n) time and O(1) space

I would like to post some of the Brain Teaser (mostly algorithmic problems) I’m giving to interviewee lately, and of course some that were submitted to me in the past. But I can’t promise I will keep doing it regularly: just that I will try (blogging regularly is hard for me). The solution will be at the end of the post, just in case you would like to try to solve it first. Of course my solution it’s MY solution: it could be buggy or non-optimal. In those cases, PLEASE share your view and, better, your alternative solutions. Problem description Determine the first non-repeated character in a word. For example, in abbcaf it should return c. Do this in [O(n)](http://en.wikipedia.org/wiki/Big_O_notation) time with O(1) space. Some observation O(n) means that the complexity of time of the algorithm must grow linearly with the input. So, if in this case the input is an array of characters, an acceptable solution can contain >1 non-nested FOR cycle. O(1) means that the complexity of space of the algorithm must be constant, regardlessly of the input. Conditions For simplicity, will assume that: the input is always a lowercase string (enforcing this condition is easy and cheap) the input is made made only of the letters of the english alphabet Those conditions will then become the ā€œbaseā€ of our solution. Of course, you are free to assume more conditions: it’s usually a good way to solve problems to start adding conditions that simplify the search of a solution, and then start a process of subtraction to arrive to have as less conditions as possible. It usually works for me. ...

December 13, 2009 Ā· 4 min Ā· 757 words

AES explains itself

This guy, Jeff Moser, is mental! He made a loooong comic strip to make AES explain itself: from a very high level, non technical explanation, deep down to mathematical details. Worth a read for sure! ;)

September 23, 2009 Ā· 1 min Ā· 36 words

Just added support for Tweetable

What’s Tweetable? It’s a plugin that integrates Twitter into my blog.

August 14, 2009 Ā· 1 min Ā· 11 words

QDetroBro: Experimenting with Qt on S60

The best way to learn a new language or a new framework is to find an idea and implement it. So I’m doing for Qt on S60. So I decided to implement a dummy browser that has some smart/attractive/peculiar/interesting/funny bits. QDetroBro Because I’m lazy to package and attach code, and because is always good the evolution of a project from the ground-up, I decided to post it on my GitHub account. You can find it at: http://github.com/detronizator/QDetroBro/tree/master. ...

August 13, 2009 Ā· 1 min Ā· 183 words

Git-over-SSH through Socks 5 Proxy on Windows

Because of my work, I use crappy M$ Windows in my office. And we are behind a bidirectional firewall. So, how do you do if you need to pull/push code with Git-over-SSH in this scenario? You need a Socks 5 that passes the firewall, and some scripting. First, you need to install: Git on Windows - http://code.google.com/p/msysgit/ Connect.c - http://bent.latency.net/bent/darcs/goto-san-connect-1.85/src/connect.html Then, you need a script that connects to the Socks 5 server. Like: [sourcecode lang=ā€˜bash’] #!/bin/sh ...

August 13, 2009 Ā· 1 min Ā· 200 words

Snippet: fix Screen Orientation in a Qt/S60 app

I follow the Qt/S60 Mailing list, that is turning out to be a very interesting and active ML, and the Qt Labs blog, always full of very good code, written directly by the guys of Qt Software. I thought could be nice to start to post some of the stuff I’m learning. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include <eikenv.h> #include <eikappui.h> #include <aknenv.h> #include <aknappui.h> // ... // lock orientation CAknAppUi* appUi = static_cast<caknappui *>( CEikonEnv::Static()->AppUi() ); if ( appUi ) //< Actually, this will always pass. It's a "static_cast" after all... { appUi->SetOrientationL( CAknAppUi::EAppUiOrientationPortrait ); } // ... Today's source is: [Nokia Forum](http://discussion.forum.nokia.com/forum/showthread.php?t=164499).</caknappui></aknappui></aknenv></eikappui></eikenv>

August 11, 2009 Ā· 1 min Ā· 116 words

Censured Berlusconi's pictures published by the El-Pais

The video is in Spanish with Italian subtitles, I’m sorry. You can find more content here. What happened in Italy is pure censorship to protect the image of a depraved, sick old man that rules my country in a new ā€œmedia-dictatorshipā€ way. The Italians should know about this. Source: blog.neminis.org.

July 5, 2009 Ā· 1 min Ā· 50 words

What in the hell is txty.mobi?

http://www.txty.mobi/ - For sure is related to mobile, usability, simplicity and ā€œmaking you able to use what you paid forā€. Intrigued? ;)

July 4, 2009 Ā· 1 min Ā· 22 words