Tuesday, July 24, 2007

I've been battling some crazy ASP.NET 1.1 code the past couple of days. First, I was calling some web services with entirely hand written SOAP protocol management. That's always fun. While tedious and too low of a level to be mucking around, it was the fastest means to an end with a crotchity ol' Apache/AXIS web service. Even though I'm fresh off the WCF training regimen; that new stuff wouldn't have helped me here. Perhaps just having the new stuff in my head pushed me in the right direction to tackle this challenge - a man can dream, can't he?

Then, just to rub it in a little, the HTTPWebRequest object decided to give me a swift kick in the shorts. You see, in .Net 1.1, there's a tiny little unknown (unanswered) bug.

I have two instance methods and each make a single call over HTTP with their own HTTPWebRequest object, there's no sharing here. Every time, the second request would hang and throw a "System.Net.WebException : The operation has timed-out." error. The same code runs great in .Net 2.0 so I figure its a framework bug.

I call one method and return a string which is used as an input argument for the second method. Both calls go to the same top level domain, but call to different end points on the domain.

After much thought, trial and error, as well as reading about the same problem other folks were having, I finally figured out the workaround.

It turns out that calling the Abort() method on the HTTPRequest instance after completing the request is sufficient to break up the clog that is preventing subsequent calls. The following code block shows the working helper method. If I comment out the calll to Abort(), it no worky.

private string ExecuteHttpWebRequest(
   string url, RequestMethod method, string message)
{
   HttpWebRequest request = 
      (HttpWebRequest)HttpWebRequest.Create(url);

   request.Timeout = 30000;
   request.KeepAlive = false;
   request.Headers.Add("Cache-Control", "no-cache");
   request.Headers.Add("Pragma", "no-cache");

   switch( method )
   {
      case RequestMethod.Get :

         request.Method = "GET";

         break;

      case RequestMethod.Post :
         
         request.ContentType 
            = "application/x-www-form-urlencoded";
         request.Method = "POST";
         request.ContentLength = message.Length;

         StreamWriter sw = 
            new StreamWriter(request.GetRequestStream());
         sw.Write(message);
         sw.Flush();

         break;
   }

   string html = null;

   using( HttpWebResponse response 
      = (HttpWebResponse)request.GetResponse() )
   {
      Stream rs = response.GetResponseStream();
      StreamReader sr = new StreamReader(rs);
      html = sr.ReadToEnd();
      response.Close();

      // subsequent calls fail without this abort in .Net v1.1
      request.Abort();
   }

   return html;
}	
Tuesday, July 24, 2007 9:27:37 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, November 30, 2006

You are hovering over bacon and eggs I've developed this phenomenal practice recently of rising early with The Wife (as a high school math teacher, she gets up wicked early) and donning my ratty old pair of Uggs, I make some bacon & eggs and a pot of coffee while I read the newspaper.

I usually come away with two or three great stories that I can use for conversation when I find myself in front of a non-developer.

Today, I came across this gem in The Oregonian:

Caught in a web of stupidity
In a recent Edge, we told you that the approximate time it would take you to visit every site on the Web if you spent one second at each one was 1 day, 9 hours, 46 minutes and 34 seconds. See, we were so busy visiting this one Web site (hey, we thought they meant TURKEY breasts!) that we left out a line. The actual figure is 3 years, 2 months, 1 day, 9 hours, 46 minutes and 34 seconds, according to The Chicago Sun-Times. Hey, Persnickety McPickypants, we were only off by 3 years and 2 months!

Huh... After thinking about it, I suppose they mean just the home page of every site. Even so, its easy to see how a large array of computers can successfully scan the entire web quickly. Then, it occurred to me the truly hard part was returning "the right" results quickly on a search result page.

Thursday, November 30, 2006 4:42:19 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, November 27, 2006

I saw this post on Jeff Atwood's blog about a new tool from SlickEdit, the makers of SlickRun; easily the most frequently used program on my laptop day-in and day-out.

The Command Spy
Whenever you click on a menu item or toolbar button in Visual Studio, you are executing what is known as a "command". Unfortunately, it's almost impossible to tell what command is linked to which menu items or toolbar buttons. The Command Spy monitors command execution and allows you to see exactly what commands you've run, how many times you've run them and what key bindings are used to invoke those commands. The main purpose of this tool is to allow you to learn what commands are bound to which keystrokes, so that you can work faster within the IDE.

