<?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/"
	>

<channel>
	<title>FruitBatInShades Code &#187; fbis</title>
	<atom:link href="http://www.fruitbatscode.com/author/fbis/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fruitbatscode.com</link>
	<description>Where the fruitbat keeps his notes</description>
	<lastBuildDate>Thu, 17 Nov 2011 12:20:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>c# Coalesce function</title>
		<link>http://www.fruitbatscode.com/net/c/c-coalesce-function</link>
		<comments>http://www.fruitbatscode.com/net/c/c-coalesce-function#comments</comments>
		<pubDate>Wed, 16 Nov 2011 09:18:25 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[My Stuff]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=474</guid>
		<description><![CDATA[When you&#8217;ve been working heavily with c# for a few days, coalesce jumps into your head for a lot of c# issues. Heres a little helper to provide coalesce in .net /// &#60;summary&#62; /// Returns the first non null value, same as SQL's COALESCE() /// &#60;/summary&#62; /// &#60;param name=&#34;p&#34;&#62;Args array&#60;/param&#62; /// &#60;returns&#62;First non null value&#60;/returns&#62; [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/c-coalesce-function/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Syncing select options</title>
		<link>http://www.fruitbatscode.com/javascript/jquery/jquery-syncing-select-options</link>
		<comments>http://www.fruitbatscode.com/javascript/jquery/jquery-syncing-select-options#comments</comments>
		<pubDate>Fri, 04 Nov 2011 10:01:46 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[My Stuff]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=467</guid>
		<description><![CDATA[I had a requirement for a series of select boxes that required the related one to only allow selections above the first. I created a little utility function that enables and disables the options based on a function you supply.  Usage is pretty simple. Pass in the first and second select as jQuery objects, then [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/javascript/jquery/jquery-syncing-select-options/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAD 9 &#8211; Numbers To Words</title>
		<link>http://www.fruitbatscode.com/net/c/uad-9-numbers-to-words</link>
		<comments>http://www.fruitbatscode.com/net/c/uad-9-numbers-to-words#comments</comments>
		<pubDate>Sun, 13 Mar 2011 11:46:13 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=454</guid>
		<description><![CDATA[Utility to take a number and convert it to the english text. Not mine this one but lost the original url! If it&#8217;s yours let me know public class NumberToWords &#123; // Single-digit and small number names private string&#91;&#93; _smallNumbers = new string&#91;&#93; &#123; &#34;Zero&#34;, &#34;One&#34;, &#34;Two&#34;, &#34;Three&#34;, &#34;Four&#34;, &#34;Five&#34;, &#34;Six&#34;, &#34;Seven&#34;, &#34;Eight&#34;, &#34;Nine&#34;, &#34;Ten&#34;, [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/uad-9-numbers-to-words/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAD8: Query String Builder</title>
		<link>http://www.fruitbatscode.com/net/c/uad8-query-string-builder</link>
		<comments>http://www.fruitbatscode.com/net/c/uad8-query-string-builder#comments</comments>
		<pubDate>Sun, 13 Mar 2011 11:40:21 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[My Stuff]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=451</guid>
		<description><![CDATA[Ever had controls that need to add to the Query String but not duplicate or erase what&#8217;s already there? This is a little utility I dug out and just changed to use a generic dictionary recently. Just use it as you would a normal dictionary. When you instantiate a copy it picks up the current [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/uad8-query-string-builder/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Get a childs relative position</title>
		<link>http://www.fruitbatscode.com/javascript/jquery/jquery-get-a-childs-relative-position</link>
		<comments>http://www.fruitbatscode.com/javascript/jquery/jquery-get-a-childs-relative-position#comments</comments>
		<pubDate>Thu, 13 Jan 2011 09:53:31 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=440</guid>
		<description><![CDATA[When processing sortables etc. Its handy to be able to get the index of individual items. Heres how you find the position of an li within a list: var position = $item.parent&#40;&#41;.find&#40;'&#62; li'&#41;.index&#40;$item&#41; + 1;]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/javascript/jquery/jquery-get-a-childs-relative-position/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAD7 &#8211; File size, nearest unit mb,kb,gb.</title>
		<link>http://www.fruitbatscode.com/net/c/uad7-file-size-nearest-unit-mbkbgb</link>
		<comments>http://www.fruitbatscode.com/net/c/uad7-file-size-nearest-unit-mbkbgb#comments</comments>
		<pubDate>Wed, 22 Dec 2010 16:33:04 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=436</guid>
		<description><![CDATA[Okay, so Util-a-day was a bit optimistic! Here&#8217;s the next one, simple function to convert a file size in a user friendly description. It converts the size to the nearest kb, mb or gb. public static String ConvertBytes&#40;double bytes&#41;&#123; String FORMAT = &#34;{0:N2}&#34;; if &#40;bytes &#62; 1073741824&#41; return String.Format&#40;FORMAT, &#40;bytes / 1024 / 1024 / [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/uad7-file-size-nearest-unit-mbkbgb/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAD6 &#8211; Physical path to virtual</title>
		<link>http://www.fruitbatscode.com/net/c/uad6-physical-path-to-virtual</link>
		<comments>http://www.fruitbatscode.com/net/c/uad6-physical-path-to-virtual#comments</comments>
		<pubDate>Tue, 07 Dec 2010 13:28:04 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=433</guid>
		<description><![CDATA[Simple util to take a physical path and gets its virtual equivalent. public static string PhysicalPathToVirtual&#40;string path&#41; &#123; if &#40;HttpContext.Current != null &#38;&#38; !String.IsNullOrEmpty&#40;path&#41;&#41; &#123; return &#34;/&#34; + path.Replace&#40;HttpContext.Current.Server.MapPath&#40;&#34;/&#34;&#41;, &#34;&#34;&#41;.Replace&#40;@&#34;\&#34;, &#34;/&#34;&#41;; &#125; else return null; &#125; public static string PhysicalPathToVirtual&#40;HttpContext context, string path&#41; &#123; if &#40;context != null &#38;&#38; !String.IsNullOrEmpty&#40;path&#41;&#41; &#123; return &#34;/&#34; + path.Replace&#40;context.Server.MapPath&#40;&#34;/&#34;&#41;, [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/uad6-physical-path-to-virtual/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAD5 &#8211; Append Directory</title>
		<link>http://www.fruitbatscode.com/net/c/uad5-append-directory</link>
		<comments>http://www.fruitbatscode.com/net/c/uad5-append-directory#comments</comments>
		<pubDate>Fri, 03 Dec 2010 13:56:52 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=429</guid>
		<description><![CDATA[When creating various file explorer for asp.net I generate thumbnails and put these in a hidden thumbs folder. This little routine just slips in a directory at the end so c:\images\file.jpg becomes c:\images\thumbs\file.jpg. /// &#60;summary&#62; /// Adds the passed directory into the string /// &#60;/summary&#62; /// &#60;param name=&#34;filePath&#34;&#62;Original Path&#60;/param&#62; /// &#60;param name=&#34;directoryName&#34;&#62;directory name to append&#60;/param&#62; [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/uad5-append-directory/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAD4 &#8211; Is Valid Email</title>
		<link>http://www.fruitbatscode.com/net/c/uad4-is-valid-email</link>
		<comments>http://www.fruitbatscode.com/net/c/uad4-is-valid-email#comments</comments>
		<pubDate>Wed, 01 Dec 2010 18:41:37 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=426</guid>
		<description><![CDATA[A simple regex to see if a string is in a valid email format public static bool IsValidEmail&#40;string email&#41; &#123; string expression = @&#34;^(([^&#60;&#62;()[\]\\.,;:\s@\&#34;&#34;]+&#34; + @&#34;(\.[^&#60;&#62;()[\]\\.,;:\s@\&#34;&#34;]+)*)&#124;(\&#34;&#34;.+\&#34;&#34;&#41;&#41;@&#34; + @&#34;&#40;&#40;\&#91;&#91;0-9&#93;&#123;1,3&#125;\.&#91;0-9&#93;&#123;1,3&#125;\.&#91;0-9&#93;&#123;1,3&#125;&#34; + @&#34;\.&#91;0-9&#93;&#123;1,3&#125;\&#93;&#41;&#124;&#40;&#40;&#91;a-zA-Z\-0-9&#93;+\.&#41;+&#34; + @&#34;&#91;a-zA-Z&#93;&#123;2,&#125;&#41;&#41;$&#34;; Regex re = new Regex(expression); if (re.IsMatch(email)) return (true); else return (false); &#160; &#60;span id=&#34;more-426&#34;&#62;&#60;/span&#62; &#160; }]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/uad4-is-valid-email/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UAD3 &#8211; Enum to ListItemCollection</title>
		<link>http://www.fruitbatscode.com/net/c/uad3-enum-to-listitemcollection</link>
		<comments>http://www.fruitbatscode.com/net/c/uad3-enum-to-listitemcollection#comments</comments>
		<pubDate>Tue, 30 Nov 2010 14:19:17 +0000</pubDate>
		<dc:creator>fbis</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Util-a-day]]></category>

		<guid isPermaLink="false">http://www.fruitbatscode.com/?p=421</guid>
		<description><![CDATA[Converts an enum to a ListItemCollection so users can select an option from an enum. Just cast it back like so: &#40;enumToUse&#41;Enum.Parse&#40;typeof&#40;enumToUse&#41;, DropDownList.SelectedItem.Value&#41; /// &#60;summary&#62; /// Converts enum to ListItemCollection /// &#60;/summary&#62; /// &#60;param name=&#34;EnumToUse&#34;&#62;Type of enum to use&#60;/param&#62; /// &#60;param name=&#34;ListItems&#34;&#62;Target LIstItemCollection&#60;/param&#62; public static void EnumToListItemCollection&#40;System.Type EnumToUse, ListItemCollection ListItems&#41; &#123; string&#91;&#93; Names; System.Array Values; [...]]]></description>
		<wfw:commentRss>http://www.fruitbatscode.com/net/c/uad3-enum-to-listitemcollection/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

