Friday, August 18, 2006

Why I won't see dumb movies

Snakes on a Plane. Just for putting that there, Google will link to it along with the millions of other references on the net to it. But I refuse to go see it, even if it is a result of bloggers building a mass hype around it. I refuse to pay for the crap that Hollywood throws out, even if this movie is a parody. That is to say, I'm not against parodies in general - no, in this case it is because they are not really making fun of anything in particular, other than people will spend a lot of money on purely hype.

Demand better movies people! Demand quality for your money!

Thursday, August 17, 2006

C# hypocrisy and delgates

After spending more time than what it should have, I finally got a delegate to work with an asyncronus thread. The problem wasn't the code so much as not being able to find clear instructions on the net on how to implement it.

One of the problems is that examples on the net often take the shorthand approach of putting multiple classes in a single file (or at least what could be a single file). For example:

namespace blah
{
class firstClass { ... }

class secondClass {...}
}

the compile can deal with this fine. But if you apply it to a windows form to use in a thread as I was attempting to do, the program crashes as soon as you attempt to go to that form, with the error of "System.Resources.MissingManifestResourceException" as explained on MS's support site.

I eventually had to copy and paste to notepad, delete the file and re-create it. I wasn't impressed }:( as this code is being used in production, and although I have backups of it, having to rebuild a file like this shouldn't be necessary.

So I created a class to use for the delegate. The next problem I found was the poor explanation of how a delegate needs prescisly the same parameter names as the method you are going to call (not to mention the same return type). For example:

namespace whatever
{
class Utility
{
...

public void myMethod(TextBox box, string message)
{
box.text = box.text + message;
}
}
}

namespace whatever
{
//I've separated this out to make my point...
class targetClass
{
private System.Windows.Forms.TextBox messageTB;
private string message;
delegate void myDelegate(TextBox box, string message); //notice it matches as above

...

//inside a thread
message = "the message";
myDelegate md = new myDelegate(Utility.myMethod)
this.invoke(md, new object[] {messageTB, message});

...
}
}

This may not be the most elegant solution, but it works. - maybe this will be a bit clearer on how delegates look and operate when being used in threads.

Tuesday, August 15, 2006

WSE and Thread Safety

I love working in .NET sometimes...

For my application that I'm working on, am using Microsoft's Web Service Enhancements (WSE) for ensuring security of uploading and downloading of sensitive data. However, I also need to implement some thread safety on it, so I don't have the users starting multiple worker threads while the first is still running. SO -

I put in a lock as is commonly used. The lock itself works fine, it will only allow one worker thread at a time to try to hit the server that I am connecting to. But then I get back an uncaught exception which causes problems: System.Thread.ThreadStopException. Now this is apparently an exception that is supposed to not be implemented in a developer's code, is not documented in MSDN, and only occurs "*very* occasionally". So apparently, I have a bug, but I am not allowed to see what it is or prevent it from screwing around with the program. Hmm, this is probably something stupid that will take me several hours to find...

Sunday, August 13, 2006

Blogs, Celebrity, and media

Although I haven't posted for several months (moving to a new home and WoW taking a lot of my time), I am struck by the increasing power of blogs in mainstream media and the creation of instant celebrity by some of the most famous bloggers out there. First, there is Amanda, of the Rocketboom fame, catapulted from a star of the hardcore net users to being on tv and in the press. Then, there is Josh Wolf, fighting for his rights as a video blogger - CNET is posting his story and noting that traditional media powers are now supporting his legal fees, which I find interesting.

Both of these are showing the power of blogging and how it beginning to affect even traditional media and how one can go from obscurity to being (a little) famous when fate grabs hold. I do have much more respect for this type of fame than that shown on the various reality shows that tv seems to not be able to rise above. I guess even the masses need something to cling to...

Other evidence of the growing power of blogs was shown in this weeks edition of The Economist, where a fairly large article was published about the increasing use of blogs by professional economists. While the Economist is fairly open to grabbing on to new movements in technology and society, it is amusing to see how what was once considered a thing of online nerds is becoming more and more accepted by media as being a legit way of reporting information.

Of course, the rights and responsibilities of bloggers are still being resolved as several people have been jailed, such as Josh, to people loosing their jobs for blogging, like Petite Anglaise (who I think has a kick-ass layout and color scheme for her blog).

Speaking of layouts and color schemes, definetly time to work on the css for this blog...