Posts
YouTube >> The Go Programming Language
A video that I need to watch myself (I just managed to watch 25% of it), but I thought was good to post it here: just to remind how good it is to think āout of the boxā. Even in Programming Languages. Presenter: Rob Pike Presented on: 30th Oct 2009 Go is a new experimental systems programming language intended to make software development fast. Our goal is that a major Google binary should be buildable in a few seconds on a single machine. The language is concurrent, garbage-collected, and requires explicit declaration of dependencies. Simple syntax and a clean type system support a number of programming styles. For more on Go including FAQs, source code, libraries, and tutorials, please see:http://golang.org ...
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  Yesterday  Weird.
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ā. ...
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. ...
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! ;)
Just added support for Tweetable
Whatās Tweetable? Itās a plugin that integrates Twitter into my blog.
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. ...
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 ...
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>