Tomer Gabel's annoying spot on the 'net RSS 2.0
# Thursday, 16 June 2005
Slava, one of my colleagues, asked me to help him out on a strange issue: he's integrating an old 2D vector engine (written in C++/MFC) into a new .NET 1.1 WinForms application. The vector engine exposes an API through a native DLL export, along with a bunch of structures. The issue was with unmarshalling one of the native structures: everything seemed to be unmarshalling correctly except for the double values (we got things like 2.53e-250 - uuh, not likely).

Slava's already managed to consume the same DLL successfully from Delphi, and upon reviewing the two we couldn't find any difference. What we managed to miss at first was that the Delphi marshalled structure was declared with a {$a-} prefix, which means "ignore alignment" - otherwise Delphi might assume that the structure might be in some way memory-aligned.

Figuring that our .NET woes might be due to the same issue, a quick look around MSDN revealed to us that the StructLayoutAttribute(LayoutKind.Sequential) declaration also relied on the "pack" member of the same class, which "controls the alignment of data fields of a class or structure in memory." My logical conclusion as a programmer would be that creating a sequential structure would default to a straighforward memory representation - i.e. no alignment - but apparently it's misguided; .NET defaults to 8-byte alignment for managed structures. We set the alignment size to 4 and voila - problem solved.

This only goes to prove that even the simplest and subtlest of programming challenges can baffle even experienced developers, and both Slava and I wasted quite a bit of time on this issue. The moral? There isn't one, really; just expect to be baffled now and then no matter what you've seen or been through.

Thursday, 16 June 2005 09:04:19 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Wednesday, 15 June 2005
It took me ages to understand the fundamentals of internationalization, (man-) language interoperability etc. In fact, only after working on MFC software over a year I encountered a problem so fundamentally accute I couldn't for the life of me figure it out, and it took a bitchslap from my friend Ilya (Konstantinov) to make me halt and figure the problem out properly.

Internationalization is hard. Perhaps its hardest aspect is support for the various languages; each language has its own character set, and although most widely-used languages derive from the basic latin alphabet there are still subtle differences. German makes extensive use of accented characters (é and ü for example); Czech makes use of the relatively unknown caron (č) and that's just the tip of the iceberg. Imagine the thoroughly different requirements of Arabic and Hebrew: complex script languages that are not only written right-to-left, but employ a completely seperate alphabet with different requirements. For example, did you know there are two ways to write several letters in the Hebrew alphabet, depending on their location (middle or end of a word), but those versions of the same letter have the same semanthics? Or maybe you've run into the latin letter Eth (Ð), which to my knowledge only exists today in Icelandic?

Finally, to the point: if you've ever received an e-mail with question marks instead of words, entered a website in your native language but got gibberish instead or perhaps (for the more astute) wondered how it is possible to display text from so many different languages on one document (web site...), you're not alone. Most programmers are completely unaware of these fundamental issues, and cause massive headaches to users and fellow programmers alike. I've come across an article Joel Spolsky wrote back in 2003 with an absurdly long name; no matter: finally someone (certainly with more credability than myself) has taken it upon himself to write a thorough introduction to the subject for people - developers in particular, but the technically savvy among you might also be entertained - who do not realize its importance. Please, please please go and read it before you go on with your daily lives.

Wednesday, 15 June 2005 15:23:13 (Jerusalem Standard Time, UTC+02:00)  #    -
Development | Software
Eric Lippert has an incredibly interesting five-part blogpost about the mathematical essence of musical theory, along with some pretty nifty demonstrations. I've dabbled a little in the more practical applications of musical theory before (writing wave and module players and some basic software synths) but honestly have never been really interested in its mathematical/physical aspects.

This, ladies and gentleman, is interesting shit.

Wednesday, 15 June 2005 13:59:35 (Jerusalem Standard Time, UTC+02:00)  #    -
Music | Personal
I've been developing Exchange and Outlook-centric applications for the last 4 years or so, and now I can tell you that I have absolutely no nerve endings in my forehead as a result (try bashing your head against the table, keyboard or wall repeatedly for four or so years and you'll see what I mean).

Developing applications for Outlook is an impossibly frustrating task; from the lackluster documentation (MAPI documentation is scarce, not to mention obfuscated and outdated) to unexpected behaviour (Outlook COM API shutdown events never occur) to missing features in high-level APIs (CDO is missing a lot of functionality, and Extended MAPI can only be used from C++ code) to depracated critical features (the password parameter for CDO.Session.Login is ignored outright). All that if you readily ignore proper bugs (CDO session logoff taking between 30 and 180 seconds, instead of - say - 0.02), COM Threading Apartment issues (CDO can only be used from STA threads - say goodbye to convenient remoting or web services) and the ghastly Outlook Object Model guard which made creating an entirely new Extended MAPI wrapper necessary to write the simplest code even for secure enterprises. Are you getting my drift here?

I distinctly recall doing some Outlook add-in work for a guy on Rent A Coder; what was originally intended as an Outlook add-in template on which the guy can build his own code turned into a fully-fledged commercial application, because the buyer simply could not afford to learn Outlook/MAPI basics. The good news for me was that the years of suffering resulted in my becoming something of an Exchange/Outlook expert and that this kind of knowledge pays very well indeed; the bad news are that it's literally impossible to do an Outlook project without reducing your life expectancy considerably (all you cardiologists must be really damn pleased about that).

Anyways I just read that according to Eric Carter I must despair no more! Apparently the new VSTO (Visual Studio Tools for Office) 2005, currently in beta, includes a proper managed API for Outlook. Hurray! Huzzah! Finally Microsoft delivers something for Outlook/Exchange programmers that might not utterly suck. Break out the champagne, everyone - our torment is over!

NOT. Unfortunately the managed API for Exchange is nowhere in sight (mind you, I've been promised an alpha version by a Microsoft premier representative back in September 2003 or so), and Exchange/MAPI programming is still a major hassle (what with the Exchange OleDB provider not functioning under ADO.NET, CDO being STA-only requiring workarounds, WebDAV being slow and often times irrelevant if Custom Forms are used, TNEF specs few and far between etc.) All in all I'd still rather choke than write an Exchange-based service. Fortunately it still pays well enough for me to afford a guy sitting behind me constantly, ready to invoke the Heimlich maneuver at any given moment.

Wednesday, 15 June 2005 12:30:07 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Tuesday, 14 June 2005
A bunch of tidbits to get you through the day:
  1. Three words: what. the. fuck.
  2. Do you recall that classic picture of the back of a girl? I recall seeing that picture demonstrating the graphic prowess of generations of computers and video cards (from the earlier Macs, through a friend's 286/VGA machine and the first true color-capable PGA video card another friend used to own). Ilya sent me a link detailing the original story. Interesting, if you're a history buff like me.
  3. This (Hebrew only) news post only goes to show that stupidity knows no bounds.
  4. While not American, I find the very concept of a senate intelligence committee voting on expanding an already-problematic Patriot Act extremely disturbing. What really yanks my chain, though, was that the vote was held during a secret meeting, to which members of the press were barred entry. Does anyone else consider the very concept of legislation in secret anti-democratic in the extreme?
  5. I came across an amusing definition of a particular class of bugs, dubbed heisenbugs. I think I'll start using the term.
  6. Finally, it appears we have an Aibo here at work! The damn thing is really disturbing. Photos and experiences to come (as soon as I get my ass off the chair long enough).
Tuesday, 14 June 2005 16:55:30 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
One of the most useless, slow and annoying features in Visual Studio.NET (2003 included) is its crappy "dynamic help" feature. It cripples the IDE performance, adds horrendous I/O overhead, pops up on top of the property sheet constantly and is completely useless to boot.

Gladly Fabrice managed to Come up with a way to get rid of it completely! Good riddance to bad rubbish. (Note that the registry change should be made in HKCU and not HKLM)

Update: Alternatively, go ahead and download VSTweak. It does the above and other things as well.

Tuesday, 14 June 2005 09:40:09 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
So I haven't had a proper vacation in ages. Sure, I've had days off on occasion, went on trips on Saturdays etc., but not a vacation per se. The last time I spent any amount of time doing nothing specific was about a year and a half ago when I went with my family to Eilat (the southernmost city in Israel, and its most [only?] popular tourist attraction).

A very good friend of mine went to live in Eilat a few months ago, so I figured since I haven't seen him for a while it might be a chance to make good use of a few days off (weekend combined with the Shavu'ot holiday). So midnight on Thursday I took a bus from my home town of Haifa to Eilat. I'll take this opportunity to extend a hand of friendship and understanding to the poor buggers who live in countries where several hours-long bus rides are a fact of life; busses suck. It's the most uncomfortable thing in the universe. I spent two 5.5 hour trips trying to find "the position" which would actually allow me to sleep a bit and failed miserably, the direct result of which is my coming to work today tired and quite off, not to mention cramped muscles, knees and back. Yech.

That said, Eilat kicks much ass. First off, coming to Eilat in your own vehicle is idiotic: to begin with parking is difficult (particularly around the city center, promenade and major attractions), the roads are quite packed and there's a constant stream of pedestrians crossing the street everywhere at all hours. Add to that the amazing availability of low-cost (particularly compared to the Tel-Aviv area) taxis that literally materialize out of thin air the second you raise your hand, where the cabbies are knowledgable and even courteous (in Israel, no less!). All that combined with the fact that everything is a short walking distance away (the entire city center, promenade included, can be crossed in a comfortable one-hour stroll) mean that it's cheaper, more efficient and certainly healthier and more enjoyable to just stroll around the city. The climate was difficult to get used to at first: the temperatures are considerably higher in Eilat than in my native Haifa bay area (37C vs 27C by day), however moisture is considerably lower - 20% vs 65%. The direct result is that it's generally quite a bit hotter but far easier to breath, and it's much more convenient to move around by foot: I'm now back north and a short walk from the bus to work got my all sticky, whereas in Eilat I would walk the 2km from my friend's house to the promenade and not feel the worse for wear.

Eilat is either a shopping heaven or a shopping nightmare, depending on what you're looking for and how hard you're willing to look. Being a free trade zone the prices in Eilat are VAT free - Israeli VAT is currently at 17% - the direct result of which is that certain commodities (CDs, cameras and books for example) are considerably cheaper, whereas simpler things are ridiculously expensive (like a can of coke). The promenade offers an insane variety of tidbits mostly aimed at tourists, but there's still pretty cool stuff to be found: I finally tried on a sharwal (also known as "fisherman's pants") and actually liked it in the extreme - I'm starting to understand the Japanese and the scots, even though the lack of pockets can be an encumbrance. Even the local shopping mall has its moments: every time I'm in Eilat I find myself spending $100-$200 on CDs; the local CD shop (Disc Club) is VAT free and cheap to begin with.

The beaches in Eilat are terrific. I've only been out of Israel once so I wouldn't know how they compare, but the beaches are clean, the water is cold and transparent and you get to swim alongside a huge diversity of wildlife. If you're into diving I probably don't have to tell you about the possibilities as the city's pretty famous for its diving attractions. There are various tourist attractions (desert trips on jeeps and camels, etc.) and it's also pretty relaxing just strolling all over the place on foot.

Being used to some pretty high quality pubs back north I was slightly disappointed with what Eilat had to offer in this area as it was particularly hard to find reasonable beer. I've found a couple places that sold Leffe Blond and Weinstephan (and the mandatory Guiness, Carlsberg, Heineken and local Goldstar that I personally dislike), but that's pretty much it. The pubs themselves however are pretty good - at least the ones I've been to (DeBar was absolutely terrific, thumbs up David!) Lastly, food-wise there are some really great places to eat in Eilat, my personally favourite being Casa Do Brasil: an absolutely terrific all-you-can-eat south-American grille. I make it a point to go there and crunch my body weight's worth in meat whenever I'm in Eilat, and this time was no different (with one exception: apparently they make the best beef fillet I've had yet in Israel). Basically everywhere you look there's great food in abundance, just take your pick and ask around for recommendations.

Tuesday, 14 June 2005 08:31:24 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
# Wednesday, 08 June 2005
I tried to help a colleague analyze an issue with an ASP.NET 1.1 application. The application was installed and worked properly on both an on-site server and a local mirror, in both cases under Windows 2000 Server with Windows 2000 SP3. The on-site administrator installed SP4 on the server, after which the application promptly stopped working properly: it didn't crash, it didn't register any errors what-so-ever and it didn't even time out, the client (in our case Internet Explorer) simply remained waiting for a response from the web server. My colleague attempted to install SP4 on the local server with the exact same result.

Oddly enough switching the application to ASP.NET 1.0 resolved the issue (but obviously is not an acceptable solution), so we tried re-registering ASP.NET 1.1 with aspnet_regiis.exe -i which had no effect. Obviously server restarts and iisreset had absolutely no effect either.

Eventually through trial and error we devised the following solution:

  • Remove the .NET framework 1.0 and its service packs (so that only 1.1 remains)
  • Reinstall .NET 1.0
  • Make sure to have a cup of coffee next to the machine at this stage (very important!)
  • Switch the application to 1.0
  • Test the application
  • Get another cup of coffee, make sure it's between 20cm and 1m from the development machine
  • Switch the application back to 1.1
  • Test again

This seems to have consistently resolved the issue with both local and on-site servers, but is obvious not a stable (nor acceptable) solution. It is also very non-scientific, because we haven't measured the volume of coffee in the mugs (mind you, neither was mine - I hardly ever drink coffee).

In short it's goddamn voodoo. I'm used to that kind of crap from Windows, but programming .NET has been impressively voodoo-free so far. I couldn't find anything similar with Google searches; has anyone ever seen (even better, solved) this issue before?

Wednesday, 08 June 2005 20:24:17 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Tuesday, 07 June 2005
I thought I wouldn't bother with the third Star Wars movie. I really did. Well no, not really; it took me exactly five minutes to snap out of it and stop lying to myself: I was going to watch the movie in the theater even though I knew it's going to suck, much like Matrix Revolutions or Terminator 3. I can't help myself. It retrospect it amuses me that I'm willing to spend money on a purely mainstream product I know there's no chance I'll enjoy, but then - it's Star Wars, if I didn't go I'd feel left out...

Anyway, bottom line - I did go and did see it in the theaters. And it did not suck. Not even remotely as much as I feared it would. Now admittedly I've read the various "it doesn't suck" quotes on the 'net, but being my usual sceptic self I had to see for myself. I wouldn't call it terrific, though; it has two major problems without which it would probably have been the best in the series: crappy dialogues that seem to have been written by a 6-year old (particularly the various Padme vs Anakin scenes), and Hayden Christensen. Not even Ewan McGregor, whom I hold in very high regard since Big Fish, was able to keep me from noticing how poorly the dialogue is written, and not even the really terrific action scenes and utterly astounding visuals could keep the grimace off my face whenever Anakin came on-screen. Add to that an anti-climaxic Darth Vader experience and what you have is a pretty decent movie that could've been the biggest thing since, well, Lord of the Rings. A crying shame.

I had a completely opposite experience with The Hitchhiker's Guide to the Galaxy: I was never a big fan of the series (yes, I read all of them) and had very low expectations. When the trailer came out I was plesently surprised to find that I thoroughly enjoyed it and laughed quite a bit, so it was with mixed feelings that I went to see it in the theater. Suffice to say that when the lights came on for the half-time break I was quite surprised: 45 minutes had gone by, and I didn't even notice. This movie is funny as hell! It's well-written, well-acted and even well-designed (visually); there are a lot of subtle jokes (as opposed to the incoherent in-jokes I originally expected) and this just made everything even better. I'm also very happy that the authors of this movie didn't give in to the fanboys, which means the authors did have some artistic license - I actually prefer the movie to the book this way. So in summary: this movie rocks. Watch it.

I had reasonably high expectations for Sin City: I like dark films and the trailer seemed very nifty. I had no idea what the movie was about though (never read the comic, nor could be bothered with previews) so I had no idea what I was getting into when I went to watch it. All in all I dub this film "high quality garbage." The production values are as high as it gets, but it doesn't stop the movie from being generic comic-based film-noir. The plot lines are overly simplistic and what the movie lacks in story-line it makes up for in insane amounts of gratuituous violence. When I made this argument a friend of mine challenged it, saying that I enjoyed Kill Bill immensely despite the level of violence which was at least as high; now don't get me wrong - I'm not squeamish and enjoy a good violence scene at least as much as the next guy, but the difference is that where violence in Kill Bill is intentionally portrayed as ludicrous and works to advance a simplistic plot (not to mention homage to '70s Hong Kong action flics), the violence in Sin City is not portrayed as ludicrous at all and works mostly to take the place of a nonexistant plot. It may work in the context of a comic, but I've never been a comic fan, so for me it merely detracts from a quality production. That said, the acting is top notch and the graphic design is absolutely beautiful, but as a whole Sin City is one movie I'm probably not going to watch again.

Finally I have a recommendation to make: grab Oldboy from the nearest Blockbuster and watch it. It's a Korean movie and I'm not sure how to best define it, but it's combination violent, disturbing and thought-provoking, with incredible acting, visual design and music to boot. Heartily recommended. Also, if you get the time, check out Kung Fu Hustle - I think it's in the theaters (in Israel) right now, or will be soon.

Tuesday, 07 June 2005 17:57:18 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal | Movies
Tidbit time:
  • Raymond has an über-interesting post on the potential security issues with C's strncpy, including an interesting bit of history.
  • Senthil Kumar's found out an interesting detail regarding the equality (==) operator in .NET System.String.
  • GAIM joins in on Google's Summer of Code project. I just wish I were a student living in the States with enough free time...
  • Remember the old Amiga game Cannon Fodder? Well I found this promitional (?) video for the CD-32 version of Cannon Fodder - so funny it's disturbing.
  • A pretty interesting post at The Register claims Microsoft's Windows 2000 operating system was a complete flop as far as security's concerned, but it marked an interesting shift in the company (and therefore the industry).
  • I don't find myself completely disagreeing with Roy Osherove that often, but his his take on The Grudge is completely opposite my own: the movie was not scary at all, for the most part very poorly acted and I came out of the theater feeling as though I've just wasted 37 NIS (the price for a preordered movie ticket in Israel, approximately $9 US - way too high anyway) and two hours of my life. On the other hand, I've found White Noise quite appealing; it didn't scare me proper (only System Shock 2's managed to do that in recent memory), but it did leave me unsettled, which is also pretty unusual. Probably the only good horror/thriller I've seen in ages is 2002's The Ring. I openly admit to not having seen the original Japanese version, nor have I seen the supposedly great The Sixth Sense. Working on it.
Tuesday, 07 June 2005 17:00:40 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
Me!
Send mail to the author(s) Be afraid.
Archive
<2005 June>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
All Content © 2024, Tomer Gabel
Based on the Business theme for dasBlog created by Christoph De Baene (delarou)