<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
        <title>Monkey See, Monkey Build by Clint Rutkas</title>
        <link>http://www.betterthaneveryone.com/Default.aspx</link>
        <description>A mix of hardware, C#, and a splash of self-indulgent ego</description>
        <language>en-US</language>
        <copyright>Clint Rutkas</copyright>
        <generator>Subtext Version 2.1.0.5</generator>
        <image>
            <title>Monkey See, Monkey Build by Clint Rutkas</title>
            <url>http://www.betterthaneveryone.com/images/RSS2Image.gif</url>
            <link>http://www.betterthaneveryone.com/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/BetterThanEveryone" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
            <title>Near complete wiring harness</title>
            <category>Building</category>
            <category>Drunktender</category>
            <category>wiring</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/A3iP9cLoid0/890.aspx</link>
            <description>&lt;a title="near complete wiring harness by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4048154110/"&gt;&lt;img alt="near complete wiring harness" src="http://farm3.static.flickr.com/2435/4048154110_ea23204742.jpg" width="500" height="488" /&gt;&lt;/a&gt;   &lt;p&gt;Remember, this use to look like this:&lt;/p&gt; &lt;a title="Final wiring for v3 drunktender hardware by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3607511119/"&gt;&lt;img alt="Final wiring for v3 drunktender hardware" src="http://farm4.static.flickr.com/3376/3607511119_0d4093cb9a.jpg" width="333" height="500" /&gt;&lt;/a&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/890.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/26/890.aspx</guid>
            <pubDate>Mon, 26 Oct 2009 22:03:17 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/890.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/26/890.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/890.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/26/890.aspx</feedburner:origLink></item>
        <item>
            <title>Quick mounting to show off look / feel</title>
            <category>Drunktender</category>
            <category>Building</category>
            <category>wiring</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/iBDXO0bUtS8/889.aspx</link>
            <description>&lt;a title="mounted on acrylic by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4041381722/"&gt;&lt;img alt="mounted on acrylic" src="http://farm3.static.flickr.com/2775/4041381722_b20781f654.jpg" width="492" height="500" /&gt;&lt;/a&gt;  &lt;p&gt;I have to say, I’m rather happy how these turned out.  This will be mounted between the two legs protected by yet another sheet of acrylic for PDC.  I’m using hex head screws also to mount these since they just look so dang nice.  I had &lt;a href="http://tapplastics.com/"&gt;TAP plastics&lt;/a&gt; in Seattle do the holes and bends for me.  Chances are there is a plastic place near you that can do this for you.  With the bends and holes, it cost about $40 and they did two of them for me in an hour on a Saturday.  The blue plastic is just protective as I still need to make a few extra holes in them.&lt;/p&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/889.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/24/889.aspx</guid>
            <pubDate>Sun, 25 Oct 2009 01:17:32 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/889.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/24/889.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/889.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/24/889.aspx</feedburner:origLink></item>
        <item>
            <title>Back plane and inductor PCBs soldered up</title>
            <category>Building</category>
            <category>Drunktender</category>
            <category>Solder</category>
            <category>wiring</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/qR7vRoWsEg0/888.aspx</link>
            <description>&lt;p&gt;Small and reduces the rat’s nest of wiring by creating these little puppies.  Everything has a little LED on it to show when it is on too.&lt;/p&gt;  &lt;p&gt;&lt;a title="back plane PCB by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4037932909/"&gt;&lt;img alt="back plane PCB" src="http://farm3.static.flickr.com/2756/4037932909_3b52b8737c_m.jpg" width="240" height="160" /&gt;&lt;/a&gt;     &lt;br /&gt;&lt;a title="load induction suppression PCB by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4038507848/"&gt;&lt;img alt="load induction suppression PCB" src="http://farm3.static.flickr.com/2802/4038507848_70b080fc6e_m.jpg" width="240" height="160" /&gt;&lt;/a&gt; &lt;a title="load induction suppression PCB by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4038507534/"&gt;&lt;img alt="load induction suppression PCB" src="http://farm3.static.flickr.com/2708/4038507534_848b010012_m.jpg" width="240" height="160" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/888.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/23/888.aspx</guid>
            <pubDate>Sat, 24 Oct 2009 00:32:12 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/888.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/23/888.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/888.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/23/888.aspx</feedburner:origLink></item>
        <item>
            <title>drinktendr progress</title>
            <category>Drunktender</category>
            <category>Solder</category>
            <category>Building</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/C3coSC-P7ew/887.aspx</link>
            <description>&lt;p&gt;If there is one thing I love, it is getting stuff done.  Here are all the parts for Drinktendr v3.5 and the new PCBs I had created to help aid in wire management.  One is just pure wire management (bottom left) and the other is to help aid in the load induction (bottom right).  The load induction suppressor PCB is designed to directly hook into the valve.&lt;/p&gt; &lt;a title="PDC bits by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4009131069/"&gt;&lt;img alt="PDC bits" src="http://farm4.static.flickr.com/3503/4009131069_e718d556b3_m.jpg" width="240" height="160" /&gt;&lt;/a&gt;  &lt;a title="Drinktendr PCBs by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4037683023/"&gt;&lt;img alt="Drinktendr PCBs" src="http://farm3.static.flickr.com/2719/4037683023_d5b7bbe8af_m.jpg" width="240" height="160" /&gt;&lt;/a&gt;  &lt;br /&gt;&lt;a title="Drinktendr PCBs by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4038431798/"&gt;&lt;img alt="Drinktendr PCBs" src="http://farm3.static.flickr.com/2434/4038431798_d0c0316e0d_m.jpg" width="240" height="160" /&gt;&lt;/a&gt; &lt;a title="Drinktendr PCBs by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/4038432404/"&gt;&lt;img alt="Drinktendr PCBs" src="http://farm3.static.flickr.com/2535/4038432404_39fd81311c_m.jpg" width="240" height="160" /&gt;&lt;/a&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/887.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/23/887.aspx</guid>
            <pubDate>Fri, 23 Oct 2009 22:09:05 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/887.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/23/887.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/887.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/23/887.aspx</feedburner:origLink></item>
        <item>
            <title>Getting a database to attach from a My Document folder</title>
            <category>Coding</category>
            <category>SQL Server</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/sP8F7XKR1z8/886.aspx</link>
            <description>&lt;p&gt;Ever want to mount a database from your My Document Folder?  I do … far too often.  In this instance, my SQL Server database MDF file is in: C:\Users\crutkas\Documents\Visual Studio 2008\Projects\Bartender.  &lt;/p&gt;  &lt;p&gt;Going into SQL Server Management Studio, and attaching a database will give you this issue.  As you can see, I can’t go in and use anything there.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image_thumb.png" width="435" height="181" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;So what the issue is I have to give SQL Server’s user that is running under access to that folder!  You can do this a few different ways.  Give access to the SQL Server user to read the entire directory tree for your user (c:\Users\[user]\) or just that folder.&lt;/p&gt;  &lt;p&gt;So how do you get the user that SQL Server is running under?  Use Computer Management to figure that out and go to the Services module.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image_3.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image_thumb_3.png" width="614" height="231" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" src="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image_thumb_4.png" width="523" height="35" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;For me, I’m running it under “Network Service”&lt;/p&gt;  &lt;p&gt;Now I go back into either c:\Users\[user]\ or the target folder and get that user access.&lt;/p&gt;  &lt;p /&gt;  &lt;p&gt;&lt;a href="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image_5.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.betterthaneveryone.com/images/GettingadatabasetoattachfromaMyDocumentf_DA57/image_thumb_5.png" width="380" height="539" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you did just the target folder, you’ll have to put in the entire file path in the file name of the Attach Database prompt, if you did the root, you now should be able to see everything via the folder tree!&lt;/p&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/886.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/13/886.aspx</guid>
            <pubDate>Tue, 13 Oct 2009 22:31:21 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/886.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/13/886.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/886.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/13/886.aspx</feedburner:origLink></item>
        <item>
            <title>Final tweaks to improve Thumbnailing and now on CodePlex!</title>
            <category>CodePlex</category>
            <category>Coding</category>
            <category>WPF</category>
            <category>XAML</category>
            <category>Video</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/YuNsUcEkMZw/885.aspx</link>
            <description>&lt;p&gt;In the prior two posts, I talked about creating and fixing the logic for creating video thumbnails / screenshots but it had a few flaws in it.&lt;/p&gt;  &lt;p&gt;The first was I didn’t realize I had to close the &lt;strong&gt;MediaPlayer&lt;/strong&gt; object’s stream, this caused memory to balloon upward after multiple plays.  Another problem was opening the same file for the same screenshots could cause issues in the long run at the same time.  To solve these issues, one was an easy fix, the other required a bit of threading knowledge.&lt;/p&gt;  &lt;p&gt;To correct this, I’ll first have a Dictionary object to pass in multiple TimeSpans so I can do multiple captures without having the file open multiple times.  I also created used a &lt;strong&gt;Mutex &lt;/strong&gt;that is tied to the video’s Uri.  This will lock the thread until the other processing has been completed.  This will help reduce the memory load footprint in a threaded environment.  You still can get in trouble by opening up some very large video files in a threaded environment&lt;/p&gt;  &lt;p&gt;To get access to the tester app, head over to &lt;a title="http://wpfvideothumbnail.codeplex.com/" href="http://wpfvideothumbnail.codeplex.com/"&gt;codeplex&lt;/a&gt; and &lt;a href="http://wpfvideothumbnail.codeplex.com/SourceControl/ListDownloadableCommits.aspx"&gt;source code can be found there too!&lt;/a&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:63cc8707-6749-4a19-8076-b85073dade8b" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;public static void CaptureScreen(Uri source, 
	Dictionary&amp;lt;TimeSpan, object&amp;gt; captureList, 
	double scale, CaptureWorkerDelegate finalWorkerPrimary, 
	CaptureWorkerDelegate finalWorkerThumbnail)
{
	var mutexLock = new Mutex(false, source.GetHashCode().ToString());
	mutexLock.WaitOne();
	
	var player = new MediaPlayer { Volume = 0, ScrubbingEnabled = true };

	player.Open(source);
	player.Pause();
	foreach (var pair in captureList)
	{
		var timeSpan = pair.Key;
		var state = pair.Value;

		player.Position = timeSpan;
		Thread.Sleep(1000);

		var width = player.NaturalVideoWidth;
		var height = player.NaturalVideoHeight;

		var rtb = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);
		var dv = new DrawingVisual();

		using (DrawingContext dc = dv.RenderOpen())
			dc.DrawVideo(player, new Rect(0, 0, width, height));

		rtb.Render(dv);
		var frame = BitmapFrame.Create(rtb).GetCurrentValueAsFrozen();
		if (finalWorkerPrimary != null)
			finalWorkerPrimary(frame as BitmapFrame, state);

		if (scale &amp;gt; 0 &amp;amp;&amp;amp; finalWorkerThumbnail != null)
		{
			var thumbnailFrame =
				BitmapFrame.Create(new TransformedBitmap(frame as BitmapSource, new ScaleTransform(scale, scale))).
					GetCurrentValueAsFrozen();
			var encoder = new JpegBitmapEncoder();
			encoder.Frames.Add(thumbnailFrame as BitmapFrame);

			finalWorkerThumbnail(thumbnailFrame as BitmapFrame, state);
		}
	}
	player.Close();
	mutexLock.ReleaseMutex();
}&lt;/pre&gt;&lt;/div&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/885.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/04/885.aspx</guid>
            <pubDate>Sun, 04 Oct 2009 20:38:42 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/885.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/04/885.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/885.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/04/885.aspx</feedburner:origLink></item>
        <item>
            <title>Improving Thumbnailing Code</title>
            <category>Coding</category>
            <category>XAML</category>
            <category>WPF</category>
            <category>Threading</category>
            <category>Video</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/PaInGw52_20/883.aspx</link>
            <description>&lt;p&gt;From the prior post about &lt;a href="http://www.betterthaneveryone.com/archive/2009/10/02/882.aspx"&gt;getting thumbnails from a video in .Net&lt;/a&gt;, it was just prototype code and wasn’t properly abstracted.  Now it is time to fix it.  We’ll create a class called &lt;strong&gt;VideoScreenShot&lt;/strong&gt;.  This class will function in both an asynchronous and synchronous mode.  This still could be improved by queuing up work but this is a nice refactoring.&lt;/p&gt;
