May 2003 - Posts
I'll admit it, sometimes my code has bugs -- hopefully all caught before release, but always the first cut has bugs. Today I hit one that made me think about something I may have been doing wrong for some time.
It's all about
. When one of these is thrown, you must rethrow it, and let the CLR terminate your application. Why? Well, as I've learned (and the name suggests), your app is now in an unstable state. Besides the obvious problems of being out of stack space, the not-so-obvious hits you -- finally blocks require stack space! Yes, this means that none of your finally blocks have been / will be executed from the time the exception happened going forward.
So, in the way past, I used to catch
in code where I knew I could simply drop whatever operation I was doing and recover. Oops, bad Idea -- you can't recover from everything
(perhaps more on that later).
Now, I put cleanup in the finally block, logging and problem handling in the catch block, and rethrow anything I don't know how to handle (if I catch it at all). I thought that was great, until today.
If I'm using some precious resource that must be released or brought to a known state, I used to put that in the finally block. But if something goofy happens (Murphy insists that it will) and a
is thrown, then my finally is not called! Yikes!
Do I need cleanup in two places (catch and finally? catch and end of try block? )? I can't centralize it into a method, as I can't call into any methods during a StackOverflowException. I suppose I could say "that probably won't happen" and ignore it, but on a machine that is never rebooted, it might happen. I can live with monitoring my app and restarting it if the CLR must terminate it, but I can't live with my app slowly bringing the server into an unstable state. Any thoughts?
P.S - any thoughts on how to log a
Early & Adopter, comes this tip on locking down the asp.net state service to local access only
This is great.. I ran into this just the other day when a fellow developer was looking for a way to secure the state service on an intranet. The networking guys didn't want to add yet another firewall until end of summer, and the site is in continuous development so it can get updated twice a week. When people are using it 24/7, it's annoying to reset the state, but even more annoying when people have access to state-stealing utilities. This will solve both problems, without requiring more SQL licenses.
Wonderful... I get to give him the answer and look like a brilliant hero.
Yet another reason that I can't understand why people in this industry aren't subscribed to as many rss feeds as they can find. It's to the point now where I sometimes hope that they don't
find out about the .net blogsphere, as it makes me look like the most well informed developer in town.
Like many others
, I've been thinking about strong typing
lately. I've realized that most of my programming in life has been done in strongly typed langages, and only a small percent in weak. That got me thinking... am I really in a position to think that I'm more productive unless I've tried an alternative?
So I'll be trying some Ruby this week, but I don't know if I'll be a convert; I've never really felt constrained by strong typing. Can anyone out there point me to concrete examples of ways in which strong typing limits productivity?
I think that for me, one of the biggest benefits of strong typing isn't in compiler errors or intellisense... it's in the design needed. It forces me to think before I code so that the correct interfaces and base classes are designed. While some may think that that's limiting, I like to have to design a bit before typing away. Without any constraints, I'm afraid I'd be much too lazy to do any design at all, especially for small projects or one-off tools.
is trying to run TabletPC OS
on a standard PC, and having some trouble doing it
Anyone out there running TabletPC OS on Virtual PC and having it work? If so, i may bite the bullet and buy a copy (of Virtual PC, I'm already a MSDN univ subscriber). Then, a kind soul could upload an image and I wouldn't even have to try to install it... Say, now that the Virtual server thing is out, how long until us MSDN univ's can get VirtualPC on subscriber downloads?
In my jr. high days, I worked as a PC repair technician for a very small computer store. I'd add / replace hardware, then install the drivers for DOS, then get whatever apps they had installed to work with, say, the new bus mouse.
Sometimes (often) a person would ask what I'd done to "make it work". I could explain all day, but I'd end up trying to train someone to do my job who wasn't really interested in it, and instead wanted the one paragraph answer so they could sound like geeks to their friends (why? your guess is as good as mine.) However, normally after a few key words, the inquiring person's eyes would glaze over, and you could just tell that they wanted you to wrap it up before they looked dumb -- they had ceased being able to follow the answer, were no longer interested, and wanted to go
It was even worse when you just started in before they asked. The eye glaze happened immediately. Even if they were trying to follow you so that they could interject a question or comment, they couldn't. They were done, and you were talking to someone who was in "config.sys mode". We called it that because mentioning config.sys was a sure-fire way to get the glaze. People didn't understand why putting a line in that one file made thier mouse work. You say "I added the drivers to your config.sys, then reordered the loads for optimal memory usage...", and boom... gone.
I'm remembering this today because I've seen it twice now in 24 hours.. The only problem is, I'm now noticing it when I do it. The first was me trying to explain the ASP.NET pipline, and the concept difference between ASP's global.asa, and ASP.NET's global.asax, and what a handler vs. module is, blah, blah, blah.... to a project manager. I thought I was being clear and interesting, and that the subject was fascinating. I was wrong. He went into config.sys mode.
More scary was yesterday - My neighbor is explaining to me why my mower isn't working well, and started in on some explanation of the exhaust backpressure in a 2-cycle engine.... or something. After about five minutes of not at all understanding what he talking about and feeling like a two year old trying to understand how black holes can emit radiation from the event horizon, I realized it. I
was now in config.sys mode. I was the guy who we snickered about after he left the PC shop. I was the clueless marvel calling a 3.5" floppy a "hard disk". (even worse, when my neighbor said "you look lost", I actually said
"config.sys mode. Sorry." Could I be more of a dork? Perhaps I should wear the propeller beanie next time)
So please - the next time you're explaining something to someone that doesn't get it, and you just know
that they should understand you.. Don't assume they're an idiot (even if they are).
It probably happens to you, more often than you think.
Okay, I love web modules in asp.net. Here's the new "impossible" thing I did. (I told people I would clean up this code and make an article, but life happens)
With very little effort, I have created a web module to allow someone to mirror a web session
. What does that mean? Well, If you mirror my session, then each time I am served up a new page, you get an exact copy of the HTML sent to you. That easy.
It has two clients - a web client, and a winforms client (embedded IE control). The web client is served up by a handler in the code you can get above, and the winforms client (also included) communicates via .net remoting events.
Now, two disclaimers:
- The project was a fun exercise, not production code. It's not even done, although it is fully functional. For instance, security wasn't completed. The headers aren't sent (so it won't work with my quick and dirty gzip module), and so on.
- It doesn't really need a remoting client - that kind of gets in the way of the rest of the source. But I wanted to try it, and it was my exercise.
It was a very fun project, and quite easy. I love asp.net. I love .net remoting. Man, could I be working with technology that's any cooler? The best thing is, there's a great community to go to for help with asp.net (like ScottGu
, Nikhil Kothari
, even DatagridGirl
, heck, I could list asp.net resources all day
..) And a community for help with remoting (Like Ingo Rammer's site on Remoting
), and even great resources on .net from the experts on the CLR
themselves. Anyone out there not love what they do?
So, one more http module to create that I always wanted in ASP, but couldn't do...
I'm still constantly amazed at how very, very easy ASP.NET makes things on me. In fact, I'm sometimes amazed at the things that are now simply possible. The pipeline and the ease at adding modules is my current favorite. I'm now trying to free my mind and realize that what was impossible now isn't, what had to be a ISAPI filter now doesn't, and what used to take weeks or months is already done.
Take this, for instance: A friend at another client site that is just starting to use ASP.NET had his boss come over and say that they needed to support gzip encoding on websites, per their IT guys. He showed my friend a package from a third party with a 12-step install, that would require "only" $2,000 to license for the high-traffic site. He asked, was it a good idea ?
In literally 10 minutes, I have a web module implementing gzip and deflate [source only]
(thanks to #ziplib
). No, really 10 minutes. Actually less if you don't include time to zip it up and include a readme. It may not be polished or optimized, but 10 minutes? I can't even get an ISAPI filter installed in 10 minutes, let alone write one.
So now that I am again realizing that there is no spoon, I'm finishing up another project that I thought would be impossible : A web module that allows you to watch a user browse your site - It's actually two parts. The web module provides a list of session IDs and allows tracking of a session, and a fat client that hooks up. The client asks for a session ID (from the list), then you sit back as an embedded browser follows along with the user. Very useful if you're on the phone with a user and can't recreate the problem from their incoherent descriptions.
Anyway, To the point: ASP.NET is good. I'm loving that not only have my horizons been broadened, but that things that were once far, far out of reach are now easy (and fun) to grab ahold of. God, I love doing what I do.
If you read my past weblog
entry on Tech interviews and the as keyword
(which I know you didn't, because no one read that blog ever), then you may know that I do some (lots) of tech interviews.
I'd like to break down some tips for those of you who are going to be given one from someone who gives them. If you already do these, then you probably know this already, and can skip to some fun reading
, or some neat stuff
remember that this is just one guy's opinion, and if I turn out to be right on a whole list of things, then the catholic church pronounces it a miracle.
So, for those that are getting "teched":
- Do not be afraid to say "I don't know." It's much better than acting like you do. So you've not worked with that particular part of the framework/language/whatever. Big deal - we'll move on, and you don't sound like an idiot. Extra kudos will be given if you follow it up with something like ", but I know where to find out".
- Ask questions and think out loud.: I'll give questions that have no outright answers so that you have to both ask for clarification and explain your answer as well. I'm sure you've heard it before - people want to know how you think. But it's more than that! -- we also want to know how well you can communicate what you are thinking! It's great if you're a genius, but if no one who is working with you can keep up because you're such an enigma, then we might as well only have a team of one.
- Last, but not least (well, least among the three here, probably), Don't be be oversell, and don't be arrogant: The person teching you may be of higher or lower caliber than you. If lower, he's probably making sure that you are a heavy hitter for his boss - be nice, and don't talk down. Let them know that you do know your stuff, but that you can work with people working their way up to it. On the other hand; don't be nervous if they're the expert and you're not -- they want a good idea of your skills and how you'd fit in with what they need. Be honest and get the job. Overselling yourself will just make you look like an idiot during the interview.
Hope these help.
I've moved my blog from my own site (www.nfission.net/weblognfission.net
) to here.
It's not that BlogX
was bad, or hard to set up, but it is
lacking some features I want --
So yes, I could (should?) help make BlogX better
, as in fact many people are doing now. But there are just so many things I want to work on right now that I have to draw the line somewhere. Blog software sounds fun, and maybe I'll work on it sometime soon. But not now.
So here I am. What is my blog about? Well, nothing yet. I'm a developer in Omaha, Nebraska - and I work only with .net currently. I get to do lots of fun things with it, and I get to dig into the dirty details - because that's what I get paid to do (and I like it, too).
So I'll be sharing .net stuff I find interesting (I'm finishing up researching an annoyance with AppDomains and dynamic loading of assemblies for reflection, will post when I have the info), neat stories and tools, and last but not least, my thoughts on dealing with being a developer in a variety of environments and industries in the Midwest. Hope you find it interesting.