Tomer Gabel's annoying spot on the 'net RSS 2.0
# Saturday, 13 August 2005
Scott's released dasBlog 1.8! I don't have time to install it just yet - will probably save that for tomorrow. Since all the bugs I filed were fixed the new version is bound to be da bomb!

Update (August 15th, 11:32 GMT+2): dasBlog 1.8 is up and running. Oddly enough it seems to be compiled, or at least set up, to run in debug mode (web.config is set to <complication debug="true"... />), so I changed that. Everything seems to be in order.

The new BlogXP theme is very slick, but it's going to take quite a bit of time to rework it to fit the site design (get rid of the calendar, change the title, add a bit of personality...), so I'll stick with my modified DiscreetBlue in the meantime.

Saturday, 13 August 2005 20:22:37 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal | Software
I went to see The Island in the cinema with a bunch of friends the other day. Hey, it didn't cost me anything so why not, right?

It's sort of 1984 (at least in the beginning) meets The Matrix (towards the middle). There are plenty of very high-profile actors who do a pretty good job with the mediocre script (including Ewan McGreggor, Scarlet Johansson, Sean Bean, Steve Buscemi and Michael Clarke Duncan) - there's even a guest role for our own Noa Tishby.

Bottom line: harmless generic action movie; ten years ago it might've been considered innovative but nowadays it's just a cash cow. The acting is, as I said, pretty good (considering the amount of star actors), the eye candy is great - but the movie itself is really uninspired.

Saturday, 13 August 2005 18:17:35 (Jerusalem Standard Time, UTC+02:00)  #    -
Movies
.NET Remoting is a pretty nice piece of technology. It theoretically allows you to tear out a class from the server code and use it remotely from a client; it features all sorts of nice features like SAO and CAO, lifetime leasing and sponsors, pluggable protocols and provider chains etc. But in order to effectively use it there are quite a few things the programmer should take into account: the obvious ones (serialization, object lifetime, state) and the less-obvious ones (object construction [for CAOs], security [e.g. typeLevelFilter]).

Today I'd like to discuss one these less-obvious issues, specifically the usage of events in remotable classes. For clarity, lets assume the following scenario: a Server has a singleton SAO factory for client registration. The CAO class is called IProvider. Suppose it has the following structure:

public delegate void ServerEventHandler( string message );

public interface IProvider
{
void ClientMessage( string message );
event ServerEventHandler OnServerMessage;
}

And suppose the client were to register itself to the event like so:

p.OnServerMessage += new ServerEventHandler( p_OnServerMessage );

What happens behind the scene is a little less trivial. Delegates themselves are value types which hold a reference to their target. So in other words, we are sending the server an object which holds a reference to our client class, in itself a MarshalByRefObject derivative. What happens when an object is marshalled by reference? Answer: a proxy is created on the remote machine. What happens, in effect, is that the server is trying to create a proxy of the client object, which requires the assembly containing the client object's type. A naïve implementation like the one above would result in the following error (click for a larger image):

The solution is something of a hack I originally found in this article; the general idea is that for every delegate defined in your shared interface you create a shim object. This object acts as an intermediary between the client and server, passing events from one side to the other; the shim itself is defined in the shared assembly, which means it is always recognized by both client and server. This way the server does not need to recognize the client object type:

The actual shim implementation is ugly but trivial. Here's one example of how to do this for the ServerEventHandler delegate:

public class ServerEventShim : MarshalByRefObject
{
ServerEventHandler target;

private ServerEventShim()
{
}

public void DoInvoke( string message )
{
target( message );
}

public static ServerEventHandler Wrap( ServerEventHandler handler )
{
ServerEventShim shim = new ServerEventShim();
shim.target = handler;
return new ServerEventHandler( shim.DoInvoke );
}
}

Now all that's left is to slightly modify the way the client registers itself for the event:

p.OnServerMessage += ServerEventShim.Wrap( new ServerEventHandler( p_OnServerMessage ) );

Be advised: the client is now effectively also a .NET Remoting server, which means you have to register a channel for it (you should use 0 for port; this instructs Remoting to use whatever available incoming port.) You are also serializing custom types here, which means you must also set typeLevelFilter=true for this incoming channel.

Finally, to be honest I'm a little astonished that the .NET Remoting team didn't realize this shortcoming and found a more reasonable way to do this (anonymous, automatically generated shim classes? Why not - there are anonymous, automatically generated proxy classes...) Oh well, another few hours down the drain.

Update (August 29th 09:45 GMT+2): As per the request of Peter Gallati, here's some source code demonstrating the technique. Feel free to drop me a line if you need any further help.

Saturday, 13 August 2005 14:14:54 (Jerusalem Standard Time, UTC+02:00)  #    -
Development
I just installed The Gimp 2.2.8 on my laptop. Somehow when I used it on other machines I managaed to miss the fact that it's partially migrated to Hebrew, and that this mode is enabled by default on machines with their regional options set up accordingly.

Now, I can't stand Hebrew in applications so I generally always set localizable applications to English (including GAIM and even Windows itself); getting Hebrew menus is bad enough, but when they're only partially translated and the dialogs aren't RTL'd to begin with it looks absolutely terrible.

If you try to run The Gimp on a Hebrew-enabled machine I seriously suggest you set LANG=en in your environment settings.

Saturday, 13 August 2005 13:22:12 (Jerusalem Standard Time, UTC+02:00)  #    -
Software
# Thursday, 11 August 2005

I've converted. Three of what I considered the most useless Windows features have one me over. Specifically: large font sizes, large icons and ClearType.