&lt;p&gt;To get access to the tester app, head over to &lt;a title="http://wpfvideothumbnail.codeplex.com/" href="http://wpfvideothumbnail.codeplex.com/"&gt;codeplex&lt;/a&gt; and &lt;a href="http://wpfvideothumbnail.codeplex.com/SourceControl/ListDownloadableCommits.aspx"&gt;source code can be found there too!&lt;/a&gt;&lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:dcbe4638-91d2-44e5-b7c7-6911a33b432c" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="c#" name="code"&gt;public delegate void CaptureWorkerDelegate(BitmapFrame frame, object state);
public static void CaptureScreenAsync(Uri source, TimeSpan timeSpan, object state, 
	CaptureWorkerDelegate finalWorkerPrimary)
{
	CaptureScreenAsync(source, timeSpan, -1, 
		state, finalWorkerPrimary, null);
}

public static void CaptureScreenAsync(Uri source, TimeSpan timeSpan, double scale, object state, 
	CaptureWorkerDelegate finalWorkerPrimary, CaptureWorkerDelegate finalWorkerThumbnail)
{
	ThreadPool.QueueUserWorkItem(
		delegate { CaptureScreen(source, timeSpan, scale, 
			state, finalWorkerPrimary, finalWorkerThumbnail); });
}

public static void CaptureScreen(Uri source, TimeSpan timeSpan, object state, 
	CaptureWorkerDelegate finalWorkerPrimary)
{
	CaptureScreen(source, timeSpan, -1, state, 
		finalWorkerPrimary, null);
}

public static void CaptureScreen(Uri source, TimeSpan timeSpan, double scale, object state, 
	CaptureWorkerDelegate finalWorkerPrimary, CaptureWorkerDelegate finalWorkerThumbnail)
{
	var player = new MediaPlayer { Volume = 0, ScrubbingEnabled = true };

	player.Open(source);
	player.Pause();
	player.Position = timeSpan;
	Thread.Sleep(1000);

	var width = player.NaturalVideoWidth;
	var height = player.NaturalVideoHeight;

	var rtb = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);
	var dv = new DrawingVisual();

	using (DrawingContext dc = dv.RenderOpen())
		dc.DrawVideo(player, new Rect(0, 0, width, height));

	rtb.Render(dv);
	var frame = BitmapFrame.Create(rtb).GetCurrentValueAsFrozen();
	if (finalWorkerPrimary != null)
		finalWorkerPrimary(frame as BitmapFrame, state);

	if (scale &amp;gt; 0 &amp;amp;&amp;amp; finalWorkerThumbnail != null)
	{
		var thumbnailFrame = BitmapFrame.Create(
			new TransformedBitmap(frame as BitmapSource, 
				new ScaleTransform(scale, scale))).GetCurrentValueAsFrozen();
		var encoder = new JpegBitmapEncoder();
		encoder.Frames.Add(thumbnailFrame as BitmapFrame);

		finalWorkerThumbnail(thumbnailFrame as BitmapFrame, state);
	}
	
	player.Close();
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;In the form’s code behind, here is my code.  This is just a sample of what can be used.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:74f6bdd6-0be3-4dd1-b677-3dd9e563fb06" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="c#" name="code"&gt;private delegate void setImageDelegate(string controlName, BitmapFrame frame);
private void setImage(string controlName, BitmapFrame frame)
{
	var control = FindName(controlName);
	if (control != null)
		((Image)control).Source = frame;
}

private void makeThumbnails(BitmapFrame frame, object state)
{
	Dispatcher.Invoke(new setImageDelegate(setImage), (string)state, frame);
}

private void makeJpeg(BitmapFrame frame, object state)
{
	var encoder = new JpegBitmapEncoder();
	encoder.Frames.Add(frame);

	string filename = (string)state + ".jpg";
	using (var fs = new FileStream(filename, FileMode.Create))
		encoder.Save(fs);
}

private void Button_Click(object sender, RoutedEventArgs e)
{
	var source = video.Source;

	VideoScreenShot.CaptureScreenAsync(source, TimeSpan.FromSeconds(10), .1, 
		"image0", makeJpeg, makeThumbnails);
	VideoScreenShot.CaptureScreenAsync(source, TimeSpan.FromSeconds(43) + TimeSpan.FromMilliseconds(760), 
		"image1", makeThumbnails);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now it isn’t so much cleaner?&lt;/p&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/883.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/03/883.aspx</guid>
            <pubDate>Sun, 04 Oct 2009 01:39:45 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/883.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/03/883.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/883.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/03/883.aspx</feedburner:origLink></item>
        <item>
            <title>Getting Thumbnails in WPF &amp;hellip; on a non-UI thread</title>
            <category>WPF</category>
            <category>XAML</category>
            <category>Video</category>
            <category>Coding</category>
            <category>Threading</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/tr0QLjWohQU/882.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://www.betterthaneveryone.com/images/GettingThumbnailsinWPFonanonUIthread_F6A7/image.png"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: 0px" title="image" border="0" alt="image" align="right" width="240" height="144" src="http://www.betterthaneveryone.com/images/GettingThumbnailsinWPFonanonUIthread_F6A7/image_thumb.png" /&gt;&lt;/a&gt;On my internal application for &lt;a href="http://channel9.msdn.com/"&gt;Channel 9&lt;/a&gt;, I have to create thumbnails at certain time codes in a movie.  After a giant headache attempting to track down the proper way of doing this, I figured out how to do this even if for a few hours I thought 127 seconds was the same at 1 minute and 27 seconds.  That caused some testing headaches as my test clip is 1:40 long.&lt;/p&gt;
&lt;p&gt;In this example I’ll write out the code for a threaded video thumbnail creating tool in WPF (XAML) and c#.&lt;/p&gt;
&lt;p&gt;To get access to the tester app, head over to &lt;a title="http://wpfvideothumbnail.codeplex.com/" href="http://wpfvideothumbnail.codeplex.com/"&gt;codeplex&lt;/a&gt; and &lt;a href="http://wpfvideothumbnail.codeplex.com/SourceControl/ListDownloadableCommits.aspx"&gt;source code can be found there too!&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First, here is my XAML for my control.  Basic but shows the point.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f8d093bd-30d6-459c-a663-338539bb34cd" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="xml" name="code"&gt;&amp;lt;StackPanel&amp;gt;
	&amp;lt;Button Click="Button_Click"&amp;gt;
		Capture
	&amp;lt;/Button&amp;gt;
	&amp;lt;Border BorderThickness="2" BorderBrush="Cyan"&amp;gt;
			&amp;lt;MediaElement Name="video" 
				Source="media\theOffice.wmv" 
				LoadedBehavior="Pause" 
				ScrubbingEnabled="True" 
				Visibility="Collapsed"/&amp;gt;
		&amp;lt;/Border&amp;gt;
	&amp;lt;StackPanel Orientation="Horizontal"&amp;gt;
		&amp;lt;Border BorderThickness="2" BorderBrush="Red"&amp;gt;
			&amp;lt;Image Name="image0" /&amp;gt;
		&amp;lt;/Border&amp;gt;
		&amp;lt;Border BorderThickness="2" BorderBrush="Green"&amp;gt;
			&amp;lt;Image Name="image1" /&amp;gt;
		&amp;lt;/Border&amp;gt;
	&amp;lt;/StackPanel&amp;gt;
	&amp;lt;StackPanel Orientation="Horizontal"&amp;gt;
		&amp;lt;Border BorderThickness="2" BorderBrush="Blue"&amp;gt;
			&amp;lt;Image Name="image2" /&amp;gt;
		&amp;lt;/Border&amp;gt;
		&amp;lt;Border BorderThickness="2" BorderBrush="Yellow"&amp;gt;
			&amp;lt;Image Name="image3" /&amp;gt;
		&amp;lt;/Border&amp;gt;
	&amp;lt;/StackPanel&amp;gt;
&amp;lt;/StackPanel&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;Click&lt;/strong&gt; event on the button will be where we get the width, height and source of the video.  I’m creating 4 images to show it off the fact it is threaded.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:22e997ea-2107-45b7-8465-14b7fcbe3525" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="c#" name="code"&gt;private void Button_Click(object sender, RoutedEventArgs e)
{
	var source = video.Source;

	setScreenCapture(image0.Name, TimeSpan.FromSeconds(10), source);
	setScreenCapture(image1.Name, TimeSpan.FromSeconds(43) + TimeSpan.FromMilliseconds(760), source);
	setScreenCapture(image2.Name, TimeSpan.FromSeconds(60), source);
	setScreenCapture(image3.Name, TimeSpan.FromSeconds(80), source);
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;We’ll be using a &lt;strong&gt;ThreadPool&lt;/strong&gt; to accomplish the processing due to a need for a &lt;strong&gt;Thread.Sleep &lt;/strong&gt;in the function following this one.  This will make things a bit more complicated but not locking the UI is worth the extra pain.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:2985e5a2-92c1-4af8-8fa0-3a46a51cd8a0" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="c#" name="code"&gt;private void setScreenCapture(string controlName, 
	TimeSpan timeSpan, Uri source)
{
	ThreadPool.QueueUserWorkItem(delegate
	{ 
		setScreenCaptureWorker(controlName, 
			timeSpan, source); 
	});
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now that we have our queuing function done, on to the worker.  &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:08e42698-bd09-429f-8b06-ca302a58b9c6" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="c#" name="code"&gt;private void setScreenCaptureWorker(string controlName, 
	TimeSpan timeSpan, Uri source)
{ /* code */ }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;We’ll be using a &lt;strong&gt;MediaPlayer&lt;/strong&gt;, &lt;strong&gt;RenderTargetBitmap&lt;/strong&gt;, &lt;strong&gt;DrawingVisual&lt;/strong&gt;, and &lt;strong&gt;DrawingContext&lt;/strong&gt; to accomplish the thumbnail creation.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:2171c856-1c5d-42ea-a23a-b42f45c4ce31" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="c#" name="code"&gt;var player = new MediaPlayer {Volume = 0, ScrubbingEnabled = true};

player.Open(source);
player.Pause();
player.Position = timeSpan;
Thread.Sleep(1000);

var width = player.NaturalVideoWidth;
var height = player.NaturalVideoHeight;

var rtb = new RenderTargetBitmap(
	width, height, 96, 96, PixelFormats.Pbgra32);
DrawingVisual dv = new DrawingVisual();

using(DrawingContext dc = dv.RenderOpen())
	dc.DrawVideo(player, new Rect(0, 0, width, height));

rtb.Render(dv);
var frame = BitmapFrame.Create(rtb).GetCurrentValueAsFrozen();
// you now have a thumbnail frame!&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;MediaPlayer&lt;/strong&gt; needs a moment to get stuff going.  Adding in the &lt;strong&gt;Thread.Sleep&lt;/strong&gt; allows this to get synced up.  The key thing to remember here is we are no longer on the UI thread.  The user interface won’t lock now.  But due to that, we have elements on non-UI threads.  The &lt;strong&gt;RenderTargetBitmap&lt;/strong&gt; and even the &lt;strong&gt;BitmapFrame&lt;/strong&gt; created are both tied to the current thread.  Passing these back to the UI will cause thread context issues.  Using a &lt;strong&gt;Freezable&lt;/strong&gt; object solves the context issue.&lt;/p&gt;
&lt;p&gt;In a perfect world, I’d have a different function do this and pass it in as a delegate but this was example code.  Due to the sample codeness of it, I’m creating the image in the function and then calling the dispatcher.  You’ll want to replace this code with whatever your goal is, however this code does both tasks I could see someone using this for.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f0ac0e87-14e3-45ba-af38-1e4c46d10656" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="css" name="code"&gt;var encoder = new JpegBitmapEncoder();
encoder.Frames.Add(frame as BitmapFrame);

string filename = controlName + ".jpg";
using (var fs = new FileStream(filename, FileMode.Create))
	encoder.Save(fs);

Dispatcher.Invoke(
	new setImageDelegate(setImage), controlName, frame); &lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;And now to update the UI elements.  Since we used &lt;strong&gt;Dispatcher.Invoke&lt;/strong&gt; to call the delegate, we can do this since that forces us back on the User Interface Thread!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:60adbb00-d704-4091-ace5-56f97dfb5954" class="wlWriterEditableSmartContent"&gt;
&lt;pre class="c#" name="code"&gt;private delegate void setImageDelegate(string controlName, BitmapFrame frame);
private void setImage(string controlName, BitmapFrame frame)
{
	var control = FindName(controlName);
	if (control != null)
		((Image)control).Source = frame;
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/882.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/10/02/882.aspx</guid>
            <pubDate>Sat, 03 Oct 2009 00:32:00 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/882.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/10/02/882.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/882.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/10/02/882.aspx</feedburner:origLink></item>
        <item>
            <title>Pouring from drunktender</title>
            <category>Drunktender</category>
            <category>Building</category>
            <category>Parts</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/GIS5fJQRPCA/881.aspx</link>
            <description>&lt;p&gt;One of my big things I love about drunktender is everything is off the shelf.  There are a few bits I’ve never really been happy with but lived with them.  I was recently told to design a better spout for the Microsoft PDC conference so this is what I came up with.  I did a quick test with what I have here and I easily put 20 1/4” tubes though the 2” pipe.  The white PVC is from the plumbing department and the grey PVC is from the electrical department.  I have an exploded and a loose connected version below of what I was planning pre-painting.&lt;/p&gt;  &lt;p&gt;&lt;a title="Possible spout for drunktender by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3931492983/"&gt;&lt;img alt="Possible spout for drunktender" src="http://farm3.static.flickr.com/2657/3931492983_96d61b7303_m.jpg" width="240" height="160" /&gt;&lt;/a&gt; &lt;a title="Possible spout for drunktender by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3931492043/"&gt;&lt;img alt="Possible spout for drunktender" src="http://farm4.static.flickr.com/3511/3931492043_fb7908092a_m.jpg" width="240" height="160" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I’ll drill a hole though the table and then use a flange which will be hidden on the underside to securely mount it to the table.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.betterthaneveryone.com/images/Pouringfromdrunktender_A08D/61024381.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="6102438[1]" border="0" alt="6102438[1]" src="http://www.betterthaneveryone.com/images/Pouringfromdrunktender_A08D/61024381_thumb.jpg" width="200" height="200" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/881.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/09/18/881.aspx</guid>
            <pubDate>Fri, 18 Sep 2009 18:31:34 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/881.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/09/18/881.aspx#feedback</comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/881.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/09/18/881.aspx</feedburner:origLink></item>
        <item>
            <title>Why it is a bad idea to prank me</title>
            <category>Ramblings</category>
            <category>Pranks</category>
            <link>http://feedproxy.google.com/~r/BetterThanEveryone/~3/s73wu_FPgfY/880.aspx</link>
            <description>&lt;p&gt;So a &lt;a href="http://twitter.com/nicfill"&gt;coworker&lt;/a&gt; decided it would be a good idea to hide both my rental keys and my car keys the Friday before Labor Day.  Being the good little mindless drone I was, I stayed late but didn’t realize my keys were gone until 9PM.  Now I’m all for pranks and someone getting me good but keys, wallets, purses are off limits since that person thinks someone stole the keys / wallet / purse.&lt;/p&gt;  &lt;p&gt;Needless to say, &lt;a href="http://twitter.com/ClintRutkas/status/3773332014"&gt;I was irked and said on twitter&lt;/a&gt; “the prank wars, started they have”.  And this weekend, I got my revenge.  Just remember, I could have been far meaner Nic.&lt;/p&gt;  &lt;table style="margin-left: -10px" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top"&gt;&lt;a title="Foam Chair Prank by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3920267550/"&gt;&lt;img style="margin: 0.25em !important" alt="Foam Chair Prank" src="http://farm3.static.flickr.com/2553/3920267550_6355f006c9.jpg" width="333" height="500" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top"&gt;         &lt;p&gt;&lt;a title="Foam Chair Prank by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3917143816/"&gt;&lt;img style="margin: 0.25em !important" alt="Foam Chair Prank" src="http://farm3.static.flickr.com/2578/3917143816_365c8c228f_s.jpg" width="75" height="75" /&gt;&lt;/a&gt;&lt;a title="Foam Chair Prank by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3919486757/"&gt;&lt;img style="margin: 0.25em !important" alt="Foam Chair Prank" src="http://farm4.static.flickr.com/3476/3919486757_180bb7a2a8_s.jpg" width="75" height="75" /&gt;&lt;/a&gt;&lt;a title="Foam Chair Prank by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3919487479/"&gt;&lt;img style="margin: 0.25em !important" alt="Foam Chair Prank" src="http://farm4.static.flickr.com/3506/3919487479_591bf52fe5_s.jpg" width="75" height="75" /&gt;&lt;/a&gt;             &lt;br /&gt;&lt;a title="Foam Chair Prank by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3917131390/"&gt;&lt;img style="margin: 0.25em !important" alt="Foam Chair Prank" src="http://farm3.static.flickr.com/2488/3917131390_87551b853d_s.jpg" width="75" height="75" /&gt;&lt;/a&gt;&lt;a title="Foam Chair Prank by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3916346877/"&gt;&lt;img style="margin: 0.25em !important" alt="Foam Chair Prank" src="http://farm3.static.flickr.com/2573/3916346877_9ec7014e4f_s.jpg" width="75" height="75" /&gt;&lt;/a&gt;&lt;a title="Foam Chair Prank by BetterThanEveryone, on Flickr" href="http://www.flickr.com/photos/betterthaneveryone/3917133272/"&gt;&lt;img style="margin: 0.25em !important" alt="Foam Chair Prank" src="http://farm3.static.flickr.com/2524/3917133272_eb6f30f7f6_s.jpg" width="75" height="75" /&gt;&lt;/a&gt;&lt;/p&gt;         &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="320" height="240"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_06_22.xap" /&gt; &lt;param name="initParams" value="m=mms://mschnlnine.wmod.llnwd.net/a1809/d1/ch9/6/0/6/1/9/4/clintPranksNic_s_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/6/0/6/1/9/4/clintPranksNic_320_ch9.png, postid=491606" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://www.betterthaneveryone.com/aggbug/880.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Clint Rutkas</dc:creator>
            <guid isPermaLink="false">http://www.betterthaneveryone.com/archive/2009/09/14/880.aspx</guid>
            <pubDate>Mon, 14 Sep 2009 18:51:52 GMT</pubDate>
            <wfw:comment>http://www.betterthaneveryone.com/comments/880.aspx</wfw:comment>
            <comments>http://www.betterthaneveryone.com/archive/2009/09/14/880.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://www.betterthaneveryone.com/comments/commentRss/880.aspx</wfw:commentRss>
        <feedburner:origLink>http://www.betterthaneveryone.com/archive/2009/09/14/880.aspx</feedburner:origLink></item>
    </channel>
</rss>
