Thursday, 5 December 2013

The Light Game for Windows Phone - The User Voice

1 of 8The Light Game is a simple but incredibly unique and fun game that I built for Windows Phone.

Since the first release, the game has been downloaded by more than 200,000 people, it has been the top free game in Windows Phone in some countries for a while and it has received hundreds of very positive reviews with an average of almost 5 stars.

In this post I would like to share with you some of the most interesting and positive reviews I received in the last 12 months.

All of these comments made me really proud and they surely stimulate me to continue in improving the game over time.

Thank you very much!

Friday, 22 November 2013

Are you serious about achieving mastery? Find your mentor!

Few months ago, I read a book that significantly helped me in reflecting about my career and aspirations as a Software Engineer. It helped me in taking a very important decision that, I am sure, will have a great impact in my future.

The book is called Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman and in this post, I am going to tell you my decision and the reasons behind it.

The book offer advices and solutions to dilemmas that software engineers typically have. The goal is helping them in increasing their expertise and becoming masters in what they do.

The book celebrates the importance of Software Craftsmanship as one of the best way to really learn the skills and the practical abilities required to design and develop high-quality tested software.
"Having knowledge is not the same as having the skill and practical ability to apply that knowledge to create software applications. This is where craftsmanship comes in."
There is one advice in particular that emerge constantly:
"If you are serious about achieving mastery, be tenacious about finding mentors to guide you."
These words made me deeply reflect.

I am an avid self-learner and definitely serious about achieving mastery. I read a lot of books written by experts in their fields that in an indirect way are like mentors for me. At the same time, at work, I am surrounded by very smart and talented people that are always willing to help and share their knowledge with me. I attend events and I am a founder of a community that helps me to network with passionate and energetic individuals.

This is awesome and it is great but I realized that I needed something more.

I really needed to find a mentor outside work, a person who I respect, with many years of experience and a strong reputation in the field, a professional that can follow me in my learning process and coach me in the right directions to become a great software engineer.
"The goal is to find ways to expose yourself to the daily working habits of other skilled people, and observe the ways in which they gradually refine those habits into even greater skill"
The main question was: Who to choose?

The answer to me was almost immediate: Matteo Baglini.

Matteo Baglini is a very senior software developer and architect with a lot of experience in building software in various different domains from business, web, mobile applications to embedded softwares. He is freelancer, a consultant, a technical writer, a speaker and founder of DotNetToscana and Coders TUG.

I have to say that Matteo is the most disciplined, the most pragmatic and the best programmer I ever met. I met him during my last year at the university and he already had a lot of impact on me at the time when we founded DotNetToscana and he surely represent what I want to become in the future. In addition, he is also a very good friend of mine.

So, in August, I sent a mail to him explaining my reflections and my intention to have him as my official technical mentor. 

Luckily, he was in a stage in his career when he wanted to invest more time in technical coaching activities so he accepted with enthusiasm and pride.

We started officially in October after my wedding and since then we had a meeting every week.

I have to say that the experience so far is incredible and I have all the intentions to share on my blog the results of this experience and the big lessons I am learning.

The ultimate goal is to being able to build cathedrals and Matteo can help me in achieving this :)
"Digging deep into a technology is that you can actually explain what’s going on beneath the surface of the systems you work on. This understanding will distinguish you from other who can’t describe the software they've helped build in a meaningful way because all they understand is one little portion. Once you’re part of a team, it’s the application of this pattern that separates out those who are making random piles of rubble (the Pragmatic Programmers called this “programming by coincidence” while Steve McConnell calls it “cargo cult software engineering”) from those who are building cathedrals."
If you are interested in the technical coaching services offered by Matteo, get in contact with him using his web site: Make It Simple.

This experience will be profound and useful for me and I am really excited about it.

Tuesday, 5 November 2013

Top Coder Problem - WolfDelaymaster

During my last SRM 593 on TopCoder I found the medium problem quite interesting and I was happy that I have been able to solve it relatively quickly using the technique of Dynamic Programming.

Solving this problem taught me two important lessons:

  1. The power of Dynamic Programming
  2. The trap of over-optimization

The interesting thing is that I didn't realize the second lesson until I wrote this post so I am really glad I decided to write it.

I am going to quickly describe my solution.

The problem statement: WolfDelaymaster (Why register on TopCoder?)
My solution: WolfDelaymaster implementation.

The definition of the problem suggest an immediate recursive implementation.

You can first check that the string satisfy the first condition. You start checking against "wolf", then "wwoollff" and so on. Considering that the maximum input string is 50 characters the biggest string to test against contains 12 times each individual character.
  1. For each positive integer n, the string which consists of n copies of 'w', then n copies of 'o', then n copies of 'l', and finally n copies of 'f' is a valid word.