I installed Command Spy over the Thanksgiving holiday. It totally rocks! Just run the VS.Net add-in while you're coding for a couple of hours and then take a look at your metrics. Command Spy will tell you how many times you've run a command without using the short-cut keystrokes. Its a great way to improve on your productivity.

Monday, November 27, 2006 10:48:29 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [2]  | 

I started using the RSS reader in Microsoft Outlook 2007.

I was using SharpReader for as long as I've ever had an RSS reader and subscribed to feeds. I really like having just one application running for my communications and work items (email, tasks, calendar, RSS feeds...). Its super easy to add a feed when you're visiting a web page too. I used folders quite a bit in SharpReader to categorize feeds, but I'm trying the "one big folder" approach for now in Outlook.

Sometimes, I got lazy and didn't open SharpReader on my laptop for a while. The posts would get way out of control. Sure, I could add it to my Start Up programs, but one of my quirks is to keep that list short, if not empty. Some weeks I even tell SQL Server to not startup automatically. Perhaps that's one of the old carry overs from living too long with too little RAM on a weak laptop.

Outlook 2007 as an RSS reader is nice, but I miss some of the basics, like identifying the URL to a blog I've already subscribed to. There's probably a way to display that information easily in Outlook, but I haven't discovered it yet.

To date, the most frustrating thing has been refreshing feeds. It gets joined at the hip with my email send/receive request. So, when someone comes by my desk in a general freak-out mode and asks how to solve a problem raised in a recent e-mail, I click on Send/Receive if I haven't gotten it yet. Now, thanks to the additional RSS feeds, I have to wait much longer as everything is updated. There must be a way to decouple these requests from each other in Outlook.

Overall, I'm very happy with the switch so far.

Monday, November 27, 2006 10:39:22 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [2]  | 

I've been using http://www.internetfrog.com/ for a few months now, but I read Doug Purdy's blog about http://www.speedtest.net/. I think this will be the new default speed test tool for me. Its awfully shiny.

Monday, November 27, 2006 10:31:03 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, November 01, 2006

I saw this link on Don Box's blog about a new Workflow book coming out. Since I'm considering WF, I'm going to take his advice and get the book.

This is a nice parlay for me after a session at the recent Seattle Code Camp. I sat in on a Windows Workflow Foundation talk by Paul Mehner, the South Sound .Net User Group Leader in Olympia, WA.

I could tell this guy is a professional trainer; he had a thorough understanding of Windows Workflow Foundation, solid content and a ton of energy. Not a sleepy eye in the whole audience!

Wednesday, November 01, 2006 10:14:52 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, October 30, 2006

The Seattle Code Camp 2 was a great weekend. It was held at Digipen, the world's first video game university. Its a cool office, and judging by all of the labs, the auditorium, and extensive media clippings framed on the wall, its a fantastic place to learn 2D and 3D animation, game programming, art and anything else related to game development. Jason Mauer did a great job of pulling everything together. I'd love to help out and organize the next Portland or Seattle gathering.

My presentation on DotNetNuke and web content management went well; I think its got some legs. Here's the zip file of my presentation and the code I was talking about. This was the first time I've presented this material and it went fairly well. I really believe in the concepts that I've been whittling on and DNN has just been the delivery vehicle of the moment. I think it'd be a lot of fun to take this one on the road and hit up a couple of code camps in other cities. I wonder what The Wife would think of that?

One of my favorite presentors last weekend was Bill Vaughn. He's with Beta V, and a prolific author; he's written a couple of SQL Server books recently. I took advantage of the opportunity to learn quite a bit about SQL Server 2005 Compact Edition and Reporting Services from him.

The XNA team was also on hand to present some brand new material. The new beta is due very soon, if its not out already. Charles Cox was on hand (a Digipen graduate) to give a great demo on building a XBox 360 game with C#.

Monday, October 30, 2006 2:11:59 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Saturday, October 21, 2006

16:3 Scale Labyrinth I forgot to mention that we we're linked by makezine.com the other day for our efforts in building a large scale labyrinth game.

