Archive for March 2009

Boulder Java User Group Meet, March 10

I went yesterday to see my friend Eric Wendelin speak about javaFX at the BoulderJUG meeting.   Eric did a great job with a fresh and informative presentation.   Also on tap was Tim Berglund giving a talk about Liquibase and Database Refactoring in general, good job.

Since we are on the topic of java, why not check out the new jQuery talk by young Dmitri.

Boulder tech meetup, March 3

I Went to the Boulder tech meetup on Tuesday as usual a good crowd.  For the the first time there was additional room on the second floor, that is if you care to watch the video feed up on the second floor from the first floor.

There were two companies that looked interesting to me Tendril and eSpor,  check them out.  Auditconfirmations should also have a bright future ahead of them.

The prsenters,

Governor’s Innovation Council pitch to Silicon Valley Presented by Brad Bernthal
AuditConfirmations presented by Dan Zitting and Ben Reubenstein
Tendril presented by Kent Dickson
eSpor presented by Jason Graves
myusearch.com presented by Elizabeth Kudner

Asp .net ViewState can be evil

My friend was telling me about how evil ViewState can be when dealing with ASP pages. As I’m new to the .net version of ASP pages I went investigating a little further. Taking a look at my sample two posts ago. Sure enough I’m guilty as charged, it turns out that the state of your controls in your ASP pages is automatically put into the ViewState bucket. In other words if you have large controls with a lot of data such as grids or lists your ViewState will include all of that data held by the control. With that said all of the data will travel between your server and the client on all round trips. It is a big waste of bandwidth.

At first I started up Fiddler which allows you to see the real http data transferred. If you do not yet have Fiddler in your toolbox you should check it out, it’s a great tool. However it doesn’t allow you to examine the ViewState in detail as the tool is more generic.

I did the google and came up on another tool, ViewState Helper Viewer it does exactly what I needed. It shows you the size of your ViewState and further you can drill down on it with a double click which will break the ViewState down into the variables that it’s holding, good job by the author Jon Tackabury. Jon has actually a couple of other impressive tools. As I’m writing this I realize that Jon already wrote ViewState plugin for Fiddler, which is great, I have to check that out.

So let’s take a closer look at the webpage, as seen in the viewer
viewstate2

As you can see at first on the highlighted row, the size of the ViewState is substantial. It is about 31% of the whole page, 15K of worthless data traveling to and from the client on each roundtrip, not good. In order to cut down on the size, simply add an attribute to your control in the html code, EnableViewState=”false”. This will instruct ASP .net not to include the state / data of the control in the ViewState bucket. As I applied that to the grid control you can see the next line above shows much better results than before. Then I further applied it to other controls on the page and now we are down to 456 bytes from 15,184.

If you want to read in depth analyzes of the ViewState and how it works in .net you might want to wander over here. For most pages you might just have to set the EnableViewState attribute on your controls, but for more advanced cases you might have to drill down further.

Sean thanks for being the devils advocate.