Showing posts with label Development Tips. Show all posts
Showing posts with label Development Tips. Show all posts

Wednesday, 30 March 2011

How Can I Tell Which Properties Have Changed

In the Properties tab within the Visual Studio IDE, any property which has been changed from its Default value will display that value in Bold font:


Saturday, 19 March 2011

Broswer Detection

A lot of sites these days rely on client side scripting language Javascript.

A great framework to create rich user experiences on the web.

The problem with this is well known: broswer implementations of Javascript differ from the standards and from each other.

It is for this very reason that makes browser detection unreliable.

In effect the problem itself recursively makes the solution unobtainable. WHAAAT???

What i mean is: detecting the browser correctly relies on that same browser implementing some sort of function which tells you its identity. Now if every browser wrote a different function to do this, you would need to know what that function is in advance in order to call it.

Therefore, your code will never cater for anything new unless it happens to implement the identity function in the same way as another browser that you already cater for.

The solution options:

1. Choose which broswers to support and stay up to date with their implementations of the identity functions. Use these functions to identify the chosen broswers your supporting and tell everything else that they:
a. Can't use the site until they update
OR
b. Can use the site with the acknowledgement that it may not function correclty.

2. Write a script which attempts to capture all current browsers implementations of the identity functions. If user has a browser outside of your supported set, let them know what their browser has identified itself as and they:
a. Can't use the site until they update
OR
b. Can use the site with the acknowledgement that it may not function correclty.

Peter-Paul Koch has written a sophisticated broswer detection script - Click Here To See.

Thursday, 3 February 2011

How to inspect Session contents in Visual Studio

Wouldn't it be nice if you didn't have dig deep into the Session object when all you want to do is inspect it's contents?

Well, until that becomes an available option in Visual Studio, keep this little code snippet close by, insert above a breakpoint at which you want to inspect the state of the Session and then put a Watch (right click, Add Watch) on the Dictionary sessionValues:


Dictionary<string, object> sessionValues = new Dictionary<string, object>();
foreach (var key in HttpContext.Current.Session.Keys)
sessionValues.Add(key.ToString(), HttpContext.Current.Session[key.ToString()]);