Tuesday, March 08, 2005

This isn't something I would normally blog about, but in this case I can't really make an exception.

Tonight we went out to eat and had what was perhaps the best meal that I've ever had...period.  We went to a small Italian restaurant called Buon Appetito on India Street in San Diego.  I had the cheese and spinach ravioli and the house salad.  Bar none both were fantastic!  I have never had such delicious ravioli in my life and the salad was perfect (love the dressing).

The next time I'm in San Diego I will undoubtedly make the stop again.

Tuesday, March 08, 2005 4:28:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Saturday, March 05, 2005
Well, here we are at the Microsoft Partner Briefing Convergence 2005 conference.  It's pretty exciting.  Last year we debuted our product offering at the Microsoft Partner Briefing in Toronto, Canada and it was a blast.  It was so very exciting to see the energy behind CRM.  We've had TONS of excitement behind our product offering since and we're expect the same or more from this conference in San Diego.  In you're in town attending the conference don't forget to stop by booth #717!
Saturday, March 05, 2005 9:34:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, March 03, 2005

Getting back in the groove...

I've been out of town for a week now (one more to go :)) so I haven't had much of a chance to get on and blog - though I've had a ton of thoughts and things I've wanted to blog about...but that's for another time.

This time, however, I wanted to get online and present an update to my .Text Blog Rating control.  As readers may already know, several weeks ago version 1.0.0.0 of the rating control was made available for the general populace.  I've (finally) taken the time to update it to version 1.0.1.0 and add several capabilities to it (I'll be getting it up on my blog momentarily - as soon as I get a chance!).

Of the new features these are the most notable:

1.  A 'Top Rated Posts' control that presents up to the top 20 highest-rated posts on the site.  This control behaves like an ASP.NET Repeater (in fact, it derives from it), so you can designate header, item, footer, etc templates.  The properties you can bind to include Id, AvgRating, DateAdded, NumRatings, Title, and Url.  Simply use the standard <%# DataBinder.Eval(Container.DataItem, “propertyname“) %> syntax and you're set...there are, of course, alternatives to this approach.  The TopRatedPosts control has a property called MinVotes that allows you to filter the list based on posts that have received a certain # of votes.  For example:

<devstone:TopRatedPosts runat=server minvotes=2>
   <headertemplate>
      <div class=listtitle>Top Rated Posts</div><ul class=list>
   </headertemplate>
   <itemtemplate>
      <li class=listitem>
         <%# DataBinder.Eval(Container.DataItem, "AvgRating", "{0:0.00}")%> - <a class=listitem href=<%# DataBinder.Eval(Container.DataItem, "Url")%>><%# DataBinder.Eval(Container.DataItem, "Title")%></a>
      </li>
   </itemtemplate>
   <footertemplate>
      </ul></div>
   </footertemplate>
</devstone:TopRatedPosts>

2.  A 'View Comments' link on rated controls.  This will popup a small window (akin to the rating window) with a bar graph illustrating the rating distribution and comments associated with the ratings.  Once aspect of the rating control that is somewhat unique is that it provides a mechanism for users to rate other users' comments and trackbacks.  However, until this release you could not see those comments - that's now been remedied.

3.  Miscellaneous enhancements.

There are some tweaks to the database and they are included in the database script.  These changes alter a few stored procedures and create a few new ones.

The web.config file will also need to undergo a small change in the <HandlerConfiguration/HttpHandlers /> section.  Those changes are also documented within the download.

Therefore, I present to you version 1.0.1.0.  Feel free to provide feedback and input as I'd love to make this product better in any way.

Have fun!

Thursday, March 03, 2005 6:11:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [4]  |  Trackback
 Thursday, February 24, 2005

Ok, I'm kind of a sucker for these kinds of tests - it's always interesting how people compare and, with a little introspection, see how accurate or off-base the results are.  In my case, I'd say it's pretty close, at least after one take.

Cattell's 16 Factor Test Results
Warmth |||||||||||||||||||||||| 74%
Intellect |||||||||||||||||||||||||||| 86%
Emotional Stability |||||||||||||||||| 54%
Aggressiveness ||||||||||||||||||||| 66%
Liveliness ||||||||||||||| 50%
Dutifulness |||||||||||||||||||||||||||| 86%
Social Assertiveness |||||||||||||||||||||||| 78%
Sensitivity ||||||||| 30%
Paranoia ||||||||||||||| 50%
Abstractness ||||||||||||||| 50%
Introversion |||||||||||||||||| 54%
Anxiety ||||||||||||||||||||| 62%
Openmindedness ||||||||||||||||||||| 66%
Independence ||||||||||||||||||||| 70%
Perfectionism ||||||||||||||||||||| 70%
Tension |||||||||||| 34%
Take Cattell 16 Factor Test (similar to 16pf)
personality tests by similarminds.com
Thursday, February 24, 2005 5:10:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, February 23, 2005

Maybe it's late or I'm just giddy...this struck me as hilarious.  I almost fell out of my chair.

Maybe I'm due a nice, smooth, refreshing cup of Nescafe Granulated FoodService Blend myself...then again, maybe not ;)