Now let me make myself clear: for the vast majority of people on the vast majority of equipment, these features are indeed absolutely useless. Six months ago I bought an LG LM50 laptop (which is absolutely terrific, by the way) with an 1400x1050 SXGA+ display. I was stunned by the resolution, particularly the desktop real-estate and sharpness the new display provided, and never felt that the default font sizes were too small: they were certainly smaller, but the display was sharper and when typing on the laptop I was sitting much closer to the display than I was used to. Then I figured what the hell, I'll give it a try, enabled the three features and was absolutely stunned: I had (at worst) the same desktop real-estate I did on the old CRTs with much clearer fonts and icons. The whole experience is that much easier on the eyes, and I still get the added bonus of extra desktop real-estate (particularly when browsing) and much better resolution when displaying images etc.

I'm never moving back to CRTs!

Thursday, 11 August 2005 20:19:21 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
I had started to write an article about event shimming in .NET Remoting (yes, I know there are such articles already, but I couldn't find one that was easily accessible and understood) yesterday, but simply crashed and slept over 9 hours. Now I'm at work, so I guess it'll just have to wait until later today or tomorrow. That said, there's the usual variety of things of interest:
  • GuestMaps are a really awesome third party tool based on Google Maps; the idea is that you basically put a map on your site and it allows your readers to mark where in the world they are. I would've put one myself, but I'd rather save myself the embarresment of finding out how many readers I have :-)
  • China's on the news again, this time for putting a young man behind bars for political activies (posting "harmful" essays on the 'net). There are two things I find extremely worrying about this: the first is the way the Chinese propaganda machine operates, specifically the official reasons for incarcarating the man: "[he] jeopardised national unity and territorial sovereignty, spread lies and disturbed public order and social stability". There is also the reason given by the Chinese government for its attempts to monitor internet cafés: "[they] can affect the mental health of teenagers while spreading unhealthy information". The second is that any "western" country with its eyes on Chinese business is decidedly ignoring these increasingly dangerous signs of human rights violations, turning a blind eye to what will undoubtedly come back to bite everyone on the ass.
  • The Commentator is really funny. I'm very glad it is a joke, because after showing it to some of my colleagues I was a bit worried that they might actually use it.
  • There is this movie I was attempting to find for ages. I haven't seen it since I was 6 or so and only knew it by its Hebrew name, the direct translation being "hole in time". Well thanks to the wonders of the 'net I was finally able to find it: it's called Biggles: Adventures in Time, and according to one reviewer it sucks rather badly. Excellent! I'm waiting for my copy and will post my opinion when I have one.
  • Go play Psychonauts.
  • Here's an interesting article explaining why you must never use "double-checked locking", which is an (apparently broken) technique for saving some CPU cycles on synchronization checks. If you do any performance-savvy multithreading code it's an absolute must-read.
  • This is absolutely awful.

Things to expect in the (reasonably) near future:

  • The .NET Remoting vs Events article I was talking about
  • My experiences with Linux
  • Reviews for Psychonauts, Half Life 2, Chronicles of Riddick
Thursday, 11 August 2005 09:11:04 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
# Tuesday, 09 August 2005
A list of Gecko configuration options (accessible by entering about:config in any Gecko-enabled browser, such as Firefox) can be found in the knowledge base (via linmagazine).

I'll be listing interesting options here whenever I find them.

editor.singleLine.pasteNewlinesIntegerDetermines the behavior when pasting content containing newlines into single-line text boxes.
0: Paste content intact (include newlines)
1 (default): Paste the content only up to (but not including) the first newline
2: Replace each newline with a space
3: Remove all newlines from content
4: Substitute commas for newlines in text box
browser.urlbar.autoFillBooleanTrue: Enables inline autocomplete.
False (default): Opposite of above.
Tuesday, 09 August 2005 11:28:19 (Jerusalem Standard Time, UTC+02:00)  #    -
Software
Or to quote Penny Arcade from a while back:
Quit whatever you're doing, it's not important. Maybe you're performing a surgery. Put the scalpel down. Maybe you're holding a runaway car back from rolling over a carriage which contains an infant. There's no baby shortage, and even if there were, they're apparently a lot of fun to make. Run over the roof of the car, go home, and open up a browser.

It's rare that I encounter something which I can't find the proper amount of superlatives to describe. That something is Charly and the Chocolate Factory, the latest Tim Burton/Johnny Depp movie based on the famous novel by Roald Dahl (which I admit not to have read). I will not bother you with the list of superlatives I did manage to come up with, but trust me: you owe it to yourself to watch this movie. Just stop whatever it is you're doing and go.

Another recommendation that's bound to steal a few days of your life (and repay you by making the remaining days worth living) is the fantastic Psychonauts. It hardly matters what you're playing now, it can't compare. Remember Monkey Island? Day of the Tentacle? Grim Fandango? Same guy, and Psychonauts just might be his best work ever. You owe it to yourself to play this game. Just stop whatever it is you're doing and go.

Tuesday, 09 August 2005 08:30:11 (Jerusalem Standard Time, UTC+02:00)  #    -
Gaming | Movies | Personal
# Monday, 08 August 2005
Mailinator's been down for a while, and also slow and quite limited. I've been looking for a replacement and was recommended DodgeIt, which hits the spot. Highly recommended!
Monday, 08 August 2005 16:21:09 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
# Saturday, 06 August 2005

I was rather surprised to find comment spam in my blog (considering it's new and relatively unknown), but then it was Outlook-specific spam and I did have some Outlook-related blogposts.

Anyway in an attempt to fight it off I've enabled Movable-Type Blacklists as well as CAPTCHA images in the comments. I hope this isn't too annoying for you; if it is let me know and I'll remove it.

Saturday, 06 August 2005 19:25:27 (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
Me!
Send mail to the author(s) Be afraid.
Archive
<2005 August>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910
All Content © 2024, Tomer Gabel
Based on the Business theme for dasBlog created by Christoph De Baene (delarou)