Tuesday, February 12, 2008
Compression and Serialization - Part I
If you've ever serialized an object to a Stream in .NET before(and you may have done so without realising), and wondered whether there is some simple way to use compression in order to save some stream-juice, read on.
In my case stream-juice is network bandwidth. I'm serializaing objects over a NetworkStream, but, saving stream-juice should never be laughed at or overlooked, regardless of typeof(stream). If you're serializing objects to a FileStream, compression can save a significant amount of disk space(stream-juice).
The System.IO.Compression namespace(framework version 2) provides classes that makes this very easy. The trick is to hook into the framework's serialization process and compress/decompress the object being serialized/deserialized.
To be continued...
BTW: the image is evidence of life on another planet. It's encrypted though(Rijndael).
Thursday, February 7, 2008
Plugins, suits and thread-monkeys
Yes. I have been absent for a while - busy throwing plugins at the suits. Works well - as long as your plugin framework is razor-thin.
Learned some hard lessons on threading in .NET since I last posted. Turns out my motto holds : DIY. In this case, don't rely on framework code like Delegate.BeginInvoke() or ThreadPool.QueueUserWorkItem() to solve every problem - in general I find it much safer and reliable to utilize the reilable Queue-a-job type patterns using a manually created Thread. In some cases I employ a job buffering strategy on top of this in order to manage and throttle throughput. This suits the type of software I work on perfectly.
Thursday, April 12, 2007
Multi-monitor-(aware software)-mutterings
It's not uncommon to have more than one monitor on your desk lately - even at home.
A while back I visited a client for the first time - and wow, every software devs dream.... a user that's serious about his hardware. Four 17" LCD monitors (a good brand) were arranged to form a sublime portal into a powerful .... OK - I might be stretching it a bit, but for the first time a started thinking about efficiently utilizing 5120x1024 of real estate.
Monday, March 5, 2007
Spiraling into an abyss
Last night I made the mistake of struggling with Prolog before going to bed - sheez. It was the first time I tried my hand at this weird (only because it is so different I suppose) language.
Here is a Prolog solution to The Towers of Hanoi game, amazing...
It was just after midnight, reluctantly pulling my last cigarette, I decided to have a squiz at my first AI assignment - I'm studying post-grad Computer Science, part-time. I found the first 2 chapters of the textbook relatively straightforward, so I was confident and enjoying it. After I got stuck for a couple of minutes on what seemed to be a trivial error in my code, one of those you know is right there in front of you, I found myself utterly confused and exausted. I went to bed.
***
***
When you're ill you sometimes you "dream" all night about events, things or even concepts you encountered during the day - I decorated the word dream, because it's more of a constant blurred awareness of the events, things or concepts bugging you. Hope that made sense. Well, I constantly "dreamt" Prolog last night - it was terrible.
Here is a Prolog solution to The Towers of Hanoi game, amazing...
It was just after midnight, reluctantly pulling my last cigarette, I decided to have a squiz at my first AI assignment - I'm studying post-grad Computer Science, part-time. I found the first 2 chapters of the textbook relatively straightforward, so I was confident and enjoying it. After I got stuck for a couple of minutes on what seemed to be a trivial error in my code
***
When you're ill you sometimes you "dream" all night about events, things or even concepts you encountered during the day - I decorated the word dream, because it's more of a constant blurred awareness of the events, things or concepts bugging you. Hope that made sense. Well, I constantly "dreamt" Prolog last night - it was terrible.
Friday, March 2, 2007
Throwing plugins at the suits
My world has been turned inside down by the plugin paradigm (call it what you like). I'm a minimalistic developer, prefering DIY sollutions to common problems (like reporting) and avoiding out-of-the-box-auto-magic-quick-fix monsters I can't control. I know people who could argue with me about these things all day - but the way I(and many others) see it, it's an art - not a job or a science or anything governed by rules.
I'm 2 months into a 6 month project - typical business desktop software(financial risk analysis, if it makes a difference). The project entails replacing an existing system(which I implemented about 3 years ago) with a new shiny one with better this and that, more of that and a few big new features. The company's software grew a web front-end (somebody else did that), and naturally a substantial amount of functionality, and more tragic, code was duplicated. The user's requirements quickly grew beyond that which two relatively seperate systems could muster and the suits agreed that it was time to let the nerds out of the cage...
Another bug that bit me is the idea of Service Orientated Architectures. Throw in a thorough study of .NET Remoting and you end up with a Windows service hosting plugins that provide services via remote interfaces to any .NET front-end you please, over a TCP/IP network - what more could you ask for? [yeah,yeah...i know]
public static void main()
Hello.
I decided to start a blog : mostly because I'd like to start an archive of useful C# code snippets and tricks, but also because I like typing. Unless you're lucky enough to find the answer to what you deem the meaning of life(2:33am, Friday morning, coffee, cigarettes,neon...."why the #$@% is this sink throwing exceptions all of a sudden!") hidden somewhere in a post, this blog provides you with nothing but random code snippets, pretty photograps(ignore this one) and such.
Subscribe to:
Posts (Atom)