<?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>Marc Mezzacca&#039;s Notebook</title>
	<atom:link href="http://blog.marcmezzacca.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.marcmezzacca.com</link>
	<description>An entrepreneur&#039;s notes on programming, going green and other ramblings...</description>
	<lastBuildDate>Fri, 15 Jul 2011 16:46:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JavaScript / jQuery Clipboard and Flash Detection Plugins</title>
		<link>http://blog.marcmezzacca.com/2011/07/javascript-jquery-clipboard-and-flash-detection-plugins/</link>
		<comments>http://blog.marcmezzacca.com/2011/07/javascript-jquery-clipboard-and-flash-detection-plugins/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 16:46:13 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash detection]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/07/javascript-jquery-clipboard-and-flash-detection-plugins/</guid>
		<description><![CDATA[Listed below are some of my recent findings for the best JavaScript Clipboard and Flash Detection scripts for web developers.
Clipboard Plugins
Developers can provide end-users the ability to copy text to their clipboard (eg. mimic Ctrl+C action).
ZeroClipboard     This is the most active clipboard project available.&#160; Most robust, lots of options and active [...]]]></description>
			<content:encoded><![CDATA[<p>Listed below are some of my recent findings for the best JavaScript Clipboard and Flash Detection scripts for web developers.</p>
<h3>Clipboard Plugins</h3>
<p>Developers can provide end-users the ability to copy text to their clipboard (eg. mimic Ctrl+C action).</p>
<p><strong>ZeroClipboard</strong>     <br />This is the most active clipboard project available.&#160; Most robust, lots of options and active community.     <br /><a href="http://code.google.com/p/zeroclipboard">http://code.google.com/p/zeroclipboard</a></p>
<p>Example of ZeroClipboard with multiple per page    <br /><a href="http://www.webmasterworld.com/javascript/3901742.htm">http://www.webmasterworld.com/javascript/3901742.htm</a></p>
<p><strong>zClip jQuery Plugin</strong>    <br />zClip Wraps the ZeroClipboard functionality into jQuery and is worth checking out for those using jQuery and seeking a quick clipboard implementation:    <br /><a title="http://www.steamdev.com/zclip/" href="http://www.steamdev.com/zclip/">http://www.steamdev.com/zclip/</a></p>
<p><strong>jQuery Clipboard      <br /></strong>Another (older) clipboard plugins for jQuery.&#160; These only work prior to the &quot;actionable-effect requirement&quot; in Adobe 10 and works completely differently. <em>*This won’t work with the latest Flash versions*</em>    <br /><a href="http://plugins.jquery.com/project/copy">http://plugins.jquery.com/project/copy</a>     <br /><a href="http://plugins.jquery.com/project/clipboard">http://plugins.jquery.com/project/clipboard</a></p>
<h3>Detecting Flash </h3>
<p>Easily identify if the end-user has Flash capabilities installed on their web browser.</p>
<p><strong>Flash Detect (JavaScript Flash Detection Library) </strong>    <br />Doesn’t seem to require a separate SWF file.&#160; Small and easy to implement.     <br /><a href="http://www.featureblend.com/javascript-flash-detection-library.html">http://www.featureblend.com/javascript-flash-detection-library.html</a></p>
<p><strong>SWFObject      <br /></strong>Another good options for Flash Detection that is very reliable.     <br /><a href="http://code.google.com/p/swfobject/wiki/whats_new">http://code.google.com/p/swfobject/wiki/whats_new</a>     </p>
<p>Some example code can be found here:     <br /><a href="http://stackoverflow.com/questions/159261/cross-browser-flash-detection-in-javascript">http://stackoverflow.com/questions/159261/cross-browser-flash-detection-in-javascript</a></p>
<p><strong>jQuery Flash Plugin </strong>    <br />Used for embedding Flash movies but also has detection.     <br /><a href="http://jquery.lukelutman.com/plugins/flash/">http://jquery.lukelutman.com/plugins/flash/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/07/javascript-jquery-clipboard-and-flash-detection-plugins/feed/</wfw:commentRss>
		<slash:comments>119</slash:comments>
		</item>
		<item>
		<title>Customized ShareThis Button using jQuery and the ShareThis API</title>
		<link>http://blog.marcmezzacca.com/2011/07/customized-sharethis-button-using-jquery-and-the-sharethis-api/</link>
		<comments>http://blog.marcmezzacca.com/2011/07/customized-sharethis-button-using-jquery-and-the-sharethis-api/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 19:43:02 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sharethis]]></category>
		<category><![CDATA[sharethis api]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/07/customized-sharethis-button-using-jquery-and-the-sharethis-api/</guid>
		<description><![CDATA[Using ShareThis and want to have a customized version of multiple share buttons on one page?&#160; The ShareThis API developer docs section would have you include a hefty piece of JavaScript wherever you wanted the ShareThis object to occur.&#160; That is not only messy, but not very practical.&#160; I was shocked I couldn’t find anyone [...]]]></description>
			<content:encoded><![CDATA[<p>Using ShareThis and want to have a customized version of multiple share buttons on one page?&#160; The <a href="http://sharethis.com/developers/api" target="_blank">ShareThis API developer docs</a> section would have you include a hefty piece of JavaScript wherever you wanted the ShareThis object to occur.&#160; That is not only messy, but not very practical.&#160; I was shocked I couldn’t find anyone that had posted a jQuery tidbit to fix this.&#160; I <a href="http://forums.sharethis.com/topic.php?id=2857" target="_blank">found one attempt</a> posted in their forums, but no final solution.&#160; The solution below is based on the previous finding and this <a href="http://forums.sharethis.com/topic.php?id=147" target="_blank">forum thread</a>.</p>
<p>Be sure to read the developer docs and include the correct ShareThis widget JS file with your publisher Id prior to this code [ something like <a title="http://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;style=default&amp;publisher=(pub-id)" href="http://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;style=default&amp;publisher=(pub-id">http://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;style=default&amp;publisher=(pub-id)</a> ]</p>
<p>What I’ve done is loop through any cases where the <em><strong>sharethis</strong> </em>class is present.&#160; Inside the link include all the necessary information in data-* attributes that we pull out using jQuery.</p>
<pre class="html">&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function () {
  SHARETHIS.onReady();
  $(&quot;a.sharethis&quot;).each(function (index) {
    var id = $(this).attr('data-id');
    var purl = '<a href="http://mydomain.com/posts/'">http://mydomain.com/posts/'</a> + id
    var ptitle = $(this).attr('data-title');
    var thisobj = SHARETHIS.addEntry({ title: ptitle, url: purl }, { button: false });
    thisobj.attachButton(document.getElementById(&quot;sharethis-&quot; + id));
  });
});
&lt;/script&gt;</pre>
<p>Example customized ShareThis Link</p>
<pre class="html">&lt;a class=&quot;sharethis&quot; data-id=&quot;(uniqueid)&quot; data-title=&quot;The Title of This Post&quot; id=&quot;sharethis-(uniqueid)&quot;&gt;Share&lt;/a&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/07/customized-sharethis-button-using-jquery-and-the-sharethis-api/feed/</wfw:commentRss>
		<slash:comments>69</slash:comments>
		</item>
		<item>
		<title>Best Tag Editor jQuery Plugin</title>
		<link>http://blog.marcmezzacca.com/2011/06/best-tag-editor-jquery-plugin/</link>
		<comments>http://blog.marcmezzacca.com/2011/06/best-tag-editor-jquery-plugin/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 20:33:42 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tag editor]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/06/best-tag-editor-jquery-plugin/</guid>
		<description><![CDATA[I searched around &#34;Googled around&#34; for a nice jQuery Tag editor, and it took me going through quite a few plugins before I found one that had everything I wanted… which included Autocomplete functionality using jQuery UI core. It looks nice, uses built-in Autocomplete, and has all the tag editor features.&#160; I must note that [...]]]></description>
			<content:encoded><![CDATA[<p>I <strike>searched around</strike> &quot;Googled around&quot; for a nice jQuery Tag editor, and it took me going through quite a few plugins before I found one that had everything I wanted… which included Autocomplete functionality using jQuery UI core. It looks nice, uses built-in Autocomplete, and has all the tag editor features.&#160; I must note that it works a little different then almost all other tag editor plugins I’ve seen in terms of work flow.&#160; It considers “remove from list” and “delete from list” two separate functions (<a href="https://github.com/webworka/Tagedit/issues/1#issuecomment-1265201" target="_blank">read this</a>).&#160; This can be very useful, or merely extra work, depending on your implementation on the back-end. Currently it is being actively <a href="https://github.com/webworka" target="_blank">developed</a> by Oliver Albrecht (aka @<a href="http://twitter.com/webworka" target="_blank">webworka</a>) and hopefully it stays in active development!&#160; </p>
<p><strong>jQuery Tagedit</strong>    <br />Demo: <a title="http://tagedit.webwork-albrecht.de&#13;&#10;" href="http://tagedit.webwork-albrecht.de">http://tagedit.webwork-albrecht.de</a>    <br />Code: <a title="https://github.com/webworka/Tagedit" href="https://github.com/webworka/Tagedit">https://github.com/webworka/Tagedit</a></p>
<p><a href="http://blog.marcmezzacca.com/wp-content/uploads/2011/06/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.marcmezzacca.com/wp-content/uploads/2011/06/image_thumb.png" width="406" height="98" /></a>     </p>
<p>I&#8217;m using it in the revamp for the <a href="http://couponfollow.com/" target="_blank">CouponFollow</a> website which I hope to push into private beta before the end of the month, and roll live shortly after.&#160; I&#8217;ll likely use this plugin in future projects as well.</p>
<p>Here are some others that I liked but didn&#8217;t make the final cut for this project.</p>
<p><strong>jQuery Tag It!     <br /></strong>Link: <a title="http://levycarneiro.com/projects/tag-it/example.html" href="http://levycarneiro.com/projects/tag-it/example.html">http://levycarneiro.com/projects/tag-it/example.html</a>    <br />Code: <a title="http://github.com/levycarneiro/tag-it" href="http://github.com/levycarneiro/tag-it">http://github.com/levycarneiro/tag-it</a>    <br /><em><u>My Notes:</u> Very simple, autocomplete using jQuery UI.&#160; Tagedit is based on this one.</em></p>
<p><strong>jQuery Tag Editor      <br /></strong>Link: <a href="http://blog.crazybeavers.se/wp-content/Demos/jquery.tag.editor/">http://blog.crazybeavers.se/wp-content/Demos/jquery.tag.editor/</a>    <br /><em><u>My Notes: </u>Good but no autoComplete. Some CSS overflow issues with large amount of tags. </em></p>
<p><strong>jQuery Tag Suggestion </strong>    <br />Link: <a href="http://remysharp.com/2007/12/28/jquery-tag-suggestion/">http://remysharp.com/2007/12/28/jquery-tag-suggestion/</a>    <br /><em><u>My Notes:</u>&#160; Good, simple.&#160; Slick auto-complete, but no spacing support.&#160; Older, not actively developed?</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/06/best-tag-editor-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 3 Routes &#8211; Allow Arbitrary Number of Slashes With Catch All</title>
		<link>http://blog.marcmezzacca.com/2011/04/asp-net-mvc-3-routes-allow-arbitrary-number-of-slashes-with-catch-all/</link>
		<comments>http://blog.marcmezzacca.com/2011/04/asp-net-mvc-3-routes-allow-arbitrary-number-of-slashes-with-catch-all/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 11:46:06 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[mvc3]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[routing]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/04/asp-net-mvc-3-routes-allow-arbitrary-number-of-slashes-with-catch-all/</guid>
		<description><![CDATA[I recently had issues where Google was seeing misspellings of a domain names as different websites themselves, and possibly as duplicate content.&#160; The domains were bound to the same web application in IIS and I wanted to fix this without editing the source of the web application itself.
I had a few options, one of which [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had issues where Google was seeing misspellings of a domain names as different websites themselves, and possibly as duplicate content.&#160; The domains were bound to the same web application in IIS and I wanted to fix this without editing the source of the web application itself.</p>
<p>I had a few options, one of which is to <a href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html" target="_blank">use Cantonal URLs</a>, but that would involve editing the web app to some degree.&#160; So before going that way, I wanted to start making permanent redirects to the correct website URL.&#160; The quickest approach I could think of was to create a global redirect as a new web application and reassign all the domain name bindings needed.&#160; So I created a simple MVC 3 Web Application called GlobalPermanentRedirect which effectively takes any page and redirects the path / query to domain specified in the appSettings. </p>
<p>The code is very simple, however I got stumped for a few minutes with Routing, as I forgot about the catch-all parameter using *.&#160; Here’s the code, it’s really only about three lines. </p>
<p>In the routing area (Global.ascx) register the route: </p>
<pre class="c-sharp" name="code">routes.MapRoute(
   &quot;Default&quot;, // Route name
   &quot;{*path}&quot;, // catch all urls
   new { controller = &quot;Redirect&quot;, action = &quot;Index&quot; } // Parameter defaults
);</pre>
<p>Create a controller called RedirectController.cs with the following line of code: </p>
<pre class="c-sharp" name="code">public ActionResult Index()
{
	return RedirectPermanent(ConfigurationManager.AppSettings[&quot;BaseUrl&quot;] + Request.Url.PathAndQuery.ToString());
}</pre>
<p>In web.Config under appSettings: </p>
<pre class="c-sharp" name="code">&lt;add value=&quot;http://www.yourmainsite.com&quot; key=&quot;BaseUrl&quot; /&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/04/asp-net-mvc-3-routes-allow-arbitrary-number-of-slashes-with-catch-all/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>Upgrade from ASP.NET MVC 1 to MVC 3</title>
		<link>http://blog.marcmezzacca.com/2011/03/upgrade-from-asp-net-mvc-1-to-mvc-3/</link>
		<comments>http://blog.marcmezzacca.com/2011/03/upgrade-from-asp-net-mvc-1-to-mvc-3/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 13:02:53 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[mvc2]]></category>
		<category><![CDATA[mvc3]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/03/upgrade-from-asp-net-mvc-1-to-mvc-3/</guid>
		<description><![CDATA[I came across the need to upgrade from MVC 1 to MVC 3, skipping MVC 2 altogether.&#160; Currently, it doesn’t seem like there are any formal directions coming from Microsoft.&#160; However, I found instructions mentioned in this StackOverflow question.
It appears, as of now, there is a two step process to migrate from MVC 1 to [...]]]></description>
			<content:encoded><![CDATA[<p>I came across the need to upgrade from MVC 1 to MVC 3, skipping MVC 2 altogether.&#160; Currently, it doesn’t seem like there are any formal directions coming from Microsoft.&#160; However, I found instructions mentioned in this <a href="http://stackoverflow.com/questions/5330500/is-it-possible-to-upgrade-an-mvc-1-project-to-mvc-3-and-use-the-razor-view-engine" target="_blank">StackOverflow question</a>.</p>
<p>It appears, as of now, there is a two step process to migrate from MVC 1 to MVC 3:    <br />1) Migrate from ASP.NET MVC 1 to MVC 2 (using <a href="http://weblogs.asp.net/leftslipper/archive/2010/03/10/migrating-asp-net-mvc-1-0-applications-to-asp-net-mvc-2-rtm.aspx" target="_blank">this tool</a>)     <br />2) Migrate from ASP.NET MVC 2 to MVC 3 (using <a href="http://aspnet.codeplex.com/releases/view/59008" target="_blank">this tool</a>)</p>
<p><strong>Things to be wary of…</strong></p>
<ul>
<li>ASP.NET MVC 3 Application Upgrade tool is not compatible with VS 2008 </li>
<li>It may compile, but <strong><em>jQuery version changes could still break your app on the client-side</em></strong> </li>
</ul>
<p>I haven&#8217;t tried it myself just yet.&#160; Based on what I’ve read, in theory, it should work, but there will likely be minor annoyances and issues to clean up.&#160; If it seems to work the first time, something is really wrong! <img src='http://blog.marcmezzacca.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I’ll post a follow-up once I give it a go.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/03/upgrade-from-asp-net-mvc-1-to-mvc-3/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>Using Data Annotations and Extensions with SubSonic 3.0</title>
		<link>http://blog.marcmezzacca.com/2011/03/using-data-annotations-and-extensions-with-subsonic-3-0/</link>
		<comments>http://blog.marcmezzacca.com/2011/03/using-data-annotations-and-extensions-with-subsonic-3-0/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 23:39:40 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[data annotation extensions]]></category>
		<category><![CDATA[data annotations]]></category>
		<category><![CDATA[subsonic]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/03/using-data-annotations-and-extensions-with-subsonic-3-0/</guid>
		<description><![CDATA[I was just about to search for a good Url regular expression to check input validation, when I remembered a recent blog post by @srkirkland mentioning Data Annotation Extensions (github).&#160; This extension package allows for additional common use data annotations, such as URL, Email, Credit Card, etc in any .NET 4.0 project. It has been [...]]]></description>
			<content:encoded><![CDATA[<p>I was just about to search for a good Url regular expression to check input validation, when I remembered a recent <a href="http://weblogs.asp.net/srkirkland/archive/2011/02/23/introducing-data-annotations-extensions.aspx" target="_blank">blog post</a> by <a href="http://twitter.com/srkirkland" rel="nofollow">@srkirkland</a> mentioning <a href="http://dataannotationsextensions.org/" target="_blank">Data Annotation Extensions</a> (<a href="https://github.com/srkirkland/DataAnnotationsExtensions" target="_blank">github</a>).&#160; This extension package allows for additional common use data annotations, such as URL, Email, Credit Card, etc in any .NET 4.0 project. It has been released as a NuGet package so you can easily implement it in your solution in just a click.</p>
<p>The catch was that I&#8217;m using SubSonic 3.0.&#160; I love SubSonic, but I couldn&#8217;t think of an easy way to implement Data Annotations in conjunction with it.&#160;&#160; So&#8230; I searched Stackoverflow like usual, and found a <a href="http://stackoverflow.com/questions/2321614/mvc-net-subsonic-auto-generate-metadata-classes-from-tt" target="_blank">couple good posts</a>.&#160; The short of it is to create an additional TT file that creates buddy classes. </p>
<p>Here is the walkthrough: <a title="http://subsonicproject.com/docs/User_talk:Minus4" href="http://subsonicproject.com/docs/User_talk:Minus4">http://subsonicproject.com/docs/User_talk:Minus4</a></p>
<p>Note that the MetaGenerator TT file referred to in the above post must be created manually by you and is not included with SubSonic by default.&#160; Actually you could call it whatever you like.&#160; The code is included in the posted link above.</p>
<p>In my MetaGenerator.TT (<a href="http://marcmezzacca.com/blog-files/MetaGenerator.tt.txt" target="_blank">download</a>) I added an extra line to the includes:</p>
<p>using DataAnnotationsExtensions;</p>
<p>Once saved, right click the file and select “Run Custom Tool” to generate the .cs (MetaGenerator.cs) file.&#160; Open that up and start adding your Data Annotations, and if you’ve so chosen, the Data Annotations Extensions as well.</p>
<p><a href="http://blog.marcmezzacca.com/wp-content/uploads/2011/03/3981c3cea7f7d772348901dc4b8d9ec0.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="3981c3cea7f7d772348901dc4b8d9ec0" border="0" alt="3981c3cea7f7d772348901dc4b8d9ec0" src="http://blog.marcmezzacca.com/wp-content/uploads/2011/03/3981c3cea7f7d772348901dc4b8d9ec0_thumb.png" width="450" height="87" /></a></p>
</p>
<p>I guess the only “gotcha” here is that if change your DB schema and you re-run the custom tool (TT file), it will wipe any custom input you’ve created.&#160; Perhaps there is a work around for that?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/03/using-data-annotations-and-extensions-with-subsonic-3-0/feed/</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
		<item>
		<title>Sending Amazon SES Emails through a Mock SMTP Server in .NET</title>
		<link>http://blog.marcmezzacca.com/2011/02/sending-amazon-ses-emails-through-a-mock-smtp-server-in-net/</link>
		<comments>http://blog.marcmezzacca.com/2011/02/sending-amazon-ses-emails-through-a-mock-smtp-server-in-net/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 14:39:26 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[amazon ses]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[mock]]></category>
		<category><![CDATA[simple email service]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[smtp server]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/02/sending-amazon-ses-emails-through-a-mock-smtp-server-in-net/</guid>
		<description><![CDATA[Some have recently posted that a pitfall of the Amazon Simple Email Service is that you can&#8217;t setup it up to work through a traditional SMTP as you can with other services such as SendGrid.&#160; While Amazon SES doesn’t provide a SMTP wrapper, Amazon points out that it can be used with some modifications to [...]]]></description>
			<content:encoded><![CDATA[<p>Some have recently posted that a pitfall of the Amazon Simple Email Service is that you can&#8217;t setup it up to work through a traditional SMTP as you can with other services such as SendGrid.&#160; While Amazon SES <a href="http://www.aspnet101.com/2011/01/sending-email-asp-net-amazon-ses-simple-email-service/" target="_blank">doesn’t provide a SMTP wrapper</a>, Amazon points out that it can be used with some modifications to your existing MTA.&#160; From the Amazon Developer Docs: </p>
<blockquote><p><strong>Q: Can my existing SMTP applications deliver email via Amazon SES?</strong>       <br />Yes. The Amazon SES Developer Guide provides instructions for configuring common mail transfer agents (MTAs) to use Amazon SES as their email transport. By following these instructions, you can create a private SMTP relay for use with any existing SMTP client software. </p>
</blockquote>
<p>In looking at the <a href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide/" target="_blank">Amazon SES Developer Guide</a>, they currently have examples of how to setup either <strong>Postfix</strong> or <strong>Sendmail</strong> software to use Amazon SES, and suggest adapting the examples to work with other agents. </p>
<p>If you want to test sending Amazon email in your own mock environment (or have an extreme situation that I don’t want to know about) below is how to setup a Mock SMTP Server and use it to test sending mail via local SMTP using the Amazon SES SendRawEmail API call. </p>
<p>There are a number of <a href="http://www.codeplex.com/site/search?query=smtp&amp;ac=8" target="_blank">open source Mock SMTP servers</a> available.&#160; For this demo I chose the <a href="http://antix.co.uk/Projects/SMTPImpostor" target="_blank">Antix Mail SMTP Impostor</a>.&#160; It seemed to have a good bit accomplished, while not being overly complex (brief <a href="http://leedumond.com/blog/a-better-smtp-development-server/" target="_blank">writeup here</a> by <a href="http://twitter.com/LeeDumond" rel="nofollow">@LeeDumond</a>).&#160;&#160; You can download the source code from here:&#160; <a title="http://ssfd.codeplex.com/" href="http://ssfd.codeplex.com/">http://ssfd.codeplex.com/</a></p>
<p>Once you’ve got the source code loaded up, Open FileMessageStorage.cs (in the Antix.Mail.Smtp.Impostor project).&#160; Add a reference to the Amazon .NET SDK. </p>
<p>Next find the <strong><em>Store()</em></strong> function.&#160; This function is used to store Mock emails locally on the hard drive.&#160; Insert the following code to actually send the email out via Amazon SES. </p>
<pre class="c-sharp" name="code">//Send msg via Amazon SES
AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(&quot;accessKey&quot;, &quot;secretKey&quot;);
SendRawEmailRequest rawObj = new SendRawEmailRequest();
rawObj.RawMessage = GetRawMessageFromString(message.Data);
rawObj.Source = message.From.Address;
foreach (MailAddress addressTo in message.To)
{
	rawObj.Destinations.Add(addressTo.Address);
}
client.SendRawEmail(rawObj); </pre>
<p>Remember to include the namespaces</p>
<pre class="c-sharp" name="code">using Amazon.SimpleEmail.Model;
using Amazon.SimpleEmail;</pre>
<p>That&#8217;s it!&#160; Now you can create a sample Console App or even Outlook to use your localhost to test sending emails via local SMTP.&#160; I&#8217;m not sure if anyone would ever want to do this, but it was a fun exercise for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/02/sending-amazon-ses-emails-through-a-mock-smtp-server-in-net/feed/</wfw:commentRss>
		<slash:comments>183</slash:comments>
		</item>
		<item>
		<title>Using ASP.NET MVC Views to Send Email via Amazon Simple Email Service using Postal</title>
		<link>http://blog.marcmezzacca.com/2011/02/using-asp-net-mvc-views-to-send-email-via-amazon-simple-email-service-using-postal/</link>
		<comments>http://blog.marcmezzacca.com/2011/02/using-asp-net-mvc-views-to-send-email-via-amazon-simple-email-service-using-postal/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 15:30:31 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[amazon ses]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[mvc3]]></category>
		<category><![CDATA[postal]]></category>
		<category><![CDATA[simple email service]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/02/using-asp-net-mvc-views-to-send-email-via-amazon-simple-email-service-using-postal/</guid>
		<description><![CDATA[At the MvcConf 2 Andrew Davey (@andrewdavey) presented a neat emailing utility for ASP.NET MVC 3 called Postal that allows for using View Engines to ease the creation of email templates, and also takes care of sending the emails out.&#160; During the session someone raised the question about sending through third-party services, namely Amazon Simple [...]]]></description>
			<content:encoded><![CDATA[<p>At the <a href="http://www.mvcconf.com/" target="_blank">MvcConf 2</a> Andrew Davey (<a href="http://twitter.com/andrewdavey" rel="nofollow">@andrewdavey</a>) <a href="http://channel9.msdn.com/Series/mvcConf/mvcConf-2-Andrew-Davey-Going-Postal-Generating-email-with-View-Engines" target="_blank">presented</a> a neat emailing utility for ASP.NET MVC 3 called Postal that allows for <a href="http://aboutcode.net/2010/11/17/going-postal-generating-email-with-aspnet-mvc-view-engines.html" target="_blank">using View Engines</a> to ease the creation of email templates, and also takes care of sending the emails out.&#160; During the session someone raised the question about sending through third-party services, namely Amazon Simple Email Service.&#160; Since Postal relies on .NET&#8217;s SmtpMail, there wasn&#8217;t a straight forward solution.&#160; This following post is about a hack I built to get around this&#8230; until something better crops up.&#160; It&#8217;s certainly not the most efficient way, but it does work. </p>
<p><em>What You&#8217;ll Need</em></p>
<p><strong><a href="http://aboutcode.net/postal/" target="_blank">Postal</a></strong> &#8211; lets you create emails using regular MVC views.&#160; Use NuGet to get the package and get started instantly.</p>
<p><strong><a href="http://aws.amazon.com/ses/" target="_blank">Amazon Simple Email Service</a></strong> -&#160; a highly scalable and cost-effective bulk and transactional email-sending service for businesses and developers.&#160; Download and install the <a href="http://aws.amazon.com/sdkfornet/" target="_blank">Amazon SDK</a> and reference the DLL in your project.</p>
<p>Here&#8217;s what I hacked together for now which I just called MailExtensions:</p>
<p><strong>SendEmailBySES</strong> &#8211; Handles everything from the dynamic Postal view to sending the message via Amazon SES.</p>
<pre class="c-sharp" name="code">public static void SendEmailBySES(dynamic email) {
	//Create Amazon SES client instance
	AmazonSimpleEmailServiceClient client
		= new AmazonSimpleEmailServiceClient(&quot;accessKey&quot;, &quot;secretKey&quot;);
	//create postal service instance
	IEmailService service = new EmailService(ViewEngines.Engines);
	//create the mail message
	MailMessage msg = service.CreateMailMessage(email);
	//convert MailMessage object to Amazon SES SendEmailRequest object
	SendEmailRequest mailObj = ConvertFromMailMessage(msg);
	//Send the email via SES
	dynamic response = client.SendEmail(mailObj);
}</pre>
<p><strong>ConvertFromMailMessage</strong> &#8211; Converts a MailMessage object to an Amazon SES SendEmailRequest object.</p>
<p>The code for this is a bit longer and more hacky so just download it instead.&#160; <strong>You can </strong><a href="http://marcmezzacca.com/src/MailExtensions.cs.txt" target="_blank">download the source here</a><strong></strong><strong>.</strong></p>
<p>NOTE: If you aren’t setup with Amazon SES you’ll have to signup up, and then need to verify your email addresses initially and go through the sandbox.&#160; Then you’ll have to apply for production.&#160; Below is a snippet to verify your email address through the API:</p>
<pre class="c-sharp" name="code">public static void VeryifySESEmail(string addy)
{
	VerifyEmailAddressRequest verRequest = new VerifyEmailAddressRequest();
	verRequest.EmailAddress = addy;
	VerifyEmailAddressResponse verResponse = client.VerifyEmailAddress(verRequest);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/02/using-asp-net-mvc-views-to-send-email-via-amazon-simple-email-service-using-postal/feed/</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
		<item>
		<title>Razor is Sharp, C?  NuGet it?  Notes from MvcConf 2 and Pluralsights Videos</title>
		<link>http://blog.marcmezzacca.com/2011/02/razor-is-sharp-c-nuget-it-notes-from-mvcconf-2-and-pluralsights-videos/</link>
		<comments>http://blog.marcmezzacca.com/2011/02/razor-is-sharp-c-nuget-it-notes-from-mvcconf-2-and-pluralsights-videos/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:46:37 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mvc3]]></category>
		<category><![CDATA[mvcconf]]></category>
		<category><![CDATA[razor]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[videos]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/02/razor-is-sharp-c-nuget-it-notes-from-mvcconf-2-and-pluralsights-videos/</guid>
		<description><![CDATA[Transitioning to MVC3 has been a great experience so far.&#160; Changing from &#60;%= to @ has been a dream come true.&#160; It might not seem like it since its only a couple characters, but seriously, it works much better, and I can already see the cut down in coding time.&#160; 
My brain hurts from watching [...]]]></description>
			<content:encoded><![CDATA[<p>Transitioning to MVC3 has been a great experience so far.&#160; Changing from &lt;%= to @ has been a dream come true.&#160; It might not seem like it since its only a couple characters, but seriously, it works much better, and I can already see the cut down in coding time.&#160; </p>
<p>My brain hurts from watching the <a href="http://mvcconf.com/">MvcConf</a> live webcast sessions most of the day yesterday, and <a href="http://bit.ly/ghDwqu">Pluralsight MVC3 videos</a> today (free until 9PM tonight).&#160; Scott Guthrie did a great job on the <a href="http://bit.ly/fo68aQ">Keynote</a> at MvcConf and all the presentations I watched were well done.&#160; I feel like I went to school the last couple days, and actually it felt pretty good.&#160; Below are my notes from the PluralSight videos, highlighting things I wanted to remember about Razor and MVC3:</p>
<ul>
<li><u><strong><em><font size="4">Razor &#8211; A general purpose templating engine</font></em></strong> </u></li>
<li><strong>Data Annotations</strong> &#8211; Attributes that can be applied to properties of models can be used for Data Validation (both client / server-side)&#160; eg. [Required] or [Range(1,4)]</li>
<li><strong>ModelState.IsValid</strong> &#8211; Checks model validation</li>
<li><strong>ClientValidationEnabled</strong> &#8211; flag in appSettings that determines if validation is handled on client-side (via jQuery) or server-side</li>
<li><strong>UnobstrusiveJavaScriptEnabled</strong> &#8211; flag for ?</li>
<li><strong>Implicit to Explicit Code Nuggets</strong> &#8211; You can use @(variable) to ensure the code is explcit and kept seperate from any following text</li>
<li><strong>Transitioning from Razor to Text</strong> &#8211; Using &lt;text&gt; tags … You can use the &lt;text&gt;&lt;/text&gt; tags to help the Razor parser when it gets tripped up in coding blocks</li>
<li><strong><a href="http://twitter.com/Html" rel="nofollow">@Html</a>.Raw</strong> &#8211; Do not html encode the code.</li>
<li><strong><a href="http://twitter.com/Html" rel="nofollow">@Html</a>.Partial</strong> &#8211; Returns string instead of writing directly to Response (Reminder: Partial views vs jQuery templates &#8211; usages, SEO, etc)</li>
<li><strong><a href="http://twitter.com/RenderSection" rel="nofollow">@RenderSection</a></strong> &#8211; Sections that can be defined within each view.&#160; Using required:false lets you make defining sections optional</li>
<li><strong>IsSectionDefined</strong> &#8211; Lets you check if a section is defined within a view.&#160; This is useful when you want to add default content when a section isn&#8217;t defined within a view.</li>
<li><strong>_ViewStart.cshtml</strong> &#8211; Lets you define code before every View renders</li>
<li><strong>system.web.webPages.razor</strong> &#8211; Dedicated section for Razor in the Web.Config file found within the Views folder</li>
</ul>
<p><strong>Action Filters</strong></p>
<p>Can be placed at the ActionResult or Or can be placed at the controller level</p>
<ul>
<li> [HandleError] &#8211; Allows pre/post processing to an action Friendly error view instead of yellow-screen of death</li>
<li> [Authorize] &#8211; Requires authorization to proceed</li>
</ul>
<p> <em>
<p>Global Action Filters</p>
<p> </em>
<ul>
<li>New in MVC3 &#8211; Ability to apply Global Action Filters</li>
<li>Register Global filters during application startup</li>
<li>- eg. GlobalFilters.Filters.Add(new HandleErrorAttribute());</li>
</ul>
<p><strong>Caching</strong></p>
<ul>
<li>New in MVC3?&#160; Caching can now be applied to child actions.&#160; Useful for caching on partial views.</li>
<li>[OutputCache(Duration=10)] &#8211; Set time for caching</li>
<li>[ChildActionOnly] &#8211; Ensure someone doesn&#8217;t make a direct request to this action</li>
</ul>
<p><strong>ViewBag vs ViewData</strong></p>
<ul>
<li>ViewData is&#160; dictionary of name/value pairs</li>
<li>ViewBag is a dynamic</li>
</ul>
<p><strong>New Action Results in MVC3</strong></p>
<ul>
<li>HttpNotFoundResult (404)</li>
<li>HttpRedirectResult (301 permenanent redirect)</li>
<li>HttpStatusCodeResult</li>
</ul>
<p><strong>RequestValidation</strong></p>
<ul>
<li>[ValidateInput(false)] &#8211; Turns off all verification to ActionResult.&#160; All or nothing approach, which can be problematic and hazardous.</li>
<li>[AllowHtml] &#8211; New in MVC3 a granular verification for view model which can be attributed to properties</li>
</ul>
<p><strong>Models Overview</strong></p>
<ul>
<li>Data Annotations &#8211; Required, StringLength, RegularExpression, Range</li>
<li>Client Validation &#8211; Improvements in MVC3</li>
<li>Remote Validation &#8211; New in MVC3 invokes server-side code, eg. validation that requires database information</li>
<li>Self Validation &#8211; View model object itself</li>
</ul>
<p><strong>Data Annotations &#8211; New</strong></p>
<ul>
<li>[Compare(&quot;varToCompare&quot;)] &#8211; New in .NET 4, allows to compare two properties</li>
<li>A second new one is … ?</li>
</ul>
<p><strong>Client Validation</strong></p>
<ul>
<li><a href="http://twitter.com/Html" rel="nofollow">@Html</a>.EnableClientValidation</li>
<li><a href="http://twitter.com/Html" rel="nofollow">@Html</a>.EnableUnobstrusiveJavaScript</li>
</ul>
<p><strong>Remote Validation</strong></p>
<ul>
<li>[Remote(&quot;ControllerAction&quot;, Named Parms)]</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/02/razor-is-sharp-c-nuget-it-notes-from-mvcconf-2-and-pluralsights-videos/feed/</wfw:commentRss>
		<slash:comments>220</slash:comments>
		</item>
		<item>
		<title>Setting up the FQL Console on Windows</title>
		<link>http://blog.marcmezzacca.com/2011/02/setting-up-the-fql-console-on-windows/</link>
		<comments>http://blog.marcmezzacca.com/2011/02/setting-up-the-fql-console-on-windows/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 22:57:15 +0000</pubDate>
		<dc:creator>marc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fql]]></category>
		<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://blog.marcmezzacca.com/2011/02/setting-up-the-fql-console-on-windows/</guid>
		<description><![CDATA[Recently I came across a FQL test console that runs locally for running tests against the Facebook Query Language (FQL).&#160; It is useful for testing purposes when developing a Facebook application.&#160; After the download and setup it simply didn’t work properly.&#160; Below are the changes I made to the fqlconsole.bat which seemed to make it [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I came across a <a href="http://igorartamonov.com/2010/07/facebooks-fql-console/">FQL test console</a> that runs locally for running tests against the Facebook Query Language (FQL).&#160; It is useful for testing purposes when developing a Facebook application.&#160; After the <a href="http://github.com/splix/fqlconsole">download</a> and setup it simply didn’t work properly.&#160; Below are the changes I made to the <code><em>fqlconsole.bat</em></code> which seemed to make it function correctly:</p>
<pre name="code">set FQLCONSOLE=.
set LIB=&quot;%FQLCONSOLE%/libs&quot;
set JARS=%LIB%/jetty-6.1.19.jar;%LIB%/jetty-util-6.1.19.jar;%LIB%/servlet-api-2.5-20081211.jar;%LIB%/start-6.1.19.jar
set JHOME=C:\&quot;Program Files&quot;\Java\jdk1.6.0_23\bin\java -classpath

start %JHOME% &quot;%JARS%&quot; org.mortbay.start.Main jetty.xml</pre>
<p>Note: If you copy the code above, ensure you enter the correct path to the JDK.&#160; </p>
<p>I also added the following to the jetty.xml under the DefaultHandler item entry:</p>
<p><code>&lt;Item&gt;<br />
  <br />&#160; &lt;New id=&quot;RequestLog&quot; class=&quot;org.mortbay.jetty.handler.RequestLogHandler&quot;/&gt;</p>
<p>&lt;/Item&gt;</p>
<p></code></p>
<p>Here’s a screenshot of what it looks like:</p>
<p><a href="http://igorartamonov.com/wp-content/uploads/2010/07/fqlconsole-screenshot.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.marcmezzacca.com/wp-content/uploads/2011/02/image.png" width="451" height="343" /></a></p>
<p>Link to GIT: <a title="http://github.com/splix/fqlconsole" href="http://github.com/splix/fqlconsole">http://github.com/splix/fqlconsole</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.marcmezzacca.com/2011/02/setting-up-the-fql-console-on-windows/feed/</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
	</channel>
</rss>

