August 2003 - Posts

Talk to your Users like they may be the CIO

I have an interesting story from work today.  First, this is just my second week at PRG-Schultz.  I know who my manager is, and I know his boss, who is a VP in the IT division, but that's about it.  I know I've been told lots of other names, but I'm not good at names, and I probably don't really care either.   Now I've already been working on one project, and I had put together a simple prototype.  I've met one chief user, and my coworker showed my prototype to him yesterday.

So this morning, someone comes up to me and says his name is Eric and he's heard I had a prototype of this app he'd like to see.  Sure thing, no problem -- I assume he's one of my other users.  He mentioned something about all the books I had, and I mentioned I get lots of them free to review, and then he talked like he had been involved in the publishing industry.  He seemed like a nice enough guy, and seemed to like what I had to show him.  I asked him his last name again, since I had forgotten it.

After he leaves, the guy across the alley asks me if I knew who that was.  Turns out Eric Goldfarb is the CIO of PRG -- oops, I knew his name sounded familiar.  Oh well, I didn't do anything embarrassing, and I certainly wasn't nervous, so all in all it was probably the best way to meet him anyhow.  I googled his name tonight -- Eric is one of ComputerWorld's Premier 100 IT Leaders for 2003!  He's been CIO of Global Knowledge and CTO of Macmillan Publishing too.

So, the moral is to always talk to your users like the may be the CIO -- in my case he actually was!

Posted by PaulWilson | with no comments

Update on my Coding Standard for .NET

My second week at PRG-Schultz is now just about over.  I finished my coding standard for all new .NET development and we went over it today.  It went pretty well for the most part, although that's probably equally attributable to my manager as to my work.  As for my part, since I just summarized and referred to the MSDN docs and other similar standards, its hard to argue with the rest of the .NET world.  I think the existence of FxCop for easy self-checking also won a few people over, since it doesn't mean lots of policing.  The consultants on the team were probably the most receptive of all, even though one wasn't involved with .NET and the other is still rather new to it.  They are just more used to change and some type of client standard or other expectation.  On the other hand, I have a most excellent manager (are you reading this Frank?) that actually did a little research and calls to others to prove to himself that this really is the industry standard in .NET.  As a result, he prepped the team so that it was understood it was a done deal and not open to much change, although gripes were more than welcome this one time.  One person that had told me he would not change seemed content with accepting it, and one other is what I suspect is the one that every shop has.  But it went real well overall, and so far they appear to be a very solid team, evidenced even more by a team-building session we had yesterday.  Some of them are going to be very new to .NET, as this is a very diverse team, but I think we'll make it.

Posted by PaulWilson | 2 comment(s)

Tip on Getting ViewState past Some Proxies

Yet another tip on viewstate from a reader of mine, Cliff Harker.  Basically, there are some proxies out there, including AOL apparently, that cut off any hidden fields that are greater than some size.  This obviously screws up viewstate, so this code breaks viewstate up into multiple smaller fields to get around this problem:

protected override object LoadPageStateFromPersistenceMedium()
  LosFormatter format = new LosFormatter();

  int cnt = Convert.ToInt32(Request["__VIEWSTATE0"].ToString());
  StringBuilder s = new StringBuilder();

  for (int i = 1; i <= cnt; i++) {
    s.Append(Request["__VIEWSTATE" + i.ToString()].ToString());

  return format.Deserialize(s.ToString());

protected override void SavePageStateToPersistenceMedium(object viewState)
  LosFormatter format = new LosFormatter();
  StringWriter writer = new StringWriter();
  format.Serialize(writer, viewState);
  StringBuilder s = new StringBuilder(writer.ToString());

  int cnt = 1;
  int left = s.Length;

  while( left > 0 ) {
    //Change to any value other than 1000 as necessary
    int cut = (left > 1000) ? 1000 : left;

    RegisterHiddenField("__VIEWSTATE" + cnt.ToString(),

    s = s.Remove(0,cut);

    left -= cut;

  RegisterHiddenField("__VIEWSTATE0", cnt.ToString());
  RegisterHiddenField("__VIEWSTATE", "");

Posted by PaulWilson | 1 comment(s)

Tip on Saving ViewState on Server

Here's a tip relating to saving viewstate on the server I received from Johan Åhlén:

Thank you for a good article on how the viewstate works!

I have also been experimenting with how to save the viewstate to the server.  Just having a session variable holding the viewstate results in the problem that the viewstate gets out of synchronisation with the page if users click back, etc.  What has worked best for me so far is storing multiple viewstates in the cache, and having a hidden field on the page telling which viewstate to use.  A possible improvement is to reduce memory usage by reducing the number of simultaneous viewstates that each user can have.

protected override void SavePageStateToPersistenceMedium(object viewState)
  // Generate unique key for this viewstate
  string str = "VIEWSTATE#" + Request.UserHostAddress
      + "#" + DateTime.Now.Ticks.ToString();
  // Save viewstate data in cache
  Cache.Add(str, viewState, null, DateTime.Now.AddMinutes(Session.Timeout),
      TimeSpan.Zero, CacheItemPriority.Default, null);
  RegisterHiddenField("__VIEWSTATE_KEY", str);
  // Keep the viewstate hidden variable but with no data to avoid error
  RegisterHiddenField("__VIEWSTATE", "");

protected override object LoadPageStateFromPersistenceMedium()
  // Load back viewstate from cache
  string str = Request.Form["__VIEWSTATE_KEY"];
  // Check validity of viewstate key
  if (!str.StartsWith("VIEWSTATE#")) {
    throw new Exception("Invalid viewstate key:" + str);
  return Cache[str];

Posted by PaulWilson | 2 comment(s)

Coding Standard for .NET and VB6 Teams

I started my new job at PRG/Schultz last week here in Atlanta, and had a very nice first week.  One of my first tasks is to create a coding standard for all new .NET development.  Now anyone that reads the MSDN docs should know what Microsoft recommends.  There are also others besides Microsoft that have adopted this new coding style.  There is even an automated compliance checker called FxCop available from Microsoft.  Most all .NET books and articles are also written to this new standard, checked by FxCop.  So it seems obvious that the Microsoft recommendation should certainly be the first choice.  Especially when you consider large corporations assume that people will come and go over time.

So what's my point then?  The existing team here at PRG is used to the traditional Hungarian style used in most VB6 shops.  I don't want to disrupt things too much, so I would really appreciate your feedback on this one.  What types of experiences have others out there had moving a team to the new standards?  What would you recommend to help them understand the need and reach of this new style?  Also, is anyone out there actually not adopting the new .NET standards, and why is that?  The more feedback the better, so don't hold back -- send stories, links, etc.  By the way, this is going to be a VB.NET shop, so any thoughts on customizing the standards towards VB.NET will be appreciated.

Posted by PaulWilson | 6 comment(s)

Finishing at Old Job -- Starting New Job Next

Today is my last day at Roche Diagnostics, where I have been the Software Architect for 2 1/2 years.  This site was originally an acquisition and they finally decided to close it.  I've known for over a year, and I finally got my notice 2 months ago, and now its over.  Some of my colleagues still have some things to do, but they are due to be out soon also.  They're all really sharp guys, so let me know if anyone is needing developers in coming months.

Next Monday, August 11, I will start my new job at PRG-Schultz.  They are planning on doing most of their new development in .NET, so I was the right person for the job.  I also got approved to write an article on MasterPages in Whidbey in an upcoming issue of a certain magazine.  So things are looking good and next week should be interesting.  My kids also start Kindergarten on Monday, so even more excitement in our house next week.

Posted by PaulWilson | 5 comment(s)
More Posts