Sites in a box

I just read up a bit
on the


InstantKB.NET

product (after our own issues with over-using
.NET, why does everyone else keep sticking it on their product names?) and it
looks pretty cool. Between that, and the many other tools like it, including the


ASP.NET starter kits

from

www.asp.net

, I am starting to wish I had a site to build… all of these tool
kits seem like wonderful ways to jump start a site!

From the InstantKB.NET site: “The End
User License cost is $119 USD per web site, per URL and per server.”
What does that mean? site, url and
server? Do you get to pick one? Is it only that price if you are running one
site on one server with one url (guess it will be a big default.aspx
page)?

HREF EXEs are cool.

I have been, since I started using .NET, a big supporter of
the ‘Smart
Client’ or ‘Rich Client’ application
. I’ve talked about it to people, I’ve
dug deep into the underlying technology, I’ve built samples… big fan
of the whole idea

. On a parallel track, I wrote several systems internal
to MSDN using VB.NET and Windows Forms, but I didn’t make any of them into
auto-deploying apps (aka no-touch apps, aka HREF EXEs, etc.). Why not? Habit I
suppose, it just really didn’t occur to me, until after I had sent out a few
updates for each of them, then I felt really silly… I’m not supposed to have
to do this anymore, sending out updates is a thing of the past!

Tonight I converted them all to HREF EXEs. I had a
little snag, it turns out that when IEExec hosts your EXE it doesn’t run it in
the same type of Apartment as when you execute it directly (which doesn’t matter for most
things, but it screws up COM automation and drag and drop), but just adding

System.Threading.Thread.CurrentThread.ApartmentState =
Threading.ApartmentState.STA

to the start of my app fixed that right up. (and, no, just
adding the STA attribute wouldn’t do it… in case you are
wondering)

Now, if I build a new version and copy
those files to the appropriate web server directory… bang,
everyone is running the new version the next time they launch the app. No
update, no need to send out a “new version” email, unless I just want to let the
users know what is new… it is a good thing.

Tired now, must stop
coding…

Why C# indeed

Early and Adopter
seem to have just noticed my blog;

Duncan Mackenzie’s
blogging, and no one told me!

(And why on earth does he
have C# code on his blog???)

[Sean ‘Early’ Campbell & Scott ‘Adopter’ Swigart’s Radio
Weblog
]

and they raised a
good question, why would I (I’m MSDN’s “Content Strategist” for VB, and an
affirmed VB Lover) have C# code on my blog?

It isn’t by choice,
that is for sure! It is his fault: Matt [Mr. Web Services] Powell

I’m doing a little bit of work on some
internal utilities at MSDN and while some of them are in VB.NET, this particular
one was written by that crazy Matt Powell fellow and
it is all in C#. I’ve actually managed to break a few things out into their own
assemblies and do them in VB.NET, but for the most part the UI is all in C#…
what is a guy to do? I’ll try to avoid starting a religous debate here, but I
have to at least say that the C# editor sucks compared to the VB.NET one… XML
commenting aside! I’ve heard it is much closer in features to VB.NET in VS.NET
2003, but I haven’t done anything but VB.NET in that version of VS.NET, so I
don’t really know…

Sadly, after only a few days of
working on this system, I started adding semicolons to my VB.NET code… Is that
like calling your wife by the wrong name?

Not quite ready for prime-time

I have a lot of
code hanging around, and the techniques in that code would likely
help people who are getting started with .NET, but I haven’t had to time to
“polish” it up for public release…

I’m starting to wonder, with the rapid
pace of technology, if I should just release things as they are and tweak later
if I have time… at least they will provide some benefit to some people. If I
wait until I get around to tidying them up, the need for these samples might be
less… hmm… I just hate posting code that I’ve never polished, it is like
having company over without cleaning up. Thoughts?

IsNumeric, Microsoft.VisualBasic.dll, etc.

Sean and Scott’s


earlier posting

on IsNumeric has resulted in a few comments…
and I just need to chime in here, use Microsoft.VisualBasic! It is all IL in the
end, right? This topic comes up over and over again on


GotDotNet

, and I just
want it to go away! Almost always, someone writes up and posts a C#
implementation of IsNumeric that might be useful, but it is not equivalent to
the function from this assembly. Why write your own, incorrect or incomplete,
implementation when a highly-tested one is shipping with the Framework? Are you
going to do the same for all of the functions in the Framework?

Microsoft.VisualBasic.dll is an assembly, it ships
with .NET, it provides useful functions… the decision to use it or not
shouldn’t be any more difficult than deciding if you are going to use any other
useful assembly. If you dig into the IL and you don’t like what it does, fine…
but I hope you are applying the same standard to all of the libraries you
use.

Counting lines of code…. why?


From time to time, when I’ve shown someone a
system I built, I’ve been asked “How many lines of code is that?”… and my
answer has always been the same… “I have no idea”.

I’ve never even tried to count the lines of code in a project, and I have no
idea why I would. Jason mentions in his post that some
people have to account for their lines of code produced in a day and I think
that is absolutely crazy. So if you write more lines of code, you are a more
productive employee? I hate to point out such an obvious point, but I’d like to
think that the important point is how many bugs you fixed or how many features
you completed…. regardless of how much typing it required.

Oh well, at least I don’t have to count my lines of code… and I don’t
intend to ever start. It is worth pointing out, since I am mostly a writer these
days, I don’t count the words in my articles (or pages) either. The exception
would be if I was being paid by the word, but as a general rule I don’t like to
pay or be paid by the word/page… pay me to cover a topic to a certain depth
and that should be enough. If I hand in 2 pages and you expected 20, read the
pages… did I cover the material, if not then don’t pay me… ok, now I am
rambling so I had better hit post…

 

Another little code snippet

Whenever I have to
code a “real” project, I end up building a bunch of components to deal with anything that seems
likely to reoccur
. Sometimes the class or Windows Forms control I’ve created
never gets used again, but often I end up using them in a whole bunch of
additional apps. Anyway, I think I’ll post some of these little bits of
development work to my blog when it seems useful enough, and perhaps other
developers will be able to find this code when they are looking for some help.

This particular piece of code is
pretty simple; it is just a small extension to the LinkLabel class to allow it
to handle launching the appropriate link when clicked.

 

     
public
class
ClickableLinkLabel : LinkLabel

     
{

 

        private string m_URL =
“about:blank”;

 

           
public
ClickableLinkLabel()

           
{

           
}

 

        protected override void OnLinkClicked

           
(LinkLabelLinkClickedEventArgs e)

       
{

           
ProcessStartInfo psi

               
=
new
System.Diagnostics.ProcessStartInfo(m_URL);

           
psi.UseShellExecute =
true;

           
System.Diagnostics.Process.Start(psi);

           
base.OnLinkClicked(e);

       
}

 

        /// <summary>

        /// Represents the link to
be navigated

        /// to when the label is
clicked

        /// </summary>

        public string
URL

       
{

           
get

           
{

               
return
m_URL;

           
}

           
set

            {

               
m_URL =
value;

           
}

       
}

     
}