Archive for June, 2005

Where were I? (StackTrace Class)

On my current
project we wished to impersonate a WebService for test purposes and decided to record
live messages using XmlSerialization. For the first few messages I manually implemented
code to serialize to a file. This cut-and-paste reuse obviously had to be refactored
but I was unhappy manually passing in the filename to every call of the new method
since the files are named the same as the webmethod. Somehow the generic serialization
code needed to know who called it, or to put it in Jerry’s terms it had to ask ‘Were
were I?’. Jerry replied
to my first ever blog post and finally I got a chance to use his suggestion:

http://dotnetworkaholic.com/PermaLink,guid,692ca362-89cb-4dad-985f-92aea92ca96b.aspx

http://www.codeproject.com/csharp/customtracelistener.asp

The crux is the
StackTrace class which resides in the System.Diagnostics namespace. It is exactly
as you might expect – very simple when you know it exists but I believe it would be
hard to find using Google etc.

This is the code
snippet I used after re-reading Jerry’s Code Project article:

#region Get the
calling method (“Where were I” – courtesy of Jerry Dennany)
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
string methodName = “unknown”;
if (st.FrameCount > 0)
{
System.Diagnostics.StackFrame sf = st.GetFrame(1);
methodName = sf.GetMethod().Name;
}
#endregion

Being a stickler
for simplicity I read the MSDN help and reduced the code to:

#region Get the
calling method name (“Where were I” – courtesy of Jerry Dennany)
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, false);
string methodName = st.GetFrame(0).GetMethod().Name;
#endregion

I am not sure
that my employer will be sending a Mr. Dennany a check anytime soon, but I appreciated
the helpful article. This is a good reminder of why we ‘waste’ so much time with blogs.





We only work with Microsoft Certified Architects

Just a heads-up. Love or hate certifications we will likely be hearing that
next year for any senior .Net position. Even if you are already MC*.* you don’t have
this one which is coming next year:

http://www.microsoft.com/learning/mcp/architect/

I stumbled across this while researching MCDBA. Apparently if you are an already MCSD,
only two more exams are needed for an MCDBA. It is probably worth the $250 + a
couple of months study time – yes Dave I am a slow learner ;)

Radio Me Channels you should be listening to

Two important points here:

  1. Radio Me is a term coined by Peter Day of the BBC for what was formerly known as podcasting. English media appears to bending over backward to never say the word iPod or podcasting
  2. If you have a commute more than a few miles each day and are not listening to Radio Me then stop reading right now and order a portable MP3
    player
    asap -an iRiver or an iPod are probably the best options (iPod may
    not good if you listen to music because of Apple’s iTunes store lock-in, I consume
    free podcasts + do a lot of running so the iPod mini was perfect)

Ok, you have an MP3 player. Now go and subscribe to feeds. There are many clients
out there that will auto download new ‘RadioMe transmissions’ in the way your
aggregator gathered this blog post. iPodder is
a good one to start with – it works with any mp3 player and works flawlessly
with my iPod Mini (which cannot
bookmark MP3s – aarghhh, bloody marketing – that’s why I bought it).

In a year of listening to Radio Me this is what I think all my .Net buddies
should at least try:

IT Conversations Far better than all other technical podcasts combined! Many episodes every week which are often open source focused, but we all need to know
what is happening outside of .Net. Many broadcasts are recordings from IT conferences
or interviews with extremely successful individuals. Steve Wozniak and Jerry Yang episodes
that immediately come to mind. Where else would you get to listen to people like this?
It is also interesing to realize how little Open Source people bash Microsoft
nowadays – Apple receives far worse treatement.
This Week in Tech Leo Laporte + friends from The Screensavers discuss the latest happening in Tech.
They are not 100% Geek compared to most of us ‘in the trenches’ and their minor
mistakes with details will irk you. Shortcomings aside, this bunch are very enteraining
and keep me abreast of new happenings. Presently this is a firm number two on
listening list.
.Net Rocks (AAC
Feed)
Our local hero and possibly the friendliest face in Atlanta’s .Net community Mark
Dunn
helped start this one. Since Rory left
the show it is not quite the same, but many episodes are still stellar. Ted
Neward ‘vs’ Don Box
including ORM, Java, Spring etc is great one to start
with – rest your mind before listening.
Slashdot Review Most .Net people sneer at /. Every other techy in town seems to rave about
it. IMO spending five minutes a day listening to the best posts is proving well
worth the time.
Daily Source Code Adam Curry – the Robert
Scoble
of Podcasting Radio Me. Adam is not so technical and freely
admits it. Living vicarously it feels like I experience his multi-million dollar
lifestyle a couple of days every week. He is the most entertaining podcasters out
there, yes IT Converstations will teach you much more but do give this whirl.
BBC:
From Our Own Correspondent
Since leaving Woking, England I am have become more American every day. This BBC broadcast
really reminded me of this, so I force myself to listen. It is not technical at all,
but for anyone interested in life outside of the USA give this a whirl. The BBC broadcasts
quite a few shows on RadioMe – exPats may like it, I felt almost homesick for the
first time in ten years :)

Yes, that is the list, notice how short it is? I have about ten more shows I
listen to regularly, but none I would strongly recommend to anyone else. Just like
blogs there are a many Radio Me broadcasters, but making quality audio appears
to be much harder than buying a $40 microphone – the best all have a background in
TV or Radio. Within a year I think Radio Me will have circa twenty well known
technical shows with others trying for a while then fading (back
to blogging?). As an example you have time to scan my ‘F-List’ blog in a few seconds
to evaulate if a post is worth reading. Listening takes much more effort.

Final point on in car use of MP3 players: Transmitters are OK if you are patient trying
different frequencies, but drain the battery and do drop out occasionally. I bought
a ‘Head Unit Aux Adapter’ from my dealer ($40!) + dismantled the dash and connected
it to the stock radio. I hear Best Buy etc will do the work, but personally it took
30 minutes install time which was fine apart car looking like this for a
few minutes: