Tomer Gabel's annoying spot on the 'net RSS 2.0
# Thursday, 15 September 2005
I've been doing some reading on the Chernobyl nuclear disaster. The reading turned out to be a genuinely frightening experience. A series of small but unfortunate errors resulted in hundreds of thousands of people evacuated from their homes and irradiated large sections of the world...

I got a similar sensation of dread by reading the Fallout manual, which starts with a perfectly dry and scientific description of the effects of a particular type of nuclear bombing. The game comes highly recommended, by the way.

Something a friend of mine said when we were discussing it over lunch yesterday triggered a memory from Jeff Wayne's War of the Worlds, to quote (this was more difficult to find than you might think):

It seems totally incredible to me now that everyone spent that evening as though it were just like any other. From the railway station came the sound of shunting trains, ringing and rumbling, softened almost into melody by the distance. It all seemed so safe and tranquil.

Thursday, 15 September 2005 13:29:35 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
I haven't had that much time on my hands lately to do any proper writing (what with a full-time job, four martial arts classes a week, making arrangements for a trip abroad and a LAN party, looking for an apartment and car and being to several family occassions), which is why content has been a little drab lately. So I'll start today's tidbits with a request: if you have an interesting programming dilemma, issue, question etc. don't hesitate to contact me - I'm most prolific when challenged with an uncommon problem.

That said, lets get to the goods:

  • I was researching an issue we had in the current project (specifically, finding out which physical monitor was connected to which video controller), and at first turned to WMI which is usually good enough to give you such answers. Although I have some WMI experience under my belt I was looking for a tool to aid me in developing WMI applications - a WMI "explorer" if you will - and after a little Googling about stumbled onto a very useful tool written by French programmer Coq. The tool, aptly named "WMI explorer", is an open source Windows Forms application which allows you to query the WMI schema as well as object instances, and also generate C# classes for WMI classes. I've found it immensely valuable; go ahead and download it, just be warned - it's currently in French. I'm contacting the author to ask his permission to translate and distribute this thing (I'm not sure under which license it is distributed because, well, I can't read French!)
  • I'm really very excited about HDR (High Dynamic Range rendering/imaging), and my excitement only grew after seeing the screenshots from Half Life 2: Lost Coast. Check out the screenshots in the article - they're simply staggering! The overexposed building on the third page is precisely the kind of thing you simply cannot do faithfully with bloom and which changes the entire gameplay; this means that when attempting to attack the castle from below you are partially blinded and at a massive disadvantage. And it looks absolutely stunning to boot - check out the curch on the fourth page!
  • Amiga demo afictionados should check out the video for Control by Oxygene - extremely impressive visuals on a (in my understanding) vanilla A4000, along with a superb soundtrack by Clawz.
  • Microsoft's specs for C# 3.0 are out, and it looks like the C# guys went haywire. I'll be digging more into that for comments. In the meantime you can check out this discussion (via Aynde Rahein)
  • Go check out Indigo Prophecy. I'm very, very, very much looking forward to it (and Tycho at Penny Arcade seems to concur).
