<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reviews on Hans Kruse</title><link>https://hanskruse.eu/post/</link><description>Recent content in Reviews on Hans Kruse</description><generator>Hugo</generator><language>en-GB</language><copyright>© Hans Kruse</copyright><lastBuildDate>Sat, 04 Jul 2020 23:31:09 +0200</lastBuildDate><atom:link href="https://hanskruse.eu/post/index.xml" rel="self" type="application/rss+xml"/><item><title>Throw away WSL environments</title><link>https://hanskruse.eu/post/2020-07-04-throw_away_wsl_environments/</link><pubDate>Sat, 04 Jul 2020 23:31:09 +0200</pubDate><guid>https://hanskruse.eu/post/2020-07-04-throw_away_wsl_environments/</guid><description>&lt;p&gt;A rainy weekend is a perfect opportunity to do some yak shaving and learn a few things. I created&#10;a &lt;a href="https://github.com/nicenemo/wsl-debian-boxes"&gt;WSL Debian boxes&lt;/a&gt;, a collection of PowerShell and Bash scripts&#10;that enable you to spin up fresh updated and Ansible enabled &lt;a href="https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux"&gt;WSL&lt;/a&gt; 2, based machines at lightning speed. Create an environment to test software. Yak shave your development environment and more.&lt;/p&gt;</description></item><item><title>Thoughts on Kubernetes on SmartOS</title><link>https://hanskruse.eu/post/2020-06-07-thoughts_on_kubernetes_on_smartos/</link><pubDate>Sun, 07 Jun 2020 17:48:25 +0200</pubDate><guid>https://hanskruse.eu/post/2020-06-07-thoughts_on_kubernetes_on_smartos/</guid><description>&lt;p&gt;With this blog post I document the thoughts I had in getting Ubuntu server running from scratch on &lt;a href="https://en.wikipedia.org/wiki/SmartOS"&gt;SmartOS&lt;/a&gt; using &lt;a href="https://bhyve.org/"&gt;BHyve&lt;/a&gt;, the BSD Hypervisor. My final goal is getting &lt;a href="https://kubernetes.io/"&gt;Kubernetes&lt;/a&gt; running on SmartOS.&lt;/p&gt;</description></item><item><title>Move the keys to your fingers</title><link>https://hanskruse.eu/post/2020-05-23-keys_to_your_fingers/</link><pubDate>Sat, 23 May 2020 15:25:38 +0200</pubDate><guid>https://hanskruse.eu/post/2020-05-23-keys_to_your_fingers/</guid><description>&lt;p&gt;I am looking into faster, smaller and hopefully more ergonomic keyboards.&#10;Below you will find a selection of my thoughts on &lt;em&gt;(custom build)&lt;/em&gt; mechanical keyboards.&lt;/p&gt;</description></item><item><title>Vanilla Java for stream copy</title><link>https://hanskruse.eu/post/2018-09-04-vanilla-java/</link><pubDate>Tue, 04 Sep 2018 08:25:14 +0200</pubDate><guid>https://hanskruse.eu/post/2018-09-04-vanilla-java/</guid><description>&lt;p&gt;In the JavaScript community, not long ago, there was a discussion about using a library versus rolling your own implementation to achieve certain goals. Since there seems to be a new hot and happy JavaScript framework every two months or so, rolling your own may be attractive to some people. It even has a name &lt;em&gt;Vanilla JavaScript&lt;/em&gt;. Someone even proposed &lt;em&gt;&lt;a href="http://vanilla-js.com/"&gt;Vanilla-JS&lt;/a&gt; framework&lt;/em&gt; framework&amp;hellip; ;). But how is that for Java? Java used to be slower paced but even here we have the problem of overchoice. For a simple problem you often have the following options:&lt;/p&gt;</description></item><item><title>Symbols of Shared Understanding</title><link>https://hanskruse.eu/post/2018-08-17-symbols-of-shared-understanding/</link><pubDate>Fri, 17 Aug 2018 03:32:00 -0700</pubDate><guid>https://hanskruse.eu/post/2018-08-17-symbols-of-shared-understanding/</guid><description>&lt;p&gt;Please let us break the terror of the typewriter. In daily life we use symbols in many places because plain text does not work. Symbols are a more succinct (less verbose) way of expressing, Numbers(0,1,2..9), Math, Music, Chemistry, Religion, army ranks, marketing, smilies, and many other uses. They allow you to see the forest for the trees and not cluttering your work with common knowledge that can be easily expressed using a symbol, E.g. using ForEach or Sigma symbol instead of using ForEach and Sigma in text over and over again in a formula. Road signs exist for a reason. In traffic you need to evaluate them in a short amount of time. Road signs mainly express a message using shape, size, colour, orientation and location. Imagine the overnight change of all road signs with plain square white signs with black four word texts. People are no longer able to instantly see the more important signs. As a side effect the economy would grind to a halt because people are driving slower due to all the sign reading&amp;hellip; What if I change the road sign texts from English to Chinese. In Software Engineering the use of Design Pattern is (getting) common knowledge. Patterns such as Iterator do not need to be explained/defined over and over again because software engineers were trained in using them. Using ASCII to express symbols is often very inefficient, e.g.: ManagerSatisfactionBonusRateFactorReasonerEnum. When literally translated to Chinese using a translation service this gets reduced to fifteen(15) characters. A lot of people in the world speak Chinese. Maybe for programming in general it may be useful to learn Chinese because it is more expressive characterwise. Once taught the symbols of the examples mentioned above allow for a more efficient expression in the domain these symbols are meant for. The question should be what can be gained in expressiveness using symbols versus the effort to teach people/adapt tools to deal with (Unicode) symbols? Choosing identifier names wisely regarding common practice and the problem domain comes first. Using Unicode may be a useful tool in reducing the clutter when education and tooling is taken care of.&lt;/p&gt;</description></item><item><title>Default method implementations with Java 8 interfaces</title><link>https://hanskruse.eu/post/2017-01-12-default-method-implementations-with/</link><pubDate>Thu, 12 Jan 2017 09:17:00 -0800</pubDate><guid>https://hanskruse.eu/post/2017-01-12-default-method-implementations-with/</guid><description>&lt;p&gt;Java 8 allows you to add so called &lt;a href="https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html"&gt;&amp;ldquo;default&amp;rdquo; method implementations to interfaces&lt;/a&gt;. The intended use was being able to extend an existing interface without breaking existing code. A new function is added with a default implementation. Existing code does not have to change because of the default implementation.&lt;/p&gt;&#10;&lt;p&gt;A possible reason to add this to the language may be a side effect of adding support for functional programming with lambda support and &amp;ldquo;streams&amp;rdquo;. By calling &lt;em&gt;stream()&lt;/em&gt; on a collection you get an &lt;em&gt;Iterable&lt;/em&gt; like structure with methods like &lt;em&gt;filter()&lt;/em&gt;, &lt;em&gt;map()&lt;/em&gt; and &lt;em&gt;flatMap().&lt;/em&gt; These methods accept a lambda expression as argument. The &lt;em&gt;stream()&lt;/em&gt; method is implemented as a so called default method on the &lt;em&gt;Collection&lt;/em&gt; interface. A possible reason to not add &lt;em&gt;filter(), map()&lt;/em&gt; and &lt;em&gt;flatMap()&lt;/em&gt; directly to &lt;em&gt;Collection&lt;/em&gt; may be the fact that all methods on an interface are public. You have no way of hiding an implementation detail in private methods. This will change in Java 9.&lt;/p&gt;</description></item><item><title>The six benefits of final</title><link>https://hanskruse.eu/post/2016-09-11-the-six-benefits-of-final/</link><pubDate>Sun, 11 Sep 2016 10:14:00 -0700</pubDate><guid>https://hanskruse.eu/post/2016-09-11-the-six-benefits-of-final/</guid><description>&lt;p&gt;Ever since I returned to &amp;ldquo;the Duke side of the Force&amp;rdquo; I am pleased when I can type a specific word of 5 letters: &lt;strong&gt;final.&lt;/strong&gt; Final means you cannot change it after it was set or defined. In functional programming languages &lt;strong&gt;final&lt;/strong&gt; is the default and usually implicit. At the cost of five characters more verbosity per declaration you get the same six benefits functional languages give you for free. With final code is easier to:&lt;/p&gt;</description></item><item><title>What's wrong with Java Beans?</title><link>https://hanskruse.eu/post/2016-09-11-whats-wrong-with-java-beans/</link><pubDate>Sun, 11 Sep 2016 08:03:00 -0700</pubDate><guid>https://hanskruse.eu/post/2016-09-11-whats-wrong-with-java-beans/</guid><description>&lt;p&gt;TLDR: This is my rant against the concept of Java Beans.&lt;/p&gt;&#10;&lt;p&gt;In my previous post I mentioned that beans are a great way to compose a solution out of smaller parts. I also mentioned writing generators for the boilerplate of a bean. Such generators are now standard in modern IDEs. Sadly one important thing Java does not have is real properties. Syntactic sugar for properties is present in languages like: C#, F#, Scala, Kotlin and Ceylon.&lt;/p&gt;</description></item><item><title>My Java Life</title><link>https://hanskruse.eu/post/2016-09-06-my-java-life/</link><pubDate>Tue, 06 Sep 2016 00:05:00 -0700</pubDate><guid>https://hanskruse.eu/post/2016-09-06-my-java-life/</guid><description>&lt;p&gt;This first blogpost on this now new blog, is a trip down memory lane about my first encounters with the Java programming language. I spent the last ten years developing in .NET but before that did use Java. At the end of 2015 I got a job offer I could not refuse but&amp;hellip; It included Java EE and Android development. OK, while teaching others about .NET LINQ, lambdas, monads, OData and JavaScript I started relearning Java, Java EE and Android. I also peeked into Scala, Akka, Play, Kotlin and Ceylon again.&lt;/p&gt;</description></item><item><title>SDC Conference 2009 Day 1</title><link>https://hanskruse.eu/post/2010-06-20-sdc-conference-2009-day-1/</link><pubDate>Sun, 20 Jun 2010 02:22:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-sdc-conference-2009-day-1/</guid><description>&lt;p&gt;Just a quick note, I am sleepy. I tidy this up later. Today I visited the first day of SDN&amp;rsquo;s SDC conference. I mainly followed the architecture track on this conference.&lt;/p&gt;&#10;&lt;p&gt;Keywords:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;(Domain Specific) Languages&lt;/li&gt;&#10;&lt;li&gt;Full Stack code generation&lt;/li&gt;&#10;&lt;li&gt;Separation of Concerns&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I followed two presentations by Udi Dahan which were on separation of concerns. He did some interesting trickery with generics to make the Roles a domain object is in explicit. (I need to check this out when I am less sleepy.) He also pointed out that business objects should not have dependencies whatsoever. This allows for reuse all over your stack, makes your stuff less complex. Business Objects are just POCOs. Another presentation by Sander Hoogendoorn did exactly the same as far as the Business Objects are concerned. His focus is on code generation and he uses some interesting tool which I also should check the name for in my notes and figure out.&lt;/p&gt;</description></item><item><title>Fluent Programming, Fluent Properties</title><link>https://hanskruse.eu/post/2010-06-20-fluent-programming-fluent-properties/</link><pubDate>Sun, 20 Jun 2010 02:19:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-fluent-programming-fluent-properties/</guid><description>&lt;p&gt;Currently Fluent Programming is a hype. You see it in client-side web programming, you see it in .NET programming and I think it is safe to assume it has been, is or will be fashionable in other environments too. You find fluent interfaces within the .NET framework in the LINQ libraries.&lt;/p&gt;&#10;&lt;p&gt;The idea of fluent interfaces is that you structure your code in such a way that you can continue chaining methods on a line. In the example below we create a FluentPerson, and like in this sentence which is way too long and uses commas to chain, we continue, by setting the &lt;em&gt;Age&lt;/em&gt;, the &lt;em&gt;Name&lt;/em&gt;, let it &lt;em&gt;Dance&lt;/em&gt; and finally give it a &lt;em&gt;Rest&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>Operator overloading</title><link>https://hanskruse.eu/post/2010-06-20-operator-overloading/</link><pubDate>Sun, 20 Jun 2010 02:17:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-operator-overloading/</guid><description>&lt;p&gt;Although I have been doing .NET since December 1999 I never followed a formal course or did take an exam. With my new employer I am going to be certified. For this I have to pass some basic exams first. These are not difficult but still require some study.&lt;/p&gt;&#10;&lt;p&gt;When reading chapter one of the course book I noticed something called widening and narrowing operator overloading. These two overloads allow you to create some custom type instance by assigning a simple type. This caught my attention because we use some custom types which are just some Guids wrapped in a type. The wrapping is done to distinguish their use.&lt;/p&gt;</description></item><item><title>Using Memoize in ASP.NET</title><link>https://hanskruse.eu/post/2010-06-20-using-memoize-in-aspnet/</link><pubDate>Sun, 20 Jun 2010 02:11:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-using-memoize-in-aspnet/</guid><description>&lt;p&gt;I spent quite some time blogging about memoize. Until now I did not have a good solution for Memoize in VB.NET because VB.NET&amp;rsquo;s lambda function is limited to a single expression and VB.NET has no anonymous delegates.&lt;/p&gt;&#10;&lt;p&gt;I first made a Memoize that used a Dictionary. Based on this implementation I made one that wraps the ASP.NET Cache. Certainly some generalisation is possible. I wrote a base class that abstracted away the concrete implementation of the cache using three functions:&lt;/p&gt;</description></item><item><title>Memento without lambdas</title><link>https://hanskruse.eu/post/2010-06-20-memoize-in-vbnet/</link><pubDate>Sun, 20 Jun 2010 02:08:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-memoize-in-vbnet/</guid><description>&lt;p&gt;I am pleased with the idea of a generalised Memoize Function. However my current implementation works from .NET 3.0 upwards because Lambda expressions are available from version 3.0. In .NET 2.0 there are no Lambda expressions. In C# lambda functions can be easily replaced with anonymous delegate implementations. In VB.NET there is no such thing as anonymous delegate implementations. That does not mean we cannot implement Memoize in VB.NET. We have to simulate what the compiler does when compiling lambda functions with closure. We make a class that has three things:&lt;/p&gt;</description></item><item><title>Memento in Second Life</title><link>https://hanskruse.eu/post/2010-06-20-memento-in-second-life/</link><pubDate>Sun, 20 Jun 2010 02:06:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-memento-in-second-life/</guid><description>&lt;p&gt;After grasping the power of Memoize in VB.NET and C#, I tried my luck at making a memoizing Fibonacci generator in Second Life&amp;rsquo;s scripting language LSL. &lt;a href="http://secondlife.com/"&gt;Second Life&lt;/a&gt; is a 3D virtual world where end users can create their own world using basic building blocks. They can script their creation with a scripting language called LSL. This language gets compiled to Mono&amp;rsquo;s runtime.&lt;/p&gt;&#10;&lt;p&gt;LSL is somewhat limited. It does not allow for closures or lambda functions. It also has a very limited set of datatypes. It does not have arrays. It has immutable lists. A list in LSL can contain elements of string, integer and other types but not lists themselves. For Fibonacci a list with only integers will do.&lt;/p&gt;</description></item><item><title>Memento VB.NET</title><link>https://hanskruse.eu/post/2010-06-20-memento-vbnet/</link><pubDate>Sun, 20 Jun 2010 02:04:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-memento-vbnet/</guid><description>&lt;p&gt;In the past blog entries I played with an imperative IEnumerable wrapped implementation of the sequence. The mathematical definition of the Fibonacci sequence is a recursive one. It is both compact and beautiful. However if you implement this literally in C# or VB.NET you will get a terribly slow program that may even crash due to stack overflow. An imperative implementation that calculates Fib(n) for any random n may be a bit faster but is still slow. The code would be less comprehensible.&lt;/p&gt;</description></item><item><title>Alternative Fibonacci implementation</title><link>https://hanskruse.eu/post/2010-06-20-alternative-fibonacci-implementation/</link><pubDate>Sun, 20 Jun 2010 02:03:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-alternative-fibonacci-implementation/</guid><description>&lt;p&gt;On Scott Hanselman&amp;rsquo;s blog there was another formula for Fibonacci that uses the golden ratio and some Mathemagic to calculate Fib(n). This formula is more useful if you want to calculate Fib(n) for a certain n and if you are not interested in the sequence. I used this formula in an alternative implementation of my FibEnumerable just to test for correctness.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-vb" data-lang="vb"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39; Fibonacci.vb created with MonoDevelop&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39; User: kruse at 14:10 22-1-2009&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39; To change standard headers go to Edit-&amp;gt;Preferences-&amp;gt;Coding-&amp;gt;Standard Headers&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;Option Explicit On&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;Option Strict On&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Imports&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Imports&lt;/span&gt; &lt;span class="nn"&gt;System.Collections&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Imports&lt;/span&gt; &lt;span class="nn"&gt;System.Collections.Generic&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Namespace&lt;/span&gt; &lt;span class="nn"&gt;EUNemopolis.Math&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Public&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt; &lt;span class="nc"&gt;FibEnumerable2&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Inherits&lt;/span&gt; &lt;span class="n"&gt;IntegerEnumerable&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Protected&lt;/span&gt; &lt;span class="k"&gt;Overrides&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt; &lt;span class="nf"&gt;NewEnumerator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;as&lt;/span&gt; &lt;span class="n"&gt;IEnumerator&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;New&lt;/span&gt; &lt;span class="n"&gt;FibEnumerator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt; &lt;span class="nc"&gt;FibEnumerator&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Inherits&lt;/span&gt; &lt;span class="n"&gt;IntegerEnumerable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IntegerEnumerator&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MAXN&lt;/span&gt; &lt;span class="ow"&gt;As&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;45&lt;/span&gt; &lt;span class="c"&gt;&amp;#39;The maximum n for which Fib(n) fits in an integer&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt; &lt;span class="ow"&gt;As&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="k"&gt;Readonly&lt;/span&gt; &lt;span class="k"&gt;Shared&lt;/span&gt; &lt;span class="n"&gt;GoldenRation&lt;/span&gt; &lt;span class="ow"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;Double&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Public&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt; &lt;span class="nf"&gt;MoveNext&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;As&lt;/span&gt; &lt;span class="kt"&gt;Boolean&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Implements&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Collections&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IEnumerator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MoveNext&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MAXN&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;2&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;SetCurrent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;else&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Dim&lt;/span&gt; &lt;span class="n"&gt;newCurrent&lt;/span&gt; &lt;span class="ow"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;newCurrent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Floor&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GoldenRation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Pow&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;GoldenRation&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;SetCurrent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newCurrent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;If&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Return&lt;/span&gt; &lt;span class="k"&gt;True&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Else&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Return&lt;/span&gt; &lt;span class="k"&gt;False&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;If&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Protected&lt;/span&gt; &lt;span class="k"&gt;Overrides&lt;/span&gt; &lt;span class="k"&gt;Sub&lt;/span&gt; &lt;span class="nf"&gt;Init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c"&gt;&amp;#39;illegal value first. Foreach does a movenext&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c"&gt;&amp;#39;first before reading current value&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;SetCurrent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Sub&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Namespace&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To see whether this gives the same result as the original implementation I altered my main program. I walk the sequence for n=0 up to and including n=45 for both implementations. I cache the results for the first implementation. In the second foreach loop I print the results for both implementations and the difference between them. If all is correct all differences should be zero. I can use both a list or a simple array for storing the results. I chose an array here just for having used array in VB.Net. I never use arrays in C#.&lt;/p&gt;</description></item><item><title>Refactoring Fibonacci code</title><link>https://hanskruse.eu/post/2010-06-20-refactoring-fibonacci-code/</link><pubDate>Sun, 20 Jun 2010 02:01:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-refactoring-fibonacci-code/</guid><description>&lt;p&gt;I planned to experiment with Inversion of Control, unit tests and a Mockup Framework under VB.NET using Mono. For this I planned to use the Fibonacci example discussed earlier. However in its present form it is not pleasant to use, reusable or extendible. I want the following:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Move the Fibonacci code in a separate library project. This will allow me to reuse the code more easily;&lt;/li&gt;&#10;&lt;li&gt;Use a check in the MoveNext Code on n&amp;lt;45. This allows me to use &lt;em&gt;For Each&lt;/em&gt; in the mainloop and I do not need to explicitly use an Enumerator. This is more the way I am used to program in C#. I suppose this is also common practice in VB.NET. Note that this will be slower;&lt;/li&gt;&#10;&lt;li&gt;Make an Abstract IntegerEnumerable base class that also contains an Abstract enumerator. This allows me to have the plumbing code in one place and let me concentrate on variations for the MoveNext function;&lt;/li&gt;&#10;&lt;li&gt;Make a prime number finder as a variation;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;When that is done I can do some performance analysis code. I am curious about the impact of checking on &amp;lsquo;45&amp;rsquo; in the MoveNext(). Also I am interested in some variations of the MoveNext Method. First of all, I developed the abstract integerenumerable:&lt;/p&gt;</description></item><item><title>My First Fibonacci workflow</title><link>https://hanskruse.eu/post/2010-06-20-my-first-fibonacci-workflow/</link><pubDate>Sun, 20 Jun 2010 01:57:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-my-first-fibonacci-workflow/</guid><description>&lt;p&gt;When supporting a business with software one often draws diagrams of the so-called business processes. These diagrams describe the flow, the work flow, of the business process. Since .NET 3.0 there is built-in support for work flows which is augmented with a nice Visual Designer in Visual Studio 2008. With this Designer one designs the workflows graphically. These designs can be used as a means of communication to the customer and between programmer and business analyst.&lt;/p&gt;</description></item><item><title>Basic Fibonacci</title><link>https://hanskruse.eu/post/2010-06-20-basic-fibonacci/</link><pubDate>Sun, 20 Jun 2010 01:55:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-basic-fibonacci/</guid><description>&lt;p&gt;When I planned to do the Fibonacci sequence I wanted to do an IEnumerable(Of Integer) implementation first using the &amp;lsquo;yield&amp;rsquo; keyword. Well that doesn&amp;rsquo;t work in VB.NET because &amp;lsquo;yield&amp;rsquo; is something specific for C#. I had to implement a full IEnumerable and IEnumerator ;(. I started using a Console Project in MonoDevelop. I wrote a main program that will print the Fibonacci sequence from 0 to 44(maximum possible with integer).&lt;/p&gt;</description></item><item><title>Fibonacci numbers in VB.NET an outline</title><link>https://hanskruse.eu/post/2010-06-20-fibonacci-numbers-in-vbnet-outline/</link><pubDate>Sun, 20 Jun 2010 01:53:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-fibonacci-numbers-in-vbnet-outline/</guid><description>&lt;p&gt;In order to get more familiar with VB.NET I wanted to do some more programming in VB.NET. Nothing serious but a bit more serious than Hello World. I went for implementing the Fibonacci sequence(&lt;a href="http://en.wikipedia.org/wiki/Fibonacci_number"&gt;See Wikipedia&lt;/a&gt;) in VB.NET. This provides me with a vehicle to test all kinds of .NET/VB.NET plumbing code. An elaborate discussion on implementing the Fibonacci sequence using various languages and techniques can be found on &lt;a href="http://www.hanselman.com/blog/TheWeeklySourceCode13FibonacciEdition.aspx"&gt;(Scott Hanselman&amp;rsquo;s blog)&lt;/a&gt;. However in this discussion VB is only used marginally. I Want to combine the best solutions offered into one or more VB.NET implementations. The first implementation should have the following characteristics:&lt;/p&gt;</description></item><item><title>Back To Basics</title><link>https://hanskruse.eu/post/2010-06-20-back-to-basics/</link><pubDate>Sun, 20 Jun 2010 01:51:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-back-to-basics/</guid><description>&lt;p&gt;Halfway through January I quit my current job. And after a short vacation I will start with my new job which is on cycling distance from my home ;). In my new job I will return to my programming roots: Basic. In high school I started programming on the Commodore 64 in Microsoft Basic 2.0. My first serious program was a vocabulary trainer that aided me in learning natural languages. I was not a star in French or German in high school. At my new job software development is done in Visual Basic 2008 (.NET). As a C# developer that cannot be too much of a problem. Since I do not want to look like an absolute beginner. I did buy a book and began to jot down the differences and check some assumptions. For fun I do my explorations not by using Visual Studio but by using MonoDevelop and the Mono 2.01 framework on Linux. First of all, does Goto still exist? Yes it does. However line numbers do not exist as with the original BASIC dialects. Instead of that there are labels. Some children, of course not me ;) , would consider it fun to run silly programs on the demo computers shown in the local department store (V&amp;amp;D) who had some C64/MSX and the like on display in the 1980s. The most popular was something like shown below:&lt;/p&gt;</description></item></channel></rss>