Wednesday, February 23, 2005 4:10:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, February 22, 2005

I am inspired by a post by Bill (William?) Ryan.  I responded to his post with a quick comment, but since submitting my response I have been somewhat introspective into the types of music I listen to and how productive I am.  Some music really grates on me while I'm working, whereas when not coding it's perfectly acceptable.  I have about 13 GB of WMA files on my media server (all ripped from CDs that I legitimately own) and it's quite a mix of songs.  While I have playlists and such, I'll often stream down songs randomly.  It gets weird sometimes to listen to one song with a pretty heavy beat to suddenly switch to Julie Andrews singing a song from Camelot and switch over to some dance beat and then a Latin ballad.  I love all the music, but I find that I'm substantially more productive if I a) don't listen to anything so I can focus on the code or b) listen to a certain genre of music or c) I forget, I'm listening to music right now and I'm distracted.

Anyhow, here's a sampling of some of my favorite music to code to.  I'd be interested in your comments and what kind of music gets you going during a code-jam session.

Favorites (preferred highlighted):
   Alanis Morrissette
   ABBA
   Alicia Keys
   Alison Krauss
   Avril Lavigne
   Barry Manilow
   Bon Jovi (especially from the 'Slippery When Wet' era)
   Cesaria Evora (enchanting voice)
   Depeche Mode
   Enigma
   Enya
   Eurythmics
   Faith Hill
   John Denver
   Josh Groban
   Julie Andrews
   Laura Pausini
   Lucero
   Luis Miguel
   Mana
   Maroon 5
   Norah Jones
   Peter Gabriel
   Ricardo Montaner
   Rick Wakeman
   Sarah Brightman
   Sheryl Crow
   Tears for Fears
   The Carpenters
   The Doors
   They Might Be Giants
   U2
   Weird Al Yankovic

There's a wide range of music I'm not mentioning here (such as classical music, Broadway (e.g. Les Miserables, Jekyll & Hyde, etc), and showtunes) because the list it too long and kinda all falls into the category of 'I love to listen to it anytime' anyway.

What music do you do your best work to?

Tuesday, February 22, 2005 2:59:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |  Trackback

Ok, this may be old hat and I'm the last on the planet to discover this, but I'm pretty excited!

Since my induction into the .NET world (which was graceful and without incident) I have had a beef with one aspect of it - Type visibility.  If I create a Class Library (aka DLL) and create public types, I really can't designate who can use those classes. - they're open to the world.  Ok, ok, there are ways to enforce this such as by applying the StrongNameIdentityPermissionAttribute to the type.

The StrongNameIdentityPermissionAttribute (SNIPA, affectionately) is a pretty slick attribute that you can apply to a variety of things: assemblies, classes, structs, constructors, and methods.  This attribute effectively marks the item as useable only by a client with a given strong name.

Demonstration of how to use the StrongNameIdentityPermissionAttribute:

1.  Create your strong name (e.g: sn -k KeyFile.snk) for your client application.

2.  Sign your client assembly with the strong name (e.g: [assembly: AssemblyKeyFile(@”..\..\KeyFile.snk”)])

3.  Set a reference to the DLL (class library) in the client (note, it will have to also have a strong name so follow steps 1 and 2 for the DLL, possibly reusing the .snk file if you want)

4.  Identify the class / method / etc that you only want to be callable by the client application.  This is the item to which you will apply the SNIPA.  A simple way to identify the strong name for the calling client is to retrieve it's public key.  This is done against the compiled client .exe/.dll (e.g:  secutil -hex -s ClientApp.exe or sn -Tp ClientApp.exe) [Updated 02/23/2005 - Didn't want to forget the sn.exe utility].  This will output the public key in hex format.  Copy and paste it into your code:

using System.Security.Permissions;

namespace ClassLibrary1 {

   [StrongNameIdentityPermission(SecurityAction.Demand, PublicKey=”......”)]
   public sealed class Class1 { ... }

}

There really isn't much more to it than that.  Only clients signed with the specified strong name will be able to create instances of the designated type and call its methods.  Pretty slick stuff.

There are a few caveats and restrictions, however, with using the SNIPA.

1.  Firstly, SNIPA applies only to one type.  That is, if you have multiple types that you want to share with a designated strong-name-signed application, you must mark each and every type individually, otherwise they're public to the world.

2.  Secondly, the items flagged with the SNIPA must be public.  They cannot be internal types.

3.  You can designate only one SNIPA per element; you cannot identify two different strong names.  You have one friend and that's it.

Today, I made a great discovery that I thought worth sharing, and this brings me back to the original purpose of the post in the first place.  In the Whidbey timeframe you will be able to designate friend assemblies with a fantastic attribute called InternalsVisibleToAttribute.  This attribute can be applied to your assembly thus:  [assembly: InternalsVisibleTo(”...”)].  One nice and enabling characteristic of this attribute is you can apply it multiple times to your assembly to designate multiple 'friends' unlike the SNIPA with which you can only designate a single category of friends: those with a given strong name.