My friend Dave Selden is the master mind. He had the idea to make the game based on his sweet eBay purchase. He called up some friends and we've been helping Dave build it over the past couple of weeks in the hopes of winning a mini-golf contest. We're up against our neighbors at Wyden & Kennedy, the ad agency for Nike. They are purportedly making a giant whale with the ball shooting out of the blow hole; rumors to be sure but I would expect they have a larger budget too.

The game begins by placing the golf ball in the start position on the board surface. One or two players turn two giant knobs on the sides of the game to manipulate the x and y axis of the board surface. If the player succeeds in moving the ball to the finish hole, the ball descends through a tube, out the side, and directly (hopefully) into the cup. Otherwise, the ball drops out on the far side of the game; where the player must then putt the ball around the rectangular green to the side with the hold. Got to love the mini-golf game!

Thanks Drew! He submitted us to makezine.com. He has millions of hundred dollar ideas.

fun | popart
Saturday, October 21, 2006 12:40:54 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, October 15, 2006

I was accepted to speak at the next Code Camp, the weekend of Oct 28th, in Seattle! Hooray!! I thought for a little bit on (A) what would be a fun topic and (2) what do I have to say about said fun topic. I finally settled on talking about something I do on a daily basis: balancing the needs of the web designer, leveraging sufficient power of a great platform (read that as using the base class libraries and everything else given to me), along with the needs of the client and the overall budget.

Our designers at Pop Art are top shelf. They've come up with some fantastic ideas for sites. They're on the leading edge of what's possible with today's browsers and giving consideration to the downlevel browser folk.

Given that, they have some high demands on the HTML emitted by anything on the server. It absolutely, positively must be W3C compliant. It doesn't matter if its HTML 4.01 Transitional, or HTML 1.0 Strict; so long as it conforms to the given specification. Gone are the days of using menu server controls that emitted glorious reams of <table>, <tr> and <td> tags. Enough for you to knit a small blanket. Amen for the CSS Control Adapters.

The designers have a lot to say on usability too. There are just some things that developers will step right over like a country boy; where as the country boy's college roommate visiting for the weekend will stop, stare, point, hold their nose and give it a wide birth.

Enter DotNetNuke. Out-of-the-box, DNN is a developers playground. They know there's so much capability under the hood that they're (and I'm generalizing here) too busy envisioning what they're going to build next instead of rethinking the user interface that a client would need to maintain a site. That seems like small potatoes next to the glorious reams of code we can write.

So, I've settled on presenting the issues, challenges, arguments, counter-points and three-point-takedowns that we've had to address over the past 18 months with DNN. That would be a little too gloomy, so the remaining 67% of the discussion will contain some solutions that bridge the gap and keep the web site looking beautiful long after it launches. My presentation is in no way the rule; simply my experiences in dealing with this issue since I came to Pop Art in 2002. As with most things, I'm sure they are lots of ways to handle them, and I'm as open minded as the next guy; providing the next guy is sans jerk.

A basic introduction of DotNetNuke would be better served by a different session, but people who've never downloaded the bits from www.dotnetnuke.com will still get a reasonable insight into the problem sets and ways to deal with them.

My basic fear is probably the same as any other presenter who ever presented in all of presentation-land: getting slotted in the same time slot as ScottGu or anyone else in the rock star line up. What a problem to have!!   :)

Sunday, October 15, 2006 7:35:33 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Saturday, October 07, 2006

I recently upgraded my laptop to 2GB of memory. I've been really pleased with my new ability to leave Internet Explorer, Outlook, SharpReader and SQL Server open when I want to use Visual Studio.Net and write some code.

As a negative side affect, I noticed some problems when I put my laptop into stand by or hibernation mode.

Stand by mode is where the laptop is still technically "on" and its drawing a tiny little charge out of the battery. All of my programs are still in memory but the machine is in a reduced state which preserves the battery until I'm ready to turn it on again. This mode the fastest way to pack up when I need to run for the bus as well as power back up again when I reach my destination.

Hiberation mode is similar to stand by except the machine is actually turned off. The laptop persists everything in memory to disk so I can even swap batteries if I like; a great trick to making long plane trips go by quickly. When I power up again, the laptop restores the contents of the memory and the CPU comes back to life.

It takes a little longer to go into and come out of hibernation since there's more stuff to do than when using stand by mode. Hence, my preference was to use stand by unless I knew I would be swapping batteries. The other day on a podcast I heard either Carl Franklin or Scott Hanselman mention that stand by mode can behave poorly because applications have the option of supporting it. Hibernation doesn't suffer from that since the contents of memory are dumped to the disk. Everything supports hibernation, but some apps may choose not to support stand by and therefore, when you start up again, an app may run aground.

