Coffee and Code

The Life and Times of Jeff Woodman

For Performance Issues, Firebug Rocks

Posted: 20 Mar 2008 01:05 PM ::: 0 Comments ::: permaLink ::: Post a comment

Firebug!
Do you want real, ultimate, client-side debugging power? Get Firebug today.

This week I tackled some performance issues with my new weblog. I had noticed that the weblog took an awfully long time to load. So, I navigated to my weblog and launched Firebug. Firebug's network monitor quickly informed me that:

  • The request to the weblog page itself was averaging over 1 second in duration.
  • The size of the HTML response for the page was in excess of 50 Kb.
  • AJAX resources and Script.aculo.us libraries were unneccessarily loaded on every request - these are only needed in an authenticated context.

Damn, I loves me some Firebug!

Using this information, I determined that the ViewState (A hidden form tag on the page) content was sometimes as large as 23 Kb! In other words, the ViewState information accounted for almost 50% of the markup on the page.

Some minor code changes resulted in a HUGE reduction in the ViewState size. For one particular weblog entry, the viewstate was reduced from 23552 bytes to 236 bytes - a 98.99% difference!

In addition to the viewstate optimizations, I also did the following:

  • Reduced the total number of items that are fetched for each request to the page - From 17 to 5, on average.
  • Implemented caching where I could to reduce round-trips to the database (From 7 round-trips to 1 round-trip per request).
  • Replaced the Archive TreeView with a simple repeater. The TreeView is expensive to initialize and populate server side, and emits tables which are a Web 2.0 no-no in most cases.

If you're a web developer, Firebug will make your life easier. For ASP.Net developers, I also recommend Binary Fortress's ViewState Helper for Internet Explorer - This tool will decode viewstate for you so you can examine the contents, as well as giving you the ViewState size and percentage of the page's content that the ViewState consumes.

Filed under: development asp.net firebug tools


6,608 Ways to Abuse your PC

Posted: 12 Dec 2007 06:00 PM ::: 0 Comments ::: permaLink ::: Comments are closed.

Wow, I've gone a whole month without posting anything to this blog. I am LAZY.

I'm currently well-caffeinated and happy, other than having to deal with some minor gastrointestinal misery for the past couple of days. Oh, our telephone line is on the blink (again). This tends to happen when we get a lot of snow; last winter we went through 5 or 6 days without a phone line. Oddly enough, my internet connection still works sometimes. Time to call the landlady!

So I've been [helping] a friend out with an ASP.Net knowledge base application for the past few days. A couple of nights ago I was working on a module that uploads Flash-format tutorials to the application. Anyway, at one point when I was testing the module, I did an upload and waited for the response.... After about 10 seconds I figured something was screwed up; No page was coming back and I had to Ctrl+Alt+Delete out of Firefox.

I fixed the problem that night, but didn't find out until the next day what had actually happened: due to some hasty coding and inadvertent recursion, my application had created 6,608 copies of an uploaded SWF, nearly filling up my hard drive...

I am a danger to myself and to my computer.

Filed under: development humor asp.net


The Straight Dope

Posted: 24 Mar 2007 02:03 AM ::: 0 Comments ::: permaLink ::: Comments are closed.

So this teenage kid and his mammy were standin' in front of me in line at Walgr**ns. He says to his mom, 'I gotta start shaving. Clean-shaven men get all the best jobs.'

And here I am, lookin' all haggard with 3 days worth of stubble and camo pants on.... wild-ass hair... so I say to the mammy: 'Well, I guess I'm outta luck!' And the mom says - I love this part - 'Oh, you see, my son means a STRAIGHT job.'

Ho ho.

Anyway, I found this link at leftslipper's website while searching for how to bind an ObjectDataSource to an object factory. The article not only told me what I needed to keep my new weblogger project rolling, but offers an alternative way to handle objects: namely acquiring them rather than constantly creating and destroying them.

Filed under: development personal humor asp.net blog


Adventures in Databinding

Posted: 10 Feb 2007 06:23 PM ::: 0 Comments ::: permaLink ::: Comments are closed.

Here are a couple of ASP.Net databinding / formatting tricks I've picked up recently:

1. I recently had to bind to a telephone number in a GridView that was stored in the database as a 10-character string. I ran into problems trying to use a DataFormatString property to format the output as (555) 555.5555. Turns out that format strings generally work better with numbers than strings.... duh.

C# Solution: Convert.ToInt64(string).ToString('(000) 000.0000') did the trick. I can't remember where I found the solution, but it's really useful! Sure beats writing a custom method to re-format the number.

2. When using a BoundField to display a DateTime, the DataFormatString property will only work when the HtmlEncode property is set to false.

Filed under: development asp.net tech


Yet Another Conference!

Posted: 11 May 2006 06:56 PM ::: 0 Comments ::: permaLink ::: Comments are closed.

I just found out that I'm enlisted to help with A/V support at another conference in Albuquerque... starting Monday and ending Thursday... I was looking forward to a couple of days off next week, but I guess it will have to wait. Sorry Lisa (aka Dark Chylde)!

I am jonesing once again for ASP.Net. I've been kinda-sorta working on a new version of my Blogging utility, AetherBlogger, but with all the travel recently, plus the new design work for my website, I've not been too diligent about working on the app lately... but hopefully soon I'll get back to work on it. My I-Ching application needs some work too, though, and I really need to try to quit smoking again and get back to the gym. What the hell am I going to do??? Stop sleeping, I guess!!

Well, take care, people. Until...

Filed under: asp.net i-ching

Author Bio

Jeff_Blog_Mugshot2.jpg

Jeff Woodman is a web developer living in Santa Fe, New Mexico, USA. He is passionate about coffee, scotch whiskey, and internet technologies. If you see him on the street, you may have to yell to get his attention, because he will most likely have some very loud punk rock playing on his MP3.

Other Places to Find Jeff

Jeff Woodman's Facebook profile
Add to Technorati Favorites Member of W3C Sites dot com
Jeff Woodman on Ma.gnolia.com

last.fm: