<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C#, VB.Net, XML and mass consumption of coffee. &#187; Coding</title>
	<atom:link href="http://www.paul-zubkov.com/tag/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paul-zubkov.com</link>
	<description></description>
	<lastBuildDate>Wed, 03 Feb 2010 18:25:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Excel VBA macro &#8211; removing blank rows from table</title>
		<link>http://www.paul-zubkov.com/2009/08/05/excel-vba-macro-removing-blank-rows-from-table/</link>
		<comments>http://www.paul-zubkov.com/2009/08/05/excel-vba-macro-removing-blank-rows-from-table/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 18:29:06 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=268</guid>
		<description><![CDATA[
I know not too many people are coding VBA macros, however if you think about it automating office tasks can be a good way to help business people.&#160; I can tell you that most coders will not touch it thinking that users should be able to do this themselves, most users will not be able [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-277" title="news" src="http://www.paul-zubkov.com/wp-content/uploads/2009/08/news.JPG" alt="news" width="300" height="199" /></p>
<p>I know not too many people are coding VBA macros, however if you think about it automating office tasks can be a good way to help business people.&nbsp; I can tell you that most coders will not touch it thinking that users should be able to do this themselves, most users will not be able to do this, simply because you need to actually write the code.&nbsp; I can tell you that knowing VBA earned me a pretty coin, and trust me, this is not too hard to learn.&nbsp;</p>
<p>Here is an example of how to remove all blank rows from a table in excel:</p>
<p><span id="more-268"></span></p>
<p><code lang="vb[lines]">Public Sub main()</p>
<p>    Dim rBody As Range<br />
    Dim iRow As Integer<br />
    Dim iCell As Integer<br />
    Dim iStoreToKill() As Integer<br />
    Dim iIndexer As Integer<br />
    Dim iEmptyCounter As Integer</p>
<p>    iEmptyCounter = 0<br />
    iIndexer = 0</p>
<p>    Set rBody = Range("BODY").Cells</p>
<p>    For iRow = 1 To rBody.Rows.Count</p>
<p>        If rBody.Cells(iRow, 1).Value = vbNullString Then<br />
            iEmptyCounter = 1<br />
            For iCell = 2 To rBody.Columns.Count<br />
                If rBody.Cells(iRow, iCell).Value = vbNullString Then<br />
                    iEmptyCounter = iEmptyCounter + 1<br />
                End If<br />
            Next</p>
<p>            If iEmptyCounter = rBody.Columns.Count Then<br />
                iIndexer = iIndexer + 1<br />
                ReDim Preserve iStoreToKill(1 To iIndexer)<br />
                iStoreToKill(iIndexer) = iRow<br />
            End If<br />
        End If<br />
    Next</p>
<p>    If iIndexer > 0 Then<br />
        For i = iIndexer To 1 Step -1<br />
            rBody.Rows(iStoreToKill(i)).EntireRow.Delete<br />
        Next<br />
    End If</p>
<p>End Sub</code></p>
<p>Let&#8217;s take a closer look at this:<br/><br/></p>
<p>Lines 3 through 8 &#8211; we need couple of variables to get this done.&nbsp; On line 3 we are declaring an object of type Range which is a collection of cells, line 6 introduces an array where we are going to store indexes of rows which are blank and needs to be deleted.</p>
<p><br/><br/></p>
<p>On line 8 we are actually assign our range.&nbsp; In this case, the range was pre-defined, but you can easily declare your own ranges by specifying cell coordinates.&nbsp; Now let&#8217;s get this thing going &#8211; line 15 we are going through all the rows within our range to see if we have any blank rows.&nbsp; Line 17 checks if the first cell in the row is empty.&nbsp; If it is, we are looking at all the cells within the row and increment our emptyCounter every time we find a blank cell (lines 19 through 23).&nbsp;</p>
<p><br/><br/></p>
<p>Lines 25 through 29 &#8211; we want to see if our counter of empty cells in this particular row matches with the number of columns in the range.&nbsp; If we have a match, this means that basically all the cells in the row are blank.&nbsp; Line 27 &#8211; we need to resize the array, while preserving all the values that are already there.&nbsp; VBA does not have ArrayLists or any dynamically sized collections, so the only way to add an element to an array when you have no idea what the total capacity of the array would be before you start is to do redim preserve.&nbsp;&nbsp;&nbsp; This way my iStoreToKill will contain the indexes of all blank rows in the range.</p>
<p><br/><br/></p>
<p>Lines 33 through 37 &#8211; well, if our iStoreToKill is not empty, we want to remove some of the rows.&nbsp; Line 34 &#8211; we are going through our array backwards.&nbsp; Why backwards &#8211; well, so your indexes will not change on you when you delete the rows going down.&nbsp; Lets imagine we have this thing going:</p>
<p><br/><br/></p>
<p>1 First row<br />
<br/><br/><br />
2<br />
<br/><br/><br />
3 Third row<br />
<br/><br/><br />
4<br />
<br/><br/><br />
5 Fifth row<br />
<br/><br/><br />
We need to remove 2nd and 4th rows, right?&nbsp; So if we go through array forward, we kill row number 2 first and then you get this type of contruct -<br />
<br/><br/><br />
1 First row<br />
<br/><br/><br />
2 Third row<br />
<br/><br/><br />
3<br />
<br/><br/><br />
4 Fifth row<br />
<br/><br/><br />
On your second iteration, we will kill row number 4 which would be the one tagged &#8220;Fifth row&#8221; and this is not what we are after here.&nbsp; After we are all done, we should get the table without any blank rows.<br />
<br/><br/><br />
Keep in mind &#8211; you need to goof around with security settings of Excel.&nbsp; If you are doing macros &#8211; get yourself code signing certificate &#8211; it will help you distribute your macros.<br />
<br/><br/><br />
I would love to hear a feedback on this post &#8211; I am not sure if I should come up with more VBA examples.<br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2009/08/05/excel-vba-macro-removing-blank-rows-from-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New (at least for me) IO functions.</title>
		<link>http://www.paul-zubkov.com/2009/06/30/new-at-least-for-me-io-functions/</link>
		<comments>http://www.paul-zubkov.com/2009/06/30/new-at-least-for-me-io-functions/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 04:39:24 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=212</guid>
		<description><![CDATA[
Well, live and learn.  This was an interesting day.  I am working on a little project right now, can&#8217;t really discuss details, and quite frankly it is nothing that I am going to be too proud of once it is done.  But this is not the point.  I had to do [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-217" title="embarrassing" src="http://www.paul-zubkov.com/wp-content/uploads/2009/06/bear.png" alt="embarrassing" width="296" height="200" /></p>
<p>Well, live and learn.  This was an interesting day.  I am working on a little project right now, can&#8217;t really discuss details, and quite frankly it is nothing that I am going to be too proud of once it is done.  But this is not the point.  I had to do some minor IO work with this and this is when I found that instead of doing stuff like:<code lang="csharp"></p>
<p>_fsCFileStream = new FileStream(sFileName, FileMode.Open, System.IO.FileAccess.Read);<br />
_srStreamReader = new StreamReader(_fsCfMCCSV, Encoding.GetEncoding(1252));</p>
<p>try<br />
{<br />
    if ((sLineIn = _srCfMCCSV.ReadLine()) == null)<br />
        //do stuff here<br />
}catch(){}<br />
</code><br />
I can simply do<br />
<code lang="csharp"><br />
File.ReadAllLines();<br />
</code></p>
<p>I guess I was stuck on .Net 1.3 for so long, I completely skipped 2.x and now 3.5 is full of surprises.  I know I am behind times, need to catch up soon.  Gone to do some reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2009/06/30/new-at-least-for-me-io-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter &#8211; I like PHP again!</title>
		<link>http://www.paul-zubkov.com/2009/06/11/codeigniter-i-like-php-again/</link>
		<comments>http://www.paul-zubkov.com/2009/06/11/codeigniter-i-like-php-again/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 23:46:09 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=208</guid>
		<description><![CDATA[
In the last few years my focus was on .Net, I love C# with all my heart(my wife does not read this blog, so I am free to say that).  It is the language that is structured enough and at the same time powerful and flexible.  There have been many advances in .Net, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-209" title="jumping" src="http://www.paul-zubkov.com/wp-content/uploads/2009/06/jumping.jpg" alt="jumping" width="306" height="200" /></p>
<p>In the last few years my focus was on .Net, I love C# with all my heart(my wife does not read this blog, so I am free to say that).  It is the language that is structured enough and at the same time powerful and flexible.  There have been many advances in .Net, WPF and MVC are exactly what was needed by the development community.  Although there are still issues with .Net that have to be resolved, I feel that the framework itself is on the right track.  With all my love for .Net I have forgotten about one of the languages that I had started my coding with &#8211; PHP.  </p>
<p>One of the greatest advantages of .Net as to compare to scripting languages like PHP is ability to really trace the code diving into smallest details.  I have hard time imagining debugging something without ability to &#8220;watch&#8221; the variables that I am working on.  Visual Studio is a very well written IDE, I can&#8217;t even think of an IDE that comes close to VS, so I got spoiled by all this luxury, until a week ago my boss came up with a project that required use of PHP.  </p>
<p>I decided to take on the project myself, wanted to refresh the stuff I knew about PHP and all that.  By saying that I would be taking on this myself, I mean the back end, after all my designing skills are very limited and I had given up on creating nice UI long time ago.  Will, the UI dude would be making this thing look nice.  So after accepting the project, I had started reading on what is going on with PHP, and guess what, there have been some incredible things that were released since I last worked on PHP.  Which should not be a surprise, progress can&#8217;t be stopped, just me with my deep submersion into .Net stayed completely oblivious to this part of coding.  This is how I found <a href="http://codeigniter.com/" target="_blank">Codeigniter</a>.</p>
<p>Now, nobody is paying me for this (I wish someone did), so this is an honest plug of the framework that was done so well, I had coded that silly file sharing thingy that my boss wanted in about 3 days.  Keep in mind, this was just the back end, now Will is goofing around with design, and I am sure he will do great, as usual.  I found that Codeigniter made my work so much easier.  Great documentation is written for the framework, there is a forum and even an IRC channel.  To me, this represented a great change from the wild days of my PHP coding.  I would recommend Codeigniter to everyone who is interested in doing work with PHP quickly.  </p>
<p>Other great things I used on this project &#8211; <a href="http://www.aptana.com/" target="_blank">Aptana Studio</a> (excellent IDE, still have not figured out how to use that build in Subversion plugin) and <a href="http://www.wampserver.com/en/" target="_blank">WAMP</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2009/06/11/codeigniter-i-like-php-again/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Firefox as development platform?</title>
		<link>http://www.paul-zubkov.com/2009/05/28/firefox-as-development-platform/</link>
		<comments>http://www.paul-zubkov.com/2009/05/28/firefox-as-development-platform/#comments</comments>
		<pubDate>Fri, 29 May 2009 02:00:25 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[FireFox]]></category>
		<category><![CDATA[FireFTP]]></category>
		<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[YSlow]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=188</guid>
		<description><![CDATA[
FireFox has been my browser of choice for quite some time.  I am the kind of guy who likes customization.  There is a certain ways my computer has to be set up, its just the kind of person I am.  Perhaps for me the most important feature of FireFox would be plug-ins. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-205" title="gears" src="http://www.paul-zubkov.com/wp-content/uploads/2009/05/gears.jpg" alt="gears" width="268" height="200" /></p>
<p>FireFox has been my browser of choice for quite some time.  I am the kind of guy who likes customization.  There is a certain ways my computer has to be set up, its just the kind of person I am.  Perhaps for me the most important feature of FireFox would be plug-ins.  This is the best tool for customization of your browser.  Now, I have been impressed with newest Internet Explorer, add-ons are step in the right direction, but at this point there are no add-ons to help with coding, but when it comes to FireFox, well, let me just list some:</p>
<p>Most obvious -<a href="https://addons.mozilla.org/en-US/firefox/addon/60"> Web Developer</a> &#8211; lets just say that this is a must have if you are coding for web.  List of features is just too long and I am just to lazy to list everything, lets just say without it any kind of coding for web would just take too long.</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/1843" target="_blank">Firebug </a>- simply put one of the best tools for debugging your web site.  Add <a href="http://developer.yahoo.com/yslow/" target="_blank">YSlow </a>and get in depth analysis of what is going on with your project.</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/8487" target="_blank">Pencil</a> &#8211; free and quite powerful tool for UI prototyping and diagrams, try it out.  It won&#8217;t replace industry standard software, I for one prefer Visio or coffee shop napkins and black pen, depends on where the idea strikes me, but if you need to do something quick, Pencil would do just fine.</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/684" target="_blank">FireFTP </a>I can&#8217;t really count number of times I needed to ftp something quickly.  FireFTP serves just that purpose.  I can&#8217;t really recommend it for transferring bunch of files, keeps on timing out, but then again, I have not really played with all settings to affect that.</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/1002" target="_blank">Codetch </a>- an IDE like plugin which lets you work with your files in a manner similar to Dreamweaver.  Once again, for a full blown project I would use a stand alone IDE, most likely Visual Studio or Komodo Edit, but for a quick change Codetch does the job.</p>
<p>There are more, much more.  These are the things that I use quite often.  Now, with all that great functionality, would I consider FireFox as a development platform?  The answer is no.  There are tools that are designed specifically for development purposes, while FireFox is a browser.  It might be handy to keep a jump drive with overloaded FireFox installed handy for some quick coding while your machine is unavailable, but for full blow development project, there are tools that can do the job much better.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2009/05/28/firefox-as-development-platform/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Optimizing Developer</title>
		<link>http://www.paul-zubkov.com/2009/05/15/optimizing-developer/</link>
		<comments>http://www.paul-zubkov.com/2009/05/15/optimizing-developer/#comments</comments>
		<pubDate>Fri, 15 May 2009 16:09:15 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[managing]]></category>
		<category><![CDATA[motivation]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[procrastination]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=201</guid>
		<description><![CDATA[
Have you ever looked at a code that you wrote several years ago?  I have to do this all the time, after all I am working on the same application.  Not only do I do it to fix bugs, but I do it to optimize the production code.  And at times I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-190" title="man_rain" src="http://www.paul-zubkov.com/wp-content/uploads/2009/05/man_rain.jpg" alt="man_rain" width="300" height="201" /></p>
<p>Have you ever looked at a code that you wrote several years ago?  I have to do this all the time, after all I am working on the same application.  Not only do I do it to fix bugs, but I do it to optimize the production code.  And at times I see my old code and think what was I thinking when I wrote this.   You see, with every release our main product grows, new features, core changes, you name it.  One can say that we are optimizing the software by adding things our clients ask for and this leads to optimization of code.  Optimizing your code is extremely important, normally there are few ways in which a particular problem could be solved, but if you are serious about your work, you do want to pick the most efficient way of doing things.  Many books have been written on the subject, simple Google search will produce lots of articles concerning code optimization.  Today I am not going to talk about that, instead I will talk about optimizing a developer.</p>
<p>If you are like me &#8211; doing coding full time and at times after hours, you want to achieve something which falls beyond simple financial compensation for you work.  I want to grow as a developer.  I have read somewhere that it takes roughly 10000 hours to master a task &#8211; be it musical instrument, a sport or any other activity.  I think similar thing is applied to programming.    I have been thinking of a way to apply optimization to myself, after all if my code can be optimized, why can&#8217;t the writer of the code.  Here are some principles that I have came up with.  This works for me, might not work for everyone.  Once again, just my own opinion.<span id="more-201"></span></p>
<p>So here it is &#8211; list of  things I (or you) need to know:</p>
<p><strong>Data Structures.</strong></p>
<p>Have you ever thought as to why virtually every course on a programming language begins with overview of your Data Structures.  Pick up a book on any programming languages, I guarantee you you would find explanation of some basic types as well as more complex types within first 20 pages of the book.  Why do all authors bother putting virtually same information in?  Data structures are basic building blocks.  If you don&#8217;t get the data structures, their limitation, advantages and benefits, you might as well stop coding altogether.</p>
<p><strong>Language.</strong></p>
<p>Let&#8217;s be honest, it is not that difficult to pick up a new programming language once you mastered couple.  At first all you notice is changes in syntax, for instance Ruby is much more &#8220;English&#8221; like language in my book then let&#8217;s say C.  But it goes beyond syntax and different names for your data structures.  Every language has it&#8217;s own ways of doing things, which might not seem all that obvious to a novice.  Spend time, learn tricks of the language, you will get better appreciation for the hard work authors of the language put into it.  You would also gain deeper understanding of how to solve that problem in the best possible way.</p>
<p><strong>Compiler / Interpreter.</strong></p>
<p>Compilers are mysterious pieces of code that actually make sense of what a coder is trying to accomplish.  Every compiler is different, with its own routines for optimization, process handling and so on.  I don&#8217;t think it would be fair to say that one has to become an expert on his compiler of choice, but more understanding of how your code is compiled or interpreted will give you advantage in writing this code in the most efficient manner.</p>
<p><strong>Community / Ways to solve the issues.</strong></p>
<p>One of the greatest things about internet is that it gives you access to incredible amount of resources.  Most of the time a search engine is my friend.  When I am stuck on something, I can always search for a solution and even if I can&#8217;t find the solution directly, there are always some situation that are different in many ways and could be applied to solve the issue.  Here is an example &#8211; few years ago I was stuck with a problem.  The project took about 3 month to complete, and at the end we found that one issue, which had nothing to do with data, more of a user experience absolutely prevented us from releasing the feature.  It was one of those situations where 3 month of your work is wiped out by something that you assume was so easy and obvious, but in reality was completely impossible.  Searching for the solution took about 3 weeks, I was not about to give up on 3 month of crazy coding.  I had tortured Google, developer communities, message boards, IRC channels, forums (I think I was even banned couple of times for my persistence), finally with a help of paid support we had an answer which was &#8211; &#8220;this can not be done&#8221;.  This was a total disaster, but through the communication with paid Development Support at Microsoft, the engineer that was working on the case with me, accidentally helped me solve another huge issue which was a limitation that was scaring away many potential customers.  So what happened to the project?  We found a hack to have it work, warned users not to do a certain things at certain instances.  While the original problem was not fully solved, the other huge issue was, and at the end I learned lots of new things and got to talk to many coders.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2009/05/15/optimizing-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bad code, we all do it.</title>
		<link>http://www.paul-zubkov.com/2009/01/27/bad-code-we-all-do-it/</link>
		<comments>http://www.paul-zubkov.com/2009/01/27/bad-code-we-all-do-it/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 18:59:43 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Management]]></category>
		<category><![CDATA[managing]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=147</guid>
		<description><![CDATA[
Bad code we all do it.
Well, I had written my share of bad code.  Couple of weeks ago I had to fix up a class that was written about 4 years ago.  For a while I could not believe I wrote this, but the comments on top clearly identified me as a suspect. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-148" title="978868_166628661" src="http://www.paul-zubkov.com/wp-content/uploads/2009/01/978868_166628661.jpg" alt="978868_166628661" width="300" height="225" /></p>
<p>Bad code we all do it.</p>
<p>Well, I had written my share of bad code.  Couple of weeks ago I had to fix up a class that was written about 4 years ago.  For a while I could not believe I wrote this, but the comments on top clearly identified me as a suspect.  The thing is we all write bad code sometimes.  If you never wrote any bad code, please raise the hand with which you did not do it.</p>
<p>So, going back to the story – I was looking at it and my first impulse was to try to hide it far away so nobody would ever have to look at it.  My second impulse was to rewrite it.  I figured, it would probably take me about 5 hours to redo this.  I did not do any of it.  Instead I brewed a fresh pot of coffee, put my pride far away, printed out copies of it for all developers in the office and decided to play a game.  <span id="more-147"></span>My team consists of 4 coders; two of them were with the company for about 3 years, 1 for about a year and one guy just started in September.  So instead of hiding it or quietly rewriting it, I gave my guys the printout and asked them to find mistakes in the class.  By the way, the comments that contained the name of the author were not printed.</p>
<p>“Who wrote this crap?” this was the first thing I heard.  Then in a typical spirit of our development team there were suggestions on what should be done to the author.  And finally there were suggestions, many suggestions.  Some of those were good, some were pointless and some were plainly wrong but one thing stood out for me – we all came up with different things to solve the same problem.  At the end the class was rewritten and suggestions from the rest of the team were used.  After it was done, there was a noticeable performance improvement.  Let’s say file X would take Y seconds to run through the original class, after the changes the same file X would take Y/3 seconds.  I am talking approximate timing, never actually forced any performance testing.  Oh yeah, at the end of it I told everyone who was the author.  That did create some awkward silence for a minute or two.</p>
<p>Why did I do it – I was quite capable of doing the work myself.  As a team lead, it might be a good idea to hide my own faulty code to keep my image, but instead I did the opposite.  I choose to do this for several reasons:</p>
<ul>
<li>We are all stressed out, the project we are on.  We all needed a break from it.  This injection of new problem did wonders for the main project.</li>
<li>I don’t really care about my image, in fact, I would prefer them not to think that I am incapable of making mistakes and can’t be considered a final authority.  I wanted them to find their own solutions.</li>
<li>We all contributed and the result was truly a collaborative effort.</li>
<li>It was clear that we all have different approaches to the same solution.</li>
</ul>
<p>The whole experience was good.  Bad code is unavoidable, but if you learn from it, it was not just a bad code it was a learning experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2009/01/27/bad-code-we-all-do-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keyboard shortcuts Visual Studio 2008</title>
		<link>http://www.paul-zubkov.com/2009/01/26/keyboard-shortcuts-visual-studio-2008/</link>
		<comments>http://www.paul-zubkov.com/2009/01/26/keyboard-shortcuts-visual-studio-2008/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 20:33:45 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[keyboard shortcuts]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=137</guid>
		<description><![CDATA[
When it comes to development, IDE is an important part of the process.  Some people still use some sort of a text editor to do all their coding, and I applaud them for it.  I on the other hand am not a big proponent of typing out all your namespaces / commands / [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-138" title="1003082_60642695" src="http://www.paul-zubkov.com/wp-content/uploads/2009/01/1003082_60642695.jpg" alt="1003082_60642695" width="300" height="178" /></p>
<p>When it comes to development, IDE is an important part of the process.  Some people still use some sort of a text editor to do all their coding, and I applaud them for it.  I on the other hand am not a big proponent of typing out all your namespaces / commands / functions, nor am I capable of memorizing all the functions that are available in a language, so I use IDE.  Since I am coding C# mostly, I am using Visual Studio.  I have to admit – I love Visual Studio, especially with <a href="http://www.jetbrains.com/resharper/">ReSharper</a> (I don&#8217;t work for JetBrains, I just simply love this tool) added to the mix.  I also have to say for the last 5 years I have not been using desktop to do my coding.  I am addicted to laptops, and my boss have been kind enough to always providing me the newest and most powerful laptop budget can allow.  This is why I love the idea of not using your mouse, after all, Visual Studio does come with a great deal of keyboard shortcuts, so why not use it?<span id="more-137"></span>Below is a list of the keyboard shortcuts I use:</p>
<p>Building</p>
<ul>
<li>Ctrl + Shift + B or simply F6  – compiles your solution.</li>
<li>Shift + F6 – compiles current project</li>
</ul>
<p>Debugging:</p>
<ul>
<li>Ctrl + D, C – Display Call Stack window</li>
<li>Ctrl + D, I – Display Immediate window</li>
<li>Ctrl + F5 – Start without debugging</li>
<li>F9 – Set or remove breakpoint</li>
<li>Ctrl + D, W – display Watch window</li>
</ul>
<p>Editing:</p>
<ul>
<li>Ctrl + M, O – Collapse regions</li>
<li>Ctrl + K, F – Format selection</li>
</ul>
<p>For a quick reminder of the keyboard shortcuts see:</p>
<p><a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=e5f902a8-5bb5-4cc6-907e-472809749973&#038;displayLang=en#">C# keyboard shortcuts</a><br />
<a href="http://www.microsoft.com/downloads/details.aspx?familyid=255b8cf1-f6bd-4b55-bb42-dd1a69315833&#038;displaylang=en"> Vb.Net keyboard shortcuts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2009/01/26/keyboard-shortcuts-visual-studio-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are changes good for you?</title>
		<link>http://www.paul-zubkov.com/2008/10/30/are-changes-good-for-you/</link>
		<comments>http://www.paul-zubkov.com/2008/10/30/are-changes-good-for-you/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 18:48:41 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[9-5]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Management]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[changes]]></category>
		<category><![CDATA[managing]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=92</guid>
		<description><![CDATA[
I have been told many many times that changes are supposed to be good for you (or me, since it&#8217;s my situation that we are looking into).  I have been a coder for quite some time now.  I can&#8217;t say that I am absolutely ecstatic about programming.  It does not influence my [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.paul-zubkov.com/wp-content/uploads/2008/10/chairs.jpg"><img class="alignnone size-medium wp-image-97" title="chairs" src="http://www.paul-zubkov.com/wp-content/uploads/2008/10/chairs-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p>I have been told many many times that changes are supposed to be good for you (or me, since it&#8217;s my situation that we are looking into).  I have been a coder for quite some time now.  I can&#8217;t say that I am absolutely ecstatic about programming.  It does not influence my life outside of my office hours and time that I spent at home trying desperately to improve myself.  For instance, I don&#8217;t watch Star Trek or build some kind of crazy contraptions which could loosely be called a robot in my basement, although come to think of it, that sounds like a good idea; the robot one, not the Star Trek.  I don&#8217;t wear nerdy t-shirts with BSOD on it.  I am not participating in heated discussions like &#8220;My IDE is bigger then yours!&#8221; and &#8220;My OS can kick your OS&#8217;s butt&#8221; and so on.  I can&#8217;t say that coding is my passion, it is something I am interested in and it pays my bills.  Another factor would be my formal training &#8211; I have some in development, but as for the other areas I can&#8217;t say that I am properly trained.  Lately something had changed in my work &#8211; I am doing more managerial things then coding.<span id="more-92"></span></p>
<p>When I realized for the first time that this was happening to me, an image of a Pointy Haired Boss came to my mind.  I quickly dismissed it, since I got most of my hair intact and there is no boldness that runs in my family.  But I assured myself that I will keep on coding despite the changes.  It becomes more and more difficult with every day.  I still see a lot of code written by the developers on my team, I get to answer whole bunch of questions from developers as to how should they proceed with their task.  At times it makes me want to ask them if google is down, but that&#8217;s not the point.  Even when I get a chance to code, I have to give projects that interests me to some other people.  These projects are more complex, take more time and require full concentration, and simply put, I can&#8217;t guarantee that I will be able to give these thing time and effort they deserve.</p>
<p>I&#8217;ve tried coding for myself &#8211; invent some little projects and making them happen &#8211; these things simply don&#8217;t work for me.  I guess there is no pressure, no drive and ultimately no purpose other then to stay afloat.  I still read about programming and related fields, and I read a lot, but it will never substitute the real deal &#8211; getting down and writing real life code, with all the stress, cursing, coffee spills and the rest.</p>
<p>To be honest, I miss the programming part of my job, but I still can give an honest question to that answer &#8211; &#8221; Are changes good for you?&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2008/10/30/are-changes-good-for-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying list of installed fonts with C#</title>
		<link>http://www.paul-zubkov.com/2008/09/28/displaying-list-of-installed-fonts-with-c/</link>
		<comments>http://www.paul-zubkov.com/2008/09/28/displaying-list-of-installed-fonts-with-c/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 04:06:44 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[font list]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Windows Forms]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=55</guid>
		<description><![CDATA[I know that all 1337 hax0rz (sorry, I promise I will not be doing this any more, as a matter of fact it really bugs me when people are using this 1337 crap) are using stuff like Ruby and Python, I know that system programming is for old farts and the future is in web [...]]]></description>
			<content:encoded><![CDATA[<p>I know that all 1337 hax0rz (sorry, I promise I will not be doing this any more, as a matter of fact it really bugs me when people are using this 1337 crap) are using stuff like Ruby and Python, I know that system programming is for old farts and the future is in web development and all that.  I am not disputing this, but there are some cool things you can do with C# and Windows coding.  For some bizzare reason, I feel that it might be a good idea to publish some code which I find neat.  One of the reasons I like C# is that generally if you need a solution to a particular problem, it is most likely to be alot simpler then what I think.  Here is how you get the list of all installed fonts loaded into a ComboBox.<span id="more-55"></span></p>
<p>First thing first<code lang="csharp">using System.Drawing.Text;</code></p>
<p>Need this to get the collection of fonts.</p>
<p>Here is the form load method:<br />
<code lang="csharp"><br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
    var fonts = new InstalledFontCollection();</p>
<p>    foreach (var family in fonts.Families)<br />
    {<br />
        comboBox1.Items.Add(family.Name);<br />
    }<br />
}<br />
</code></p>
<p>Pretty straight forward, get all the fonts into a collection called fonts, then loop through each element in this collection and add a new item to the ComboBox.  One can say, hey Paul, this could be done via DataBinding &#8211; yeah, sure, here is what you would do:<br />
<code lang="csharp"><br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
    var fonts = new InstalledFontCollection().Families;<br />
    comboBox1.DataSource = fonts;<br />
}<br />
</code><br />
But let&#8217;s take a look at the output &#8211; here is what you get with my little foreach loop:</p>
<p><a href="http://www.paul-zubkov.com/wp-content/uploads/2008/09/form-w-loop1.png"><img class="alignnone size-medium wp-image-59" title="form-w-loop1" src="http://www.paul-zubkov.com/wp-content/uploads/2008/09/form-w-loop1.png" alt="" width="300" height="300" /></a></p>
<p>I know, not too fancy, but clean and I like clean.  Now here is what you get with DataBinding:</p>
<p><a href="http://www.paul-zubkov.com/wp-content/uploads/2008/09/form-w-databind.png"><img class="alignnone size-medium wp-image-60" title="form-w-databind" src="http://www.paul-zubkov.com/wp-content/uploads/2008/09/form-w-databind.png" alt="" width="300" height="300" /></a></p>
<p>I know, there are ways to clean this up, but why bother?</p>
<p>Next I just added a small text box to show how the fonts are going to look like:</p>
<p><a href="http://www.paul-zubkov.com/wp-content/uploads/2008/09/form-w-box.png"><img class="alignnone size-medium wp-image-61" title="form-w-box" src="http://www.paul-zubkov.com/wp-content/uploads/2008/09/form-w-box.png" alt="" width="300" height="300" /></a></p>
<p>To get this going, all I need is an event that will be triggered whenever the selection at the ComboBox is changed:<br />
<code lang="csharp"><br />
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
    textBox1.Font = new Font(comboBox1.SelectedItem.ToString(), 12);<br />
}<br />
</code></p>
<p>That&#8217;s it, we are done here.  It compiles, it runs, and it switches the font on the TextBox.  Here is the complete code for the form:<br />
<code lang="csharp"><br />
using System;<br />
using System.Drawing;<br />
using System.Windows.Forms;<br />
using System.Drawing.Text;</p>
<p>namespace WindowsFormsApplication3<br />
{<br />
    public partial class Form1 : Form<br />
    {<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
        }</p>
<p>        private void Form1_Load(object sender, EventArgs e)<br />
        {<br />
            var fonts = new InstalledFontCollection();</p>
<p>            foreach (var family in fonts.Families)<br />
            {<br />
                comboBox1.Items.Add(family.Name);<br />
            }<br />
        }</p>
<p>        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)<br />
        {<br />
            textBox1.Font = new Font(comboBox1.SelectedItem.ToString(), 12);<br />
        }<br />
    }<br />
}<br />
</code></p>
<p>Beauty of C# is that it took me about 4 minutes to write this code.  It is clean, simple and does exactly what it is supposed to do.  It might not be the coolest technology out there, but it is good enough for what I do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2008/09/28/displaying-list-of-installed-fonts-with-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exterminating Bugs &#8211; Rosetta 3.1 should be here soon!</title>
		<link>http://www.paul-zubkov.com/2008/04/14/exterminating-bugs-rosetta-31-should-be-here-soon/</link>
		<comments>http://www.paul-zubkov.com/2008/04/14/exterminating-bugs-rosetta-31-should-be-here-soon/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 17:44:45 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[9-5]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Rosetta]]></category>

		<guid isPermaLink="false">http://www.paul-zubkov.com/?p=18</guid>
		<description><![CDATA[This has been a crazy couple of weeks.  Finally all coding for the newest release of Rosetta is done, we are now fixing bugs.  Guys have done great job adding two huge features which I am sure our clients will be happy about.  We also done bunch of smaller things that will improve usability and [...]]]></description>
			<content:encoded><![CDATA[<p>This has been a crazy couple of weeks.  Finally all coding for the newest release of Rosetta is done, we are now fixing bugs.  Guys have done great job adding two huge features which I am sure our clients will be happy about.  We also done bunch of smaller things that will improve usability and help save even more time.  Plus tweaked performance, but this is an ongoing battle.</p>
<p>This has been a very difficult release to prepare.  We just hired another great developer &#8211; Will who despite my expectation did not require much of hand-holding and was able to just dive into it and make some great things happen.  My other guys had to do features with no set of final specs, it seemed to change with every week but managed to do great so far.  Considering the fact that our support guy Paul was doing lot&#8217;s of travel and we had to pick up those duties as well, we did reasonably well.  Dave is supposed to announce this release at the conference at the end of the month, would be great if we could actually finish it by then.</p>
<p>Actually after this release Dave is planning on visiting most of our clients and having a talk about the direction the software is going.  Should be good as we love getting realistic feedback and not just generic &#8211; &#8220;Look good, will probably use it&#8221;.</p>
<p>When I came to then ATP Canada, Rosetta was 1.3.  We had two developers &#8211; Matt and I; back then we had to work as a fire brigade all the time.  We also managed sales and support as well as coding.  Now we are looking at 3.1, have great team of developers, dedicated support / sales person and things are looking very optimistic.</p>
<p>I am actually looking forward to this release, after this one there are going to be some major changes in product lines and frameworks, should be fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paul-zubkov.com/2008/04/14/exterminating-bugs-rosetta-31-should-be-here-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