I'm hosting a LAN party this weekend, so hopefully I'll have some interesting experiences and/or pictures to share by Sunday. On Sunday itself I'm going for my first trip out of Israel in 8 years (the last, and technically first, one was to London for a week when I was 14). I'm going to Turkey for a week of treks, jeeps, rafting and of course some classic R&R (the trip's programme for Hebrew speakers can be found here). Hopefully it'll be a great trip - pictures and experiences when I get back.
Thursday, 15 September 2005 12:13:47 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
# Wednesday, 07 September 2005
Lots of generic crap for today. Without further ado:
  • What in the bleeding hell. I have to admit that this whole "code/hacker-caffeine" trend is starting to get on my nerves. After years and years of caffeine addiction (I could probably have won the world record for most coke drank in a day) a couple of years ago I decided to let go of it - almost completely. I now enjoy the occasional coke and, if I'm genuinely tired and need a pick-me-up, a coffee always helps. Back in the day I could've drowned a triple espresso without any effect. Bottom line, it never ceases to amaze me how dependant people allow themselves to become.
  • Joku posted a worthy comment on Mike Stall's blog:
    Not really related, but it would be good if technical bloggers writing about X,Y & Z would also mention what is the closest public release they are using. Now if you go google and find some older blog entry it maybe the stuff being talked about was in relation to for example VS Beta 1 and might be completely wrong today. I don't think everyone who come to blogs.msdn from google will figure out that many of the blog entries that talk about say VS2005 are actually talking about something that's specific to non-RTM build. If there were tags for every public build and they were visible and easy to put on the blog entry... Well some day perhaps.
    It is a valid point, and I shall endeavour to do that from now on.
  • RMS never ceases to amaze me in how he takes theories (conspiratorial, political or otherwise) and treats them like facts. "Israel's real nuclear weapons", says he. It is commonly accepted that Israel does have a nuclear arsenal, but no-one knows for sure, myself included. Admittedly RMS's never purported to be unbiased or politically-correct, but it bothers me never-the-less.
  • Fellow Israeli developer-blogger Oren Ellenbogen mentioned a few weeks ago a subtlety in the usage of interfaces in C# I was not aware of. I've since used explicit interface declarations with great success, however one caveat is that you can't use the interface members even from a private scope (i.e. from a member method within the class implementing the interface). So use this feature with caution - it can reduce messiness (particularly where intellisense is concerned), but often at the cost of forcing you to add lots of unnecessary casts.
  • Software patents are taking an increasingly alarming foothold in common business practice. Litigation has always been part of business, but when Creative sues Apple for patent infringement over the iPod's navigation interface, to me it means things have gotten completely out of hand. Face it, people: one-click shopping, song navigation in menus etc. should not be patentable. It's ridiculous, any UI-designer with more than 3 IQ could've come up with that concept. Yes, Creative went to market first, but that is completely irrelevant; just imagine if someone patented the "ability to close a user interface component by clicking a button" - none of us would be able to close windows. Does that make sense to you?
  • This little hard-drive hack is really damn cool.
  • The Blizzard vs BnetD case is worrisome to say the least. I'm not versed in the particulars of the case, but assuming the BnetD programers did not actually reverse-engineer Blizzard proprietary code they should not have had a case. I wonder how this case compares to the Microsoft vs Samba litigation - I reckon I should do some further reading.
  • I've been playing with Total Commander for several days now. Originally I couldn't stand the software, but admittedly it gives Servant Salamander a serious run for its money, and has quite a few features SS does not.
  • I promised Oran (one of my colleagues) that if he found an IBM Model M keyboard for me I would try it out for a week. He managed to find one and I've spend a couple of hours on Sunday cleaning it up, and have been using it since. It's a very nice keyboard; the buckling spring key design has terrific tactile response and typing on it feels great. There are several things I do not like about it, though: for one, it's missing the Windows keys which I've grown accustomed to using (Left Windows key + D or L two dozen times a day...); the right shift occasionally gets stuck; finally, it's a little big for my hands so certain keypresses are far less convenient than they were with the trusty Microsoft Natural Elite. It doesn't seem that the new keyboard has improved my errors/character rate any, but it is a little early to tell. That said, it's amazing that a keyboard manufactured in 1991 can favorably compare to a modern, ergonomic keyboard. My model is a 1391408, in case you were wondering. All in all, I still miss the old Microsoft Natural classic (I've used one from 1996 to about 2001 when it crashed on the floor one too many times. It's still working, by the way, just missing some keys.)
  • I came home from a pub last night and made the mistake of turning on the TV. Twelve Kingdoms episodes 14 and 15 were on. No sleep for me tonight. Do yourself a favour and watch that show; I own it in its entirety on DVD and it was some of the finest money I've ever spent. Other anime favorites include Trigun, Full Metal Alchemist and Cowboy Bebop. If you're curious about anime, NGE might be a good primer, although I have my gripes with it.
  • Finally, I've made a list of all my DVD movies on IMDB, but unfortunately there is no way to link to it externally. I'll find some other catalogue, or write one on my own.
Wednesday, 07 September 2005 15:07:48 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
I was writing a relatively small GUI application (more on that later) and was looking for an easy way to add wizards to the application. A quick Google search brought me several options, but eventually I settled for Al Gardner's excellent "Designer centric Wizard control" on The Code Project; it is combination useful, solid and open-source. I highly recommend it, however I did find two caveats:

For starters, this isn't actually the wizard designer's fault, rather Visual Studio's. I designed a moderately complex, 5-step wizard. The way the wizard designer works, all controls on all pages are thrown into the same class file. Since this is parsed and modified by the designer itself this wouldn't be an issue, however the wizard was also localizable. This meant that whenever I saved the wizard or moved from code view to design view and vice versa, the machine would chug for several seconds on regenerating the code. Add to that the usually-tolerable ReSharper parsing phase (I use build 165) and you've got 10-second stalls every couple of minutes, which makes development extremely tedious.

The other issue is that the Cancel event does not work as planned, and I can't figure out way. I added my own handler to the cancellation event with an "are you sure"-type messagebox, but whenever I answered no the wizard would still close. I tracked this down to the cancellation button on the wizard (btnCancel) having its DialogResult property set to DialogResult.Cancel (since I'm running the form instance with ShowDialog this would cause the form to close), however nothing in the application has ever set it to that value. Worse still, when I added the line:

this.btnCancel.DialogResult = DialogResult.None;

To the InitializeComponent method on Wizard, a breakpoint on the cancellation event handler would show that Wizard.btnCancel_Click:

this.FindForm().DialogResult = DialogResult.None;

I tried contacting Al to let him know about this issue, but there is no obvious way to get contact info from The Code Project. Any ideas?

Wednesday, 07 September 2005 11:01:28 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Tuesday, 30 August 2005
So here I am, banging my head against the table repeatedly (quite literally, feel free to ask my colleagues) because of a bug so idiotic I can't even begin to describe it.

I wasted 20 minutes tracking down a bug just to find what Rik Hemsley says best:

?productlistview.Items(0).Selected
True
?productlistview.SelectedItems.Count
0

Hmm?

Apparently, though no-one will tell you this, the selection could fail if you don't have the focus. Make sure you add a call to lstWhatever.Focus() before you mess with selections.

Tuesday, 30 August 2005 17:29:32 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Monday, 29 August 2005

Eli Ofek has published a 5-part (well, 4-part really) series about migrating an actual project from the classic triad of VS2003/.NET 1.1/VSS to VS2005/.NET 2.0/Team Foundation Server. I used to be a developer on the "sister team" of the project he's talking about, and I can tell you that it's a huge project with an extremely talented and devoted team of developers, so if you're going to be doing any migration work in the nearby future I highly recommend you go ahead and do some serious reading on his blog. The bottom line is that Beta 2 servers aren't stable enough, nor the IDE performant enough, to do any proper work on. The little experience I had with the VS2005 was that it was actually very good and the performance just fine (on my 1.7GHz Dothan laptop w/1GB memory), but I can't argue with server stability issues.

Regardless, I particularly recommend reading phase 3, which discusses critical language/library differences.

Monday, 29 August 2005 09:38:14 (Jerusalem Standard Time, UTC+02:00)  #    -
Development

I've updated the article about events and .NET remoting with some source code. Let me know if you find it useful. That said, I haven't been active on the 'net for the last few days so I have quite a bit of catching up to do.

Monday, 29 August 2005 08:47:36 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Tuesday, 23 August 2005
A colleague was writing a bit of image processing code in C# while working under the assumption that a bitwise shift operation by a negative count (i.e. lvalue >> -2) would result in the opposite shift (lvalue << 2 in our example). Nevermind the logic behind that assumption, while helping doing some research I've stumbled upon what might be a portability issue in the C# language design.

Apprently C# defines the left/right-shift operators as, for example:

int operator >> ( int x, int count );

It goes on to specify the behavioural differences between 32-bit and 64-bit code but gives no indication of what happens if you shift by a negative value (which is possible given that count is of type int); this is left undefined. This leaves certain behavioural aspects of applications up to the VM; what probably happens is (for Intel processors anyway) that the JIT compiler generates something which looks like:

mov ecx,[count]
and ecx,0x1f
shl [eval],ecx    ; or sal, if x is uint...

If count is negative, this will result in a mask of the two's complement, so for -2 this would be 11110 - or a shift-left by 30. I'm not sure what prompted Tal to make the assumption regarding negative shifts, but the fact of the matter is that his code compiled without warning. If the default operators were declared with uint count, at the very least we'd get a "possible signed-unsigned mismatch" compiler warning. Most people would slap themselves and correct their erroneous code.

I couldn't find any reference of this with a Google search and would be more than interested in hearing corrections, explanations or just opinions...

Update (September 7th, 10:16): As per Eli Ofek's advice I started a discussion thread on the MSDN forums which already proved useful. A guy calling himself TAG suggested that the reason why the operators are defined with signed shift count is that unsigned types are not CLS- (common language specification-) compliant. This could very well be the case, however I am adamant that the language specification should reflect this; also, the fact that the CLS does not support unsigned types is nontrivial (and not easily found), which could potentially mean a lot of projects, open source and commercial, are in fact nonportable because they make use of unsigned types.

Tuesday, 23 August 2005 16:11:56 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Sunday, 21 August 2005
The game reviews I promised are still in the pipeline (it takes a lot of effort to get myself in the "reviewer state"), but I did post other stuff instead (mostly software- and development-related). Now it's time for tidbits:
  • I've been sorely lacking a "navigation" submenu in Microsoft Word. I use a lot of internal hyperlinks in my documents (and have been reading and writing quite a few of those for the past few weeks), and it's a pain in the ass not to be able to navigate back and forth. Apparently it's just hidden in the Web toolbar and is readily accessible using Alt+Left and Alt+Right keyboard shortcuts. Oddly enough the keyboard customization dialog shows a GoBack function as well as the WebGoBack-WebGoForward duo; I'm not entirely clear on the difference yet. Anyways it's amazing how much better life is all of a sudden.
  • There are numerous updates to the ReSharper 2.0 beta post.
  • Thanks to Ofer for introducing me to the kickass bugmenot.com. It's basically a user-contributed database of registration information for any and all websites (there's even an entry for Nectarine!) which should prove amazingly useful, particularly when complemented by services like DodgeIt. They also have a petition asking content providers to stop with the pointless mandatory registration procedures. Not sure if I'll sign or not, but the site itself is damn useful.
  • DevBoi seems to be a very useful development tool: it is a sidebar extension for Mozilla browsers offering easy access to online/offline documentation repositories for standards such as HTML, CSS and more.
  • Apparently them christian preachers weren't kidding around: pr0n can indeed make you blind. Consider yourself, er, warned.

Light load this time. More to come.

Sunday, 21 August 2005 17:38:01 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
I always enjoy researching languages (a passion that's only intensified since I cowrote our internal C#->java source-level compiler), so when a colleague approached me with an issue he had while creating a design in C# I was immediately intrigued.

Consider the following scenario:

class a1
{
public virtual int ret()
{
return 1;
}
}

class a2 : a1
{
public override int ret()
{
return 2;
}
}

Now, suppose I want to create another class, a3, which overrides ret but instead of implementing it on its own, it calls the a1 implementation - effectively skipping two generations of inheritence. If I wanted to call a2's implementation I could write a simple base.ret() call, so for a1 it's a simple case of base.base.ret(), right?

Quite wrong. Apparently the C# language specification defines the base keyword in a way that simply does not allow this. I was curious of this is the case with java as well, and lo and behold: java doesn't support super.super.member constructs either.

While researching the issue, I've come across two particularly interesting notes: Mads Torgersen, the new Microsoft program manager on C# Compiler and Language, has this to say in an interview:

Q: why only the first immediate base class is allowed in c#? e.g. cant do base.base.ToString()
A: The behaviour of your base class is determined by the writer of that class. It would open up a hole for breach of contract if you could bypass this and access something that this writer has decided to hide from you.

I'm not sure I'm convinced by this; it assumes the person who writes the instance class is not the same person who wrote the base class, which is not always the case. Other people around the 'net have said that this is a sort of "OOP no-no"; I can't say I've ever thought about this particular issue very deeply so I'll have to do some more thinking. If anyone has any references (no books, please - they're expensive and difficult to get) I would be very interested in hearing about it.

Brian Maso, posting to a similar discussion regarding java, suggests that this limitation derives from the java virtual machine design:

"super" is not an object reference. It's a Java language fiction. It basically indicates to the compiler that the target method call uses the "invokespecial" bytecode, not the usual method invocation bytecode "invokevirtual". This is as opposed to "this", which is an actual object reference variable.

If that is indeed the case, I can imagine the CLR shares similar design limitations, however this is research I'll leave for another time. For the time being suffice to say that the only way to do this is to use reflection, which is a sloppy solution which hinders performance, readability and safety. Imagine accessing runtime information, creating class instances (generating additional work for the GC in the process) etc. instead of a simple vtable indirection - it's not even funny!

Sunday, 21 August 2005 14:05:41 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
Me!
Send mail to the author(s) Be afraid.
Archive
<2005 September>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
All Content © 2017, Tomer Gabel
Based on the Business theme for dasBlog created by Christoph De Baene (delarou)