Stefano Tommesani

  • Increase font size
  • Default font size
  • Decrease font size

AltaLux 1.5 in IrfanView

E-mail Print PDF


AltaLuxIV1 The AltaLux image enhancement filter is now available in the popular IrfanView image viewer!

Now you can enjoy AltaLux technology inside an advanced image viewer and editor, so trying how AltaLux can effectively enhance your photos is just a click away while you keep using your favourite image viewer.

Last Updated on Sunday, 04 November 2012 12:20

An object-oriented approach to FizzBuzz

E-mail Print PDF

FizzBuzz is described as:

Write a program that prints the integers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz"

It takes a couple of minutes to write a few lines of C++ code that satisfy the requirements:

#include <iostream>
using namespace std;
int main () {
 int i;
 for (i = 0; i <= 100; i++) {
 if ((i % 15) == 0)
 cout << "FizzBuzz" << endl;
 else if ((i % 3) == 0)
 cout << "Fizz" << endl;
 else if ((i % 5) == 0)
 cout << "Buzz" << endl;
 cout << i << endl;
 return 0;

But then the examiner may ask you to add some more checks, such as printing a different string when the number is a multiple of 11 or any other number, and the code quickly becomes ugly. In fact, the major mistake that you can make with FizzBuzz is using the wrong sequence of checks, for example checking for modulus of 3 before that of 15, so that FizzBuzz is never printed; this is obvious with only 3 simple checks, but gets more complicated with a longer list of more complicated checks.

So why not spend a few minutes more than those required to write a trivial solution, and propose a fully object-oriented solution that is designed for extensibility?

Last Updated on Monday, 27 May 2013 18:51

Improving web speed with Arduino

E-mail Print PDF

The Flash library by Mikal Hart is a wonderful piece of software for improving simple web server apps built on the Arduino: the main problem when designing such apps is that the limited number of RAM available forces the designer either to use an SD card to store the files that are part of the web site, and/or store some HTML fragments in the PROGMEM area, and copy them back to normal RAM to modify and include them in the server HTML packets. The Flash library greatly simplifies the second technique, as the following code fragment highlights:

FLASH_STRING(WebPageHeader, "HTML source code");
Client& client = web_server.get_client();

The FLASH_STRING macro declares a string contained in PROGMEM, so that it does not decrease the available RAM. Streaming that string is as easy as calling the print method and passing the Client connection of the web server as the parameter. Using this technique, dynamic generation of web pages includes both static parts stored in PROGMEM as FLASH_STRINGs (for example, page headers and footers, top menus, etc.) and dynamic parts that are generated by code (for example, tables containing data values coming from attached devices).

Last Updated on Thursday, 21 March 2013 23:18

Test video for CCTV motion analysis

E-mail Print PDF

CCTVTestVideoHere is video footage from a real-life scene: it's a windy day, so the camera is slightly shaking, and there is a lot of action happening in the road below. This video sequence is useful for the following tests:

  • - checking the direction of moving vehicles (there are bikes moving in the wrong direction)
  • - classifying moving objects (cars, buses, motorcycles, bikes etc.)
  • - rejecting false alarms due to unrelevant movements (the shadow of the trees is costantly moving, but it should not trigger an alarm, while people walking and running should)

You can download this video sequence (running time: 9m 42s) from Dropbox clicking on this link. (if clicking on the link starts a video player, right-click on the link and choose Save Link As.. from the popup menu)

Last Updated on Thursday, 13 September 2012 15:53

Slow blits with latest nVidia drivers

E-mail Print PDF

An application of mine uses DirectDraw to draw video frames on multiple screens, and so far the visualization pipeline used a group of off-screen YUV surfaces that, at the end of the process, are drawn into the primary surface. So this is the code that creates the primary surface:

ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps    = DDSCAPS_PRIMARYSURFACE;
if ((ddrval = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL)) != DD_OK)

and this is the code that creates an off-screen YUV surface:

Last Updated on Friday, 27 July 2012 11:12

Easy multi-thread programming with Delphi

E-mail Print PDF

In the AltaPixShare software app, when the user drags a group of images to the target location, the following code iterates over the list of images, and for each image creates the destination file:

for i := 0 to Pred(ActiveImages.Count) do
CurrentImage := TProcessedImage(ActiveImages[i]);
CurrentImage := nil;
if Assigned(CurrentImage)
then begin

Given that applying a filter to a large image and then writing the output image into a JPEG file is a time-consuming task, this is a clear case for multi-threaded optimization, so that multiple images are processed at the same time on different CPU cores. And using the amazing AsyncCalls library, we can achieve this result with only a few lines of code. These are the steps required to turn this serial code into a multi-threaded one:

Last Updated on Saturday, 20 April 2013 17:19

Page 7 of 9
View Stefano Tommesani's profile on LinkedIn

Latest Articles

Necessary evil: testing private methods 29 January 2017, 21.41 Testing
Necessary evil: testing private methods
Some might say that testing private methods should be avoided because it means not testing the contract, that is the interface implemented by the class, but the internal implementation of the class itself. Still, not all
I am right and you are wrong 28 December 2016, 14.23 Web
I am right and you are wrong
Have you ever convinced anyone that disagreed with you about a deeply held belief? Better yet, have you changed your mind lately on an important topic after discussing with someone else that did not share your point of
How Commercial Insight changes R&D 06 November 2016, 01.21 Web
How Commercial Insight changes R&D
The CEB's Commercial Insight is based on three pillars: Be credible/relevant – Demonstrate an understanding of the customer’s world, substantiating claims with real-world evidence. Be frame-breaking – Disrupt the
Windows Forms smells funny, but... 07 April 2016, 15.38 Software
Windows Forms smells funny, but...
In the "2016 .NET Community Report" just released by Telerik, the answers to the question "What technology would you choose if building for Windows Desktop?" were as follows: So roughly half of new desktop developments would
Say goodbye to
It is not easy to monitor how our code behaves on a vast array of different machines. A myriad of different configurations can lead to errors that are difficult to reproduce and even more difficult to anticipate. And when the