Developer Notebook Bloghttp://daveweaver.net/(none)en-usTue, 15 Apr 2008 15:31:50 GMTConnectServer Sites 1.8.5223.2david.weaver@missionresearch.comdavid.weaver@missionresearch.comhttp://daveweaver.net/notebook,trackback,MoreProgrammingCheatSheetshttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,MoreProgrammingCheatSheetshttp://daveweaver.net/notebook,commentview,MoreProgrammingCheatSheetshttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=fb672d57-92f4-4162-afbd-17f7c77bdd42

image I've linked to a couple cheat sheets in the past (Powershell and CSS), but I've run across a post that lists a bunch for different languages and frameworks. Most of them are available as PDFs. See webtecker.com.

 

The image is from a VisiBone advertisement. That company sells some great cheat sheets and cheat books.

More Programming Cheat Sheetshttp://daveweaver.net/notebook,permalink,MoreProgrammingCheatSheetshttp://daveweaver.net/notebook,permalink,MoreProgrammingCheatSheetsTue, 15 Apr 2008 15:31:50 GMT<p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/MoreProgrammingCheatSheets_A211/image_2.png"><img style="border-right: 0px; border-top: 0px; margin: 0px 20px 20px 0px; border-left: 0px; border-bottom: 0px" height="209" alt="image" src="http://daveweaver.net/media/blog/WindowsLiveWriter/MoreProgrammingCheatSheets_A211/image_thumb.png" width="166" align="left" border="0" /></a> I've linked to a couple cheat sheets in the past (<a href="http://daveweaver.net/notebook,permalink,PowerShellCheatSheet" target="_blank">Powershell</a> and <a href="http://daveweaver.net/notebook,permalink,CSSCheatSheets" target="_blank">CSS</a>), but I've run across a post that lists a bunch for different languages and frameworks. Most of them are available as PDFs. See <a href="http://webtecker.com/2008/04/14/programing-cheat-sheets/" target="_blank">webtecker.com</a>. </p> <p>&#160; </p> <p>The image is from a <a href="http://www.visibone.com/" target="_blank">VisiBone</a> advertisement. That company sells some great cheat sheets and cheat books. </p>http://daveweaver.net/notebook,commentview,MoreProgrammingCheatSheetsprogramming;tools;web
http://daveweaver.net/notebook,trackback,InnovationFeatureCreepAndOpenSourcehttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,InnovationFeatureCreepAndOpenSourcehttp://daveweaver.net/notebook,commentview,InnovationFeatureCreepAndOpenSourcehttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a00596fa-2f0e-49e2-8201-cdfae5c977fe

imageHere's a very interesting interview of Jason Fried (of 37signals) by Walt Mossberg. It's from a conference on innovation in business. Jason explains how 37signals' business model helps them avoid the pressures of feature creep and how that makes his product a success. He emphasizes the use of the word "No" in developing software and trying to please everyone is the road to mediocrity. He comes up with a fitting analogy using Italian restaurants, but you'll have to watch the interview to hear it. The interview goes on to examine how feature creep affects the success of open source.

Innovation, Feature Creep and Open Sourcehttp://daveweaver.net/notebook,permalink,InnovationFeatureCreepAndOpenSourcehttp://daveweaver.net/notebook,permalink,InnovationFeatureCreepAndOpenSourceFri, 09 Nov 2007 14:50:04 GMT<p><a href="http://www.businessinnovationfactory.com/innovationstorystudio/bif3_jfried.php" target="_blank"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 20px; border-left: 0px; border-bottom: 0px" height="231" alt="image" src="http://daveweaver.net/media/blog/WindowsLiveWriter/InnovationFeatureCreepandOpenSource_89CC/image_3.png" width="433" border="0"></a> <a title="Interview with Jason Fried" href="http://www.businessinnovationfactory.com/innovationstorystudio/bif3_jfried.php" target="_blank">Here's a very interesting interview</a> of Jason Fried (of 37signals) by Walt Mossberg. It's from a conference on innovation in business. Jason explains how 37signals' business model helps them avoid the pressures of feature creep and how that makes his product a success. He emphasizes the use of the word "No" in developing software and trying to please everyone is the road to mediocrity. He comes up with a fitting analogy using Italian restaurants, but you'll have to watch the interview to hear it. The interview goes on to examine how feature creep affects the success of open source. </p>http://daveweaver.net/notebook,commentview,InnovationFeatureCreepAndOpenSourcedesign;programming
http://daveweaver.net/notebook,trackback,HighScalabilityByAmazonhttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,HighScalabilityByAmazonhttp://daveweaver.net/notebook,commentview,HighScalabilityByAmazonhttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=c086f635-22bc-4a96-8435-2c092917ae13

imageHere's an interesting write-up that summarizes several sources of information about Amazon and high scalability systems. I thought some of the bullet points were pretty insightful...

  • Between 100-150 services are accessed to build a page.
  • Take it for granted stuff fails, that's reality, embrace it. For example, go more with a fast reboot and fast recover approach.
  • Work from the customer backward. Focus on value you want to deliver
    for the customer. Start with a press release of what features the user will see and work backwards to check that you are building something valuable.
  • Use measurement and objective debate to separate the good from the bad. Referred to as getting rid of the influence of the HiPPO's, the highest paid people in the room. This is done with techniques like A/B testing and Web Analytics. If you have a question about what you should do, code it up, let people use it, and see which alternative gives you the results you want.
High Scalability By Amazonhttp://daveweaver.net/notebook,permalink,HighScalabilityByAmazonhttp://daveweaver.net/notebook,permalink,HighScalabilityByAmazonTue, 18 Sep 2007 22:38:56 GMT<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 20px 20px; border-right-width: 0px" height="43" alt="image" src="http://daveweaver.net/media/blog/WindowsLiveWriter/HighScalabilityByAmazon_10657/image_1.png" width="185" align="right" border="0"> <a title="Amazon Architecture" href="http://highscalability.com/amazon-architecture" target="_blank">Here's an interesting write-up</a> that summarizes several sources of information about Amazon and high scalability systems. I thought some of the bullet points were pretty insightful... </p> <ul> <li>Between 100-150 services are accessed to build a page. <li>Take it for granted stuff fails, that's reality, embrace it. For example, go more with a fast reboot and fast recover approach. <li>Work from the customer backward. Focus on value you want to deliver<br>for the customer. Start with a press release of what features the user will see and work backwards to check that you are building something valuable. <li>Use measurement and objective debate to separate the good from the bad. Referred to as getting rid of the influence of the HiPPO's, the highest paid people in the room. This is done with techniques like A/B testing and <acronym>Web Analytics</acronym>. If you have a question about what you should do, code it up, let people use it, and see which alternative gives you the results you want.</li> </ul>http://daveweaver.net/notebook,commentview,HighScalabilityByAmazonprogramming;web
http://daveweaver.net/notebook,trackback,MicrosoftSurfaceAndSilverlighthttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,MicrosoftSurfaceAndSilverlighthttp://daveweaver.net/notebook,commentview,MicrosoftSurfaceAndSilverlighthttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=d48b8bf5-030d-4c5c-9e76-f6089d5fe8b1

3-4-View.jpgIf you haven't seen all the video clips for Microsoft Surface yet you'll have to check them out. Surface should be really cool and should enable some giant steps forward with user interfaces. Your typical windowed application will be a thing of the past and that should also carry over into desktop computers. I'd expect some multi-touch flat panels for your PC too.

From what I've read, all the apps shown on Surface were written using WPF on the .Net Framework. Silverlight is another technology from Microsoft that brings WPF and .Net to the web browser (cross-platform even). Silverlight is the re-branded WPF/E code and is the next big thing from MS as far as the visual web goes. We used Silverlight (then WPF/E) for a SalesWorks demo back in February. Think of Silverlight as Microsoft's version of Flash.

image To see something really neat, check out this demo of a Surface-style app using Silverlight in your web browser. You'll need to install the Silverlight Alpha to see it (just click thru the steps to install it). Yeah, that's a video file running in there. It's really amazing. You just want to put your fingers to the screen and start dragging the pictures around. 

Microsoft Surface And Silverlighthttp://daveweaver.net/notebook,permalink,MicrosoftSurfaceAndSilverlighthttp://daveweaver.net/notebook,permalink,MicrosoftSurfaceAndSilverlightFri, 24 Aug 2007 00:54:19 GMT<p><img style="margin: 0px 0px 20px 20px" height="189" alt="3-4-View.jpg" src="http://blog.scifi.com/tech/Pics/3-4-View.jpg" width="240" align="right">If you haven't seen all the video clips for Microsoft Surface yet you'll have to <a title="Microsoft Surface" href="http://www.microsoft.com/surface/" target="_blank">check them out</a>. Surface&nbsp;should be&nbsp;really cool and should enable some giant steps forward with user interfaces. Your typical windowed application will be a thing of the past and&nbsp;that should also&nbsp;carry over into desktop computers. I'd expect some multi-touch flat panels for your PC too. </p> <p>From <a href="http://weblogs.asp.net/scottgu/archive/2007/05/30/microsoft-surface-and-wpf.aspx" target="_blank">what I've read</a>, all the apps shown on Surface were written&nbsp;using WPF on the .Net Framework. Silverlight is another technology from Microsoft that brings WPF and .Net to the web browser (cross-platform even). Silverlight is&nbsp;the re-branded WPF/E code and is the next big thing from MS as far as the visual web goes. We used Silverlight (then WPF/E) for a <a title="Using WPF/E In A Product Demo" href="http://daveweaver.net/notebook,permalink,UsingWPFEInAProductDemo" target="_blank">SalesWorks demo</a> back in February. Think of Silverlight as Microsoft's version of Flash. </p> <p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/MicrosoftSurfaceAndSilverlight_125C5/image.png" atomicselection="true"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 20px 20px 0px; border-right-width: 0px" height="151" alt="image" src="http://daveweaver.net/media/blog/WindowsLiveWriter/MicrosoftSurfaceAndSilverlight_125C5/image_thumb.png" width="181" align="left" border="0"></a> To see something really neat, <a title="Silverlight &quot;Surface&quot; Demo" href="http://silverlight.schwarz-interactive.de/ex04/default.html" target="_blank">check out this demo</a> of a Surface-style app using Silverlight in your web browser. You'll need to install the Silverlight Alpha to see it (just click thru the steps to install it). Yeah, that's a video file running in there. It's really amazing. You just want to put your fingers to the screen and start dragging the pictures around.&nbsp; </p> <p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:7807a026-e575-491d-967b-1f2e51dbd842" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px;display: none;">Technorati tags: <a href="http://technorati.com/tags/Microsoft" rel="tag">Microsoft</a>, <a href="http://technorati.com/tags/Surface" rel="tag">Surface</a>, <a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>, <a href="http://technorati.com/tags/WPF" rel="tag">WPF</a>, <a href="http://technorati.com/tags/SalesWorks" rel="tag">SalesWorks</a> </div>>http://daveweaver.net/notebook,commentview,MicrosoftSurfaceAndSilverlightdesktop;programming;web
http://daveweaver.net/notebook,trackback,PowerShellCheatSheethttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,PowerShellCheatSheethttp://daveweaver.net/notebook,commentview,PowerShellCheatSheethttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=197e5402-d54a-4965-84d5-379b15566c87

image I don't use MS PowerShell very often, but sometimes it does come in handy for testing .NET components. It seems like every time I want to use it I am Googling for basic commands to use with it. I've run across this handy little cheat sheet that you can print out. PowerShell Cheat Sheet Redux

PowerShell Cheat Sheethttp://daveweaver.net/notebook,permalink,PowerShellCheatSheethttp://daveweaver.net/notebook,permalink,PowerShellCheatSheetWed, 15 Aug 2007 19:29:05 GMT<p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/PowerShellCheatSheet_D9B5/image.png" atomicselection="true"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 20px 20px 0px; border-right-width: 0px" height="89" alt="image" src="http://daveweaver.net/media/blog/WindowsLiveWriter/PowerShellCheatSheet_D9B5/image_thumb.png" width="120" align="left" border="0"></a> I don't use MS PowerShell very often, but sometimes it does come in handy for testing .NET components. It seems like every time I want to use it I am Googling for basic commands to use with it. I've run across this handy little cheat sheet that you can print out. <a title="PowerShell Cheat Sheet Redux" href="http://blogs.msdn.com/powershell/archive/2007/01/25/powershell-cheat-sheet-redux-the-pdf-version.aspx" target="_blank">PowerShell Cheat Sheet Redux</a> </p> <div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:b534000c-2246-4513-82c9-8bfeacb003a1" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px; display: none;">Technorati tags: <a href="http://technorati.com/tags/Powershell" rel="tag">Powershell</a>, <a href="http://technorati.com/tags/Microsoft" rel="tag">Microsoft</a> </div>http://daveweaver.net/notebook,commentview,PowerShellCheatSheetprogramming;tools
http://daveweaver.net/notebook,trackback,UseReflectionToMacroReplaceEmailMessageshttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,UseReflectionToMacroReplaceEmailMessageshttp://daveweaver.net/notebook,commentview,UseReflectionToMacroReplaceEmailMessageshttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=6f784935-167e-4a8d-9aab-d07882671530

One of the web services I've been working on has the requirement to send out formatted emails to internal user and external customers. In order for the service to go live we needed to take any day-to-day maintenance duties away from the developers of the project. One aspect of those duties is to keep the email messages that go out up-to-date. We store the addresses, subject and body of the various emails in the database. With the message bodies, we've designed it that the author can insert various macros that will get replaced with contextual values.

For example, when a new account is created a new email is fired off to our customer. That email needs to list all the specific details of the new account. The email message will have macros available like $AccountId$, $ContactFirstName$ or $InitialPassword$. When we generate the email, we call a simple function that uses reflection to pull the properties out of the Account object and replace the macros within the email message. Below is the VB.Net function that does that.

PublicSharedFunction ReplaceMessageMacros(ByVal Msg AsString, ByVal Obj AsObject, ByVal ObjType As Type) AsStringDim objectType As Type = Obj.GetTypeDim pi As PropertyInfo()
    Dim i AsInteger' get the property list from the object passed in
    pi =  = objectType.GetProperties(BindingFlags.PublicOr BindingFlags.Instance)
    
    ' loop thru all properties of object and see if a macro exists in the MsgFor i = 0 To (pi.Length - 1)
        Dim val AsStringTry
            val = pi(i).GetValue(Obj, Nothing).ToString()
        Catch ex As Exception
            val = ""EndTry' replace the macro with the property value
        Msg = Replace(Msg, "$" & pi(i).Name & "$", val)
    NextReturn Msg
EndFunction

Make sure you import System.Reflection

Use Reflection To Macro-Replace Email Messageshttp://daveweaver.net/notebook,permalink,UseReflectionToMacroReplaceEmailMessageshttp://daveweaver.net/notebook,permalink,UseReflectionToMacroReplaceEmailMessagesSun, 11 Mar 2007 14:25:16 GMT<p>One of the web services I've been working on has the requirement to send out formatted emails to internal user and external customers. In order for the service to go live we needed to take any day-to-day maintenance duties away from the developers of the project. One&nbsp;aspect of those duties is to keep the email messages that go out up-to-date. We store the addresses, subject and body of the various emails in the database. With the message bodies, we've&nbsp;designed&nbsp;it that the author can insert various macros that will get replaced with contextual values. </p> <p>For example, when a new account is created a new email is fired off to our customer. That email needs to list all the specific details of the new account. The email message will have macros available like $AccountId$, $ContactFirstName$ or $InitialPassword$. When we generate the email, we call a simple function that uses reflection to pull the properties out of the Account object and replace the macros within the email message. Below is the VB.Net function that does that. </p><pre class="csharpcode"><span class="kwrd">Public</span> <span class="kwrd">Shared</span> <span class="kwrd">Function</span> ReplaceMessageMacros(<span class="kwrd">ByVal</span> Msg <span class="kwrd">As</span> <span class="kwrd">String</span>, <span class="kwrd">ByVal</span> Obj <span class="kwrd">As</span> <span class="kwrd">Object</span>, <span class="kwrd">ByVal</span> ObjType <span class="kwrd">As</span> Type) <span class="kwrd">As</span> <span class="kwrd">String</span> <span class="kwrd">Dim</span> objectType <span class="kwrd">As</span> Type = Obj.<span class="kwrd">GetType</span> <span class="kwrd">Dim</span> pi <span class="kwrd">As</span> PropertyInfo() <span class="kwrd">Dim</span> i <span class="kwrd">As</span> <span class="kwrd">Integer</span> <span class="rem">' get the property list from the object passed in</span> pi = = objectType.GetProperties(BindingFlags.<span class="kwrd">Public</span> <span class="kwrd">Or</span> BindingFlags.Instance) <span class="rem">' loop thru all properties of object and see if a macro exists in the Msg</span> <span class="kwrd">For</span> i = 0 <span class="kwrd">To</span> (pi.Length - 1) <span class="kwrd">Dim</span> val <span class="kwrd">As</span> <span class="kwrd">String</span> <span class="kwrd">Try</span> val = pi(i).GetValue(Obj, <span class="kwrd">Nothing</span>).ToString() <span class="kwrd">Catch</span> ex <span class="kwrd">As</span> Exception val = <span class="str">""</span> <span class="kwrd">End</span> <span class="kwrd">Try</span> <span class="rem">' replace the macro with the property value</span> Msg = Replace(Msg, <span class="str">"$"</span> &amp; pi(i).Name &amp; <span class="str">"$"</span>, val) <span class="kwrd">Next</span> <span class="kwrd">Return</span> Msg <span class="kwrd">End</span> <span class="kwrd">Function</span> </pre> <p>Make sure you import System.Reflection </p>http://daveweaver.net/notebook,commentview,UseReflectionToMacroReplaceEmailMessagesprogramming
http://daveweaver.net/notebook,trackback,CreateAScaledThumbnailImageInASPNEThttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,CreateAScaledThumbnailImageInASPNEThttp://daveweaver.net/notebook,commentview,CreateAScaledThumbnailImageInASPNEThttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7eb589a0-fd07-4a10-8dd4-9ce22825e05a

I occasionally get questions on how I do my thumbnail images for my photo gallery. This site runs on ASP.NET and the photo section automatically creates thumbnails of JPEG images on the fly. In the real world, a web site like flckr.com wouldn't work if thumbnails were always created on the fly, but for my small amount of pictures it works just fine. Below is the code that creates a scaled thumbnail from a JPEG path and writes it back to the browser. This code is used within an HTTP handler that just serves thumbnails.

A couple points of interest. The code encodes the thumbnail at 75% quality. If the original image is smaller than the requested width and height, it won't scale it but will send it to the browser.

 

   1:  PublicSub ScaledImage(ByVal Path AsString, ByVal Width AsInteger, ByVal Height AsInteger)
   2:  Dim originalWidth AsInteger
   3:  Dim originalHeight AsInteger
   4:  Dim image As bitmap = bitmap.FromFile(Path)
   5:   
   6:      originalHeight = image.Height
   7:      originalWidth = image.Width
   8:   
   9:  Dim heightRatio AsDouble = CDbl(originalHeight / originalWidth)
  10:  Dim widthRatio AsDouble = CDbl(originalWidth / originalHeight)
  11:   
  12:  Dim desiredHeight AsInteger = Height
  13:  Dim desiredWidth AsInteger = Width
  14:   
  15:      Height = desiredHeight
  16:      Width = Convert.ToInt32(Height * widthRatio)
  17:  If Width > desiredWidth Then
  18:          Width = desiredWidth
  19:          Height = Convert.ToInt32(Width * heightRatio)
  20:  EndIf
  21:   
  22:  If Height > originalHeight Or Width > originalWidth Then
  23:          Height = originalHeight
  24:          Width = originalWidth
  25:   
  26:          image.Save(Response.OutputStream, ImageFormat.Jpeg)
  27:  Else
  28:  Dim thumb As Graphics
  29:  Dim bitmap As bitmap = New bitmap(Width, Height)
  30:          thumb = Graphics.FromImage(bitmap)
  31:          thumb.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
  32:          thumb.DrawImage(image, 0, 0, Width, Height)
  33:   
  34:  Dim codec As ImageCodecInfo = GetEncoderInfo("image/jpeg")
  35:   
  36:  Dim eps As EncoderParameters = New EncoderParameters(1)
  37:          eps = New EncoderParameters
  38:          eps.Param(0) = New EncoderParameter(Encoder.Quality, CLng(75))
  39:   
  40:          bitmap.Save(Response.OutputStream, codec, eps)
  41:   
  42:          thumb.Dispose()
  43:          bitmap.Dispose()
  44:          eps.Dispose()
  45:  EndIf
  46:      image.Dispose()
  47:   
  48:      Response.ContentType = "image/pjpeg"
  49:      Response.End()
  50:  EndSub
  51:   
  52:  PublicFunction GetEncoderInfo(ByVal MimeType AsString) As ImageCodecInfo
  53:  Dim myEncoders() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders()
  54:  Dim myEncoder As ImageCodecInfo
  55:  ForEach myEncoder In myEncoders
  56:  If myEncoder.MimeType = MimeType Then
  57:  Return myEncoder
  58:  EndIf
  59:  Next
  60:  ReturnNothing
  61:  EndFunction

Works for me.Create A Scaled Thumbnail Image In ASP.NEThttp://daveweaver.net/notebook,permalink,CreateAScaledThumbnailImageInASPNEThttp://daveweaver.net/notebook,permalink,CreateAScaledThumbnailImageInASPNETMon, 26 Feb 2007 21:54:44 GMT<p><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 20px 20px; border-right-width: 0px" height="90" src="http://daveweaver.net/media/blog/WindowsLiveWriter/CreateAScaledThumbnailImageInASP.NET_ED4F/image%7B0%7D%5B6%5D.png" width="132" align="right" border="0"> I occasionally get questions on how I do my thumbnail images for my <a title="Photo Gallery" href="http://daveweaver.net/photos" target="_blank">photo gallery</a>. This site runs on ASP.NET and the photo section automatically creates thumbnails of JPEG images on the fly. In the real world, a&nbsp;web site like&nbsp;flckr.com&nbsp;wouldn't work if thumbnails were always created on the fly, but for my small amount of pictures it works just fine. Below is the code&nbsp;that creates a scaled thumbnail from a JPEG path and writes it back to&nbsp;the browser. This code is used within an HTTP handler that just serves thumbnails. </p> <p>A couple points of interest. The code encodes the thumbnail at 75% quality. If the original image is smaller than the requested width and height, it won't scale it but will send it to the browser. </p> <p>&nbsp; </p> <div class="csharpcode"><pre><span class="lnum"> 1: </span><span class="kwrd">Public</span> <span class="kwrd">Sub</span> ScaledImage(<span class="kwrd">ByVal</span> Path <span class="kwrd">As</span> <span class="kwrd">String</span>, <span class="kwrd">ByVal</span> Width <span class="kwrd">As</span> <span class="kwrd">Integer</span>, <span class="kwrd">ByVal</span> Height <span class="kwrd">As</span> <span class="kwrd">Integer</span>)</pre><pre><span class="lnum"> 2: </span> <span class="kwrd">Dim</span> originalWidth <span class="kwrd">As</span> <span class="kwrd">Integer</span></pre><pre><span class="lnum"> 3: </span> <span class="kwrd">Dim</span> originalHeight <span class="kwrd">As</span> <span class="kwrd">Integer</span></pre><pre><span class="lnum"> 4: </span> <span class="kwrd">Dim</span> image <span class="kwrd">As</span> bitmap = bitmap.FromFile(Path)</pre><pre><span class="lnum"> 5: </span>&nbsp;</pre><pre><span class="lnum"> 6: </span> originalHeight = image.Height</pre><pre><span class="lnum"> 7: </span> originalWidth = image.Width</pre><pre><span class="lnum"> 8: </span>&nbsp;</pre><pre><span class="lnum"> 9: </span> <span class="kwrd">Dim</span> heightRatio <span class="kwrd">As</span> <span class="kwrd">Double</span> = <span class="kwrd">CDbl</span>(originalHeight / originalWidth)</pre><pre><span class="lnum"> 10: </span> <span class="kwrd">Dim</span> widthRatio <span class="kwrd">As</span> <span class="kwrd">Double</span> = <span class="kwrd">CDbl</span>(originalWidth / originalHeight)</pre><pre><span class="lnum"> 11: </span>&nbsp;</pre><pre><span class="lnum"> 12: </span> <span class="kwrd">Dim</span> desiredHeight <span class="kwrd">As</span> <span class="kwrd">Integer</span> = Height</pre><pre><span class="lnum"> 13: </span> <span class="kwrd">Dim</span> desiredWidth <span class="kwrd">As</span> <span class="kwrd">Integer</span> = Width</pre><pre><span class="lnum"> 14: </span>&nbsp;</pre><pre><span class="lnum"> 15: </span> Height = desiredHeight</pre><pre><span class="lnum"> 16: </span> Width = Convert.ToInt32(Height * widthRatio)</pre><pre><span class="lnum"> 17: </span> <span class="kwrd">If</span> Width &gt; desiredWidth <span class="kwrd">Then</span></pre><pre><span class="lnum"> 18: </span> Width = desiredWidth</pre><pre><span class="lnum"> 19: </span> Height = Convert.ToInt32(Width * heightRatio)</pre><pre><span class="lnum"> 20: </span> <span class="kwrd">End</span> <span class="kwrd">If</span></pre><pre><span class="lnum"> 21: </span>&nbsp;</pre><pre><span class="lnum"> 22: </span> <span class="kwrd">If</span> Height &gt; originalHeight <span class="kwrd">Or</span> Width &gt; originalWidth <span class="kwrd">Then</span></pre><pre><span class="lnum"> 23: </span> Height = originalHeight</pre><pre><span class="lnum"> 24: </span> Width = originalWidth</pre><pre><span class="lnum"> 25: </span>&nbsp;</pre><pre><span class="lnum"> 26: </span> image.Save(Response.OutputStream, ImageFormat.Jpeg)</pre><pre><span class="lnum"> 27: </span> <span class="kwrd">Else</span></pre><pre><span class="lnum"> 28: </span> <span class="kwrd">Dim</span> thumb <span class="kwrd">As</span> Graphics</pre><pre><span class="lnum"> 29: </span> <span class="kwrd">Dim</span> bitmap <span class="kwrd">As</span> bitmap = <span class="kwrd">New</span> bitmap(Width, Height)</pre><pre><span class="lnum"> 30: </span> thumb = Graphics.FromImage(bitmap)</pre><pre><span class="lnum"> 31: </span> thumb.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic</pre><pre><span class="lnum"> 32: </span> thumb.DrawImage(image, 0, 0, Width, Height)</pre><pre><span class="lnum"> 33: </span>&nbsp;</pre><pre><span class="lnum"> 34: </span> <span class="kwrd">Dim</span> codec <span class="kwrd">As</span> ImageCodecInfo = GetEncoderInfo(<span class="str">"image/jpeg"</span>)</pre><pre><span class="lnum"> 35: </span>&nbsp;</pre><pre><span class="lnum"> 36: </span> <span class="kwrd">Dim</span> eps <span class="kwrd">As</span> EncoderParameters = <span class="kwrd">New</span> EncoderParameters(1)</pre><pre><span class="lnum"> 37: </span> eps = <span class="kwrd">New</span> EncoderParameters</pre><pre><span class="lnum"> 38: </span> eps.Param(0) = <span class="kwrd">New</span> EncoderParameter(Encoder.Quality, <span class="kwrd">CLng</span>(75))</pre><pre><span class="lnum"> 39: </span>&nbsp;</pre><pre><span class="lnum"> 40: </span> bitmap.Save(Response.OutputStream, codec, eps)</pre><pre><span class="lnum"> 41: </span>&nbsp;</pre><pre><span class="lnum"> 42: </span> thumb.Dispose()</pre><pre><span class="lnum"> 43: </span> bitmap.Dispose()</pre><pre><span class="lnum"> 44: </span> eps.Dispose()</pre><pre><span class="lnum"> 45: </span> <span class="kwrd">End</span> <span class="kwrd">If</span></pre><pre><span class="lnum"> 46: </span> image.Dispose()</pre><pre><span class="lnum"> 47: </span>&nbsp;</pre><pre><span class="lnum"> 48: </span> Response.ContentType = <span class="str">"image/pjpeg"</span></pre><pre><span class="lnum"> 49: </span> Response.<span class="kwrd">End</span>()</pre><pre><span class="lnum"> 50: </span><span class="kwrd">End</span> <span class="kwrd">Sub</span></pre><pre><span class="lnum"> 51: </span>&nbsp;</pre><pre><span class="lnum"> 52: </span><span class="kwrd">Public</span> <span class="kwrd">Function</span> GetEncoderInfo(<span class="kwrd">ByVal</span> MimeType <span class="kwrd">As</span> <span class="kwrd">String</span>) <span class="kwrd">As</span> ImageCodecInfo</pre><pre><span class="lnum"> 53: </span> <span class="kwrd">Dim</span> myEncoders() <span class="kwrd">As</span> ImageCodecInfo = ImageCodecInfo.GetImageEncoders()</pre><pre><span class="lnum"> 54: </span> <span class="kwrd">Dim</span> myEncoder <span class="kwrd">As</span> ImageCodecInfo</pre><pre><span class="lnum"> 55: </span> <span class="kwrd">For</span> <span class="kwrd">Each</span> myEncoder <span class="kwrd">In</span> myEncoders</pre><pre><span class="lnum"> 56: </span> <span class="kwrd">If</span> myEncoder.MimeType = MimeType <span class="kwrd">Then</span></pre><pre><span class="lnum"> 57: </span> <span class="kwrd">Return</span> myEncoder</pre><pre><span class="lnum"> 58: </span> <span class="kwrd">End</span> <span class="kwrd">If</span></pre><pre><span class="lnum"> 59: </span> <span class="kwrd">Next</span></pre><pre><span class="lnum"> 60: </span> <span class="kwrd">Return</span> <span class="kwrd">Nothing</span></pre><pre><span class="lnum"> 61: </span><span class="kwrd">End</span> <span class="kwrd">Function</span></pre> </div> <br>Works for me.http://daveweaver.net/notebook,commentview,CreateAScaledThumbnailImageInASPNETprogramming;web
http://daveweaver.net/notebook,trackback,UsingSHA1HashingToVerifyDataIntegrityhttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,UsingSHA1HashingToVerifyDataIntegrityhttp://daveweaver.net/notebook,commentview,UsingSHA1HashingToVerifyDataIntegrityhttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=c50c07af-0af3-4c3c-8101-934934ed50ab

Hashing is a reproducible process to calculate a hash value from some data. The hash values are unique and specific for the data it was derived from. Wikipedia has a good explanation of hashing. i will be showing some VB.Net code in this article that uses the SHA1 algorithm to do some hashing.

Hashing by itself does nothing to prevent tampering with the data. Message Authentication Codes (MAC) are a way to prevent this. MACs use symmetric encryption methods to protect the sent hash. Symmetric encryption uses one private session key and both the sender and receiver require to have a copy of this key.

Below is the VB.Net code to generate a MAC using HMACSHA1:

   1:  Imports System.Security.Cryptography
   2:   
   3:  PublicSharedFunction ComputeHash(ByVal Data AsString, ByVal Key AsString) AsString
   4:  ' initialize the keyed hash
   5:  Dim sha1Algo AsNew HMACSHA1(System.Text.Encoding.ASCII.GetBytes(Key))
   6:   
   7:  ' compute hash 
   8:  Dim hash AsByte() = sha1Algo.ComputeHash(System.Text.Encoding.ASCII.GetBytes(Data))
   9:   
  10:  ' convert to string and return
  11:  Return System.BitConverter.ToString(hash)
  12:  EndFunction
  13:   
  14:  PublicSharedFunction VerifyHash(ByVal Received AsString, ByVal Data AsString, ByVal Key AsString) AsBoolean
  15:  ' hash our data
  16:  Dim hash asString = ComputeHash(Data, Key)
  17:  
  18:  ' compare strings
  19:  Return (Received = hash)
  20:  EndFunction
  21:   

This code was derived from a more in-depth article: Hashing, MACs, and Digital Signatures in .NET.

Using SHA1 Hashing To Verify Data Integrityhttp://daveweaver.net/notebook,permalink,UsingSHA1HashingToVerifyDataIntegrityhttp://daveweaver.net/notebook,permalink,UsingSHA1HashingToVerifyDataIntegrityWed, 21 Feb 2007 17:15:56 GMT<p>Hashing is a reproducible process to calculate a hash value from some data. The hash values are unique and specific&nbsp;for the data it was derived from. <a title="Wikipedia: Hash function" href="http://en.wikipedia.org/wiki/Hash_function" target="_blank">Wikipedia has a good explanation of hashing</a>. i will be showing some VB.Net code in this article that uses the <a title="Wikipedia: SHA hash functions" href="http://en.wikipedia.org/wiki/SHA1" target="_blank">SHA1 algorithm</a> to do some hashing. </p> <p>Hashing by itself does nothing to prevent tampering with the data. <a title="Wikipedia: Message authentication code" href="http://en.wikipedia.org/wiki/Message_authentication_codes" target="_blank">Message Authentication Codes</a> (MAC)&nbsp;are a way to prevent this. MACs use symmetric encryption methods to protect the sent hash. Symmetric encryption uses one private session key and both the sender and receiver require to have a copy of this&nbsp;key. </p> <p>Below is the VB.Net code to generate a MAC using <a title="MSDN: HMACSHA1 Class" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemsecuritycryptographyhmacsha1classtopic.asp" target="_blank">HMACSHA1</a>: </p> <div class="csharpcode"><pre><span class="lnum"> 1: </span><span class="kwrd">Imports</span> System.Security.Cryptography</pre><pre><span class="lnum"> 2: </span>&nbsp;</pre><pre><span class="lnum"> 3: </span><span class="kwrd">Public</span> <span class="kwrd">Shared</span> <span class="kwrd">Function</span> ComputeHash(<span class="kwrd">ByVal</span> Data <span class="kwrd">As</span> <span class="kwrd">String</span>, <span class="kwrd">ByVal</span> Key <span class="kwrd">As</span> <span class="kwrd">String</span>) <span class="kwrd">As</span> <span class="kwrd">String</span></pre><pre><span class="lnum"> 4: </span> <span class="rem">' initialize the keyed hash</span></pre><pre><span class="lnum"> 5: </span> <span class="kwrd">Dim</span> sha1Algo <span class="kwrd">As</span> <span class="kwrd">New</span> HMACSHA1(System.Text.Encoding.ASCII.GetBytes(Key))</pre><pre><span class="lnum"> 6: </span>&nbsp;</pre><pre><span class="lnum"> 7: </span> <span class="rem">' compute hash </span></pre><pre><span class="lnum"> 8: </span> <span class="kwrd">Dim</span> hash <span class="kwrd">As</span> <span class="kwrd">Byte</span>() = sha1Algo.ComputeHash(System.Text.Encoding.ASCII.GetBytes(Data))</pre><pre><span class="lnum"> 9: </span>&nbsp;</pre><pre><span class="lnum"> 10: </span> <span class="rem">' convert to string and return</span></pre><pre><span class="lnum"> 11: </span> <span class="kwrd">Return</span> System.BitConverter.ToString(hash)</pre><pre><span class="lnum"> 12: </span><span class="kwrd">End</span> <span class="kwrd">Function</span></pre><pre><span class="lnum"> 13: </span>&nbsp;</pre><pre><span class="lnum"> 14: </span><span class="kwrd">Public</span> <span class="kwrd">Shared</span> <span class="kwrd">Function</span> VerifyHash(<span class="kwrd">ByVal</span> Received <span class="kwrd">As</span> <span class="kwrd">String</span>, <span class="kwrd">ByVal</span> Data <span class="kwrd">As</span> <span class="kwrd">String</span>, <span class="kwrd">ByVal</span> Key <span class="kwrd">As</span> <span class="kwrd">String</span>) <span class="kwrd">As</span> <span class="kwrd">Boolean</span></pre><pre><span class="lnum"> 15: </span> <span class="rem">' hash our data</span></pre><pre><span class="lnum"> 16: </span> <span class="kwrd">Dim</span> hash <span class="kwrd">as</span> <span class="kwrd">String</span> = ComputeHash(Data, Key)</pre><pre><span class="lnum"> 17: </span> </pre><pre><span class="lnum"> 18: </span> <span class="rem">' compare strings</span></pre><pre><span class="lnum"> 19: </span> <span class="kwrd">Return</span> (Received = hash)</pre><pre><span class="lnum"> 20: </span><span class="kwrd">End</span> <span class="kwrd">Function</span></pre><pre><span class="lnum"> 21: </span>&nbsp;</pre> </div> <p>This code was derived from a more in-depth article: <a title="Hashing, MACs, and Digital Signatures in .NET" href="http://dotnetslackers.com/articles/security/Hashing_MACs_and_Digital_Signatures_in_NET.aspx" target="_blank">Hashing, MACs, and Digital Signatures in .NET</a>. </p> <style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style>http://daveweaver.net/notebook,commentview,UsingSHA1HashingToVerifyDataIntegrityprogramming
http://daveweaver.net/notebook,trackback,UsingWPFEInAProductDemohttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,UsingWPFEInAProductDemohttp://daveweaver.net/notebook,commentview,UsingWPFEInAProductDemohttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=51a0d0c5-0e30-47bb-a1f8-8437fc634643

I have been evaluating WPF/E for add-ins to my company's products. One screen we have been thinking about for a while is a lead pipeline that shows lead stages in a graphical way. Our products leverage IE for the presentation layer and it is tough to do a compelling pipeline with just DHTML.

 

WPF/E brings a lot to the table. First of all it is very easy to incorporate into our screens, I simply insert the control code and link in the aghost.js file. It also enables us to easily separate the markup from the script. The HTML file orchestrates the screen while the script and XAML reside in separate files. I also like the division of labor. As shown in these screenshots I've coded the pipeline screen as a segmented pipe along the top of the screen. As the developer I just created simple XAML objects that represented the different elements of the pipeline, nothing too fancy. I then hook up my script to control click-thrus and mouse-overs (the second screen shows how the mouse-over affects the pipeline). In production I would then had the XAML source over to a designer and they would take my rudimentary design and create something beautiful from it. They'd send me the updated XAML file and I just insert back into the development tree and everything should still work with changes. In this case I was the designer too, but you should start to see how this should make development easier.

 

Another thing that I experimented with was trying to use the same XAML objects and provide an entirely different look and feel for the screen. The final screen shot shows how that turned out. This pipeline demo is very simple, but it starts to paint a picture of how WPF and WPF/E can be used in software. I can imagine that things are not quite as simple when more complex functionality is needed. When trying to change the pipeline into a vertical funnel, I did have to adjust some of my code to make it work.

 

I did try to use Microsoft's new Expression Design application to create the XAML I used in this demo. I designed the circular pipeline segments and exported them as WPF/E XAML code. That sort of worked, but It generated everything as complex paths and was hard to modify by hand. By the time I had finished the demo, I ended up starting from scratch with the XAML objects. Still, the tools are great and they look very promising.  

Using WPF/E In A Product Demohttp://daveweaver.net/notebook,permalink,UsingWPFEInAProductDemohttp://daveweaver.net/notebook,permalink,UsingWPFEInAProductDemoWed, 31 Jan 2007 19:29:20 GMT<p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/UsingWPFEInAProductDemo_9DAD/image04.png" atomicselection="true"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 20px 20px; border-right-width: 0px" height="180" src="http://daveweaver.net/media/blog/WindowsLiveWriter/UsingWPFEInAProductDemo_9DAD/image0_thumb2.png" width="240" align="right" border="0"></a>I have been evaluating WPF/E for add-ins to my company's products. One screen we have been thinking about for a while is a lead pipeline that shows lead stages in a graphical way. Our products leverage IE for the presentation layer and&nbsp;it is&nbsp;tough to do a compelling pipeline with just DHTML. </p> <p>&nbsp; </p> <p><a title="Getting Started with WPF/E" href="http://msdn2.microsoft.com/en-gb/library/bb190632.aspx" target="_blank">WPF/E brings a lot to the table</a>. First of all it is very easy to incorporate into our screens, I simply insert the control code and link in the aghost.js file. It also enables us to easily separate the markup from the script. The HTML file orchestrates the screen while the script and XAML reside in separate files. I also like the division of labor. As shown in these screenshots I've coded the pipeline screen as a segmented pipe along the top of the screen. <a href="http://daveweaver.net/media/blog/WindowsLiveWriter/UsingWPFEInAProductDemo_9DAD/image015.png" atomicselection="true"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 20px 0px 20px 20px; border-right-width: 0px" height="180" src="http://daveweaver.net/media/blog/WindowsLiveWriter/UsingWPFEInAProductDemo_9DAD/image0_thumb7.png" width="240" align="right" border="0"></a>As the developer I just created simple XAML objects that represented the different elements of the pipeline, nothing too fancy. I then hook up my script to control click-thrus and mouse-overs (the second screen shows how the mouse-over affects the pipeline). In production I would then had the XAML source over to a designer and they would take my rudimentary design and create something beautiful from it. They'd send me the updated XAML file and I just insert back into the development tree and everything should still work with changes. In this case I was the designer too, but you should start to see how this should make development easier. </p> <p>&nbsp; </p> <p>Another thing that I experimented with was trying to use the same XAML objects and provide an entirely different look and feel for the screen. The final screen shot shows how that turned out. This pipeline demo is very simple, but&nbsp;it starts to paint a picture of how WPF and WPF/E can be used in software. I can imagine that things are not quite as simple when more complex functionality is needed. When trying to change the pipeline into a vertical funnel, I did have to adjust some of my code to make it work.<a href="http://daveweaver.net/media/blog/WindowsLiveWriter/UsingWPFEInAProductDemo_9DAD/image018.png" atomicselection="true"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 20px 0px 20px 20px; border-right-width: 0px" height="180" src="http://daveweaver.net/media/blog/WindowsLiveWriter/UsingWPFEInAProductDemo_9DAD/image0_thumb8.png" width="240" align="right" border="0"></a> </p> <p>&nbsp; </p> <p>I did try to use <a title="Microsoft Expression Design" href="http://www.microsoft.com/products/expression/" target="_blank">Microsoft's new Expression Design application</a> to create the XAML I used in this demo. I designed the circular pipeline segments and <a title="Export WPF/E XAML from Expression Design" href="http://daveweaver.net/notebook,permalink,ExportWPFECompatibleXAMLUsingExpressionDesign">exported them as WPF/E XAML code</a>. That sort of worked, but It generated everything as complex paths and was hard to modify by hand.&nbsp;By the time I had finished the demo, I ended up starting from scratch with the XAML objects.&nbsp;Still, the tools are great and they look very promising. &nbsp; </p>http://daveweaver.net/notebook,commentview,UsingWPFEInAProductDemodesign;desktop;programming;tools;web
http://daveweaver.net/notebook,trackback,ExportWPFECompatibleXAMLUsingExpressionDesignhttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,ExportWPFECompatibleXAMLUsingExpressionDesignhttp://daveweaver.net/notebook,commentview,ExportWPFECompatibleXAMLUsingExpressionDesignhttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=86b8382c-d0a2-412a-8ab2-211d3c0e198f

In my previous post I had only been using Expression Blend and wasn't able to figure out how to get it to generate content for WPF/E. It turns out that only Expression Design can export WPF/E compatible content (thanks ADO Guy).

If you download and install Expression Design, you can create vector-based elements to include in your WPF/E-based web pages. Expression Design is very similar to Adobe Illustrator. Once you've completed your design, click on File>Export>XAML. This will prompt you for a filename then it brings up a XAML Export window like the one on the right. If you select the Document Format dropdown you can select the WPF/E format. I've tried a couple simple tests that displayed correctly in WPF/E Pad.

This is a good step and may be all we need, however I was expecting this same type of functionality with all the Expression tools. Is that coming?

Export WPF/E Compatible XAML Using Expression Designhttp://daveweaver.net/notebook,permalink,ExportWPFECompatibleXAMLUsingExpressionDesignhttp://daveweaver.net/notebook,permalink,ExportWPFECompatibleXAMLUsingExpressionDesignTue, 02 Jan 2007 15:44:59 GMT<p>In my previous post I had only been using Expression Blend and wasn't able to figure out how to get it to generate content for WPF/E. It turns out that only <a title="Download: Microsoft Expression Design December 2006 CTP" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=112D7906-CA5C-43A4-A9FD-C4E2DCA6DD1C&amp;displaylang=en" target="_blank">Expression Design</a> can export WPF/E compatible content (<a title="ADO Guy: Codename &quot;WPF/E&quot; and Expression Toolset" href="http://adoguy.com/viewrant.aspx?id=2144" target="_blank">thanks ADO Guy</a>). </p> <p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/ExportWPFECompatibleXAMLUsingExpressionD_9728/image%7B0%7D%5B5%5D.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 20px 20px; border-left: 0px; border-bottom: 0px" height="240" src="http://daveweaver.net/media/blog/WindowsLiveWriter/ExportWPFECompatibleXAMLUsingExpressionD_9728/image%7B0%7D_thumb%5B1%5D.png" width="178" align="right" border="0"></a> If you download and install Expression Design, you can create vector-based elements to include in your WPF/E-based web pages. Expression Design is very similar to Adobe Illustrator. Once you've completed your design, click on File&gt;Export&gt;XAML. This will prompt you for a filename then it brings up a XAML Export window like the one on the right. If you select the Document Format dropdown you can select the WPF/E format. I've tried a couple simple tests that displayed correctly in WPF/E Pad. </p> <p>This is a good step and may be all we need, however I was expecting this same type of functionality with all the Expression tools. Is that coming? </p>http://daveweaver.net/notebook,commentview,ExportWPFECompatibleXAMLUsingExpressionDesigndesign;programming;web
http://daveweaver.net/notebook,trackback,GettingStartedWithWPFEhttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,GettingStartedWithWPFEhttp://daveweaver.net/notebook,commentview,GettingStartedWithWPFEhttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=945c7be7-3814-46ae-a427-8c564a7d4213

WPF/E Example AppI first crossed paths with Windows Presentation Foundation/Everywhere (WPF/E) on Mike Harsh's blog post about the Mix '06 event in March of 2006. I knew about XAML and where Microsoft was going with their presentation layer tools, but our company creates mass-market desktop software that doesn't utilize the .Net Framework yet. This meant any XAML or WPF was off limits for us. That is until MS announced WPF/E.

In Mike Harsh's words "(WPF/E) is a cross-platform, cross-browser web technology that supports a subset of WPF XAML.  WPF/E also has a friction-free install model and the download size we’re targeting is very small.  WPF/E supports programmability through JavaScript for tight browser integration.  The WPF/E package also contains a small, cross platform subset of the CLR and .NET Framework that can run C# or VB.NET code."

So XAML and WPF can now be hosted in Internet Explorer. Since my company's desktop applications host IE for the presentation layer, then our presentation layer can take advantage of XAML and WPF. Unfortunately there was not much to be heard of WPF/E since March, but this month MS released a CTP of WPF/E.

 

where to get started

Probably the best place to get started is the WPF/E Dev Center on MSDN. Download and install the SDK so you can start trying the examples. The Dev Center has a few that you can look at. Mike harsh has also built a cool little application that let's you test your XAML code, called WPF/E Pad. Once you have the SDK installed you can run the WPF/E Pad and try some of the built in examples. After you get a feel for what can be done try entering some of your own XAML. Try copying and pasting the source from below into the bottom panel of WPF/E Pad and clicking the Load button.

 

<Canvasxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"x:Name="_037_bugs_logo"Width="1056"Height="816"><EllipseHeight="200"Width="200"Canvas.Left="30"Canvas.Top="30"Stroke="Black"StrokeThickness="10"Fill="SlateBlue"/><RectangleHeight="100"Width="100"Canvas.Left="5"Canvas.Top="5"Stroke="Black"StrokeThickness="10"Fill="SlateBlue"/><LineX1="280"Y1="10"X2="10"Y2="280"Stroke="black"StrokeThickness="5"/></Canvas>

 

You should end up with something like the screenshot to the left. The XAML creates an ellipse, a rectange and a line. This is not a very compelling example (it was taken from the MS SDK download) but it gives you something to start with. What's nice about the technology is that it allows you to interact with the XAML code using JavaScript. So you can create a bunch of objects using the XAML markup and embed it in your web page, then use JavaScript to program those objects. For example you can attach events to the XAML objects (similar to DHTML) and handle those events in your JavaScript. WPF/E Pad doesn't support event handling at the moment, so you have to take the next step and create your own web page to test out event handling. Those steps are covered in detail within the WPF/E SDK.

 

what's next?

What makes all this really interesting is how Microsoft is backing up this technology with their development tools. They've recently released an entire suite of apps to generate, manage and debug XAML. Check out their Expression Suite. I think the development tools will be able to target WPF/E versus WPF at some point. Exciting stuff.

Getting Started With WPF/Ehttp://daveweaver.net/notebook,permalink,GettingStartedWithWPFEhttp://daveweaver.net/notebook,permalink,GettingStartedWithWPFEThu, 28 Dec 2006 15:23:35 GMT<p><img style="margin: 0px 0px 20px 20px" alt="WPF/E Example App" src="http://static.flickr.com/37/116850754_f9628b295d_m.jpg" align="right" border="0" minmax_bound="true">I first crossed paths with <a title="Windows Presentation Foundation/Everywhere" href="http://msdn2.microsoft.com/en-us/asp.net/bb187358.aspx" target="_blank">Windows Presentation Foundation/Everywhere</a> (WPF/E) on <a title="WPF/E at Mix '06" href="http://blogs.msdn.com/mharsh/archive/2006/03/23/559106.aspx" target="_blank">Mike Harsh's blog post</a> about the Mix '06 event in March of 2006. I knew about XAML and where Microsoft was going with their presentation layer tools, but our company creates mass-market desktop software that doesn't utilize the .Net Framework yet. This meant any <a title="XAML Overview from MSDN" href="http://msdn2.microsoft.com/en-us/library/ms752059.aspx" target="_blank">XAML</a> or <a title="Windows Presentation Foundation" href="http://wpf.netfx3.com/" target="_blank">WPF</a> was off limits for us. That is until MS announced WPF/E. </p> <blockquote> <p>In Mike Harsh's words "(WPF/E) is a cross-platform, cross-browser web technology that supports a subset of WPF XAML.&nbsp; WPF/E also has a friction-free install model and the download size we’re targeting is very small.&nbsp; WPF/E supports programmability through JavaScript for tight browser integration.&nbsp; The WPF/E package also contains a small, cross platform subset of the CLR and .NET Framework that can run C# or VB.NET code." </p></blockquote> <p>So&nbsp;XAML and WPF can now be hosted in Internet Explorer. Since&nbsp;my company's&nbsp;desktop applications host IE for the presentation layer, then our presentation layer can take advantage of XAML and WPF. Unfortunately there was not much to be heard of WPF/E since March, but this month <a title="Download WPF/E December CTP" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=2B01EC7E-C3B8-47CC-B12A-67C30191C3AA&amp;displaylang=en" target="_blank">MS released a CTP of WPF/E</a>. </p> <p>&nbsp; </p> <p><strong>where to get started</strong> </p> <p>Probably the best place to get started is the <a title="WPF/E Dev Center" href="http://msdn2.microsoft.com/en-us/asp.net/bb187358.aspx" target="_blank">WPF/E Dev Center</a> on MSDN. Download and install the SDK so you can start trying the examples. The Dev Center has a few that you can look at. Mike harsh has also built a cool little application that let's you test your XAML code, called <a title="WPF/E Pad" href="http://www.simplegeek.com/mharsh/wpfepad/" target="_blank">WPF/E Pad</a>. Once you have the SDK installed you can run the&nbsp;WPF/E Pad and try some of the built in examples. After you get a feel for what can be done try entering some of your own XAML. Try copying and pasting the source from below into the bottom panel of WPF/E Pad and clicking the Load button. </p> <p>&nbsp; </p><pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Canvas</span> <span class="attr">xmlns</span><span class="kwrd">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span> <span class="attr">xmlns:x</span><span class="kwrd">="http://schemas.microsoft.com/winfx/2006/xaml"</span> <span class="attr">x:Name</span><span class="kwrd">="_037_bugs_logo"</span> <span class="attr">Width</span><span class="kwrd">="1056"</span> <span class="attr">Height</span><span class="kwrd">="816"</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">Ellipse</span> <span class="attr">Height</span><span class="kwrd">="200"</span> <span class="attr">Width</span><span class="kwrd">="200"</span> <span class="attr">Canvas</span>.<span class="attr">Left</span><span class="kwrd">="30"</span> <span class="attr">Canvas</span>.<span class="attr">Top</span><span class="kwrd">="30"</span> <span class="attr">Stroke</span><span class="kwrd">="Black"</span> <span class="attr">StrokeThickness</span><span class="kwrd">="10"</span> <span class="attr">Fill</span><span class="kwrd">="SlateBlue"</span><span class="kwrd">/&gt;</span> <span class="kwrd">&lt;</span><span class="html">Rectangle</span> <span class="attr">Height</span><span class="kwrd">="100"</span> <span class="attr">Width</span><span class="kwrd">="100"</span> <span class="attr">Canvas</span>.<span class="attr">Left</span><span class="kwrd">="5"</span> <span class="attr">Canvas</span>.<span class="attr">Top</span><span class="kwrd">="5"</span> <span class="attr">Stroke</span><span class="kwrd">="Black"</span> <span class="attr">StrokeThickness</span><span class="kwrd">="10"</span> <span class="attr">Fill</span><span class="kwrd">="SlateBlue"</span><span class="kwrd">/&gt;</span> <span class="kwrd">&lt;</span><span class="html">Line</span> <span class="attr">X1</span><span class="kwrd">="280"</span> <span class="attr">Y1</span><span class="kwrd">="10"</span> <span class="attr">X2</span><span class="kwrd">="10"</span> <span class="attr">Y2</span><span class="kwrd">="280"</span> <span class="attr">Stroke</span><span class="kwrd">="black"</span> <span class="attr">StrokeThickness</span><span class="kwrd">="5"</span><span class="kwrd">/&gt;</span> <span class="kwrd">&lt;/</span><span class="html">Canvas</span><span class="kwrd">&gt;</span></pre> <p>&nbsp; </p> <p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/GettingStartedWithWPFE_8284/image%7B0%7D%5B2%5D.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; margin: 0px 20px 20px 0px; border-left: 0px; border-bottom: 0px" height="143" src="http://daveweaver.net/media/blog/WindowsLiveWriter/GettingStartedWithWPFE_8284/image%7B0%7D_thumb.png" width="240" align="left" border="0"></a>You should end up with something like the screenshot to the left. The XAML creates an ellipse, a rectange and a line. This is not a very compelling example (it was taken from the MS SDK download) but it gives you something to start with. What's nice about the technology is that it allows you to interact with the XAML code using JavaScript. So you can create a bunch of objects using the XAML markup and embed it in your web page, then use JavaScript to program those objects. For example you can attach events to the XAML objects (similar to DHTML) and handle those events in your JavaScript. WPF/E Pad doesn't support event handling at the moment, so you have to take the next step and create your own web page to test out event handling. Those steps are covered in detail within the WPF/E SDK. </p> <p>&nbsp; </p> <p><strong>what's next?</strong> </p> <p>What makes all this really interesting is how Microsoft is backing up this technology with their development tools. They've recently released an entire suite of apps to generate, manage and debug XAML. Check out their <a title="Microsoft Expression Suite" href="http://www.microsoft.com/products/expression/en/default.mspx" target="_blank">Expression Suite</a>. I think the development tools will be able to target WPF/E versus WPF at some point. Exciting stuff. </p>http://daveweaver.net/notebook,commentview,GettingStartedWithWPFEdesign;desktop;programming;web
http://daveweaver.net/notebook,trackback,UsingDasBlogAsABloggingEnginehttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,UsingDasBlogAsABloggingEnginehttp://daveweaver.net/notebook,commentview,UsingDasBlogAsABloggingEnginehttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=d84bbf0b-7813-403f-a9cf-17c90a679ebe11

dasBlog Logo The blog content for this website is managed and rendered by a custom version of the dasBlog Weblog. I've refactored the dasBlog ASP.NET application code into a reusable .NET library that can basically be called by any .NET client app. In this case the client is our home-grown site hosting software. I'll go into a little more detail about how this was accomplished.

Here's a little background about the client. Our hosting software is a simple ASP.NET web application that uses modules to render parts of the page. There are 3 content panels for each page (not including the headers and footers) that contain the user's HTML. The simplest way for content to be rendered for these panels is to use the HTML module that simply pulls content from a .htm file on the server. We have more complex modules for showing forms, photo albums and blog articles. A simple configuration file tells the site engine which module a content panel should call to get HTML to show. In this blog there are two content panels: a center panel and a right panel. The right contains some blogging tools and the main, center panel contains the blog articles. This is where the dasBlog code comes in.

The original dasBlog application is a full blown weblog application that handles everything from displaying and posting articles to site templates to usage statistics. I wanted these tools as well, but I didn't want them in the form of a website. All I needed was to be able to call into a library to get the HTML for a list of blog articles or single blog articles. I also wanted to take advantage of the blog api's used by blog publishing clients so there would be a way to get the content into it.

I started with dasBlog version 1.8.5223.2. The application was designed to mostly handle a single blog and its content. Most of the code assumed global classes for getting the content and settings stored on disk. What I did was create a BlogContext to hold all the global class instances. The single, global class which encapsulated all the original global variables enabled me manage multiple sets of blog content and settings. I wrote another couple classes to manage the multiple instances of the BlogContext class.

To give you an view at how this all works together, I'll show you a code sample. One of the handlers within our site engine module is OnColumnRender(...). It gets called in the module when the site engine needs it to render some HTML for a content panel. It gets passed a Column arg and a Holder arg. The Column arg gives the module a reference back into the APIs in the site engine. The Holder arg is just a typical ASP.NET Control that represents the content for a panel. The following code sample gets a reference to a BlogContext and uses it to fill in the Holder Control class.

   1:  PublicSub OnColumnRender(ByVal Column As PageColumn, ByVal Holder As Control) Implements SiteModule.OnColumnRender
   2:  ' get a reference to a blog context. a single site (SiteInfo.Key) can contain multiple
   3:  ' blogs identified by Column.Key
   4:  Dim blogContext AsNew BlogContext
   5:  Dim blogEngine As BlogEngine
   6:      blogEngine = BlogEngines.GetBlogEngine(Column.Page.SiteInfo.Key, Column.Page.SiteInfo.ContentFolder)
   7:      blogContext = blogEngine.GetBlogContext(Column.Key)
   8:  
   9:  ' set the root for our engine
  10:      blogContext.SiteConfig.Root = Column.Page.Url.Root
  11:  
  12:  ' tell the blog engine where to get its templates
  13:      blogContext.TemplateFolder = Column.Page.Template.Folder("blog").Path
  14:      blogContext.TemplateURL = Column.Page.Template.Folder("blog").VirtualPath
  15:   
  16:  Try
  17:  ' now tell the blog engine to process the bodyText macro
  18:  ' and fill the Holder with blog controls. it takes the
  19:  ' the ASP.NET page class as an argument. those familiar
  20:  ' with dasBlog recognizes the %bodyText% macro as the
  21:  ' actual portion of the page where article content is put
  22:          blogContext.Process(Holder, "<%bodyText%>", Column.Page)
  23:  Catch (Exception ex)
  24:          Column.Page.HandleModuleException(ex)
  25:  Finally
  26:  ' set the page description based on the blog content
  27:  If blogContext.Description.Length > 0 Then
  28:          Column.Page.Description = blogContext.Description
  29:  EndIf
  30:  
  31:  ' add our blog stylesheets
  32:          Column.Page.StyleSheets.Add(blogContext.TemplateURL & "/styles.css")
  33:  
  34:  ' add a RSD tag
  35:          Column.Page.HeadTags.Add("<link rel=""EditURI"" type=""application/rsd+xml""" & _
  36:  " title=""RSD"" href=""" & Column.Page.Url.Root & "/" & Column.Key & ",rsd"" />")
  37:  EndTry
  38:  End Sub

 
The result is a set of modified dasBlog libraries, some web.config settings and a site engine module library that gets registered with the site engine. There are many details that I've skipped over, like how the blog clients interact, how the generated content is modified by user interaction and how the right content panel shows details about the blog itself. I will likely give more details a sample code if there is interest.

Using dasBlog As A Blogging Enginehttp://daveweaver.net/notebook,permalink,UsingDasBlogAsABloggingEnginehttp://daveweaver.net/notebook,permalink,UsingDasBlogAsABloggingEngineThu, 12 Oct 2006 16:34:35 GMT<p><img style="margin: 0px 0px 20px 20px" height="140" alt="dasBlog Logo" src="http://daveweaver.net/media/blog/WindowsLiveWriter/UsingdasBlogAsABloggingEngine_9E71/dasbloglogo20011.jpg" width="130" align="right"> The blog content for this website is managed and rendered by a custom&nbsp;version of the <a href="http://www.dasblog.net/" target="_blank">dasBlog</a> Weblog.&nbsp;I've refactored the dasBlog ASP.NET application code into a reusable .NET library that can basically be called by any .NET client app. In this case the client is our home-grown site hosting software. I'll go into a little more detail about how this was accomplished. </p> <p>Here's a little background about the client. Our hosting software is a simple ASP.NET web application that&nbsp;uses modules to render parts of the page. There are 3 content panels for each page (not including the headers and footers)&nbsp;that contain the&nbsp;user's HTML. The simplest way for content to be rendered for these panels is to use the HTML module that simply pulls content from a .htm file on the server. We have more complex modules for showing forms, photo albums and blog articles. A simple configuration file tells the site engine which module a content panel should call to get HTML to show. In this blog there are two content panels: a center panel and a right panel. The right contains some blogging tools and the main, center panel contains the blog articles. This is where the dasBlog code comes in. </p> <p>The original dasBlog application is a full blown weblog application that handles everything from displaying and&nbsp;posting articles to site templates&nbsp;to usage statistics. I&nbsp;wanted these tools as well, but I didn't want them in the form of a website. All I needed was to be able to call into a library to get the HTML for a list of blog articles or single blog articles. I also wanted to take advantage of the blog api's used by blog publishing clients so there would be a way to get the content into it. </p> <p>I started with dasBlog version 1.8.5223.2. The application was designed to mostly handle&nbsp;a single blog and its content. Most of the code assumed global classes for getting the content and settings stored on disk. What I did was create a&nbsp;BlogContext to hold all the global class instances.&nbsp;The single, global class&nbsp;which encapsulated all the original global variables&nbsp;enabled me manage multiple sets of blog content and settings. I wrote another couple classes to manage the multiple instances of the BlogContext class. </p> <p>To give you an view at how this all works together, I'll show you a code sample. One of the handlers within our site engine module is OnColumnRender(...). It gets called in the module when the site engine needs it to render some HTML for a content panel. It gets passed a Column arg and a Holder arg. The Column arg gives the module a reference back into the APIs in the site engine. The Holder arg is just a typical ASP.NET Control that represents the content for a panel. The following code sample gets a reference to a BlogContext and uses it to fill in the Holder Control class. </p> <!-- code formatted by http://manoli.net/csharpformat/ --> <div class="csharpcode"><pre><span class="lnum"> 1: </span><span class="kwrd">Public</span> <span class="kwrd">Sub</span> OnColumnRender(<span class="kwrd">ByVal</span> Column <span class="kwrd">As</span> PageColumn, <span class="kwrd">ByVal</span> Holder <span class="kwrd">As</span> Control) <span class="kwrd">Implements</span> SiteModule.OnColumnRender</pre><pre><span class="lnum"> 2: </span> <span class="rem">' get a reference to a blog context. a single site (SiteInfo.Key) can contain multiple</span></pre><pre><span class="lnum"> 3: </span> <span class="rem">' blogs identified by Column.Key</span></pre><pre><span class="lnum"> 4: </span> <span class="kwrd">Dim</span> blogContext <span class="kwrd">As</span> <span class="kwrd">New</span> BlogContext</pre><pre><span class="lnum"> 5: </span> <span class="kwrd">Dim</span> blogEngine <span class="kwrd">As</span> BlogEngine</pre><pre><span class="lnum"> 6: </span> blogEngine = BlogEngines.GetBlogEngine(Column.Page.SiteInfo.Key, Column.Page.SiteInfo.ContentFolder)</pre><pre><span class="lnum"> 7: </span> blogContext = blogEngine.GetBlogContext(Column.Key)</pre><pre><span class="lnum"> 8: </span> </pre><pre><span class="lnum"> 9: </span> <span class="rem">' set the root for our engine</span></pre><pre><span class="lnum"> 10: </span> blogContext.SiteConfig.Root = Column.Page.Url.Root</pre><pre><span class="lnum"> 11: </span> </pre><pre><span class="lnum"> 12: </span> <span class="rem">' tell the blog engine where to get its templates</span></pre><pre><span class="lnum"> 13: </span> blogContext.TemplateFolder = Column.Page.Template.Folder(<span class="str">"blog"</span>).Path</pre><pre><span class="lnum"> 14: </span> blogContext.TemplateURL = Column.Page.Template.Folder(<span class="str">"blog"</span>).VirtualPath</pre><pre><span class="lnum"> 15: </span>&nbsp;</pre><pre><span class="lnum"> 16: </span> <span class="kwrd">Try</span></pre><pre><span class="lnum"> 17: </span> <span class="rem">' now tell the blog engine to process the bodyText macro</span></pre><pre><span class="lnum"> 18: </span> <span class="rem">' and fill the Holder with blog controls. it takes the</span></pre><pre><span class="lnum"> 19: </span> <span class="rem">' the ASP.NET page class as an argument. those familiar</span></pre><pre><span class="lnum"> 20: </span> <span class="rem">' with dasBlog recognizes the %bodyText% macro as the</span></pre><pre><span class="lnum"> 21: </span> <span class="rem">' actual portion of the page where article content is put</span></pre><pre><span class="lnum"> 22: </span> blogContext.Process(Holder, <span class="str">"&lt;%bodyText%&gt;"</span>, Column.Page)</pre><pre><span class="lnum"> 23: </span> <span class="kwrd">Catch</span> (Exception ex)</pre><pre><span class="lnum"> 24: </span> Column.Page.HandleModuleException(ex)</pre><pre><span class="lnum"> 25: </span> <span class="kwrd">Finally</span></pre><pre><span class="lnum"> 26: </span> <span class="rem">' set the page description based on the blog content</span></pre><pre><span class="lnum"> 27: </span> <span class="kwrd">If</span> blogContext.Description.Length &gt; 0 <span class="kwrd">Then</span></pre><pre><span class="lnum"> 28: </span> Column.Page.Description = blogContext.Description</pre><pre><span class="lnum"> 29: </span> <span class="kwrd">End</span> <span class="kwrd">If</span></pre><pre><span class="lnum"> 30: </span> </pre><pre><span class="lnum"> 31: </span> <span class="rem">' add our blog stylesheets</span></pre><pre><span class="lnum"> 32: </span> Column.Page.StyleSheets.Add(blogContext.TemplateURL &amp; <span class="str">"/styles.css"</span>)</pre><pre><span class="lnum"> 33: </span> </pre><pre><span class="lnum"> 34: </span> <span class="rem">' add a RSD tag</span></pre><pre><span class="lnum"> 35: </span> Column.Page.HeadTags.Add(<span class="str">"&lt;link rel="</span><span class="str">"EditURI"</span><span class="str">" type="</span><span class="str">"application/rsd+xml"</span><span class="str">""</span> &amp; _</pre><pre><span class="lnum"> 36: </span> <span class="str">" title="</span><span class="str">"RSD"</span><span class="str">" href="</span><span class="str">""</span> &amp; Column.Page.Url.Root &amp; <span class="str">"/"</span> &amp; Column.Key &amp; <span class="str">",rsd"</span><span class="str">" /&gt;"</span>)</pre><pre><span class="lnum"> 37: </span> <span class="kwrd">End</span> <span class="kwrd">Try</span></pre><pre><span class="lnum"> 38: </span><span class="kwrd">End</span> Sub</pre> </div> <p>&nbsp;<br>The result is a set of modified dasBlog libraries, some web.config settings and a site engine module library that gets registered with the site engine. There are many details that I've skipped over, like how the blog clients interact, how the generated content is modified by user interaction and how the right content panel shows details about the blog itself. I will likely give more details a sample code if there is interest. </p>http://daveweaver.net/notebook,commentview,UsingDasBlogAsABloggingEngineprogramming;web
http://daveweaver.net/notebook,trackback,SNIPPLRCodeSnippetSharinghttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,SNIPPLRCodeSnippetSharinghttp://daveweaver.net/notebook,commentview,SNIPPLRCodeSnippetSharinghttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=018fad64-21a1-43f2-9b66-42126ef18ec7

Based on a previous post of mine, I started hunting for a source code repository to use. I found several. The one I liked the best was snipplr.com. There were a few reasons I liked this service. It has a very simple, clean interface. It has a simple, open API for accessing your snippets from other applications. It keeps track of snippet changes. It handles colorizing source code. It provides tagging of my snippets. I've also had no problems reaching it and it seems snappy.

As an experiment, I've added a snippet sidebar to my source code editor, Parachute, which can be downloaded from my website. Just open the options and enter your snipplr API key. Your snippets should show up and can be filtered by the tag bar at the top. Double-click on a snippet to paste it in the editor pane. Please try it out and let me know how you like it.

SNIPPLR: Code Snippet Sharinghttp://daveweaver.net/notebook,permalink,SNIPPLRCodeSnippetSharinghttp://daveweaver.net/notebook,permalink,SNIPPLRCodeSnippetSharingWed, 06 Sep 2006 14:53:22 GMT<p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/SNIPPLRCodeSnippetSharing_9907/snipplr%5B2%5D.jpg" atomicselection="true"><img style="border-right: 0px; border-top: 0px; margin: 0px 20px 20px 0px; border-left: 0px; border-bottom: 0px" height="198" src="http://daveweaver.net/media/blog/WindowsLiveWriter/SNIPPLRCodeSnippetSharing_9907/snipplr_thumb.jpg" width="240" align="left" border="0"></a> Based on a <a href="http://daveweaver.net/notebook,permalink,2006,08,10,DevelopmentChecklist">previous post of mine</a>, I started hunting for a source code repository to use. I found several. The one I liked the best was&nbsp;<a href="http://snipplr.com" target="_blank">snipplr.com</a>. There were a few reasons I liked this service. It has a very simple, clean&nbsp;interface.&nbsp;It has a simple, <a href="http://snipplr.com/extras/" target="_blank">open API for accessing your snippets</a> from other applications. It keeps track of snippet changes. It handles colorizing source code. It provides tagging of my snippets. I've also had no problems reaching it and it seems snappy. </p> <p>As an experiment, I've added a snippet sidebar to my source code editor, <a href="http://daveweaver.net/parachute">Parachute</a>, which can be downloaded from my website. Just open the options and enter your snipplr API key. Your snippets should show up and can be filtered by the tag bar at the top. Double-click on a snippet to paste it in the editor pane. Please <a href="http://daveweaver.net/parachute-download">try it out</a> and let me know how you like it. </p>http://daveweaver.net/notebook,commentview,SNIPPLRCodeSnippetSharingdesktop;programming;tools
http://daveweaver.net/notebook,trackback,NowThisIsScaryhttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,NowThisIsScaryhttp://daveweaver.net/notebook,commentview,NowThisIsScaryhttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=f62bfc51-a115-45f1-9704-6e12ed6db6aa5

I've seen some pretty impressive digital rendering before, but I had know idea it was this close to being mainstream. Microsoft will be releasing DirectX 10 on Windows Vista. DX 10 is a total re-write. I think gaming is going to jump to the next level. I also think it's a good idea for Microsoft to only make DX 10 available on Vista. It gives the gaming community and home users good incentive to move to that platform, even if business users have no motivation. Then again maybe it's not a marketing tactic since the article says "The new display driver or graphics model in Windows Vista, WDDM (Windows Display Driver Model), is the main reason for DirectX10’s exclusivity to the operating system".

Now This Is Scaryhttp://daveweaver.net/notebook,permalink,NowThisIsScaryhttp://daveweaver.net/notebook,permalink,NowThisIsScaryFri, 18 Aug 2006 01:38:20 GMT<p><a href="http://daveweaver.net/media/blog/WindowsLiveWriter/NowThisIsScary_13043/dx102.png" atomicselection="true"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 20px 20px; border-right-width: 0px" height="166" src="http://daveweaver.net/media/blog/WindowsLiveWriter/NowThisIsScary_13043/dx10_thumb.png" width="240" align="right" border="0"></a> I've seen some pretty impressive digital rendering before, but I had know idea it was this close to being mainstream. Microsoft will be releasing <a href="http://blogs.technet.com/windowsvista/articles/447226.aspx" target="_blank">DirectX 10 on Windows Vista</a>. DX 10 is a total re-write. I think gaming is going to jump to the next level. I also think it's a good idea for Microsoft to only make DX 10 available on Vista. It gives the gaming community and home users&nbsp;good incentive to move to that platform, even if business users have no motivation. Then again maybe it's not a marketing tactic since the article says "The new display driver or graphics model in Windows Vista, WDDM (Windows Display Driver Model), is the main reason for DirectX10’s exclusivity to the operating system". </p>http://daveweaver.net/notebook,commentview,NowThisIsScarydesktop;misc;programming
http://daveweaver.net/notebook,trackback,DevelopmentChecklisthttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,DevelopmentChecklisthttp://daveweaver.net/notebook,commentview,DevelopmentChecklisthttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=5493426f-d283-41ec-8bb6-b51f1d6d38a0

In continuing to review the good and bad aspect of our last product cycle I ran across a discussion on the Coding Horror website called What is "Modern Software Development". The topic of the discussion is about identifying an essential checklist for good software development. There were existing lists from Joel Spolsky and Steve McConnell as well as new suggestions. It inspired me to compile an essential checklist for our development team. I used items from the original lists and added some of the suggestions from the discussion. Here is the list with how I feel we currently stack up.

1. Do you use source control?
Yes. All our source and documentation is in source control and backed up nightly, offsite. We use Subversion and TortoiseSVN.

2. Can you make a build in one step?
Yes. Each of our projects have build scripts so they can be built and packaged with single commands.

3. Do you conduct code reviews on a regular basis?
No. We have a small team of experienced programmers who all sit around a big desk in our dev room. This makes communication much easier, but it's still no excuse for being more formal about code reviews. This needs to happen.

4. Do you have a common code repository?
No. This is not so crucial for our small team, but as we grow it will be important. We find ourselves constantly asking "Hey Steve, where did you implement that XXX portion of code" so we can copy it in another place.

5. Do you have a bug database?
Yes. We use Bugzilla for recording bugs.

6. Do you fix bugs before writing new code?
No. We do fix bugs and supporting our customers is a top priority, but during a product cycle bugs are usually the last thing that are done and also the most likely to get short-changed.

7. Do you have an up-to-date schedule?
No. Scheduling is kinda done at the watercooler. This needs to be more formalized and done across the entire product team.

8. Do you have detailed activity lists?
No. We should be able to extract detailed activity lists from our specs. Currently this is not possible because our specs are not as detailed as they should be. I think these are important because it is a good litmus test for our spec process.

9. Do you have unit tests?
No.

10. Do you conduct regular usability testing?
No.

Whew. After going thru all that it appears we have a long way to go. It's not totally as bad as it seems. If there was a slight bit of doubt in answering the question, I listed No. Some of the items we do to a certain degree but I felt we need to address it better. Hopefully in the upcoming months we can improve on these items now that they are identified.

Development Checklisthttp://daveweaver.net/notebook,permalink,DevelopmentChecklisthttp://daveweaver.net/notebook,permalink,DevelopmentChecklistThu, 10 Aug 2006 22:15:13 GMT<p>In continuing to review the good and bad aspect of our last product cycle I ran across a discussion on the <a href="http://www.codinghorror.com/" target="_blank">Coding Horror</a> website called <a href="http://www.codinghorror.com/blog/archives/000643.html" target="_blank">What is "Modern Software Development"</a>. The topic of the discussion is about identifying an essential checklist for good software development. There were existing lists from <a href="http://www.joelonsoftware.com/articles/fog0000000043.html" target="_blank">Joel Spolsky</a> and <a href="http://www.stevemcconnell.com/bp08.htm" target="_blank">Steve McConnell</a> as well as new suggestions. It inspired me to compile an essential checklist for our development team. I used items from the original lists and added some of the suggestions from the discussion. Here is the list with how I feel we currently stack up. </p> <p><strong>1. Do you use source control?<br /></strong> Yes. All our source and documentation is in source control and backed up nightly, offsite. We use Subversion and TortoiseSVN. </p> <p><strong>2. Can you make a build in one step?</strong> <br />Yes. Each of our projects have build scripts so they can be built and packaged with single commands. </p> <p><strong>3. Do you conduct code reviews on a regular basis?</strong> <br />No. We have a small team of experienced programmers who all sit around a big desk in our dev room. This makes communication much easier, but it's still no excuse for being more formal about code reviews. This needs to happen. </p> <p><strong>4. Do you have a common code repository?</strong> <br />No. This is not so crucial for our small team, but as we grow it will be important. We find ourselves constantly asking "Hey Steve, where did you implement that XXX portion of code" so we can copy it in another place. </p> <p><strong>5. Do you have a bug database?<br /></strong> Yes. We use Bugzilla for recording bugs. </p> <p><strong>6. Do you fix bugs before writing new code?<br /></strong> No. We do fix bugs and supporting our customers is a top priority, but during a product cycle bugs are usually the last thing that are done and also the most likely to get short-changed. </p> <p><strong>7. Do you have an up-to-date schedule?</strong> <br />No. Scheduling is kinda done at the watercooler. This needs to be more formalized and done across the entire product team. </p> <p><strong>8. Do you have detailed activity lists?<br /></strong> No. We should be able to extract detailed activity lists from our specs. Currently this is not possible because our specs are not as detailed as they should be. I think these are important because it is a good litmus test for our spec process. </p> <p><strong>9. Do you have unit tests?<br /></strong> No. </p> <p><strong>10. Do you conduct regular usability testing?<br /></strong> No.<br /> <br />Whew. After going thru all that it appears we have a long way to go. It's not totally as bad as it seems. If there was a slight bit of doubt in answering the question, I listed No. Some of the items we do to a certain degree but I felt we need to address it better. Hopefully in the upcoming months we can improve on these items now that they are identified. </p>http://daveweaver.net/notebook,commentview,DevelopmentChecklistprogramming
http://daveweaver.net/notebook,trackback,Underestimationhttp://daveweaver.net/pingback.aspxhttp://daveweaver.net/notebook,permalink,Underestimationhttp://daveweaver.net/notebook,commentview,Underestimationhttp://daveweaver.net/SyndicationService.asmx/GetEntryCommentsRss?guid=3e9a381f-ddf1-4c4f-9019-5a647770858e

Part of finishing up a product cycle involves a postmortem. It's a chance to reflect back and identify the positive and negative things that contributed to the success of a product release. Hopefully identifying the positive and negatives will help us improve the quality of our software and increase our efficiency in building products.

We have just finished up a particularly long and grueling cycle for GiftWorks Volunteers. While I'm sure the actual product will surpass the expectations of our customers, the process of getting there was not a model of efficiency. We had several slipped deadlines. I've spent a lot of time tracing the steps along the way, trying to come up with a short list of points to carry forward to the next project. One point that keeps coming up is time estimation. Our company and our competition work on "Internet time". Release early, release often. It is critical for us to deliver our products as fast (if not faster) than our competition. Our customers demand it. But our customers also demand quality, and that is the challenge.

Time estimation comes up at several places during a product cycle. When a product idea is formed there are always rough estimates made as to how long it would take to release. There are time estimates for coming up with product specifications, time estimates for doing the development and testing, time estimates for beta releases. There are even time estimates for coming up with time estimates. These estimates allow us to plan ahead and are necessary. From the very beginning, "do you think we can get this done for a fall launch?", "can testing begin next month?", "how long will it take to get feedback from customers?". Time estimates also have a major impact on the overall product, and I think that impact can easily be underestimated (no pun intended).

Early, "back-of-the-napkin" time estimates are sometimes used to set deadlines for a product release. I'll call these "artificial" deadlines. They are deadlines that are set based on information other than the project schedule created after a functional specification has been reviewed and all teams have had a chance to provide time estimates. The artificial deadlines may be marketing driven, competition driven or come from somewhere else. They are not wrong, but do add a degree of risk to the product cycle.

There are several variables that can be used to represent a product cycle. Here is how I picture the formula in my mind: Resources + Time is proportional to Functionality x Level Of Quality. Where the Level Of Quality is a constant, or at least I think it should be. Generally, the more resources or time you add to a project, the more functionality you'll end up with. For example, assuming constant resources and level of quality, a four month product cycle will yield more functionality than a