<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Gunnar Peipman -  Programming Blog | Gunnar Peipman -  Programming Blog</title>
	
	<link>http://gunnarpeipman.com</link>
	<description />
	<lastBuildDate>Wed, 19 Jun 2013 09:15:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/gunnarpeipman" /><feedburner:info uri="gunnarpeipman" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Surface RT–first impressions</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/C4Nv8pVwqFo/</link>
		<comments>http://gunnarpeipman.com/2013/06/surface-rt/#comments</comments>
		<pubDate>Wed, 19 Jun 2013 09:15:00 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[Devices and hardware]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1563</guid>
		<description><![CDATA[<p>Couple months ago I bought Surface RT because I needed some lightweight business supporting thing to take with me sometimes. Carrying ~3kg development laptop is not always fun, specially when you have long days and you need to move from one place to another often. Surface RT turned out to be pretty good investment and here are my first real-life experiences.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/surface-rt/">Surface RT&ndash;first impressions</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Couple months ago I bought Surface RT because I needed some lightweight business supporting thing to take with me sometimes. Carrying ~3kg development laptop is not always fun, specially when you have long days and you need to move from one place to another often. Surface RT turned out to be pretty good investment and here are my first real-life experiences.</p><span id="more-1563"></span><p align="left">The full pointo of Surface RT came to me when I actually started using it in real life. Of course, I also made my own experiments on it just to find out other possible scenarios where Surface can be great help for me, but I will focus on other things on later posts.</p> <p align="center"><img title="Surface RT" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Surface RT" src="http://gunnarpeipman.com/wp-content/uploads/2013/06/surfacert.jpg" width="432" height="257"></p> <h3>Easy, quick and lightweight</h3> <p>First thing I noticed was that it is convenient to take Surface RT with me. I don’t even need bag with me because I can just keep it in hand. Opening Surface and accessing my work programs and systems is blazing fast – just open Surface, click button, log in and there you are. Typing is painless no matter if you use on-screen or attached keyboard. Yes, it takes some small time to get used with those new keyboards but it’s not something annoying. It took me two meetings to be intermediate level Surface keyboard gangsta.</p> <h3>Battery</h3> <p>Alhtough one of my friends faced bad issues with Surface RT battery time I have had no problems with Surface RT battery. If I don’t do anything that keeps CPU heavily loaded the battery lasts around two-three days for me. Of course, I have companion tool called Windows Phone 8 because Windows RT has no support for SIM-card.</p> <p>Charger is weird creature by Microsoft and it’s impossible to get it somewhere if you are not in country where Surface RT is not available. There are no normal chargers or USB charging possible and this is something I consider as bad fail of Microsoft – if being online is mandatory for you when travelling then you still have to take some more fool-proof device for you.</p> <h3>Storage</h3> <p>I have heard many complaints about how Windows RT takes too much disk space on Surface. Well… it’s still dual operating system that is able to run some of your known applications from regular Windows and it comes with RT version of Office. Of course, it all takes some room.</p> <p><img title="SanDisk Mobile Ultra 64GB" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: right; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 5px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="SanDisk Mobile Ultra 64GB" align="right" src="http://gunnarpeipman.com/wp-content/uploads/2013/06/sandisk-mobile-ultra-64gb.png" width="150" height="119">Solution to problem is simple – you can buy MicroSD card to extend storage and keep big files on card. Current MicroSD cards provide disk space up to 64GB and Microsoft has told that they have made no limits to size of MicroSD. If you find some bigger MicroSD that has same communication interface as smaller ones have then it should work fine with Surface RT. </p> <p>I bought 64GB MicroSD and still I have a lot of room available on main disk and on MicroSD. I think more and more that whining about disk space is just whining and it doesn’t come from real use.</p> <h3>Working on Surface RT</h3> <p>Now let’s focus on some work stuff too. I decided for Surface RT after considering many factors. I need access to my systems, I need to communicate with my teams and customers and I must be able to work with documents. This far Surface RT is served me well on following things:</p> <ul> <li>accessing <strong>Jira OnDemand</strong> to monitor tasks and issues for current systems</li> <li>accessing <strong>SharePoint on Office365</strong> where we host our project sites</li> <li>using <strong>Skype</strong> – experience is damn kinky but it works</li> <li>I can work with <strong>e-mails</strong> using e-mail application for Metro, it’s very primitive but it works so I get everything done</li> <li><strong>Office documents</strong> – yes, I can work wih Word, Excel and PowerPoint – applications are not as powerful as their full versions but I can still get my work done</li> <li><strong>OneNote</strong> for touch – I’m using it to protocol customer meetings (damn convenient – just type your memos and when you are back on your work machine your memo is already waiting there)</li> <li><strong>Remote Desktop</strong> – yes, Surface RT comes with Remote Desktop and if needed I can access my servers from Surface RT (not very convenient due to small screen but it works well)</li> <li><strong>SkyDrive</strong> – yes, I can work with files on cloud and as most of my stuff is on cloud then SkyDrive is great help for me</li></ul> <p>There are some things I’m not very happy with. SharePoint client integration is missing, Office applications on RT are not very touch oriented and OneNote is missing many text formatting options or at least I have not found these. These issues are not show stoppers but they take time to get around.</p> <h3>Conclusion</h3> <p>Surface RT is not replacement for laptop. It is companion tool that is somewhere between laptop and smart phone and if you treat it like this then you will be happy with it. If you want replacement to your laptop then you have to buy the new laptop. This far Surface RT has been great help on my business trips and it also helps me when I have out-from-office days. I can most important things done, I can keep up communication with teams and customers and I can manage my servers. Cloud integration makes working with same files on different devices very convenient. If you need just device that helps you to keep up business side of your office then Surface RT is very good choice.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="Creating gadget-like blocks for Windows Home Server 2011 web add-in user interface" href="http://gunnarpeipman.com/2012/02/creating-gadget-like-blocks-for-windows-home-server-2011-web-add-in-user-interface/" rel="bookmark">Creating gadget-like blocks for Windows Home Server 2011 web add-in user interface</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Running SharePoint on Windows 7" href="http://gunnarpeipman.com/2009/05/running-sharepoint-on-windows-7/" rel="bookmark">Running SharePoint on Windows 7</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Windows 7 on my development machine" href="http://gunnarpeipman.com/2009/01/windows-7-on-my-development-machine/" rel="bookmark">Windows 7 on my development machine</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="List of Microsoft training kits" href="http://gunnarpeipman.com/2012/10/list-of-microsoft-training-kits-2/" rel="bookmark">List of Microsoft training kits</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Visual Studio 2010: How to crash Windows 7" href="http://gunnarpeipman.com/2009/05/visual-studio-2010-how-to-crash-windows-7/" rel="bookmark">Visual Studio 2010: How to crash Windows 7</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/surface-rt/">Surface RT&ndash;first impressions</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/C4Nv8pVwqFo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/surface-rt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/surface-rt/</feedburner:origLink></item>
		<item>
		<title>How my company uses Windows Azure in development process</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/yna5d1iPZXI/</link>
		<comments>http://gunnarpeipman.com/2013/06/how-my-company-uses-windows-azure-in-development-process/#comments</comments>
		<pubDate>Wed, 12 Jun 2013 07:31:00 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1564</guid>
		<description><![CDATA[<p>I have used MSDN Ultimate Windows Azure benefit from the day it was made available and from this day I have more and more used Windows Azure on my everyday’s development work. I’m building mostly web-based applications and services and Windows Azure fits well for this scenario. In this posting I will introduce you how Windows Azure supports development work in practice of one small software company.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/how-my-company-uses-windows-azure-in-development-process/">How my company uses Windows Azure in development process</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>I have used MSDN Ultimate <a href="http://www.windowsazure.com/">Windows Azure</a> benefit from the day it was made available and from this day I have more and more used Windows Azure on my everyday’s development work. I’m building mostly web-based applications and services and Windows Azure fits well for this scenario. In this posting I will introduce you how Windows Azure supports development work in practice of one small software company.</p><span id="more-1564"></span><h3>Why Windows Azure?</h3> <p>This is the first question that developers from other companies ask me when they hear about my heavy use of Windows Azure. I have experiences from past – based on server and shared hosting – and I can say that Windows Azure makes my life way easier. Main reasons are here:</p> <ul> <li><strong>no hardware costs</strong> – I don’t have to rent or buy servers, I don’t have to monitor their physical health and it’s not my responsibility to buy more hardware, replace broken parts or buying new machines when old ones need to be retired,</li> <li><strong>no maintenance costs</strong> – I don’t have to spend my time on deploying updates, make fancy configuration changes and other administrative work I had to buy in before or in the case of over-shared shared hosting I had to have endless discussions with tech support to get test sites run at normal speed,</li> <li><strong>no backups – </strong>what’s on cloud will stay on cloud – I don’t have to worry about installing my systems again when some environment crashes because it is up to Windows Azure service to keep my machines alive and backed up,</li> <li><strong>control over server</strong> – something you don’t get with shared hosting is control over server environment – on Windows Azure I can access my virtual machines over Remote Desktop to detect problems or made some simple configuration changes,</li> <li><strong>small or zero expenses</strong>- if you have small company and you have MSDN Ultimate subscription you have Windows Azure as part of your development environment for free (of course, if you spend more resources than the amount included to your MSDN benefit you must pay).</li></ul> <blockquote> <p><strong>From practice. </strong>Windows Azure, by costs, is somewhere between shared and server hosting. Comparing calculations are not easy to do because when calculating expenses on your side you have to consider also people’s work related to supporting servers, operating systems etc. It’s possible you have cheaper model worked out. I’m owner of small company and I’m only happy when price and outcome are in very good balance.</p></blockquote> <p>It is easy to involve Windows Azure to your development processes and once it’s done you will definitely enjoy it.</p> <h3>Scenarios for Windows Azure</h3> <p>For me the most important scenarios in development processes where Windows Azure comes in are as follows:</p> <ul> <li><strong>test environments</strong> – on test environments we do in-house or team testing,</li> <li><strong>public test environments</strong> – here are also customers involved,</li> <li><strong>demo environments</strong> – do demo our systems to possible new customers.</li></ul> <p>For all of these scenarios I like one common characteristic – it’s fire and forget deployment. </p> <blockquote> <p><strong>From practice.</strong> All these environments are important to us and other people who are involved in our work. Stability and availability must be very good and this is where Windows Azure is the best choice for us. We don’t need endless discussions and negotiations with tech support of services anymore – if we need more resources we can buy what we need.</p></blockquote> <h3>Deployments to cloud environment</h3> <p>Deploying systems to cloud environment is damn easy. You can use Visual Studio for it and if you like to automate things then you can also use MS Build and PowerShell. Here are possible options for deployments:</p> <ul> <li>Cloud projects on Visual Studio,</li> <li>PowerShell scripts to build and deployment packages,</li> <li>MS Deploy – works also for Windows Azure web sites,</li> <li>Integration with Team Foundation Services.</li></ul> <blockquote> <p><strong>From practice.</strong> I’m using mostly cloud projects and to some compute instances we deploy more than one separate system with one shot. We are using special deployment projects that include folder for each separate system and these systems are deployed to folders using Visual Studio file deployment. When systems are deployed to folders we run cloud deployment project that moves all new stuff to cloud. <strong>We do it around 4-5 times per day and preparation for deployment takes only some minutes,</strong></p></blockquote> <h3>Database deployments</h3> <p>With systems we must also deploy their databases. In most cases SQL Azure web database is more than enough for us. Visual Studio makes it extremely easy to deploy database updates from database to Visual Studio database project and from database project to different database. </p> <p>It’s also possible to use database deployments where database is recreated before deployment. Test data can be part of database project – you can use post-deployment scripts to pump test data to database. There’s nothing complex. Just spend some hours on playing with database projects and you are there.</p> <p>You can find some reading about database projects here:</p> <ul> <li><a href="http://gunnarpeipman.com/2013/01/using-visual-studio-database-projects-in-real-life/">Using Visual Studio database projects in real life</a></li> <li><a href="http://gunnarpeipman.com/2013/06/using-visual-studio-database-post-deployment-scripts-in-practice/">Using Visual Studio database post-deployment scripts in practice</a></li> <li><a href="http://gunnarpeipman.com/2010/12/comparing-and-updating-database-schemas-using-visual-studio-2010/">Comparing and updating database schemas using Visual Studio 2010</a></li></ul> <blockquote> <p><strong>From practice. </strong>Visual Studio database projects are very powerful tool to synchronize changes between databases. Of course, it’s not silver bullet that solves all your problems but still it’s very good result if database deployment takes you couple of minutes instead of hours of manual update. <strong>SQL Azure</strong> is also supported, just make sure you set SQL Azure as target database.</p></blockquote> <h3>Architectural changes in applications</h3> <p>Now comes the most complex part – in-premises and shared hosting applications are not usually built to handle file system, sessions and cache as services. If you write simple web applications then Windows Azure Web Sites should be enough for you – similar to shared hosting and fast deployments using MS Deploy. </p> <p>For compute instances you need some tweaking. You have to build application the way that it works in shared hosting and on compute instance. This means using dependency injection to plug file access and session providers to your application depending on where it is running.</p> <blockquote> <p><strong>From practice.</strong> First time it takes time to get all those pieces together and function normally on Windows Azure. Consider two-three working days for some of your great developers for this task. When everything starts running and you have idea how things work then next times it takes you around hour to get all tweaks done for new project.</p></blockquote> <h3>Conclusion</h3> <p>I started using Windows Azure when it was young platform and over time I have reached the point where Windows Azure is mandatory service in my development processes. There are many ways how Windows Azure can support your development processes and it’s not hard to get there. Visual Studio provides you with very good tools and making some more advanced use of database projects in Visual Studio you will work also deploy your databases very fast. Your first time on building up everything described here may take time and be painful for you but when you get things running you will never want to go back.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title=".Net Service Bus: How to make training kit examples authenticate without problems" href="http://gunnarpeipman.com/2009/05/net-service-bus-how-to-make-training-kit-examples-authenticate-without-problems/" rel="bookmark">.Net Service Bus: How to make training kit examples authenticate without problems</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Software Estimation &#8211; Demystifying the Black Art" href="http://gunnarpeipman.com/2009/01/software-estimation-demystifying-the-black-art/" rel="bookmark">Software Estimation &#8211; Demystifying the Black Art</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="List of Microsoft training kits" href="http://gunnarpeipman.com/2009/06/list-of-microsoft-training-kits/" rel="bookmark">List of Microsoft training kits</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Refactoring: expose static method" href="http://gunnarpeipman.com/2009/01/refactoring-expose-static-method/" rel="bookmark">Refactoring: expose static method</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="How to become a good developer?" href="http://gunnarpeipman.com/2008/07/how-to-become-a-good-developer/" rel="bookmark">How to become a good developer?</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/how-my-company-uses-windows-azure-in-development-process/">How my company uses Windows Azure in development process</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/yna5d1iPZXI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/how-my-company-uses-windows-azure-in-development-process/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/how-my-company-uses-windows-azure-in-development-process/</feedburner:origLink></item>
		<item>
		<title>Aloha Editor–simple and easy to use WYSIWYG editor</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/mqLt6wCQ7b0/</link>
		<comments>http://gunnarpeipman.com/2013/06/aloha-editor/#comments</comments>
		<pubDate>Sun, 09 Jun 2013 22:06:00 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1552</guid>
		<description><![CDATA[<p>Some sites need simple WYSIWYG editor just to provide some simple formatting options for some texts. I needed editor like this on one of my ASP.NET MVC projects. Although there are lot of editors and it is not hard to build your own simple editor I took Aloha Editor. Let’s see why.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/aloha-editor/">Aloha Editor&ndash;simple and easy to use WYSIWYG editor</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[Some sites need simple WYSIWYG editor just to provide some simple formatting options for some texts. I needed editor like this on one of my ASP.NET MVC projects. Although there are lot of editors and it is not hard to build your own simple editor I took <a href="http://aloha-editor.org/">Aloha Editor</a>. Let’s see why.<span id="more-1552"></span><p align="center"><a title="Aloha Editor" href="http://aloha-editor.org/"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Aloha Editor" border="0" alt="Aloha Editor" src="http://gunnarpeipman.com/wp-content/uploads/2013/06/aloha-editor.png" width="678" height="302" /></a></p>  <p>If you go to <a href="http://aloha-editor.org/">Aloha Editor homepage</a> you will find working example of editor and example HTML page with JavaScript that works as simple getting started guide. It took me couple of minutes to add Aloha Editor to my page and get it working.</p>  <h3>Configure on page, use from CDN</h3>  <p>You can include Aloha Editor files from their CDN and configure editor on your page. This is the block of JavaScript from my page:</p>  <hr />  <pre style="line-height: normal; width: auto; font-family: ; background: white; color: ; overflow: visible"><font face="Consolas"><span style="color: "><font color="#006400"><font style="font-size: 9.8pt">&lt;!-- load the Aloha Editor core and some plugins --&gt;</font></font></span><font style="font-size: 9.8pt"><br /><span style="color: "><font color="#0000ff">&lt;</font></span><span style="color: "><font color="#800000">script</font></span><font color="#000000">&#160;</font><span style="color: "><font color="#ff0000">src</font></span><font color="#0000ff"><span style="color: ">=</span><span style="color: ">&quot;http://cdn.aloha-editor.org/latest/lib/aloha.js&quot;</span></font><br /><font color="#000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color: "><font color="#ff0000">data-aloha-plugins</font></span><span style="color: "><font color="#0000ff">=</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#0000ff"><span style="color: ">&quot;common/ui,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; common/format,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; common/list,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; common/link,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; common/table,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; common/highlighteditables&quot;</span><span style="color: ">&gt;</span><br /><span style="color: ">&lt;/</span></font><span style="color: "><font color="#800000">script</font></span></font><span style="color: "><font style="font-size: 9.8pt" color="#0000ff">&gt;</font></span></font></pre>

<hr />

<p>Notice how easy it is to say what functions you want to plug to editor. I mean even beginners should be able to get this editor work with no markable problems.</p>

<h3>Visible only when needed</h3>

<p>Here is one text field where simple HTML editing is needed:</p>

<p align="center"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Aloha Editor: Text area for description editing" border="0" alt="Aloha Editor: Text area for description editing" src="http://gunnarpeipman.com/wp-content/uploads/2013/06/aloha-text-in-editor.png" width="463" height="548" /></p>

<p>When I move mouse to text area to start editing text then Aloha toolbar appears:</p>

<p align="center"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Aloha Editor: Toolbar is visible only when needed" border="0" alt="Aloha Editor: Toolbar is visible only when needed" src="http://gunnarpeipman.com/wp-content/uploads/2013/06/aloha-text-with-editor.png" width="609" height="623" /></p>

<p>Toolbar is lightweight and doesn’t take space on screen when it is not needed. Toolbar like this leaves way more space for content on screen and it allows to focus better on information on form.</p>

<h3>Conclusion</h3>

<p>Aloha Editor is small, compact and easy to use. It may save markable amount of space on views where more than one WYSIWYG editor is needed. Files can be included from Aloha CDN and this way it possible to save some traffic and keep load of server lower. JavaScript you must add to your pages is short, simple and easy to understand. Alhtough I have been Aloha user for some hours I am very happy with it.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="ASP.NET MVC 3: Intranet Application template" href="http://gunnarpeipman.com/2011/04/asp-net-mvc-3-intranet-application-template/" rel="bookmark">ASP.NET MVC 3: Intranet Application template</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Programming Windows Identity Foundation" href="http://gunnarpeipman.com/2011/03/programming-windows-identity-foundation/" rel="bookmark">Programming Windows Identity Foundation</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="ASP.NET MVC&ndash;How to show asterisk after required field label" href="http://gunnarpeipman.com/2012/06/asp-net-mvchow-to-show-asterisk-after-required-field-label/" rel="bookmark">ASP.NET MVC&ndash;How to show asterisk after required field label</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Just released: WHS YouTube Downloader beta" href="http://gunnarpeipman.com/2012/02/just-released-whs-youtube-downloader-beta/" rel="bookmark">Just released: WHS YouTube Downloader beta</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed" href="http://gunnarpeipman.com/2010/10/deploying-asp-net-mvc-3-web-application-to-server-where-asp-net-mvc-3-is-not-installed/" rel="bookmark">Deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/aloha-editor/">Aloha Editor&ndash;simple and easy to use WYSIWYG editor</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/mqLt6wCQ7b0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/aloha-editor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/aloha-editor/</feedburner:origLink></item>
		<item>
		<title>Better solution for ASP.NET MVC checkbox list</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/BmKGhqYdmAo/</link>
		<comments>http://gunnarpeipman.com/2013/06/better-solution-for-asp-net-mvc-checkbox-list/#comments</comments>
		<pubDate>Fri, 07 Jun 2013 08:48:31 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1560</guid>
		<description><![CDATA[<p>Couple of years ago I worked out my first solution for checkbox list in ASP.NET MVC. Today I got some markable simplifications done and my solution is close to state where some nice-to-have tweaks can be done to add more automatics to controller side but solution is also good enough how it is like now. Let’s see how to get checkbox list functionality done with couple of simple steps.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/better-solution-for-asp-net-mvc-checkbox-list/">Better solution for ASP.NET MVC checkbox list</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Couple of years ago I worked out my first solution for checkbox list in ASP.NET MVC. Today I got some markable simplifications done and my solution is close to state where some nice-to-have tweaks can be done to add more automatics to controller side but solution is also good enough how it is like now. Let’s see how to get checkbox list functionality done with couple of simple steps.</p><span id="more-1560"></span><h3>References</h3> <p>This is not required topic. It’s here just to track previous steps of story so I can later remember where this solution came from.</p> <ul> <li><a href="http://gunnarpeipman.com/2011/05/asp-net-mvc-implementing-checkboxlist/">ASP.NET MVC: Implementing CheckBoxList</a>  <li><a href="http://gunnarpeipman.com/2011/05/asp-net-mvc-getting-selected-values-from-checkboxlist/">ASP.NET MVC: Getting selected values from CheckBoxList</a>  <li><a href="http://gunnarpeipman.com/2011/11/asp-net-mvc-converting-business-objects-to-select-list-items/">ASP.NET MVC: Converting business objects to select list items</a> </li></ul> <p>Main problems with previous solution were the facts that generating list of items for checkbox list and making updates to changed collection later were not very well implemented and these implementations didn’t defined simple enough interface to use for front-end developers.</p> <h3><img title="Events and tags" style="float: right; margin: 0px 0px 0px 10px; display: inline" alt="Events and tags" align="right" src="http://gunnarpeipman.com/wp-content/uploads/2013/05/event-tags-model.png">Solution</h3> <p>In big picture our solution is simple (think that we create tag list for event):</p> <ol> <li>We will create base class for business of model classes that we can use in controllers – it depends on your architecture.  <li>We will write extension method that creates list of all tags and selects the ones that were already chosen.  <li>We will write extension method to HtmlHelper that displays checkbox list to user. This extension method is used in view.  <li>We weill write extension method to update event tags collection when user clicks save button in view. </li></ol> <p>It means that our solution has three generic interfacing points:</p> <ol> <li>Create data source for checkbox list  <li>Display checkbox list  <li>Update data source </li></ol> <p>It is possible to go further and find the ways how to automate update process to move updating functionality to model binder by example but I don’t stop on tweaks like this here because I have no good idea right now if these tweaks make any good or are they just nice things that turn out to be too confusing for end users.</p> <h3>Base class for business or model classes</h3> <p>Before we implement full checkbox list functionality we need some preparations. My solution is not ideally generic and it has some requirements to avoid complex logic that involves reflection and smart code-level decisions. I don’t go deeper here as anyway you see later why we made this step.</p> <p>Whatever you use in your MVC application – domain classes or mapped models – we need something static where we can link extension methods we will write at later steps. I’m using Entity Framework with POCO-s and this solution makes some use of Entity Framework features that maybe other mappers doesn’t support this way.</p> <p>My base class for business classes is as follows:</p> <p> <hr />  <pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><span style="color: "><font color="#0000ff"><font style="font-size: 9.8pt">public</font></font></span><font style="font-size: 9.8pt"><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">abstract</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">class</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">BaseEntity</font></span><br /></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000">{<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">int</font></span><font color="#000000"> Id { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span><font color="#000000">; }<br />}</font></font></font></pre>
<p>
<hr />


<p>And here is example business class:</p>
<p>
<hr />

<pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><span style="color: "><font color="#0000ff"><font style="font-size: 9.8pt">public</font></font></span><font style="font-size: 9.8pt"><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">class</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">Event</font></span><font color="#000000"> : </font><span style="color: "><font color="#2b91af">BaseEntity</font></span></font></font><font style="font-size: 9.8pt"><font face="Consolas"><font color="#000000">&nbsp;<br />{<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span></font><font face="Consolas"><font color="#000000"> Event()<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">this</font></span><font color="#000000">.Tags = </font><span style="color: "><font color="#0000ff">new</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">HashSet</font></span><font color="#000000">&lt;</font><span style="color: "><font color="#2b91af">Tag</font></span></font><font face="Consolas"><font color="#000000">&gt;();<br />&nbsp;&nbsp;&nbsp; }<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">string</font></span><font color="#000000"> Title { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000"> DateTime Begins { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000"> DateTime Ends { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">string</font></span><font color="#000000"> Description { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">string</font></span><font color="#000000"> Url { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">string</font></span><font color="#000000"> TitleForUrl { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">string</font></span><font color="#000000"> Abstract { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">int</font></span><font color="#000000"> Clicks { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">virtual</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">ICollection</font></span><font color="#000000">&lt;</font><span style="color: "><font color="#2b91af">Tag</font></span><font color="#000000">&gt; Tags { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font><font face="Consolas"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">virtual</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">ICollection</font></span><font color="#000000">&lt;</font><span style="color: "><font color="#2b91af">Party</font></span><font color="#000000">&gt; Vendors { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000">; }<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">virtual</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">ICollection</font></span><font color="#000000">&lt;</font><span style="color: "><font color="#2b91af">Party</font></span><font color="#000000">&gt; Organizers { </font><span style="color: "><font color="#0000ff">get</font></span><font color="#000000">; </font><span style="color: "><font color="#0000ff">set</font></span><font color="#000000">; }<br />}</font></font></font></pre>
<p>
<hr />


<p>You can define also abstract property like DisplayName for business base class to make sure that all business classes have string presentation understandable to humans. But this is not very important fact here.</p>
<h3>Creating source for checkbox list</h3>
<p>Next step is to prepare data for checkbox list. We need two things:</p>
<ol>
<li>Collection of items that can be selected 
<li>Collection of items that must be shown as selected </li></ol>
<p>By example, when we want to let user select tags for some event we need list of all tags to show and list of current tags to know what tags exactly must be shown as selected.</p>
<p>To meet these needs I wrote simple extension method to business base class type of collections:</p>
<p>
<hr />

<pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><span style="color: "><font color="#0000ff"><font style="font-size: 9.8pt">public</font></font></span><font style="font-size: 9.8pt"><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">static</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">IEnumerable</font></span><font color="#000000">&lt;</font><span style="color: "><font color="#2b91af">SelectListItem</font></span><font color="#000000">&gt; ToCheckBoxListSource&lt;T&gt;(</font><span style="color: "><font color="#0000ff">this</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">IEnumerable</font></span><font color="#000000">&lt;T&gt; checkedCollection, <br /></font><span style="color: "><font color="#2b91af">                                          IEnumerable</font></span><font color="#000000">&lt;T&gt; allCollection) <br />                                          </font><span style="color: "><font color="#0000ff">where</font></span><font color="#000000"> T : </font><span style="color: "><font color="#2b91af">BaseEntity</font></span><br /></font></font><font style="font-size: 9.8pt"><font face="Consolas"><font color="#000000">{<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span><font color="#000000"> result = </font><span style="color: "><font color="#0000ff">new</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">List</font></span><font color="#000000">&lt;</font><span style="color: "><font color="#2b91af">SelectListItem</font></span></font><font face="Consolas"><font color="#000000">&gt;();<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">foreach</font></span><font color="#000000"> (</font><span style="color: "><font color="#0000ff">var</font></span><font color="#000000"> allItem </font><span style="color: "><font color="#0000ff">in</font></span></font><font face="Consolas"><font color="#000000"> allCollection)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span><font color="#000000"> selectItem = </font><span style="color: "><font color="#0000ff">new</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">SelectListItem</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selectItem.Text = allItem.ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selectItem.Value = allItem.Id.ToString();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selectItem.Selected = (checkedCollection.Count(c =&gt; c.Id == allItem.Id) &gt; 0);<br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result.Add(selectItem);<br />&nbsp;&nbsp;&nbsp; }<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">return</font></span><font color="#000000"> result;<br />}</font></font></font></pre>
<p>
<hr />


<p>This method creates list of SelectListItems for allCollection and uses checkedCollection to find out if current item must be displayed as checked or not. Example of controller comes below.</p>
<h3>Displaying checkbox list</h3>
<p>Now as we have data for checkbox list we can focus on displaying it. I created simple extension method for HtmlHelper so we can display checkbox list like any other control on edit form.</p>
<p>
<hr />

<pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><span style="color: "><font color="#0000ff"><font style="font-size: 9.8pt">public</font></font></span><font style="font-size: 9.8pt"><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">static</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">MvcHtmlString</font></span><font color="#000000"> CheckBoxList(</font><span style="color: "><font color="#0000ff">this</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">HtmlHelper</font></span><font color="#000000"> helper, </font><span style="color: "><font color="#0000ff">string</font></span><font color="#000000"> name, <br />                                         </font><span style="color: "><font color="#2b91af">IEnumerable</font></span><font color="#000000">&lt;</font><span style="color: "><font color="#2b91af">SelectListItem</font></span></font></font><font style="font-size: 9.8pt"><font face="Consolas"><font color="#000000">&gt; items)<br />{<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span><font color="#000000"> output = </font><span style="color: "><font color="#0000ff">new</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">StringBuilder</font></span></font><font face="Consolas"><font color="#000000">();<br />&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">@"&lt;div class=""checkboxList""&gt;"</font></span></font><font face="Consolas"><font color="#000000">);<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">foreach</font></span><font color="#000000"> (</font><span style="color: "><font color="#0000ff">var</font></span><font color="#000000"> item </font><span style="color: "><font color="#0000ff">in</font></span></font><font face="Consolas"><font color="#000000"> items)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">@"&lt;input type=""checkbox"" name="""</font></span></font><font face="Consolas"><font color="#000000">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(name);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">"\" value=\""</font></span></font><font face="Consolas"><font color="#000000">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(item.Value);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">"\""</font></span></font><font face="Consolas"><font color="#000000">);<br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">if</font></span></font><font face="Consolas"><font color="#000000"> (item.Selected)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">@" checked=""checked"""</font></span></font><font face="Consolas"><font color="#000000">);<br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">" /&gt;"</font></span></font><font face="Consolas"><font color="#000000">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(item.Text);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">"&lt;br /&gt;"</font></span></font><font face="Consolas"><font color="#000000">);<br />&nbsp;&nbsp;&nbsp; }<br /> <br />&nbsp;&nbsp;&nbsp; output.Append(</font><span style="color: "><font color="#a31515">"&lt;/div&gt;"</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000">);<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">return</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">new</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">MvcHtmlString</font></span><font color="#000000">(output.ToString());<br />}</font></font></font></pre>
<p>
<hr />


<p>As you can see here I chose pretty safe data source for checkbox list. We use safe collection of SelectListItems that makes no calls to database. Also it doesn’t have any additional logic involved behind the scenes.</p>
<h3>Saving changes back to collection</h3>
<p>When user saves data checkbox list is sent to controller as array of integers. We have to update some collection of business object and make sure we don’t confuse mapper anyhow. We have to add items that are currently missing from collection and remove items that are not needed anymore.</p>
<blockquote>
<p><strong>NB! </strong>It is easier to clear collection and add selected values back there but this is not safe thing to do. Mappers handle this move differently and you may introduce negative side effects in code this way. By example, mapper may delete all current event tags and insert them back again.</p></blockquote>
<p>Now we have second place where we need base class to make collection updating functionality available for all business classes. For collection updating I wrote this extension method:</p>
<p>
<hr />

<pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><span style="color: "><font color="#0000ff"><font style="font-size: 9.8pt">public</font></font></span><font style="font-size: 9.8pt"><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">static</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#0000ff">void</font></span><font color="#000000"> UpdateCollectionFromModel&lt;T&gt;(</font><span style="color: "><font color="#0000ff">this</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">ICollection</font></span><font color="#000000">&lt;T&gt; domainCollection, <br />                                                </font><span style="color: "><font color="#2b91af">IQueryable</font></span><font color="#000000">&lt;T&gt; objects, </font><span style="color: "><font color="#0000ff">int</font></span><font color="#000000">[] newValues) <br />                                                </font><span style="color: "><font color="#0000ff">where</font></span><font color="#000000"> T : </font><span style="color: "><font color="#2b91af">BaseEntity</font></span><br /></font></font><font style="font-size: 9.8pt"><font face="Consolas"><font color="#000000">{<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">if</font></span><font color="#000000"> (newValues == </font><span style="color: "><font color="#0000ff">null</font></span></font><font face="Consolas"><font color="#000000">)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainCollection.Clear();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">return</font></span></font><font face="Consolas"><font color="#000000">;<br />&nbsp;&nbsp;&nbsp; }<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">for</font></span><font color="#000000"> (</font><span style="color: "><font color="#0000ff">var</font></span></font><font face="Consolas"><font color="#000000"> i = domainCollection.Count - 1; i &gt;= 0; i--)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span></font><font face="Consolas"><font color="#000000"> domainObject = domainCollection.ElementAt(i);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">if</font></span></font><font face="Consolas"><font color="#000000"> (!newValues.Contains(domainObject.Id))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainCollection.Remove(domainObject);<br />&nbsp;&nbsp;&nbsp; }<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">foreach</font></span><font color="#000000"> (</font><span style="color: "><font color="#0000ff">var</font></span><font color="#000000"> newId </font><span style="color: "><font color="#0000ff">in</font></span></font><font face="Consolas"><font color="#000000"> newValues)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span></font><font face="Consolas"><font color="#000000"> domainObject = domainCollection.FirstOrDefault(t =&gt; t.Id == newId);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">if</font></span><font color="#000000"> (domainObject != </font><span style="color: "><font color="#0000ff">null</font></span></font><font face="Consolas"><font color="#000000">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">continue</font></span></font><font face="Consolas"><font color="#000000">;<br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainObject = objects.FirstOrDefault(t =&gt; t.Id == newId);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">if</font></span><font color="#000000"> (domainObject == </font><span style="color: "><font color="#0000ff">null</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">continue</font></span><font color="#000000">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainCollection.Add(domainObject);<br />&nbsp;&nbsp;&nbsp; }<br />}</font></font></font></pre>
<p>
<hr />


<p>This extension method takes collection we need to update, query of all objects that can be added to collection and selected id values from model. It uses these parameters to make safe updates to collection of business object.</p>
<h3>Using checkbox list</h3>
<p>Now let’s focus on how to use checkbox list. I’m using my old good <a href="http://gunnarpeipman.com/2011/04/creating-tag-cloud-using-asp-net-mvc-and-entity-framework/">event tags example</a> for this. Both of these classes use BaseEntity as their base class.</p>
<p>Now let’s go through event editing flow in ASP.NET MVC application.</p>
<h4>1. Display edit form</h4>
<p>We display event in edit mode and provide view with model that has also list of tags. Some of these tags are selected because I selected some of these before.</p>
<p>
<hr />

<pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><font color="#000000"><font style="font-size: 9.8pt">[</font></font><font style="font-size: 9.8pt"><span style="color: "><font color="#2b91af">HttpGet</font></span><font color="#000000">]</font><br /><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">ActionResult</font></span><font color="#000000"> Edit(</font><span style="color: "><font color="#0000ff">int</font></span></font></font><font style="font-size: 9.8pt"><font face="Consolas"><font color="#000000"> id)<br />{<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span></font><font face="Consolas"><font color="#000000"> evt = Context.Events.FirstOrDefault(e =&gt; e.Id == id);<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">if</font></span><font color="#000000"> (evt == </font><span style="color: "><font color="#0000ff">null</font></span></font><font face="Consolas"><font color="#000000">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">return</font></span><font color="#000000"> HttpNotFound(</font><span style="color: "><font color="#a31515">"Cannot find event with id "</font></span></font><font face="Consolas"><font color="#000000"> + id);<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span><font color="#000000"> model = </font><span style="color: "><font color="#0000ff">new</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">AdminEventEditModel</font></span></font><font face="Consolas"><font color="#000000">();<br />&nbsp;&nbsp;&nbsp; model.AllTags = evt.Tags.ToCheckBoxListSource(Context.Tags);<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#2b91af">Mapper</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000">.Map(evt, model);<br /> <br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">return</font></span><font color="#000000"> View(model);<br />}</font></font></font></pre>
<p>
<hr />


<h4>2. Display checkbox list</h4>
<p>In view we have to display checkbox list to user.</p>
<p>
<hr />

<pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><span style="color: "><font color="#0000ff"><font style="font-size: 9.8pt">&lt;</font></font></span><font style="font-size: 9.8pt"><span style="color: "><font color="#800000">div</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#ff0000">class</font></span><font color="#0000ff"><span style="color: ">=</span><span style="color: ">"editor-label"</span><span style="color: ">&gt;</span></font><br /><font color="#000000">&nbsp;&nbsp;&nbsp; <span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%"><font style="background-color: #ffff00">@</font></span>Html.LabelFor(model =&gt; model.TagIds)</font><br /><span style="color: "><font color="#0000ff">&lt;/</font></span><span style="color: "><font color="#800000">div</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#0000ff"><span style="color: ">&gt;</span><br /><span style="color: ">&lt;</span></font><span style="color: "><font color="#800000">div</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#ff0000">class</font></span><font color="#0000ff"><span style="color: ">=</span><span style="color: ">"editor-field"</span><span style="color: ">&gt;</span></font><br /><font color="#000000">&nbsp;&nbsp;&nbsp; <span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%"><font style="background-color: #ffff00">@</font></span>Html.CheckBoxList(</font><span style="color: "><font color="#a31515">"TagIds"</font></span><font color="#000000">, Model.AllTags)</font><br /><span style="color: "><font color="#0000ff">&lt;/</font></span><span style="color: "><font color="#800000">div</font></span></font><span style="color: "><font style="font-size: 9.8pt" color="#0000ff">&gt;</font></span></font></pre>
<p>
<hr />


<p>This is just simple call to our extensions method.</p>
<h4>3. Updating tags collection</h4>
<p>When user saves event then selected tags are returned as array of integers. We need current event, tags collection and selected tags id-s to update tags collection of event.</p>
<p>
<hr />

<pre style="overflow: visible; font-family: ; background: white; color: ; line-height: normal; width: auto"><font face="Consolas"><font color="#000000"><font style="font-size: 9.8pt">[</font></font><font style="font-size: 9.8pt"><span style="color: "><font color="#2b91af">HttpPost</font></span><font color="#000000">]</font><br /><span style="color: "><font color="#0000ff">public</font></span><font color="#000000">&nbsp;</font><span style="color: "><font color="#2b91af">ActionResult</font></span><font color="#000000"> Edit(</font><span style="color: "><font color="#2b91af">AdminEventEditModel</font></span></font></font><font style="font-size: 9.8pt"><font face="Consolas"><font color="#000000"> model)<br />{<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#008000">// ...</font></span><br /><font color="#000000">&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">var</font></span></font><font face="Consolas"><font color="#000000"> evt = Context.Events.FirstOrDefault(e =&gt; e.Id == model.Id);<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">if</font></span><font color="#000000"> (evt == </font><span style="color: "><font color="#0000ff">null</font></span></font><font face="Consolas"><font color="#000000">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#0000ff">return</font></span><font color="#000000"> HttpNotFound(</font><span style="color: "><font color="#a31515">"Cannot find event with id "</font></span></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000"> + model.Id);<br /> <br />&nbsp;&nbsp;&nbsp; evt.Tags.UpdateCollectionFromModel(Context.Tags, model.TagIds);<br />&nbsp;&nbsp;&nbsp; Context.SaveChanges();<br />&nbsp;&nbsp;&nbsp; </font><span style="color: "><font color="#008000">// ...</font></span><br /><font color="#000000">}</font></font></font></pre>
<p>
<hr />


<p>Now we have all flow of checkbox list covered.</p>
<h3>Conclusion</h3>
<p>I was not hard to build extension methods to implement checkbox list functionality. We had to use base class to write generic extension methods that cover whole domain. We also wrote method to generate data source for checkbox list, method to display it and method to update event tags collection later. We ended up with three extension methods – one for every step in flow. The solution is simple and common enough to use it in real projects.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="ASP.NET 4.0: Writing custom output cache providers" href="http://gunnarpeipman.com/2009/11/asp-net-4-0-writing-custom-output-cache-providers/" rel="bookmark">ASP.NET 4.0: Writing custom output cache providers</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="ASP.NET 4.0: How to use application warm-up class" href="http://gunnarpeipman.com/2010/01/asp-net-4-0-how-to-use-application-warm-up-class/" rel="bookmark">ASP.NET 4.0: How to use application warm-up class</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="5 minutes WIF: Make your ASP.NET application use test-STS" href="http://gunnarpeipman.com/2011/02/5-minutes-wif-make-your-asp-net-application-use-test-sts/" rel="bookmark">5 minutes WIF: Make your ASP.NET application use test-STS</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Free ASP.NET 4.0 beta hosting available" href="http://gunnarpeipman.com/2009/06/free-asp-net-4-0-beta-hosting-available/" rel="bookmark">Free ASP.NET 4.0 beta hosting available</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Using conditionals in ASP.NET data binding expressions" href="http://gunnarpeipman.com/2010/04/using-conditionals-in-asp-net-data-binding-expressions/" rel="bookmark">Using conditionals in ASP.NET data binding expressions</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/better-solution-for-asp-net-mvc-checkbox-list/">Better solution for ASP.NET MVC checkbox list</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/BmKGhqYdmAo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/better-solution-for-asp-net-mvc-checkbox-list/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/better-solution-for-asp-net-mvc-checkbox-list/</feedburner:origLink></item>
		<item>
		<title>Using client certificates on Windows Azure</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/LbNKJdvc-ZM/</link>
		<comments>http://gunnarpeipman.com/2013/06/using-client-certificates-on-windows-azure/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 23:30:00 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1497</guid>
		<description><![CDATA[<p>In one of current projects we needed to deploy one Windows Azure site that supports SSL and requires client certificates. Until it’s just about deploying SSL site wo Windows Azure there’s nothing complex but when modifying IIS settings is required then some coding is needed. Here is the example.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/using-client-certificates-on-windows-azure/">Using client certificates on Windows Azure</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[In one of current projects we needed to deploy one Windows Azure site that supports SSL and requires client certificates. Until it’s just about deploying SSL site wo Windows Azure there’s nothing complex but when modifying IIS settings is required then some coding is needed. Here is the example.<span id="more-1497"></span><h3>Overview</h3>  <p>With cloud project it is possible to set up everything needed to deploy SSL site to compute instance (certificates, end points, host headers etc). Changing of IIS settings during or after deployment is not so easy. Start-up script that you can specify in cloud service definition file is run before sites are set up on IIS and the only way to modify IIS settings seems to be the moment when web role starts.</p>  <blockquote>   <p><strong>NB!</strong> In this posting I expect that you already know how to deploy SSL site to Windows Azure and you are familiar with service definition and configuration files. You can find more from Windows Azure page <a href="http://www.windowsazure.com/en-us/develop/net/common-tasks/enable-ssl/">Configuring SSL for an application in Windows Azure</a>. </p> </blockquote>  <h3>Solution</h3>  <p>As a solution we make changes to IIS configuration when web role starts. For this moment sites on IIS are set up and we can access them. To access site settings we need library for IIS management and elevated privileges for web role. Under these conditions we can modify site settings.</p>  <h4>1. Reference Microsoft.Web.Administration</h4>  <p>Right click on web application and add NuGet reference to Microsoft.Web.Administration package.</p>  <p align="center"><a href="http://gunnarpeipman.com/wp-content/uploads/2013/05/nuget-microsoft-web-administration.png"><img style="border-right-width: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px;padding-top: 0px" title="Microsoft.Web.Administration NuGet package" border="0" alt="Microsoft.Web.Administration NuGet package" src="http://gunnarpeipman.com/wp-content/uploads/2013/05/nuget-microsoft-web-administration_thumb.png" width="800" height="450" /></a></p>  <h4>2. Add WebRole entry point </h4>  <p>Add new class called WebRole.cs to web application that you want to deploy to Windows Azure. Code is taken from Manu Cohen-Yashar posting <a href="http://blogs.microsoft.co.il/blogs/applisec/archive/2013/04/07/client-certificates-in-windows-azure.aspx">Client Certificates in Windows Azure</a>.</p>  <hr />  <pre style="line-height: normal;width: auto;font-family:;background: white;color:;overflow: visible"><font face="Consolas"><span style="color:"><font color="#0000ff"><font style="font-size: 9.8pt">public</font></font></span><font style="font-size: 9.8pt"><font color="#000000">&#160;</font><span style="color:"><font color="#0000ff">class</font></span><font color="#000000">&#160;</font><span style="color:"><font color="#2b91af">WebRole</font></span><font color="#000000"> : </font><span style="color:"><font color="#2b91af">RoleEntryPoint</font></span><br /></font></font><font style="font-size: 9.8pt"><font face="Consolas"><font color="#000000">{<br />&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">public</font></span><font color="#000000">&#160;</font><span style="color:"><font color="#0000ff">override</font></span><font color="#000000">&#160;</font><span style="color:"><font color="#0000ff">bool</font></span></font><font face="Consolas"><font color="#000000"> OnStart()<br />&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">try</font></span><br /></font><font face="Consolas"><font color="#000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">using</font></span><font color="#000000"> (</font><span style="color:"><font color="#0000ff">var</font></span><font color="#000000"> server = </font><span style="color:"><font color="#0000ff">new</font></span><font color="#000000">&#160;</font><span style="color:"><font color="#2b91af">ServerManager</font></span></font><font face="Consolas"><font color="#000000">())<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">var</font></span><font color="#000000"> siteNameFromServiceModel = </font><span style="color:"><font color="#a31515">&quot;Web&quot;</font></span><font color="#000000">; </font><span style="color:"><font color="#008000">// TODO: update this site name for your site. </font></span><br /><font color="#000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">var</font></span><font color="#000000"> siteName = </font><span style="color:"><font color="#0000ff">string</font></span><font color="#000000">.Format(</font><span style="color:"><font color="#a31515">&quot;{0}_{1}&quot;</font></span><font color="#000000">, </font><span style="color:"><font color="#2b91af">RoleEnvironment</font></span></font><font face="Consolas"><font color="#000000">.CurrentRoleInstance.Id, siteNameFromServiceModel);<br /></font><br /><font color="#000000">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">var</font></span></font><font face="Consolas"><font color="#000000"> config = server.GetApplicationHostConfiguration();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">var</font></span><font color="#000000"> accessSection = config.GetSection(</font><span style="color:"><font color="#a31515">&quot;system.webServer/security/access&quot;</font></span></font><font face="Consolas"><font color="#000000">, siteName);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; accessSection[</font><span style="color:"><font color="#a31515">&quot;sslFlags&quot;</font></span><font color="#000000">] = </font><span style="color:"><font color="#a31515">@&quot;Ssl,SslRequireCert&quot;</font></span></font><font face="Consolas"><font color="#000000">;<br /> <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; server.CommitChanges();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">catch</font></span><font color="#000000"> (</font><span style="color:"><font color="#2b91af">Exception</font></span></font><font face="Consolas"><font color="#000000"> ex)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#008000">// handle error here</font></span><br /></font></font><font face="Consolas"><font style="font-size: 9.8pt"><font color="#000000"><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font><span style="color:"><font color="#0000ff">return</font></span><font color="#000000">&#160;</font><span style="color:"><font color="#0000ff">base</font></span><font color="#000000">.OnStart();<br />&#160;&#160;&#160; }<br />}</font></font></font></pre>

<hr />

<p>If you need different settings for SSL then take a look at <a href="http://www.iis.net/configreference/system.webserver/security/access">SSL flags list in IIS.NET</a>.</p>

<h4>3. Run web role in elevated privileges</h4>

<p>Now open ServiceDefinition.csdef file from your Windows Azure deployment project and add the following XML there:</p>

<hr />

<pre style="line-height: normal;width: auto;font-family:;background: white;color:;overflow: visible"><font face="Consolas"><span style="color:"><font color="#0000ff"><font style="font-size: 9.8pt">&lt;</font></font></span><font style="font-size: 9.8pt"><span style="color:"><font color="#a31515">Runtime</font></span><span style="color:"><font color="#0000ff">&#160;</font></span><span style="color:"><font color="#ff0000">executionContext</font></span><span style="color:"><font color="#0000ff">=</font></span><font color="#000000">&quot;</font><span style="color:"><font color="#0000ff">elevated</font></span><font color="#000000">&quot;</font></font><span style="color:"><font style="font-size: 9.8pt" color="#0000ff"> /&gt;</font></span></font><br /></pre>

<hr />

<p>Insert it right below &lt;WebRole&gt; node.</p>

<p>Now you are ready to build your solution and try out if deployment works as expected.</p>

<blockquote>
  <p><strong>NB! </strong>Before deploying SSL site to Windows Azure make sure you have certificates uploaded and DNS settings done. Otherwise you may face hard to debug errors and there is no free official tech support anymore.</p>
</blockquote>

<p>If everything went well then you should see the following screen when opening your Windows Azure IIS settings over remote desktop:</p>

<p align="center"><a href="http://gunnarpeipman.com/wp-content/uploads/2013/05/windows-azure-ssl-client-certificate.png"><img style="border-bottom: 0px;border-left: 0px;padding-left: 0px;padding-right: 0px;border-top: 0px;border-right: 0px;padding-top: 0px" title="IIS on Windows Azure uses SSL and required client certificates" border="0" alt="IIS on Windows Azure uses SSL and required client certificates" src="http://gunnarpeipman.com/wp-content/uploads/2013/05/windows-azure-ssl-client-certificate_thumb.png" width="704" height="480" /></a></p>

<p>Same way you can also modify all other IIS settings for your web role.</p>

<h3>Conclusion</h3>

<p>As start-up scripts run in some too early phase of deployment we cannot use them to modify site settings as IIS site is not deployed yet. We were able to use web role start method to make changes to IIS. We used spacial Microsoft.Web.Administration library to keep code simple. Maybe it’s not the best way how to do things but it works in most cases and I was able to deploy the site that authenticates users using Estonian ID-card.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="ASP.NET MVC: Showing dates using DayCalendarPage extension method" href="http://gunnarpeipman.com/2011/05/asp-net-mvc-showing-dates-using-daycalendarpage-extension-method/" rel="bookmark">ASP.NET MVC: Showing dates using DayCalendarPage extension method</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Using Moq to mock ASP.NET MVC HttpContextBase" href="http://gunnarpeipman.com/2011/07/using-moq-to-mock-asp-net-mvc-httpcontextbase/" rel="bookmark">Using Moq to mock ASP.NET MVC HttpContextBase</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Windows Azure Developer Porta screenshots" href="http://gunnarpeipman.com/2009/04/windows-azure-developer-portal-screenshots/" rel="bookmark">Windows Azure Developer Porta screenshots</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="ASP.NET MVC: Using jQuery context menu with tables" href="http://gunnarpeipman.com/2010/05/asp-net-mvc-using-jquery-context-menu-with-tables/" rel="bookmark">ASP.NET MVC: Using jQuery context menu with tables</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Using dynamic type to test ASP.NET MVC controller actions returning JsonResult" href="http://gunnarpeipman.com/2010/07/using-dynamic-type-to-test-asp-net-mvc-controller-actions-returning-jsonresult/" rel="bookmark">Using dynamic type to test ASP.NET MVC controller actions returning JsonResult</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/using-client-certificates-on-windows-azure/">Using client certificates on Windows Azure</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/LbNKJdvc-ZM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/using-client-certificates-on-windows-azure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/using-client-certificates-on-windows-azure/</feedburner:origLink></item>
		<item>
		<title>Windows Azure updates, new services and MSDN benefits</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/PUk_e35vYHs/</link>
		<comments>http://gunnarpeipman.com/2013/06/windows-azure-updates/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 09:00:00 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1546</guid>
		<description><![CDATA[<p>As Microsoft is on the wave of launching new stuff then next load of updates is  for Windows Azure. New services, updates, new features and some nice surprises for those who have Windows Azure as MSDN subscription benefit. Also there is something for enterprises interested in private Windows Azure. For those who want to learn more about Windows Azure there is Windows Azure Training Kit May 2013 update available.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/windows-azure-updates/">Windows Azure updates, new services and MSDN benefits</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[As Microsoft is on the wave of launching new stuff then next load of updates is&nbsp; for Windows Azure. New services, updates, new features and some nice surprises for those who have Windows Azure as MSDN subscription benefit. Also there is something for enterprises interested in private Windows Azure. For those who want to learn more about Windows Azure there is <a href="http://www.microsoft.com/en-us/download/details.aspx?id=8396">Windows Azure Training Kit May 2013 update</a> available.&nbsp;<span id="more-1546"></span><h3>General Windows Azure updates</h3> <ol> <li><strong>Develop/test in the cloud</strong>  <ul> <li>No Charge for Stopped VMs  <li>Pay by the Minute Billing  <li>MSDN Use Rights now supported on Windows Azure  <li>Heavily Discounted MSDN Dev/Test Rates  <li>MSDN Monetary Credits  <li>Portal Support for Better Tracking MSDN Monetary Credit Usage </li></ul> <li><strong>BizTalk Services</strong> – EDI and EAI in the cloud, nice addition to service bus. Find out more <a href="http://www.windowsazure.com/en-us/manage/services/biztalk-services/">here</a>.  <li><strong>Per-Minute Billing and No Charge for Stopped VMs -</strong> no compute charges for stopped VMs  <li><strong>SSL Support with Web Sites</strong> – yes, we have no full SSL support on Web Sites and we can even use SNI  <li><strong>Active Directory</strong>: Updated directory sync utility, ability to manage Office 365 directory tenants from Windows Azure Management Portal  <li><strong>Free Trial</strong>: More flexible Free Trial offer &#8211; With a free trial, you now get a monthly Windows Azure credit of $200. This credit can be applied to any service of your choice</li></ol> <p>Find out more from ScottGu blog post <a href="http://weblogs.asp.net/scottgu/archive/2013/06/03/windows-azure-announcing-new-dev-test-offering-biztalk-services-ssl-support-with-web-sites-ad-improvements-per-minute-billing.aspx">Windows Azure: Announcing New Dev/Test Offering, BizTalk Services, SSL Support with Web Sites, AD Improvements, Per Minute Billing</a>.</p> <h3>New MSDN benefits</h3> <ol> <li>No Charge for Stopped VMs  <li>Pay by the Minute Billing  <li>MSDN Use Rights now Supported on Windows Azure (run your MSDN software on Windows Azure virtual machines)  <li>Heavily Discounted MSDN Dev/Test Rates  <li>MSDN Monthly Monetary Credits  <li>Portal Support for Better Tracking MSDN Monetary Credit Usage</li></ol> <p>More about MSDN benefits and good overview of financial stuff can be found from ScottFGu blog post <a href="http://weblogs.asp.net/scottgu/archive/2013/06/03/windows-azure-announcing-major-improvements-for-dev-test-in-the-cloud.aspx">Windows Azure: Announcing Major Improvements for Dev/Test in the Cloud</a>.</p> <h3>Windows Azure Pack</h3> <p><a href="http://www.microsoft.com/en-us/server-cloud/windows-azure-pack.aspx">Windows Azure Pack</a> is something for companies who want to host Windows Azure on their own infrastructure. As far as I know it’s great help for companies and governments who doesn’t want USA agencies to have access to their data. With Windows Azure Pack infrastructure is offered by some Microsoft partner and Microsoft just manages Windows Azure on partner infrastructure for customers. This way Microsoft is just service provider and not service hoster.</p> <p>Windows Azure Pack contains the following components:</p> <ul> <li>Management portal  <li>Service management programming interface  <li>Web sites service  <li>Virtual machines service  <li>Service bus</li></ul> <p>Find out more from Mary Jo Foley’s article <a href="http://www.zdnet.com/microsoft-finds-a-new-way-to-deliver-a-private-cloud-in-a-box-7000016279/">Microsoft finds a new way to deliver a private cloud in a box</a>. </p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="Connecting to Windows Azure web role instance using Remote Desktop" href="http://gunnarpeipman.com/2010/12/connecting-to-windows-azure-web-role-instance-using-remote-desktop/" rel="bookmark">Connecting to Windows Azure web role instance using Remote Desktop</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Windows Azure Error: Failed to start Storage Emulator: the SQL Server instance &lsquo;localhost\SQLExpress&rsquo; could not be found" href="http://gunnarpeipman.com/2011/11/windows-azure-error-failed-to-start-storage-emulator-the-sql-server-instance-localhostsqlexpress-could-not-be-found/" rel="bookmark">Windows Azure Error: Failed to start Storage Emulator: the SQL Server instance &lsquo;localhost\SQLExpress&rsquo; could not be found</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Windows Azure: Debug and redeploy your web applications quickly" href="http://gunnarpeipman.com/2010/12/windows-azure-debug-and-redeploy-your-web-applications-quickly/" rel="bookmark">Windows Azure: Debug and redeploy your web applications quickly</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Solving Azure configuration problems" href="http://gunnarpeipman.com/2009/03/solving-azure-configuration-problems/" rel="bookmark">Solving Azure configuration problems</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Windows Azure development storage and StorageServerException (Error 500)" href="http://gunnarpeipman.com/2012/10/windows-azure-development-storage-and-storageserverexception-error-500/" rel="bookmark">Windows Azure development storage and StorageServerException (Error 500)</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/windows-azure-updates/">Windows Azure updates, new services and MSDN benefits</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/PUk_e35vYHs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/windows-azure-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/windows-azure-updates/</feedburner:origLink></item>
		<item>
		<title>TFS 2013 Team Rooms</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/rr4A_MmvpLI/</link>
		<comments>http://gunnarpeipman.com/2013/06/tfs-2013-team-rooms/#comments</comments>
		<pubDate>Tue, 04 Jun 2013 07:00:00 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[TFS]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1545</guid>
		<description><![CDATA[<p>One new feature that is coming with Team Foundation Server 2013 and this is already available on Team Foundation Service is called Team Rooms. Team Rooms are virtual rooms where team members can communicate with each other. Logs are saved by date and this way all important direct communication is there also for later dates.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/tfs-2013-team-rooms/">TFS 2013 Team Rooms</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>One new feature that is coming with Team Foundation Server 2013 and this is already available on <a href="http://tfs.visualstudio.com/">Team Foundation Service</a> is called Team Rooms. Team Rooms are virtual rooms where team members can communicate with each other. Logs are saved by date and this way all important direct communication is there also for later dates.</p><span id="more-1545"></span><p align="center"><a href="http://gunnarpeipman.com/wp-content/uploads/2013/06/tfs-team-room.png"><img title="TFS 2013 Team Room" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="TFS 2013 Team Room" src="http://gunnarpeipman.com/wp-content/uploads/2013/06/tfs-team-room_thumb.png" width="902" height="460"></a><br /><em>TFS 2013: Example Team Room with some chat.<br />Click on image to view it at original size.</em></p> <p>Room reminds a little bit web based IRC client built to SharePoint but it seems to be pretty good idea to get started with extending TFS with direct team communication. As it is early preview then there are not much to highlight yet but as Build conference is coming I’m sure Microsoft has some surprises for us.</p> <h3>Team Room features</h3> <p>Here are current features:</p> <ul> <li>#Taskid in char creates link to task with given number (take a look at #29 at screenshot above – it’s link to task umber 29)</li> <li>If you want to make message to somebody more easy to notice then use @username at chat and user with give user name will see his or her name highlighted (take look at line that starts with orange @gunnar at screenshot)</li> <li>You can browse chat by date. There’s dropdown calendar on top of chat window.</li> <li>If somebody writes messages then browser beeps. You can click on megaphone icon to turn off beeping.</li></ul> <p>As this is fresh preview and sometimes I see TFS error messages there I’m sure that Microsoft came out with limited set on things to show in Team Room chat. Over next weeks I hope to see more stuff coming to feed.</p> <h3>Speculations</h3> <p>As Team Foundation Service seems to run on SharePoint and make use of new application model I think it’s possible to integrate Yammer style feeds to TFS and enable also team document in-place reviews, notifications about new commits, task changes etc. Also search would be nice to have because teams who start really using Team Rooms every day need chat search very soon. I see here a lot of room for improvements and integrations. One interesting scenario would be integration with Office365 SharePoint to get project documents to chat. </p> <h3>Conclusion</h3> <p>TFS Team Rooms is new interesting chat feature that helps teams to communicate real-time and keep chat logs. Today the solution offered as part of Team Foundation Services is simple and easy to get started. Although there is room enough for tons of interesting features today is the first day of new service and I hope we will see many more features coming over next weeks.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="ExpectedException attribute in Visual Studio 2008 and Visual Studio 2010" href="http://gunnarpeipman.com/2009/07/expectedexception-attribute-in-visual-studio-2008-and-visual-studio-2010/" rel="bookmark">ExpectedException attribute in Visual Studio 2008 and Visual Studio 2010</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Code Contracts: Unit testing contracted code" href="http://gunnarpeipman.com/2010/05/code-contracts-unit-testing-contracted-code/" rel="bookmark">Code Contracts: Unit testing contracted code</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="ASP.NET MVC installer for Visual Studio 2010 Beta 1" href="http://gunnarpeipman.com/2009/06/asp-net-mvc-installer-for-visual-studio-2010-beta-1/" rel="bookmark">ASP.NET MVC installer for Visual Studio 2010 Beta 1</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Making CopySourceAsHtml add-on work with VS2010" href="http://gunnarpeipman.com/2011/11/making-copysourceashtml-add-on-work-with-vs2010/" rel="bookmark">Making CopySourceAsHtml add-on work with VS2010</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Windows Azure error: An unsupported response was received. The response header &#8216;MSDeploy.Response&#8217; was &#8221; but &#8216;v1&#8242; was expected." href="http://gunnarpeipman.com/2011/12/windows-azure-error-an-unsupported-response-was-received-the-response-header-msdeploy-response-was-but-v1-was-expected/" rel="bookmark">Windows Azure error: An unsupported response was received. The response header &#8216;MSDeploy.Response&#8217; was &#8221; but &#8216;v1&#8242; was expected.</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/tfs-2013-team-rooms/">TFS 2013 Team Rooms</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/rr4A_MmvpLI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/tfs-2013-team-rooms/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/tfs-2013-team-rooms/</feedburner:origLink></item>
		<item>
		<title>Visual Studio 2013 announced!</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/nw1_fGm6x_Q/</link>
		<comments>http://gunnarpeipman.com/2013/06/visual-studio-2013-announced/#comments</comments>
		<pubDate>Mon, 03 Jun 2013 18:19:15 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1542</guid>
		<description><![CDATA[<p>Today at TechEd Brian Harry announced Visual Studio 2013, Team Foundation Server 2013 and new ALM features. Some new features are also available on Team Foundation Service. Preview versions of VS2013 and TFS2013 will be available during Build conference later this month.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/visual-studio-2013-announced/">Visual Studio 2013 announced!</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Today at TechEd Brian Harry announced Visual Studio 2013, Team Foundation Server 2013 and new ALM features. Some new features are also available on Team Foundation Service. Preview versions of VS2013 and TFS2013 will be available during Build conference later this month.</p><span id="more-1542"></span><p>Main features:</p> <ul> <li>Agile portfolio management</li> <li>Updates to Team Explorer and version control</li> <li>Lightweigh code commenting</li> <li>Indicators in code editor to find easily more information about code objects</li> <li>Creatig and modifying test plans, suites and shared steps on the web</li> <li>Cloud load testing</li> <li>Acquired InRelease software for release management</li> <li>Team collaboration and conversations</li></ul> <p align="center"><img title="Code indicators at Visual Studio 2013" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; border-left: 0px; display: block; padding-right: 0px; margin-right: auto" border="0" alt="Code indicators at Visual Studio 2013" src="http://gunnarpeipman.com/wp-content/uploads/2013/06/simple-product-repository.png" width="626" height="312"><em>Code indicators at Visual Studio 2013.</em></p> <p>Read more from Brian’s blof posting <a href="http://blogs.msdn.com/b/bharry/archive/2013/06/03/visual-studio-2013.aspx">Visual Studio 2013</a>.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="Comparing and updating database schemas using Visual Studio 2010" href="http://gunnarpeipman.com/2010/12/comparing-and-updating-database-schemas-using-visual-studio-2010/" rel="bookmark">Comparing and updating database schemas using Visual Studio 2010</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Solution Navigator: Killer replacement for Solution Explorer" href="http://gunnarpeipman.com/2010/07/solution-navigator-killer-replacement-for-solution-explorer/" rel="bookmark">Solution Navigator: Killer replacement for Solution Explorer</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Visual Studio 2010: UML modeling projects" href="http://gunnarpeipman.com/2009/11/visual-studio-2010-uml-modeling-projects/" rel="bookmark">Visual Studio 2010: UML modeling projects</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Visual Studio 2010 SP1 Beta supports IIS Express" href="http://gunnarpeipman.com/2010/12/visual-studio-2010-sp1-beta-supports-iis-express/" rel="bookmark">Visual Studio 2010 SP1 Beta supports IIS Express</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Entity Framework 4.0: Generating SQL script from model" href="http://gunnarpeipman.com/2009/07/entity-framework-4-0-generating-sql-script-from-model/" rel="bookmark">Entity Framework 4.0: Generating SQL script from model</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/visual-studio-2013-announced/">Visual Studio 2013 announced!</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/nw1_fGm6x_Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/visual-studio-2013-announced/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/visual-studio-2013-announced/</feedburner:origLink></item>
		<item>
		<title>Using Visual Studio database post-deployment scripts in practice</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/UPbEUzlBf8I/</link>
		<comments>http://gunnarpeipman.com/2013/06/using-visual-studio-database-post-deployment-scripts-in-practice/#comments</comments>
		<pubDate>Sun, 02 Jun 2013 22:18:00 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1492</guid>
		<description><![CDATA[<p>Visual Studio database projects support database post-deployment scripts you can use to make additional modifications to database or to insert some test data. In my work I use database projects and post-deployment scripts very often. In this posting I will introduce you how to use post-deployment scripts to make dealing with database and data easier for developers.</p><p>The post <a href="http://gunnarpeipman.com/2013/06/using-visual-studio-database-post-deployment-scripts-in-practice/">Using Visual Studio database post-deployment scripts in practice</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://gunnarpeipman.com/2013/01/using-visual-studio-database-projects-in-real-life/">Visual Studio database projects</a> support database post-deployment scripts you can use to make additional modifications to database or to insert some test data. In my work I use database projects and post-deployment scripts very often. In this posting I will introduce you how to use post-deployment scripts to make dealing with database and data easier for developers.</p><span id="more-1492"></span><h3>Life-cycle of post-deployment script</h3> <p>Post-deployment script, like any other thing under development, has its own life-cycle. The following diagram shows how the process goes.</p> <p align="center"><img title="Life-cycle of database post-deployment script" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin: 20px auto; display: block; padding-right: 0px; border-top-width: 0px" border="0" alt="Life-cycle of database post-deployment script" src="http://gunnarpeipman.com/wp-content/uploads/2013/05/post-deployment-script-cycle.png" width="484" height="388"></p> <p>Steps are as follows:</p> <ol> <li>Developer makes modification to database, by example developer adds new table and some new relations.  <li>System code is modified to reflect changes in database.  <li>Modifications are tested to make sure that functionality is not broken.  <li>Data for new table is added to post-deployment script.  <li>Database deployment with post-deployment script is run on developer machine to make sure that database deployment works. Of course, it’s only good idea to try also code out after changes to post-deployment script.</li></ol> <p>Post-deployment script changes mostly with database but there is one exception – over time test data is replaced by real or at least close-to-reality data and after these changes post-deployment script must be tested again.</p> <h3>Post-deployment script must be up to date</h3> <p>If post-deployment script is not updated with database then soon it will live its own life and it gets more and more out from synch with database. As post-deployment script doesn’t work anymore then developers start keeping their current copy of database and make only structural updates there. Soon it turns to fear against database deployments as more and more issues raise when database must be deployed again. And, of course, after every deployment all data must be inserted to database again.</p> <p>Up to date post-deployment script has some serious benefits:</p> <ul> <li>Developers are more brave when working with database,  <li>Deployment and data related errors come out early.  <li>All developers have up to date version of database and test data – they don’t waste time to fix problems related to some earlier version of database that is deprecated.  <li>It is easy to deploy database with test data also to other environments like test server, continuous integration server etc.  <li>Typical problem of customer – do I have to insert this data again after update – is solved once and forever.</li></ul> <h3>What if some guys refuse to use database scripts?</h3> <p>Do they also refuse to write quality code? I mean how they can do their job if the only way to get up to date database is to deploy this database to their development machines? </p> <p>If they refuse to use last version of database and data then the quality of their code comes down, they spend a lot of time on fighting with newer codebase and their current database incompatibility problems and soon they probably understand that they get badly stuck this way. </p> <p>Okay, even if they move fast there’s still problem – other team members move way faster with their tasks. </p> <h3>Post-deployment script in practice</h3> <p>I’m using database projects with post-deployment scripts almost in all active projects. Post-deployment script helps me to be sure that developers work on with latest data and if latest data introduces problems then they can focus on solving these problems because these problems have high appearing probability on test and staging environments.</p> <p>Usual post-deployment script managing activities are these:</p> <ul> <li>Make sure database deployments with data succeed.  <li>Solve all database deployment problems ASAP – don’t stop developers work.  <li>If customer has added new important data to test database then migrate this data to post-deployment script.</li></ul> <p>These steps doesn’t waste your time a lot and same time you keep development smoothly running.</p> <h3>Getting started</h3> <p>Actually database projects and post-deployment scripts are not something complex and huge. Play with them a little bit and try to use them with some sample application to get better idea how to use them. Of couse, if you have DBA in your team then also tell him what you are planning and find out together how he can support developers work.</p> <p>In the beginning it’s all new for team – give them some time to get used with new tools and if possible then organize them small in-house training with practical examples. This way you can get also valuable input from developers that makes whole process easier for everybody.</p> <h3>Conclusion</h3> <p>Visual Studio database projects that provide fresh data to developers have worked for me very well. Although it’s not something you can start right on minute it still has a lot of benefits you don’t want to miss. Making life with database and data easier for developers helps them save time for coding and also guys who are responsible for deployments are happy because they can do everything way faster than before.</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="SQL Server 2008 Reporting Services&ndash;get nice reports quickly" href="http://gunnarpeipman.com/2008/04/sql-server-2008-reporting-servicesget-nice-reports-quickly/" rel="bookmark">SQL Server 2008 Reporting Services&ndash;get nice reports quickly</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Hiding loggers implementations using Unity" href="http://gunnarpeipman.com/2009/03/hiding-loggers-implementations-using-unity/" rel="bookmark">Hiding loggers implementations using Unity</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Visual Studio Extension: Save UML diagram as image" href="http://gunnarpeipman.com/2010/09/visual-studio-extension-save-uml-diagram-as-image/" rel="bookmark">Visual Studio Extension: Save UML diagram as image</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Documenting source code" href="http://gunnarpeipman.com/2009/08/documenting-source-code/" rel="bookmark">Documenting source code</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Visual Studio 2008: No ASP.NET MVC items shown in Add New Item dialog" href="http://gunnarpeipman.com/2009/06/visual-studio-2008-no-asp-net-mvc-items-shown-in-add-new-item-dialog/" rel="bookmark">Visual Studio 2008: No ASP.NET MVC items shown in Add New Item dialog</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/06/using-visual-studio-database-post-deployment-scripts-in-practice/">Using Visual Studio database post-deployment scripts in practice</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/UPbEUzlBf8I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/06/using-visual-studio-database-post-deployment-scripts-in-practice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/06/using-visual-studio-database-post-deployment-scripts-in-practice/</feedburner:origLink></item>
		<item>
		<title>Understanding exceptions artistic way</title>
		<link>http://feedproxy.google.com/~r/gunnarpeipman/~3/LpjQ6jvPQw8/</link>
		<comments>http://gunnarpeipman.com/2013/05/understanding-exceptions-artistic-way/#comments</comments>
		<pubDate>Sun, 26 May 2013 09:39:40 +0000</pubDate>
		<dc:creator>Gunnar</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://gunnarpeipman.com/?p=1489</guid>
		<description><![CDATA[<p>Finding out reason of bug in code is not always easy thing to do. But it can be extremely hard if you have no idea what do with information that exceptions provide you. In this posting I introduce you weird artistic handling of exceptions and unfortunately this story comes from real life.</p><p>The post <a href="http://gunnarpeipman.com/2013/05/understanding-exceptions-artistic-way/">Understanding exceptions artistic way</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[Finding out reason of bug in code is not always easy thing to do. But it can be extremely hard if you have no idea what do with information that exceptions provide you. In this posting I introduce you weird artistic handling of exceptions and unfortunately this story comes from real life.<span id="more-1489"></span><p>Years ago I had honor to witness one debugging session where one lengthy method threw NullReferenceException. It was actually one SharePoint form or web part that threw exception and the exption message was shown to user. The developer who worked on debugging this form or web part had also stack trace available for exception. One more thing to mention – two years of experience on .NET and university degree in software development were also written to CV of this guy.</p> <p>Let’s start. NullReferenceException means that code is trying to use some object that is null. When attaching debugger to process then it is easy to step through problematic method and find out where exception occurs. </p> <p>But what I saw was something new to me – the guy was just watching the message and then looking at different parts of source code to find out <strong>where</strong> things can go wrong. No, he was not investigating this one method but whole code in solution. Why is he doing something like this and why takes solving of this problem more time than half of day?</p> <p>Well, here is how exception can be understood:</p> <p align="center"><img title="Exception - important and technical information" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="Exception - important and technical information" src="http://gunnarpeipman.com/wp-content/uploads/2013/05/exception-info.png" width="507" height="182"><br /><em>This is just arbitrary exception I stole somewhere from web.</em></p> <ul> <li><strong>important information</strong> – this is the information that gives us details about bug and based on this information all debugging can be done,</li> <li><strong>technical information</strong> – is… well… just techinal information like you can see when operating system crashes or ATM goes mad or your tablet has hardware fault – it is there, it is important but it’s just this technical information like all technical information everywhere else (maybe somebody needs it some day).</li></ul> <p>Of course, after short lecture about exceptions the problem got solved with ten minutes but the memory remains…</p><div class="SPOSTARBUST-Related-Posts"><H3>Related Posts</H3><ul class="entry-meta"><li class="SPOSTARBUST-Related-Post"><a title="Code Metrics: Measuring LoC in .NET applications" href="http://gunnarpeipman.com/2010/02/code-metrics-measuring-loc-in-net-applications/" rel="bookmark">Code Metrics: Measuring LoC in .NET applications</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Authenticating programmatically to Exchange Server 2003 FBA" href="http://gunnarpeipman.com/2008/12/authenticating-programmatically-to-exchange-server-2003-fba/" rel="bookmark">Authenticating programmatically to Exchange Server 2003 FBA</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Refactoring: extract method" href="http://gunnarpeipman.com/2009/01/refactoring-extract-method/" rel="bookmark">Refactoring: extract method</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Invariant code contracts &ndash; using class-wide contracts" href="http://gunnarpeipman.com/2010/05/invariant-code-contracts-using-class-wide-contracts/" rel="bookmark">Invariant code contracts &ndash; using class-wide contracts</a></li>
<li class="SPOSTARBUST-Related-Post"><a title="Displaying custom HTML in WebBrowser control" href="http://gunnarpeipman.com/2009/08/displaying-custom-html-in-webbrowser-control/" rel="bookmark">Displaying custom HTML in WebBrowser control</a></li>
</ul></div><p>The post <a href="http://gunnarpeipman.com/2013/05/understanding-exceptions-artistic-way/">Understanding exceptions artistic way</a> appeared first on <a href="http://gunnarpeipman.com">Gunnar Peipman -  Programming Blog</a>.</p><img src="http://feeds.feedburner.com/~r/gunnarpeipman/~4/LpjQ6jvPQw8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gunnarpeipman.com/2013/05/understanding-exceptions-artistic-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gunnarpeipman.com/2013/05/understanding-exceptions-artistic-way/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 1.756 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-06-19 11:16:32 --><!-- Compression = gzip -->
