Friday, December 14, 2007

Starbucks Card Balance Google Gadget


I created a simple Google gadget to show me how much money I have left before my caffeine headache kicks in. It's a nice addition to my iGoogle account.

I personally wouldn't provide my Starbucks Card number and pin to a total stranger, but some of my friends wanted to use it so here it is.


Tuesday, November 27, 2007

How to update an UpdatePanel from two different ContentPlaceHolders using MasterPages

The first thing you want to do is always set your UpdatePanel's UpdateMode to Conditional. By default UpdateMode is set to Always which is great when you're first learning, but not efficient. Why? Because every time a postback is triggered, your update panel reloads, which 9 times out of 10, isn't what you want.

The trick to setting up two different UpdatePanels is this. Lets say you have an UpdatePanel containing a GridView in one ContentPlaceHolder displaying a customer's order history. You have another UpdatePanel in another ContentPlaceHolder that will display the order details when an order is selected.

The problem is you can't declaratively set the Trigger to a control in a different ContentPlaceHolder.

What you need to do is override the OnInit() method.

Here is an example:

Combine this with the UpdatePanelAnimation control to give a visual cue to the user that the data has been updated and you have a simple ajaxified solution.

<ajaxtoolkit:updatepanelanimationextender
id="upAnimation"
behaviorid="upAnim"
targetcontrolid="updateDetails"
runat="server">
<animations>
<onupdating>
 <sequence>
  <color
   animationtarget="updateDetails"
   duration="1"
   startvalue="#ffffff"
   endvalue="#ffffcc"
   property="style"
   propertykey="backgroundColor">
  </color>
 </sequence>
</onupdating>
              <onupdated>
 <sequence>
  <color
   animationtarget="updateDetails"
   duration="1"
   startvalue="#ffffcc"
   endvalue="#ffffff"
   property="style"
   propertykey="backgroundColor">
  </color>
 </sequence>
</onupdated>
</animations>
</ajaxtoolkit:updatepanelanimationextender>

Wednesday, October 24, 2007

How to prevent gifs from rendering grainy using .Net GDI

I recently built a Http Handler for an Asp.net application that needed to generate image thumbnails from different image types on the fly. Sounds easy enough, right?

Well it was a simple task until I tried to generate a thumbnail from a gif. After hours and hours trying to figure out how to improve the resolution I found a great article addressing this particular issue.

The key to this conundrum you ask? Color quantization.

Unfortunately System.Drawing uses a web-safe palette even though just about every gif you've ever seen uses an adaptive palette.

The result:

After implementing Brendan Tompkins Octree-based quantization technique...

Wednesday, October 17, 2007

Greenbluff 2007

Sunday, September 23, 2007

Pike Street Market

The Edminsters visit the Pike Street Market in Seattle.

Posted by Picasa