Tuesday, April 2, 2013

ASP.NET Persistent session state with Riak

Hello World,

Many of us have faced this pertinent question of choosing a persistent storage for ASP.NET session state, especially if you've worked with high usage e-commerce websites. During my research for an elegant yet simple to implement solution that does not overburden the production SQL server, I landed on this post by Jeremiah Peschka.

As Jeremiah highlights, the solution proposed meets the requirements on durable and fault tolerant session state with a ton of enterprise class features.

The core tool used is an open source key value database (never knew there was something like that :-)) called Riak.

I will try to dig deep and do a follow up post on how the experience is with a basic implementation using Riak as the session store.

Happy Coding!

Finding out who is active with your MS SQL Server Database

Hello World,

I was trying to research how to quickly (and easily :-)) find out what is currently active on a particular database instance and landed on this excellent post by Brent Ozar. He describes in a short, crisp video a tool called sp_whoIsActive created by Adam Machanic. You need to run the SQL script on your master database and once done, fire it from the context of the database you are interested in:

EXEC master..sp_WhoIsActive

You would get this nice result window:



Happy Coding!

Wednesday, August 22, 2012

Some MSDN Blogs of interest

Hello World,

This is actually a note to myself about some blogs that I found interesting (or more interesting, 'cause ideally I would love to be able to read everything there is on that site! - alas a day has only 24 hours : ))

Vishal Joshi’s Tangent (ASP.NET)

WebDev Blog 

Scott Hanselman

This very interesting post on universal providers (launched with VS 2012) - here
There is off course the perpetual favorite in Scott Guthrie's blog  

Performance tidbits by Rico Mariani

Then there is MSDN Blogs home : )  

Happy Coding

Monday, August 20, 2012

VS 2010 Dark Theme et al

Hello World!


              So I got a taste of dark theme while playing around with VS 2012 RC made available by our application life cycle maintenance team. It looks cool, and to be honest the greatest cool quotient is contributed by the fact that the theme is easy on the eye. For someone who stares at monitors almost the entire waking up day, that is a big one!
 
            I got down googling as to how I could get a good (tested : ) ) dark theme for VS 2010 and got these resources:
  1. Collection of themes for Visual studio: studiostyl.es
  2. My personal favorite (thus far): Dark Studio
  3. Stackoverflow tip on how to import the theme HERE
 The reason I chose Dark Studio is very clear: keywords, comments and highlighting is legible. What I also discovered is that when you hover over an outlined section's node, the entire section is highlighted:
 
 
For the ones who care: dark themes save energy as the display takes less power to show them!
 
Happy Coding

Friday, August 17, 2012

VS 2010 Freezing during Auto Save

Hello World,

           We use Virtual Machines (VM) for some of our development work. These VMs are hosted on a server that is geographically far off (I'm in India while the VM server sits in Western Europe). Time and again there are some applications that do not quite match up with how they would behave on a local desktop. Visual Studio is one such app.
           On my VM, I had this particular issue that when VS was trying to "Auto Save" the project and solution, it would hang up and not respond for some time. I googled up to find out if I could somehow reduce the frequency of auto save and found this blog.
PS: Although the blog talks about VS 2005, the option to set the auto save frequency is located at the same menu in VS 2010. (for a change :))

Happy Coding!

Wednesday, August 15, 2012

Windows developer power tools

Hello World,

Discovered this great book - Windows Developer Power tools and its companion website. There are a host of open source tools here that would make the life of any developer better. I will try to post about tools as I discover them but there's one which caught my eye straightaway: An MSI Content viewer/extractor called Less MSIerable (have to commend the choice of name :))

It is also worth taking a look at this list of most loved tools.
I've ordered a copy of this book from here. Can't wait to lay my hands on it!

Happy Coding!

Tuesday, August 14, 2012

C#: Keeping your stored procedure names maintainable

Hello World,

Necessity is the mother of invention (oft repeated but very true) - as your hair starts greying, (and hairline begins to recede ;) ) you suddenly start to realize the weight of these adages.
One such necessity arose out of my observation that stored procedure names were scattered all across a codebase I was working with. If you ever wanted to change the name of a stored procedure used some context, you had to search the entire codebase and replace all occurances. I did not like this approach and came up with the below approach:

  1. Create a type that holds stored procedure names grouped by module
  2. Read the name of stored procs from this type everywhere else. Now if a change is required it is in one sinlge place
 A sample is given below:


   1:  /// <summary>
   2:      /// Holds the names of stored procedures used by the application
   3:      /// </summary>
   4:      public static class Commands
   5:      {
   6:          /// <summary> Holds the commands to fetch configuration data </summary>
   7:          public static class Config
   8:          {
   9:              /// <summary> The Command to Get a list of websites that are to be processed </summary>
  10:              public const string GetWebsites = "dbo.GetSomeConfig";
  11:   
  12:              /// <summary> The command to get website specific configuration by it's name </summary>
  13:              public const string GetWebsiteConfiguration = "dbo.GetSomeMoreConfig";
  14:          }
  15:   
  16:          /// <summary> Holds the commands to fetch Auth data </summary>
  17:          public static class Authentication
  18:          {
  19:              /// <summary> The command to fetch auth info </summary>
  20:              public const string GetAuthenticationType = "dbo.GetAuthType";
  21:   
  22:              /// <summary> The command to validate user </summary>
  23:              public const string ValidateUser = "dbo.ValidateUser";
  24:   
  25:                  }
  26:   
  27:          /// <summary> Holds the commands to fetch related data </summary>
  28:          public static class AnotherModule
  29:          {
  30:                        // More names here
  31:                        ...
  32:          }
  33:      }

Now code that looked like this:

   1:  var cmdConfigSettings = new SqlCommand("dbo.GetSomeConfig", connString)
Will look like this:

   1:  var cmdConfigSettings = new SqlCommand(Commands.Config.GetWebsites, connString)
Happy Coding!