Mix06 Sessions Coming

posted on 03/24/06 at 09:42:31 pm by Joel Ross

Mike Swanson is reporting that about 50 sessions from Mix06 will be available online for free - for everyone. Microsoft did the same thing for PDC '05, so I was hoping this was going to happen. Expect to see it in three to four weeks.

I spoke with Brian, who was there, and he told me this was the best conference he's ever been to - and he's been to a few Tech Eds and PDCs. I'm looking forward to downloading a few of these.

Technorati Tags:

Categories: Development


RossCode Weekly #040

posted on 03/24/06 at 07:11:52 pm by Joel Ross

RossCode Weekly #040?- 03.24.2006

The show didn't turn out as long as I thought it was going to. Keeping up with the stats, I did 43 stories in less than 30 minutes. How's that for signal to noise? Unless, of course, you consider the whole show noise!

Intro - 0:00
Download this episode -?29:19 /?14.1 MB
Subscribe to RossCode Weekly

Previously On RCW - 1:07
Dell buys Alienware
CBS's NCAA game streaming a success
CBS will sell condensed, full games on iTunes
Google forced to reveal websites to Government
Google court case thrown out
Windows Live ID to support multiple credentials

News & Views - 6:20
Vista delayed until 2007
Vista uses plain ol' BIOS to boot
Office 2007 coming in 2007
Google launches Finance
Yahoo launches local news
del.icio.us adds URL info
Grid storage from Amazon
Microsoft Atlas March CTP released
Microsoft's Team Foundation Server launches

The Cold Wars - 12:25
RIM?buys Ascendant Systems
Sony announces PS3 delay
PS3?to be region-free
Netscape.com to become Digg-like
Warner on schedule to release HD-DVDs on April 18th
1st Gen HD players won't allow copying
Disney may support both Blu-Ray and HD-DVD
Disney sells movie on iTunes
ABC to start stream test
NBC to show "Heist" on demand on MSN
Google Video offers downloadable videos
Google Video offers RSS feeds
Newsgator Inbox released
Newsgator buys SmartFeed
Newsgator announces synchronization support with Vista and?IE 7
Yahoo Messenger 7.5 beta released
Windows Live Messenger beta open to public, but not really
IE7 Beta 2 Preview released
Firefox 2.0 Alpha 1 released
Mozilla Lighting released
Google Reader adds sharing
Paypal Mobile

The Grapevine - 24:41
Microsoft to offer XBox 360 dev kit for $100
TiVo Series 3 to debut in September, for $800?
Google offers to sell access to books for publishers

Odds & Ends - 27:17
Trojan encrypts files and demands $300
Wesmirch - powered by Memeorandum

Outro?- 28:37

Contact / Feedback
206-424-4729 (4RCW)

Production Notes
Background music provided by Chronos (Introvert 4) and the Podsafe Music Network.
Hosting of RossCode Weekly is provided by OurMedia.org.
Would you like to sponsor RossCode Weekly? Contact me at sponsor @ rosscode.com.

Technorati Tags: | | | | | |

Categories: RossCode Weekly


Viewstate On The Server

posted on 03/23/06 at 09:40:56 pm by Joel Ross

We're going through an existing application with an eye on performance. One of the first things we noticed was viewstate. We had quite a few pages that were pretty heavy, so we started looking at what we could do about it.

The obvious choice was to reduce the size, but that takes time to determine what can be excluded, and with a?lot of pages, that would be a fairly large undertaking. We plan to do that over time, but we wanted a speed increase now. So we started looking at alternatives to storing the viewstate on the client. Our application is hosted in the midwest, but the users are primarily on the left coast, and it's accessed over a T1 - it's not available on the 'Net, so the pipe is limited. With 300 or so users, it's important for us to limit the sheer amount of data passed over the line. We eventually settled on storing viewstate in the database. We looked at some alternatives - cache, session, etc., but settled on the database because, while it isn't as fast as the other two, it is less memory intensive, and still faster than passing it over the wire.

So how did we do it? Well, we were smart and put in a base page that all pages in our application use, so we only had to modify one file, and all pages benefited. Then we added a web.config option to turn it on and off, and left it flexible enough that we could add other storage mechanisms in the future.

With that, here's the code to save it to the database:

   1:  protected override void SavePageStateToPersistenceMedium(object state)
   2:  {
   3:      switch (ConfigurationManager.AppSettings["ViewStateMode"].ToLower())
   4:      {
   5:          case "database":
   6:              LosFormatter los = new LosFormatter();
   7:              System.IO.StringWriter writer = new System.IO.StringWriter();
   8:              los.Serialize(writer, state);
   9:              string viewState = writer.ToString();
  10:  ?
  11:              string key = ViewStateManager.InsertViewState(viewState);
  12:  ?
  13:              RegisterHiddenField("__VIEWSTATE_KEY", key);
  14:              break;
  15:  ?
  16:          default:
  17:          case "normal":
  18:              base.SavePageStateToPersistenceMedium(state);
  19:              break;
  20:      } 
  21:  }

