<?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>MIKE &#187; Developement</title>
	<atom:link href="http://helios.ca/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://helios.ca</link>
	<description>Just another developer blog</description>
	<lastBuildDate>Tue, 12 Jul 2011 21:35:29 +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>ASP.NET MVC Merge + Minify Javascript on the fly</title>
		<link>http://helios.ca/2011/07/12/asp-net-mvc-merge-minify-javascript-on-the-fly/</link>
		<comments>http://helios.ca/2011/07/12/asp-net-mvc-merge-minify-javascript-on-the-fly/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 21:30:33 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=183</guid>
		<description><![CDATA[According to Yahoo&#8217;s Best Practices for Speeding Up Your Web Site we should make fewer HTTP Requests. I usually like to combines my images into a single *.png file and use CSS Sprites to display the image, or merge all my JavaScripts and Styles into a single js/css file. This article is going to focus only [...]]]></description>
			<content:encoded><![CDATA[<p>According to Yahoo&#8217;s <a href="http://developer.yahoo.com/performance/rules.html">Best Practices for Speeding Up Your Web Site</a> we should make <a href="http://developer.yahoo.com/performance/rules.html#num_http">fewer HTTP Requests</a>.</p>
<p>I usually like to combines my images into a single *.png file and use CSS Sprites to display the image, or merge all my JavaScripts and Styles into a single js/css file.</p>
<p>This article is going to focus only on JavaScript and CSS minification/merging, but I might write another for images and sprites later.</p>
<p>I use this technique in all my project, it is very easy, lightweight and the best is it runs when you build your solution.</p>
<p>In this example I used:</p>
<ul>
<li>Visual Studio 2010</li>
<li>.NET 4</li>
<li>ASP.NET MVC 3</li>
<li>Yahoo YUI Compressor</li>
<li>EcmaScript.NET</li>
</ul>
<h2><strong>Step 1:</strong> Create a new MVC Project.</h2>
<p style="text-align: center;"><a href="http://helios.ca/wp-content/uploads/2011/07/1.png"><img class="size-medium wp-image-343 aligncenter" title="Create MVC Project" src="http://helios.ca/wp-content/uploads/2011/07/1-300x207.png" alt="" width="300" height="207" /></a></p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://helios.ca/wp-content/uploads/2011/07/2.png"><img class="size-medium wp-image-344 aligncenter" title="MVC Project Settings" src="http://helios.ca/wp-content/uploads/2011/07/2-300x269.png" alt="" width="300" height="269" /></a></p>
<h2>Step 2: Create some CSS and JS files.</h2>
<p>In this case I simply split the Site.css that comes with MVC into many files and added a Site.js files that simply does on alert on document ready.</p>
<p style="text-align: center;"><a href="http://helios.ca/wp-content/uploads/2011/07/3.png"><img class="size-full wp-image-345 aligncenter" title="Add some JS and CSS files" src="http://helios.ca/wp-content/uploads/2011/07/3.png" alt="" width="233" height="575" /></a></p>
<h2>Step 3: Modify the MasterPage (_Layout.cshtml) to reference the right files depending on the solution running in Debug or Release.</h2>
<h2><a href="http://helios.ca/wp-content/uploads/2011/07/4.png"><img class="aligncenter size-full wp-image-346" title="MasterPage modifications" src="http://helios.ca/wp-content/uploads/2011/07/4.png" alt="" width="742" height="352" /></a>Step4: Add the EcmacScript.NET and Yahoo.UI.Compressor binariesfrom the example file on Codeplex).</h2>
<h2><a href="http://helios.ca/wp-content/uploads/2011/07/5.png"><img class="aligncenter size-full wp-image-347" title="Add Binaries" src="http://helios.ca/wp-content/uploads/2011/07/5.png" alt="" width="221" height="71" /></a></h2>
<h2>Step 5: Create MSBuild.xml file &#8211; start from Codeplex example</h2>
<pre class="xml" name="code">
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
    <UsingTask
        TaskName="CompressorTask"
        AssemblyFile="Yahoo.Yui.Compressor.dll" />

    <PropertyGroup>
        <CssOutputFile Condition=" '$(CssOutputFile)'=='' ">
            ../AssetsMinification/Content/AssetsMinification.css
        </CssOutputFile>
        <JavaScriptOutputFile Condition=" '$(JavaScriptOutputFile)'=='' ">
            ../AssetsMinification/Scripts/AssetsMinification.js
        </JavaScriptOutputFile>
    </PropertyGroup>

    <Target Name="MyTaskTarget">

        <ItemGroup>
            <CssFiles Include="../AssetsMinification/Content/Reset.css"/>
            <CssFiles Include="../AssetsMinification/Content/Site.css"/>
            <CssFiles Include="../AssetsMinification/Content/Text.css"/>
            <CssFiles Include="../AssetsMinification/Content/Forms.css"/>
            <CssFiles Include="../AssetsMinification/Content/Tables.css"/>
            <CssFiles Include="../AssetsMinification/Content/Menu.css"/>

            <JavaScriptFiles Include="../AssetsMinification/Scripts/jquery-1.5.1.js"/>
            <JavaScriptFiles Include="../AssetsMinification/Scripts/modernizr-1.7.js"/>
            <JavaScriptFiles Include="../AssetsMinification/Scripts/Site.js"/>
        </ItemGroup>

        <CompressorTask
            CssFiles="@(CssFiles)"
            DeleteCssFiles="false"
            CssOutputFile="$(CssOutputFile)"
            CssCompressionType="YuiStockCompression"
            JavaScriptFiles="@(JavaScriptFiles)"
            ObfuscateJavaScript="True"
            PreserveAllSemicolons="False"
            DisableOptimizations="Nope"
            EncodingType="Default"
            DeleteJavaScriptFiles="false"
            LineBreakPosition="-1"
            JavaScriptOutputFile="$(JavaScriptOutputFile)"
            LoggingType="ALittleBit"
            ThreadCulture="en-CA"
            IsEvalIgnored="false"
            />
    </Target>
</Project>
</pre>
<h2>Step 5: Run It in release mode</h2>
<p>That&#8217;s it! </p>
<p><a href="http://www.chambaud.com/dump/beta/AssetsMinification.zip">Here&#8217;s the code.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2011/07/12/asp-net-mvc-merge-minify-javascript-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Navigation in Windows Phone 7 Application</title>
		<link>http://helios.ca/2010/08/12/navigation-in-windows-phone-7-application/</link>
		<comments>http://helios.ca/2010/08/12/navigation-in-windows-phone-7-application/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 17:27:13 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=274</guid>
		<description><![CDATA[I&#8217;ve recently started playing with Windows Phone 7 Developer Tools and one of the first thing I asked myself is &#8220;How To Link Between Views?!&#8221;. I researched the web and found 3 ways to handle navigation: Static Links, Routes and Navigation Service. First of all, to build a Windows Phone 7 Application you will need [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently started playing with <a href="http://developer.windowsphone.com/windows-phone-7/">Windows Phone 7 Developer Tools</a> and one of the first thing I asked myself is <strong>&#8220;How To Link Between Views?!&#8221;. </strong>I researched the web and found 3 ways to handle navigation: <strong>Static Links</strong>, <strong>Routes </strong>and <strong>Navigation Service.</strong> </p>
<p>First of all, to build a Windows Phone 7 Application you will need to download and install the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c8496c2a-54d9-4b11-9491-a1bfaf32f2e3&amp;displaylang=en">this</a>. You will also need to have a basic understanding of Silverlight/XAML.</p>
<p>1. First things first, lets create a new Project.</p>
<p><img class="aligncenter size-full wp-image-280" title="1" src="http://helios.ca/wp-content/uploads/2010/08/1.png" alt="" width="550" height="380" /></p>
<p>2. Then I created a few pages in a folder I created and named <strong>Views</strong> (You could call this folder whatever you want&#8230;)</p>
<p><a href="http://helios.ca/wp-content/uploads/2010/08/3.png"><img class="aligncenter size-full wp-image-282" title="3" src="http://helios.ca/wp-content/uploads/2010/08/3.png" alt="" width="550" height="380" /></a></p>
<p>3. This is what my Solution Explorer looks like now.</p>
<p><a href="http://helios.ca/wp-content/uploads/2010/08/2.png"><img class="aligncenter size-full wp-image-283" title="2" src="http://helios.ca/wp-content/uploads/2010/08/2.png" alt="" width="335" height="287" /></a></p>
<p>4. To create Static Links, add some Hyperlink to the ContentGrid of <strong>MainPage.xaml</strong> and give them the <strong>NavigateUri </strong>property with the path to the page you want to navigate to.</p>
<pre class="xml" name="code">
<Grid x:Name="ContentGrid" Grid.Row="1">
    <HyperlinkButton Content="Page 1" Height="30" NavigateUri="/Views/Page1.xaml" Name="hyperlinkButton1" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="100" Margin="21,86,0,0"></HyperlinkButton>
    <HyperlinkButton Content="Page 2" Height="30" NavigateUri="/Views/Page2.xaml" Name="hyperlinkButton2" VerticalAlignment="Top" Width="100" Margin="21,152,359,0"></HyperlinkButton>
    <HyperlinkButton Content="Page 3" Height="30" NavigateUri="/Views/Page3.xaml" Name="hyperlinkButton3" HorizontalAlignment="Left"  VerticalAlignment="Bottom" Width="100" Margin="21,0,0,371"></HyperlinkButton>
</Grid>
</pre>
<p>5. Now if you run the application using the Windows Phone 7 Emulator and click one of the Hyperlink you created you should see the content of that page. In my case the only thing I changed is the Page Title..</p>
<p><a href="http://helios.ca/wp-content/uploads/2010/08/6.png"><img src="http://helios.ca/wp-content/uploads/2010/08/6.png" alt="" title="6" width="260" height="478" class="aligncenter size-full wp-image-299" style="float:left" /></a></p>
<p><a href="http://helios.ca/wp-content/uploads/2010/08/4.png"><img src="http://helios.ca/wp-content/uploads/2010/08/4.png" alt="" title="4" width="260" height="478" class="aligncenter size-full wp-image-293" style="float:left" /></a></p>
<p style="clear:both">
<p>6. Lets try to do the same thing with the Navigation Service. Open <strong>App.xaml</strong> and add the following code in <strong><Application.Resources></strong></p>
<pre class="xml" name="code">
<nav:UriMapper x:Key="UriMapper">
<nav:UriMapper.UriMappings>
<nav:UriMapping Uri="/Page1" MappedUri="/Views/Page1.xaml"></nav:UriMapping>
<nav:UriMapping Uri="/Page2" MappedUri="/Views/Page2.xaml"></nav:UriMapping>
<nav:UriMapping Uri="/Page3" MappedUri="/Views/Page3.xaml"></nav:UriMapping>
        </nav:UriMapper.UriMappings>
    </nav:UriMapper>
</pre>
<p>7. We now need to tell the Application to use this UriMapper. This is very simple, open App.xaml.cs and add <strong>RootFrame.UriMapper = Resources["UriMapper"] as UriMapper;</strong> at the end of the constructor. It should look like this:</p>
<pre class="csharp" name="code">
public App()
{
    // Global handler for uncaught exceptions.
    // Note that exceptions thrown by ApplicationBarItem.Click will not get caught here.
    UnhandledException += Application_UnhandledException;

    // Standard Silverlight initialization
    InitializeComponent();

    // Phone-specific initialization
    InitializePhoneApplication();

    RootFrame.UriMapper = Resources["UriMapper"] as UriMapper;
}
</pre>
<p>8. Once this is done, add a button on the <strong>MainPage.xaml</strong>. </p>
<pre class="csharp" name="code">
<Grid x:Name="ContentGrid" Grid.Row="1">
    <HyperlinkButton Content="Page 1" Height="30" NavigateUri="/Views/Page1.xaml" Name="hyperlinkButton1" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="100" Margin="21,86,0,0"></HyperlinkButton>
    <HyperlinkButton Content="Page 2" Height="30" NavigateUri="/Views/Page2.xaml" Name="hyperlinkButton2" VerticalAlignment="Top" Width="100" Margin="21,152,359,0"></HyperlinkButton>
    <HyperlinkButton Content="Page 3" Height="30" NavigateUri="/Views/Page3.xaml" Name="hyperlinkButton3" HorizontalAlignment="Left"  VerticalAlignment="Bottom" Width="100" Margin="21,0,0,371"></HyperlinkButton>
< B utton Content="Go To Page 3" Height="72" HorizontalAlignment="Left" Margin="21,291,0,0" Name="button1" VerticalAlignment="Top" Width="246" Click="button1_Click" />
</Grid>
</pre>
<p>9. Double click on the button you just added to give it a Click Event. This should create <strong>button1_Click</strong> method in <strong>MaiPage.xaml.cs</strong>. Put the following line of code in the method:</p>
<pre class="csharp" name="code">
private void button1_Click(object sender, RoutedEventArgs e)
{
    NavigationService.Navigate(new Uri("/Page3", UriKind.Relative));
}
</pre>
<p>10. NavigationService also provides you metods like GoBack() to go back to the previous page. If you want to try this, you could add a button a Page3.xaml much like we did for step 9 and put this code in Page3.xaml.cs:</p>
<pre class="csharp" name="code">
private void button1_Click(object sender, RoutedEventArgs e)
{
    NavigationService.GoBack();
}
</pre>
<p>I know I skipped the second option, Routes. I&#8217;ll write about it in another post! I think the most important navigation feature in a Windows Phone 7 application is the NavigationService!</p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2010/08/12/navigation-in-windows-phone-7-application/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 2 &#8211; Linking between Areas</title>
		<link>http://helios.ca/2010/06/10/asp-net-mvc-2-linking-between-areas/</link>
		<comments>http://helios.ca/2010/06/10/asp-net-mvc-2-linking-between-areas/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 15:02:37 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=267</guid>
		<description><![CDATA[If you&#8217;ve been playing with MVC 2 you might be wondering how to make ActionLinks between areas. I know it took me a good half hour to figure out! Here it is: Html.ActionLink("Display Text", "Action", "Controller", new { area = "Area" }, null); I hope it helps someone!]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been playing with MVC 2 you might be wondering how to make ActionLinks between areas. I know it took me a good half hour to figure out!</p>
<p>Here it is:</p>
<pre class="csharp" name="code">
Html.ActionLink("Display Text", "Action", "Controller", new { area = "Area" }, null);
</pre>
<p>I hope it helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2010/06/10/asp-net-mvc-2-linking-between-areas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 2 Model Validation With Localization</title>
		<link>http://helios.ca/2010/02/17/asp-net-mvc-2-model-validation-with-localization/</link>
		<comments>http://helios.ca/2010/02/17/asp-net-mvc-2-model-validation-with-localization/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 17:35:03 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=226</guid>
		<description><![CDATA[So yesterday I posted about MVC 2 Model Validation. And today I&#8217;m going to do the same thing, but I&#8217;m going to Localize those ErrorMessage. In this post I&#8217;ll not be using the SetCulture Attribute from ASP.NET MVC And Localization. Instead I&#8217;ll be using the auto-culture feature of ASP.NET which will be explained here; note [...]]]></description>
			<content:encoded><![CDATA[<p>So yesterday I posted about <a href="http://helios.ca/2010/02/15/asp-net-mvc-2-model-validation/">MVC 2 Model Validation</a>. And today I&#8217;m going to do the same thing, but I&#8217;m going to Localize those ErrorMessage.</p>
<p>In this post I&#8217;ll not be using the SetCulture Attribute from <a href="http://helios.ca/2009/05/27/aspnet-mvc-and-localization/">ASP.NET MVC And Localization</a>. Instead I&#8217;ll be using the auto-culture feature of ASP.NET which will be explained here; note you could achieve the same thing with the SetCulture Attribute. </p>
<p>Obviously, we&#8217;ll start by creating a new ASP.NET MVC 2 Web Application. I did not create a Test Project for this&#8230;<br />
<a href="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-35-28-AM1.png"><img src="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-35-28-AM1.png" alt="" title="2-17-2010 11-35-28 AM" width="512" height="372" class="aligncenter size-full wp-image-242" /></a></p>
<p>Then we need to setup proper Globalization configuration in our project. For this we&#8217;ll use the Auto-Culture features of ASP.NET. Open up the Web.Config and add this line.</p>
<pre class="xml" name="code">
<configuration>
    ....
    <system.web>
        ....
        <globalization enableClientBasedCulture="true" culture="auto" uiCulture="auto"/>
    </system.web>
    ....
</configuration>
</pre>
<p>Lets make sure the Globalization works.</p>
<p>First, we&#8217;ll create the App_GlobalResources folder and add 2 resources files to it; <strong>Global.resx</strong> and <strong>Global.fr.resx</strong>. Also add some Resources to this files.<br />
<a href="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-40-17-AM1.png"><img src="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-40-17-AM1.png" alt="" title="2-17-2010 11-40-17 AM" width="520" height="156" class="aligncenter size-full wp-image-246" /></a></p>
<p>Well also need to make sure that these Resources files do not have Internal properties, but Public properties and also make it an embedded resources. To do this we need to click the <strong>Global.resx</strong> file, right-blick and go to <strong>properties</strong>. Set the <strong>Build Action</strong> to <strong>Embedded Resources</strong> and the <strong>Custom Tool</strong> to <strong>PublicResXFileCodeGenerator</strong>. </p>
<p><a href="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-12-10-37-PM.png"><img src="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-12-10-37-PM.png" alt="" title="2-17-2010 12-10-37 PM" width="415" height="158" class="aligncenter size-full wp-image-238" /></a></p>
<p>Now we&#8217;ll change some hard-coded text to Resources. I simply opened up the HomeController and changed the Index action&#8230;</p>
<pre class="csharp" name="code">
public ActionResult Index()
{
    ViewData["Message"] = Resources.Global.Welcome;

    return View();
}
</pre>
<p>Just try the application and make sure it works properly.</p>
<p><a href="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-45-27-AM.png"><img src="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-45-27-AM.png" alt="" title="2-17-2010 11-45-27 AM" width="492" height="268" class="aligncenter size-full wp-image-232" /></a></p>
<p><a href="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-45-53-AM.png"><img src="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-45-53-AM.png" alt="" title="2-17-2010 11-45-53 AM" width="493" height="268" class="aligncenter size-full wp-image-233" /></a></p>
<p>So now we know that our Localization works, but that&#8217;s not what this post is about is it&#8230; What we want is to localize the Error Messages in our Model! So lets make a test model with some validation attributes! </p>
<p>Notice that I&#8217;m not using <strong>ErrorMessage</strong> anymore, instead I&#8217;m using <strong>ErrorMessageResourceType</strong> and <strong>ErrorMessageResourceName</strong>.</p>
<pre class="csharp" name="code">
public class Test
{
    // StringLength
    [StringLength(5, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "StringLength")]
    public string StringLength { get; set; }

    // Required
    [Required(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "Required")]
    public string Required { get; set; }

    // Required and StringLength
    [Required(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "Required")]
    [StringLength(5, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "StringLength")]
    public string Combos { get; set; }

    // Range Attribute
    [Range(1, 31, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "Range")]
    public int Range { get; set; }

    // RegularExpression Attribute
    [RegularExpression(@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$", ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "Email")]
    public string Regex { get; set; }

    // Custom Regular Expression EmailAttribute
    [Email(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "Email")]
    public string Email { get; set; }
}
</pre>
<p>So that&#8217;s it for the model, now we need a Controller and a View for that.</p>
<pre class="csharp" name="code">
[HttpGet]
public ActionResult Create()
{
   var t = new Test();
   return View(t);
}

[HttpPost]
public ActionResult Create(Test t)
{
    if (ModelState.IsValid)
    {
        // If it's valid redirect to success page, or in my case the Home page since I have nothing else...
        return Redirect("/");
    }
    return View(t);
}
</pre>
<p>For the view, just right click on either Create and click Add View&#8230;<br />
<a href="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-57-52-AM.png"><img src="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-11-57-52-AM.png" alt="" title="2-17-2010 11-57-52 AM" width="382" height="384" class="aligncenter size-full wp-image-237" /></a></p>
<p>We don&#8217;t need to change anything to the view so I&#8217;m not going to go into details on this one&#8230; Beside I&#8217;ll post the Source Code when I&#8217;m done..</p>
<p>Here&#8217;s the final result, with my browser set to French.<br />
<a href="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-12-23-09-PM.png"><img src="http://helios.ca/wp-content/uploads/2010/02/2-17-2010-12-23-09-PM.png" alt="" title="2-17-2010 12-23-09 PM" width="630" height="706" class="aligncenter size-full wp-image-253" /></a></p>
<p>It&#8217;s my first strike at this so if you have any comments or suggestion feel free to share it with us in the comment section!</p>
<p>Here&#8217;s the <a href='http://helios.ca/wp-content/uploads/2010/02/MvcModelValidationLocalized.zip'>Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2010/02/17/asp-net-mvc-2-model-validation-with-localization/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 2 Model Validation</title>
		<link>http://helios.ca/2010/02/15/asp-net-mvc-2-model-validation/</link>
		<comments>http://helios.ca/2010/02/15/asp-net-mvc-2-model-validation/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 16:40:59 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=213</guid>
		<description><![CDATA[In projects I usually work on, we always use a data validation framework. But now in ASP.NET MVC 2 you can do it just as you would using a framework. You need to write your model with the proper validation attributes. using System; using System.ComponentModel.DataAnnotations; namespace FunWithMvc2RC2 { public class Test { // StringLenght [StringLength(5, [...]]]></description>
			<content:encoded><![CDATA[<p>In projects I usually work on, we always use a data validation framework. But now in ASP.NET MVC 2 you can do it just as you would using a framework. </p>
<p>You need to write your model with the proper validation attributes.</p>
<pre class="csharp" name="code">
using System;
using System.ComponentModel.DataAnnotations;

namespace FunWithMvc2RC2
{
    public class Test
    {
        // StringLenght
        [StringLength(5, ErrorMessage = "Maximum 25 Characters")]
        public string StringLength { get; set; }

        // Required
        [Required(ErrorMessage = "Required Field")]
        public string Required { get; set; }

        // Required and StringLenght
        [Required(ErrorMessage = "Required Field")]
        [StringLength(5, ErrorMessage = "Maximum 25 Characters")]
        public string Combos { get; set; }

        // Range Attribute
        [Range(1, 31, ErrorMessage = "Minimum 1; Maximum 31")]
        public int Range { get; set; }

        // RegularExpression Attribute
        [RegularExpression(@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$", ErrorMessage = "Invalid Email Address")]
        public string Regex { get; set; }

        // Custom Regular Expression EmailAttribute
        [Email(ErrorMessage = "Email Validation")]
        public string Email { get; set; }
    }
}
</pre>
<p>This will give you something like this:<br />
<a href="http://helios.ca/wp-content/uploads/2010/02/test1.jpg"><img src="http://helios.ca/wp-content/uploads/2010/02/test1.jpg" alt="" title="test" width="522" height="630" class="aligncenter size-full wp-image-220" /></a></p>
<p>And to make the Email Attribute you simply make a new class, which inherits RegularExpressionAttribute and then send the constructor an Email Address Regex! It&#8217;s this simple. You could do the same for any other Regular Expression based validation. Just Make sure you call your class &#8211; SomethingAttribute. </p>
<pre class="csharp" name="code">
using System;
using System.ComponentModel.DataAnnotations;

namespace FunWithMvc2RC2
{
    public class EmailAttribute : RegularExpressionAttribute
    {
        public EmailAttribute() :
            base(@"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$") {}
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2010/02/15/asp-net-mvc-2-model-validation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>&#8220;Edit WCF Configuration&#8221; is missing from Visual Studio 2008 context menu</title>
		<link>http://helios.ca/2010/02/04/edit-wcf-configuration-is-missing-from-visual-studio-2008-context-menu/</link>
		<comments>http://helios.ca/2010/02/04/edit-wcf-configuration-is-missing-from-visual-studio-2008-context-menu/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 17:11:25 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=202</guid>
		<description><![CDATA[So this morning I format a laptop and install a fresh copy of Visual Studio 2008. I then try to edit the Web.Config using Edit WCF Configuration, but wait it&#8217;s missing! What the hell? So I look around in VS menus and find Tools -&#62; WCF Service Configurator Editor. I clicked it and modified my [...]]]></description>
			<content:encoded><![CDATA[<p>So this morning I format a laptop and install a fresh copy of Visual Studio 2008. I then try to edit the Web.Config using <strong>Edit WCF Configuration</strong>, but wait it&#8217;s missing! What the hell?</p>
<p><a href="http://helios.ca/wp-content/uploads/2010/02/1.jpg"><img class="aligncenter size-full wp-image-204" title="1" src="http://helios.ca/wp-content/uploads/2010/02/1.jpg" alt="" width="350" height="362" /></a></p>
<p>So I look around in VS menus and find <strong>Tools -&gt; WCF Service Configurator Editor. </strong>I clicked it and modified my Web.Config&#8230;But I really liked to have the option to just open this in the Context Menu! I clicked again just to humor myself and it was back!</p>
<p><a href="http://helios.ca/wp-content/uploads/2010/02/2.jpg"><img class="aligncenter size-full wp-image-203" title="2" src="http://helios.ca/wp-content/uploads/2010/02/2.jpg" alt="" width="350" height="362" /></a></p>
<p>I don&#8217;t know what happened there, it&#8217;s actually the first time I see this, but I don&#8217;t play much with WCF! I was actually able to reproduce this first hand on a virtual machine&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2010/02/04/edit-wcf-configuration-is-missing-from-visual-studio-2008-context-menu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To: Remove Workspaces from Visual Studio</title>
		<link>http://helios.ca/2010/01/25/how-to-remove-workspaces-from-visual-studio/</link>
		<comments>http://helios.ca/2010/01/25/how-to-remove-workspaces-from-visual-studio/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 16:09:26 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Developement]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=192</guid>
		<description><![CDATA[I usually work using Team Foundation Systems over VPN. And sometimes my VPN access is revoked because I no longer work for a particular client, when this happens my Visual Studio Workspaces is stock there, I can&#8217;t reuse the same folder. I&#8217;ve been looking into this and found a fairly simple solution from Greg. Open [...]]]></description>
			<content:encoded><![CDATA[<p>I usually work using Team Foundation Systems over VPN. And sometimes my VPN access is revoked because I no longer work for a particular client, when this happens my Visual Studio Workspaces is stock there, I can&#8217;t reuse the same folder. I&#8217;ve been looking into this and found a fairly simple solution from <a href="http://gregdoesit.com/2009/01/tfs-deleting-old-workspaces/">Greg</a>.</p>
<ol>
<li>Open the Command Line ( <strong>Start -&gt; Run -&gt; cmd</strong>)</li>
<li>Go to:  <strong>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE</strong> (or C:\Program Files\Microsoft Visual Studio 8\Common7\IDE for Visual Studio 2005)</li>
<li>Execute: <strong>tf workspaces /remove:workspace</strong></li>
</ol>
<p>This probably works with Visual Studio 2010, I should update this post whenever I try it!</p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2010/01/25/how-to-remove-workspaces-from-visual-studio/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ASP.Net MVC RSS Feed Action Result</title>
		<link>http://helios.ca/2009/09/22/asp-net-mvc-rss-feed-action-result/</link>
		<comments>http://helios.ca/2009/09/22/asp-net-mvc-rss-feed-action-result/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 22:17:35 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=180</guid>
		<description><![CDATA[ASP.NET MVC ships with a few ActionResult but lacks an RSS Feed ActionResult. I required one for a small project at work, so I started looking on the web if there was something interesting before coding my own. Well the googling was successful! I found a nice piece of code by Guy Burstein. If you [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET MVC ships with a few ActionResult but lacks an RSS Feed ActionResult. I required one for a small project at work, so I started looking on the web if there was something interesting before coding my own. Well the googling was successful! I found a nice piece of code by <a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2009/01/11/asp-net-mvc-rss-feed-action-result.aspx">Guy Burstein. </a></p>
<p>If you need such an ActionResult in your application, I would recommend you to read his <a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2009/01/11/asp-net-mvc-rss-feed-action-result.aspx">article </a>first!</p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2009/09/22/asp-net-mvc-rss-feed-action-result/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC Extension Methods of UrlHelper</title>
		<link>http://helios.ca/2009/09/21/asp-net-mvc-extension-methods-of-urlhelper/</link>
		<comments>http://helios.ca/2009/09/21/asp-net-mvc-extension-methods-of-urlhelper/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 01:31:08 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=170</guid>
		<description><![CDATA[How to create ASP.NET MVC Extensions Methods of UrlHelper]]></description>
			<content:encoded><![CDATA[<p>I think this is kind of obvious, but I guess it might not be for everyone because I&#8217;ve seen some code where people do not use this! URL Helpers are really easy to setup, it takes only a few minutes and will probably save you a lot of massive Search &amp; Replace in the future!</p>
<pre class="csharp" name="code">public static string Image(this UrlHelper helper, string fileName)
{
    return helper.Content("~/Content/Images/" + fileName));
}

public static string Stylesheet(this UrlHelper helper, string fileName)
{
    return helper.Content("~/Content/Stylesheets/" + fileName);
}

public static string Script(this UrlHelper helper, string fileName)
{
    return helper.Content("~/Content/Scripts/" + fileName);
}</pre>
<p>So instead of doing this:</p>
<pre class="csharp" name="code">&lt;link href="../../../Content/StyleSheets/Main.css" rel="stylesheet" type="text/css" /&gt;</pre>
<p>You can do this:</p>
<pre class="csharp" name="code">&lt;link href="&lt;%= Url.Stylesheet("Main.css")%&gt;" rel="stylesheet" type="text/css" /&gt;</pre>
<p>These are just 3 common examples, you should do the same thing for things you use a lot.</p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2009/09/21/asp-net-mvc-extension-methods-of-urlhelper/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC V2 Preview 1 Released!!!</title>
		<link>http://helios.ca/2009/08/01/asp-net-mvc-v2-preview-1-released/</link>
		<comments>http://helios.ca/2009/08/01/asp-net-mvc-v2-preview-1-released/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 16:35:18 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://helios.ca/?p=164</guid>
		<description><![CDATA[The ASP.NET team just released ASP.NET MVC Version 2 Preview 1.  You can grab it here. Scott Guthrie wrote a nice article about it.]]></description>
			<content:encoded><![CDATA[<p>The ASP.NET team just released  ASP.NET MVC Version 2 Preview 1.  You can grab it <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=d34f9eaa-fcbe-4e20-b2fd-a9a03de7d6dd#tm" target="_blank">here</a>.</p>
<p><a href="http://weblogs.asp.net/scottgu">Scott Guthrie</a> wrote a nice <a href="http://weblogs.asp.net/scottgu/archive/2009/07/31/asp-net-mvc-v2-preview-1-released.aspx"></a><a href="http://weblogs.asp.net/scottgu/archive/2009/07/31/asp-net-mvc-v2-preview-1-released.aspx">article</a> about it.<a href="http://weblogs.asp.net/scottgu/archive/2009/07/31/asp-net-mvc-v2-preview-1-released.aspx"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://helios.ca/2009/08/01/asp-net-mvc-v2-preview-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

