Despre “succesul” comunismului

Tocmai am citit un comentariu la un articol; omul spune foarte clar (si foarte corect): “Secretul minunii comuniste a fost sa nu lase oamenii sa aleaga”.

Articolul poate fi citit la, iar comentariul apartine utilizatorului “gigi”.

Keep your customers away from your computers

Last week I had to pay a visit to a car service: my car needed an oil change and there were some other needed maintenance tasks.

The service is nicely organized: there’s a waiting room with clear walls that allow the customer to see how the mechanics work on their cars. They’ve recently added some video cameras allowing the manager to quickly see the mechanics as well. But they did a little mistake …

In the waiting room there are two PC-s connected to the Internet that any customer can use. Every time I pay them a visit, I sit at one of these PC-s and read some blogs (last time I’ve read a lot about Ember and JS, as these technologies are critical for our current project).

So, as soon as I’ve given them the car keys, I’ve sit in front of one of the PC-s and moved the mouse … the monitor kept showing “no video signal, check your cable connection”. Being the experienced developer I am, I reached for the reset button and pressed it, thinking the PC is old and it can’t come out of power-save. I’ve waited for a while, moved the mouse again, pressed some keys on the keyboard … nothing! So I’ve moved to the next PC and started reading about Ember.JS.

In a few minutes, the service manager came to the PC that I’ve just reset and started to operate on the mouse and the keyboard, while looking oddly above my head … then I’ve realized that the PC had been connected to a larger monitor that was hanging in the corner of the waiting room and the manager was looking at that monitor. I’ve told him what I did and I’ve apologized … and he said all cameras in the service were connected to that PC, and now he was not able to display their feed anymore. He was relieved that the problem was BTKATC, and not with his setup and then he laughed and said he’ll place a label on the PC saying “Please do not use”.

We both carried on.

My conclusion: even your well educated customers make mistakes, make sure you place clear guides everywhere.

Cannot debug program in Visual Studio

One of my coworkers ran into a nice issue: she has been assigned to take over the work of a developer from another country and she received the sources nicely packed in a Visual Studio solution.

She managed to build the sources, but every time she tried to start the application under Visual Studio debugger the output window would list “invalid instruction” and the application quit; the main function was not hit at all.

When run without the debugger, the application run fine.

She was not able to find out what was happening so she called me (the last C++ expert in the company) to the rescue.

We’ve discussed our options for a good half an hour: try a newer VS version, cut out parts from the application, ask the upper management to coerce the original developer into answering our e-mails …

And then I’ve got it: I’ve seen a .DLL marked with some “enigma” keyword. I’ve configured VS to stop at all exceptions and I’ve run the application with the debugger. Good, the exception was in that DLL!

The coworker got her hands dirty into removing that DLL from the application and then everything worked fine; it’s now clear to us that the original developer had implemented a copy protection in the application and this copy protection included some code sequence that would prevent the application from running under a debugger. It’s not clear why he didn’t warn us upfront, but that’s business as usual – sometimes things work OOB, sometimes you have to dig a little.

Support blues …

One of our customers has a weird issue with the application. The support person asked for the application logs, but he was not quite explicit in his request:

“Could you please send the log files as shown below …”

And the customer answer was priceless: she didn’t send the actual log file, she sent back a picture with the content of the folder :-)

Harmful coding practice

A customer has reported a bug. Being one of those educated and smart customers we love, he sent us the repro steps and the input data.
When I first saw the bug report, I thought it will be really hard to repro it, but, to my surprise, I’ve been able to repro it from the first try.
Good, let’s move into debugging …
Everything works ok, until we’re returning a value in an Office ribbon callback method. That’s where PowerPoint raises an exception and stops calling other callbacks. I had to modify the code a little to make it debuggable (it has been written in fluent paradigm and there was no other way of finding out the culprit).
And … surprise: the callback returns 1500, which is probably too large for PowerPoint to handle and this is why the other callbacks are never called – PowerPoint stops processing this request and moves on to other requests.
Why would the callback return 1500, since it should have returned something below 30? Here’s where karma bit me: I’ve optimized some code to use internally some lists and return these lists. The code worked fine for years, until a rookie had to use my code.
My original code:

public static class AvailableDateFormatsManager

private static readonly List _formatsListA = …
private static readonly List _formatsListB = …

public static List GetAvlFormats( {criteria} ) …


Rookie’s code:
public List GetAllAvlDateFormats( …)
var list1 = AvailableDateFormatsManager.GetAvlFormats( criteriaA ); // returns _formatsListA
var list2 = AvailableDateFormatsManager.GetAvlFormats( criteriaB ); // returns _formatsListB
list1.AddRange( list2);
return list1;

All names are meaningless and stupid, all you have to do is to notice how I’ve broken the encapsulation by returning the actual private List object instead of returning an IEnumerable or a ReadOnlyCollection.