Wednesday 31 October 2007

Ignorance

For the past 3 years or so, I have been ignorant of something that I can do in C#. That is, use the a ?? b operator. This doesn't exist in C++ or C, but it is nice if you don't know about it. What is return a if it is not null, otherwise it returns b. Therefore, what was previously

return var == null ? default : var;

can now be written as

return var ?? default;

Which is nice and small. They both could also be written as

if(var == null) return default; return var;

or more verbosely as

if(var == null) {
  return default;
}
return var;

Of course, I should have discovered this 3 years ago, but I didn't, oops. Never mind, that's why, I suppose I should look at open source code, because then I would see things I didn't know about and be forced to learn them, instead of just stumbling across them. Well, I'd still be stumbling across them, just a lot faster than I am now.

Tuesday 30 October 2007

Antivirus, VS2008

Today I have just installed Visual Studio 2008 v9 Beta 2. The first two times I tried installing it it didn't work. Then I realised it was probably not installing because of the new antivirus product I had just switched to, called Comodo Antivirus, so aptly named because it was made by Comodo. Anyway, I just temporarily disabled the "On Access Scanner", and the "HIPS Application Control" and then it installed fine.

I haven't yet played around much with VS8, having just installed it, but I have had a bit of a look at the Comodo antivirus product, and it looks very nice. The user interface for the most part is quite pretty, except for a few things that go away after an initial safe-list making scan. It also asks me if I should allow a programme to run, every time I start one, so it's quite paranoid, which is good. An antivirus product should be paranoid, and so should all computer users.

Anyway, there is a cute software project I made a while back, a few years now, but due to backup incompetence I have lost the original source (as well as the compiled examples). Never mind, I will be making it soon enough. Basically it is a hierarchical view control that behaves like a treeview control, and looks like a family tree. Anyway, the original implementation I made was quite neat. There was also I nice side tab control I made once, which has also disappeared of the face of the Earth.

Thinking down that path, there is also a little photography programme I made, which basically loads in a list of students from a school database, and then divides everything into classes, and allows the names to be added into a caption underneath it. The names are dynamic, and the list of students could be printed as barcodes and scanned in. This is useful, because it means for the most part that the students names are spelt properly (as long as they are in the school database). But now I have to make that again as well. Never mind.