The coolness behind this is you can create types that are internal to your application, and now internal can actually extend beyond the scope of your DLL and into your 'family of products' without exposing unnecessary objects and types to the public world.  I am SO excited for this feature as I was wanting to take advantage of such functionality since the beginning.

Way to go .NET team!

Tuesday, February 22, 2005 2:13:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [4]  |  Trackback
 Saturday, February 19, 2005

[Updated 06/22/2006 - fixed typo in code]

Lately, I've been debugging an issue in an application that I wrote that was a bit frustrating, though until today I've pretty much ignored the error.  I decided to bite the bullet and dig in and try to figure out the problem.

I have an application that creates some datagram (UDP) endpoints using the Socket class found within the System.Net.Sockets namespace.  As it turned out, there were times during my application's execution path in which the sockets would suddenly stop responding, though the port was still open (this could be ascertained via netstat or TCPView).  To make the situation more perplexing, I had another application that used the exact same objects and it didn't exhibit the same behaviors - it continued to run as expected.

So I dug in a bit and within about 30 seconds figured out the problem - at least what was causing the problem:  the point at which the application always had this problem of stopping to respond it would always send a datagram packet to localhost (127.0.0.1) to determine if it could find a particular listener/host.  Well, if I had a listener at localhost there was never a problem, but if no socket was bound to that endpoint my UDP socket would throw a SocketException during the EndReceiveFrom().

I put together some tests and found that the WinSock error being thrown was WSAECONNRESET; in other words the socket was forcibly closed by the remote host.  This was disconcerting for a little while, but I found that if I simply called BeginReceiveFrom() again, it would be up and running - but this wasn't necessarily the right fix.

Microsoft made some changes to their WinSock implementation between Windows NT 4.0 and Windows 2000.  One of these was that the Recvfrom() function would return WSAECONNRESET instead of continuing to block or time out if the sendto() function resulted in an “ICMP port unreachable”.  In other words, if you sent a datagram to a listening port all was cosher and behaved normally, however, if you attempted to send a datagram to an endpoint without a listening application, a pending/blocking call to Recvfrom() would throw.  Previously, my SocketException handling code would simply return without attempting to re-listen, assuming that if the error were received the socket was closing down.

It is possible, fortunately, to achieve Windows NT 4.0 behavior rather than having the socket return an error result.  This is accomplished by calling the WSAIoctl() function in Ws2_32.dll.  Well, if you're writing code using the .NET framework, it's not necessary to dip down into P/Invoke to call the function, but rather you can use the IOControl() method on the Socket class.  The key lies in passing in the control code of SIO_UDP_CONNRESET and a value of False (0) to turn off the 'new', Windows 2000 behavior - thus restoring the expected Windows NT 4.0 behavior.

const uint SIO_UDP_CONNRESET = 0x9800000C;

It's interesting, and I feel unfortunate, that the IOControl() function accepts control codes of type Int32.  Many of the control codes are UInt32 values.  So instead of taking the default value for SIO_UDP_CONNRESET and passing that in (which we can't because it's out of the range for an Int32), we must take the same value and convert it to a signed value.

// 0x9800000C == 2440136844 (uint) == -1744830452 (int) == 0x9800000C
const int SIO_UDP_CONNRESET = -1744830452;
byte[] inValue = new byte[] { 0, 0, 0, 0 };     // == false
byte[] outValue = new byte[] { 0, 0, 0, 0 };    // initialize to 0
_socket.IOControl(SIO_UDP_CONNRESET, inValue, outValue);

Simply make that call during the initialization of the socket and the WSAECONNRESET error will not be raised when a datagram is sent to a closed/invalid end point.

Happy coding!

Saturday, February 19, 2005 5:22:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Thursday, February 17, 2005

I found this brief essay online today and it's definitely worth the read.  I've mentioned some of the tenets in past posts, but I whole-heartedly agree with Michael's assessment of the life and lifestyle within Microsoft.  Granted, though I was not on a product team or working on-campus as I was in our Salt Lake City branch office, much of what he said was directly applicable.

Individuals within the halls at Microsoft have a passion and a focus for software.  Software is the bread and butter of everything.  There is very little paperwork at all - pretty much everything besides the periodic reviews and printed expense reports (which simply provide a backup to the electronically filed expense reports) is done via software.

The two downsides that Michael mentions that stood out to me are Work/Life Balance and Managers.  He's spot on.  It seems that while the mantra is that one should strike a good, healthy, working balance between work and family life, it is the tendency of managers to judge that work is more important if you had to make a decision (of course it didn't help that my managers were in the Denver office).  Any decision to the contrary is detrimental to your review scores.

He mentions that 'most of lower management should be tossed'.  I'm behind him there.  In fact, I feel that's a big part to my being disillusioned in some respects.  Don't get me wrong, I love the leadership (BillG, SteveB, etc) and a select few of middle/upper management, but my direct managers left a lot to be desired and are probably the primary reasons and catalysts as to why I left in the first place.  I strongly feel that I'd work for MS again if I were to have different (and local) management.

All in all, a very good post.

Thursday, February 17, 2005 5:31:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback