Programmer's Weblog

BHO.CVX Trojan

Friday, December 21, 2007

My friend got this on his computer. The most annoying thing for him was that his antivirus software would popup a warning message about this Trojan every now and then.

The BHO probably stands for Browser Helper Object; I could find it inside the Add-ons to IE, but deactivating it didn't help. Thankfully the antivirus was yelling which file the Trojan is in, it couldn't delete it because it was in use. Even in safe mode the file was locked.

I was able to delete it from command line after booting up the computer using windows install CD and choosing Recovery mode (or sth like that, I have German Windows :) ).

0 comments

Evil locale

Sunday, December 16, 2007

.NET is trying to protect developers from making simple mistakes while providing them with all sorts of non obvious problems completely for free.

The simple mistake is trying to mutate a struct returned by a property. Line 14 in the example code raises compile time error. This line is otherwise completely fine except that it doesn't make sense -- the Start property is returning a copy of the value type Point.

 1 struct Point {
 2     public int x;
 3     public int y;
 4 }
 5 class Line {
 6     Point start;
 7     Point end;
 8     public Point Start {get {return start;}}
 9     public Point End {get {return end;}}
10 }
11 public class Main {
12     public static void Main() {
13         Line l = new Line();
14         l.Start.x = 2
15     }
16 }

The example comes from here The page explains that in such a case IronPython will also fail (by design) with an error.

Now about the free errors. They are all sponsored by the evil locale. Parsing in .NET takes the operating system's locale into account. In Poland the floating point numbers are written using coma instead of a dot. So 2.3 is written as 2,3. Trying to parse your settings file containing floats on a computer with Polish locale will throw an exception if there are any dots in them.

But it is not just parsing. If you invoke ToUpper on a string it also takes locale into account. In Turkey they have dotted i and dotless ı. The letter i (the dotted one obviously) has upper case equivalent which has a dot above it (expressible in unicode). If you have good fonts you should be able to see it right here: İ.

One more thing, when dealing with DateTime think about Buddhist Era in Sri Lanka :).

Labels: ,

1 comments

Resolver One - Beta

Saturday, December 8, 2007

There are plenty of languages laying around. They are tools with advantages and disadvantages. Knowing them allows us to know which are best to the job at hand. Recently I reflected on which languages would I use for different tasks.

If I had an idea for a killer web site I would go with Ruby on Rails. I have done one app using it and was very happy with it.

If I were making a windows app, I would code against .NET. The language of choice for this task would be Nemerle. Nemerle is a functional language with powerful macros (don't confuse with C macros) targeted at .NET Framework.

What would I use to add some processing to a spreadsheet? Python would be my first choice :). Resolver One allows to script a spreadsheet with Python. The Beta has just been released [download].

Labels:

0 comments