I might have seen that on my laptop, but it hasn't been painful enough for me to care too much; until the 2GB memory upgrade.

In the best scenario, I would start the stand by or hibernate process and it would immediately come back and tell me this message:

Insufficient System Resources Exist to Complete the API

At first, I would smile and say to myself, "That's cause I got two gigs, baby!!" That wore off though. My harddrive is a paultry 40GB and I usually have somewhere between 8 and 0.5 GB free on any given day. So a few days ago, I deleted all of my Office and Battlestar Galactica episodes that I downloaded from iTunes and made sure I had enough room for the memory to dump to disk.

In the worst scenario, it would "take" for at least 2 minutes, enough for me to believe it worked, only to start up again inside my laptop bag. I would get to my destination and grab my laptop only to find it a little too warm. I'd frown. Sometimes, in the past, I would forget that it was on and chuck it in my bag only to find a hot laptop waiting for me later. The same frown occurs.

So this morning, I thought, what if there were some glorious place that existed where people would store and share their knowledge? I fired up my browser and did a Google query for "dell latitude cannot hibernate with 2GB ram". The first hit was this one:

http://translocator.ws/2005/11/06/hibernation-insufficient-system-resources

This page talks about my exact problem and an patch that is supposed to fix the problem. Only in his case, he has four computers that still exhibit the behavior after the patch was applied. There was a note on there that the latest patch of August 2006 was released. I suspected his problem was before this latest patch came out.

I downloaded the patch (WindowsXP-KB909095-x86-ENU.exe), installed it and lo-and-behold it worked! Well, I hibernated for at least two minutes. I'm excited to see if I get my stand by working again. I'll add a comment in a few days with the results.

This is the knowledge base article link and title for this issue:

http://support.microsoft.com/kb/909095

The computer occasionally does not hibernate and you receive an "Insufficient System Resources Exist to Complete the API" error message in Windows XP with Service Pack 2

Saturday, October 07, 2006 11:39:00 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
 Tuesday, October 03, 2006

Jason Mauer's blog let me know that Seattle Code Camp is coming up at the end of the month! Ack!

I'm thinking about heading up with my buddy Kelly. I told myself at the Portland Code camp, I said "Self," that's what I call myself, "you should present at the next code camp." Well, this is the next one, but its right around the corner!

I could do the DotNetNuke presentation, but seeing as how they just incorporated combined with their proximity to Seattle, there's a good probability that a DNN big shot will be there doing a far better show than I could. I was very impressed at the last Portland Code Camp at the quality of the "simple" talks. Things that you should already know, but are fun and refreshing to go over again. For example, the Subversion discussion was really well attended and you always end up learning some new trick or insight. I love that.

I'll put my thinking hat on and see what I come up with.

fun | learning | popart | events
Tuesday, October 03, 2006 2:42:21 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, October 02, 2006

No matter how complex the Internet becomes, it refreshing to see that right and wrong are still easy to decipher. Here's the lesson that Six Apart has to pay for.

Monday, October 02, 2006 10:18:26 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
A MOSS 2007 site.
Monday, October 02, 2006 9:52:50 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Saturday, September 30, 2006
My first Windows Live Writer.
Saturday, September 30, 2006 10:08:49 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, September 27, 2006

The other day I fired up TortoiseSVN and it politely informed me that I might enjoy the latest release.

Hurrah!

Wednesday, September 27, 2006 10:54:52 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, September 26, 2006
DotNetNuke goes corporate.
Tuesday, September 26, 2006 12:16:16 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, September 25, 2006
I got 2GB of RAM today.
Monday, September 25, 2006 4:01:21 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
The new office.
Monday, September 25, 2006 7:51:46 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, September 24, 2006
Office move.
Sunday, September 24, 2006 8:24:49 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, September 19, 2006
A review of Death By Meeting.
Tuesday, September 19, 2006 7:22:45 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, September 13, 2006
Review of Professional DotNetNuke 4, Chapter 1
Wednesday, September 13, 2006 4:28:57 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, September 12, 2006
DNN 4.3.5 due shortly.
Tuesday, September 12, 2006 9:15:42 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |