<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;A0ICRnk9fip7ImA9WhdVFEw.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199</id><updated>2011-09-19T11:06:07.766+03:00</updated><category term="NUnit" /><category term="Україна" /><category term="Fail" /><category term="Relax" /><category term="Vista" /><category term="Vim" /><category term="Tip" /><category term="NuGet" /><category term="MSpec" /><category term="English" /><category term="Dependency Injection" /><category term=".Net" /><category term="log4net" /><category term="NHibernate" /><category term="Hudson" /><category term="UI" /><category term="RTF" /><category term="Windows" /><category term="Fun" /><category term="Programming" /><category term="Sql" /><category term="Finance" /><category term="Books" /><category term="Testing" /><title>Ivan's Blog</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://korneliuk.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/korneliuk" /><feedburner:info uri="korneliuk" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CUEERn0_eyp7ImA9WhdXE0o.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-9138941227766502752</id><published>2011-08-26T18:43:00.001+03:00</published><updated>2011-08-26T18:46:47.343+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-26T18:46:47.343+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RTF" /><title>Reducing size of RTF file with image</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
We use RTF format to generate documents in our products as it is widely supported by software vendors. The bad thing about RTF files is a file size, which drastically increases&amp;nbsp;when document contains images&amp;nbsp;(compared to&amp;nbsp;the&amp;nbsp;same document saved in "doc" format). This becomes a big &amp;nbsp;issue when you have hundreds of thousands documents stored in a databases, and&amp;nbsp;send&amp;nbsp;them to other parties.&lt;br /&gt;
&lt;br /&gt;
As it turned out, the file size issue is not caused by RTF format itself, but by the way MS Word saves RTF files with images. When MS Word saves document in RTF format, it saves two copies of each image - original one and also a copy converted to WMF format.&amp;nbsp;Fortunately, there is way to disable such a strange behavior. You can read how at Microsoft&amp;nbsp;knowledge&amp;nbsp;base article&amp;nbsp;&lt;a href="http://support.microsoft.com/kb/224663"&gt;Document file size increases with EMF, PNG, GIF, or JPEG graphics in Word&lt;/a&gt;.&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-9138941227766502752?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/On2dJRVWFHo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/9138941227766502752/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=9138941227766502752" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/9138941227766502752?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/9138941227766502752?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/On2dJRVWFHo/reducing-size-of-rtf-file-with-image.html" title="Reducing size of RTF file with image" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2011/08/reducing-size-of-rtf-file-with-image.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUARn08eyp7ImA9WhdQFUs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-7721257068120877987</id><published>2011-08-17T01:43:00.003+03:00</published><updated>2011-08-17T09:57:27.373+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-17T09:57:27.373+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="NuGet" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>Using NuGet to download all packages for the solution</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Here I'm talking about technique which allows you to &lt;a href="http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages"&gt;use NuGet without&amp;nbsp;committing&amp;nbsp;packages to source control&lt;/a&gt; (which is handy in case you use Mercurial). First time I've heard about this approach from &lt;a href="http://joseoncode.com/2011/05/31/nuget-keep-your-package-folder-out-of-your-cvs/"&gt;José F. Romaniello post&lt;/a&gt;. In essence: each project within solution has a pre-build step ensuring that all packages are downloaded via NuGet.exe command line utility. While this approach works well for a small project, it has some drawbacks with large solutions:&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;It forces me to insert that build step into each project within solution, which is a little bit annoying.&lt;/li&gt;
&lt;li&gt;It increases solution build time. This becomes visible for a solution containing a lot of projects. I guess that was one of the main reasons why &lt;a href="http://simoncropp.posterous.com/introducing-pepitagetexe"&gt;Simon Cropp wrote this post&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
So, do I really need to check for NuGet packages on each build? It think that checking for dependencies at CI server, and perhaps after pulling changes from source control might be enough.&lt;br /&gt;
&lt;br /&gt;
To achieve this I use a Powershell &lt;a href="https://gist.github.com/1150094"&gt;script&lt;/a&gt; which looks for packages.config files within a solution and executes NuGet.exe for each of them.&lt;/div&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1150094.js"&gt;
 
&lt;/script&gt;
&lt;br /&gt;
This script uses repositories.config file to locate packages.config files instead of searching them in file system. Obviously to make it work, repositories.config should be placed in source control and path variables should be adjusted according to the solution folders structure.&lt;br /&gt;
&lt;br /&gt;
Hope you find this post helpful. At least I've learned some new things about powershell :). Please share your thoughts.&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-7721257068120877987?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/Wa5DjE1yN0M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/7721257068120877987/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=7721257068120877987" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/7721257068120877987?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/7721257068120877987?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/Wa5DjE1yN0M/using-nuget-to-download-all-packages.html" title="Using NuGet to download all packages for the solution" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2011/08/using-nuget-to-download-all-packages.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0ABRn89eyp7ImA9Wx9aFEw.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-5478927868346676581</id><published>2011-03-06T14:49:00.000+02:00</published><updated>2011-03-06T14:49:17.163+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-06T14:49:17.163+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Relax" /><title>Великий піст 2011.</title><content type="html">Наступний тиждень доведеться холостякувати, ще й грошей залишилось 200 грн. Що ж, саме вчасно наступає Великий піст в цьому році.&lt;br /&gt;
&lt;br /&gt;
Якщо хтось теж збирається постити, то ось схема із сайту &lt;a href="http://www.sestry.ru/church/content/velpost2011/index"&gt;sestry.ru&lt;/a&gt;, яка допомагає розібратися що можна їсти і коли.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-fWZqhxBYUj8/TXOBvr6ZONI/AAAAAAAAGn4/FWmpm6RwJ88/s1600/velpost.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="242" src="http://1.bp.blogspot.com/-fWZqhxBYUj8/TXOBvr6ZONI/AAAAAAAAGn4/FWmpm6RwJ88/s400/velpost.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-5478927868346676581?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/lOnGFz_hI54" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/5478927868346676581/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=5478927868346676581" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/5478927868346676581?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/5478927868346676581?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/lOnGFz_hI54/2011.html" title="Великий піст 2011." /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-fWZqhxBYUj8/TXOBvr6ZONI/AAAAAAAAGn4/FWmpm6RwJ88/s72-c/velpost.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2011/03/2011.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUEERn09fSp7ImA9Wx5QFk4.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-3475508610842821143</id><published>2010-09-05T00:55:00.001+03:00</published><updated>2010-09-05T01:00:07.365+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-05T01:00:07.365+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Hudson" /><category scheme="http://www.blogger.com/atom/ns#" term="MSpec" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="English" /><title>How to integrate MSpec into Hudson CI server</title><content type="html">&lt;p&gt;If you’re find this post, you might already know what is MSpec and Hudson CI server. If not, I’ll tell you.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://http://github.com/machine/machine.specifications"&gt;MSpec&lt;/a&gt; (short for Machine.Specifications) is an awesome .Net BDD style testing framework for, which allows you write tests without language noise.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://wiki.hudson-ci.org/display/HUDSON/Meet+Hudson"&gt;Hudson CI&lt;/a&gt; is an open source continuous integration server, which is very easy to install and configure with a user friendly interface. It allows you continuously build you projects and verify the quality of these builds. And it has a lot of plugins, which make developing with Hudson more interesting and fun.&lt;/p&gt;  &lt;h4&gt;So what does it mean integrate and why should I do this?&lt;/h4&gt;  &lt;p&gt;MSpec has a command line runner, which can fail the build in case some tests are failing, and it can generate nice HTML report which can be placed in build artifacts. So what else do I need, and why i should bother with Hudson integration?&lt;/p&gt;  &lt;p&gt;Because dealing with tests is one of the Hudson core features. It can show you information about tests for a particular build and tests history information, such as when they started breaking, how many new tests were added, how test duration changed from build to build, etc. Hudson can also show nice history trend charts.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_77xe419MW1k/TILAed--VoI/AAAAAAAAGiY/aDw_PSESuDg/s1600-h/TestResult8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="TestResult" border="0" alt="TestResult" src="http://lh3.ggpht.com/_77xe419MW1k/TILAf-2leQI/AAAAAAAAGic/CHK-ishWoP8/TestResult_thumb6.png?imgmax=800" width="644" height="514" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At the screenshot above you can see the test result for a single build.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_77xe419MW1k/TILAgXE3D4I/AAAAAAAAGig/GfY9Hf1wBFE/s1600-h/TestResultTrend4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="TestResultTrend" border="0" alt="TestResultTrend" src="http://lh6.ggpht.com/_77xe419MW1k/TILAhV5KpZI/AAAAAAAAGik/KI5c0h9_lB8/TestResultTrend_thumb2.png?imgmax=800" width="513" height="241" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At this screenshot (from another project) you can see tests trend.&lt;/p&gt;  &lt;p&gt;And the most fun feature (at least to me) is the test tracking in a &lt;a href="http://wiki.hudson-ci.org/display/HUDSON/The+Continuous+Integration+Game+plugin"&gt;Hudson Continuous Integration game&lt;/a&gt; plugin, which gives points to user on improving the builds. This is my favorite plugin (ok, maybe after &lt;a href="http://wiki.hudson-ci.org/display/HUDSON/ChuckNorris+Plugin"&gt;Chack Norris plugin&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_77xe419MW1k/TILAh3YWV8I/AAAAAAAAGio/JXmMxJBtCOI/s1600-h/SoreCard4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="SoreCard" border="0" alt="SoreCard" src="http://lh5.ggpht.com/_77xe419MW1k/TILAi4dHaBI/AAAAAAAAGis/cSVR4QZ3kjk/SoreCard_thumb2.png?imgmax=800" width="469" height="158" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Would not it be great if MSpec tests will participate in such activities?&lt;/p&gt;  &lt;h4&gt;How to achieve that?&lt;/h4&gt;  &lt;p&gt;So how does Hudson know about all available testing tools for various programming languages? Of cause it doesn’t know about all of them. It works internally with JUnit xml reports, but there are many special plugins for most popular testing tool, which in fact transform testing tool output to JUnit format, thus allowing them to be used by Hudson. Unfortunately, there is no such plugin for MSpec currently. And I’m not familiar with Java to write it :)&lt;/p&gt;  &lt;p&gt;Good news is that MSpec can generate xml report (although it not as informative as i would like it to be). And we can write XSLT transformation to convert MSpec xml output to JUnit format and use it to provide test results to Hudson directly as JUnit tests.&lt;/p&gt;  &lt;p&gt;So here is such XSLT:&lt;/p&gt; &lt;script src="http://gist.github.com/565471.js?file=MSpecToJUnit.xslt"&gt;&lt;/script&gt;  &lt;p&gt;So now you can transform MSpec results to JUnit output in you build script and than use it in Hudson. If you are using MSBuil you can use it XsltTransformation task to do the conversion:&lt;/p&gt; &lt;script src="http://gist.github.com/565480.js?file=MSpecToJUnitWithMSBuild.xml"&gt;&lt;/script&gt;  &lt;p&gt;And finally you configure Hudson to use test results by specifying converted xml output. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_77xe419MW1k/TILAjg41iYI/AAAAAAAAGiw/9dbLJa0cb_k/s1600-h/PublishTestResults%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PublishTestResults" border="0" alt="PublishTestResults" src="http://lh6.ggpht.com/_77xe419MW1k/TILAkUFqSCI/AAAAAAAAGi0/CUAvOHdGFro/PublishTestResults_thumb%5B1%5D.png?imgmax=800" width="609" height="118" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Additionally it is a good idea to publish MSpec HTML report. You may do that with help of &lt;a href="http://wiki.hudson-ci.org/display/HUDSON/HTML+Publisher+Plugin"&gt;HTML Publisher Plugin&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_77xe419MW1k/TILAlPT5qDI/AAAAAAAAGi4/SFmJ2cXmVFE/s1600-h/PublishSpecs%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PublishSpecs" border="0" alt="PublishSpecs" src="http://lh6.ggpht.com/_77xe419MW1k/TILAmCq7WdI/AAAAAAAAGi8/SQ4Ynms4q-A/PublishSpecs_thumb%5B1%5D.png?imgmax=800" width="566" height="128" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;That is all you need (except of course that you need to write build script which would run you specifications and will generate xml and html reports). At the end you may see you specifications included as usual tests in Hudson. And as a bonus you get nice HTML report:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_77xe419MW1k/TILAnGB2z2I/AAAAAAAAGjA/dAN5EF6iGnU/s1600-h/HudsonView%5B17%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HudsonView" border="0" alt="HudsonView" src="http://lh3.ggpht.com/_77xe419MW1k/TILApMtwrDI/AAAAAAAAGjE/GjiB8tBefpw/HudsonView_thumb%5B11%5D.png?imgmax=800" width="684" height="772" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The link at the top of the page points to the Specifications HTML report:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_77xe419MW1k/TILAqAUQazI/AAAAAAAAGjI/yoimyx7I-9c/s1600-h/SpecificationsReport%5B9%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="SpecificationsReport" border="0" alt="SpecificationsReport" src="http://lh4.ggpht.com/_77xe419MW1k/TILArdzYsNI/AAAAAAAAGjM/ukF5N5laVGI/SpecificationsReport_thumb%5B7%5D.png?imgmax=800" width="537" height="484" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_77xe419MW1k/TILAsQiDhLI/AAAAAAAAGjQ/U3c6zsdd2Nc/s1600-h/Specifications%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Specifications" border="0" alt="Specifications" src="http://lh3.ggpht.com/_77xe419MW1k/TILAuQgf2EI/AAAAAAAAGjY/UEvTZk_eY5I/Specifications_thumb%5B2%5D.png?imgmax=800" width="551" height="772" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;p&gt;That’s not all I wanted to say. But I’m a bit tired already. So much words :) Hope it would be useful for someone. And hope that yours Mr. Hudson and Chack Noris will always be happy:).&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-3475508610842821143?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/oaxudKMxiH8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/3475508610842821143/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=3475508610842821143" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3475508610842821143?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3475508610842821143?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/oaxudKMxiH8/hot-to-integrate-mspec-into-hudson-ci.html" title="How to integrate MSpec into Hudson CI server" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_77xe419MW1k/TILAf-2leQI/AAAAAAAAGic/CHK-ishWoP8/s72-c/TestResult_thumb6.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2010/09/hot-to-integrate-mspec-into-hudson-ci.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QFSX44fSp7ImA9WxBUF0w.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-5548135593897761388</id><published>2010-03-04T17:08:00.000+02:00</published><updated>2010-03-04T17:08:38.035+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-04T17:08:38.035+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="Fail" /><title>XML file in Visual Studio - Request for permission failed.</title><content type="html">Напишу для себе про помилку, яку показувала Visual Studio коли я відкривав xml файл. Бо не знатиму, що робити з цією помилкою, коли вона виникне наступного разу.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Отже ситуація така. Включив до проекту скачаний з інтернету XML файл. Відкрив його в Visual Studio 2008 і побачив таку помилку:&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="white-space: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_77xe419MW1k/S4_IMJGvi2I/AAAAAAAAGac/_fnk57ClRuo/s1600-h/ErrorIndication.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="98" src="http://1.bp.blogspot.com/_77xe419MW1k/S4_IMJGvi2I/AAAAAAAAGac/_fnk57ClRuo/s640/ErrorIndication.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_77xe419MW1k/S4_IWQJmUeI/AAAAAAAAGak/mv_jjWB1YQ4/s1600-h/Error.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="108" src="http://1.bp.blogspot.com/_77xe419MW1k/S4_IWQJmUeI/AAAAAAAAGak/mv_jjWB1YQ4/s640/Error.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Повідомлення про помилку:&lt;/div&gt;&lt;pre&gt;Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.&lt;/pre&gt;&lt;br /&gt;
Якщо в DOCTYPE зазначено url схеми в інтернеті, то відповідно виникає помилка:&lt;br /&gt;
&lt;pre&gt;Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
&lt;/pre&gt;&lt;br /&gt;
При цьому до проекту було вже підключено кілька XML файлів із таким жe DTD.&lt;br /&gt;
&lt;br /&gt;
Гугл мені не допоміг.&amp;nbsp;Здогадався подивитися у властивості файлу. Проблема виявилась простою - Windows заблокувала файл, тому що він був завантажений з інтернету.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_77xe419MW1k/S4_LsOybLvI/AAAAAAAAGas/OLAWmqUGFq8/s1600-h/Unlock.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://1.bp.blogspot.com/_77xe419MW1k/S4_LsOybLvI/AAAAAAAAGas/OLAWmqUGFq8/s640/Unlock.png" width="486" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Дуже дякую. Це ж мабуть я мав відразу здогадатися? Витратив кучу часу.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-5548135593897761388?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/UQAlBbHEOi4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/5548135593897761388/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=5548135593897761388" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/5548135593897761388?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/5548135593897761388?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/UQAlBbHEOi4/xml-file-in-visual-studio-request-for.html" title="XML file in Visual Studio - Request for permission failed." /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_77xe419MW1k/S4_IMJGvi2I/AAAAAAAAGac/_fnk57ClRuo/s72-c/ErrorIndication.png" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2010/03/xml-file-in-visual-studio-request-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D04GQHk-eSp7ImA9Wx9aFEw.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-3013307696413888344</id><published>2010-02-15T21:26:00.003+02:00</published><updated>2011-03-06T14:52:01.751+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-06T14:52:01.751+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Relax" /><title>Великий піст 2010. Що можна їсти?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;UPD&lt;/span&gt;: Оновлену схему посту для 2011 року можна подивитись &lt;a href="http://korneliuk.blogspot.com/2011/03/2011.html"&gt;тут&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Сьогодні, 15 лютого, розпочався Великий піст. Для мене це привід змінити себе на краще, &lt;br /&gt;
поборотися зі шкідливими звичками. І хоча всі кажуть, що піст&amp;nbsp;–&amp;nbsp;це не дієта, все ж утримання від&amp;nbsp;їжі - це головний атрибут посту.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Яку їжу можна вживати в піст&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Є різні правила. Біль та менш строгі. Я користуюсь тими, що описані на &lt;a href="http://www.sestry.ru/church/content/vpost"&gt;сторінці&lt;/a&gt; сайту&amp;nbsp;&lt;a href="http://www.sestry.ru/"&gt;http://www.sestry.ru&lt;/a&gt;.&amp;nbsp;Там я знайшов і цю зручну схему:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_77xe419MW1k/S3mSEU1X-GI/AAAAAAAAGZE/Li5sdLlwTlU/s1600-h/vpost_img.jpg" imageanchor="1" style="display: inline !important; margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://4.bp.blogspot.com/_77xe419MW1k/S3mSEU1X-GI/AAAAAAAAGZE/Li5sdLlwTlU/s640/vpost_img.jpg" width="384" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Отже оcновні правила такі:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Не можна їсти м'ясо, рибу, яйця, молоко та інші продукти тавринного походження.&lt;/li&gt;
&lt;li&gt;У перші два дні посту (15 та 16 лютого) та в передостанній день (2 квітня) - строгий піст. Рекомендується повне утримання від їжі, або невелика кількість пісної їжі.&lt;/li&gt;
&lt;li&gt;В середу та п'ятницю - «сухояденіє». Не можна вживати ні варену, ні приготовану на пару їжу. Не можна вживати олію. Дозволяються хліб, свіжі, сушені й квашені овочі та фрукти.&lt;/li&gt;
&lt;li&gt;В інші дні дозволена рослинна олія.&lt;/li&gt;
&lt;li&gt;В суботу, в неділю а також в свята&amp;nbsp;25 лютого, 9 березня та 22 березня&amp;nbsp;можна вживати морепродукти.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;В Вербну неділю (28 березня) можна їсти рибу. А в Лазареву суботу (напередодні Вербної неділі) можна їсти ікру.&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;І наостанок, слід пам'ятати, що головне чого не можна їсти - це своїх ближніх.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-3013307696413888344?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/-z1TL3KaYDo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/3013307696413888344/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=3013307696413888344" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3013307696413888344?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3013307696413888344?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/-z1TL3KaYDo/2010.html" title="Великий піст 2010. Що можна їсти?" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_77xe419MW1k/S3mSEU1X-GI/AAAAAAAAGZE/Li5sdLlwTlU/s72-c/vpost_img.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2010/02/2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEIFR3o7fCp7ImA9WxBXE0g.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-6485280299386189761</id><published>2010-01-24T01:52:00.006+02:00</published><updated>2010-01-24T19:01:56.404+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-24T19:01:56.404+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Dependency Injection" /><category scheme="http://www.blogger.com/atom/ns#" term="Testing" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="English" /><title>Null arguments in a constructor. To check or not to check.</title><content type="html">We've had interesting discussion recently, on whether to check constructor arguments on nulls. I want to share my thought on this.&lt;br /&gt;
&lt;br /&gt;
Our coding convention has a rule stating that all public methods arguments should be checked for nulls. So our methods usually looks like this one:&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;public void SomeMethod(string arg)
{
    Precondition.Argument.NotNull(arg, "arg");
    // Real code comes here...
}
&lt;/pre&gt;And I'm quite happy with such&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Design_by_Contract"&gt;DbC&lt;/a&gt; like coding style. But... with one exception.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;I don't like to write code checking for null dependencies in a service constructor.&lt;/i&gt; For two main reasons:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;b&gt;It is easier to write tests for the service. &lt;/b&gt;In case when particular dependency is not used in test it is easier to pass null instead of&amp;nbsp;creating stub dependencies only to satisfy checks.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;It useless in case when all services are instantiated through &lt;a href="http://en.wikipedia.org/wiki/Dependency_injection"&gt;DI container&lt;/a&gt;.&lt;/b&gt;&amp;nbsp;That is because, as far as I know, most DI containers will throw an exception&amp;nbsp;by self&amp;nbsp;when it can't find dependency for the service.&lt;/li&gt;
&lt;/ol&gt;I think code will show my point better. Suppose we need a service to login users. Service responsibility will be to retrieve user by the name provided, verify that provided password is correct and to set the user as a current user in the application. In case when&amp;nbsp;supplied&amp;nbsp;user name or password are incorrect, service should log appropriate message.&lt;br /&gt;
&lt;br /&gt;
So service will need some repository to retrieve users, some service to authenticate user and a logger to log messages in case when incorrect user credentials specified.&lt;br /&gt;
&lt;br /&gt;
I'll disregard TDD practice and will show the code before test (shame on me). So the LoginService code:&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;public class LoginService : ILoginService
{
    readonly IUserRepository userRepository;
    readonly IAuthenticationService authenticationService;
    readonly ILog log;

    public LoginService(
        IUserRepository userRepository,
        IAuthenticationService authenticationService,
        ILog log)
    {
        // This is the subject of discussing.
        Precondition.Argument.NotNull(userRepository, "userRepository");
        Precondition.Argument.NotNull(authenticationService, "authenticationService");
        Precondition.Argument.NotNull(log, "log");

        this.userRepository = userRepository;
        this.authenticationService = authenticationService;
        this.log = log;
    }

    public bool Login(UserCredentials userCredentials)
    {
        Precondtion.Argument.NotNull(userCredentials);
        
        var user = this.userRepository.FindByName(userCredentials.Name);
        if (user == null)
        {
            this.log.Info("Login attempt failed due to invalid user name");
            return false;
        }

        if (!this.authenticationService.PasswordMatches(user, userCredentials.Password))
        {
            this.log.Info("Login attempt failed due to invalid password");
            return false;
        }

        SetCurrentUser(user);
        return true;
    }
}
&lt;/pre&gt;Lets write a test for scenario when incorrect user name is provided. For this scenario we don't need IAuthenticationService.&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;[Subject(typeof(LoginService))]
public class when_unknown_user_name_provided
{
    const string UnknownUserName = "Unknown user";
    User user;
    UserCredentials credentials;
    LogSpy logSpy;
    LoginService loginService;
    bool loginResult;

    Establish context = () =&amp;gt;
    {
        credentials = new UserCredentials(UnknownUsername, "stub password");
        var userRepository = MockRepository.GenerateStub&amp;lt;IUserRepository&amp;gt;();
        userRepository.Stub(x =&amp;gt; x.FindByName(UnknownUserName).Return(null);

        // We really do not need an authenticationService for this test. 
        // But should stub it only to satisfy null check constraints.
        // Isn't it easier and more readable to use such obviuos construction?
        // var authenticationServiceNotUsed = null;
        var authenticationServiceNotUsed = 
            MockRepository.GenerateStub&amp;lt;IAutenticationService&amp;gt;();

        logSpy = new LogSpy();
        
        loginService = new LoginService(
            userRepository, authenticationServiceNotUsed, LogSpy);        
    };

    Because of = () =&amp;gt; loginResult = loginService.Login(userCredentials);

    It should_indicate_that_user_login_failed = () =&amp;gt; loginResult.ShouldBeFalse();

    It should_not_set_current_user = () =&amp;gt; User.Current.ShouldBeNull();

    It should_log_invalid_login_attempt = () =&amp;gt;
        logSpy.InfoMessage.ShouldBeEqualTo(
            "Login attempt failed due to invalid user name"); 
}
&lt;/pre&gt;And wait, as far as I have serviceAuthentication instance I might want to ensure that it was not called within a test:&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;It should_not_use_authentication_service = () =&amp;gt; 
        authenticationService.AssertWasNotCalled(
            x =&amp;gt; x.PasswordMatches(Arg&amp;lt;User&amp;gt;.Is.Anyting, Arg&amp;lt;string&amp;gt;.Is.Anything));
&lt;/pre&gt;Seems like a waste of time. Intent is more clear when null authenticationService is used. That's all about testing challenge.&lt;br /&gt;
&lt;br /&gt;
Now lets me return back to my statement that such null checks in a constructor are useless. So what is the advantage they might give? Earlier problem discovering by throwing ArgumentNullException in a constructor, instead of NullReferenceException somewhere while executing method later. I believe that in production code such services should not be instantiated directly by hand, but resolved with DI container (in a &lt;a href="http://ayende.com/Blog/archive/2010/01/22/rejecting-dependency-injection-inversion.aspx"&gt;recent Ayende's post&lt;/a&gt; you can see a very nice picture of dependencies graph). As I've already said, most of DI containers will throw an exception itself if it can't find dependency. But with DI containers even better approach is to test container configuration. For given example test may look like: &lt;br /&gt;
&lt;pre class="brush: csharp"&gt;[Subject(typeof(ApplicationConfiguration))]
public class when_configuring
{
    Because of = () =&amp;gt; ApplicationConfiguration.Initialize();

    It should_initialize_service_locator = () =&amp;gt;
        ServiceLocator.Current.ShouldNotBeNull();

    It should_configure_login_service = () =&amp;gt;
        ServiceLocator.Current.GetInstance&amp;lt;ILoginService&amp;gt;().ShouldNotBeNull();
}
&lt;/pre&gt;With this approach we get even earlier problem discovering.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Summary&lt;/b&gt;: This post explains why using null arguments checks in services constructors is not a good idea. The better approach is letting them be null for testing purposes and testing you DI container configuration to ensure that services may be resolved in a run-time.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt; Tests are using syntax of the awesome Machine.Specifications framework which you can find &lt;a href="http://github.com/machine/machine.specifications"&gt;here&lt;/a&gt;. All the code examples were written without any code editor. So I expect it contains errors.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-6485280299386189761?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/faqt6PxkqRg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/6485280299386189761/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=6485280299386189761" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6485280299386189761?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6485280299386189761?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/faqt6PxkqRg/null-arguments-in-constructor-to-check.html" title="Null arguments in a constructor. To check or not to check." /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2010/01/null-arguments-in-constructor-to-check.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QHQ3c8fSp7ImA9WxBXE08.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-8231809418151071073</id><published>2009-12-29T01:23:00.004+02:00</published><updated>2010-01-24T11:28:52.975+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-24T11:28:52.975+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="log4net" /><category scheme="http://www.blogger.com/atom/ns#" term="English" /><title>Configuring Log4Net AdoNetAppender with a connection string from application configuration file</title><content type="html">I read Ben Scheirman's "&lt;a href="http://flux88.com/blog/changing-log4net-connection-string-at-runtime"&gt;Changing log4net connection string at runtime&lt;/a&gt;" post and wanted to leave a comment describing solution I use to solve log4net ConnectionString configuring problem. But as I wanted to show some code, it might be better to make a blog post.&lt;br /&gt;
&lt;br /&gt;
So the problem I faced with was:&lt;br /&gt;
&lt;blockquote&gt;How to configure &lt;a href="http://logging.apache.org/log4net/index.html"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-style-span" style="text-decoration: none;"&gt;log4net&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; AdoNetAppender to use connection string specified in a&amp;nbsp;&amp;lt;connectionStrings&amp;gt; section of an application configuration file?&lt;/blockquote&gt;There is no obvious way to do this in a current release of log4net. But &lt;a href="https://issues.apache.org/jira/browse/LOG4NET-88"&gt;such issue&lt;/a&gt; is already &lt;a href="http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/AdoNetAppender.cs?r1=607475&amp;amp;r2=607748&amp;amp;diff_format=h"&gt;fixed&lt;/a&gt; in a log4net trunk, thus it will be possible to do so in the next release.&lt;br /&gt;
&lt;br /&gt;
I don't really like to use the code which not yet&amp;nbsp;officially&amp;nbsp;released. So I use a simple workaround - a class inherited from AdoNetAppender with a new property ConnectionStringName. The code is pretty obvious:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;using System.Configuration;

using log4net.Appender;
using log4net.Core;

/// &amp;lt;summary&amp;gt;
/// Allows to use a connection string specified in the 
/// &amp;lt;see cref="ConfigurationManager.ConnectionStrings"/&amp;gt; section of an application
/// configuration file.
/// &amp;lt;/summary&amp;gt;
/// &amp;lt;remarks&amp;gt;
/// Such feature is already implemented in a log4net trunk (see
/// https://issues.apache.org/jira/browse/LOG4NET-88). But it is not yet released.
/// &amp;lt;para/&amp;gt;
/// TODO: Remove this class as soon as log4net 1.2.11 will be released.
/// &amp;lt;/remarks&amp;gt;
public class Log4NetConnectionStringNameAdoNetAppender : AdoNetAppender
{
    private string connectionStringName;

    /// &amp;lt;summary&amp;gt;
    /// Gets or sets the name of the connection string from the application
    /// configuration file.
    /// &amp;lt;/summary&amp;gt;
    /// &amp;lt;value&amp;gt;The name of the connection string.&amp;lt;/value&amp;gt;
    public string ConnectionStringName
    {
        get
        {
            return this.connectionStringName;
        }
        
        set
        {
            this.connectionStringName = value;

            if (!string.IsNullOrEmpty(this.connectionStringName))
            {
                var settings =
                    ConfigurationManager.ConnectionStrings[this.connectionStringName];
                if (settings == null)
                {
                    string msg = string.Format(
                        "Unable to find [{0}] ConfigurationManager.ConnectionStrings item",
                        this.connectionStringName);

                    throw new LogException(msg);
                }

                this.ConnectionString = settings.ConnectionString;
            }
        }
    }
}
&lt;/pre&gt;&lt;br /&gt;
And the log4net configuration looks like this:&lt;br /&gt;
&lt;pre class="brush: xml"&gt;&amp;lt;appender name="DBAppender" type="NamespaceWhereClassLives.Log4NetConnectionStringNameAdoNetAppender,AssemblyContainingClass"&amp;gt;
    &amp;lt;connectionStringName value="ConnectionStringNameFromConfigFile"/&amp;gt;
    &amp;lt;!-- Other parameters --&amp;gt;
&amp;lt;/appender&amp;gt;
&lt;/pre&gt;This looks like a hack, but it works for me pretty well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-8231809418151071073?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/3ScwBiKJoTc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/8231809418151071073/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=8231809418151071073" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/8231809418151071073?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/8231809418151071073?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/3ScwBiKJoTc/configuring-log4net-adonetappender-with.html" title="Configuring Log4Net AdoNetAppender with a connection string from application configuration file" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/12/configuring-log4net-adonetappender-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEFSX87fyp7ImA9WxNWFUg.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-2266662034016117997</id><published>2009-10-14T23:53:00.000+03:00</published><updated>2009-10-14T23:53:38.107+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-14T23:53:38.107+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Україна" /><category scheme="http://www.blogger.com/atom/ns#" term="Fun" /><title>На Украине? На Росії!</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_77xe419MW1k/StY277DYphI/AAAAAAAAGRI/b_ce4SF1SYc/s1600-h/Map_of_Kiev_Rus%27.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_77xe419MW1k/StY277DYphI/AAAAAAAAGRI/b_ce4SF1SYc/s200/Map_of_Kiev_Rus%27.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;Вчора дізнався, що фінською правильно вживати&amp;nbsp;&lt;i&gt;"Я був &lt;/i&gt;&lt;b&gt;&lt;i&gt;на Росії&lt;/i&gt;&lt;/b&gt;&lt;i&gt;"&lt;/i&gt;&amp;nbsp;(Minä olin Venäjallä),&amp;nbsp;але &lt;i&gt;"Я живу в Україні" &lt;/i&gt;(Minä asun Ukrainassa).&lt;br /&gt;
&lt;br /&gt;
На відміну від інших країн, для Росії, в фінській мові використовуються &lt;a href="http://en.wikipedia.org/wiki/Finnish_language_noun_cases#External_Locatives"&gt;зовнішні місцеві відмінки&lt;/a&gt;. Приклади&amp;nbsp;&lt;a href="http://en.wiktionary.org/wiki/Ven%C3%A4j%C3%A4#Usage_notes"&gt;тут&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
PS. Взагалі то я не дуже переймаюсь тим як саме кажуть росіяни - &lt;i&gt;"на Украине"&lt;/i&gt; чи &lt;i&gt;"в Украине"&lt;/i&gt;. Мені це навіть імпонує&amp;nbsp;трохи. Все таки підкреслюється унікальність нашої країни. Писав же Некрасов &lt;a href="http://ru.wikipedia.org/wiki/%D0%9A%D0%BE%D0%BC%D1%83_%D0%BD%D0%B0_%D0%A0%D1%83%D1%81%D0%B8_%D0%B6%D0%B8%D1%82%D1%8C_%D1%85%D0%BE%D1%80%D0%BE%D1%88%D0%BE"&gt;"Кому на Руси жить хорошо"&lt;/a&gt;. Так от я подумав, може це &lt;i&gt;"на"&lt;/i&gt; нам у спадок від Київської Русі дісталась?&lt;br /&gt;
&lt;br /&gt;
Та не про те хотів сказати. Я не знаю як правильно вживати "в Україні" російською мовою. Але я &lt;a href="http://mova.kreschatic.kiev.ua/41.htm#1"&gt;знаю&lt;/a&gt;, що українською правильно казати: "Я живу &lt;b&gt;в Україні&lt;/b&gt;".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-2266662034016117997?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/9CKXk8miC20" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/2266662034016117997/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=2266662034016117997" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2266662034016117997?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2266662034016117997?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/9CKXk8miC20/blog-post_14.html" title="На Украине? На Росії!" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_77xe419MW1k/StY277DYphI/AAAAAAAAGRI/b_ce4SF1SYc/s72-c/Map_of_Kiev_Rus%27.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/10/blog-post_14.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8EQn09cCp7ImA9WxNWFUg.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-3987253274828876927</id><published>2009-10-14T21:45:00.002+03:00</published><updated>2009-10-14T23:56:43.368+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-14T23:56:43.368+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Україна" /><category scheme="http://www.blogger.com/atom/ns#" term="Fun" /><title>За кого голосувати на виборах?</title><content type="html">Послухайте &lt;a href="http://sashko.com.ua/?p=10"&gt;чудову пісню&lt;/a&gt; Сашка Положинського. Мене дуже порадувала.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-3987253274828876927?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/o6zXNK9WDz4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/3987253274828876927/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=3987253274828876927" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3987253274828876927?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3987253274828876927?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/o6zXNK9WDz4/blog-post.html" title="За кого голосувати на виборах?" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/10/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QNSX86eip7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-2770993747544829203</id><published>2009-09-30T09:34:00.004+03:00</published><updated>2009-10-13T23:23:18.112+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:23:18.112+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Books" /><title>Майкл К. Физерс. Эффективная работа с унаследованным кодом</title><content type="html">&lt;a href="http://www.blogger.com/"&gt;&lt;/a&gt;&lt;span id="goog_1254291409403"&gt;&lt;/span&gt;&lt;span id="goog_1254291409404"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_77xe419MW1k/SsL4juLo6eI/AAAAAAAAGRA/xNyYvZq-CFs/s1600-h/FWELC.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_77xe419MW1k/SsL4juLo6eI/AAAAAAAAGRA/xNyYvZq-CFs/s320/FWELC.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;Останнім часом я зустрічав багато посилань на книгу &lt;a href="http://www.williamspublishing.com/Books/978-5-8459-1530-6.html"&gt;"Эффективная работа с унаследованным кодом"&lt;/a&gt;&amp;nbsp;із дуже позитивним відгуками. Тому сподівався, що книга мені сподобається. Але прочитавши її, мої очікування не виправдались. Навпаки, книга здалась мені дуже нудною. Не знаю чия це вина, автора, перекладачів, чи мого сприйняття. Багато сторінок, я просто переглядав по діагоналі. Часто ловив себе на тому, що прочитавши якийсь розділ нічого не зрозумів, бо думки гуляли&amp;nbsp;деінде, &amp;nbsp;а перечитувати ніякого бажання немає. І взагалі не розумію, як можна стільки уваги приділити питанню - як розірвати залежність між кодом, і жодним словом не обмовитись про &lt;a href="http://en.wikipedia.org/wiki/Dependency_injection"&gt;Dependecy Injection Containers (IOC)&lt;/a&gt;. А, точно, це ж успадкований код. До того ж судячи з книги, більшість успадкованого коду - це код на C та C++. Але мене це мало цікавить.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-2770993747544829203?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/09g05OnTRxQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/2770993747544829203/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=2770993747544829203" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2770993747544829203?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2770993747544829203?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/09g05OnTRxQ/blog-post.html" title="Майкл К. Физерс. Эффективная работа с унаследованным кодом" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_77xe419MW1k/SsL4juLo6eI/AAAAAAAAGRA/xNyYvZq-CFs/s72-c/FWELC.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/09/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQBQn84fyp7ImA9WxBXEkg.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-9152232477045987316</id><published>2009-09-27T16:12:00.008+03:00</published><updated>2010-01-23T16:19:13.137+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-23T16:19:13.137+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="NHibernate" /><category scheme="http://www.blogger.com/atom/ns#" term="Sql" /><category scheme="http://www.blogger.com/atom/ns#" term="English" /><title>High/Low generator with SQL</title><content type="html">In current project, we use High/Low generator strategy to generate identifiers for entities. (Fabio Maulo wrote a good explanation &lt;a href="http://fabiomaulo.blogspot.com/2008/12/identity-never-ending-story.html"&gt;why using identity is a bad thing&lt;/a&gt;). The question I sometimes see in NHibernate forums is what to do if some other applications also use the same database. Usual answer is - implement some service which would generate id, and use it in that applications.&lt;br /&gt;
Yesterday I met similar issue. What I needed to do is to insert some fake data using SQL only. For that purpose I wrote such stored procedure:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;IF OBJECT_ID('dbo.GenerateHiLoIdRange') IS NOT NULL
  DROP PROCEDURE dbo.GenerateHiLoIdRange
GO
CREATE PROCEDURE dbo.GenerateHiLoIdRange (
    @IdsCount INT
)
AS
/* =============================================================== */
/* == Generates a range of identifiers using High/Low strategy. == */
/* =============================================================== */
BEGIN
    SET NOCOUNT ON;
    
    IF @IdsCount &amp;lt;= 0
    BEGIN
        RAISERROR('@IdsCount should be positive. But was %d', 16, -1, @IdsCount)
        RETURN(-100);
    END

    DECLARE @NextHi INT
    DECLARE @MaxLo  INT
    SET @MaxLo = 100  -- Hardcoded value used over all tables in a database.
 
    BEGIN TRANSACTION UpdateHiLoTable
        
        SET @NextHi = (
            SELECT next_hi 
            FROM hibernate_unique_key WITH (UPDLOCK, ROWLOCK)
        )
        
        UPDATE hibernate_unique_key 
        SET next_hi = @NextHi + 1 + (@IdsCount - 1) / @MaxLo
        WHERE next_hi = @NextHi
        
    COMMIT TRANSACTION UpdateHiLoTable
    
    SELECT @NextHi * @MaxLo + IntValue
    FROM   dbo.Integers(@IdsCount - 1)
END
GO
&lt;/pre&gt;&lt;br /&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Main points of procedure:&lt;br /&gt;
&lt;/div&gt;&lt;ul&gt;&lt;li&gt;It uses hard coded MaxLo value&amp;nbsp;(100)&amp;nbsp;, which is used over all entities in our application.&lt;/li&gt;
&lt;li&gt;Calculates new NextHi value based on requested identifiers count and updates&amp;nbsp;&lt;span style="font-family: monospace; white-space: pre;"&gt;hibernate_unique_key&lt;/span&gt;&amp;nbsp;table in transaction.&lt;/li&gt;
&lt;li&gt;To return a result set containing generated identifiers procedure needs some sort of "Integers" table.&amp;nbsp;In my case i simulate such table with a table-valued function.&lt;/li&gt;
&lt;/ul&gt;&lt;pre class="brush: sql"&gt;IF OBJECT_ID('dbo.Integers') IS NOT NULL
  DROP FUNCTION dbo.Integers
GO
CREATE FUNCTION dbo.Integers (
    @MaxValue INT
)
RETURNS @Integers TABLE (IntValue INT NOT NULL)
AS
/* =============================================================== */
/* ==   Returns the [0,  @MaxValue] range of integer values.    == */
/* =============================================================== */
BEGIN
    IF @MaxValue &amp;gt; 9999
    BEGIN
      RETURN;
    END;
    
    DECLARE @Digits TABLE
    (
        Digit INT NOT NULL PRIMARY KEY
    )

    INSERT INTO @Digits (Digit) VALUES (0)
    INSERT INTO @Digits (Digit) VALUES (1)
    INSERT INTO @Digits (Digit) VALUES (2)
    INSERT INTO @Digits (Digit) VALUES (3)
    INSERT INTO @Digits (Digit) VALUES (4)
    INSERT INTO @Digits (Digit) VALUES (5)
    INSERT INTO @Digits (Digit) VALUES (6)
    INSERT INTO @Digits (Digit) VALUES (7)
    INSERT INTO @Digits (Digit) VALUES (8)
    INSERT INTO @Digits (Digit) VALUES (9)
    
    INSERT INTO @Integers
    SELECT Number
    FROM  
        (SELECT 
            Thousands.Digit * 1000 + 
            Hundreds.Digit * 100 + 
            Tens.Digit * 10 + 
            Ones.Digit AS Number
         FROM   
            @Digits Thousands
            CROSS JOIN @Digits Hundreds
            CROSS JOIN @Digits Tens
            CROSS JOIN @Digits Ones
        ) Integers
    WHERE Number &amp;lt;= @MaxValue
    ORDER BY Number
        
    RETURN;
END
GO
&lt;/pre&gt;Note that number of integers in a function is limited to 10000. But that is what I need.&lt;br /&gt;
&lt;br /&gt;
Now I can generate identifiers in t-sql batches:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;CREATE TABLE #TempId (Id INT NOT NULL)

SELECT * FROM hibernate_unique_key

INSERT INTO #TempId
  EXEC dbo.GenerateHiLoIdRange 250

SELECT&amp;nbsp;Id AS Id, 
    'PersonName' +  CAST(ROW_NUMBER() OVER(ORDER BY Id) - 1 AS VARCHAR(255)) AS PersonName
FROM #TempId

DROP TABLE #TempId
&lt;/pre&gt;&lt;br /&gt;
In my sandbox database I see such results:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_77xe419MW1k/Sr9jF8X7c0I/AAAAAAAAGQ4/BITkcG2I9fQ/s1600-h/HiLoGeneratorResults.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_77xe419MW1k/Sr9jF8X7c0I/AAAAAAAAGQ4/BITkcG2I9fQ/s400/HiLoGeneratorResults.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-9152232477045987316?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/sjO38yu13eE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/9152232477045987316/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=9152232477045987316" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/9152232477045987316?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/9152232477045987316?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/sjO38yu13eE/highlow-generator-with-sql.html" title="High/Low generator with SQL" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_77xe419MW1k/Sr9jF8X7c0I/AAAAAAAAGQ4/BITkcG2I9fQ/s72-c/HiLoGeneratorResults.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/09/highlow-generator-with-sql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkEGRHgzeSp7ImA9WxJVEkQ.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-8277015124053538340</id><published>2009-06-29T20:41:00.007+03:00</published><updated>2009-06-29T21:03:45.681+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-29T21:03:45.681+03:00</app:edited><title>Firefox - пожирач пам'яті</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_77xe419MW1k/SkkBZFFuxHI/AAAAAAAAF10/1l6-mZT5nXQ/s1600-h/firefox.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 257px;" src="http://2.bp.blogspot.com/_77xe419MW1k/SkkBZFFuxHI/AAAAAAAAF10/1l6-mZT5nXQ/s400/firefox.png" alt="" id="BLOGGER_PHOTO_ID_5352811162481116274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Це через кілька хвилин після того як, здавалося б, закрив  firefox. Куди стільки пам'яті можна жерти?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-8277015124053538340?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/8Oun8HPKNyU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/8277015124053538340/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=8277015124053538340" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/8277015124053538340?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/8277015124053538340?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/8Oun8HPKNyU/firefox.html" title="Firefox - пожирач пам'яті" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_77xe419MW1k/SkkBZFFuxHI/AAAAAAAAF10/1l6-mZT5nXQ/s72-c/firefox.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/06/firefox.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMGQHg4fCp7ImA9WxJVEUQ.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-6114733026307027082</id><published>2009-06-28T15:13:00.005+03:00</published><updated>2009-06-28T15:50:21.634+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-28T15:50:21.634+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>Linq в .Net Framework 2.0</title><content type="html">&lt;span style="font-weight: bold;"&gt;Проблема:&lt;/span&gt; Клієнти живуть на Windows 2000, на яку можна поставити лише .Net Framework 2.0. Але в проекті хочеться використовувати Linq. Чи це можливо?&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Рішення&lt;/span&gt;: Можна! &lt;a href="http://code.google.com/p/linqbridge/downloads/list"&gt;Завантажуємо&lt;/a&gt; чудову бібліотеку &lt;a href="http://www.albahari.com/nutshell/linqbridge.aspx"&gt;LinqBridge&lt;/a&gt; і з радістю використовуємо Linq.&lt;br /&gt;&lt;br /&gt;Що саме містить ця бібліотека:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Власну реалізацію всіх Linq операторів для Enumerable класу  із Framework 3.5, що саме і дозволяє використовувати Linq to Objects в .Net Framework 2.0.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Реалізує generic делегати &lt;span style="font-weight: bold;"&gt;Func&lt;/span&gt; та &lt;span style="font-weight: bold;"&gt;Action&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Реалізує &lt;span style="font-weight: bold;"&gt;ExtensionAttribute&lt;/span&gt;, який дозволяє використовувати extension methotds в .Net Framework 2.0.&lt;/li&gt;&lt;/ul&gt;Однак це не стосується &lt;span style="font-weight: bold;"&gt;Linq to Sql &lt;/span&gt;та &lt;span style="font-weight: bold;"&gt;Linq to Xml&lt;/span&gt;, які ця бібліотека не реалізує.&lt;br /&gt;&lt;br /&gt;Детально про LinqBridge, і про те чому це можливо &lt;a href="http://www.albahari.com/nutshell/linqbridge.aspx"&gt;читайте в статті автор&lt;/a&gt;а, якому я дуже вдячний за чудову роботу.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-6114733026307027082?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/qXQ-RPzn1Ko" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/6114733026307027082/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=6114733026307027082" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6114733026307027082?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6114733026307027082?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/qXQ-RPzn1Ko/linq-net-framework-20.html" title="Linq в .Net Framework 2.0" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/06/linq-net-framework-20.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QNSX86eip7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-176732399986776480</id><published>2009-02-15T23:35:00.003+02:00</published><updated>2009-10-13T23:23:18.112+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:23:18.112+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Books" /><title>Харпер Лі. Убить пересмешника.</title><content type="html">В романі &lt;a href="http://ru.wikipedia.org/wiki/%D0%9B%D0%B8,_%D0%A5%D0%B0%D1%80%D0%BF%D0%B5%D1%80"&gt;Харпер Лі&lt;/a&gt;, очима маленької дівчинки, показано життя Америки на початку минулого століття.&lt;br /&gt;&lt;br /&gt;Читається дуже легко, чимось нагадало "Пригоди Тома Сойєра" Марка Твена.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-176732399986776480?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/UMx0wUCaXrk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/176732399986776480/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=176732399986776480" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/176732399986776480?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/176732399986776480?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/UMx0wUCaXrk/blog-post_7610.html" title="Харпер Лі. Убить пересмешника." /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/02/blog-post_7610.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QNSX86eip7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-3571837635056757413</id><published>2009-02-15T09:34:00.004+02:00</published><updated>2009-10-13T23:23:18.112+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:23:18.112+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Books" /><title>Вернор Виндж. Пламя над бездной.</title><content type="html">В романі автор пропонує дуже цікавий погляд на будову всесвіту. Він поділяється на зони - від центра до краю. В центрі - безодня, в якій розум неможливий. Чим ближче до краю, тим технологічнішими можуть бути цивілізації. В Краї, швидкість світла не є обмеженням. За краєм цивілізації стають Силами (я так і не зрозумів що це таке).&lt;br /&gt;&lt;br /&gt;Розпочинається книга, тим, що представники людської цивілізації, десь в Краї, знайшли та розворушили якийсь архаїчний архів, і цим розбудили Зло, яке собі спокійно дрімало мільйони років. Корабель, в якому, як виявилось була протидія, встиг втекти і потрапив на планету в повільній зоні.&lt;br /&gt;&lt;br /&gt;Надалі, однією з основних сюжетних ліній є опис цивілізації собакоподібних зграй, які населяють ту планету, де приземлився космічний корабель з утікачами. Ці собаки можуть бути розумними лише коли об'єднані в зграю. І вся зграя - це одна особистість. &lt;br /&gt;&lt;br /&gt;Щоб активувати протидію Злу, споряджена експедиція. Пригоди та стосунки членів екіпажу: жінки, чоловіка, який певним чином пов'язаний із Силою, та двох розумних рослин на візках складають іншу сюжетну лінію.&lt;br /&gt;&lt;br /&gt;І все це переплітається повідомленнями із груп новин пародійної всесвітньої мережі "мільйонів неправд".&lt;br /&gt;&lt;br /&gt;Мені роман сподобався своєю незвичністю. Тепер собак шкода, як же їм, бідним "синглетам" живеться.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-3571837635056757413?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/dXEQAqTdL8g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/3571837635056757413/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=3571837635056757413" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3571837635056757413?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3571837635056757413?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/dXEQAqTdL8g/blog-post_15.html" title="Вернор Виндж. Пламя над бездной." /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/02/blog-post_15.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MCR3Y_fCp7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-4611967212947931194</id><published>2009-02-02T23:10:00.003+02:00</published><updated>2009-10-13T23:24:26.844+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:24:26.844+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Books" /><title>Герберт Уэллс. Машина времени.</title><content type="html">&lt;a href="http://lib.aldebaran.ru/author/uyells_gerbert/uyells_gerbert_mashina_vremeni/"&gt;Ця книга&lt;/a&gt; давно була в мене в readlist'і. Нарешті дійшли руки її прочитати. Перед тим як її завантажити, прочитав кілька дуже схвальних відгуків. І мабуть тому від книги очікував більше. Але прочитав із задоволенням, швидко. Перед сном і з ранку в метро.&lt;br /&gt;Головною темою книги є питання соціальної нерівності, яке автор показав в незвичному ракурсі.&lt;br /&gt;&lt;br /&gt;PS. Я думаю, що людству до 8000 року не дотягнути.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-4611967212947931194?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/l9Vhvs8kIlY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/4611967212947931194/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=4611967212947931194" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/4611967212947931194?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/4611967212947931194?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/l9Vhvs8kIlY/blog-post_02.html" title="Герберт Уэллс. Машина времени." /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/02/blog-post_02.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MCR3Y_fSp7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-6912215716038341295</id><published>2009-02-01T07:35:00.005+02:00</published><updated>2009-10-13T23:24:26.845+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:24:26.845+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Books" /><title>Стивен Хокинг и Леонард Млодинов. Кратчайшая история времени.</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://amphora.ru/book.php?id=832"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 214px; height: 320px;" src="http://4.bp.blogspot.com/_77xe419MW1k/SYU1nDhkgoI/AAAAAAAAEY8/dMMLbrZKGCg/s320/A+Briefer+History+of+Time.jpg" alt="" id="BLOGGER_PHOTO_ID_5297699481748537986" border="0" /&gt;&lt;/a&gt; Прочитав &lt;a href="http://amphora.ru/book.php?id=832"&gt;чергову книгу&lt;/a&gt; найвідомішого (принаймні для мене) фізика сучасності.&lt;br /&gt;&lt;br /&gt;В цій книзі автор намагається, іще доступніше ніж в своїх попередніх книгах, пояснити будову всесвіту, з точки зору сучасної фізики.&lt;br /&gt;&lt;br /&gt;І дійсно складні речі в книзі пояснені дуже доступно і з цікавими прикладами. Прочитав із великим задоволенням.&lt;br /&gt;&lt;br /&gt;P.S. Але така хитрість автора зі мною не спрацювала. Все рівно нічого не розумію.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-6912215716038341295?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/Qxjw9meTfbQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/6912215716038341295/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=6912215716038341295" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6912215716038341295?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6912215716038341295?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/Qxjw9meTfbQ/blog-post.html" title="Стивен Хокинг и Леонард Млодинов. Кратчайшая история времени." /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_77xe419MW1k/SYU1nDhkgoI/AAAAAAAAEY8/dMMLbrZKGCg/s72-c/A+Briefer+History+of+Time.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2009/02/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUHQnc-fip7ImA9WxVXFkU.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-2859159140534659674</id><published>2008-10-30T07:17:00.007+02:00</published><updated>2009-02-15T09:33:53.956+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-15T09:33:53.956+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Testing" /><category scheme="http://www.blogger.com/atom/ns#" term="NUnit" /><title>Unit testing #2. NUnit constraint-based Asserts</title><content type="html">Починаючи з версії 2.4 в NUnit реалізовано новий стиль assert'ів. Ця модель використовує один метод Assert.That(args) для всіх тверджень. Логіка виконання кожного твердження перенесена в другий параметр. Ось декілька прикладів:&lt;br /&gt;&lt;pre class="csharp"&gt;Assert.That(10.0/3.0, Is.EqualTo(3.33).Within(0.01f));&lt;br /&gt;Assert.That(2*2, Is.Not.EqualTo(5));&lt;br /&gt;Assert.That(new object(), Is.Not.Null);&lt;br /&gt;Assert.That(string.Empty, Is.Empty);&lt;br /&gt;Assert.That("abc", Has.Length(3));&lt;br /&gt;Assert.That(new string[] {"a", "b", "c"}, Is.All.Not.Null);&lt;br /&gt;&lt;/pre&gt;Також можна комбінувати constraints.&lt;br /&gt;&lt;pre class="csharp"&gt;Assert.That(3, Is.LessThan( 5 ) | Is.GreaterThan( 10 ));&lt;br /&gt;Assert.That("s", !Is.Null));&lt;/pre&gt;Для того щоб працювати з новим стилем потрібно використати:&lt;br /&gt;&lt;pre class="csharp"&gt;using NUnit.Framework.SyntaxHelpers;&lt;br /&gt;&lt;/pre&gt;Цей стиль мені подобається більше ніж &lt;a href="http://www.nunit.org/index.php?p=classicModel&amp;amp;r=2.4.8"&gt;класичний&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Детальніше - на сторінці &lt;a href="http://www.nunit.org/index.php?p=constraintModel&amp;amp;r=2.4.8"&gt;Constraint-Based Assert Model &lt;/a&gt;документації NUnit .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-2859159140534659674?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/xdr7uMs6dJw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/2859159140534659674/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=2859159140534659674" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2859159140534659674?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2859159140534659674?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/xdr7uMs6dJw/unit-testing-2-nunit-constraint-based.html" title="Unit testing #2. NUnit constraint-based Asserts" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2008/10/unit-testing-2-nunit-constraint-based.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4MR3o7cSp7ImA9WxRWEks.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-2902417838402813074</id><published>2008-10-29T08:07:00.010+02:00</published><updated>2008-10-29T09:23:06.409+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-29T09:23:06.409+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Testing" /><category scheme="http://www.blogger.com/atom/ns#" term="NUnit" /><title>Unit testing #1</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_77xe419MW1k/SQgCH2R9yfI/AAAAAAAADf4/sF9miZwdcos/s1600-h/utc2.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 190px; height: 228px;" src="http://3.bp.blogspot.com/_77xe419MW1k/SQgCH2R9yfI/AAAAAAAADf4/sF9miZwdcos/s320/utc2.jpg" alt="" id="BLOGGER_PHOTO_ID_5262458498435631602" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Я знову вирішив щось написати. Справа в тому, що я почав читати книгу &lt;a href="http://www.pragprog.com/titles/utc2/pragmatic-unit-testing-in-c-with-nunit"&gt;"Pragmatic Unit Testing in C# with NUnit"&lt;/a&gt; by Andy Hunt and Dave Thomas with Matt Hargett. І ось, вночі, коли я прочитав перші сторінки, я подумав - "Круто, прочитав лише кілька сторінок, а вже виніс для себе чотири нових речі про які не знав раніше. А наступного дня, коли на роботі розказував, що книжка цікава, що я дізнався чотири нових штучки, ніяк не міг згадати, а про яку ж все-таки четверту річ я дізнався. От три пам'ятаю а четверту ні. Отже треба ці знання записувати. Тут їм і буде місце.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;Тіп #1. "Ommit the &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;message&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; string for reporting unless you really need to".&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ось класичний синтаксис Assert в NUnit:&lt;br /&gt;&lt;pre&gt;Assert.AreEqual(expected, actual [, string message])&lt;/pre&gt;Автори рекомендують не включати текстовий рядок для пояснення тесту, крім випадків коли це дійсно необхідно. Краще коли ім'я тесту самостійно пояснює призначення самого тесту, коли використовуються доречні методи Assert'а, або тест розбивається на декілька методів, щоб залишатися сконцентрованими на конкретних тестових випадках.&lt;br /&gt;&lt;br /&gt;Що ж в цій практиці революційного і чому вона нова для мене? Не знаю. Просто я чомусь часто писав ці текстові пояснення в NUnit Assert'ах. Мабуть це був вплив StyleCop, який змушує завжди писати пояснення для методу System.Diagnostics.Deиug.Assert. А тепер не буду, звісно крім випадків, коли це дійсно необхідно :).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-2902417838402813074?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/o0fakrJL4rk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/2902417838402813074/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=2902417838402813074" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2902417838402813074?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2902417838402813074?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/o0fakrJL4rk/unit-testing-1.html" title="Unit testing #1" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_77xe419MW1k/SQgCH2R9yfI/AAAAAAAADf4/sF9miZwdcos/s72-c/utc2.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2008/10/unit-testing-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0INSH85eyp7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-7441615525813611</id><published>2008-07-02T23:00:00.003+03:00</published><updated>2009-10-13T23:26:39.123+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:26:39.123+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Relax" /><title>Двоколісний друг</title><content type="html">Нарешті купив мотик. Yamaha YBR 125. Або просто "йобр", чи "юбка". Уже встиг впасти :). Фотки потім.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-7441615525813611?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/WUSaTVdw_Wg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/7441615525813611/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=7441615525813611" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/7441615525813611?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/7441615525813611?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/WUSaTVdw_Wg/blog-post.html" title="Двоколісний друг" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2008/07/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AHSX05eip7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-3594526220378822145</id><published>2008-06-02T22:41:00.003+03:00</published><updated>2009-10-13T23:28:58.322+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:28:58.322+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Finance" /><title>Інвестиційний портфель</title><content type="html">Натрапив на сайт &lt;a href="http://www.investportfel.com"&gt;Мой инвестиционный портфель&lt;/a&gt;, який дозволяє контролювати та аналізувати свої інвестиційні вклади. Я для таких цілей використовував spreadsheets в Google docs. Мушу визнати що користуватися новим ресурсом значно простіше.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-3594526220378822145?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/WJoKgATsV_M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/3594526220378822145/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=3594526220378822145" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3594526220378822145?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3594526220378822145?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/WJoKgATsV_M/blog-post.html" title="Інвестиційний портфель" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2008/06/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EFRHc_fCp7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-6055103743651245288</id><published>2008-04-11T00:05:00.003+03:00</published><updated>2009-10-13T23:26:55.944+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:26:55.944+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tip" /><title>Як перезавантажити IPod</title><content type="html">Що робити коли завис IPod? Перезавантажити. Як це зробити описано &lt;a href="http://docs.info.apple.com/article.html?artnum=61705-ru"&gt;тут&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-6055103743651245288?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/7UxXrYjZbCY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/6055103743651245288/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=6055103743651245288" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6055103743651245288?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/6055103743651245288?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/7UxXrYjZbCY/ipod.html" title="Як перезавантажити IPod" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2008/04/ipod.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QNSX86eyp7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-2596795136124078187</id><published>2008-03-31T22:53:00.002+03:00</published><updated>2009-10-13T23:23:18.113+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:23:18.113+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Books" /><title>Николай Гаврилович Чернышевский: Что делать?</title><content type="html">&lt;blockquote&gt;Кто не изучил человека в самом себе, никогда не достигнет глубокого знания людей.&lt;/blockquote&gt;Сильний твір! Розумний і непростий. Чомусь не можу дібрати слів, щоб описати про що саме ця книга. Мабуть про стосунки людей, про місце особи в суспільстві, про особистість... Не знаю, якось складно передати враження від роману в двох словах. Та мабуть цього й не варто робити...&lt;br /&gt;Комусь твір може здатись неактуальним для нашого часу. Так я з кимось не погоджусь. Одним словом, раджу читати &amp;mdash; книга точно не залишить Вас байдужим.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-2596795136124078187?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/nQWzPDvOL50" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/2596795136124078187/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=2596795136124078187" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2596795136124078187?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/2596795136124078187?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/nQWzPDvOL50/blog-post_31.html" title="Николай Гаврилович Чернышевский: Что делать?" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><thr:total>0</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2008/03/blog-post_31.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IDSH08eyp7ImA9WxNWFEs.&quot;"><id>tag:blogger.com,1999:blog-8619358898227991199.post-3877267754247509877</id><published>2008-03-11T00:58:00.009+02:00</published><updated>2009-10-13T23:26:19.373+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-13T23:26:19.373+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Vim" /><title>Vim localization</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_77xe419MW1k/R9XCGvy7t7I/AAAAAAAACD4/Pbn-uX2mSGQ/s1600-h/IMG_0655.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_77xe419MW1k/R9XCGvy7t7I/AAAAAAAACD4/Pbn-uX2mSGQ/s400/IMG_0655.JPG" alt="" id="BLOGGER_PHOTO_ID_5176256767897352114" border="0" /&gt;&lt;/a&gt;Давно вже хотів написати про мій досвід використання української мови (та й російської теж) в Vim, і ніяк не міг за це діло взятись. Але врешті-решт я це зробив!&lt;br /&gt;&lt;br /&gt;&lt;a title="Vim homepage" href="http://www.vim.org/index.php" id="xh5k"&gt;Vim&lt;/a&gt; — один з найпопулярніших текстових редакторів. Докладніше про Vim можна почитати на &lt;a title="Vim homapage" href="http://www.vim.org/index.php" id="y85o"&gt;домашній сторінці&lt;/a&gt; та на &lt;a title="Vim в Wikipedia" href="http://ru.wikipedia.org/wiki/VIM" id="diu8"&gt;сторінці в wikipedia&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Цей редактор дозволяє значно підвищити швидкість роботи з текстом. На жаль, до недавнього часу, при роботі з кириличними текстами, я піддавав сумніву це твердження. Саме про це й піде мова далі.&lt;br /&gt;&lt;h4&gt;&lt;b&gt;Використання кириличної розкладки&lt;/b&gt;&lt;/h4&gt;  Як відомо Vim має декілька режимів роботи (хоча як говорить мій друг &lt;a title="Hobbin's blog" href="http://hobbinsblog.blogspot.com/" id="lxu9"&gt;Hobbin&lt;/a&gt; "Vim має два режими в  одному — пищить, а в іншому все псує" :)). Так от, без спеціального налаштування, Vim в нормальному режимі не сприймає команди набрані кириличною розкладкою. Далі наведено два методи для подолання цього неподобства.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Метод I. Використання langmap&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Доповнити _vimrc такими рядками (простіше вчинити як я — просто використати _vimrc колеги)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;" Cyrillic keys support&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;:set langmap=ФИСВУАПРШОЛДЬТЩЗЙКІЫЕГМЦЧНЯЖЮЇЪ;ABCDEFGHIJKLMNOPQRSSTUVWXYZ:&gt;}},&lt;br /&gt;фисвуапршолдьтщзйкыіегмцчняжюїъ]];abcdefghijklmnopqrsstuvwxyz\;.\,,\;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Саме так я жив досить довгий час. Але при наборі команд в режимі командного рядка&lt;b&gt; &lt;/b&gt;все одно доводиться переключатися до латинської розкладки. Ця проблема вирішується при використанні методу II.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Метод II. Використання keymap&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Виявляється Vim дозволяє підключити  зовнішню розкладку клавіатури за допомогою команди &lt;span style="font-family:Courier New;"&gt;set keymap&lt;/span&gt;, і перключати розкладки вже всередині самого редактора за допомогою команди &amp;lt;ctrl-6&amp;gt; (в &lt;span style="font-weight: bold;"&gt;режимі редагування&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;В директорії $Vim\vim71\keymap (для Vim версії 7.1) серед інших, я знайшов файл ukrainian-jcuken.vim (by Anatoli Sakhnik) з українською розкладкою звичною для Linux. Але так як я звик до Windows варіанту (та й клавіатури тільки з Windows розкладкою попадались :)), то вирішив створити українську розкладку характерну для Windows. За основу я взяв файл з російським аналогом russian-jcukenwin.vim (by Artem Chuprina), де добавив відповідні українські символи, та добавив апостроф замість букви "ё". Розкладка з апострофом використовується у Windows Vista під назвою ukrainian enhanced. Так і я назвав свою. Сам файл опублікував серед скриптів vim за адресою &lt;a title="Ukrainian enhanced keymap" href="http://www.vim.org/scripts/script.php?script_id=2165" id="ze5b"&gt;http://www.vim.org/scripts/script.php?script_id=2165&lt;/a&gt;. Якщо така розкладка виявиться корисною іще для когось, то я скористаюсь порадою Анатолія Сахніка і напишу листа до &lt;a title="vim_dev" href="http://groups.google.com/group/vim_dev" id="ut6o"&gt;vim_dev&lt;/a&gt; з пропозицією добавити її до дистрибутиву Vim. Наразі, судячи з рейтингу -1/1, цей скрипт не викликає захоплення у Vim спільноти :). Для того щоб скористатися розкладкою, просто збережіть файл до директорії $Vim\vimfiles\keymap та розширте _vimrc таким:&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;&lt;br /&gt;" Ukrainian layout support. Use &amp;lt;ctrl-6&amp;gt; (&amp;lt;ctrl-^&amp;gt;) in Insert mode, to toggle layouts.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;set keymap=ukrainian-enhanced&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;" Default - latin layout&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;set iminsert=0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;" Default - latin layout in search mode&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;set imsearch=0&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Для того щоб переключити розкладку, використовуйте &amp;lt;ctrl-^&amp;gt; (&amp;lt;ctrl-6&amp;gt; в Windows).&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt; &lt;p&gt;&lt;/p&gt; &lt;h4&gt;&lt;b&gt;Навігація по словам&lt;/b&gt;&lt;/h4&gt; Vim неправильно опрацьовує команди навігації пов'язані з визначенням слова, такі як &lt;b&gt;w &lt;/b&gt;— слово вперед, &lt;b&gt;e&lt;/b&gt; — перейти до кінця слова, &lt;b&gt;b&lt;/b&gt; — слово назад, &lt;span style="font-weight: bold;"&gt;*&lt;/span&gt; — знати в тексті слово під курсором, і т.п. Це стосується тільки версії Vim для Windows. Щоб вилікувати цю хворобу, достатньо добавити в файл конфігурації _vimrc такий рядок:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;" Support for words in cyrillic.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;" Default for Windows is: @,48-57,_,128-167,224-235&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set iskeyword=@,48-57,_,А-Я,а-я,І,і,Ї,ї,Є,є,Ґ,ґ&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;В &lt;a title="Vim - Викиучебник" href="http://ru.wikibooks.org/wiki/Vim#Vim_.D0.B8_.D1.80.D1.83.D1.81.D1.81.D0.BA.D0.B0.D1.8F_.D1.80.D0.B0.D1.81.D0.BA.D0.BB.D0.B0.D0.B4.D0.BA.D0.B0_.D0.BA.D0.BB.D0.B0.D0.B2.D0.B8.D0.B0.D1.82.D1.83.D1.80.D1.8B" id="esfv"&gt;першоджерелі&lt;/a&gt; використовується рядок базований на символьних кодах:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set iskeyword=@,48-57,_,192-255&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;, і це мабуть правильно, але, як на мене, там вказано аж надто широкий діапазон кодів, та й використання символьних значень здається більш очевидним. Можливо згодом виникнуть якісь проблеми пов'язані з різними кодуваннями, але поки що перший варіант працює, тому я зупинився на ньому.&lt;br /&gt;&lt;h4&gt;Трохи гумору&lt;/h4&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_77xe419MW1k/R9XCpvy7t8I/AAAAAAAACEA/GeGNXe3BzyM/s1600-h/vim-keyboard.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_77xe419MW1k/R9XCpvy7t8I/AAAAAAAACEA/GeGNXe3BzyM/s400/vim-keyboard.jpg" alt="" id="BLOGGER_PHOTO_ID_5176257369192773570" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_77xe419MW1k/R9XAjfy7t5I/AAAAAAAACDo/z4LFn94z9_k/s1600-h/vim-keyboard.jpg"&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;&lt;a title="The Ideal VIM Keyboard" href="http://www.peterkrantz.com/2006/vim-keyboard/" id="vrh9"&gt;The Ideal VIM Keyboard&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Використані джерела:&lt;/h4&gt;&lt;a title="Домашня сторінка Vim" href="http://www.vim.org/index.php" id="gi21"&gt;Домашня сторінка Vim &lt;/a&gt;&lt;br /&gt;&lt;a title="Vim — Википедия" href="http://ru.wikipedia.org/wiki/VIM" id="kbsz"&gt;Vim — Википедия&lt;/a&gt;&lt;br /&gt;&lt;a title="Vim — Викиучебник" href="http://www.vim.org/index.php" id="ttpz"&gt;Vim — Викиучебник&lt;/a&gt;&lt;br /&gt;&lt;a title="Все о Vim: Русский язык в Виме" href="http://allaboutvim.blogspot.com/2008/01/blog-post.html" id="ttpz"&gt;Все о Vim: Русский язык в Виме&lt;br /&gt;&lt;/a&gt;:help keymap&lt;br /&gt;:help langmap&lt;br /&gt;:help iskeyword&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8619358898227991199-3877267754247509877?l=korneliuk.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/korneliuk/~4/A4Pbe6N2IlQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://korneliuk.blogspot.com/feeds/3877267754247509877/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8619358898227991199&amp;postID=3877267754247509877" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3877267754247509877?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8619358898227991199/posts/default/3877267754247509877?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/korneliuk/~3/A4Pbe6N2IlQ/vim-localization.html" title="Vim localization" /><author><name>Vansha</name><uri>http://www.blogger.com/profile/12117983842614711809</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://bp0.blogger.com/_77xe419MW1k/R09Gsd6GZ1I/AAAAAAAABnM/OWy-n1ppcaU/s320/ICQ.JPG" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_77xe419MW1k/R9XCGvy7t7I/AAAAAAAACD4/Pbn-uX2mSGQ/s72-c/IMG_0655.JPG" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://korneliuk.blogspot.com/2008/03/vim-localization.html</feedburner:origLink></entry></feed>