If this test fail, we can use the second rule and split the original string in two parts and recursively check them. It is important to try all the possible split points that are multiple of 4 (there are no valid strings shorter than 4 characters).
  1. The concatenation of two valid words is a valid word.
This is the initial implementation:

Does this implementation works?

Yes, it works!

Are you concerned about the performance implication of having two recursive branches?

I was and for some reasons I decided to apply the technique of dynamic programming in order to speed up the program. You can learn more about dynamic programming on Wikipedia. It basically consist of caching the intermediate result of computation to quickly cut the recursion tree.

Here the implementation (addition highlighted).

Does this effort was required?

Absolutely not!!! The original implementation was good enough.

What is the worst case?

The worst case is a string that is invalid with a length of 50 characters like "fofflwllwooowowwwllllwlwllwwlwwfwwfwofwwfolowlolwo".

The execution time of the original algorithm on the worst case is: 0.0110 seconds.
The execution time of the optimized algorithm on the worst case is: 0.00056 seconds

Dynamic programming is powerful as it improved the speed of the algorithm of a factor of 19 but in this case it was not necessary. This is the biggest mistake I made. I wasted a lot of time that I could have spent on the next problem.

It is worth to mention that the problem could have being solved in an iterative way but for some reasons the I didn't get it during the competition and the recursive implementation was more natural for me.

This is a possible implementation adapted from the winner of the competition (I didn't test it using the TopCoder system tests).

The time of the iterative version on the worst case is: 7.1E-06

This version is absolutely the quickest version!

Monday, 4 November 2013

What is your personality type indicator?

The Myers-Briggs Type Indicator (MBTI) is a psychometric questionnaire designed to measure psychological preferences in how people perceive the world and make decisions.

Doing the test can helps you in understand yourself better and clarify your work preferences so that you can set career goals on your natural inclinations as suggested in the book 10 Career Essentials: Excel at Your Career by Using Your Personality Type.

You can take a free test on Humanmetrics.

This is my result.

It seems that I am a INFJ type of person that is the most rare of all the types (1% of population). I am quite impressed about the description of this type as, in some way, I recognize myself in it.

In particular the following is somewhat true about me:

  • They put a lot of energy into identifying the best system for getting things done, and constantly define and re-define the priorities in their lives.
  • The INFJ is as genuinely warm as they are complexINFJs hold a special place in the heart of people who they are close to, who are able to see their special gifts and depth of caring
  • INFJs are concerned for people's feelings, and try to be gentle to avoid hurting anyone
  • They are very sensitive to conflict, and cannot tolerate it very well.
  • INFJ is a perfectionist who doubts that they are living up to their full potential
  • INFJs are rarely at complete peace with themselves - there's always something else they should be doing to improve themselves and the world around them
  • They believe in constant growth, and don't often take time to revel in their accomplishments. 
  • They have strong value systems, and need to live their lives in accordance with what they feel is right.
  • INFJs are in some ways gentle and easy goingConversely, they have very high expectations of themselves, and frequently of their families. They don't believe in compromising their ideals.
  • INFJ is a natural nurturer; patient, devoted and protective.
  • Many excel in the sciences, where they make use of their intuition.
  • They are capable of great depth of feeling and personal achievement.
For more info:

I have the same type as Mohandas Gandhi and Eleanor Roosevelt. It is probably not coincidental that the book The Art of Happiness: A Handbook for Living is one of my favourite books.

What is your personality type indicator?

Wednesday, 31 July 2013

Configuring the TopCoder Arena for C# developers

If you read my previous post (Learning Algorithms with TopCoder - Getting Started Guide) you are probably motivated in solving TopCoder problems and putting yourself under test. You probably created an account and tried the arena and you quickly realized that the experience is not that great.


  • You have to read the text of the problem inside the arena
  • You have to manually create the class and copy the method signature
  • Testing the code with the examples is a manual process in the arena
  • Debugging against the examples force you to code all the examples manually
  • You have to copy the code from Visual Studio into the Coding Area

This is tremendously annoying!

Fortunately, there is a solution to these problems using some arena plugins. It is a little bit annoying to setup but once done your coding experience is vastly improved and you can finally focus on writing algorithms.

You can find some only-text documentation at the following link:

First of all, download the file and extract it into C:\TopCoder

The folder contains an empty Visual Studio .NET 4.5 C# console application and a folder jars with the plugin code.

In this post, I want to explain step by step how to configure the TopCoder arena to be able to start solving SRM problems in TopCoder using C# and Visual Studio.

Launch the arena and open the Editor options.

Add a new editor with the following information:

  • Name: ExampleBuilder
  • EntryPoint: codeprocessor.EntryPoint
  • ClassPath: C:\TopCoder\jars\CodeProcessor.jar;C:\TopCoder\jars\FileEdit.jar; C:\TopCoder\jars\ExampleBuilder.jar

Select the new editor and click Configure.

Insert the entry point fileedit.EntryPoint and the processor class tc_plugin.ExampleBuilder

Then, click Verify.

Press OK and then Click Configure.

Specify the enter directory to C:\TopCoder, check "Write the problem description using HTML" and check "Write the Problem Description to separate file" with extension html.

Click the Code Template tab, select the C# language.

Copy the template code from here but feel free to customize it as you like.

Save everything.

Now you have everything set up and you are ready to code.

Open one of the past SRM: Practise Rooms > SRMs.

Select one of the problem.

The default editor will launch by default. Make sure that you select C# as your language.

Change your editor to ExampleBuilder.

This will trigger the creation of two files:

  • A C# source file with the problem and the tests
  • An html file with the description of the problem

You can open the html file and read the problem statement in your favourite browser (maybe in a separate screen if you have a multi-monitor setup).

At this point, you can open the TopCoder Visual Studio solution and include the file in the project.

You can see that all the examples has been automatically added as tests and the only thing that you need to do is to provide the implementation of the algorithm in the method.

using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class BinaryCode 
    public string[] decode(string message) 
        string[] res = new string[0];
        return res;

    public static void Main(String[] args) 
            eq(0,(new BinaryCode()).decode("123210122"),new string[] { "011100011",  "NONE" });
            eq(1,(new BinaryCode()).decode("11"),new string[] { "01",  "10" });
            eq(2,(new BinaryCode()).decode("22111"),new string[] { "NONE",  "11001" });
            eq(3,(new BinaryCode()).decode("123210120"),new string[] { "NONE",  "NONE" });
            eq(4,(new BinaryCode()).decode("3"),new string[] { "NONE",  "NONE" });
            eq(5,(new BinaryCode()).decode("12221112222221112221111111112221111"),
                  new string[] { "01101001101101001101001001001101001",                  
                                 "10110010110110010110010010010110010" });

        catch(Exception exx)  


You can see the results of the tests simply running the project with F5.

How do you actually submit your code?

Click Compile and the source code will be automatically copied into the arena.

Finally click Submit.

To summarize, once you setup your development machine like I explained in this post you will be able to open any TopCoder problem, start coding your algorithm immediately and have a lot of fun. During a competition, this technique can also save you a lot of time and increase the chance of getting an higher score.

Enjoy coding!


Saturday, 27 July 2013

Learning Algorithms with TopCoder - Getting Started Guide

I have lots of friends who are passionate developers and every so often we discuss about
algorithms design and how important this is. The TopCoder platform offers a very good opportunity to put yourself under test, improve your skills and compete among other coders around the world. Everyone is pretty excited when I explain them about the platform and they seems willing to try it out but for some reasons this does not happen.

Let me be clear now.

Do you know what is the reason?

The answer is that...

They are frightened!

Saying that you don't have time is not an excuse because a competition is just 90 minutes long and everyone can give it a try. They are coders so why should they be scared of coding?


The reason is because they "don't feel ready to compete". They fell they need to do additional learning before actually competing otherwise they hurt their reputation and self-esteem. This is perfectly reasonable and I completely understand these feelings because this is how I constantly feel. TopCoder problems are usually very difficult and this fear of failing is completely blocking them.

So what?

What they don't consider is that TopCoder is not only a competing platform but also a learning platform. Once registered you have access to all the exercises from previous competitions with solutions completely explained, you can try them on your own without competing, you have access to lots of tutorials. There are tons of materials. You will be never ready so after trying few exercises I recommend to try a SRM (Single Round Match) competition. Competing really change the game and makes you more aware of your true skills. You are then able to identify areas of improvement, practise and then compete again. At the end of the day, you are always and constantly learning!

TopCoder is a learning platform!

Competitions can be seen as just a way of learning but you are not forced to compete.

However, if you are ambitious and you are truly committed to becoming a great coder, like I am sure you are, competing is the best way to put yourself under test and really find your potentials and limitations.

If you are scared you probably are not really serious of becoming a great coder.

It does not matter how strong you become compared to others. What matters is constantly learning and improving yourself.

This idea is also clearly expressed by the founder of TopCoder, Jack Hughes:

"TopCoder intends to help developers increase their skill level as well as increase their value to employers"

Then what?

If you read so far, it means that I convinced you to try TopCoder and in this post I would quickly introduce you to the platform.

First of all, you need to register.

Open the following website and click on Register Now in the top right corner

TopCoder allows you to learn and compete in many different areas. If you want to practise your algorithmic skills just select "I want to compete on TopCoder" and then follow the procedure where you will be asked to provide all your personal details.

Once registered, you can login into the website.

Expand the Competitions menu item and enter into the Algorithm category and then into the Single Round Matches section. It is probably a good idea to read the Overview page and then the Algorithm Competition Guide.

You can access to all the past problems clicking the Match Archive link under Statistics. In addition, you can also read the code submitted by all the people who participated to the competition. This is a lot of stuff!

There are also an interesting set of tutorials about algorithms that you can find in the Tutorials page.

However, there is nothing better than actually trying a problem yourself.

If you want an experience that is similar to a rate event, you can launch the Arena clicking the O(n) image in the top-left corner or the Launch Arena link.

The Arena is written in Java and you need to have it installed.

In the arena you enter a practice room and you can submit your code to a problem and get a score of how well you did it. The biggest value of the practise room for a learning point of view is the ability to run the system tests and discover bugs in your algorithm. You can also challenge the code written by other coders to find bugs in their implementations.

More information here: Practising in the TopCoder arena.

You can code using one of the following languages: C++, Java, C#, VB or Python.

The platform has been recently updated to the latest version of the languages.

If you decide to compete, you will get a score and you will be ranked against all the other top coders. You can find statistics about your performance clicking on your login name in the top-right corner.

For example, the followings are my current statistics. As you can see, I am still quite weak. 

I hope with this post that I have stimulated your curiosity.

Happy coding and see you in the arena!

See how to configure the TopCoder Arena for C# developers.


Thursday, 25 July 2013

DotNetToscana is Community of the Year 2013

I am pleased to announce that DotNetToscana has been awarded by Microsoft as Community of the Year 2013.

My sincere congratulations to all the members of the staff and all of our followers and supporters.

This is the picture taken during the Microsoft Community Lead Summit with Marco Minerva, our community lead, and Marco Dal Pino recently awarded as Nokia Developer Champion for Windows Phone.

Well done!

Sunday, 7 July 2013

My TechEd 2013 in Slides

Microsoft TechEd Europe 2013 conference was held the last week of June in Madrid, Spain. As usual, Microsoft published online the entire content of the sessions. This is a lot of free materials!

Considering an average of 1.5 hours per session, it would require almost 4 working months to watch all of the sessions.

Even an avid learner like me, needs to give up on such idea. That's why I think that downloading all the sessions in advance is usually a crazy idea.

In the past, I watched only few sessions and I simply ignored all the others. The problem with that option is that you might easily miss some important news.

This year, I decided to follow a different approach. I decided to fully watch only the keynotes and to read the slides of all the other sessions. The goal is obviously to learn all the latest news from Microsoft without missing anything. Following this approach, allows me to identify topics I didn't consider and that might be of interest. In addition, nobody stops me to watch a particular session in full later if I need to understand more deeply a subject I am particular interested.

I spent almost 18 hours to do this and in this post I would like to summarize the conference showing the slides that I liked the most.

Statistics and Trends

This slide include really impressive information about the amount of data that is transferred on the Internet every minute. This is astonishing and it is growing incredibly fast.

The challenges faced today by the organisations are complex.

Cloud computing is the answer and hybrid cloud computing looks like the most favourite trend.

In addition, mobile malware is increasing in particular in the Android world. Security is surely a big and important topic.

Windows Server 2008 R2 is the most used Windows Server OS right now and there is still a significant portion of Windows Server 2003 deployments out there.

Windows XP is still incredibly popular and share a similar slice of the client OSs with Windows 7. Windows 8 instead is still quite irrelevant. Hopefully the future release Windows 8.1 will get more traction thanks to the reintroduction of the start button of the ability to further customize the desktop. As a consequence of this, there are still a lot of VB6 applications in production.

Microsoft Cloud Vision

Microsoft is clearly investing a lot in building a complete cloud infrastructure.

Microsoft and Citrix

Microsoft is the lead for desktops and Citrix is the lead of Desktop Virtualization. As a Citrix employee, I am quite interested in the relationship between these two companies, and in this edition of TechEd there were many sessions mentioning Citrix products.

First of all, it was quite interesting to read about the interconnected history of the two companies.


The following slides describes the power of combining XenApp and Configuration Manager 2012 and I am particularly proud to say that I personally worked in some part of these projects in Citrix in the last few years.

The Mobile SDK for Windows Apps allows to mobilize applications that are hosted on Citrix XenApp or XenDesktop and delivered to any mobile device with Citrix Receiver.

SQL Server 2014

Windows Server 2012 R2

I simply love the ability to create virtual networks. Thanks to the new Windows Azure Active Directory will be easier then ever to create a private virtual network that spans across Azure and the corporate network. This is a significant step forward for my point of view!

Software Development



MSDN Benefits

The new MSDN benefits for Windows Azure are incredible. In particular, I like:
  • No charge for Stopped VMs
  • Pay by the Minute Billing
  • Heavily Discounted MSDN Dev/Test Rates
  • MSDN Monetary Credits