When storing viewstate in cache or session, you don't have to worry about serializing the data - you can throw it in, and pull it out?as an object without issue. When you throw it in the database, you need to serialize it to a string, so you have to use a LosFormatter to do that for you. Our ViewStateManager takes a string and returns a key - we use a GUID for our key, but I've also seen using the session ID combined with the current page name and time. It doesn't really matter what you use, as long as it't unique. Then, you register that key as a hidden field. So instead of passing the whole viewstate to the client, you only pass a pointer to it. Now, when a page posts back, you use that key to load it from the database:

   1:  protected override object LoadPageStateFromPersistenceMedium()
   2:  {
   3:      switch (ConfigurationManager.AppSettings["ViewStateMode"].ToLower())
   4:      {
   5:          case "database":
   6:              string key = Request.Form["__VIEWSTATE_KEY"];
   7:              string viewState = ViewStateManager.GetViewState(key);
   8:  ?
   9:              LosFormatter los = new LosFormatter();
  10:              return los.Deserialize(viewState);
  12:          case "normal":
  13:          default:
  14:              return base.LoadPageStateFromPersistenceMedium();
  15:      }
  16:  }

As you can see, we can easily turn it off in the web.config and have viewstate back in the page. We considered using our configuration table to manage this value so we could change viewstate persistence on the fly, but determined that would actually be a bad thing. Imagine this scenario:

  1. User loads a page and viewstate is stored in the database
  2. The configuration is changed to persist viewstate to the page
  3. User posts back

So what happens? When the user posts back, the load viewstate method will be looking for the viewstate in the page, when it's actually in the database. Not good. At least with storing it in the web.config, it will force the application to restart, which gives us a little more protection - plus, it requires a developer to make the change, who should know the consequences of making that change.

The last thing to touch on is the viewstate table itself. Not the structure - that's pretty easy. Three fields: key, value, and a timestamp. Simple, but the most important thing to consider about this table is clean up. When do you delete the records in this table? Our initial thought was to delete it when you retrieve it. Once you've used it, it's no longer valid, right? Have you ever posted a form, had something go wrong, and just hit F5 to repost the data? I have, and if after thefirst post, the viewstate was deleted, hitting F5 would cause an error because the viewstate would be gone. That's a problem. So we decided to go with a nightly job to purge old records from the table. Since it's an internal application, we could reliably remove records at night knowing that most of the time, no users are currently using the site.

So while this is all technically possible, was it worth it? Using Fiddler, I went through a few different scenarios and my quick eye ball glance says page size was reduced by about 25% on a lot of pages, and on a few pages, the size was reduced by more than half. And this was after we've already implemented HTTP compression. Also, by not having to compress the viewstate reduces the tax on the server too - less data to compress.

Overall, we've been happy with the performance increase.

Categories: Development


RCW coming late this week

posted on 03/23/06 at 12:06:10 am by Joel Ross

I know RCW has been sporadic at best lately, but March Madness has been crazy for me this year. I have the show prep done, but I'm not going to have time to record it just yet, so that will have to come tomorrow or Friday. It's going to be a long one - almost two weeks of content and a lot has happened, so it should be a good show! But you'll just have to wait...

Technorati Tags:

Categories: RossCode Weekly


Adapter Pattern

posted on 03/22/06 at 11:47:51 pm by Joel Ross

I've been slowly reading a book on Design Patterns, but I've recently started looking at dofactory.com, mainly because it has it's samples written in C#. It's odd how a description can seem so vague, but seeing code crystalizes the concept. Well, that's exactly what happened when I took a look at the adapter pattern. Reading about it, it sort of made sense - I know what the concept of an adapter is, and I can relate that concept to programming, and come up with...something. Taking an object and adapting it to my current system. Yeah, that makes sense, right?

It does when you see it in code! Once I saw it, the possibilities seem endless. To me, it's a great pattern for integration. Let's say you have a system that can handle your type of order, and you need to integrate with another system, which uses a similar, but different order object. So how do you do it? With an adapter! It's the least impactful to the existing system, and get's you the result you want - integrating disparate systems.

The description makes sense, but let's look at code, since that's what cleared up the fog for me. First, the client that interacts with orders:

   1:  List<Order> orders = OrderManager.GetOrders();
   2:  ?
   3:  foreach(Order order in orders)
   4:  {
   5:      order.Save();
   6:  }

Nothing special, but the client knows how to get orders, and how to save an order. Now, here's what an order looks like:

   1:  public class Order
   2:  {
   3:      private string _orderId;
   4:      public virtual string OrderId
   5:      {
   6:          get { return _orderId; }
   7:          set { _orderId = value; }
   8:  ?
   9:          public virtual void Save()
  10:          {
  11:              Data.Save(this);
  12:          }
  13:      }
  14:  }

Again, nothing special. You can go on working like this forever. Until you buy a company, and all of?a sudden, you're dealing with an order from their system:

   1:  public class CompanyOrder
   2:  {
   3:      private string _id;
   4:      public string ID 
   5:      {
   6:          get { return _id; }
   7:          set { _id = value; }
   8:      }   
   9:  ?
  10:      public void Commit()
  11:      {
  12:          Data.Commit();
  13:      }
  14:  }

So what do you do? Do you rewrite your order processing system to accept both Order objects and CompanyOrder objects? Do you rewrite the new system to use Order objects rather than CompanyOrder objects? Or do you write an adapter to link one to the other?

   1:  public class NewOrder : Order
   2:  {
   3:      private CompanyOrder companyOrder;
   4:  ?
   5:      public NewOrder(CompanyOrder companyOrder) : base()
   6:      {
   7:          this.companyOrder = companyOrder;
   8:      }
   9:  ?
  10:      public override string OrderId
  11:      {
  12:          get { return this.companyOrder.ID; }
  13:          set { this.companyOrder.ID = value; }
  14:      }
  15:  ?
  16:      public override void Save()
  17:      {
  18:          this.companyOrder.Commit();
  19:      }
  20:  }

Now you just change the OrderManager to know how to get the new CustomerOrder objects, and add those to the collection (as NewOrder objects), and the client can now interact with the new system's orders.

And that, my friend, is the adapter pattern.

Categories: Development


OpenXML Developers and NuSoft

posted on 03/21/06 at 09:03:49 pm by Joel Ross

It's always interesting when you find information about your company before 1.) it's publicly announced, and 2.) your own company talks about it.

I didn't think much of it over the weekend when one of my "Ego Feeds" found a hit for NuSoft at a site called openxmldeveloper.org. I saw it, and didnt' read too much into it - it never clicked that OpenXML is the new open XML format for Office "12" so I just noted that it was interesting.

Then came the announcement this morning from Bill Gates at Office DevCon. Now it clicked, so I went back, and sure enough, there's NuSoft Solutions as one of the "Founding Community Members".

There've been rumblings about a few "secret" projects coming from Microsoft. I wonder if this is one of them...

Technorati Tags: |

Categories: General


VS 2005 Website "Projects"

posted on 03/19/06 at 09:46:06 pm by Joel Ross

I've talked about the issue with Visual Studio 2005 and how team development is an issue in my mind. The main issue to me has to do with deleting or moving files. If you're not sure how to reproduce it, the steps were included in a recent email a client sent out to the development team:

  1. Developer 1 deletes a file.
  2. Developer 2 gets latest.
  3. The deleted files show up as new files for developer 2.
  4. Developer 2 checks in all files (including the one deleted by developer 1).
  5. Developer 1 gets latest and gets the file they deleted prior.
  6. Developer 1 thinks about killing everyone on his team.

Yeah, that's a good description...

Having said that, you do get a warning when you get latest and a file has been deleted. It's?a good signal to check for newly added files that shouldn't be there.

Technorati Tags:

Categories: ASP.NET


Dew Case Mod

posted on 03/19/06 at 08:55:41 pm by Joel Ross

I never really got into case mods, but if I did, this would be right up my alley...

Technorati Tags:

Categories: General


The Benefits of Being a VIP...

posted on 03/17/06 at 02:35:50 pm by Joel Ross

...arent' exactly what they're cracked up to be! Somehow, I got on the VIP list to watch NCAA games online this year, and in case you were wondering if you were missing anything, well, this pretty much sums it up.

I'm a VIP!

Technorati Tags: | | |

Categories: Sports


March Madness 2006 Is Ready!

posted on 03/12/06 at 07:19:02 pm by Joel Ross

We just finished updating the teams for this year, so if you are a Tourneytopia.com user or a Tourney Pool Manager user, the teams will be downloaded shortly, if they haven't been already!

Now, I have to go back and actually look at the seeds. When you're focused on data entry, you don't get a very good look at what's going on!

Technorati Tags: | | | |

Categories: Develomatic


<< 1 ... 40 41 42 43 44 45 46 47 48 49 50 ... 124 >>