<?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>Adventures In Development &#187; JavaScript</title>
	<atom:link href="http://www.adventuresindevelopment.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adventuresindevelopment.com</link>
	<description>Web Development Tools, Ideas, Techniques and Resources</description>
	<lastBuildDate>Fri, 27 Aug 2010 04:11:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to Implement an ASP.NET Color Picker</title>
		<link>http://www.adventuresindevelopment.com/2009/06/12/how-to-implement-an-aspnet-color-picker/</link>
		<comments>http://www.adventuresindevelopment.com/2009/06/12/how-to-implement-an-aspnet-color-picker/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 20:28:18 +0000</pubDate>
		<dc:creator>Matthew Paulson</dc:creator>
				<category><![CDATA[360 WebCMS]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Content Management Systems]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.adventuresindevelopment.com/?p=139</guid>
		<description><![CDATA[One of the components of the 360 Web Content Management System (website in progress) that I wanted to develop was an events calendar that allowed you to post events into color-coded categories. You can see a demo of it here. At first, I had it so that users would manually enter in a 6-character HTML [...]]]></description>
			<content:encoded><![CDATA[<p>One of the components of the <a href="http://www.360webcms.com/">360 Web Content Management System</a> (website in progress) that I wanted to develop was an events calendar that allowed you to post events into color-coded categories. You can see a demo of it <a href="http://cmsdemo.factor360.com/events.aspx">here</a>. At first, I had it so that users would manually enter in a 6-character HTML color code, but it was very non-intuitive for anyone who&#8217;s never worked with HTML before. Eventually I stumbled upon the <a href="http://www.karpach.com/ColorPickerDemo.aspx">ASP.NET Color Picker control</a>. It&#8217;s a custom ASP.NET control that you can add to a page much in the way that you can add a text box, radio buttons, or a drop down list.</p>
<p><span style="text-decoration: underline;"><strong>Here&#8217;s how to implement the ASP.NET Color Picker Control</strong></span></p>
<p><strong>(1) Download the library and add it to your project<br />
</strong></p>
<p>First, download the library from the ASP.NET Color Picker Control website. Make sure to download the latest binary release from the website. Currently that version is <a href="http://www.karpach.com/files/WebControls.v.1.4.10423.1-bin.zip">ASP.NET Color Picker v.1.4.10423.1 Binary</a>. Once you get the zip file, it will contain a library that you should extract to the /bin/ folder of your website.</p>
<p><strong>(2) Register the library on your page</strong></p>
<p>ASP.NET provides a set of standard controls that you can add to a page that start with the &#8220;ASP&#8221; prefix, such as &#8220;&lt;ASP:TextBox runat=&#8221;server&#8221; id=&#8221;txtBox&#8221; /&gt;. Any custom controls will have their own prefix that you specify by registering the library on the page. It&#8217;s another line of code that you add to the top of the page next to your page definition. It should look something like this:</p>
<p>&lt;%@ Register Assembly=&#8221;Karpach.WebControls&#8221; Namespace=&#8221;Karpach.WebControls&#8221; TagPrefix=&#8221;cc1&#8243; %&gt;</p>
<p><strong>(3) Add the control to your page</strong></p>
<p>Now that you have the library referenced, you can add the control to your page and make use of it.  For the purpose of this demo, I&#8217;m going to set the AutoPostBack property to true and run a function whenever the color is changed. This will show us the color that we picked inside of a label (also shown below) after we select a new color.</p>
<p>&lt;cc1:ColorPicker ID=&#8221;colorBackgroundColor&#8221; runat=&#8221;server&#8221; AutoPostBack=&#8221;true&#8221; OnColorChanged=&#8221;chngColor&#8221; /&gt;<br />
&lt;br /&gt;&lt;br /&gt;<br />
&lt;asp:Label ID=&#8221;lblResults&#8221; runat=&#8221;server&#8221; Text=&#8221;"&gt;&lt;/asp:Label&gt;</p>
<p><strong>(4) Create Your C# Function</strong></p>
<p>After we choose a color, we have to do something with it. With the ColorPicker control above, I&#8217;m using the OnColorChanged property to call the &#8220;chngColor&#8221; function, which in C# will look something like this. This will also demonstrate how to programmatically read the color chosen with the .Color property of the ASP.NET Color Picker Control</p>
<p>protected void chngColor(object sender, EventArgs e)<br />
{<br />
lblResults.Text = &#8220;&lt;div style=&#8217;background-color:#&#8221; + colorBackgroundColor.Color.Replace(&#8220;#&#8221;, &#8220;&#8221;) + &#8220;;height:50px;width:80px;text-align:center;padding-top:35px;&#8217;&gt;Sample Text&lt;/div&gt;&#8221;;<br />
}</p>
<p><strong>(5) Success</strong></p>
<p>So far, we&#8217;ve added the library to our project, registered the library on the page, added the control to the page, and done something with the color chosen by the user. Your page should look something like this:</p>
<p><a href="http://www.adventuresindevelopment.com/wp-content/uploads/2009/06/color-picker.jpg"><img class="alignnone size-full wp-image-140" title="color-picker" src="http://www.adventuresindevelopment.com/wp-content/uploads/2009/06/color-picker.jpg" alt="color-picker" width="567" height="398" /></a></p>
<p><a href="http://www.adventuresindevelopment.com/wp-content/uploads/2009/06/colorpickerdemo.zip">You can download my sample program here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adventuresindevelopment.com/2009/06/12/how-to-implement-an-aspnet-color-picker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create a Sortable HTML Table with JQuery and TableSorter</title>
		<link>http://www.adventuresindevelopment.com/2009/06/05/create-a-sortable-html-table-with-jquery-and-tablesorter/</link>
		<comments>http://www.adventuresindevelopment.com/2009/06/05/create-a-sortable-html-table-with-jquery-and-tablesorter/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 15:29:19 +0000</pubDate>
		<dc:creator>Matthew Paulson</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adventuresindevelopment.com/?p=133</guid>
		<description><![CDATA[One of the more useful features of ASP.NET&#8217;s GridView control is that users can sort the information in the table they are seeing by any number of fields. To allow this sorting to happen, ASP.NET sends a post-back to the server and the web server re-renders the page with the GridView re-sorted in the order [...]]]></description>
			<content:encoded><![CDATA[<p>One of the more useful features of <a href="http://msdn.microsoft.com/en-us/library/aa479339.aspx">ASP.NET&#8217;s GridView control</a> is that users can sort the information in the table they are seeing by any number of fields. To allow this sorting to happen, ASP.NET sends a post-back to the server and the web server re-renders the page with the GridView re-sorted in the order requested. Now, there&#8217;s a way to display a table that can be sorted by any number of fields using only JavaScript. There&#8217;s no communication back and forth with the web-server wasting bandwidth and processing power on the web-server.</p>
<p>The JQuery library that allows this to happen is called <a href="http://tablesorter.com/docs/">Tablesorter</a>. Tablesorter has a ton of very useful features, including having a very small code base, the ability to sort across multiple columns and is compatible with just about every web-browser that&#8217;s currently being used, even IE 6. It has sort parsers for a number of types of formats, including text, URIs, integers, currency, floats, IP addresses and dates, so whatever type of data you have in the table, chances are it will be able to intelligently sort it.</p>
<p><span style="text-decoration: underline;"><strong>Here&#8217;s how to create a sortable table with TableSorter and JQuery</strong></span></p>
<p><strong>(1) Get the required libraries and reference them.</strong></p>
<p>You&#8217;ll want to download the minfiied version of Tablesorter from the Tablesorter website. The slimmed-down version comes in at 12 KB. You can download that <a href="http://tablesorter.com/jquery.tablesorter.min.js">here</a>. You&#8217;ll also want to get a copy of the latest version of JQuery which is available form the <a href="http://www.jquery.com/">JQuery Website</a>. Once you get those two files downloaded, you&#8217;ll want to add references to them in your page&#8217;s &lt;HEAD&gt;. They should look something like this depending on where you placed your files:</p>
<p>&lt;script src=&#8221;jquery.tablesorter.min.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;jquery-1.3.2.min.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;</p>
<p><strong>(2) Make an HTML Table</strong></p>
<p>Here&#8217;s a demonstration table that the Tablesorter website provides for us to use. Simply add this to the body of your page:</p>
<pre class="html"><span class="tag">&lt;table</span><span class="aname"> id</span>=<span class="avalue">"myTable"</span><span class="tag">&gt;</span>
<span class="tag">&lt;thead</span><span class="tag">&gt;</span>
<span class="tag">&lt;tr</span><span class="tag">&gt;</span>
    <span class="tag">&lt;th</span><span class="tag">&gt;</span>Last Name<span class="tag">&lt;/th&gt;</span>
    <span class="tag">&lt;th</span><span class="tag">&gt;</span>First Name<span class="tag">&lt;/th&gt;</span>
    <span class="tag">&lt;th</span><span class="tag">&gt;</span>Email<span class="tag">&lt;/th&gt;</span>
    <span class="tag">&lt;th</span><span class="tag">&gt;</span>Due<span class="tag">&lt;/th&gt;</span>
    <span class="tag">&lt;th</span><span class="tag">&gt;</span>Web Site<span class="tag">&lt;/th&gt;</span>
<span class="tag">&lt;/tr&gt;</span>
<span class="tag">&lt;/thead&gt;</span>
<span class="tag">&lt;tbody</span><span class="tag">&gt;</span>
<span class="tag">&lt;tr</span><span class="tag">&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>Smith<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>John<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>jsmith@gmail.com<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>$50.00<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>http://www.jsmith.com<span class="tag">&lt;/td&gt;</span>
<span class="tag">&lt;/tr&gt;</span>
<span class="tag">&lt;tr</span><span class="tag">&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>Bach<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>Frank<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>fbach@yahoo.com<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>$50.00<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>http://www.frank.com<span class="tag">&lt;/td&gt;</span>
<span class="tag">&lt;/tr&gt;</span>
<span class="tag">&lt;tr</span><span class="tag">&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>Doe<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>Jason<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>jdoe@hotmail.com<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>$100.00<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>http://www.jdoe.com<span class="tag">&lt;/td&gt;</span>
<span class="tag">&lt;/tr&gt;</span>
<span class="tag">&lt;tr</span><span class="tag">&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>Conway<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>Tim<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>tconway@earthlink.net<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>$50.00<span class="tag">&lt;/td&gt;</span>
    <span class="tag">&lt;td</span><span class="tag">&gt;</span>http://www.timconway.com<span class="tag">&lt;/td&gt;</span>
<span class="tag">&lt;/tr&gt;</span>
<span class="tag">&lt;/tbody&gt;</span>
<span class="tag">&lt;/table&gt;</span></pre>
<p><strong>(3) Sort Your Table</strong></p>
<p>The only thing left to do to make our quick and dirty demo of the table sorter to work is to call the sorting library using the document.ready() function that&#8217;s frequently used with JQuery. That will look something like this:</p>
<p>&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221;&gt;</p>
<p>$(document).ready(function()<br />
{<br />
$(&#8220;#myTable&#8221;).tablesorter();<br />
}<br />
);</p>
<p>&lt;/script&gt;</p>
<p><strong>(4) Further Development</strong></p>
<p>The next logical step is to add some CSS formatting that will give the user a better idea of which sort direction they&#8217;re doing. You can see a demo of how to style the different sort directions on the <a href="http://tablesorter.com/docs/#Configuration">Tablesorter website</a>, which would be a must on any production site. You might also want to play around with doing multi-column sorts and with their widget system.</p>
<p><a href="http://www.adventuresindevelopment.com/wp-content/uploads/2009/06/tablesorterdemo.zip">Click here to download my example code (24 KB)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adventuresindevelopment.com/2009/06/05/create-a-sortable-html-table-with-jquery-and-tablesorter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery Date Picker: One Step Torwards Making Forms That Work</title>
		<link>http://www.adventuresindevelopment.com/2009/05/28/jquery-date-picker-one-step-torwards-making-forms-that-work/</link>
		<comments>http://www.adventuresindevelopment.com/2009/05/28/jquery-date-picker-one-step-torwards-making-forms-that-work/#comments</comments>
		<pubDate>Thu, 28 May 2009 13:37:00 +0000</pubDate>
		<dc:creator>Matthew Paulson</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adventuresindevelopment.com/?p=110</guid>
		<description><![CDATA[While attending Microsoft Mix earlier this spring, I stumbled upon a book called &#8220;Making Forms That Work&#8220;, which was written by Caroline Jarrett and Gerry Gaffney. The book focused on building web-forms that aren&#8217;t intimidating and that people will actually fill out. One of the focuses was making sure to use the right controls for [...]]]></description>
			<content:encoded><![CDATA[<p>While attending Microsoft Mix earlier this spring, I stumbled upon a book called &#8220;<a href="http://www.amazon.com/Forms-that-Work-Interactive-Technologies/dp/1558607102">Making Forms That Work</a>&#8220;, which was written by Caroline Jarrett and Gerry Gaffney. The book focused on building web-forms that aren&#8217;t intimidating and that people will actually fill out. One of the focuses was making sure to use the right controls for the right question you have for your user. You certainly don&#8217;t want a drop down list of 1000 names to have the user pickout their name, and you definitely don&#8217;t want to give them a text-box to type in their gender.</p>
<p>On that same line of reasoning, it&#8217;s probably not a good idea to have users manually type in dates. Considering all of the formats possible for entering a date, say &#8220;5/28/2009&#8243;, &#8220;5/28/09&#8243;, &#8220;Thursday, May 28th, 2009&#8243;, &#8220;May 28 09&#8243;, etc, you would need quite the number of regular expressions to determine if what the user entered in actually was a date. One solution to this is to draw a small calendar on the page and have the user click which date they want, but those often take up a lot of screen real estate.</p>
<p>Instead,  I usually recommend some sort of pop-up date picker. For ASP.NET, I&#8217;ll typically use the <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Calendar/Calendar.aspx">AJAX Control Toolkit Date Picker</a>. For other situations, I&#8221;ll make use of <a href="http://www.kelvinluck.com/assets/jquery/datePicker/">Kevin Luck&#8217;s JQuery DatePicker</a>. For more advanced date picking, you might also look into the  <a href="http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/">JQuery Date Range Picker</a>.</p>
<p><a href="http://www.adventuresindevelopment.com/wp-content/uploads/2009/05/calendar-extender.jpg"><img class="alignnone size-full wp-image-111" title="calendar-extender" src="http://www.adventuresindevelopment.com/wp-content/uploads/2009/05/calendar-extender.jpg" alt="calendar-extender" width="511" height="247" /></a></p>
<p><span style="text-decoration: underline;"><strong>For today&#8217;s project, we&#8217;ll make a basic implementation of Luck&#8217;s JQuery Date Picker.  Here&#8217;s </strong><strong>how to get started:</strong></span></p>
<p><strong>(1) Download the libraries</strong></p>
<p>For this project, we&#8217;re actually going to need a couple different libraries. We&#8217;ll need the <a href="http://www.jquery.org/">JQuery</a> library it self. You&#8217;ll also need the <a href="http://jqueryjs.googlecode.com/svn/trunk/plugins/methods/date.js">date methods extension</a> for JQuery. After we have those two helper-libraries in place, we can download the <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.datePicker.js">JQuery Date Picker library it self</a> and the <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/styles/datePicker.css">associated CSS file</a>.</p>
<p><strong>(2) Create header references</strong></p>
<p>Now that we&#8217;ve got all of the libraries, we need to add some references in the header that should (for the most part, depending on where you put the files) look like this:</p>
<p>&lt;script src=&#8221;jquery-1.3.2.min.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;date.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;jquery.datePicker.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
&lt;link href=&#8221;datePicker.css&#8221; rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; /&gt;</p>
<p><strong>(3) Create an input field for your datepicker</strong></p>
<p>With the datepicker, you&#8217;ll actually click the textbox itself or an associated image, and that will load the javascript popup that lets you pick out a date, and then the date picker will fill the value you choose into that textbox. Add an input tag to your page. Make sure to give it a class of &#8220;date-pick&#8221;.</p>
<pre id="line46">&lt;<span class="start-tag">input</span><span class="attribute-name"> name</span>=<span class="attribute-value">"date1" </span><span class="attribute-name">id</span>=<span class="attribute-value">"date1" </span><span class="attribute-name">class</span>=<span class="attribute-value">"date-pick" </span><span class="error"><span class="attribute-name">/</span></span>&gt;</pre>
<p><strong>(3) Call the date picker script</strong></p>
<p>Somewhere in the header, we&#8217;ll need to call the date picker script so that it loads when the page does.  That code should look like this:</p>
<p>&lt;script type=&#8221;text/javascript&#8221; charset=&#8221;utf-8&#8243;&gt;<br />
$(function()<br />
{<br />
$(&#8216;.date-pick&#8217;).datePicker();<br />
});<br />
&lt;/script&gt;</p>
<p><strong>(4) You&#8217;re done</strong></p>
<p>At this point, you should have something that looks like this (after you click on the &#8220;Choose Date&#8221; text):</p>
<p><a href="http://www.adventuresindevelopment.com/wp-content/uploads/2009/05/date-picker.jpg"><img class="alignnone size-full wp-image-112" title="date-picker" src="http://www.adventuresindevelopment.com/wp-content/uploads/2009/05/date-picker.jpg" alt="date-picker" width="341" height="171" /></a></p>
<p>Right now, it&#8217;s pretty ugly. The neat little calendar icon won&#8217;t be there, but <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePicker.html">you can add that by modifying the css</a>.You&#8217;ll probably also want to modify the color scheme to match the theme of your site. You can download <a href="http://www.adventuresindevelopment.com/wp-content/uploads/2009/05/date-pick-min.zip">my quick and dirty example code here (36 KB)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adventuresindevelopment.com/2009/05/28/jquery-date-picker-one-step-torwards-making-forms-that-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make an AJAX-like Multiple File Uploader with Uploadify</title>
		<link>http://www.adventuresindevelopment.com/2009/05/20/make-an-ajax-like-multiple-file-uploader-with-uploadify/</link>
		<comments>http://www.adventuresindevelopment.com/2009/05/20/make-an-ajax-like-multiple-file-uploader-with-uploadify/#comments</comments>
		<pubDate>Wed, 20 May 2009 18:40:41 +0000</pubDate>
		<dc:creator>Matthew Paulson</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adventuresindevelopment.com/?p=68</guid>
		<description><![CDATA[I&#8217;m currently working on an file manager that will be integrated with the content management system software that we developed. In doing this, I&#8217;ve been looking for a solution that would allow users to upload multiple files at once, does so in a very easy to use way and shows a progress bar. For this [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently working on an file manager that will be integrated with the content management system software that we developed. In doing this, I&#8217;ve been looking for a solution that would allow users to upload multiple files at once, does so in a very easy to use way and shows a progress bar. For this project, I don&#8217;t really need to interact with ASP.NET at all for a database, so I can look at some of the JavaScript &amp; Flash solutions that are out there. The solution that I eventually settled on was <a href="http://www.uploadify.com/">Uploadify</a>. The tool is actually a combination of Flash and JQuery. It&#8217;s very customizable in the functionality that it offers as well as the design of the system.</p>
<p>I was at first concerned because the solution only supports PHP, however members of the Uploadify development community have developed a replacement server-sidescript that will replace the &#8220;upload.php&#8221; file with a .NET version. You can find <a href="http://www.uploadify.com/forum/viewtopic.php?f=5&amp;t=45">that code on their forums here</a>.</p>
<p><strong>Here&#8217;s what Uploadify looks like in action:</strong></p>
<p><a href="http://www.adventuresindevelopment.com/wp-content/uploads/2009/05/uploadify-example.jpg"><img class="alignnone size-full wp-image-69" title="uploadify-example" src="http://www.adventuresindevelopment.com/wp-content/uploads/2009/05/uploadify-example.jpg" alt="uploadify-example" width="364" height="312" /></a></p>
<p><strong><span style="text-decoration: underline;">Implementing Uploadify</span></strong></p>
<p><strong>Getting Started:</strong></p>
<p>So how do we implement Uploadify? It&#8217;s actually easier than many JQuery modules that are out there. The first thing you&#8217;ll need is the Uploadify Core <a href="http://www.uploadify.com/">that can be downloaded from the Uploadify website</a>. You can also download code for several examples of implementations of code. The core it self comes with a PDF manual as well.</p>
<p><strong>Script References:</strong></p>
<p>You&#8217;ll need to reference the latest version of the JQuery Core was well as the Uploadify JavaScript file:</p>
<p><code>&lt;link rel="stylesheet" href="uploadify/uploadify.css" type="text/css" /&gt;<br />
&lt;script type="text/javascript" src="js/jquery-1.3.2.min.js"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript" src="js/jquery.uploadify.js"&gt;&lt;/script&gt;<br />
</code><br />
<strong>Making a Placeholder:</strong></p>
<p>You&#8217;ll need a placeholder DIV that the script can use to draw the upload tool on the page somewhere in the &lt;BODY&gt; tag:</p>
<p><code>&lt;div id="fileUpload1"&gt;&lt;/div&gt;</code></p>
<p><strong>Calling the Script:</strong></p>
<p>Now, all we need to do is call the uploader when the page loads:</p>
<p><code>&lt;script type="text/javascript"&gt;<br />
$(document).ready(function() {<br />
 $("#fileUpload1").fileUpload({<br />
  'uploader': 'uploadify/uploader.swf',<br />
  'cancelImg': 'uploadify/cancel.png',<br />
  'script': 'uploadify/upload.php',<br />
  'folder': 'files',<br />
  'multi': true,<br />
  'buttonText': 'Select Files',<br />
  'checkScript': 'uploadify/check.php',<br />
  'displayData': 'speed',<br />
  'simUploadLimit': 2<br />
 });<br />
});<br />
&lt;/script&gt;<br />
</code><br />
That&#8217;s all it really takes to implement Uploadify. You might want to modify some of the settings in it to customize the uploader to your needs, but it&#8217;s a really great solution.</p>
<p><strong>Here are some common options that you can play with in the settings:</strong></p>
<ul>
<li>&#8220;CheckScript&#8221; and &#8220;Script&#8221;  -&gt; Be sure to change these if you are using the .NET solution</li>
<li>sizeLimit -&gt; Limit the file size of the upload (in bytes)</li>
<li>Height &amp; Width -&gt; Change the dimensions of the container DIV</li>
<li>fileExt -&gt; Limit the type of file extensions that you allow.</li>
<li>ButtonText &amp; ButtonIMG -&gt; Customize the look of the upload button</li>
<li><a href="http://www.uploadify.com/documentation/">There&#8217;s a full list in the Uploadify Website</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.adventuresindevelopment.com/2009/05/20/make-an-ajax-like-multiple-file-uploader-with-uploadify/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Using System.IO to Create, Read, Rename and Delete Files and Folders in C# and Visual Basic</title>
		<link>http://www.adventuresindevelopment.com/2009/05/18/using-systemio-to-create-read-rename-and-delete-files-and-folders-in-c-and-visual-basic/</link>
		<comments>http://www.adventuresindevelopment.com/2009/05/18/using-systemio-to-create-read-rename-and-delete-files-and-folders-in-c-and-visual-basic/#comments</comments>
		<pubDate>Tue, 19 May 2009 00:19:45 +0000</pubDate>
		<dc:creator>Matthew Paulson</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.adventuresindevelopment.com/?p=49</guid>
		<description><![CDATA[If you&#8217;re making use of C# or Visual Basic for Windows Forms, ASP.NET Web Forms or ASP.NET MVC, you have access to a very powerful file-system access library that&#8217;s included with Visual Studio. The library, System.IO, will allow you to create, rename, edit and delete files and folders on your system. If you are using [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re making use of C# or Visual Basic for Windows Forms, ASP.NET Web Forms or ASP.NET MVC, you have access to a very powerful file-system access library that&#8217;s included with Visual Studio. The library, System.IO, will allow you to create, rename, edit and delete files and folders on your system. If you are using System.IO in ASP.NET, you will be able to access the file system on the web-server assuming that <a href="http://msdn.microsoft.com/en-us/library/ms998320.aspx">appropriate permissions are set with the Network Service account</a>. For the purposes of this article, all of the code will be in C#, but rest assured, the same functionality is available in Visual Basic, but the syntax might be slightly different.</p>
<p><strong>To get started with the library, add a reference to the System.IO library at the top of your file</strong></p>
<p><code>Using System.IO;</code></p>
<p><span style="text-decoration: underline;"><strong>Here&#8217;s how to manipulate folders/directories using the System.IO Library:</strong></span></p>
<p><strong>Delete a folder:</strong></p>
<p>Directory.Delete(&#8220;c:\\directory\\subdirectory\\&#8221;); //standard delete</p>
<p>Directory.Delete(&#8220;c:\\directory\\subdirectory\\&#8221;, true); //delete folder and all subdirectories</p>
<p><strong>Create a folder:</strong></p>
<p>Directory.CreateDirectory(&#8220;c:\\directory\\subdirectory\\&#8221;)</p>
<p><strong>Check if a folder exists:</strong></p>
<p>Directory.Exists(&#8220;c:\\directory\\subdirectory\\&#8221;); //returns boolean value</p>
<p><strong>Move/Rename a </strong><strong>folder</strong><strong>:</strong></p>
<p>Directory.Move(&#8220;c:\\directory\\oldlocation\\&#8221;, &#8220;c:\\directory\\newlocation\\&#8221;);</p>
<p><strong>Get a list of files in a </strong><strong>folder</strong><strong>:</strong></p>
<p>Directory.GetFiles(&#8220;c:\\directory\\subfolder\\&#8221;); // returns a string array of files in the folder</p>
<p><span style="text-decoration: underline;"><strong>Here&#8217;s how to manipulate files using the System.IO Library:</strong></span></p>
<p><strong>Delete a file:</strong></p>
<p>File.Delete(&#8220;c:\\directory\\filename.text&#8221;);</p>
<p><strong>Create a file:</strong></p>
<p>File.Create(&#8220;c:\\directory\\filename.text&#8221;); //note, the file will be empty. There are some overloads available that will let you create a file with content in it</p>
<p><strong>Check if a file exists:<br />
</strong></p>
<p>File.Exists(&#8220;c:\\directory\\subdirectory\\filename.text&#8221;); //returns boolean value</p>
<p><strong>Move/Rename a file:</strong></p>
<p>File.Move(&#8220;c:\\directory\\filename.text&#8221;, &#8220;c:\\directory\\filenamenew.text&#8221;);</p>
<p><strong>Create a copy of a file:</strong></p>
<p>File.Copy(&#8220;c:\\directory\\filename.text&#8221;, &#8220;c:\\directory\\filenamenew.text&#8221;);</p>
<p><strong>Read text from file:</strong></p>
<p>string FileContents = File.ReadAllText(&#8220;c:\\folder\\filename.text&#8221;);</p>
<p><strong>Write text to a file:</strong></p>
<p>File.WriteAllText(&#8220;c:\\filename.text&#8221;, &#8220;contents of file&#8221;);</p>
<p><span style="text-decoration: underline;"><strong>Tips for Using System.IO in ASP.NET</strong></span></p>
<p><strong>Using Server.MapPath to Convert Relative URLS to Physical File Paths</strong></p>
<p>Remember that the System.IO library always requires that you input a physical file path on the web server&#8217;s hard drive. Passing in a file or directory relative to the root of the web server will not work. IE, File.Exists(&#8220;/images/file.jpg&#8221;) will result in an exception. Fortunately, Microsoft has recognized that this would be an issue ahead of time and has given us the &#8220;Server.MapPath&#8221; function which will convert relative URLs on the server into physical file paths.</p>
<p>Here&#8217;s an example of Server.MapPath in action:</p>
<p><code>string RelativeURL = "/media/files/mypicture.jpg";<br />
string AbsolutePath = Server.MapPath(RelativeURL);<br />
bool FileExists = File.Exists(AbsolutePath);<br />
</code></p>
<p><strong>Setting File and Directory Permissions in IIS for ASP.NET<br />
</strong></p>
<p>If you plan on doing any sort of uploading files, modifying files, deleting files, modifying folders or deleting folders from your web-server, you are going to have to assign additional permissions on the server. To do this, you will need to make modifications to the appropriate folders that you want to be able to modify in IIS or have your web host do it for you. Essentially, you need to give the &#8220;network service&#8221; account permissions to do anything that you want ASP.NET to be able to do. If you want to be able to delete files, give the Network Service account permissions to delete files in the appropriate folder.</p>
<p>In the next couple of weeks, I&#8217;m hoping to create a C#/ASP.NET based file-manager. It&#8217;s very likely that we&#8217;ll be using a lot of these methods for this project. If there are any features you&#8217;d like to see developed in it, don&#8217;t hesitate to <a href="http://www.adventuresindevelopment.com/contact/">contact me</a>.</p>
<p><strong>Update &#8211; Mar 18 @ 9:00 PM </strong>- When I wrote the above commands, I initially neglected to use <a href="http://msdn.microsoft.com/en-us/library/h21280bw.aspx">escape sequences</a> for the file names. Remember to always use a double back-slash or start your string with the @ symbol for your physical file paths to work properly. I&#8217;ve updated the commands to reflect the correct way to reference directories.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adventuresindevelopment.com/2009/05/18/using-systemio-to-create-read-rename-and-delete-files-and-folders-in-c-and-visual-basic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Safely Display Your Email Address Online Without Getting Spammed</title>
		<link>http://www.adventuresindevelopment.com/2009/05/15/how-to-safely-display-your-email-address-online-without-getting-spammed/</link>
		<comments>http://www.adventuresindevelopment.com/2009/05/15/how-to-safely-display-your-email-address-online-without-getting-spammed/#comments</comments>
		<pubDate>Fri, 15 May 2009 12:30:29 +0000</pubDate>
		<dc:creator>Matthew Paulson</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adventuresindevelopment.com/?p=15</guid>
		<description><![CDATA[If you have a website or blog, one of your motivating factors is that you&#8217;d like to promote yourself, your services or your ideas. Typically most bloggers don&#8217;t want to be writing anonymously and would like to provider their readership an easy way to contact them. Unfortunately, it&#8217;s a really bad idea to let your [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a website or blog, one of your motivating factors is that you&#8217;d like to promote yourself, your services or your ideas. Typically most bloggers don&#8217;t want to be writing anonymously and would like to provider their readership an easy way to contact them.</p>
<p>Unfortunately, it&#8217;s a really bad idea to let your email address set publicly on your website. There are all sorts of bots crawling across the web that download pages and use <a href="http://en.wikipedia.org/wiki/Regular_expression">regular expressions</a> to identify and collect email addresses that are sitting in plain-text on a website. If you do this, chances are you will soon be on the receiving end of a lot of unwanted spam.</p>
<p>Fortunately, there are several ways that you can allow people to contact you without displaying your email address in a way that would expose you to these types of spam-bots. An easy way would be to create an image with the text of your email address on it (that&#8217;s what Facebook does). 15 Days of JQuery suggests <a href="http://15daysofjquery.com/safer-mailto-links/8/">using AJAX to safely display your address</a>. Some people don&#8217;t display their real address and just leave a contact form to allow people to send the messages. If you don&#8217;t protect your contact form, you&#8217;ll be on the receiving end of another type of spam. Some people obfuscate their email addresses on their sites so that spam-bots cannot read them, such as using name &lt;at&gt; example &lt;dot&gt; org instead of name@example.org.</p>
<p>All of these solutions have their pluses and minuses, but there&#8217;s a really simple solution that I&#8217;d suggest to you which will give the appearance of displaying your address in plain-text without exposing your email address to bots that harvest email addresses from the web. Since these types of bots generally cannot process JavaScript, using a simple JavaScript method to generate the text of your address should suffice to prevent the harvesting of your email address.</p>
<p><strong>Here&#8217;s an example of how to do it:</strong></p>
<p>&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221;&gt;<br />
var1 = &#8220;ple.org&#8221;; var2 = &#8220;na&#8221;; var3 = &#8220;me@exam&#8221;;<br />
document.write(var2 + var3 + var1);<br />
&lt;/script&gt;</p>
<p><em>This will display as &#8220;name@example.org&#8221; after being processed by JavaScript&#8217;s interpreter.</em></p>
<p>How do you protect your email address from getting spammed online? Let me know in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adventuresindevelopment.com/2009/05/15/how-to-safely-display-your-email-address-online-without-getting-spammed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Simple Image Rotator with JQuery</title>
		<link>http://www.adventuresindevelopment.com/2009/05/14/building-a-simple-image-rotator-with-jquery/</link>
		<comments>http://www.adventuresindevelopment.com/2009/05/14/building-a-simple-image-rotator-with-jquery/#comments</comments>
		<pubDate>Fri, 15 May 2009 03:21:17 +0000</pubDate>
		<dc:creator>Matthew Paulson</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.adventuresindevelopment.com/?p=11</guid>
		<description><![CDATA[I was recently working on a new website for an adult fellowship group at my church and one of the tasks I had was to create an image rotator that had various bible verses on it that would transition every few seconds. Since the site was Joomla-based, I initially searched for a free plugin that [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently working on a new website for an adult fellowship group at my church and one of the tasks I had was to create an image rotator that had various bible verses on it that would transition every few seconds. Since the site was Joomla-based, I initially searched for a free plugin that would do the trick. I did find one that would do the trick (<a href="http://www.joomlashack.com/extensions/170-flash-rotator-module-version-25-unbranded">Flash Rotator Module</a> by JoomlaShack), but it was $19.95. I decided I would keep looking and find a free solution.</p>
<p>Eventually I stumbled upon <a href="http://www.malsup.com/jquery/cycle/">JQuery Cycle</a>. It&#8217;s a free JQuery tool that lets you do an image rotator with a lot of unique transitions. I opted for a basic &#8220;fade&#8221;, since that&#8217;s what the previous version of the site was using. There&#8217;s also shuffle, zoom, rotation, and scrolling effects. You can see the results of these efforts on <a href="http://www.sfcontext.com/">http://www.sfcontext.com</a>/</p>
<p><span style="text-decoration: underline;"><strong>Here are the steps to recreate a basic image-slideshow using JQuery Cycle:</strong></span></p>
<p><strong>(1) Reference the JQuery Library and the JQuery Cycle Libraries in your &lt;HEAD&gt;.</strong></p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;jquery-1.3.2.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;jquery.cycle.all.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;</p>
<p><em>(You&#8217;ll need the <a href="http://docs.jquery.com/Downloading_jQuery">JQuery library</a> as well as the <a href="http://malsup.com/jquery/cycle/download.html">JQuery Cycle library</a> on your web-server, make sure to update your references)</em></p>
<p><strong>(2) Make a DIV with your images in it where you want the rotator to appear on your page:</strong></p>
<p>&lt;div class=&#8221;pics&#8221;&gt;<br />
&lt;img src=&#8221;/media/banners/1.jpg&#8221; width=&#8221;597&#8243; height=&#8221;175&#8243; /&gt;<br />
&lt;img src=&#8221;/media/banners/2.jpg&#8221; width=&#8221;597&#8243; height=&#8221;175&#8243; /&gt;<br />
&lt;img src=&#8221;/media/banners/3.jpg&#8221; width=&#8221;597&#8243; height=&#8221;175&#8243; /&gt;<br />
&lt;img src=&#8221;/media/banners/4.jpg&#8221; width=&#8221;597&#8243; height=&#8221;175&#8243; /&gt;<br />
&lt;/div&gt;</p>
<p><em>Feel free to use as many images as you want in this. You can also change the height and the width, but it&#8217;s probably a good idea that they all have the same height and width. You can also use &#8220;ALT&#8221; and &#8220;TITLE&#8221; tags since they&#8217;re plane-jane HTML image objects.</em></p>
<p><strong>(3) Use a $document.ready() function to load the JQuery Cycle rotator effects</strong></p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
$(document).ready(function() {<br />
$(&#8216;.pics&#8217;).cycle({<br />
fx:    &#8216;fade&#8217;,<br />
speed:  5000<br />
});<br />
});<br />
&lt;/script&gt;</p>
<p><em>make sure that the class of the DIV lines up with the class being referenced in the $document.ready() function. You can also replace the &#8220;fade&#8221; fx with </em>a <a href="http://http://malsup.com/jquery/cycle/download.html">number of other transitions</a> and change the speed as you desire. The &#8220;5000&#8243; represents 5000 miliseconds or 5 seconds.</p>
<p>Overall, I&#8217;m very impressed with JQuery Cycle as an image-rotator solution. The library it self is only 28KB when it&#8217;s compressed, and if you don&#8217;t include all of the transitions, you can shave a few kilobytes off that number.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adventuresindevelopment.com/2009/05/14/building-a-simple-image-rotator-with-jquery/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
