<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>dboyle</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/dboyle/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/dboyle/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:20:36 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Coder Dojo in MS Dublin</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/coder-dojo-in-ms-dublin</link>
      <pubDate>Wed, 10 Jul 2013 10:39:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/07/10/coder-dojo-in-ms-dublin/</guid>
      <description><![CDATA[Last week we finished up for the summer after a pilot run of Coder Dojo sessions which were held at...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Last week we finished up for the summer after a pilot run of Coder Dojo sessions which were held at the Microsoft Dublin campus over the last couple of months. It was an absolute blast and everybody involved had fun, learnt some stuff and generally got a lot from it. </span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">What is a Coder Dojo? So you can read reams about the movement on <a href="https://coderdojo.com/"><span style="color: #0563c1;">this website</span></a> and others, but in a nutshell it&rsquo;s a coding club for kids, usually run weekly for a couple of hours per session. The kids are usually roughly aged between 7 and 17. The focus is on child-led learning, with the goal being that the children themselves set the agenda and ideally you get to a stage where you have multiple project groups working on ideas with various technologies that they have chosen themselves. The children are then supported by volunteer mentors who hopefully know bit about the technology in question and are at least a step or two ahead of the kids.</span></p>
<p>&nbsp;<span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Starting off anew though you are going to have to introduce some technologies and basically give lessons &ndash; and see how everybody gets on. With kids starting afresh we found it better to follow a very loosely structured lecture series &ndash; it doesn&rsquo;t take long (first session) before the kids get creative and add their own&nbsp; code to give their webpages a personal touch. We were lucky to have a very enthusiastic group of mentors; one who was a veteran of other dojos and got us out of the blocks the first week with a lesson on HTML delivered in a manner that appealed to the audience (without in-depth explanation of unnecessary stuff). And we continued from there with other mentors who researched suitable &ldquo;starter&rdquo; technologies and some who basically learned Scratch to be able to teach it. Once the kids had the power of choice we soon had two groups each week; one focused on <a href="https://scratch.mit.edu/">Scratch</a> and the others adding ever more functionality and styling to their personal websites. The parents really seemed to enjoy it too &ndash;&nbsp; most were employees and had their own laptops and while most them spent their time catching up on work, but there were certainly a few who followed the lessons and even a one or two who every so often enthusiastically beat the kids to the punch with answers to questions!</span></p>
<p>&nbsp;</p>
<h3><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">What did we learn</span></h3>
<p>&nbsp;<span style="font-family: arial,helvetica,sans-serif; font-size: medium;">The logistics behind organizing something like this on a corporate site involved a fast learning curve in our corporate policies as well as our security and facilities procedures, Irish child protection law insurance requirements etc&hellip; I will deal with all that in a more specific posting. Right now I want to talk about the actual dojo sessions and how they evolved, even in the short term of the pilot sessions.</span></p>
<h3><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Starting with pure beginners? Then start with something universal.</span></span></h3>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Some of us dreamed of getting the kids onto Visual Studio Express and writing .Net applications (and may still have that as an eventual dream). But we had a couple of planning meetings among the mentors and decided that given the ages involved we would need to start by getting the basic concepts across. We thought about Scratch, Kodu and smallbasic, but then a couple of us attended a &ldquo;mentors meetup&rdquo; with mentors from various Dublin dojos and got convinced of the merits of getting straight into HTML and web development. This worked really well. It is pretty universal in the sense that they had all browsed the web, clicked on links etc&hellip; before so it was great for them to see how pages are made and also in the sense that you can build almost anything (including W8 apps) with HTML, CSS and JavaScript these days.<br /></span></p>
<h3><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Give them choices</span></h3>
<p>&nbsp;<span style="font-family: arial,helvetica,sans-serif; font-size: medium;">After a few weeks the web development lessons had got to a point where we were adding more JavaScript and kids were asking how to do things like drop-down lists etc&hellip; and it was just getting a little advanced for some of the younger ones. So we started a Scratch session and from then on they could choose which room they wanted to attend. As Scratch lets you get animations and sounds straight away we thought they would all switch, but it actually evened out at about a 60:40 split in favour of HTML most weeks.</span></p>
<p>&nbsp;</p>
<h3><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Take breaks</span></h3>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">We didn&rsquo;t always have full lessons going on and officially everyone is free to take a break at any time, but a parent pointed out to us early on that young kids cannot usually concentrate on something for 2 hours (I should know this stuff &ndash; I have three under the age of five). Children&nbsp;will also usually defer to adults to tell them when to take a break, so we subsequently had at least one official break period at each session which let the children relax and recharge a little.</span>&nbsp;</p>
<h3><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Keep researching</span></h3>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">We have an enthusiastic mentor team who have been very proactive in researching suitable languages and technologies. We have a host of technologies lined up to play with after the summer and are looking forward to trying some stuff like <a href="https://research.microsoft.com/en-us/projects/kodu/">Kodu</a>, <a href="https://www.touchdevelop.com/">Touch Develop</a>, <a href="https://channel9.msdn.com/coding4fun/blog/Jump-into-HTML-game-dev-with-the-free-Construct-2">Construct</a> etc&hellip;</span><span style="font-size: medium;"><span style="font-family: arial,helvetica,sans-serif;">&nbsp;</span>&nbsp;and of course to seeing how the children use them, like or dislike them and if we get some projects spinning up with them.</span></p>
<h3><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">People are awesome </span></h3>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Truly this has been a feel-good project from the start. We have had people back this from right across almost every function in Microsoft Dublin. Everyone we spoke to wanted this to work and helped us to navigate the projects legalities, facilities and security, health and safety requirements, HR and child protection policies. The mentors gave up their time not just to mentor at each session, but also to come to occasional&nbsp;meetings and to do a bit of prep and research. We got a project corporate sponsor&nbsp;here in the European development centre&nbsp;who provided some budget for nibbles at the first and last session and very kindly sponsored T shirts for the kids for the last session.</span></p>
<p>&nbsp;</p>
<h3><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Celebrate at the end of term </span></h3>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">The last session was great. The children were nowhere near as shy as we expected and nearly all got up and proudly presented their work on the stage using the big screen while wearing their brand new Dojo T-shirts. It was fantastic to see Over a cup of coffee and a biscuit (fruit and juices for the children) afterwards we chatted with the parents and got their thoughts on format and scheduling etc&hellip; All were happy with how it had gone and the 5pm Wednesday timing seems to work well. The children all promised to come back at the end of the summer and get stuck into bigger projects and we all signed off happy it had gone well and inspired by the potential for the future once we restart. One parent has since told me that she found it very tough to get the T-shirt off her son to wash it, as he was so proud of it he wanted to wear it every day!</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/96/6708.DojoShirt.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-96/6708.DojoShirt.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/96/6708.DojoShirt.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-96/6708.DojoShirt.jpg" alt="" border="0" /></a></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Languages I have learned</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/languages-i-have-learned</link>
      <pubDate>Wed, 17 Apr 2013 07:25:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/04/17/languages-i-have-learned/</guid>
      <description><![CDATA[Ok, that should more accurately read &ldquo;used&rdquo; or even &ldquo;abused"&nbsp; - as most of...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Ok, that should more accurately read &ldquo;used&rdquo; or even &ldquo;abused"&nbsp; - as most of these have only enterd my domain when required by a job or college course. However some have been a major part of life over a much longer periods&nbsp; - C++, C# and of course SQL (in some flavour) have featured heavily over the last couple of decades.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So I had the idea to write down the full list. This is just&nbsp;an exercise in nostalgia, not a critique or comparison. I just got to thinking about some of the languages I have used or even seen at their peak, which are now mostly forgotten &ndash; at least by me. This list will be fairly chronological, as that should help me to remember most of them.</span></p>
<p>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">BASIC</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Didn&rsquo;t we all start with this? I did have some limited and infrequent exposure to Commodore 64&rsquo;s and the like in the mid-80&rsquo;s but did not really get the bug until the seminal moment in 1989 when I first attended the Crawley College of Technology (<a href="https://en.wikipedia.org/wiki/Central_Sussex_College">now the Central Sussex College</a>) part-time BASIC programming course. That short (c30 hours over a couple of months) course actually landed me a job with a company called N.E.T. (<a href="https://www.net.com/">now Sonus</a>) configuring IDNX network topologies, and occasionally remoting into live installations to change config values using Unix shell scripts.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Turbo Pascal</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I have fond memories of a fairly powerful tool which just needed Tp.exe (on a 3.5in floppy) and an editor.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">RPG III</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Not so fond memories of report design with this one</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Lisp</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Find the mis-matched bracket &ndash; that&nbsp;that's&nbsp;what&nbsp;I mainly remember from using this&nbsp;20 years ago</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Dbase IV/Clipper</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Used to develop my first commercial code, a database system for a local company which had revolutionary pop-up &ldquo;windows&rdquo;.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">CoBOL</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I. E. D. P. (Information, Environment, Data, Processing) &ndash; still etched on my mind. Thought I had left this behind at college until I worked for a bank on the nuts and bolts of mainframe/server/client communications between various apps. I had to write a couple of libraries for their Cobol system to call and they insisted I did a few days re-training to be familiar with the CoBOL devs pain.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">X86 Assembler</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Powerful stuff. Back in college this was how we wrote games and some of the open-book exams involved questions like &nbsp;&nbsp;&ldquo;Add auto-fire to the gun&rdquo; etc... Then in the early days of Windows programming this was how you saw into some libraries when debugging (the second screen was often full of it). And then in at least one contract I&rsquo;ve even ended up maintaining what were known as TSR&rsquo;s (Terminate and Stay Resident programs) which set up buffers and other temporary things on users HDDs on startup.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">DOS batch files</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Always and everywhere. We have all seen full build systems written in this stuff. I still write them when I need to iterate over&nbsp; bunch of files &nbsp;(like moving files between changelists in SD).</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">C</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">The big one. Loved it at college, Then, when I got to work, I wrote my first Windows apps in it (and hand coded the resources .rc files in the Brief editor). I feel I owe this language a debt as it opened the door for most of what I do today. I still have Kelly and Pohl&rsquo;s &ldquo;A book on C&rdquo; on my shelf here (and I&rsquo;m sure Kernighan and Ritchie&rsquo;s book is at home somewhere).</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">C++</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I remember in the early 90s there was an funny e-mail used to do the rounds about &ldquo;why C++ is like sex&rdquo; and one of the lines was something like &ldquo;because everybody thinks everybody else is doing it, but really most people haven&rsquo;t done as much of it as you think&rdquo;. And it was like that, we could not wait to get into this cool new way of coding (OOP). I eventually&nbsp;did, and it became my trade.&nbsp;Back during my self-employed years I titled myself a &ldquo;Contract C++ dev&rdquo;. I have used a few flavours of this over the years, from Ansi to Visual C++ (and MFC) &nbsp;to Borland and the OWL library.</span></p>
<p>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Lotus 1-2-3 macros</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Back in the day we had a full test automation suite for the 1-2-3 product, written entirely in it&rsquo;s own macros. It was impressive and took quite a bit of learning, and worked.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Lotus Notes macros</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Notes was a great rapid development platform back in the 90s and this was the way to add &ldquo;code-behind&rdquo;. It did sometimes mean late nights using print statements to debug, but it also meant I sometimes quickly produced really useful centralised project repositories with workflows etc... (Think Sharepoint, but in 1994).</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">LotusScript</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Or Lotus Basic as I think it may have once been known. This added more power to the code behind Notes databases and came with some step-through debugging capabilities.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Java</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I did my first course in Java in 1996 or 7 and I well remember the excitement over how&nbsp;the web was gaining traction at that time. I even remember a discussion with other course attendees about the end of the PC, and the advent of thin client machines. I suppose we were right &ndash; it just took a while longer (and reliable broadband). Anyways I have mainly only used Java on subsequent college courses (finished a Masters a couple of years ago) and I still like it &ndash; if my next job was a shift to that stack I imagine I&rsquo;d be nearly as happy as I currently&nbsp;am on .Net.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">CL</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">When i was a C++ dev an agency once sent me for an interview. 5 minutes in the guy asked where I learned CL &ndash; turns out the agency had confused either C or C++ with CL, a SQL or 4GL language from a company called <a href="https://www.mbase.com.au/Products/CL4languageanddatabase/tabid/282/Default.aspx">Multibase pty</a>. So I told him that I had never heard of it, but as I was just recently arrived in Australia and needed a job I asked them to give me a week to learn it. I subsequently delivered on that first project for them (Y2K compliance testing) by writing a rudimentary parser to match patterns and identify Y2K smells</span></p>
<p>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">SQL</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Like batch files this seems to have been omni present, from DB2, Oracle, Sybase to Multibase and then MS came out with their own SQL Server and it&rsquo;s Express and compact version. I've probably been using MS SQL Server for the best part of a decade.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Nortel Meridian scripts</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">As I recall the Nortel Meridian Call centre server had it&rsquo;s own scripting language, which allowed the use of variables to assign calls to different levels of operators depending on their skillset and that of the forwarding operator.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">JavaScript</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">While I&rsquo;ve never worked as a &ldquo;web developer&rdquo; I have done my fair share of html parsing and that have needed&nbsp;to know what the scripts are doing too. Over the last few years working with MS Dynamics CRM has required more ramping up in this area as nearly every form in every CRM solution I have ever created has required at least some Javascript (Jscript) behind it. I like it and I like that there is a ton of resources out there to help with it.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">C#</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Since the first time I walked in the doors of MS as a contractor I&rsquo;ve been using this (and .Net of course). Currently it&rsquo;s what I use everyday &ndash; I&rsquo;ve even got <a href="https://blogs.msdn.com/b/dboyle/archive/2013/03/27/exam-70-483-programming-in-c-5-0.aspx">the cert to prove I know it</a></span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">VB.Net</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I don&rsquo;t use this too much, but every now and then I find myself fixing or extending a tool written with it and am always glad that .Net makes it more immediately familiar than it might otherwise&nbsp;</span><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">be.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Powershell</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I don&rsquo;t write any big scripts with this, but I use it from time to time to boss my O/S or that of remote machines around.</span></p>
<p><strong></strong>&nbsp;</p>
<p><strong><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Bourne Shell, C Shell</span></strong></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Infrequent use over the years when using Unix based machines</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">When I look back at this list now it actually doesn&rsquo;t appear that long, considering the time frame. So now I&rsquo;m thinking there may be others which I&rsquo;ve forgotten (did OS/2 have a scripting language). If I do remember more, I&rsquo;ll add them here.&nbsp;</span><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">&nbsp;</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Exam 70-483: Programming in C# 5.0</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/exam-70-483-programming-in-c-5-0</link>
      <pubDate>Wed, 27 Mar 2013 09:11:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/03/27/exam-70-483-programming-in-c-5-0/</guid>
      <description><![CDATA[I took and passed this exam this morning and am feeling quite happy with myself. It is the first of...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I took and passed this <a href="https://www.microsoft.com/learning/en/us/exam.aspx?ID=70-483#fbid=1Z6g2DPevAD"><span style="color: #0563c1;">exam</span></a> this morning and am feeling quite happy with myself. It is the first of the three exams which are building blocks towards the Microsoft Certified Solutions Developer (Windows Store Apps) certification, but on it&rsquo;s own it does confer Microsoft Specialist (C# 5.0 Programming) status. For more information on the MCSD see <a href="https://www.microsoft.com/learning/en/us/mcsd-windows-store-apps-certification.aspx#fbid=1Z6g2DPevAD"><span style="color: #0563c1;">here</span></a> as you have the option of pursuing this through C# and Xaml or Javascript and Html 5.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">&nbsp;</span></p>
<h1><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">My route to certification</span></h1>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So I have worked in C# quite a bit over the years, but have been wary of the certification exams and the specificity of their questioning. This was due to my belief that modern resources like IntelliSense and MSDN have meant that we don&rsquo;t tend to memorise the specifics of the languages and frameworks with which we work anymore. There was a time when one always required books on the desk and it was natural to save that kind of slow research time by remembering API method signatures etc... whereas now I think I tend to more naturally remember concepts and then quickly look up implementation specifics when required. But earlier this year I finally got my first <a href="https://blogs.msdn.com/b/dboyle/archive/2013/01/23/mcts-in-microsoft-dynamics-crm-2011-customization-and-configuration-mb2-866.aspx"><span style="color: #0563c1;">certification</span></a> and so my fear of specific questioning was reduced and ultimately the experience made me want to get more certs. I purchased <a href="https://www.amazon.co.uk/NET-Framework-Edition-Professional-Apress/dp/1430242337"><span style="color: #0563c1;">&ldquo;Pro C# and the .Net 4.5 Framework&rdquo;</span></a> a couple of months ago and as I worked my way through it I thought now might be a good time to think about some of the programming certifications. </span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So although I was at that stage only half way through the big book (it&rsquo;s 1400 pages) I checked out the certification paths and discovered that as an employee I could get the recommended training course (<a href="https://www.microsoft.com/learning/en/us/Course.aspx?ID=20483B&amp;Locale=en-us#fbid=1Z6g2DPevAD"><span style="color: #0563c1;">Course 20483B</span></a>) documentation soft copy for free. Over the last few weeks in the evenings I worked through the modules and was pleasantly suprised to find no surprises; what I mean by this is that is I had pretty much covered everything in the course before (the fact that I&rsquo;ve written a few <a href="https://www.windowsphone.com/en-ie/search?q=dermotb"><span style="color: #0563c1;">Windows Phone</span></a> and <a href="https://apps.microsoft.com/windows/app/irish-tides/7d36b364-0523-4bcf-8c32-97d3f445f731"><span style="color: #0563c1;">Windows 8</span></a> apps over the last year certainly &nbsp;helped with the newer stuff).</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">After I finished the course I went ahead and booked the exam, and then revised by following the links from the blog pages of a couple of folk who had already passed it (Thank you <a href="https://www.jayway.com/2012/08/15/msdn-study-links-for-exam-70-483-programming-in-c/"><span style="color: #0563c1;">Andreas Hammar</span></a>, <a href="https://www.claudiobernasconi.ch/2013/01/15/microsoft-70-483-exam-preparation-guide/"><span style="color: #0563c1;">Claudio Bernasconi</span></a> and of course <a href="https://en.csharp-online.net/MSDN_Reference_Guide_for_Exam_70-483"><span style="color: #0563c1;">MSDN</span></a> and <a href="https://social.technet.microsoft.com/Forums/en-US/CertGeneral/thread/1ae3ad77-1e36-40e2-8b1b-0bc5b766f938"><span style="color: #0563c1;">Technet</span></a>). I also speed read the course modules again, but paid extra attention to the areas to areas to which&nbsp;I have had less exposure&nbsp;(Performance counters, Reflection, using unmanaged code and encryption/decryption).</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">On the day I actually found this exam a little easier than the previous CRM one - I think in programming subjects it might be easier to spot definitively correct answers. It was also&nbsp;shorter (at only 40 questions) and I found&nbsp;that&nbsp;sometimes when I'd marked a question for review a later question which included&nbsp;a code sample might help clear up the ambiguity (in my mind) and let me go back an finish the "marked for review" question (only happened for a couple of questions).&nbsp;Anyway,&nbsp;</span><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I am now a certified Microsoft Specialist in C# 5.0 programming and have already acquired the course materials for the the next one (<a href="https://www.microsoft.com/learning/en/us/course.aspx?ID=20484A#fbid=1Z6g2DPevAD"><span style="color: #0563c1;">Essentials of Developing Windows Store Apps using C#</span></a>). I&rsquo;m on vacation next week, so I may get to make a start on it...</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Detecting repeated parameter values across multiple method calls</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/detecting-repeated-parameter-values-across-multiple-method-calls</link>
      <pubDate>Mon, 11 Mar 2013 06:03:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/03/11/detecting-repeated-parameter-values-across-multiple-method-calls/</guid>
      <description><![CDATA[So this was actually asked of me once in an "interview&nbsp;style" situation and it took me quite a...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So this was actually asked of me once in an "interview&nbsp;style" situation and it took me quite a while to twig that the use of a queue would&nbsp;be required. I can't fully remember the wording of the question but it was basically something like this: "For every thousand session requests&nbsp;recieved by your server, if the same IP address appears 3 times, then flag it as&nbsp;a possible problem/hacker address".</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So as I mentioned&nbsp;the use of a queue is the key to this implementation, as&nbsp;controlling the queue size allows us to restrict ourselves to the most recently pased&nbsp;1000 (or any other limit number) values. In real life I would probably use something&nbsp;more like this <a href="https://stackoverflow.com/questions/5852863/fixed-size-queue-which-automatically-dequeues-old-values-upon-new-enques">implementation for a fixed size queue</a>&nbsp;but right now&nbsp;I've just knocked up something quick and dirty which is not thread safe etc... But it&nbsp;illustrates the general logic.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I'm using a&nbsp;<a href="https://msdn.microsoft.com/en-us/library/7977ey2c.aspx">generic queue</a> of strings&nbsp;(in real life I could probably use the <span class="selflink"><a href="https://msdn.microsoft.com/en-us/library/s128tyf6.aspx">System.Net.IPAddress</a> class) and to keep the count (up to 3) of times a address appears in each thousand I use a Dictionary implementation&nbsp;with the IP address strings as my keys. So the logic is:</span></span></p>
<ul>
<li><span class="selflink" style="font-family: arial,helvetica,sans-serif; font-size: medium;">For each IP address passed, add it to the queue</span></li>
<li><span class="selflink" style="font-family: arial,helvetica,sans-serif; font-size: medium;">If the queue has more than 1000 items, remove the oldest one</span></li>
<li><span class="selflink" style="font-family: arial,helvetica,sans-serif; font-size: medium;">Upon removal of an address from the queue, also decrement the "per thousand" count associated with it in the Dictionary (if this is 0 or less, ralso emove the dictionary entry)</span></li>
<li><span class="selflink" style="font-family: arial,helvetica,sans-serif; font-size: medium;">Upon addition of an address to the queue, also increment the "per thousand" count associated with it in the Dictionary (if this is no entry, add it with a count value of 0)</span></li>
</ul>
<p><span class="selflink" style="font-family: arial,helvetica,sans-serif; font-size: medium;">&nbsp;</span></p>
<p><span class="selflink" style="font-family: arial,helvetica,sans-serif; font-size: medium;">and the code works out as:</span>&nbsp;</p>
<pre class="scroll"><code class="cplusplus"> private static bool IsSuspectIP(string address)<br /> {<br /> addressQueue.Enqueue(address);<br /> <br /> if (addressQueue.Count() &gt; 999)<br /> {<br /> string oldAddr = addressQueue.Dequeue();<br /> DecrementCounter(oldAddr);<br /> }<br /> <br /> IncrementCounter(address);<br /> <br /> if (addressCounters[address] &gt;= 2)<br /> {<br /> return true;<br /> }<br /> return false;<br /> }</code></pre>
<p><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus">&nbsp;</code></span>&nbsp;</p>
<pre class="scroll"><code class="cplusplus"> private static void IncrementCounter(string address)<br /> {<br /> if (addressCounters.ContainsKey(address))<br /> {<br /> addressCounters[address]++;<br /> }<br /> else<br /> {<br /> addressCounters.Add(address, 0);<br /> }<br /> }</code></pre>
<p>&nbsp;&nbsp;</p>
<pre class="scroll"><code class="cplusplus"> private static void DecrementCounter(string address)<br /> {<br /> if (addressCounters.ContainsKey(address))<br /> {<br /> if (addressCounters[address] &lt; 0)<br /> {<br /> addressCounters.Remove(address);<br /> }<br /> else<br /> {<br /> addressCounters[address]--;<br /> }<br /> }<br /> }</code></pre>
<p>&nbsp;</p>
<p><span class="selflink" style="font-family: arial,helvetica,sans-serif; font-size: medium;">Ok, that's end of the <a href="https://blogs.msdn.com/b/dboyle/archive/2013/02/12/technical-interview-screen-questions.aspx">coding tests series</a> for now. These were fun(ish) to write and also pretty quick to write (so they've really upped my posting frequency recently). But I do have an overdue requested update&nbsp;to add to my <a href="https://apps.microsoft.com/windows/app/irish-tides/7d36b364-0523-4bcf-8c32-97d3f445f731">Windows 8 app</a>, and have another app idea to work on, so I need to divert my spare time&nbsp;in that direction again now.</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Linked list stuff in a modern environment</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/linked-list-stuff-in-a-modern-environment</link>
      <pubDate>Mon, 11 Mar 2013 04:18:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/03/11/linked-list-stuff-in-a-modern-environment/</guid>
      <description><![CDATA[So recently somebody asked about this and seemed surprised when I said that owing to...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So recently somebody asked about this and seemed surprised when I said that owing to the&nbsp;availability of lots of lists and collection classes in modern frameworks,&nbsp;I had not coded a linked list in&nbsp;a couple of decades, at least not&nbsp;since&nbsp;I completed my BSc (finished in 1996 while employed by IBM). So anyways, I decided to include them in this blog series just to show&nbsp;I can do it if I have to!&nbsp;I suppose it still makes sense to think about collection class implementation every now and then&nbsp;- it may be&nbsp;very useful&nbsp;in some future role if performance tweaking on structures like these becomes important. One caveat is that I have just included these quickly, and so haven't really optimised or thought about the "best" way to do the following methods - just made ones that work (without much testing).</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">For these examples I have used a Single Linked List. This class defines it and the following method is used just to display the list contents of the list:</span></p>
<pre class="scroll"><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> class SLLNode<br /> {<br /> public int value;<br /> <br /> public SLLNode pNext;<br /> <br /> public SLLNode(int val)<br /> {<br /> value = val;<br /> pNext = null;<br /> }<br /> }<br /> <br /> private static void DisplayLL(SLLNode current)<br /> {<br /> while (current != null)<br /> {<br /> Console.WriteLine("Node value {0}", current.value);<br /> current = current.pNext;<br /> }<br /> }</code></span></pre>
<p>&nbsp;</p>
<h2><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Copying a Single Linked List</span></h2>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Can be little confusing as you're effectively stepping through two lists, the existing list and the one you are creating as you go:</span></p>
<p>&nbsp;</p>
<pre class="scroll"><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> private static SLLNode CopySLL(SLLNode n1)<br /> {<br /> SLLNode current = n1;<br /> <br /> <br /> SLLNode newHead = new SLLNode(n1.value);<br /> SLLNode prev = newHead;<br /> <br /> while (current != null)<br /> {<br /> current = current.pNext; //old list<br /> <br /> if (current != null)<br /> {<br /> SLLNode newNode = new SLLNode(current.value);<br /> prev.pNext = newNode;<br /> prev = prev.pNext;<br /> }<br /> }<br /> <br /> DisplayLL(newHead);<br /> return newHead;<br /> }</code></span></pre>
<h2><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Sorting a Single Linked List</span></h2>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">J</span><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">ust using a&nbsp;simple bubble sort here for a list with integer values in the payload. I'm writing this on a tired Sunday evening, so feel free to suggest "improvements"!</span></p>
<p>&nbsp;</p>
<pre class="scroll"><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> private static void SortSLL(SLLNode head)<br /> {<br /> SLLNode current;<br /> int swaps = 1;<br /> <br /> while (swaps &gt; 0)<br /> {<br /> current = head;<br /> swaps = 0;<br /> while (current != null)<br /> {<br /> SLLNode next = current.pNext;<br /> <br /> if (next != null)<br /> {<br /> if (current.value &gt; next.value)<br /> {<br /> int tmp = current.value;<br /> current.value = next.value;<br /> next.value = tmp;<br /> swaps++;<br /> }<br /> }<br /> current = next; //move along<br /> }<br /> }<br /> }</code></span></pre>
<p>&nbsp;</p>
<h2><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Reverse a Single Linked List</span></h2>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Walk the list, reversing the "pNext" pointers as you go - just need to remember not to orphan any nodes, and to set the original head's "next" pointer to point to null as it becomes the tail</span></p>
<p>&nbsp;</p>
<pre class="scroll"><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> private static SLLNode ReverseSLL(SLLNode head)<br /> {<br /> SLLNode current = head;<br /> <br /> SLLNode prev;<br /> <br /> SLLNode next = current.pNext; <br /> <br /> while (next != null)<br /> {<br /> prev = current;<br /> current = next;<br /> next = current.pNext;<br /> current.pNext = prev;<br /> }<br /> head.pNext = null;<br /> <br /> return current;<br /> }</code></span></pre>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Checking for a prime number</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/checking-for-a-prime-number</link>
      <pubDate>Fri, 08 Mar 2013 08:16:07 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/03/08/checking-for-a-prime-number/</guid>
      <description><![CDATA[Ok, looking back at the original post&nbsp;I'm nearly regretting it as I need to find the time to...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Ok, looking back at the original <a href="https://blogs.msdn.com/b/dboyle/archive/2013/02/12/technical-interview-screen-questions.aspx">post</a>&nbsp;I'm nearly regretting it as I need to find the time to actually write these - but at least this one was quick and simple. In fact it may be too simple to use as a tech test, but anyways here it is.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">A prime number is any number greater than 1 which is&nbsp;only divisible by itself and 1. The method I use here simply checks all the values up to the number under investigation to see if division by them would leave a remainder of zero. There are probably faster ways to do this using smarter maths, and if you know of one, please post a comment!</span></p>
<p>&nbsp;</p>
<pre class="scroll"><span style="color: #333399;"><code class="cplusplus"> private static bool IsPrime(int num)<br /> {<br /> if (num &lt;= 1)<br /> {<br /> return false;<br /> }<br /> <br /> for (int i = 2; i &lt; num; i++)<br /> {<br /> if (num % i == 0)<br /> {<br /> return false;<br /> }<br /> }<br /> <br /> return true;<br /> }</code></span></pre>]]></content:encoded>
    </item>
    <item>
      <title>Checking if a string is a palindrome</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/checking-if-a-string-is-a-palindrome</link>
      <pubDate>Fri, 08 Mar 2013 07:52:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/03/08/checking-if-a-string-is-a-palindrome/</guid>
      <description><![CDATA[Back in my original college days (over 20 years ago now) this used to be the subject of a running...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Back in my original college days (over 20 years ago now) this used to be the subject of a running joke. It seemed that&nbsp;with every new language learned one of the first exercises was to check for palindromes, and the joke was that we couldn't wait to get into gainful employment with some large corporation, hopefully working with their Palindrome product group - as we had so much experience!. </span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">So what's a palindrome? <a href="https://en.wikipedia.org/wiki/Palindrome">Wikipedia</a>&nbsp;explains it as "a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction". So we're basically checking if the string can be reversed and still have the same letter order.&nbsp;In&nbsp;.Net&nbsp;we could use String.Reverse() and work on the resulting list, but doing it the old fashioned way I get code like this</span></p>
<pre class="scroll"><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> char[] checkChars = testString.ToCharArray();<br /> <br /> for (int i = 0; i &lt; checkChars.Length / 2; i++)<br /> {<br /> if (checkChars[i] != checkChars[checkChars.Length - i - 1])<br /> {<br /> return false;<br /> }<br /> }<br /> return true;</code></span></pre>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">But that method would fail on some common palindromic strings like "Navan" (casing) or "A man a plan a canal panama" (casing and spaces).&nbsp;So in the full version&nbsp;I ignore casing and spaces to get an implementation like:</span></p>
<pre class="scroll"><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> private static bool IsPalindrome(string testString)<br /> {<br /> StringBuilder checkChars = new StringBuilder();<br /> <br /> foreach (char c in testString.ToLower())<br /> {<br /> if (c != ' ')<br /> {<br /> checkChars.Append(c);<br /> }<br /> }<br /> <br /> for (int i = 0; i &lt; checkChars.Length / 2; i++)<br /> {<br /> if (checkChars[i] != checkChars[checkChars.Length - i - 1])<br /> {<br /> return false;<br /> }<br /> }<br /> return true;<br /> }</code></span></pre>
<p><br />&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Quicksort</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/quicksort</link>
      <pubDate>Wed, 06 Mar 2013 14:36:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/03/06/quicksort/</guid>
      <description><![CDATA[Along with Mergesort, Bubblesort and others, Quicksorting of arrays is a standard on any fully...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Along with Mergesort, Bubblesort and others, Quicksorting of arrays is a standard on any fully fledged undergraduate computer science course. It&rsquo;s a simple theory, and like a lot of theories can be easily described verbally, on a whiteboard or even in pseudocode, but they all take a little work to actually implement. Quicksort is&nbsp;a "divide and conquer&rdquo; comparison sorting algorithm. The basic idea is that you continually reduce the area of the array under inspection (or unsorted area) by arranging the values around a pivot value (which can be chosen randomly), and then doing the same to the left and right sub arrays in a recursive fashion. Acually Wikipedia explain this much better so here is their <a href="https://en.wikipedia.org/wiki/Quicksort">link</a>. They also have a nice pseudocode version, repeated here:</span>&nbsp;</p>
<pre class="scroll"><span style="color: #333399; font-size: medium;"><code class="cplusplus"> function quicksort('array')<br /> if length('array') &le; 1<br /> return 'array' // an array of zero or one elements is already sorted<br /> select and remove a pivot value 'pivot' from 'array'<br /> create empty lists 'less' and 'greater'<br /> for each 'x' in 'array'<br /> if 'x' &le; 'pivot' then append 'x' to 'less'<br /> else append 'x' to 'greater'<br /> return concatenate(quicksort('less'), 'pivot', quicksort('greater')) // two recursive calls</code></span></pre>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">It is common (and makes the explanation easy) to refer to dividing the array into left and right sub arrays or lists. In .Net you certainly could use lists, but it is&nbsp;much more efficient to use the same array, moving values and passing indices to inform each recursion of their sub portion of the array. In my implementation I use a class called Quicksorter, and calling QuickSort() on an instance of this class will trigger a call to the recursive method qsort passing the initial 0 and Length-1 parameters.</span>&nbsp;</p>
<pre class="scroll"><span style="color: #333399; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> class QuickSorter<br /> {<br /> int[] intArray;<br /> <br /> public QuickSorter(int[] unsorted)<br /> {<br /> intArray = new int[unsorted.Length];<br /> unsorted.CopyTo(intArray, 0);<br /> <br /> }<br /> <br /> public void PrintArray()<br /> {<br /> for (int i = 0; i &lt; intArray.Length - 1; i++)<br /> {<br /> Console.Write(intArray[i] + ", ");<br /> }<br /> Console.WriteLine(intArray[intArray.Length - 1]);<br /> }<br /> <br /> public void QuickSort()<br /> {<br /> qsort(0, intArray.Length - 1);<br /> }<br /> <br /> private void qsort(int left, int right)<br /> {<br /> int pivot, lft, rgt;<br /> <br /> lft = left;<br /> rgt = right;<br /> pivot = intArray[left];<br /> <br /> while (left &lt; right)<br /> {<br /> while ((intArray[right] &gt;= pivot) &amp;&amp; (left &lt; right))<br /> {<br /> right--;<br /> }<br /> <br /> if (left != right)<br /> {<br /> //now we know the rhs value is less than the pivot, so move it (left was saved as the pivot value)<br /> //and move the lhs counter after the operation<br /> intArray[left++] = intArray[right];<br /> }<br /> <br /> while ((intArray[left] &lt;= pivot) &amp;&amp; (left &lt; right))<br /> {<br /> left++;<br /> }<br /> <br /> if (left != right)<br /> {<br /> //now we know the lhs value is greater than the pivot, so move it, rhs is pointing to a value which has been copied/duped to the lhs, basically a free space<br /> //and move the rhs counter after the operation<br /> intArray[right--] = intArray[left];<br /> }<br /> }<br /> <br /> //pivot value can slot back in to the free/duplicate lhs space<br /> intArray[left] = pivot;<br /> <br /> //reset lhs, rhs and pivot<br /> pivot = left;<br /> left = lft;<br /> right = rgt;<br /> <br /> if (left &lt; pivot)<br /> {<br /> qsort(left, pivot - 1);<br /> }<br /> <br /> if (right &gt; pivot)<br /> {<br /> qsort(pivot + 1, right);<br /> }<br /> }<br /> }</code></span></pre>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">This class could easily be adapted for other value types and could easily be altered to sort arrays of any object by:</span></p>
<ol>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">a)&nbsp;Implementing the <a href="https://msdn.microsoft.com/en-us/library/system.collections.icomparer.aspx">IComparer</a>&nbsp;interface</span></li>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">b) Changing the comparison lines to use the results of .Compare(object1, object2)</span></li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Greatest Common Divisor (and Lowest Common Multiple)</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/greatest-common-divisor-and-lowest-common-multiple</link>
      <pubDate>Mon, 04 Mar 2013 03:06:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/03/04/greatest-common-divisor-and-lowest-common-multiple/</guid>
      <description><![CDATA[It's worth repeating the wikipedia definition for GCD here, as it's explains it well: "The greatest...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">It's worth repeating the wikipedia definition for GCD here, as it's explains it well: "The greatest common divisor (gcd), also known as the greatest common factor (gcf), or highest common factor (hcf), of two or more non-zero integers, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4. (See their full explanation <a href="https://en.wikipedia.org/wiki/Greatest_common_divisor">here</a>).</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Euclid's algorithm to derive the GCD is simple and fast, and easily implemented in code as:</span></p>
<p>&nbsp;</p>
<pre class="scroll"><span style="color: #000080; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> static int GetGCD(int num1, int num2)<br /> {<br /> //check for valid inputs<br /> if (num1 &lt; 1 || num2 &lt; 1)<br /> {<br /> return -1;<br /> }<br /> <br /> while (num1 != num2)<br /> {<br /> if (num1 &gt; num2)<br /> {<br /> num1 = num1 - num2;<br /> }<br /> if (num2 &gt; num1)<br /> {<br /> num2 = num2 - num1;<br /> }<br /> }<br /> return num1;</code>&nbsp;&nbsp;</span></pre>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">In this approach the greater&nbsp;number decreases by the difference each time until they equal each other (at which point there woult also be no remainder from a modulus operation between them). This lower, equal number is the GCD. In some implementations you might see an "else" clause between the two "if" statements, but leaving it out as is done here allows for two reduction operations to happen between loop tests. You can do the same by applying the modulus operand to the two numbers swapping the results each time as you re-enter the loop.&nbsp;&nbsp;It's all about getting the remainder to equal&nbsp;0. </span><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">We can do this with&nbsp;recursion as seen here:</span></p>
<p>&nbsp;</p>
<pre class="scroll"><span style="color: #000080; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> public static int RecursiveGCD(int num1, int num2)<br /> {<br /> if (num2 == 0)<br /> {<br /> return num1;<br /> }<br /> else<br /> {<br /> return RecursiveGCD(num2, num1 % num2);<br /> }<br /> }</code></span></pre>
<p><span style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: medium;">This second example has no handling for zero values, and while it won't crash it will give results for zeroes or minus numbers. One way of bullet-proofing this would be to have two methods - one which performs the valid inputs check, and then just calls the recursive method.</span></p>
<h2><span style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: medium;">&nbsp;Lowest (or least) common multiple</span></h2>
<p><span style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: medium;">Again using&nbsp;the Wikipidea definition: "The least common multiple (also called the lowest common multiple or smallest common multiple) of two integers a and b, usually denoted by LCM(a, b), is the smallest positive integer that is divisible by both a and b.[1] If either a or b is 0, LCM(a, b) is defined to be zero.</span></p>
<p>&nbsp;</p>
<p><span style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: medium;">So I can't remember if this was also a Euclides formula, but dividing the product of the two numbers by their greatest common divisor gives the smallest possible common product of these two numbers individually multiplied with another, as follows:</span></p>
<pre class="scroll"><span style="color: #000080; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> static int GetLCM(int num1, int num2)<br /> {<br /> return (num1 * num2) / GetGCD(num1, num2);<br /> }</code></span></pre>]]></content:encoded>
    </item>
    <item>
      <title>Binary Search Tree</title>
      <link>https://docs.microsoft.com/archive/blogs/dboyle/binary-search-tree</link>
      <pubDate>Fri, 22 Feb 2013 09:36:00 GMT</pubDate>
      <dc:creator><![CDATA[DermotB]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dboyle/2013/02/22/binary-search-tree/</guid>
      <description><![CDATA[This is a simple data structure, but again one with which many of us may have not been familiar with...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">This is a simple data structure, but again one with which many of us may have not been familiar with in some time. But it seems to beloved of tech screeners (and very useful in networking software) so a refresher is always nice; I have here put together a simple sorted tree and some equally simple methods, both recursive and non-recursive for the main operations, which are:</span></p>
<ul>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Insertion</span></li>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Finding nodes in the tree</span></li>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Displaying the tree</span></li>
</ul>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">I created a class imaginatively called "BinarySearchTree" to implement this. In retrospect this constrcted my recursion to require helper methods, as I needed to pass the root node into the helper which was then treated as the "current" node and passed to future recursions. Not a big overhead, but a tad annoying. Here is the code:</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">First class is the TreeNode class, a simple class which assigns the identifier value upon construction.</span></p>
<pre class="scroll"><span style="color: #000080; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> class TreeNode<br /> {<br /> public int nodeValue{get;set;}<br /> public TreeNode leftBranch, rightBranch;<br /> <br /> public TreeNode(int value)<br /> {<br /> nodeValue=value;<br /> leftBranch=null;<br /> rightBranch=null;<br /> }<br /> <br /> }</code></span></pre>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Then the BinarySearchTree class with Insert,&nbsp;Find and Display methods. This Display method does not show the nodes in order of value. Will make one of those next.</span></p>
<pre class="scroll"><span style="color: #000080; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> class BinarySearchTree<br /> {<br /> TreeNode root = null;<br /> <br /> public BinarySearchTree(TreeNode rootNode)<br /> {<br /> root = rootNode;<br /> }<br /> <br /> public TreeNode Find(int keyValue)<br /> {<br /> TreeNode currentNode = root;<br /> <br /> while (currentNode != null)<br /> {<br /> if (currentNode.nodeValue == keyValue)<br /> {<br /> return currentNode;<br /> }<br /> else<br /> {<br /> if (keyValue &lt; currentNode.nodeValue)<br /> {<br /> currentNode = currentNode.leftBranch;<br /> }<br /> if (keyValue &gt; currentNode.nodeValue)<br /> {<br /> currentNode = currentNode.rightBranch;<br /> }<br /> }<br /> }<br /> <br /> return null;<br /> }<br /> <br /> public TreeNode FindRecursive(int keyValue)<br /> {<br /> return findRecursiveHelper(root, keyValue);<br /> }<br /> <br /> private TreeNode findRecursiveHelper(TreeNode current, int keyValue)<br /> {<br /> if (current == null)<br /> {<br /> return null;<br /> }<br /> <br /> if (current.nodeValue == keyValue)<br /> {<br /> return current;<br /> }<br /> <br /> if (keyValue &lt; current.nodeValue)<br /> {<br /> if (current.leftBranch != null)<br /> {<br /> return (findRecursiveHelper(current.leftBranch, keyValue));<br /> }<br /> else<br /> {<br /> return null;<br /> }<br /> }<br /> <br /> if (keyValue &gt; current.nodeValue)<br /> {<br /> if (current.rightBranch != null)<br /> {<br /> return (findRecursiveHelper(current.rightBranch, keyValue));<br /> }<br /> else<br /> {<br /> return null;<br /> }<br /> }<br /> <br /> return null;<br /> }<br /> <br /> <br /> public void Insert(TreeNode newNode)<br /> {<br /> InsertHelper(root, newNode);<br /> }<br /> <br /> private void InsertHelper(TreeNode current, TreeNode newNode)<br /> {<br /> if (newNode.nodeValue &lt; current.nodeValue)<br /> {<br /> if (current.leftBranch == null)<br /> {<br /> current.leftBranch = newNode;<br /> }<br /> else<br /> {<br /> InsertHelper(current.leftBranch, newNode);<br /> }<br /> }<br /> if (newNode.nodeValue &gt; current.nodeValue)<br /> {<br /> if (current.rightBranch == null)<br /> {<br /> current.rightBranch = newNode;<br /> }<br /> else<br /> {<br /> InsertHelper(current.rightBranch, newNode);<br /> }<br /> }<br /> }<br /> <br /> public void DisplayTree()<br /> {<br /> displayTreeHelper(root);<br /> }<br /> <br /> private void displayTreeHelper(TreeNode current)<br /> {<br /> Console.WriteLine(current.nodeValue.ToString());<br /> <br /> if (current.rightBranch != null)<br /> {<br /> displayTreeHelper(current.rightBranch);<br /> }<br /> <br /> if (current.leftBranch != null)<br /> {<br /> displayTreeHelper(current.leftBranch);<br /> }<br /> }<br /> }</code></span></pre>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">To use the classes then I can call them from Main() as follows:</span></p>
<pre class="scroll"><span style="color: #000080; font-family: terminal,monaco; font-size: medium;"><code class="cplusplus"> BinarySearchTree bst = new BinarySearchTree(root);<br /> bst.Insert(new TreeNode(25));<br /> bst.Insert(new TreeNode(45));<br /> bst.Insert(new TreeNode(75));<br /> bst.Insert(new TreeNode(85));<br /> bst.Insert(new TreeNode(95));<br /> bst.Insert(new TreeNode(15));<br /> bst.Insert(new TreeNode(27));<br /> TreeNode tn = bst.Find(85);<br /> TreeNode trn = bst.FindRecursive(27);<br /> bst.DisplayTree();</code></span></pre>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">As in the other articles the next things I need to ponder is, "If a candidate delivers this answer, what questions do we ask next?" Some potentials are:</span></p>
<ol>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">Rewrite the Display method to display the nodes in order of values (in-order Traversal)</span></li>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">What optimisations can be applied to these trees?</span></li>
<ol>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">If using the tree to store data, then manipulation of&nbsp;regularly searched-for data to be acessible the top of a tree makes sense - extra points here for any mention of&nbsp;AVL, Red-black, treap etc...</span></li>
</ol>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">and of course - what unit tests would you write</span></li>
<ol>
<li><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">which can be applied to every method in the classes</span></li>
</ol></ol>]]></content:encoded>
    </item>
  </channel>
</rss>