Tuesday, October 11, 2005

Raise your hand if you aren't here.

I just got this email from my web host:

Dear Customer

To resolve the recent email latency issue, we have deployed a second email system. This is a courtesy note to inform you that your email for geekdork.com has been migrated to the second email system.
...
If you experience any issues with your email, please contact our technical support department and provide as much detail as possible.

Thank you.

DiscountASP.NET
http://www.DiscountASP.NET

Sunday, September 11, 2005

Link: Stuff on my cat

A friend just sent me a link to a brilliant web site:

StuffOnMyCat.com

Boy, do I have some material for them...

Saturday, August 06, 2005

Ashamed of VB.NET ?!

I recently read an article regarding .NET techniques on a programming community site. The author explained at the end of the article that all the examples were written in C# because that's his personal preference. His author profile describing his skills mentioned his proficiency at several languages including VB.NET. With that, he included the parenthetical comment "I’m not proud of this".

Why would anyone do this? Why would anyone go out of their way to say this? What is SO damn wrong and shameful about learning, knowing and being proficient at VB.NET? Whenever I hear people bash VB.NET I have to ask, "What is so grand about C# that makes you so high-and-mighty that you should be ashamed by any association to VB.NET?"

I work with VB.NET on a daily basis. That's the language I started with when I dove into .NET. I also use C# on a daily basis. Once I learned .NET using a language syntax I was already comfortable with (VB/Script) I easily transitioned into using C# when I could focus on learning the C# syntax and not have to also stress over the .NET semantics. Frankly, I think this made my .NET skill aquisition that much faster.

I'll openly (and not shamefully) admit that I prefer working with VB.NET in some areas. I find that it is much friendlier when writing UI code in Visual Studio.NET (2003). It plays very nicely with the IDE when working with forms. However, in my main VS.NET solution all the projects are C# based except for the single VB.NET web application project. I greatly prefer C# for little reason other than the XML commenting in all the supporting libraries. However, I find C# to be a pain when building classes. In VB.NET when you type the first line of a Property, it fills out the rest, creating the structure for the default accessors. In C# I have to write them all out manually. (Hopefully I haven't missed some VS.NET configuration setting for that.)

The simple fact that all .NET languages are for most purposes identical in capabilities should make anyone feel that the languages are equal. Yet so many developers work with C# and steer clear of VB.NET while maintaining a holier-than-thou attitude towards the VBers. Get over yourselves.

Friday, July 15, 2005

Prison vs. Work

IN PRISONAT WORK
you spend the majority of your time in an 10X10 cellyou spend the majority of your time in an 8X8 cubicle
you get three meals a dayyou get a break for one meal and you have to pay for it
you get time off for good behavioryou get more work for good behavior
the guard locks and unlocks all the doors for youyou must often carry a security card and open all the doors for yourself
you can watch TV and play gamesyou could get fired for watching TV and playing games
you get your own toiletyou have to share the toilet with some people who pee on the seat
they allow your family and friends to visityou aren't even supposed to speak to your family
all expenses are paid by the taxpayers with no work requiredyou get to pay all your expenses to go to work, and they deduct taxes from your salary to pay for prisoners
you spend most of your life inside bars wanting to get outyou spend most of your time wanting to get out and go inside bars
you must deal with sadistic wardensthey are called managers

Thursday, July 07, 2005

GeekDork.Baby

My wife and I had another ultrasound appointment today. Got several 2D AND 3D pictures. Plus we got about 9 minutes of videotape along the way. The 3D ultrasound stuff is pretty damn cool.

Monday, June 27, 2005

web.config Intellisense

A recent CodeProject article discusses Howto: Enable Intellisense Support for Configuration Files In VS.NET 2003.

Seems to work pretty well and I can see how the same technique could be applied to custom XML files in applications. The one problem I found seems to be that the XSD provided with the article download doesn't appear to support the tag of the config. I couldn't find it in anywhere in the XSD and unfortunately my XSD skills aren't so great otherwise I'd fix it. I may try at some point once I get some more understanding of building XSDs.

Updated:

It turns out the article's comments section had some suggestions on fixing the element problem. So I did some reading and tweaked the XSD. It seems to now validate properly with elements where they are allowed. You can download my modified XSD here: http://www.geekdork.com/dotnet/clrconfig.xsd

Another update (6/27):

Apparently, putting that xmlns attribute in the element of a web.config causes it to break. There was no mention of this in anything I read about it. It makes intellisense work when it's there and used in Visual Studio, but completely seizes the application. Not such a good thing.

Saturday, June 25, 2005

A Page.GetUrl() Method

A recent post on the Wrox/Wiley programmer to programmer forum asked the question:

"How do I get the URL to a page without hardcoding the page URL?"


While it would be a very nice feature to have in .NET it seems to make sense that there is no method that will generate a URL for you to a page even though we have strongly typed code-behind classes that often times drive the page. Consider that the pages are just ASPX files that can be named anything and can live anywhere in your application structure. They can be derived from any page-derived class in the accessible namespaces (the framework supplied System.Web.UI.Page class, or any class that you create in your application assemblies that was derived from the framework's web page class). This provides us with very flexible design and application structure but as a result we don't have a reliable way to say "give me the URL for X".

A possible solution to this that solves two problems at once is to create a shared/static "GetUrl" method on the pages. This method provides the root-relative URL to the page that owns the code-behind class as well as specifying required parameters so you don't have to guess at them or encounter problems later on.

Let's take an example of a class that shows the attributes for some item. This class lives at the root of our application:

   ourApplication/ItemAttributes.aspx


Here's the code-behind class:

Public Class ItemAttributes
Inherits System.Web.UI.Page
...
Public Shared Function GetUrl(itemID As Integer, page As Page) As String
Return page.ResolveUrl("~/ItemAttributes.aspx?itemID=" & itemID)
End Function
End Class


The GetUrl() method expects a couple of arguments: first an itemID because we need a reference to some item so we know what item's attributes to show; second, an instance of a Page class. We need the instance of the page class so we can access the ResolveUrl() method. Now, any other pages in the application can create links to this page by calling the public shared method:

   ItemAttributes.GetUrl(12, Me)
'returns "/ourApplication/ItemAttributes.aspx?itemID=12"


A benefit of this technique is that we get a more robust application that is not quite as suceptible to growing pains. Let's say that we move this page because our application is getting bigger and the pages are getting cluttered. We'll move the page to a directory of common pages:

   ourApplication/common/ItemAttributes.aspx


We can just modify the GetUrl method and all the pages that consume this page link will follow along without a glitch:

   Return page.ResolveUrl("~/common/ItemAttributes.aspx?itemID=" & itemID)


Now let's imagine that we have to add another querystring value to the page because we now need to get information about the category that this item is in. When we modify our page to look for the querystring value all the page requests will start failing. We don't know all the places that this page is called in the application so we will have to do a pretty good job testing the application to find the now-broken references. However, there is salvation! All we have to do is change the method signature to expect the new argument:

   Public Shared Function GetUrl(itemID As Integer, categoryID As Integer, page As Page) As String


Now when we try to the build the application we'll get compile errors everywhere that this method is called. We can go and repair all those broken calls. Of course, depending on how you build your pages, you could add an overloaded method that still accepts the original set of arguments and have it call the new method with a default value so you don't have to repair broken calls. This is a great approach if you can build the page to function without the additional information.

By using this technique you get several advantages:
1. Flexibility to move pages
2. Compile-time debugging (reduces testing and potential customer discoveries of overlooked bugs)
3. Multi-developer teams don't have to waste precious time researching what the page expects for a querystring because the calls have a strongly typed and descriptive signature.

Tuesday, June 07, 2005

Religious development

I just read a short post on the Wrox/Wiley programmer to programmer forum. The poster's signature read:
Writing software to specification and walking on water is easy.. as long as both are frozen.
How true that is.

Friday, June 03, 2005

Link: Just ignore me when I get crabby like this

Eric Sink writes about basic airport etiquette.

In addition to his comments, I'd like to add the following rule:

- Stand a minimum of 10 feet away from the baggage claim carousel and do not approach until you think you SEE your bag.

Tuesday, May 24, 2005

Gent: Tuesday

Went for a very long walk around Gent.



Very interesting place. There are the famous towers of three cathedrals plus many more churches across the city. Lots of really neat alleyways and streets. Many of the buildings have remarkable faces of intricate wood, stove and iron work. Very impressive.

Gent: Tuesday morning

Lovely morning in Gent. Took a couple quick cameraphone pics from the hotel terrace:


The roundabout on the hotel street, a trolly and the trains overhead.


The other direction on the hotel's street.

Monday, May 23, 2005

Arrived in Belgium

I got into Gent, Belgium this morning for a one week visit for the European user group conference I'm attending and presenting at for work. The express flight was a little late getting to Newark, NJ so I had to rush to make the connection. Then, of course, we sat at the gate for at least 30 minutes then took a good while to get off the ground. Didn't leave there till an hour after the planned pushback. So we arrived late but it didn't really matter because we didn't have anything scheduled for when we got here.

Somehow I left home without the data cable for the camera I brought so I can't get any good pictures online till after I get home. But I have my camera phone (with infrared transfer) so I could at least get something.


View from the hotel window. The building next door blocks the side of the train station overpass that leads into the main square of Gent.

I walked into the train station and around almost every corner is some stand or shop that sells "Warme Waffles". The whole place smelled of them which made me very hungry. However, I can't eat until dinner later on with a contact of ours here. I'm definately going to have to see about getting a waffle for dessert (apparently that's how it works).

Saturday, May 21, 2005

Added old posts.

I added posts from my old blog (there weren't many). It was reasonably painless apart from trying to figure out what the real times where that posts were made. The blog pluggin I was using was saving the times wrong. But they didn't seem to be consistantly wrong so I had to do a little estimating or just make them up. Oh well. They're here now, so I just have to figure out if I'll publish directly to my site or have my site pull the feed and show the results. I suppose the latter would be better.

GeekDork.Blog = New Blogger()

I broke down a got a new blog. I had tried a blog pluggin on my site, but it just wasn't working out the way I had hoped. So I decided to give Blogger a try. I was about to start looking into importing previous blog posts but just now noticed that I can change the date and time of new posts. So I should be able to put in my old posts without much difficultly. Good thing I don't have hundreds of them! Hopefully this bog will work out better than the old one.

Monday, May 16, 2005

ASP.NET Application reset behavior

In the March 2005 asp.netPRO magazine, there is an article by Dino Esposito discussing accessing compile-time code programmatically. He explains how code files are generated from the parsed markup files and then get compiled into temporary assemblies in the ASP.NET temp folder(s). Although he makes a very brief mention of how to actually access this code programmatically, he mostly writes about how ASP.NET works under the hood. Towards the end of the article he notes something that I found very interesting. He writes:
"Each ASP.NET application is allowed a maximum number of page recompiles (with 15 as the default) before the whole application is restarted. ...If the lates compilation exceeds the threshold, the AppDomain is unloaded and the application is restarted. Bear in mind that the atomic unit of code you can unlad in the CLR is the AppDomain, not the assembly. Put another way, you can't unload a single assembly without unloading the whole AppDomain."

I develop with the "attach when you need to" versus the "hit play/F5 and lauch I.E. every time" technique. I find this to be much more productive and saves the hastle of having to truly restart my application every time. Granted, this introduces some problems because I'm not starting clean every single time but I find that the occassional inconvenience is far outweighed by the time savings of avoiding a the full recompile-load IE-attach sequence.

When I make file changes that do not require recompiling I go thru many change-save-refresh cycles. I have noticed that most of the time after I refresh there is only a slight delay (sometimes hardly noticable) on the first refresh after a change. I knew that ASP.NET is refreshing its cache of my page but beyond that I was not aware of what was actually going on. Occasionally, the application will seem to hang up, but then return and behave as if I had restarted completely (I'll end up at the login page if I'm in a authenticated application). Based on Esposito's explanation I now understand that I've reached that recompile threshold and my entire application has been restarted. This explains the behavior I've experienced and wondered about.

Thursday, April 21, 2005

Stupid Bosses (Not Mine)

As a member and moderator on the Wrox/Wiley Publishing programmer to programmer forums, I see lots of silly or simple questions. This is no surprise and expectable when so many people come to the forums as new programmers. However, sometimes after some additional prodding (like asking "Why are you doing is this way instead of that?" I'll learn that they are doing something the way they are "because that's how my boss wants me to do it". It also seems that the way the boss wants it done is rediculously idiotic. A recent thread in an ASP.NET forum led me to learn that the programmer is manually writing out HTML instead of using a DataGrid control because the boss has some kind of weird problem with the built-in .NET controls.

How the HELL does this happen? Who the hell are the bosses that think this way? This boss in particular has made a decision that makes about as much sense as buying a car and choosing not to drive but to push it instead. S/he is costing their company time and money by forcing the programmer to do a hell of a lot more work than is necessary!

I am a technology person. It happens that my boss is as well. He still programs while he manages the other developers. He understands the capabilities of the technologies we use if not all of the nitty gritty details of how to implement them. Implementation is my job. I build things the best way I can, by utilizing the resources and tools available. He lets me use the tools I need (where availability and money allow). But somewhere out in the corporate world, there is are bosses who are total idiots and are making their employees jobs a complete pain in the ass while being a detriment to their companies.

Saturday, March 26, 2005

A JAVA iron lung

I was installing MSMoney 2003 this evening and happened to scan thru the EULA when I came across this section that I find particularly funny:

9. NOTE ON JAVA TECHNOLOGY. The SOFTWARE PRODUCT may contain support for programs written in JAVA. JAVA TECHNOLOGY IS NOT FAULT TOLERANT AND IS NOT DESIGNED, MANUFACTURED, OR INTENDED FOR USE OR RESALE AS ON-LINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF JAVA TECHNOLOGY COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE. Sun Microsystems, Inc. has required the inclusion of this disclaimer.

Friday, March 18, 2005

Eric Sink's Source Control HOWTO

Eric Sink (founder of SourceGear, maker of Vault) has been writting and is finishing a splendid Source Control How To. He makes some very good comments regarding how must programmers/developers learn what they need to program but are never taught the tools that developers use in real-world software environments (project management, bug tracking and , most importantly, source code version managment).

Thursday, March 03, 2005

Overriding web.config app settings with user.config

Some time ago, I was in a situation where I wanted to set local application settings for a web application I was developing to some alternatives without messing with the project's copy of the web.config file. So I'd change my local copy by making it writable (normally the file was read-only because it is under source control). Every time I'd get latest version for the project it would either overwrite the file (if I forgot to leave the local copy) or I'd have to merge any changes manually.

Then I came up with this clever idea to have a little change script which would tickle the XML nodes of the web config file so I could just run that every time I got latest version. But it still was a pain because I had to remember to perform this action or it was more difficult to maintain.

Well, I just learned that .NET has a built in solution (that wasn't very well publicized apparently). Apparently, you can place the attribute [file="user.config"] in the web.config file and it will point to that file for application setting overrides. So you could then create that file in the application directory to hold your personal overrides for the default app settings. The file should look like this:

<appSettings>
<add key="key" value="value" />
</appSettings>

Note that 'appSettings' is the root node. The user.config file does not have to exist. .NET will just ignore a missing file and use the default values in web.config.

If you do create this file make sure you do not put it into the project (and, thus, source control) so as to avoid overwriting individual's settings.

I found this in the MSDN article: Team Development with Visual Studio NET and Visual SourceSafe - Chapter 4: Managing Dependencies

There are lots of other details in there that are helpful to know if you are building software in a team environment.

Monday, February 21, 2005

In-laws, Jerry, Boxing and a pessimistic wine junky

Another weekend has gone by. Unlike most of them, this last one was filled with all kinds of excitement. First my in-laws arrived (it still sounds strange) and we had a fine dinner of Omaha Steaks. I got tickets to a Jerry Seinfeld performance for them for Christmas and the four of us went to the show Friday night.  We had pretty good seats and it was very funny. Apart from a little navigation difficulties on the way there, we had a delightful time.

Saturday we met them for breakfast at a local diner then hung out at home for a little while. They left early afternoon and the wife and I went to see "Million Dollar Baby". Apart from my general disliking of Eastwood's speaking voice, the movie was quite good and I can see why it's getting so much praise. A bit depressing though.

Sunday consisted of brunch with the neighbor and a late afternoon trip to the local indie theatre for "Sideways". I don't think it deserves all the hype it's been getting but it was good nonetheless. Then we went to dinner at a Vietnamese place we hadn't tried yet that is conveniently right next door to the theatre. My food preference is "bland farm" but my wife has been getting me to experience some more culturally diverse cuisine. I'm getting there.

Saturday, January 08, 2005

Junk mail, email and keeping the USPS in business

Hardly a day goes by that I don't get some kind of junk mail offer in
my post box. Usually credit card offers. Now I greatly
appreciate that the financial institutions recognize that I have great
credit and can understand their desire to get a piece of my
wallet. However, I get sick of the junk mail and I feel bad that
the town I live in has a poor paper recycling program that forces me to
toss the offers in the regular trash.

As the internet and use of email has progressed there has been talk of
the United States Postal Service suffering due to the decreased use of
snail mail. Companies sending junk mail certainly don't seem to
have slowed down. Meanwhile, the people who now use email to keep
in touch with their friends and family probably never really wrote
enough letters to make a significant dent in the USPS profits to begin
with. They telephoned, so if anyone's hurting it's the phone
companies, and I don't feel so terribly bad about that.

Thanks to Andy Roony of 60 Minutes I now have a great solution that
solves these problems. My trash can won't get as full, and I'll
help keep the USPS in business. The best part is that it doesn't
cost me a dime. The companies that send this crap to us really
want us to write back to them. They have included a self
addressed stamped envelope in the form of that "Business Reply Mail"
(BRM) envelope. It's actually not stamped so this is where the
keeping the USPS in business part comes in. The postage for those
BRM envelopes is paid for by the company you are replying to but ONLY
when it is actually used. Otherwise it's not economical to send
junk mail. So let's use it.

The process is simple. Open your junk mail envelope and find that
BRM envelope in it. Take everything else, including the original
envelope (which you might have to cut up into a few pieces) and place
it back in the BRM envelope, lick it, seal it and drop it in the
mail. That's it. Now the companies that send the junk can
dispose of the junk and the USPS gets some more business. If you
want, throw in some more trash you might have. You'd be surprised
how much you can stuff into those envelopes. Also, if you so
choose, you can leave a little note inside the returned mail telling
them to take you off their mailing list. Perhaps we can reduce
the junk we get while disposing of it.

I'm not going to try to do the math on this, but I bet that if everyone
who gets this stuff takes a few seconds to send it back we could do the
USPS a real favor. Maybe the price of stamps wouldn't keep
jumping up which just further deters us from using snail mail to send
correspondence.

Do your part! Return the trash.

Wednesday, January 05, 2005

New article on spaanjaars.com

I just wrote a short article entitled "'Re'implementing Interface Implementations: VB.NET vs. C#" which discusses how to implement an interface method a second time on a class that is derived from a class that already implements the interface.  It also discusses the differences between doing this in VB.NET and C#.

Take a look

Sunday, January 02, 2005

Happy New Year!

Hope everyone had a pleasant new years weekend. Nothing major happened for me. Spent the weekend at the in-laws and celebrated Mrs. GeekDork's birthday (a week or so late). Had no intentions of doing anything rambunctous for new years and was quite successful. Spent it watching the newly released Seinfeld DVDs. Finished the first season (all 5 episodes) just before midnight, watched the ball drop and went to bed at 12:02. Woohoo. I really don't see what all the fuss is about. I mean, it's just another second of another day of another year... my appologies for being cynical.

Spent the better part of the 1st working on my first attempt at a multi (4) layer cake. Had never tried before and was surprisingly pleased with the outcome, though it was a smidge lopsided but tasty nonetheless. Vanilla cake, chocolate pudding, whipped cream and strawberries. Yum!

Now the holidays are over and I must return to work after several short weeks. Oh the humanity.

Cheers!