<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rum and Code</title>
	<atom:link href="http://rumandcode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rumandcode.wordpress.com</link>
	<description>In Code Veritas</description>
	<lastBuildDate>Tue, 27 Oct 2009 12:18:10 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='rumandcode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/8600dfd9554a347312104a551846171a?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Rum and Code</title>
		<link>http://rumandcode.wordpress.com</link>
	</image>
			<item>
		<title>Html 4.1 Makes CSS Names Case Sensitve</title>
		<link>http://rumandcode.wordpress.com/2009/10/27/html-4-1-makes-css-names-case-sensitve/</link>
		<comments>http://rumandcode.wordpress.com/2009/10/27/html-4-1-makes-css-names-case-sensitve/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 12:18:10 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/2009/10/27/html-4-1-makes-css-names-case-sensitve/</guid>
		<description><![CDATA[We recently had to change a bunch of pages to make sure that IE and Firefox rendered them in standards mode to support some Ajax controls. It&#8217;s simple enough to add the doctype and an x-ua-compatible line for ie. What shocked me was when it broke our image buttons. They were linkbuttons with totally valid [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=245&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We recently had to change a bunch of pages to make sure that IE and Firefox rendered them in standards mode to support some Ajax controls. It&#8217;s simple enough to add the doctype and an x-ua-compatible line for ie. What shocked me was when it broke our image buttons. They were linkbuttons with totally valid css behind them. The css validated from css 1 to 2.1 and I was baffled until I noticed the button was rendering correctly on one page where by rights it shouldn&#8217;t. </p>
<p>I fired up developer tools in ie8 and firebug and saw that on the bad pages the proper class wasn&#8217;t getting picked up by the buttons at all. WTF!?!</p>
<p>Then I saw it. The name of the class on the good page was case sensitive while all the others were capitalized. Could it be so simple?  Yea, yeah it is.</p>
<p>tl;dr If you&#8217;re doing a page in HTML 4.1 standards, make sure you css classes observe case sensitivity. </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/245/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=245&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/10/27/html-4-1-makes-css-names-case-sensitve/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>
	</item>
		<item>
		<title>Bing Maps Silverlight Control With Traffic Cams</title>
		<link>http://rumandcode.wordpress.com/2009/09/10/bing-maps-silverlight-control-with-traffic-cams/</link>
		<comments>http://rumandcode.wordpress.com/2009/09/10/bing-maps-silverlight-control-with-traffic-cams/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 13:40:36 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Check this out]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Bing]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=221</guid>
		<description><![CDATA[So there is a CTP of the Bing Maps Silverlight SDK out there and with the discontinuation of the asp.net version it looks like this is the direction that Redmond is moving.   I&#8217;ve been playing with the controls for a few weeks now and thought I&#8217;d do a little tutorial on a practical use.  One [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=221&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So there is a <a href="http://connect.microsoft.com/silverlightmapcontrolctp" target="_blank">CTP of the Bing Maps Silverlight SDK</a> out there and with the discontinuation of the asp.net version it looks like this is the direction that Redmond is moving.   I&#8217;ve been playing with the controls for a few weeks now and thought I&#8217;d do a little tutorial on a practical use.  One of the many awesome things about using Silverlight for this is that it don&#8217;t bog down with lots of pins / objects on the map and we don&#8217;t have to deal with a lot of the AJAX and postback issues we would doing the same thing in a traditional ASP.net app.</p>
<p>So despite the bad things that people in PA have to say about PennDot, they do have a ton of public traffic cams up on the major roads so an enterprising user can check conditions if they are going anywhere around the city.</p>
<p>In this app we&#8217;re going to generate a map and pins for each cam which will pop their image into a modal child window for the user to view and refresh the image every 5 seconds</p>
<p><img class="alignnone size-full wp-image-222" title="1" src="http://rumandcode.files.wordpress.com/2009/09/1.jpg?w=600&#038;h=430" alt="1" width="600" height="430" /></p>
<p><img class="alignnone size-full wp-image-224" title="2" src="http://rumandcode.files.wordpress.com/2009/09/2.jpg?w=428&#038;h=248" alt="2" width="428" height="248" /></p>
<p>That done, the first thing we need to do is add a ref to the map assembly.</p>
<p><img class="alignnone size-full wp-image-225" title="3" src="http://rumandcode.files.wordpress.com/2009/09/3.jpg?w=357&#038;h=167" alt="3" width="357" height="167" /></p>
<p>You can do it like this.</p>
<p><img class="alignnone size-full wp-image-226" title="4" src="http://rumandcode.files.wordpress.com/2009/09/4.jpg?w=455&#038;h=269" alt="4" width="455" height="269" /></p>
<p>Then in the xaml on the main page we need to add the reference thus:</p>
<p><img class="alignnone size-full wp-image-227" title="5" src="http://rumandcode.files.wordpress.com/2009/09/5.jpg?w=600&#038;h=94" alt="5" width="600" height="94" /></p>
<p>We also add the object to the grid and give it a name.  If you run the app now you should get a normal map.  For this we&#8217;re going to need a Child Window to show the image in, so lets add one to the silverlight project.</p>
<p><img class="alignnone size-full wp-image-228" title="6" src="http://rumandcode.files.wordpress.com/2009/09/6.jpg?w=356&#038;h=93" alt="6" width="356" height="93" /></p>
<p><img class="alignnone size-full wp-image-229" title="7" src="http://rumandcode.files.wordpress.com/2009/09/7.jpg?w=600&#038;h=368" alt="7" width="600" height="368" /></p>
<p>Now that it&#8217;s added, lets go mess with the xaml a bit.</p>
<p><img class="alignnone size-full wp-image-230" title="8" src="http://rumandcode.files.wordpress.com/2009/09/8.jpg?w=470&#038;h=325" alt="8" width="470" height="325" /></p>
<p>It has it pretty well setup for us to begin with but we want to bump up the size a bit to make the images more visible and add an Image object to the grid.  We don&#8217;t need to set its Grid.Row property explicitly since it&#8217;s the only one there and will fall into place on its own.  Give it a name and jump to the code view.</p>
<p>I&#8217;m giving you all the code at once so lets just step through and see whats going on here.  First we&#8217;re taking a string in the constructor which we&#8217;ll see come in handy later and throwing it into a class variable.  We&#8217;re also setting up a DispatcherTimer which is almost exactly like an old school timer.  We preload the image and start the timer ticking every 5 seconds and instruct the callback to reload the pic each time.</p>
<p><img class="alignnone size-full wp-image-231" title="9" src="http://rumandcode.files.wordpress.com/2009/09/9.jpg?w=600&#038;h=662" alt="9" width="600" height="662" /></p>
<p>We can also see that loading the pic is super easy.  Its important however to make sure we&#8217;re not caching the image or it&#8217;ll never change.  In most cases this wouldn&#8217;t be an issue as Silverlight does this to save resources, in this case we need the opposite.</p>
<p>Now lets jump back to the main window.</p>
<p><img class="alignnone size-full wp-image-232" title="10" src="http://rumandcode.files.wordpress.com/2009/09/10.jpg?w=250&#038;h=553" alt="10" width="250" height="553" /></p>
<p>I grabbed the data off the pennDot website and put it into a nice little xml file.   It looks like this:</p>
<p><img class="alignnone size-full wp-image-233" title="11" src="http://rumandcode.files.wordpress.com/2009/09/11.jpg?w=600&#038;h=444" alt="11" width="600" height="444" /></p>
<p>With that added we need to start creating pins for the user to click to see the camera footage.</p>
<p><img class="alignnone size-full wp-image-234" title="12" src="http://rumandcode.files.wordpress.com/2009/09/12.jpg?w=445&#038;h=277" alt="12" width="445" height="277" /></p>
<p>Now lets do this with LINQ to XML, we&#8217;ll need to import the assembly because it doesn&#8217;t preload with Silverlight.</p>
<p><img class="alignnone size-full wp-image-235" title="13" src="http://rumandcode.files.wordpress.com/2009/09/13.jpg?w=457&#038;h=382" alt="13" width="457" height="382" /></p>
<p>That done we can write a little query to grab the data we need.</p>
<p><img class="alignnone size-full wp-image-236" title="14" src="http://rumandcode.files.wordpress.com/2009/09/14.jpg?w=531&#038;h=223" alt="14" width="531" height="223" /></p>
<p>Now we&#8217;ve got an anon collection we can loop through and add our pins.  We&#8217;ll want to put them all into a new MapLayer to make it easy to clear them all later if we decide to give the user the option to remove the pins and it&#8217;ll simplify placement.</p>
<p><img class="alignnone size-full wp-image-237" title="15" src="http://rumandcode.files.wordpress.com/2009/09/15.jpg?w=600&#038;h=361" alt="15" width="600" height="361" /></p>
<p>For this example I&#8217;m just making little green Ellipses for pins but you could do something nicer with ease.  You can see that the URL to the different images is predictable if we know the camera ID so we set that up and create an anon method that will run when the user clicks on an Ellipse.  The event will create an instance of our child window and point it at the camera URL the user just clicked on.  When the user is done it will release the mouse.</p>
<p>Now we add the ellipse to the new MapLayer we created and place it in the correct location.  The loop complete we add the new layer to the map.   One last change.  We&#8217;ll do the user a favor and center the map near our cameras and zoom it in so that they&#8217;re pretty well visible.</p>
<p><img class="alignnone size-full wp-image-238" title="16" src="http://rumandcode.files.wordpress.com/2009/09/16.jpg?w=600&#038;h=67" alt="16" width="600" height="67" /></p>
<p>Now lets see how we did.</p>
<p><img class="alignnone size-full wp-image-239" title="17" src="http://rumandcode.files.wordpress.com/2009/09/17.jpg?w=600&#038;h=472" alt="17" width="600" height="472" /></p>
<p>And the camera</p>
<p><img class="alignnone size-full wp-image-240" title="18" src="http://rumandcode.files.wordpress.com/2009/09/18.jpg?w=600&#038;h=448" alt="18" width="600" height="448" /></p>
<p>You can check out a live version <a href="http://www.rumandcode.com/SilverMapTraffic/BingTrafficMapExampleTestPage.aspx" target="_blank">here</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/221/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=221&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/09/10/bing-maps-silverlight-control-with-traffic-cams/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/1.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/2.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/3.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/4.jpg" medium="image">
			<media:title type="html">4</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/5.jpg" medium="image">
			<media:title type="html">5</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/6.jpg" medium="image">
			<media:title type="html">6</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/7.jpg" medium="image">
			<media:title type="html">7</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/8.jpg" medium="image">
			<media:title type="html">8</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/9.jpg" medium="image">
			<media:title type="html">9</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/10.jpg" medium="image">
			<media:title type="html">10</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/11.jpg" medium="image">
			<media:title type="html">11</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/12.jpg" medium="image">
			<media:title type="html">12</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/13.jpg" medium="image">
			<media:title type="html">13</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/14.jpg" medium="image">
			<media:title type="html">14</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/15.jpg" medium="image">
			<media:title type="html">15</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/16.jpg" medium="image">
			<media:title type="html">16</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/17.jpg" medium="image">
			<media:title type="html">17</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/09/18.jpg" medium="image">
			<media:title type="html">18</media:title>
		</media:content>
	</item>
		<item>
		<title>Images and Parameters Broken in CrystalReportViewer</title>
		<link>http://rumandcode.wordpress.com/2009/05/28/images-and-parameters-broken-in-crystalreportviewer/</link>
		<comments>http://rumandcode.wordpress.com/2009/05/28/images-and-parameters-broken-in-crystalreportviewer/#comments</comments>
		<pubDate>Thu, 28 May 2009 17:30:03 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=197</guid>
		<description><![CDATA[ 
I hate Crystal Reports.  I was on the verge of a nervous breakdown today after launching a well tested app and finding my reportviewer with broken images or with a mysterious javascript error saying Object Expected.

The deal is that Crystal requires the aspnet_client folder that IIS creates in your Default Web Site and is accessable to all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=197&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p> </p>
<p>I hate Crystal Reports.  I was on the verge of a nervous breakdown today after launching a well tested app and finding my reportviewer with broken images or with a mysterious javascript error saying Object Expected.</p>
<p><img class="alignnone size-full wp-image-198" title="CropperCapture[2]" src="http://rumandcode.files.wordpress.com/2009/05/croppercapture2.png?w=600&#038;h=44" alt="CropperCapture[2]" width="600" height="44" /></p>
<p>The deal is that Crystal requires the aspnet_client folder that IIS creates in your Default Web Site and is accessable to all the virtual folders that live there.</p>
<p>However if you try to deploy your site to a new website on the server to use a different port or subdomain using host headers you won&#8217;t have access to the aspnet_client goodness and your reports will be borked.</p>
<p> <img class="alignnone size-full wp-image-200" title="CropperCapture[1]" src="http://rumandcode.files.wordpress.com/2009/05/croppercapture11.png?w=164&#038;h=129" alt="CropperCapture[1]" width="164" height="129" /></p>
<p>You can either copy the folder into your application folder or create a virtual folder that points to the aspnet_client folder in the Default site.</p>
<p><img class="alignnone size-full wp-image-201" title="CropperCapture[4]" src="http://rumandcode.files.wordpress.com/2009/05/croppercapture4.png?w=169&#038;h=139" alt="CropperCapture[4]" width="169" height="139" /></p>
<p>and you&#8217;re golden.</p>
<p><img class="alignnone size-full wp-image-202" title="CropperCapture[3]" src="http://rumandcode.files.wordpress.com/2009/05/croppercapture3.png?w=600&#038;h=44" alt="CropperCapture[3]" width="600" height="44" /></p>
<p>I owe a co-worker with a good memory for putting me on the right scent to figure this out.  Hope this helps someone avoid the anguish this caused me.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/197/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=197&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/05/28/images-and-parameters-broken-in-crystalreportviewer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/05/croppercapture2.png" medium="image">
			<media:title type="html">CropperCapture[2]</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/05/croppercapture11.png" medium="image">
			<media:title type="html">CropperCapture[1]</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/05/croppercapture4.png" medium="image">
			<media:title type="html">CropperCapture[4]</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/05/croppercapture3.png" medium="image">
			<media:title type="html">CropperCapture[3]</media:title>
		</media:content>
	</item>
		<item>
		<title>Save User Data In Silverlight</title>
		<link>http://rumandcode.wordpress.com/2009/05/20/save-user-data-in-silverlight/</link>
		<comments>http://rumandcode.wordpress.com/2009/05/20/save-user-data-in-silverlight/#comments</comments>
		<pubDate>Wed, 20 May 2009 14:01:32 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=191</guid>
		<description><![CDATA[So I&#8217;m writing a little time wasting game that step-father 2.0 came up with.  It&#8217;s a sort of sudokuesque columns blend.  Of course we want to have a way to keep track of your top ten scores for bragging rights. 
Anyway, in Silverlight you get, to start out, ten megs of isolated storage on each user&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=191&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So I&#8217;m writing a little time wasting game that step-father 2.0 came up with.  It&#8217;s a sort of sudokuesque columns blend.  Of course we want to have a way to keep track of your top ten scores for bragging rights. </p>
<p>Anyway, in Silverlight you get, to start out, ten megs of isolated storage on each user&#8217;s drive to work with.  You can prompt them for more space if you like but for our purposes we&#8217;ve got plenty of room for a little text file to store the top ten scores.  <span style="color:#0000ff;"><span style="color:#0000ff;"><span> </span><span style="color:#0000ff;"><font color="#0000ff">private</p>
<p></font></span></p>
<p><span style="color:#000000;"> </span><span style="color:#0000ff;">void</span><span style="color:#000000;"> SaveScore() </span>{</p>
<p><span style="color:#2b91af;">List</span><span style="color:#a600a6;">&lt;</span><span style="color:#0000ff;">double</span><span style="color:#a600a6;">&gt;</span> scores <span style="color:#a600a6;">=</span> <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">List</span><span style="color:#a600a6;">&lt;</span><span style="color:#0000ff;">double</span><span style="color:#a600a6;">&gt;</span>();</p>
<p><span style="color:#0000ff;">string</span> rawScores <span style="color:#a600a6;">=</span> LoadData(<span style="color:#a31515;">&#8220;scores.dat&#8221;</span>);</p>
<p><span style="color:#008000;">/* If there are scores, read them in */</span></p>
<p><span style="color:#0000ff;">if</span>(rawScores<span style="color:#a600a6;">.</span>Length <span style="color:#a600a6;">&gt;</span> <span style="color:#008000;">0</span>) {</p>
<p><span style="color:#0000ff;">string</span>[] splitScores <span style="color:#a600a6;">=</span> rawScores<span style="color:#a600a6;">.</span>Split(<span style="color:#a31515;">&#8216;;&#8217;</span>);</p>
<p>scores <span style="color:#a600a6;">=</span> splitScores<span style="color:#a600a6;">.</span>Select(a <span style="color:#a600a6;">=&gt;</span> <span style="color:#0000ff;">double</span><span style="color:#a600a6;">.</span>Parse(a))<span style="color:#a600a6;">.</span>ToList();</p>
<p>}</p>
<p>scores<span style="color:#a600a6;">.</span>Add(score);</p>
<p><span style="color:#008000;">/* Get the scores in order highest to lowest */</span></p>
<p>scores<span style="color:#a600a6;">.</span>Sort((a,b) <span style="color:#a600a6;">=&gt;</span> b<span style="color:#a600a6;">.</span>CompareTo(a));</p>
<p><span style="color:#008000;">/* Take the new top ten and semicolon delimit them */</span></p>
<p><span style="color:#0000ff;">string</span> newScores <span style="color:#a600a6;">=</span></p>
<p>scores<span style="color:#a600a6;">.</span>Take(<span style="color:#008000;">10</span>)<span style="color:#a600a6;">.</span>Aggregate(<span style="color:#a31515;">&#8220;&#8221;</span>, (a,b) <span style="color:#a600a6;">=&gt;</span> (a <span style="color:#a600a6;">+</span> <span style="color:#a31515;">&#8220;;&#8221;</span> <span style="color:#a600a6;">+</span> b))<span style="color:#a600a6;">.</span>TrimStart(<span style="color:#a31515;">&#8216;;&#8217;</span>);</p>
<p>SaveData(newScores, <span style="color:#a31515;">&#8220;scores.dat&#8221;</span>);</p>
<p>}</p>
<p><span style="color:#888888;">And the supporting methods..</span></p>
<p><span style="color:#0000ff;"><font color="#0000ff">private</p>
<p></font></span> </p>
<p><span style="color:#000000;"> </span><span style="color:#0000ff;">void</span><span style="color:#000000;"> SaveData(</span><span style="color:#0000ff;">string</span><span style="color:#000000;"> data, </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fileName) </span>{</p>
<p><span style="color:#0000ff;">using</span> (<span style="color:#2b91af;">IsolatedStorageFile</span> isf <span style="color:#a600a6;">=</span></p>
<p><span style="color:#2b91af;">IsolatedStorageFile</span><span style="color:#a600a6;">.</span>GetUserStoreForApplication()) {</p>
<p><span style="color:#0000ff;">using</span> (<span style="color:#2b91af;">IsolatedStorageFileStream</span> isfs <span style="color:#a600a6;">=</span></p>
<p><span style="color:#0000ff;">new</span> <span style="color:#2b91af;">IsolatedStorageFileStream</span>(fileName, <span style="color:#2b91af;">FileMode</span><span style="color:#a600a6;">.</span>Create, isf)) {</p>
<p><span style="color:#0000ff;">using</span> (<span style="color:#2b91af;">StreamWriter</span> sw <span style="color:#a600a6;">=</span> <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">StreamWriter</span>(isfs)) {</p>
<p>sw<span style="color:#a600a6;">.</span>Write(data);</p>
<p>sw<span style="color:#a600a6;">.</span>Close();</p>
<p>}}}}</p>
<p><span style="color:#0000ff;"><font color="#0000ff">private</p>
<p></font></span> </p>
<p><span style="color:#000000;"> </span><span style="color:#0000ff;">string</span><span style="color:#000000;"> LoadData(</span><span style="color:#0000ff;">string</span><span style="color:#000000;"> fileName) </span>{</p>
<p><span style="color:#0000ff;">string</span> data <span style="color:#a600a6;">=</span> <span style="color:#2b91af;">String</span><span style="color:#a600a6;">.</span>Empty;</p>
<p><span style="color:#0000ff;">using</span> (<span style="color:#2b91af;">IsolatedStorageFile</span> isf <span style="color:#a600a6;">=</span> <span style="color:#2b91af;">IsolatedStorageFile</span><span style="color:#a600a6;">.</span>GetUserStoreForApplication()) {</p>
<p><span style="color:#0000ff;">using</span> (<span style="color:#2b91af;">IsolatedStorageFileStream</span> isfs <span style="color:#a600a6;">=</span></p>
<p><span style="color:#0000ff;">new</span> <span style="color:#2b91af;">IsolatedStorageFileStream</span>(fileName, <span style="color:#2b91af;">FileMode</span><span style="color:#a600a6;">.</span>OpenOrCreate, isf)) {</p>
<p><span style="color:#0000ff;">using</span> (<span style="color:#2b91af;">StreamReader</span> sr <span style="color:#a600a6;">=</span> <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">StreamReader</span>(isfs)) {</p>
<p><span style="color:#0000ff;">string</span> lineOfData <span style="color:#a600a6;">=</span> <span style="color:#2b91af;">String</span><span style="color:#a600a6;">.</span>Empty;</p>
<p><span style="color:#0000ff;">while</span> ((lineOfData <span style="color:#a600a6;">=</span> sr<span style="color:#a600a6;">.</span>ReadLine()) <span style="color:#a600a6;">!=</span> <span style="color:#0000ff;">null</span>)</p>
<p>data <span style="color:#a600a6;">+=</span> lineOfData;</p>
<p>}}}</p>
<p><span style="color:#0000ff;">return</span> data;</p>
<p>}</p>
<p></span></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=191&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/05/20/save-user-data-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>
	</item>
		<item>
		<title>Empty Option in DropDownList Bound to LinqDataSource</title>
		<link>http://rumandcode.wordpress.com/2009/04/02/empty-option-in-dropdownlist-bound-to-linqdatasource/</link>
		<comments>http://rumandcode.wordpress.com/2009/04/02/empty-option-in-dropdownlist-bound-to-linqdatasource/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 13:38:29 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=185</guid>
		<description><![CDATA[This has been driving me a little crazy.  Sure if it was a completely code side binding I could insert the empty row into the datasource myself but I&#8217;m doing lots of work in ListViews of late so that option is totally out.  I ended up finding the answer on StackOverflow.
&#60;asp:DropDownList ID="ddlEditEmployee" AppendDataBoundItems="true"

runat="server"

DataTextField="Value" DataValueField="ID"

SelectedValue='&#60;%# Bind("EmployeeID") [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=185&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This has been driving me a little crazy.  Sure if it was a completely code side binding I could insert the empty row into the datasource myself but I&#8217;m doing lots of work in ListViews of late so that option is totally out.  I ended up finding the answer on <a href="http://stackoverflow.com/questions/278290/dropdownlist-with-linqdatasource-and-an-empty-option" target="_blank">StackOverflow</a>.</p>
<pre><span style="color:#0000ff;"><span style="color:#0000ff;">&lt;</span></span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">DropDownList</span> <span style="color:#ff0000;">ID</span><span style="color:#0000ff;">="ddlEditEmployee"</span> <span style="color:#ff0000;">AppendDataBoundItems</span><span style="color:#0000ff;">="true"</span>

<span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"</span>

<span style="color:#ff0000;">DataTextField</span><span style="color:#0000ff;">="Value"</span> <span style="color:#ff0000;">DataValueField</span><span style="color:#0000ff;">="ID"</span>

<span style="color:#ff0000;">SelectedValue</span><span style="color:#0000ff;">='</span>&lt;%# Bind("EmployeeID") %&gt;<span style="color:#0000ff;">'</span>

<span style="color:#ff0000;">DataSourceID</span><span style="color:#0000ff;">="LinqDataSource2"&gt;</span>

<span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">ListItem</span> <span style="color:#ff0000;">Value</span><span style="color:#0000ff;">="-1"&gt;</span>

None

<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">ListItem</span><span style="color:#0000ff;">&gt;</span>

<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">DropDownList</span><span style="color:#0000ff;">&gt;</span></pre>
<p>The AppendDataBoundItems bit is important too otherwise sneaking that default on in there is for nothing.  Enjoy.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/185/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=185&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/04/02/empty-option-in-dropdownlist-bound-to-linqdatasource/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>
	</item>
		<item>
		<title>Clean Complex Databinding in ASP.Net</title>
		<link>http://rumandcode.wordpress.com/2009/04/02/clean-complex-databinding-in-aspnet/</link>
		<comments>http://rumandcode.wordpress.com/2009/04/02/clean-complex-databinding-in-aspnet/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 12:47:05 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=179</guid>
		<description><![CDATA[So I needed to do a little CRUD ListView for a simple app I&#8217;m working on.  One of the columns is an image path that I was using an Image object to display.  The object got vetoed and I&#8217;m going with text now so I wanted a clean way to either show a simple text [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=179&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So I needed to do a little CRUD ListView for a simple app I&#8217;m working on.  One of the columns is an image path that I was using an Image object to display.  The object got vetoed and I&#8217;m going with text now so I wanted a clean way to either show a simple text link to pop the image on a new tab or show that no image was available.  I went with this in the template:</p>
<pre><span style="color:#0000ff;"><span style="color:#0000ff;">&lt;</span></span><span style="color:#a31515;">td</span><span style="color:#0000ff;">&gt;</span>&lt;%<span style="color:#0000ff;">#</span> GenerateImageField(Eval(<span style="color:#a31515;">"ImagePath"</span>)) %&gt; <span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:#0000ff;">&gt;</span></pre>
<p> </p>
<pre>public string GenerateImageField(object dataItem){
if (dataItem == null || string.IsNullOrEmpty(dataItem.ToString()))
{
return "No Image";
}
return @"&lt;a href='"+ dataItem.ToString() +@"' target='_blank'&gt;Image&lt;/a&gt;";
}</pre>
<p><span style="color:#000000;">This works out rather well.</span></p>
<pre><img class="alignnone size-full wp-image-183" title="croppercapture1" src="http://rumandcode.files.wordpress.com/2009/04/croppercapture1.png?w=395&#038;h=107" alt="croppercapture1" width="395" height="107" /></pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/179/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/179/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/179/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=179&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/04/02/clean-complex-databinding-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/04/croppercapture1.png" medium="image">
			<media:title type="html">croppercapture1</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net Server Control Tag For QueryString</title>
		<link>http://rumandcode.wordpress.com/2009/03/26/aspnet-server-control-tag-for-querystring/</link>
		<comments>http://rumandcode.wordpress.com/2009/03/26/aspnet-server-control-tag-for-querystring/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 15:13:18 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=170</guid>
		<description><![CDATA[Maybe I&#8217;m just lucky but I&#8217;ve only had to use control tags in ASP.Net apps very infrequently and I always forget how they work until I need them again.  Sherlock Holmes would say thats a good thing but I&#8217;m going to post a little example here for my own benefit. 
I LOVE the ListView control that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=170&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Maybe I&#8217;m just lucky but I&#8217;ve only had to use control tags in ASP.Net apps very infrequently and I always forget how they work until I need them again.  Sherlock Holmes would say thats a good thing but I&#8217;m going to post a little example here for my own benefit. </p>
<p>I LOVE the ListView control that we got in 3.5 and I&#8217;m using it alot in the dinky apps I&#8217;m banging out of late.  For this one I needed to create a little link in the grid for each row using the current querystring and the row&#8217;s ID.</p>
<p><span style="color:#0000ff;"><font color="#0000ff">&lt;</p>
<p></font></span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">ListView</span> <span style="color:#ff0000;">ID</span><span style="color:#0000ff;">=&#8221;lvLicenses&#8221;</span> <span style="color:#ff0000;">runat</span><span style="color:#0000ff;">=&#8221;server&#8221;</span> <span style="color:#ff0000;">DataSourceID</span><span style="color:#0000ff;">=&#8221;dsEmployeeLicense&#8221;&gt;</span></p>
<p><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">ItemTemplate</span><span style="color:#0000ff;">&gt;</span></p>
<p><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">tr</span> <span style="color:#ff0000;">style</span><span style="color:#0000ff;">=&#8221;</span><span style="color:#ff0000;">background-color</span>: <span style="color:#0000ff;">#E0FFFF</span>;<span style="color:#ff0000;">color</span>: <span style="color:#0000ff;">#333333</span>;<span style="color:#0000ff;">&#8220;&gt;</span></p>
<p><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">td</span><span style="color:#0000ff;">&gt;</span></p>
<p><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">a</span> <span style="color:#ff0000;">href</span><span style="color:#0000ff;">=&#8217;EmployeeLicense.aspx?EmpID=</span>&lt;%=Request.QueryString["ID"]%&gt;<span style="color:#0000ff;">&amp;ID=</span>&lt;%# Eval(&#8220;ID&#8221;) %&gt;<span style="color:#0000ff;">&#8216;</span> <span style="color:#ff0000;">target</span><span style="color:#0000ff;">=&#8221;_self&#8221;&gt;</span>Edit<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">a</span><span style="color:#0000ff;">&gt;</span></p>
<p><span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:#0000ff;">&gt;</span></p>
<p>Easy as pie.  mmm pie.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=170&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/03/26/aspnet-server-control-tag-for-querystring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net Listview with FileUpload Control &amp; LinqDataSource</title>
		<link>http://rumandcode.wordpress.com/2009/03/19/aspnet-listview-with-fileupload-control-linqdatasource/</link>
		<comments>http://rumandcode.wordpress.com/2009/03/19/aspnet-listview-with-fileupload-control-linqdatasource/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:29:19 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=154</guid>
		<description><![CDATA[So this was a little harder than I thought it would be.  I&#8217;m still a little shocked that it wasn&#8217;t a more common question.  So here is what we&#8217;re going for, a ListView databound to a LinqDatasource which has a column with an image path.  We want to show that image in the grid and allow for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=154&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So this was a little harder than I thought it would be.  I&#8217;m still a little shocked that it wasn&#8217;t a more common question.  So here is what we&#8217;re going for, a ListView databound to a LinqDatasource which has a column with an image path.  We want to show that image in the grid and allow for uploading new images to new and existing rows. Like this:</p>
<p><img class="alignnone size-full wp-image-155" title="croppercapture1" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture1.png?w=437&#038;h=148" alt="croppercapture1" width="437" height="148" /></p>
<p>And the insert</p>
<p><img class="alignnone size-full wp-image-156" title="croppercapture2" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture2.png?w=407&#038;h=96" alt="croppercapture2" width="407" height="96" /></p>
<p>The source for the above would look like this:</p>
<p><img class="alignnone size-full wp-image-157" title="croppercapture3" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture3.png?w=510&#038;h=261" alt="croppercapture3" width="510" height="261" /></p>
<p>See that we&#8217;re just wrapping the image in a link and shrinking it down. </p>
<p><img class="alignnone size-full wp-image-158" title="croppercapture4" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture4.png?w=510&#038;h=167" alt="croppercapture4" width="510" height="167" /></p>
<p>Again, no biggie, just a regular FileUpload control.</p>
<p>Now lets look at the real magic thats going to make this work.  The first thing we need is a way to find the control from our code-behind.  This is pilfered from everyone&#8217;s friend Jeff Atwood from over at Coding Horror.</p>
<p><img class="alignnone size-full wp-image-159" title="croppercapture5" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture5.png?w=509&#038;h=222" alt="croppercapture5" width="509" height="222" /></p>
<p>Then we&#8217;re going to going to override the LINQ inserting and inserted events:</p>
<p><img class="alignnone size-full wp-image-160" title="croppercapture6" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture6.png?w=510&#038;h=210" alt="croppercapture6" width="510" height="210" /></p>
<p>This should be pretty straightforward.  We grab a handle to the FileUpload object and create the server path (I know, it should be inside the IF but I don&#8217;t want to redo the screenshot)  Then we save the file to the server.</p>
<p><img class="alignnone size-full wp-image-161" title="croppercapture7" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture7.png?w=510&#038;h=181" alt="croppercapture7" width="510" height="181" /></p>
<p>Now after the row has been inserted we&#8217;ll check that FileUpload control again, get the row that was just inserted, set the path and update the row just in time for the postback.</p>
<p><img class="alignnone size-full wp-image-163" title="croppercapture81" src="http://rumandcode.files.wordpress.com/2009/03/croppercapture81.png?w=319&#038;h=221" alt="croppercapture81" width="319" height="221" /></p>
<p>You could probably wrap the whole thing up in an UpdatePanel and make it all slick and Ajaxy but I think what we&#8217;ve got here is pretty neat as is.  Enjoy.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=154&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/03/19/aspnet-listview-with-fileupload-control-linqdatasource/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture1.png" medium="image">
			<media:title type="html">croppercapture1</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture2.png" medium="image">
			<media:title type="html">croppercapture2</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture3.png" medium="image">
			<media:title type="html">croppercapture3</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture4.png" medium="image">
			<media:title type="html">croppercapture4</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture5.png" medium="image">
			<media:title type="html">croppercapture5</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture6.png" medium="image">
			<media:title type="html">croppercapture6</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture7.png" medium="image">
			<media:title type="html">croppercapture7</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/03/croppercapture81.png" medium="image">
			<media:title type="html">croppercapture81</media:title>
		</media:content>
	</item>
		<item>
		<title>Fold up Regions Macro for Visual Studio</title>
		<link>http://rumandcode.wordpress.com/2009/02/09/fold-up-regions-macro-for-visual-studio/</link>
		<comments>http://rumandcode.wordpress.com/2009/02/09/fold-up-regions-macro-for-visual-studio/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 15:16:41 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=143</guid>
		<description><![CDATA[So we wrap everything in regions.  I know some coders scoff at that but we think it keeps the code tidy.  One of the downsides is that there isn&#8217;t a keyboard shortcut to collapse all regions without collapsing everything else too.  One of my wonderful co-workers found one.
Here is what you need to do.  Go [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=143&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So we wrap everything in regions.  I know some coders scoff at that but we think it keeps the code tidy.  One of the downsides is that there isn&#8217;t a keyboard shortcut to collapse all regions without collapsing everything else too.  One of my wonderful co-workers found one.</p>
<p>Here is what you need to do.  Go to Tools/Macros/Macro IDE in Visual Studio.</p>
<p><img class="alignnone size-full wp-image-144" title="croppercapture1" src="http://rumandcode.files.wordpress.com/2009/02/croppercapture1.png?w=510&#038;h=309" alt="croppercapture1" width="510" height="309" /></p>
<p>Create a new macro and name it RegionTools. (This is important as it has to match the module name.</p>
<p>Drop the following code into it.</p>
<p>Imports EnvDTE<br />
Imports System.Diagnostics<br />
Public Module RegionTools</p>
<p>    Sub ExpandAllRegions()</p>
<p>        Dim objSelection As TextSelection</p>
<p>        DTE.SuppressUI = True<br />
        objSelection = DTE.ActiveDocument.Selection()<br />
        objSelection.StartOfDocument()<br />
        Do While objSelection.FindText(&#8220;#region&#8221;, vsFindOptions.vsFindOptionsMatchInHiddenText)<br />
           <br />
        Loop<br />
        objSelection.StartOfDocument()<br />
        DTE.SuppressUI = False</p>
<p>        objSelection = Nothing</p>
<p>    End Sub<br />
    Sub CollapseAllRegions()</p>
<p>        Dim objSelection As TextSelection</p>
<p>        ExpandAllRegions()</p>
<p>        DTE.SuppressUI = True<br />
        objSelection = DTE.ActiveDocument.Selection()<br />
        objSelection.EndOfDocument()</p>
<p>        Do While (objSelection.FindText(&#8220;#region&#8221;, vsFindOptions.vsFindOptionsBackwards))<br />
            DTE.ExecuteCommand(&#8220;Edit.ToggleOutliningExpansion&#8221;)<br />
            objSelection.EndOfDocument()<br />
        Loop<br />
        objSelection.StartOfDocument()<br />
        DTE.SuppressUI = False<br />
        objSelection = Nothing</p>
<p>    End Sub<br />
End Module</p>
<p> </p>
<p> <span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;"><br />
</span></span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;"><span style="color:#000000;">That done you can map the macro to a proper shortcut as I&#8217;ve done using Ctl-Shift&#8211;</span></span><br />
</span></span></p>
<p><span style="font-size:x-small;color:#0000ff;"><span style="color:#000000;"><img class="alignnone size-full wp-image-145" title="croppercapture2" src="http://rumandcode.files.wordpress.com/2009/02/croppercapture2.png?w=510&#038;h=289" alt="croppercapture2" width="510" height="289" /></span></span></p>
<p><span style="font-size:x-small;color:#0000ff;"><span style="color:#000000;">Enjoy.</span></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=143&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/02/09/fold-up-regions-macro-for-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/02/croppercapture1.png" medium="image">
			<media:title type="html">croppercapture1</media:title>
		</media:content>

		<media:content url="http://rumandcode.files.wordpress.com/2009/02/croppercapture2.png" medium="image">
			<media:title type="html">croppercapture2</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick and Easy Security From Threads</title>
		<link>http://rumandcode.wordpress.com/2009/01/21/quick-and-easy-security-from-threads/</link>
		<comments>http://rumandcode.wordpress.com/2009/01/21/quick-and-easy-security-from-threads/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 13:09:48 +0000</pubDate>
		<dc:creator>echostorm</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://rumandcode.wordpress.com/?p=140</guid>
		<description><![CDATA[Sometimes we can use Active Directory for our application security.  There are a number of ways to attack the problem including the oft painful LDAP.  If we need to check to see if the current user is a member of an AD group we can do it thus:
// We can start by making sure that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=140&subd=rumandcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Sometimes we can use Active Directory for our application security.  There are a number of ways to attack the problem including the oft painful LDAP.  If we need to check to see if the current user is a member of an AD group we can do it thus:</p>
<p>// We can start by making sure that our current principal is set correctly as it probably isn&#8217;t.</p>
<p> <span style="color:#2b91af;"><span style="color:#2b91af;">Thread</span></span><span style="color:#a600a6;">.</span>CurrentPrincipal <span style="color:#a600a6;">=</span> <span style="color:#0000ff;">new</span> <span style="color:#2b91af;">WindowsPrincipal</span>(<span style="color:#2b91af;">WindowsIdentity</span><span style="color:#a600a6;">.</span>GetCurrent());</p>
<p>// Then we can save some time with an obvious check </p>
<p><span style="color:#0000ff;">if</span> (<span style="color:#2b91af;">Thread</span><span style="color:#a600a6;">.</span>CurrentPrincipal<span style="color:#a600a6;">.</span>Identity<span style="color:#a600a6;">.</span>IsAuthenticated)</p>
<p>{</p>
<p>// Now we have only to specify the name of the group in AD.  Here I have</p>
<p>// the name &#8220;XXX_Administrators&#8221; refrenced from the resource file.</p>
<p><span style="color:#0000ff;">if</span> (<span style="color:#2b91af;">Thread</span><span style="color:#a600a6;">.</span>CurrentPrincipal<span style="color:#a600a6;">.</span>IsInRole(Properties<span style="color:#a600a6;">.</span><span style="color:#2b91af;">Resources</span><span style="color:#a600a6;">.</span>AdminRole))</p>
<p>{</p>
<p><span style="color:#0000ff;">return</span> <span style="color:#2b91af;">SecurityGroup</span><span style="color:#a600a6;">.</span>Administrators;</p>
<p>}</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rumandcode.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rumandcode.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rumandcode.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rumandcode.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rumandcode.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rumandcode.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rumandcode.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rumandcode.wordpress.com/140/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rumandcode.wordpress.com/140/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rumandcode.wordpress.com/140/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rumandcode.wordpress.com&blog=520201&post=140&subd=rumandcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://rumandcode.wordpress.com/2009/01/21/quick-and-easy-security-from-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/573fbee92f89bedf849872526354e363?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">echostorm</media:title>
		</media:content>
	</item>
	</channel>
</rss>