tag:blogger.com,1999:blog-84834760781290169102024-02-20T01:20:07.871+02:00Odes to human lazinessSergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-8483476078129016910.post-67829021945272358072012-11-26T15:44:00.004+02:002012-11-26T20:10:16.597+02:00Подготовка к сдаче экзамена 70-480: Developing in HTML5 with JavaScript and CSS3<div>
С гордостью сообщаю, что сегодня я сдал экзамен <a href="http://www.microsoft.com/learning/en/us/exam.aspx?id=70-480">70-480: Developing in HTML5 with JavaScript and CSS3</a>, набрав 880 баллов из 1000. Хотелось бы поделиться опытом подготовки к сдаче этого экзамена. На мой взгляд, данный экзамен интересен по ряду причин:</div>
<div>
<ul>
<li>Cейчас его можно сдать абсолютно бесплатно по ваучеру <b>HTMLJMP</b>;</li>
<li>Сдача этого экзамена является одним из условий для получения сертификата <a href="http://www.microsoft.com/learning/en/us/certification/cert-mcsd-web-applications.aspx">MCSD: Web Applications</a>.</li>
</ul>
</div>
<h3>
Немного о моем опыте в HTML, JavaScript и CSS</h3>
<div>
Основным профилем для меня является ASP.NET. Как и большинству ASP.NET-разработчиков, часто приходится иметь дело с мордой веб-сайта (front-end). Суммарный опыт в разработке с использованием HTML, JavaScript и CSS весьма обширен и растянут по времени (около 5 лет). В недавнем времени ситуация резко изменилась, и последние несколько проектов были исключительно Web Applications (Single-page веб-сайт и парочка приложений для Google Chrome).</div>
<div>
При этом, как раньше, так и сейчас, ощущается нехватка четких систематизированных знаний в данной области. Собственно, основной причиной для сдачи этого экзамена для меня и является попытка систематизировать имеющиеся знания и улучшить их.</div>
<h3>
Материалы для подготовки</h3>
<div>
<ol>
</ol>
</div>
<div>
Для получения основных знаний обязательно нужно пройти интерактивный курс <a href="https://www.microsoftvirtualacademy.com/tracks/developing-html5-apps-jump-start">Developing in HTML5 with JavaScript and CSS3 Jump Start</a> (Microsoft Virtual Academy). Он обеспечит вам покрытие около <b>60%</b> всех вопросов экзамена.</div>
<div>
<br /></div>
<div>
Также в процессе подготовки вам потребуется справочная информация. Ее вы сможете найти на следующих ресурсах:</div>
<ul>
<li><a href="http://www.w3schools.com/">W3Schools</a> - материал излагается в сжатой и доступной форме;</li>
<li><a href="http://www.w3.org/">W3C</a> - всё расписано до мелочей. Рекомендую только для тех, кто хочет максимально глубоко погрузиться в спецификации;</li>
<li><a href="https://developer.mozilla.org/en-US/">Mozilla Developer Network</a> (MDN) - материал изложен не слишком сжато, но и не слишком подробно. На мой взгляд, это золотая середина.</li>
</ul>
<div>
<div>
Конечно, можно пойти лёгким путем и скачать braindump-ы с <a href="http://www.examcollection.com/70-480.html">examcollection.com</a>. Я всем рекомендую использовать braindump-ы для подготовки, но наилучший эффект достигается только тогда, когды вы используете их уже после изучения основного материала. Кроме того, у braindump-ов есть ряд недостатков:</div>
<div>
<ol>
<li>Экзамен довольно новый, и соответственно, нормальных braindump-ов по нему еще нет;</li>
<li>Нет гарантий, что даже те braindump-ы, которые есть, составлены без ошибок.</li>
</ol>
</div>
</div>
<div>
В дополнение ко всему вышеперечисленному, рекомендую пройтись по очень хорошей статье, в которой человек подробно изложил процесс подготовки по каждой отдельной секции вопросов: <a href="http://www.bloggedbychris.com/2012/09/19/microsoft-exam-70-480-study-guide/">Microsoft Exam 70-480 Study Guide</a>.<br />
<br />
Всем удачи в подготовке к экзамену и сдаче!</div>
<ul>
</ul>
<div>
<br />
<br /></div>
Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com11tag:blogger.com,1999:blog-8483476078129016910.post-12016501053395134882012-11-14T20:19:00.000+02:002012-11-15T20:32:44.844+02:00CSSDeck.com<span style="background-color: white; font-family: arial, sans-serif; font-size: 13px; line-height: 18px;">Сегодня со мной поделились <a href="http://cssdeck.com/">ссылкой </a>на интересный сервис, который во многом похож на <a href="http://jsfiddle.net/">jsfiddle.net</a>.</span><br />
<span style="background-color: white; font-family: arial, sans-serif; font-size: 13px; line-height: 18px;"><br /></span>
<span style="background-color: white; font-family: arial, sans-serif; font-size: 13px; line-height: 18px;">Кроме приятного дизайна и социальной составляющей, этот сервис обладает рядом инновационных фич. Одной из них является возможность создавать codecast`ы, которые потом можно проигрывать и шарить. При этом сохраняется возможность взаимодействовать с исходным кодом при проигрывании codecast'a</span><br />
<br style="background-color: white; font-family: arial, sans-serif; font-size: 13px; line-height: 18px;" />
<span style="background-color: white; font-family: arial, sans-serif; font-size: 13px; line-height: 18px;">А еще там можно работать совместно над одним проектом в режиме реального времени.</span><br />
<span style="background-color: white; font-family: arial, sans-serif; font-size: 13px; line-height: 18px;"><br /></span>
<span style="background-color: white; font-family: arial, sans-serif; font-size: 13px; line-height: 18px;">Вот некоторые примеры codecast'ов (для начала проигрывания нужно нажать Play):</span><br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: arial, sans-serif; font-size: x-small;"><a href="http://cssdeck.com/labs/codecast-transforming-new-microsoft-logo-into-windows-8-logo">Codecast: Transforming New Microsoft Logo Into Windows 8 Logo</a></span></span><br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: arial, sans-serif; font-size: x-small;"><a href="http://cssdeck.com/labs/lets-make-a-bouncing-ball-in-html5-canvas"> Lets Make a Bouncing Ball in HTML5 Canvas</a></span></span><br />
<span style="background-color: white; line-height: 18px;"><span style="font-family: arial, sans-serif; font-size: x-small;"><a href="http://cssdeck.com/labs/css3-stackoverflow-logo">CSS3 Stackoverflow Logo</a></span></span>Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-4810577802496045672011-11-25T15:04:00.001+02:002011-11-26T21:21:42.513+02:00MSBuild error related to missing Tracker.exe, AL.exe, LC.exe and so onToday I got some frustrating error, when I've been setting up a new project on TeamCity and tried to run it:<br />
<br />
<span class="Apple-style-span" style="color: red;">C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1835, 9): error MSB3454: Tracker.exe is required to correctly incrementally generate resources in some circumstances, such as when building on a 64-bit OS using 32-bit MSBuild. This build requires Tracker.exe, but it could not be found. The task is looking for Tracker.exe beneath the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A. To solve the problem, either: 1) Install the Microsoft Windows SDK v7.0A or later. 2) Install Microsoft Visual Studio 2010. 3) Manually set the above registry key to the correct location. Alternatively, you can turn off incremental resource generation by setting the "TrackFileAccess" property to "false".
</span>
<br />
<br />
It was a bit strange to see a reference to the Windows SDK v7.0A, because I was pretty sure that there is just v7.1 installed. Thanks to the <a href="http://stackoverflow.com/questions/2986440/msbuild-on-teamcity-server-cant-find-al-exe">stackoverwflow</a> for the solution that I found very quickly. The first (and the only in my case) thing you need to do is to tell MSBuild to use the latest version of the Windows SDK installed:<br />
<ol>
<li><b>Go to "Microsoft Windows SDK v7.1" from the Start menu</b></li>
<li><b>Select "Windows SDK 7.1 Command Prompt" and enter</b></li>
<li><b>> cd Setup</b></li>
<li><b>> WindowsSdkVer -version:v7.1</b></li>
</ol>
<div>
After this I was able to build project on the server without any problems.</div>Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com1tag:blogger.com,1999:blog-8483476078129016910.post-88083799352142345672011-08-16T13:29:00.004+03:002011-08-16T13:36:04.409+03:00How to register COM-class within the application manifest fileYou don't always need to register referenced COM-classes in the windows registry. Sometimes it's much more simple and reliable to use application manifest for referencing COM-classes. This feature is called <b>Registration-free COM</b> and well described in <a href="http://msdn.microsoft.com/en-us/magazine/cc188708.aspx">this article</a>.<br />
<div>
In few words, you can add application manifest file to you .NET application project (Add New Item -> Application Manifest File). Then you can reference COM this way:</div>
<blockquote>
<code><span style="color: black; font-family: 'Courier New'; font-size: x-small;"><span style="color: blue;"><?</span><span style="color: maroon;">xml</span> <span style="color: red;">version</span><span style="color: blue;">="1.0"</span> <span style="color: red;">encoding</span><span style="color: blue;">="utf-8"</span>?<span style="color: blue;">></span><br /><span style="color: blue;"><</span><span style="color: maroon;">asmv1:assembly</span> <span style="color: red;">manifestVersion</span><span style="color: blue;">="1.0"</span> <span style="color: red;">xmlns</span><span style="color: blue;">="urn:schemas-microsoft-com:asm.v1"</span> <span style="color: red;">xmlns:asmv1</span><span style="color: blue;">="urn:schemas-microsoft-com:asm.v1"</span> <span style="color: red;">xmlns:asmv2</span><span style="color: blue;">="urn:schemas-microsoft-com:asm.v2"</span> <span style="color: red;">xmlns:xsi</span><span style="color: blue;">="http://www.w3.org/2001/XMLSchema-instance"</span><span style="color: blue;">></span><br /> <span style="color: blue;"><</span><span style="color: maroon;">file</span> <span style="color: red;">name</span><span style="color: blue;">="MyPrivateCOM.dll"</span><span style="color: blue;">></span><br /> <span style="color: blue;"><</span><span style="color: maroon;">comClass</span> <span style="color: red;">clsid</span><span style="color: blue;">="{AC78B8E2-6C4D-11d1-ADE2-0000F8754B99}"</span> <span style="color: red;">threadingModel</span><span style="color: blue;">="Apartment"</span> <span style="color: blue;">/></span><br /> <span style="color: blue;"></</span><span style="color: maroon;">file</span><span style="color: blue;">></span><br /><span style="color: blue;"></</span><span style="color: maroon;">asmv1:assembly</span><span style="color: blue;">></span></span><br /><br /><span style="color: grey; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: grey; font-size: xx-small;">Source Code Highlighter</span></a>.</span></code></blockquote>
<div>
I provided a simplified version of the manifest file with a COM-reference only. Though, it's correct and working sample. Of course, application manifests allows to do much more than just referencing COM-classes, but it's an another big and interesting topic.</div>
Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-47019356691244747932011-03-05T14:20:00.004+02:002011-07-28T15:14:35.088+03:00How to install SQL Server Management Studio Express 2008In the SQL Server 2005 installing of <b>SSMSE </b>(SQL Server Management Studio Express) was very easy, just all about launching the installation file. In the SQL Server 2008 process of installing SSMSE is a bit different, since installation is represented as a part of the SQL Server Installation Center Utility.<br />
In order to install SSMSE 2008 you need to perform the following steps:<br />
<ol>
<li>Download the <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b">installation package</a> and launch it.</li>
<li>Click "New SQL Server stand-alone installation or add features to an existing installation".<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg60rRHagp24sOS2z_jHzGXbeDvmJPn6SG_96I-xhEBX6dY3kBuUN8lqoGIklybVoiCBQh0a7F-yMY-WnHij91GoBtNPMaCIX_u_Laj98vfN3WITjRA1CqQWYo0uw4fZccwdzvD-_ea41G6/s1600/New+SQL+Server+stand-alone+installation+or+add+featuresto+an+existion+installation.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg60rRHagp24sOS2z_jHzGXbeDvmJPn6SG_96I-xhEBX6dY3kBuUN8lqoGIklybVoiCBQh0a7F-yMY-WnHij91GoBtNPMaCIX_u_Laj98vfN3WITjRA1CqQWYo0uw4fZccwdzvD-_ea41G6/s400/New+SQL+Server+stand-alone+installation+or+add+featuresto+an+existion+installation.jpg" width="400" /></a></li>
<li>Wait untill installation setup support files and configuration checks, then click OK and Install.</li>
<li>Click "Perform a new installation of SQL Server 2008", but not "Add features to an existing instance of SQL Server 2008" (!!!).<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3PRnhjIaU8pHBFmJxo7WwseSsQXiXL_pHPwogb8uLiDyp9e7HLU1CiluJQpYEkeDH-5w-abracnr6JhJ68cMW1HM6MWEhxBfIYnFHs84GMypn5wQXy3hERGlmoiptTLzG_l1jwP1-Se9G/s1600/Preform+a+new+installation+of+SQL+Server+2008.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3PRnhjIaU8pHBFmJxo7WwseSsQXiXL_pHPwogb8uLiDyp9e7HLU1CiluJQpYEkeDH-5w-abracnr6JhJ68cMW1HM6MWEhxBfIYnFHs84GMypn5wQXy3hERGlmoiptTLzG_l1jwP1-Se9G/s400/Preform+a+new+installation+of+SQL+Server+2008.jpg" width="400" /></a></li>
<li>Click Next in the Product Key dialog even if all the options are disabled.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnOD8VvZw98uXKDV0vaf88bm4HnBYbHlczOHtEQO1oXSWsKeeaQIBZ6BA3gcEPrcmNKA05IneMFlK95tP2XiECCkI1cHoDbcdRwqNfGZ4SxokZ_1QZZ7GSWFxwgFM6m4G_rd8U5bZTvUWW/s1600/ProductKeyIgnore.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnOD8VvZw98uXKDV0vaf88bm4HnBYbHlczOHtEQO1oXSWsKeeaQIBZ6BA3gcEPrcmNKA05IneMFlK95tP2XiECCkI1cHoDbcdRwqNfGZ4SxokZ_1QZZ7GSWFxwgFM6m4G_rd8U5bZTvUWW/s400/ProductKeyIgnore.jpg" width="400" /></a></li>
<li>In the feature selection dialog enable Management Tools feature and click Next.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzvcwXNN6LD6-WtETRJo6Ma-6ihu7d_r10jDPDXGsXhcJmZze_Du4iNDNGMFA2eI2AklOzyZZTAiMvCXiWIXmhTmxgC3-vLgiNlSoEPcEt_2mP_BSmNbJr9Ii7H2hHaToweVQM-XJ2mWKs/s1600/Enable+Management+Tools+feature.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzvcwXNN6LD6-WtETRJo6Ma-6ihu7d_r10jDPDXGsXhcJmZze_Du4iNDNGMFA2eI2AklOzyZZTAiMvCXiWIXmhTmxgC3-vLgiNlSoEPcEt_2mP_BSmNbJr9Ii7H2hHaToweVQM-XJ2mWKs/s400/Enable+Management+Tools+feature.jpg" width="400" /></a></li>
<li>Wait untill installation performs an additionnal configuration checks. Then click Install. <b>Note</b>: You might receive a configuration error, if you have SQL Server 2005 Express tools already installed on the machine. In my case I removed SQL Server 2005 Express tools. But it was not enough. I also used solution provided <a href="http://social.msdn.microsoft.com/Forums/en/sqlsetupandupgrade/thread/5fc58507-9f40-4213-acbd-32a57c8822d7">here</a> (removing registry key). It was helpfull.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeGVh3-DyFp-3KH08FCohxRS8xIZuRLdmJNChzJp9Nx_TpSRLMNf0ei5kruPGMg8llY5sWpzLUeEfpQ8fXsOaUt10-uqOs5hu3Hy47Zlt0eTiOW3Z7qCwa1EjToqHzTYRCkCLP4SS4d7DV/s1600/Ready+To+Install.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeGVh3-DyFp-3KH08FCohxRS8xIZuRLdmJNChzJp9Nx_TpSRLMNf0ei5kruPGMg8llY5sWpzLUeEfpQ8fXsOaUt10-uqOs5hu3Hy47Zlt0eTiOW3Z7qCwa1EjToqHzTYRCkCLP4SS4d7DV/s400/Ready+To+Install.jpg" width="400" /></a></li>
<li>Wait untill installation completed. Enjoy!</li>
</ol>
Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-5404156025489015322010-12-16T15:45:00.001+02:002010-12-16T15:45:50.351+02:00Using RouteValueDictionary to test anonymous objects in C#For example, you have the following anonymous type declaration & instantiation:<br />
<pre style="font-family: consolas;"><span style="color: blue;">var</span> someObject = <span style="color: blue;">new</span> {<span class="Apple-style-span" style="color: purple;">someProperty</span>= <span style="color: #a31515;">"someValue"</span>};</pre>How to inspect value of the <span class="Apple-style-span" style="font-family: consolas; white-space: pre;"><span style="color: purple;">id</span></span><span class="Apple-style-span" style="font-family: consolas; white-space: pre;"> </span>property? You need a wrapper, that is able to index anonymous objects. For example, <span class="Apple-style-span" style="color: darkblue; font-family: consolas; white-space: pre;">RouteValueDictionary</span>.<br />
<br />
Here is code:<br />
<pre style="font-family: consolas;"><span style="color: blue;">var</span> wrapper = <span style="color: blue;">new</span> <span style="color: darkblue;">RouteValueDictionary</span>(someObject);
<span style="color: darkblue;">Assert</span>.<span style="color: darkcyan;">AreEqual</span>("<span class="Apple-style-span" style="color: #a31515;">someValue"</span>, wrapper[<span style="color: #a31515;">"someProperty"</span>]);</pre><div><br />
If your ASP.NET MVC controller returns <span class="Apple-style-span" style="color: darkblue; font-family: consolas; white-space: pre;">JsonResult</span>, you can use this approcah to test contents of the Data property, which usually references to some anonymous object.</div>Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-52605555698632962812010-09-09T10:50:00.004+03:002010-09-09T11:07:55.698+03:00Beyond Multiple Choice: Lab Exam Demonstration for DevelopersMicrosoft demonstrates a proof of concept for a lab that tests your hands-on development skills in the Visual Studio environment.<br />
<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/7BL2mW7XEBs&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_embedded&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/7BL2mW7XEBs&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="355"></embed></object><br />
<br />
<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/IjzVMmZI1nc&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_embedded&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/IjzVMmZI1nc&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="355"></embed></object><br />
<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/1CuMJo7tOHo&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_embedded&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/1CuMJo7tOHo&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="355"></embed></object><br />
<br />
<br />
Link: <a href="http://j.mp/cGIn69">http://j.mp/cGIn69</a>.<br />
<br />
You can leave your feedback by completing the survey at <a href="http://j.mp/beRxTG">http://j.mp/beRxTG</a>.Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-20902067569118420502010-08-20T23:01:00.003+03:002010-09-09T11:11:34.931+03:00Great ASP.NET MVC 2 (+ EF 4.0) sample<p>Recently I``ve found a great sample project on the <a href="http://codeplex.com/">codeplex</a> that shows how to build web applications with ASP.NET MVC 2. I speak about <a href="http://mvcmusicstore.codeplex.com/">MVC Music Store</a>.</p><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioF4aTgjp5VnaNFlNACwVQcq3i5xraNFG-hcQi-scOMy3he7AehSZWn6QqpR3nYM1hwpGUH9ydF4D8SAhzCXd-UqwA_BrGWM33Y4O7_KRyyKXXBeOjjIGAsM2P1_SNltPLrLdfsbV1JeWE/s1600/MVC-Music-Store-Thumb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioF4aTgjp5VnaNFlNACwVQcq3i5xraNFG-hcQi-scOMy3he7AehSZWn6QqpR3nYM1hwpGUH9ydF4D8SAhzCXd-UqwA_BrGWM33Y4O7_KRyyKXXBeOjjIGAsM2P1_SNltPLrLdfsbV1JeWE/s320/MVC-Music-Store-Thumb.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><p>First of all, this project was interesting for me because it demonstrates how to organize data access via Entity Framework 4. There are also a lot of nice stuff in this project, including:</p><ul><li>Templating, Data Annotations, Validation;</li>
<li>View models;</li>
<li>Client-side validation, jQuery and AJAX helper methods;</li>
</ul><p>Project includes 80-page PDF walktrough tutorial that describes in details how to create sample application starting from clicking File -> New Project.</p><p>You need Visual Studio 2010 and ASP.NET 4.0 to run samples.</p><p>ASP.NET MVC 2 is the latest official release at the current moment (ASP.NET MVC 3 is still under development). So, this tutorial is very actual now. I recommend it to everyone who are not familiar with ASP.NET MVC technology. Moreover, this tutorial might be useful if you would like to understand how to use Entity Framework 4 within your ASP.NET MVC website.</p>Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-68772296151224229782010-05-28T00:29:00.013+03:002010-08-23T17:16:46.221+03:00Dependency injection and Microsoft Enterprise Library validation app block<div style="text-align: justify;">Sometimes, when you use EntLib (Microsoft Enterprise Library) validation block, you may realize, that the built-in set of validators in the EntLib does not satisfy all the your needs. Of course, you can create a custom validation, inheriting from the abstract <span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: 'Segoe UI', Verdana, Arial; line-height: 18px;"><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.validator(v=VS.100).aspx" style="color: #1364c4;">Validator</a></span> and <span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: 'Segoe UI', Verdana, Arial; line-height: 18px;"><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.validationattribute(v=VS.100).aspx" style="color: #1364c4;">ValidationAttribute</a></span> classes. This is a good way to create a validation logic, that can be used in the different parts of your project. But what to do, if you need to access some business components inside of validator, which should be resolved via the dependency injection (DI) mechanism? Since the EntLib is responsible for instantiating validators instances, it doesn`t know anything about your registered dependency classes, and will not be able to resolve such dependencies. In this case you have two possible solutions:<br />
</div><ul style="text-align: justify;"><li>Access DI container via a static class, that has a reference to it;</li>
<li>Use <span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: 'Segoe UI', Verdana, Arial; line-height: 18px;"><a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.validation.validators.selfvalidationattribute(v=PandP.10).aspx" style="color: #1364c4;">SelfValidationAttribute</a></span> in the class you have to validate;<br />
</li>
</ul><div style="text-align: justify;">I do not recommend the first approach with a static class, because it makes your domain model dependent on the application infrastructure. From my point of view, the less classes know about dependency injection container - the better. The second approach is more prefferable, it is very suitable for the progressive domain models and view-models from the MV-VM pattern. All that you need to do is:<br />
</div><ol style="text-align: justify;"><li>Define in your class a public void method that takes a single <span class="Apple-style-span" style="font-family: 'Segoe UI', Verdana, Arial;">parameter of type <a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.validation.validationresults.aspx" style="color: #1364c4;">ValidationResults</a></span>;<br />
</li>
<li>Decorate this method with a <span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-family: 'Segoe UI', Verdana, Arial; line-height: normal;"><a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.validation.validators.selfvalidationattribute(v=PandP.10).aspx" style="color: #1364c4;">SelfValidationAttribute</a></span>;<br />
</li>
<li>Decorate your class with a <span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-family: 'Segoe UI', Verdana, Arial; line-height: normal;"><a ref="http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.validation.validators.hasselfvalidationattribute.aspx" style="color: #1364c4;">HasSelfValidationAttribute</a></span>;<br />
</li>
</ol><div style="text-align: justify;">Let`s consider the following example. We have a CreateProductViewModel class that is used for representing a product creation form to user. Let`s assume, that we want to deny user to create a new product, if there is a product with the same name already exists in the store database. Moreover, we want to use a business component, which is responsible for the product-related operations. Since we have a large composite application, we use a DI mechanism to provide a loosely coupled architecture and increase testability. Below you can find the code of this sample class.<br />
</div><blockquote><code><br />
<ol><span style="color: black; font-family: 'Courier New'; font-size: small;">
<li>[HasSelfValidation]</li>
<li><span style="color: blue;">public</span> <span style="color: blue;">class</span> CreateProductViewModel</li>
<li>{</li>
<li> <span style="color: blue;">private</span> <span style="color: blue;">readonly</span> IProductComponent<br />
_productComponent;<br />
</li>
<li> </li>
<li> <span style="color: blue;">public</span> CreateProductViewModel(IProductComponent productComponent)</li>
<li> {</li>
<li> _productComponent = productComponent;</li>
<li> }</li>
<li> </li>
<li> [StringLengthValidator(1, 20)]</li>
<li> <span style="color: blue;">public</span> <span style="color: blue;">string</span> ProductName { <span
style="color: blue;">get</span>; <span style="color: blue;">set</span>; }<br />
</li>
<li> </li>
<li> [SelfValidation]</li>
<li> <span style="color: blue;">public</span> <span style="color: blue;">void</span><br />
IsDuplicateProductName(ValidationResults results)<br />
</li>
<li> {</li>
<li> <span style="color: blue;">var</span> product =<br />
_productComponent.GetProductByName(ProductName);<br />
</li>
<li> </li>
<li> <span style="color: blue;">if</span> (product != <span style="color: blue;">null</span>)<br />
</li>
<li> results.AddResult(<span style="color: blue;">new</span> ValidationResult(<span style="color: #a31515;">"Product with same name already exists"</span>, <span style="color: blue;">null</span>,<br />
<span style="color: #a31515;">"ProductName"</span>,<br />
</li>
<li> <br />
<span style="color: blue;">null</span>, <span style="color: blue;">null</span>));<br />
</li>
<li> }</li>
<li>}</li>
</span></ol></code><code><span style="color: grey; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: grey; font-size: xx-small;">Source Code Highlighter</span></a>.</span></code></blockquote><div style="text-align: justify;">Here is the IsDuplicateProductName method that performs a validation logic by acquiring a product component. Product component is an instance of the class, which implements IProductComponent interface and most probably becomes resolved via the constructor dependency injection, but this is not so significant. You can get full validation results by invoking the code like this:<br />
</div><div><blockquote><code><br />
<ol><span style="color: black; font-family: 'Courier New'; font-size: small;">
<li><span style="color: blue;">var</span> validator = ValidationFactory.<br />
CreateValidatorFromAttributes<CreateProductViewModel>();<br />
</li>
<li> </li>
<li>ValidationResults results;</li>
<li>validator.Validate(createProductViewModelInstance, results);</li>
</span></ol></code><code><span style="color: grey; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: grey; font-size: xx-small;">Source Code Highlighter</span></a>.</span></code></blockquote></div>Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-48742470343558665072010-05-09T15:17:00.001+03:002010-05-28T09:42:42.447+03:00Specifying the default browser for running ASP.NET MVC projects in VS2008<div style="text-align: justify;"><span class="Apple-tab-span" style="white-space:pre"> </span>By the default Visual Studio 2008 runs web sites/applications in the Internet Explorer. When you are opening ASP.NET MVC project there is no way in the IDE to change this behaviour. So, if you want to make your ASP.NET MVC project to run in the Chrome, for example, you need to do the following:</div><div><ol><li style="text-align: justify;">Open/create a simple (non-MVC) web site in the Visual Studio.</li>
<li style="text-align: justify;">Select any .aspx file, or the site root in the Solution Explorer window.</li>
<li style="text-align: justify;">Go to File -> <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Browse</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_1">with</span>...</li>
</ol></div><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEw6IMdryL_EoAuGaJcmIqFqxzO_tNhRXoDWwfTH4faMS_GPVn8GWFeibjHHmog1h9Y_kDJNt317FGp-QwzgzHzl_wzbrz_iwbiWTb-HNKcw6tO1X3fCYHF__AvRpq7PiAd2Gwl6mxDcKi/s1600/browse_with_dialog.png"><img style="cursor:pointer; cursor:hand;width: 200px; height: 152px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEw6IMdryL_EoAuGaJcmIqFqxzO_tNhRXoDWwfTH4faMS_GPVn8GWFeibjHHmog1h9Y_kDJNt317FGp-QwzgzHzl_wzbrz_iwbiWTb-HNKcw6tO1X3fCYHF__AvRpq7PiAd2Gwl6mxDcKi/s200/browse_with_dialog.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5469269521659826434" /></a></div><div style="text-align: center;"><br />
</div><div style="text-align: justify;"><span class="Apple-tab-span" style="white-space:pre"> </span><span class="blsp-spelling-error" id="SPELLING_ERROR_2">Then</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_3">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_4">need</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_5">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_6">specify</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_7">your</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_8">default</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_9">browser</span>. <span class="blsp-spelling-error" id="SPELLING_ERROR_10">If</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_11">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_12">don</span>`t <span class="blsp-spelling-error" id="SPELLING_ERROR_13">find</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_14">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_15">browser</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_16">what</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_17">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_18">want</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_19">in</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_20">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_21">available</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_22">browsers</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_23">list</span>, <span class="blsp-spelling-error" id="SPELLING_ERROR_24">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_25">can</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_26">add</span> a new <span class="blsp-spelling-error" id="SPELLING_ERROR_27">browser</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_28">by</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_29">specifying</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_30">path</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_31">of</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_32">it</span>`s <span class="blsp-spelling-error" id="SPELLING_ERROR_33">executable</span>:</div><div style="text-align: center;"><br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFIJ5oh1GYxbow8ufpYNIIjH9uno-Wk_P0jZgakkbtWg5EE3dES57oeSiUf6WMjTUkHfG5We6qgSCFaJ2fOMCbfuzkyMgvyRogAxc_xp6wMNYIUeMBwO33T83KA5BPPUFaoh5jrzjJd-KI/s1600/add_browser_dialog.png"><img style="cursor:pointer; cursor:hand;width: 200px; height: 78px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFIJ5oh1GYxbow8ufpYNIIjH9uno-Wk_P0jZgakkbtWg5EE3dES57oeSiUf6WMjTUkHfG5We6qgSCFaJ2fOMCbfuzkyMgvyRogAxc_xp6wMNYIUeMBwO33T83KA5BPPUFaoh5jrzjJd-KI/s200/add_browser_dialog.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5469271709945806018" /></a></div><div style="text-align: center;"><br />
</div><div style="text-align: left;"><span class="Apple-tab-span" style="white-space:pre"> </span><span class="blsp-spelling-error" id="SPELLING_ERROR_34">Changes</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_35">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_36">made</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_37">are</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_38">global</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_39">and</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_40">affect</span> every <span class="blsp-spelling-error" id="SPELLING_ERROR_42">web</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_43">project</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_44">in</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_45">the</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_46">Visual</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_47">Studio</span>. <span class="blsp-spelling-error" id="SPELLING_ERROR_48">Now</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_49">you</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_50">can</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_51">switch</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_52">to</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_53">your</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_54">ASP</span>.<span class="blsp-spelling-error" id="SPELLING_ERROR_55">NET</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_56">MVC</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_57">project</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_58">and</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_59">enjoy</span> it`s <span class="blsp-spelling-error" id="SPELLING_ERROR_60">running</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_61">in</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_62">your</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_63">favorite</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_64">browser</span>.</div><div style="text-align: left;"><br />
</div>Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0tag:blogger.com,1999:blog-8483476078129016910.post-92176002643618641022010-05-09T14:50:00.001+03:002010-05-28T09:19:21.582+03:00<span class="Apple-tab-span" style="white-space:pre"> </span>Hi.<div><br />
</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>In this blog I will write about influence of human laziness in the software development. I live with a native belief that lazyness is a booster of a progress and helps to make software better :)</div>Sergey Ermakovichhttp://www.blogger.com/profile/15322731459791260431noreply@blogger.com0