{"authors":[{"name":"holsee"}],"description":"Code and stuff. holsee's notes on Elixir, algorithms, and whatever is on the workbench.","feed_url":"https://holsee.github.io/feed.json","home_page_url":"https://holsee.github.io/","items":[{"content_html":"<p>After a decade frozen on Octopress, this site is now built with\n<a href=\"https://cherrybomb.dev\">Cherry</a>, a static site generator written in Elixir.</p>\n<p>The migration was done by an AI agent driving the <code>cherry</code> CLI: every command\nspeaks JSON, the verifier (<code>cherry check --strict</code>) turned 41 content problems\ninto a fixable list, and the whole thing built clean on Windows.</p>\n<p>Fitting, given how many posts here are about Elixir in the first place.</p>","date_published":"2026-08-15T00:00:00Z","id":"https://holsee.github.io/rebuilt-with-cherry/","summary":"This site now builds with Cherry, an Elixir static site generator, after a decade on Octopress.","tags":["meta","elixir","cherry"],"title":"Rebuilt with Cherry","url":"https://holsee.github.io/rebuilt-with-cherry/"},{"content_html":"<p>I gave a lightning talk at <a href=\"http://ElixirConf.eu\">ElixirConfEU</a> on Visualizing Elixir Processes in 3D.</p>\n<p><img src=\"/images/exconfeu/elixirconf_lightning_talk.jpg\" alt=\"Giving the lightning talk at ElixirConfEU\" /></p>\n<p>A few nights before travelling to Krakow I had watched a video by <a href=\"https://github.com/krestenkrab/\">Kresten Krab Thorup</a> on his project <a href=\"https://github.com/krestenkrab/erlubi\">Erlubi</a> which transmits basic details of the Erlang VM to a <a href=\"http://ubietylab.net\">Ubigraph Server</a>.</p>\n<p>I started to use this to inspect Erlang projects, and play about with OTP Supervisor trees and how they looked in 3D.</p>\n<p>I decided to go about using this from elixir. It doesn't take much to use from elixir; if you want to visualize your own project simply cherry pick the steps 1, 3, 6 and 7 below.</p>\n<p><strong>1</strong> Download the Ubigraph server from <a href=\"http://ubietylab.net\">ubietylab.net</a>. Unpack it and just run the command line tool <code>bin/ubigraph_server</code>. A black window will appear.</p>\n<p><strong>2</strong> Create a new elixir project <code>mix new lightning_ex</code> and cd into directory.</p>\n<p><strong>3</strong> Add Erlubi as a dependency to the mix.exs file:</p>\n<pre class=\"lumis\"><code class=\"language-elixir\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-function\">defp</span> <span class=\"l-function\">deps</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-punctuation-bracket\">[</span><span class=\"l-punctuation-bracket\">{</span><span class=\"l-string-special-symbol\">:erlubi</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-string-special-symbol\">github: </span><span class=\"l-string\">&quot;krestenkrab/erlubi&quot;</span><span class=\"l-punctuation-bracket\">}</span><span class=\"l-punctuation-bracket\">]</span>\n</div><div class=\"l-line\" data-line=\"3\"><span class=\"l-keyword\">end</span>\n</div></code></pre>\n<p><strong>4</strong> Add some code to ex_lightning.ex to generate linked and unlinking procs</p>\n<pre class=\"lumis\"><code class=\"language-elixir\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-function\">defmodule</span> <span class=\"l-module\">ExLightning</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-keyword-function\">def</span> <span class=\"l-function\">start_linked</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">n</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"3\">    <span class=\"l-keyword\">for</span> <span class=\"l-comment\">_</span> <span class=\"l-operator\">&lt;-</span> <span class=\"l-number\">1</span><span class=\"l-operator\">..</span><span class=\"l-variable\">n</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"4\">      <span class=\"l-module\">Task</span><span class=\"l-operator\">.</span><span class=\"l-function-call\">start_link</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-keyword\">fn</span> <span class=\"l-operator\">-&gt;</span>\n</div><div class=\"l-line\" data-line=\"5\">        <span class=\"l-type\">:timer</span><span class=\"l-operator\">.</span><span class=\"l-function-call\">sleep</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-number\">1000</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"6\">      <span class=\"l-keyword\">end</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"7\">    <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"8\">  <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"9\">\n</div><div class=\"l-line\" data-line=\"10\">  <span class=\"l-keyword-function\">def</span> <span class=\"l-function\">start</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">n</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"11\">    <span class=\"l-keyword\">for</span> <span class=\"l-comment\">_</span> <span class=\"l-operator\">&lt;-</span> <span class=\"l-number\">1</span><span class=\"l-operator\">..</span><span class=\"l-variable\">n</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"12\">      <span class=\"l-module\">Task</span><span class=\"l-operator\">.</span><span class=\"l-function-call\">start</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-keyword\">fn</span> <span class=\"l-operator\">-&gt;</span>\n</div><div class=\"l-line\" data-line=\"13\">        <span class=\"l-type\">:timer</span><span class=\"l-operator\">.</span><span class=\"l-function-call\">sleep</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-number\">1000</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"14\">      <span class=\"l-keyword\">end</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"15\">    <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"16\">  <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"17\"><span class=\"l-keyword\">end</span>\n</div></code></pre>\n<p><strong>5</strong> In terminal fetch dependencies and compile with <code>mix do deps.get, compile</code></p>\n<p><strong>6</strong> In terminal start an iex session with mix <code>iex -S mix</code></p>\n<p><strong>7</strong> In iex session start Erlubi tracer with <code>:erlubi_tracer.run</code>. If you get an error ensure you started ubigraph_server as described in step 1. At this point you should see the vanilla elixir system visualized in 3D like so:</p>\n<ul>\n<li>Green Cubes = Erlang Ports</li>\n<li>Red Spheres = Erlang Processes</li>\n<li>Blue Sphere = Named Erlang Processes</li>\n<li>Grey Line = Process Links</li>\n</ul>\n<p><img src=\"/images/exconfeu/erlubi_vanilla.png\" alt=\"Erlubi 3D visualization: a vanilla process tree\" /></p>\n<p><strong>8</strong> run <code>ExLightning.start 5000</code> which will create 5000 unlinked processes (unbound red spheres)</p>\n<p><img src=\"/images/exconfeu/erlubi_unlinked.png\" alt=\"Erlubi 3D visualization: processes without links\" /></p>\n<p><strong>9</strong> run <code>ExLightning.start_linked 5000</code> which will create 5000 linked processes, which will be linked to the creating process.</p>\n<p><img src=\"/images/exconfeu/erlubi_linked.png\" alt=\"Erlubi 3D visualization: processes with links shown\" /></p>\n<p>Full source code can be found here: <a href=\"https://github.com/holsee/lightning_ex\">github.com/holsee/lightning_ex</a></p>\n<p>Have fun :D</p>","date_published":"2015-04-28T00:00:00Z","id":"https://holsee.github.io/elixirconfeu-elixir-procs-in-3d/","summary":"A lightning talk at ElixirConfEU on visualizing Elixir processes in 3D.","tags":["elixir"],"title":"ElixirConfEU - Elixir Processes in 3D","url":"https://holsee.github.io/elixirconfeu-elixir-procs-in-3d/"},{"content_html":"<p>Much more than an introduction to the elixir language, the philosophy and design choices are examined in this talk by <a href=\"https://twitter.com/josevalim\">José Valim</a>.</p>\n<p>Even for the seasoned elixir wrangler this is a very interesting watch, as José discusses the kind of citizen elixir wants to be in the Erlang ecosystem.</p>\n<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/Lqo9-pQuRKE\" title=\"What Elixir is about, Erlang Factory SF 2015\" loading=\"lazy\" allowfullscreen></iframe></div>","date_published":"2015-04-02T00:00:00Z","id":"https://holsee.github.io/what-elixir-is-about-at-erlang-factory-sf-2015/","summary":"Jose Valim on Elixir's philosophy and design choices at Erlang Factory SF 2015.","tags":["elixir"],"title":"What Elixir is about @ Erlang Factory SF 2015","url":"https://holsee.github.io/what-elixir-is-about-at-erlang-factory-sf-2015/"},{"content_html":"<p>Love these videos, love Spotify's culture, looks like a great place to work.</p>\n<div class=\"video-embed\"><iframe src=\"https://player.vimeo.com/video/85490944\" title=\"Spotify Engineering Culture, part 1\" loading=\"lazy\" allowfullscreen></iframe></div>\n<p>Far bigger company than I thought they would be... tis cool how they approach the architecture to cope with that effectively.</p>\n<div class=\"video-embed\"><iframe src=\"https://player.vimeo.com/video/94950270\" title=\"Spotify Engineering Culture, part 2\" loading=\"lazy\" allowfullscreen></iframe></div>\n<p>Well worth the watch.</p>","date_published":"2015-03-27T00:00:00Z","id":"https://holsee.github.io/spotify-culture-envy/","summary":"Spotify's engineering culture videos, and a healthy dose of culture envy.","tags":["culture"],"title":"Spotify Culture Envy","url":"https://holsee.github.io/spotify-culture-envy/"},{"content_html":"<p>I recently got into a conversation about the computer science classic <em>sorting</em>, in particular we chatted about applications of Radix Sort.</p>\n<p>This is not something I had really needed to look into in any detail, but sparked my interest due to this statement &quot;Radix sorts are often, in practice, the fastest and most useful sorts on parallel machines.&quot;</p>\n<p>The spark rekindled my desire for refreshing my knowledge of the basics so I may build on this to explore the latest and greatest research in this area.</p>\n<p>I personally like the MIT course <a href=\"http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/\">Introduction to Algorithms</a> as it covers so many of the fundamentals very well.</p>\n<p>Watching &quot;Counting Sort, Radix Sort, Lower Bounds for Sorting&quot; at the minute:</p>\n<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/Nz1KZXbghj8\" title=\"YouTube video\" loading=\"lazy\" allowfullscreen></iframe></div>\n<p>A good start for now.</p>\n<p>Also worth checking out: <a href=\"http://cs.stackexchange.com/questions/12223/practical-applications-of-radix-sort\">&quot;Practical Applications of Radix Sort&quot;</a>.</p>","date_published":"2015-03-17T00:00:00Z","id":"https://holsee.github.io/mit-introduction-to-algorithms/","summary":"Radix sort and the MIT Introduction to Algorithms lectures worth revisiting.","tags":["algorithms","comp-sci"],"title":"MIT: Introduction to Algorithms","url":"https://holsee.github.io/mit-introduction-to-algorithms/"},{"content_html":"<p>I think brushing up on Computer Science fundamentals from time to time is a valuable endeavour, which every developer should do.</p>\n<p>Even if it is as little as taking one of the many <a href=\"/mit-introduction-to-algorithms/\">undergrad level modules online</a>.  Many of which are not to be sniffed at.</p>\n<p>In our industry we are not chartered, and nor do I think we should be as I don't like the idea of a professional body lording over us.  I think we owe it to ourselves to get better or at the very least not get dumber, as many jobs in our industry will make you dumber over time.</p>\n<p>My Sister is a doctor, and soon she will be revalidated: &quot;<em>Revalidation is the process by which doctors holding registration with a licence to practise will have to demonstrate to the GMC that they are up-to-date and fit to practise and complying with the relevant professional standards.</em>&quot;</p>\n<p>I can't speak for what her day to day is like, but as a practicing doctor I doubt you exercise your entire base of knowledge on a regular enough basis to avoid refreshing yourself with the fundamentals from time to time.</p>\n<p>Now imagine beyond doing our daily duties, developers were required to go through such a &quot;revalidation&quot; process in order to be allowed to hold the title of software engineer (or whatever).</p>\n<p>An interesting thought... baring in mind we all probably know at least one <a href=\"http://techcrunch.com/2015/03/08/on-secretly-terrible-engineers/\">Secretly Terrible Engineer</a>.</p>\n<p>Ours is a industry fueled by both passion and science, and the passion is what has pushed us forward.  The same can be said for medicine.</p>\n<p>Bad engineers probably were not always that way, maybe they were both sharp and passionate as a they come when they started, but the lack of inspiration in their 9 to 5 has caused them to become blunt and disenchanted over time.</p>\n<p>It is often said software development is so broad and someone cannot possibly know everything, true, but I don't think medicine is a small field and there is no excuse for a Doctor to not be continually up-to-date with the fundamentals of their field as well as their respective specialization.</p>\n<p>I for one don't like the idea of being made to &quot;Revalidate&quot;, but I do think we owe it to ourselves to try and stay fresh and up-to-date with the foundations of our industry.</p>","date_published":"2015-03-17T00:00:00Z","id":"https://holsee.github.io/dont-succumb-to-dumb/","summary":"Why brushing up on computer science fundamentals is worth every developer's time.","tags":["comp-sci","opinion"],"title":"Don't circum to dumb","url":"https://holsee.github.io/dont-succumb-to-dumb/"},{"content_html":"<p>I recently gave a presentation to <a href=\"http://www.meetup.com/Functional-Kats-Belfast/\">Functional Kats (Belfast)</a> on the elixir language.  It was a lot of fun!</p>\n<p>The format of the event I totally love, it started with a couple of talks followed by a Kata hack where we all had a go at implementing the Luhn Credit Card algo in the functional programming language of our choice.  At the end we all took turns to present our solutions.</p>\n<p>The goal of my talk was to arm the folks with enough of the basics to implement the Kata in elixir.</p>\n<img src=\"/images/me_at_func_kats.jpeg\" alt=\"\">","date_published":"2015-03-13T00:00:00Z","id":"https://holsee.github.io/a-taste-of-elixir/","summary":"Slides and notes from a talk introducing Elixir at Functional Kats Belfast.","tags":["elixir"],"title":"A taste of elixir at Functional Kats Belfast","url":"https://holsee.github.io/a-taste-of-elixir/"},{"content_html":"<p>I found this video last night by <a href=\"LeHoff\">Torben Hoffman</a>, I recommend folks interested in Erlang or Elixir give it a watch and take it to heart.  Torben does a good job of displaying how an &quot;Erlanger&quot; should think, in comparison to other programmers.</p>\n<div class=\"video-embed\"><iframe src=\"https://player.vimeo.com/video/118258580\" title=\"Vimeo video\" loading=\"lazy\" allowfullscreen></iframe></div>\n<p>Torben recommends 2 books which have been added to my reading list:</p>\n<p><a href=\"http://www.usingcsp.com/cspbook.pdf\">Communicating Sequential Processes</a> by C.A.R. Hoare. (Free digital Version)</p>\n<p><a href=\"http://www.amazon.co.uk/Principles-Protocol-Design-Robin-Sharp/dp/3540775404\">Principles of Protocol Design</a> by Robin Sharp.</p>","date_published":"2015-03-08T00:00:00Z","id":"https://holsee.github.io/thinking-like-an-erlanger/","summary":"Torben Hoffmann on how an Erlanger thinks about processes and failure.","tags":["erlang","otp"],"title":"Thinking Like an Erlanger","url":"https://holsee.github.io/thinking-like-an-erlanger/"},{"content_html":"<p><em>As I plan to write and speak about Elixir on my blog and hopefully at some meet-ups soon, I though I would write a short post with handy descriptions of some of the key aspects that I can reference in one place...</em></p>\n<h3 id=\"what-is-elixir\">What is Elixir?<a href=\"#what-is-elixir\" aria-label=\"Link to heading 'What is Elixir?'\" data-heading-content=\"What is Elixir?\" class=\"anchor\"></a></h3>\n<p>Think Dave Thomas describes it best...</p>\n<p>&quot;The Elixir Programming Language wraps functional programming with immutable state and an actor-based approach to concurrency in a tidy modern syntax.  And it runs on the industrial-strength, high-performance, distributed Erlang VM.&quot;</p>\n<p>It has very powerful meta-programming capabilities through compile time expansion of macros and the dynamic power of the language.  A good example of the developer productivity that can be gained is their use in the <a href=\"http://www.phoenixframework.org/v0.7.2/docs/routing\">routing system in the phoenix web framework</a>. When learning about Elixir macros I found the '<a href=\"http://www.theerlangelist.com/2014/06/understanding-elixir-macros-part-1.html\">Understanding Elixir Macros Series</a>' by <a href=\"https://twitter.com/sasajuric\">Saša Jurić</a> to be very useful.</p>\n<h3 id=\"what-is-the-erlang-vm--beam\">What is the Erlang VM &amp; BEAM?<a href=\"#what-is-the-erlang-vm--beam\" aria-label=\"Link to heading 'What is the Erlang VM &amp; BEAM?'\" data-heading-content=\"What is the Erlang VM &amp; BEAM?\" class=\"anchor\"></a></h3>\n<p>The &quot;Erlang VM&quot; is the name of the virtual machine where all Erlang code is executed. Every compiled Erlang file has the suffix .beam.</p>\n<p>There is also an implementation of Erlang which runs on the JVM, called <a href=\"https://github.com/krestenkrab/erjang/wiki\">Erjang</a>, but I guess the less said about that the better as the Erlang VM is really the awesome part if you ask me.</p>\n<p>When you compile Elixir code it is converted to .beam format, which allows it to be executed on the Erlang VM.</p>\n<h3 id=\"what-is-otp\">What is OTP?<a href=\"#what-is-otp\" aria-label=\"Link to heading 'What is OTP?'\" data-heading-content=\"What is OTP?\" class=\"anchor\"></a></h3>\n<p>OTP is set of Erlang libraries and design principles providing middle-ware to develop these systems. It includes its own distributed database, applications to interface towards other languages, debugging and release handling tools.</p>\n<p>The OTP libraries (and the associated best practices to an extent) are mature, battle hardened and hide much of the boilerplate code required to perform common patterns such as creating a server to store state, recover from failures through supervision trees and so much more.</p>\n<p>I look forward to writing about this with examples in future as I learn more about OTP myself.</p>\n<p><em>Where is OTP used?</em></p>\n<p><a href=\"https://github.com/mojombo/egitd\">egitsd</a> - egitd is an Erlang git-daemon implementation that provides a more flexible,\nscalable, and loggable way to serve public git repositories.  It is used by github.com.</p>\n<p><a href=\"http://www.rabbitmq.com\">RabbitMQ</a> - An open source message broker (sometimes called message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP).</p>\n<p><a href=\"https://github.com/erlang/otp/wiki/Projects-using-erlang-otp\">More Projects using OTP...</a></p>\n<h3 id=\"sources\">Sources:<a href=\"#sources\" aria-label=\"Link to heading 'Sources:'\" data-heading-content=\"Sources:\" class=\"anchor\"></a></h3>\n<ul>\n<li><a href=\"http://www.erlang.org/doc/\">Erlang Website</a></li>\n<li><a href=\"https://github.com/erlang/otp/wiki\">Erlang OTP Source on Github</a></li>\n<li><a href=\"http://elixir-lang.org\">Elixir Website</a></li>\n<li><a href=\"https://pragprog.com/book/elixir/programming-elixir\">Programming Elixir Book</a> by <a href=\"https://twitter.com/pragdave\">Dave Thomas</a></li>\n<li><a href=\"http://elixirsips.com\">Elixir Sips Screencasts</a> by <a href=\"https://plus.google.com/+JoshAdams\">Josh Adams</a></li>\n</ul>","date_published":"2014-12-29T00:00:00Z","id":"https://holsee.github.io/elixir-beam-otp/","summary":"Handy one-place descriptions of Elixir, the BEAM, and OTP.","tags":["elixir","otp"],"title":"Elixir, BEAM and OTP","url":"https://holsee.github.io/elixir-beam-otp/"},{"content_html":"<p><a href=\"https://twitter.com/toddlmontgomery\">@ToddMontgomery</a>'s session on message passing and distributed systems at <a href=\"http://reactconf.com\">ReactConf</a>.</p>\n<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/DL_-ENSpcAg\" title=\"YouTube video\" loading=\"lazy\" allowfullscreen></iframe></div>","date_published":"2014-12-22T00:00:00Z","id":"https://holsee.github.io/to-be-message-driven/","summary":"Todd Montgomery at ReactConf on message passing and distributed systems.","tags":[],"title":"To Be Message Driven","url":"https://holsee.github.io/to-be-message-driven/"},{"content_html":"<p>I listened to this on Sunday morning over a few nice coffees. Super interview... well worth the listen.</p>\n<iframe width=\"100%\" height=\"166\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/175814224&amp;color=6df2ff&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false\"></iframe>","date_published":"2014-11-25T00:00:00Z","id":"https://holsee.github.io/william-gibson-on-zero-history-interview/","summary":"A Sunday-morning listen: William Gibson interviewed about Zero History.","tags":["sci-fi"],"title":"William Gibson on 'Zero History' Interview","url":"https://holsee.github.io/william-gibson-on-zero-history-interview/"},{"content_html":"<p>A fun little test driven kata which will introduce you to the basics of elixir.</p>\n<p>A rule I try to follow for this is to try and keep my solution less than 20 lines of code.</p>\n<div class=\"markdown-alert markdown-alert-note\">\n<p class=\"markdown-alert-title\">Note</p>\n<p>The screencast that used to be embedded here is set to private on YouTube, so\nit has been removed from the page rather than left as a dead player.</p>\n</div>","date_published":"2014-11-25T00:00:00Z","id":"https://holsee.github.io/roman-numerals-elixir-kata/","summary":"A test-driven Roman numerals kata as an introduction to Elixir basics.","tags":["elixir","kata"],"title":"Roman Numerals Elixir Kata","url":"https://holsee.github.io/roman-numerals-elixir-kata/"},{"content_html":"<p>Pretty cool that <a href=\"http://blogs.msdn.com/b/dotnet/archive/2014/11/12/net-core-is-open-source.aspx\">.NET got open sourced</a>, even more cool is that it is MIT license with the <a href=\"https://github.com/Microsoft/dotnet\">Source Code on Github</a>.</p>\n<p>Also pretty funky that they are offering a fully featured version of Visual Studio for free and shipping supported Linux and OS X runtimes.  Mono has give us this for a long time, but it is a nice that the gaps in Mono are going to be filled.</p>\n<p>Lots of cool stuff coming in this area, such as the new Roslyn compiler (C# written in C# now not C++) which will open up some crazy compiler as a service meta-programming voodoo.  Mono is a C# implementation of C# and has again been ahead of its time in this space, but Roslyn seems to be generating some crazy buzz around code introspection and IDE features.</p>\n<p>Most interesting thing in .NET space for me though is not any of this but is simply the F# language, which itself is written in F#, and has been the most pioneering and exciting language in the .NET space for a number of years due to its ability to innovate a add new powerful features with relative ease.</p>\n<p>I hope that C# and .NET keep pushing forward and we don't see a Java-'6-8'-esk stagnation period. Doesn't look like it in week one anyway -&gt; <a href=\"http://blogs.msdn.com/b/dotnet/archive/2014/11/20/one-week-of-open-source.aspx\">'One Week of Open Source'</a>...</p>","date_published":"2014-11-25T00:00:00Z","id":"https://holsee.github.io/dot-net-open-sourced/","summary":".NET goes open source under MIT, with the code on GitHub.","tags":[".net","open-source"],"title":".NET Open Sourced","url":"https://holsee.github.io/dot-net-open-sourced/"},{"content_html":"<p>Completed the <a href=\"https://www.codeschool.com/courses/rails-testing-for-zombies\">Rails Testing <em>for zombies</em></a> courses on <a href=\"http://mbsy.co/8TZ9N\">CodeSchool</a> tonight.</p>\n<p>I liked it, I always found starting a new rails app always triggered my testing OCD and it was nice to get an insight into the strategies one can take to test a rails app without overdoing it.</p>\n<img src=\"/images/badges/rtfz_badge.png\" alt=\"\">\n<p>The course covers how to unit test and integration test your rails app with fixtures using TestUnit, so you are given a good idea of the tools at your disposal out of the box. As a well as that you are introduced to other popular testing gems which make your life easier such as <a href=\"https://github.com/thoughtbot/shoulda\">Shoulda</a>, <a href=\"https://github.com/jnicklas/capybara\">Capybara</a> and <a href=\"https://github.com/thoughtbot/factory_girl\">FactoryGirl</a>.  I will touch on each of there briefly to give you a taste of what they are all about...</p>\n<p>During the Unit Testing section you are introduced to <a href=\"https://github.com/thoughtbot/shoulda\">Shoulda</a> gem which is described as an alternative syntax that is easy on the fingers and the eyes.</p>\n<pre class=\"lumis\"><code class=\"language-ruby\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-type\">class</span> <span class=\"l-type\">UserTest</span> <span class=\"l-operator\">&lt;</span> <span class=\"l-type\">Test</span><span class=\"l-punctuation-delimiter\">::</span><span class=\"l-type\">Unit</span><span class=\"l-punctuation-delimiter\">::</span><span class=\"l-type\">TestCase</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-function-call\">should</span> <span class=\"l-function-call\">have_many</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string-special-symbol\">:posts</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"3\">  <span class=\"l-function-call\">should_not</span> <span class=\"l-function-call\">allow_value</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string\">&quot;</span><span class=\"l-string\">blah</span><span class=\"l-string\">&quot;</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">for</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string-special-symbol\">:email</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"4\"><span class=\"l-keyword\">end</span>\n</div></code></pre>\n<p>As the course starts to dig into integration testing you are also introduced to <a href=\"https://github.com/jnicklas/capybara\">Capybara</a> which provides a interaction based DSL for defining your integration tests that supports <a href=\"http://www.rubydoc.info/github/jnicklas/capybara#Drivers\">multiple drivers</a>. Capybara tests when executing act like a headless browser of sorts giving you more control over the interactions with your site or api, following redirects more naturally for example which is something not handles by vanilla rails integration tests so well.</p>\n<pre class=\"lumis\"><code class=\"language-ruby\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"> <span class=\"l-function-call\">describe</span> <span class=\"l-string\">&quot;</span><span class=\"l-string\">the signin process</span><span class=\"l-string\">&quot;</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-string-special-symbol\">:type</span> <span class=\"l-operator\">=&gt;</span> <span class=\"l-string-special-symbol\">:feature</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-function-call\">before</span> <span class=\"l-string-special-symbol\">:each</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"3\">    <span class=\"l-type\">User</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable\">make</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string-special-symbol\">:email</span> <span class=\"l-operator\">=&gt;</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">user@example.com</span><span class=\"l-string\">&#39;</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-string-special-symbol\">:password</span> <span class=\"l-operator\">=&gt;</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">password</span><span class=\"l-string\">&#39;</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"4\">  <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"5\">\n</div><div class=\"l-line\" data-line=\"6\">  <span class=\"l-function-call\">it</span> <span class=\"l-string\">&quot;</span><span class=\"l-string\">signs me in</span><span class=\"l-string\">&quot;</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"7\">    <span class=\"l-function-call\">visit</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">/sessions/new</span><span class=\"l-string\">&#39;</span>\n</div><div class=\"l-line\" data-line=\"8\">    <span class=\"l-function-call\">within</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string\">&quot;</span><span class=\"l-string\">#session</span><span class=\"l-string\">&quot;</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"9\">      <span class=\"l-function-call\">fill_in</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">Email</span><span class=\"l-string\">&#39;</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-string-special-symbol\">:with</span> <span class=\"l-operator\">=&gt;</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">user@example.com</span><span class=\"l-string\">&#39;</span>\n</div><div class=\"l-line\" data-line=\"10\">      <span class=\"l-function-call\">fill_in</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">Password</span><span class=\"l-string\">&#39;</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-string-special-symbol\">:with</span> <span class=\"l-operator\">=&gt;</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">password</span><span class=\"l-string\">&#39;</span>\n</div><div class=\"l-line\" data-line=\"11\">    <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"12\">    <span class=\"l-function-call\">click_button</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">Sign in</span><span class=\"l-string\">&#39;</span>\n</div><div class=\"l-line\" data-line=\"13\">    <span class=\"l-function-call\">expect</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">page</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">to</span> <span class=\"l-function-call\">have_content</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">Success</span><span class=\"l-string\">&#39;</span>\n</div><div class=\"l-line\" data-line=\"14\">  <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"15\"><span class=\"l-keyword\">end</span>\n</div></code></pre>\n<p>Lastly you are introduced to <a href=\"https://github.com/thoughtbot/factory_girl\">FactoryGirl</a>, which is an alternative to using the built in test fixtures provided by rails out of the box.</p>\n<p>There are numerous advantages to using a factories and specifically FactoryGirl instead of the built in rails fixture for your test data. You are provided with granular control over how the test data built and initialized not to mention the ability to create test data dynamically rather than maintaining a complex hand crafted static data set defined in yaml with magic ids providing the only basis for associations.</p>\n<pre class=\"lumis\"><code class=\"language-ruby\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-comment\"># This will guess the User class</span>\n</div><div class=\"l-line\" data-line=\"2\"><span class=\"l-type\">FactoryGirl</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable\">define</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"3\">  <span class=\"l-function-call\">factory</span> <span class=\"l-string-special-symbol\">:user</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"4\">    <span class=\"l-function-call\">first_name</span> <span class=\"l-string\">&quot;</span><span class=\"l-string\">John</span><span class=\"l-string\">&quot;</span>\n</div><div class=\"l-line\" data-line=\"5\">    <span class=\"l-function-call\">last_name</span>  <span class=\"l-string\">&quot;</span><span class=\"l-string\">Doe</span><span class=\"l-string\">&quot;</span>\n</div><div class=\"l-line\" data-line=\"6\">    <span class=\"l-function-call\">age</span> <span class=\"l-number\">27</span>\n</div><div class=\"l-line\" data-line=\"7\">    <span class=\"l-function-call\">admin</span> <span class=\"l-boolean\">false</span>\n</div><div class=\"l-line\" data-line=\"8\">    <span class=\"l-function-call\">association</span> <span class=\"l-string-special-symbol\">:roles</span>\n</div><div class=\"l-line\" data-line=\"9\">\n</div><div class=\"l-line\" data-line=\"10\">    <span class=\"l-comment\"># This will use the User class</span>\n</div><div class=\"l-line\" data-line=\"11\">    <span class=\"l-function-call\">factory</span> <span class=\"l-string-special-symbol\">:admin</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"12\">      <span class=\"l-function-call\">first_name</span> <span class=\"l-string\">&quot;</span><span class=\"l-string\">Admin</span><span class=\"l-string\">&quot;</span>\n</div><div class=\"l-line\" data-line=\"13\">      <span class=\"l-function-call\">last_name</span>  <span class=\"l-string\">&quot;</span><span class=\"l-string\">User</span><span class=\"l-string\">&quot;</span>\n</div><div class=\"l-line\" data-line=\"14\">      <span class=\"l-function-call\">admin</span>      <span class=\"l-boolean\">true</span>\n</div><div class=\"l-line\" data-line=\"15\">    <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"16\">  <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"17\">\n</div><div class=\"l-line\" data-line=\"18\">  <span class=\"l-function-call\">factory</span> <span class=\"l-string-special-symbol\">:foo</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"19\">    <span class=\"l-comment\"># some fields</span>\n</div><div class=\"l-line\" data-line=\"20\">  <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"21\"><span class=\"l-keyword\">end</span>\n</div></code></pre>\n<p>Using the <code>Factory</code> method directly will create an instance of an admin and insert it into the DB.</p>\n<p>Beyond this basic example you are able to create new instances without inserting them into the database using the <code>build</code> method on the Factory as well as defining associations between entities as simple as adding <code>association :foo</code>.</p>\n<pre class=\"lumis\"><code class=\"language-ruby\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-function-call\">test</span> <span class=\"l-string\">&#39;</span><span class=\"l-string\">something to do with an admin</span><span class=\"l-string\">&#39;</span> <span class=\"l-keyword\">do</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-variable\">user</span> <span class=\"l-operator\">=</span> <span class=\"l-type\">Factory</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string-special-symbol\">:admin</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"3\">  <span class=\"l-function-call\">assert</span> <span class=\"l-variable\">user</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">admin</span>\n</div><div class=\"l-line\" data-line=\"4\">  <span class=\"l-function-call\">association</span> <span class=\"l-string-special-symbol\">:foo</span>\n</div><div class=\"l-line\" data-line=\"5\"><span class=\"l-keyword\">end</span>\n</div></code></pre>\n<p>Insights into a good test strategy that I took away was to unit test the model and have a full suite of integration tests for everything else, which regards to the rails portion of your application anyway, keep your controllers and views logic free.</p>\n<p>This is the approach that I had taken with a node.js app I have been writing, although I have been hand crafting the test data code I think I will look for something like FactoryGirl maybe <a href=\"https://www.npmjs.org/package/factory-girl\">this javcascript port</a>.</p>\n<p>So thats another course completed, and was well worth the time, not a bad way to spend some of your Sunday afternoon. I think I might do the <a href=\"https://www.codeschool.com/courses/try-r\">Try R</a> course next or some <a href=\"https://www.codeschool.com/courses/warming-up-with-ember-js\">Ember.js</a> which I can put to use in the near future as I am design a website for my wife to kick start a new business idea we have.</p>","date_published":"2014-11-24T00:00:00Z","id":"https://holsee.github.io/devlog-rails-testing-for-zombies/","summary":"Devlog notes from Code School's Rails Testing for Zombies.","tags":["codeschool","devlog","ruby"],"title":"Devlog: Rails Testing","url":"https://holsee.github.io/devlog-rails-testing-for-zombies/"},{"content_html":"<p>Found this gem in a tweet from <a href=\"https://twitter.com/david_whitney\">@david_whitney</a>, and as he says the title is trolly but none the less is an excellent talk on automated testing.</p>\n<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/VDfX44fZoMc\" title=\"J.B. Rainsberger: Integrated Tests Are A Scam\" loading=\"lazy\" allowfullscreen></iframe></div>\n<h3 id=\"integrations-tests-lead-to-bad-design\">Integrations Tests Lead to Bad Design<a href=\"#integrations-tests-lead-to-bad-design\" aria-label=\"Link to heading 'Integrations Tests Lead to Bad Design'\" data-heading-content=\"Integrations Tests Lead to Bad Design\" class=\"anchor\"></a></h3>\n<ul>\n<li>An interesting point is made (and I am paraphrasing) that the more integration tests we have the less design feedback we get, leading to sloppy design as we don't feel the same feedback &amp; design pressure...</li>\n</ul>\n<h3 id=\"what-failed-and-where\">What Failed and Where?<a href=\"#what-failed-and-where\" aria-label=\"Link to heading 'What Failed and Where?'\" data-heading-content=\"What Failed and Where?\" class=\"anchor\"></a></h3>\n<ul>\n<li>Integration tests may highlight failures, and the name of the test may go a long way to saying what failed, but pin pointing the actual location and reason for the failure is often lost in the generalization of the test itself.</li>\n</ul>\n<h3 id=\"the-systemic-growth-of-integration-tests\">The Systemic Growth of Integration Tests<a href=\"#the-systemic-growth-of-integration-tests\" aria-label=\"Link to heading 'The Systemic Growth of Integration Tests'\" data-heading-content=\"The Systemic Growth of Integration Tests\" class=\"anchor\"></a></h3>\n<p>&quot;...[they're] like taking aspirin that make your headache worse...&quot;</p>\n<ul>\n<li>Given 3 components which each interact with each other, how many tests would we need to cover all code paths?</li>\n</ul>\n<div class=\"table-scroll\"><table>\n<thead>\n<tr>\n<th>Component</th>\n<th># Paths</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>A</td>\n<td>3</td>\n</tr>\n<tr>\n<td>B</td>\n<td>5</td>\n</tr>\n<tr>\n<td>C</td>\n<td>7</td>\n</tr>\n</tbody>\n</table></div>\n<p>3 x 5 x 7 = 105 Integration Tests*</p>\n<ul>\n<li>Add a 4th subsystem, as a result of a refactoring, with 2 paths removed from C moved into Component D:</li>\n</ul>\n<div class=\"table-scroll\"><table>\n<thead>\n<tr>\n<th>Component</th>\n<th># Paths</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>A</td>\n<td>3</td>\n</tr>\n<tr>\n<td>B</td>\n<td>5</td>\n</tr>\n<tr>\n<td>C</td>\n<td>5</td>\n</tr>\n<tr>\n<td>D</td>\n<td>2</td>\n</tr>\n</tbody>\n</table></div>\n<p>3 x 5 x 5 x 2 = 150 Integration Tests*</p>\n<p>*At Least as to cover all code paths.</p>\n<ul>\n<li>This is an example of <em>negative design pressure</em>, specifically in this instance to refactoring, which itself is important to obtaining good design.</li>\n<li>Resulting in another 45 tests being created and a on going cost of the time it will take to execute these tests.</li>\n<li>Not to mention the time it takes to run these tests hardly lends itself to a rapid Red Green Refactor cycle that would be possible with more isolated tests.</li>\n</ul>\n<h3 id=\"the-solution\">The Solution<a href=\"#the-solution\" aria-label=\"Link to heading 'The Solution'\" data-heading-content=\"The Solution\" class=\"anchor\"></a></h3>\n<ul>\n<li>Design to Contracts\n<ul>\n<li>If each Component operates against a contract, and the interactions between each component are clearly identified through design then come implementation we will be able isolate and ensure each component behaves correctly given the contract is upheld on both ends.</li>\n</ul>\n</li>\n<li>Tests Subsystems in isolation\n<ul>\n<li>Isolation can be achieved through the use of Test Doubles or Mocks, to ensure each interaction with other components follow the contract under each of the specified scenarios.</li>\n</ul>\n</li>\n</ul>\n<p><em>The talk goes into much more detail and is crammed with practical advice... GO WATCH and make the world a better place.</em></p>","date_published":"2014-10-18T00:00:00Z","id":"https://holsee.github.io/integrated-tests-are-a-scam/","summary":"J.B. Rainsberger's Integrated Tests Are a Scam: trolly title, excellent talk on automated testing.","tags":["testing"],"title":"Integrated Tests Are A Scam","url":"https://holsee.github.io/integrated-tests-are-a-scam/"},{"content_html":"<p>The best HTTP Status Code decision diagram I have seen to date, from the\n<a href=\"https://github.com/for-GET/http-decision-diagram\">for-GET/http-decision-diagram</a> project.</p>\n<p><a href=\"https://github.com/for-GET/http-decision-diagram\"><img src=\"https://raw.githubusercontent.com/for-GET/http-decision-diagram/master/httpdd.fsm.png\" alt=\"HTTP decision diagram: a flowchart from request through to every response status code\" /></a></p>","date_published":"2014-10-18T00:00:00Z","id":"https://holsee.github.io/http-status-code-decision-diagram/","summary":"The best HTTP status code decision diagram seen to date, and where it lives.","tags":["http"],"title":"HTTP Status Code Decision Diagram","url":"https://holsee.github.io/http-status-code-decision-diagram/"},{"content_html":"<p>Completed the <a href=\"https://www.codeschool.com/courses/ruby-bits\">RUBY BITS</a> courses on <a href=\"http://mbsy.co/8TZ9N\">CodeSchool</a>. Again... I was impressed with the content, as a casual rubyist I got plenty out of doing this.</p>\n<p>I really enjoyed this course, I took away a lot of useful idioms which I will put to good use (when I get the chance).</p>\n<img class=\"center\" src=\"/images/badges/ruby-bits_badge.png\" width=\"538\" height=\"178\" alt=\"\">\n<p>The meta-programming a DSL creation in <a href=\"https://www.codeschool.com/courses/ruby-bits-part-2\">RUBY BITS part 2</a> were great... adding methods to classes dynamically is pretty bad-ass for drying up code.</p>\n<p><em>I always wanted default method implementation on interfaces in C#, dunno why I brought this up other than in Ruby that would never ever be an issue with the features you have at your disposal... very few languages lead to as much developer happiness.</em></p>\n<img class=\"center\" src=\"/images/badges/ruby-bits-2_badge.png\" width=\"538\" height=\"178\" alt=\"\">\n<p>Just one of those languages I would love to write everyday if I could.\nMoving onto <a href=\"https://www.codeschool.com/courses/rails-testing-for-zombies\">Rails Testing <em>for zombies</em></a> course next...</p>\n<p>...that said <a href=\"http://elixir-lang.org\">Elixir has hit v1.x</a> and the Dave Thomas <a href=\"https://pragprog.com/book/elixir/programming-elixir\">&quot;Programming Elixir&quot;</a> book has been released, so that will most likely eat up the next month or two of my life.</p>","date_published":"2014-10-18T00:00:00Z","id":"https://holsee.github.io/devlog-ruby-bits-1-and-2/","summary":"Devlog notes from Code School's Ruby Bits 1 and 2.","tags":["codeschool","devlog","ruby"],"title":"Devlog: Ruby Bits 1 & 2","url":"https://holsee.github.io/devlog-ruby-bits-1-and-2/"},{"content_html":"<p>My IDM binge continues....</p>\n<iframe width=\"100%\" height=\"60\" src=\"https://www.mixcloud.com/widget/iframe/?feed=http%3A%2F%2Fwww.mixcloud.com%2FMinimalMondays%2Fminimal-mondays-04-hooked-on%2F&amp;mini=1&amp;embed_uuid=0a231047-3880-4264-a801-908226f94943&amp;replace=0&amp;light=1&amp;embed_type=widget_standard&amp;hide_tracklist=1\" frameborder=\"0\"></iframe>","date_published":"2014-10-09T00:00:00Z","id":"https://holsee.github.io/tunes-minimal-mondays-04-hooked-on/","summary":"Tunes: Minimal Mondays 04, Hooked On. The IDM binge continues.","tags":["idm","tunes"],"title":"Tunes: Minimal Mondays | 04 | Hooked On","url":"https://holsee.github.io/tunes-minimal-mondays-04-hooked-on/"},{"content_html":"<iframe width=\"100%\" height=\"60\" src=\"https://www.mixcloud.com/widget/iframe/?feed=http%3A%2F%2Fwww.mixcloud.com%2Fmesterhazy%2Fmesterh%25C3%25A1zy-k%25C3%25B6rzeti-var%25C3%25A1zsl%25C3%25B3hivatal-2002%2F&amp;mini=1&amp;embed_uuid=5557789f-2af5-4be6-a5c8-69a92088366a&amp;replace=0&amp;light=1&amp;hide_artwork=1&amp;embed_type=widget_standard&amp;hide_tracklist=1\" frameborder=\"0\"></iframe>","date_published":"2014-10-09T00:00:00Z","id":"https://holsee.github.io/tunes-mesterhazy-korzeti-varazslohivatal-2002/","summary":"Tunes: Mesterházy's Körzeti Varázslóhivatal (2002), an IDM favourite.","tags":["idm","tunes"],"title":"Tunes: Mesterházy - Körzeti Varázslóhivatal (2002)","url":"https://holsee.github.io/tunes-mesterhazy-korzeti-varazslohivatal-2002/"},{"content_html":"<p>Completed the <a href=\"\">Real Time Web with Node.js course on CodeSchool</a></p>\n<img src=\"/images/badges/rtnode_badge.png\" alt=\"\">\n<p>Another impeccable course, produced to the usual  high standards which I have come to expect with each and every CodeSchool module. Go give these guys money and do a few courses, worth every penny.</p>\n<p>I have completed a couple of node.js projects to date and am currently working on a biggin', so I didn't find this course very challenging, but I did find it fun, another great jingle and lots of great content.</p>\n<p>The examples go a long way to show how much you can do with so little code, walking students through using <a href=\"http://socket.io\">socket.io</a> and <a href=\"http://redis.io\">redis</a> to build a chat client and a Q&amp;A system.</p>\n<p>Something I learned was how to use redis effectively, the course got me started and provided useful tips such as limiting size of a list to 10 items for example:</p>\n<pre class=\"lumis\"><code class=\"language-javascript\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword\">var</span> <span class=\"l-variable\">redis</span> <span class=\"l-operator\">=</span> <span class=\"l-function-builtin\">require</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string\">&quot;redis&quot;</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">,</span>\n</div><div class=\"l-line\" data-line=\"2\">    <span class=\"l-variable\">client</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">redis</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">createClient</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"3\"><span class=\"l-comment\">//... on last meeting submitted ...</span>\n</div><div class=\"l-line\" data-line=\"4\"><span class=\"l-keyword\">var</span> <span class=\"l-variable\">meeting</span> <span class=\"l-operator\">=</span> <span class=\"l-constant\">JSON</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">stringify</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">lastMeeting</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"5\">\n</div><div class=\"l-line\" data-line=\"6\"><span class=\"l-comment\">// Use LPUSH &amp; LTRIM in tandem</span>\n</div><div class=\"l-line\" data-line=\"7\"><span class=\"l-variable\">client</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">lpush</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string\">&#39;recent_meetings&#39;</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">meeting</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-keyword-function\">function</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">err</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable-parameter\">reply</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span> \n</div><div class=\"l-line\" data-line=\"8\">  <span class=\"l-variable\">client</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">ltrim</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-string\">&#39;recent_meetings&#39;</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-number\">0</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-number\">9</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-comment\">// 10 Items Max</span>\n</div><div class=\"l-line\" data-line=\"9\"><span class=\"l-punctuation-bracket\">}</span><span class=\"l-punctuation-bracket\">)</span>\n</div></code></pre>\n<p>and for good measure,\n<a href=\"devlog-a-sip-of-coffeescript\">using my new CoffeeScript skills</a>, the same thing:</p>\n<pre class=\"lumis\"><code class=\"language-plaintext\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\">redis = require(&quot;redis&quot;)\n</div><div class=\"l-line\" data-line=\"2\">client = redis.createClient()\n</div><div class=\"l-line\" data-line=\"3\">#... on last meeting submitted ...\n</div><div class=\"l-line\" data-line=\"4\">meeting = JSON.stringify lastMeeting\n</div><div class=\"l-line\" data-line=\"5\">\n</div><div class=\"l-line\" data-line=\"6\">client.lpush &#39;recent_meetings&#39;, meeting, (err, reply) -&gt;  \n</div><div class=\"l-line\" data-line=\"7\">  client.ltrim(&#39;recent_meetings&#39;, 0, 9) # 10 Items Max\n</div><div class=\"l-line\" data-line=\"8\">\n</div></code></pre>\n<p>P.S. There was a gif of Eric Allam and Gregg Pollack here that cracked me up no\nend. Code School has since shut down and taken it with them.</p>","date_published":"2014-10-07T00:00:00Z","id":"https://holsee.github.io/devlog-real-time-web-with-node-dot-js/","summary":"Devlog notes from Code School's Real-Time Web with Node.js course.","tags":["codeschool","devlog","nodejs"],"title":"Devlog: Real Time Web with Node.js","url":"https://holsee.github.io/devlog-real-time-web-with-node-dot-js/"},{"content_html":"<p>A plain &amp; simple, practical and <em>short</em> introduction to monads and how they can be put to add some elegance to your code!</p>\n<p>Do yourself a favour and take 30 mins to add some very slick refactoring tricks into your toolbelt.</p>\n<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/uTR__8RvgvM\" title=\"YouTube video\" loading=\"lazy\" allowfullscreen></iframe></div>","date_published":"2014-10-06T00:00:00Z","id":"https://holsee.github.io/refactoring-ruby-with-monads/","summary":"A short, practical introduction to monads in Ruby, via a GoGaRuCo talk.","tags":["gogaruco","ruby"],"title":"Refactoring Ruby with Monads","url":"https://holsee.github.io/refactoring-ruby-with-monads/"},{"content_html":"<img src=\"/images/certs/coursera_prp.png\" alt=\"\">\n<p><a href=\"https://www.coursera.org/course/progfun\">Coursera - Functional Programming Principles in Scala</a></p>\n<p>###About the Course</p>\n<p>This is a follow-on for the Coursera class “Principles of Functional Programming in Scala”, which so far had more than 100’000 inscriptions over two iterations of the course, with some of the highest completion rates of any massive open online course worldwide.</p>\n<p>The aim of the second course is to teach the principles of reactive programming. Reactive programming is an emerging discipline which combines concurrency and event-based and asynchronous systems. It is essential for writing any kind of web-service or distributed system and is also at the core of many high-performance concurrent systems. Reactive programming can be seen as a natural extension of higher-order functional programming to concurrent systems that deal with distributed state by coordinating and orchestrating asynchronous data streams exchanged by actors.</p>\n<p>In this course you will discover key elements for writing reactive programs in a composable way. You will find out how to apply these building blocks in the construction of event-driven systems that are scalable and resilient.</p>\n<p>The course is hands on; most units introduce short programs that serve as illustrations of important concepts and invite you to play with them, modifying and improving them. The course is complemented by a series of assignments, which are also programming projects.</p>","date_published":"2014-10-06T00:00:00Z","id":"https://holsee.github.io/devlog-principles-of-reactive-programming/","summary":"Devlog: completing Principles of Reactive Programming on Coursera.","tags":["devlog","mooc"],"title":"Devlog: Principles of Reactive Programming","url":"https://holsee.github.io/devlog-principles-of-reactive-programming/"},{"content_html":"<img src=\"/images/certs/coursera_progfun.png\" alt=\"\">\n<p><a href=\"https://www.coursera.org/course/reactive\">Coursera - Principles of Reactive Programming</a></p>\n<p>###About the Course</p>\n<p>This course introduces the cornerstones of functional programming using the Scala programming language. Functional programming has become more and more popular in recent years because it promotes code that’s safe, concise, and elegant. Furthermore, functional programming makes it easier to write parallel code for today’s and tomorrow’s multiprocessors by replacing mutable variables and loops with powerful ways to define and compose functions.</p>\n<p>Scala is a language that fuses functional and object-oriented programming in a practical package. It interoperates seamlessly with Java and its tools. Scala is now used in a rapidly increasing number of open source projects and companies. It provides the core infrastructure for sites such as Twitter, LinkedIn, Foursquare, Tumblr, and Klout.</p>\n<p>In this course you will discover the elements of the functional programming style and learn how to apply them usefully in your daily programming tasks. You will also develop a solid foundation for reasoning about functional programs, by touching upon proofs of invariants and the tracing of execution symbolically.</p>\n<p>The course is hands on; most units introduce short programs that serve as illustrations of important concepts and invite you to play with them, modifying and improving them. The course is complemented by a series of assignments, most of which are also programming projects.</p>","date_published":"2014-10-06T00:00:00Z","id":"https://holsee.github.io/devlog-functional-programming-principles-in-scala/","summary":"Devlog: completing Odersky's Functional Programming Principles in Scala on Coursera.","tags":["devlog","mooc"],"title":"Devlog: Functional Programming Principles in Scala","url":"https://holsee.github.io/devlog-functional-programming-principles-in-scala/"},{"content_html":"<p>Completed the <a href=\"https://www.codeschool.com/courses/coffeescript\">CoffeeScript course on CodeSchool</a>.</p>\n<img class=\"center\" src=\"/images/badges/coffeescript_badge.png\" alt=\"\">\n<p>I love these list comprehensions... I don't think I will be writing straight JS for a while.</p>\n<pre class=\"lumis\"><code class=\"language-plaintext\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"># Eat lunch.\n</div><div class=\"l-line\" data-line=\"2\">eat food for food in [&#39;toast&#39;, &#39;cheese&#39;, &#39;wine&#39;]\n</div><div class=\"l-line\" data-line=\"3\">\n</div><div class=\"l-line\" data-line=\"4\"># Fine five course dining.\n</div><div class=\"l-line\" data-line=\"5\">courses = [&#39;greens&#39;, &#39;caviar&#39;, &#39;truffles&#39;, &#39;roast&#39;, &#39;cake&#39;]\n</div><div class=\"l-line\" data-line=\"6\">menu i + 1, dish for dish, i in courses\n</div><div class=\"l-line\" data-line=\"7\">\n</div><div class=\"l-line\" data-line=\"8\"># Health conscious meal.\n</div><div class=\"l-line\" data-line=\"9\">foods = [&#39;broccoli&#39;, &#39;spinach&#39;, &#39;chocolate&#39;]\n</div><div class=\"l-line\" data-line=\"10\">eat food for food in foods when food isnt &#39;chocolate&#39;\n</div></code></pre>","date_published":"2014-10-06T00:00:00Z","id":"https://holsee.github.io/devlog-a-sip-of-coffeescript/","summary":"Devlog notes from Code School's A Sip of CoffeeScript course.","tags":["codeschool","coffeescript","devlog"],"title":"Devlog: A Sip of CoffeeScript","url":"https://holsee.github.io/devlog-a-sip-of-coffeescript/"},{"content_html":"<p>Came across this on kickstarter <a href=\"https://www.kickstarter.com/projects/1205042237/the-ridge-stand-a-new-edge-in-smart-design\">(here)</a>. I want one of these... so slick!  Shipping end of 2014 and taking pre-orders now.</p>\n<img src=\"/images/wants/ridge.jpg\" alt=\"\">\n<p><a href=\"http://www.theridgestand.com\">The Ridge Stand by NewBee Design</a></p>","date_published":"2014-09-23T00:00:00Z","id":"https://holsee.github.io/ridge-stand/","summary":"A Kickstarter find: The Ridge Stand. So slick.","tags":["wants"],"title":"The Ridge Stand","url":"https://holsee.github.io/ridge-stand/"},{"content_html":"<p>Earlier this year I was fortunate enough to attend <a href=\"http://reactconf.com\">ReactConf</a> in London, this was one of the sessions. In an earlier post I spoke of how you should should check out <a href=\"http://mechanical-sympathy.blogspot.co.uk\">Martin Thompson</a>'s videos as they are the proverbial a gold mine of knowledge on building fast and scalable systems.</p>\n<p>In this talk Martin defines different levels of &quot;Real Time&quot;, touching on the importance of being responsive and practical tools and advice to achieve that in the real world.</p>\n<p>The talk is broken into the following sections:</p>\n<ol>\n<li>How to Test and Measure</li>\n<li>A little bit of Theory</li>\n<li>A little bit of Practice</li>\n<li>Common Pitfalls</li>\n<li>Useful Algorithms and Techniques</li>\n</ol>\n<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/4dfk3ucthN8\" title=\"YouTube video\" loading=\"lazy\" allowfullscreen></iframe></div>\n<p>You can find the full conference playlist on youtube <a href=\"http://www.youtube.com/watch?v=ZLBH4l7dCFA&amp;list=PLSD48HvrE7-Z1stQ1vIIBumB0wK0s8llY\">here</a>...</p>\n<p>Enjoy!</p>","date_published":"2014-09-23T00:00:00Z","id":"https://holsee.github.io/responding-in-a-timely-manner/","summary":"Martin Thompson at ReactConf London on building systems that respond in a timely manner.","tags":["performance","react-2014"],"title":"Responding in a Timely Manner","url":"https://holsee.github.io/responding-in-a-timely-manner/"},{"content_html":"<p>These last few months I have been learning more than usual and in this post I talk a little about some of the things that have caught my interest.  All of this is outside of work as my day job is working on a Trading platform written in C#.</p>\n<p>Another goal of this post is to kick start my blogging again which I have completely got out of the way of doing over the last 2 or so years.</p>\n<h3 id=\"erlang--elixir\">Erlang &amp; Elixir<a href=\"#erlang--elixir\" aria-label=\"Link to heading 'Erlang &amp; Elixir'\" data-heading-content=\"Erlang &amp; Elixir\" class=\"anchor\"></a></h3>\n<p>Partially inspired by my functional programming binge and a chat I had with <a href=\"http://joearms.github.io\">Joe Armstrong</a> at <a href=\"http://reactconf.com\">ReactConf</a>; I have been getting stuck into Erlang, <a href=\"http://elixir-lang.org\">Elixir</a> and the <a href=\"https://github.com/phoenixframework/phoenix\">Phoenix web framework</a>.</p>\n<p>I feel these will play a big part in my future.  The BEAM VM is fascinating and the powerful distributed programming model via the OTP libraries is something different and interesting.  I look forward to digging into these topics on my blog in the coming months as I become more familiar with them.</p>\n<p>I am working on an 'anonymous' location broadcast server to use these technologies in anger and I have found this has helped me achieve those A-HA moments that are so important when it comes to learning something and making it stick.</p>\n<h3 id=\"nodejs\">Node.js<a href=\"#nodejs\" aria-label=\"Link to heading 'Node.js'\" data-heading-content=\"Node.js\" class=\"anchor\"></a></h3>\n<p>I've been working away on a personal project (which will be launched at outloud.io some time in the future) using node.js, express.js, postgreSQL, passport.js, mocha, chai, chai-as-promised, Q, db-migrate, node-env...</p>\n<p>I have had this idea for a while, and I got pretty excited about building it.  At the time I was looking for a good excuse to get stuck into a substantial project which was built on node.js.  Even though I have used JS for years I have learned a great deal about the node way, building stuff tis the best way to learn it is no secret.</p>\n<h3 id=\"ruby-and-rails\">Ruby and Rails<a href=\"#ruby-and-rails\" aria-label=\"Link to heading 'Ruby and Rails'\" data-heading-content=\"Ruby and Rails\" class=\"anchor\"></a></h3>\n<p>I completed a MOOC course on Coursera on <a href=\"https://www.coursera.org/course/webapplications\">Web Application Architectures</a> which used Ruby &amp; Rails recently.  Was very much entry level stuff, got through it in about 2 days and I think anybody with significant web dev experiences would find the same thing.  I guess it showed me that I knew more than I thought about Ruby and Rails and needed to focus on more advanced and newer topics.</p>\n<p>I have been slowly but surely learning Ruby for the past 4 years and I find it lots of fun.  I used to subscribe and watch the <a href=\"http://www.rubytapas.com\">Ruby Tapas</a> episodes which are brilliant, but because I wasn't using it in my day job for anything more than Chef scripts I never really got to go deep.</p>\n<p><a href=\"http://www.codewars.com/about\">Codewars.com</a> stole quite a few of my evenings, a great way to learn or get better using a language by solving a katas (with tests) then seeing how others solved the same problems in a potentially more idiomatic way.  Each solution is rated by the community on 'how smart' and 'best practice' which is a nice touch.</p>\n<p>I plan to dig into the latest version of Rails for Zombies on Code School and keep going to the <a href=\"http://belfastruby.com\">Belfast Ruby</a> meet-ups.</p>\n<h3 id=\"objective-c\">Objective-C<a href=\"#objective-c\" aria-label=\"Link to heading 'Objective-C'\" data-heading-content=\"Objective-C\" class=\"anchor\"></a></h3>\n<p>I worked as a &quot;mobile developer&quot; and have built a few apps over the last number of years in various technologies such as Obj-C, Java (Android), C# Xamarin (targeting both iOS and Android) and some PoCs using Phonegap.</p>\n<p>But I never felt I got to use Objective-C to the extent I wanted to, as the performance, the sexy runtime dispatch and the CocoaTouch libs intrigued.  A friend of mine who now works at Apple once told me the Cocoa libraries were examples of some of the nicest Object Oriented programming he had ever seen.  This has always made me want to know more.</p>\n<p>My employer sent me on an Objective-C course few months back which was nice of them since I don't even use it in my current day job.</p>\n<p>As I said, apple dev has always interested me so I have read a couple of books and completed numerous little projects.</p>\n<p>Right now I am working through the iOS Code School path and building and iOS client for the location broadcast server I spoke about in the Elixir section above.</p>\n<p>I wouldn't mind working on iOS again... which leads me into...</p>\n<h3 id=\"swift-10\">Swift 1.0<a href=\"#swift-10\" aria-label=\"Link to heading 'Swift 1.0'\" data-heading-content=\"Swift 1.0\" class=\"anchor\"></a></h3>\n<p>XCode 6.0.1 has been dropped and now I have Swift to play with :D. I didn't have my own Apple dev license so I had to wait.  I did pretty much read the iBook cover to cover in the interim.</p>\n<p>If I am to ever transition into this area, I would like to do so where I can hit the ground running so I might start to port the Objective-C location client to swift (or maybe just parts of it to get used to the interop).</p>\n<h3 id=\"data-structure--algorithms\">Data Structure &amp; Algorithms<a href=\"#data-structure--algorithms\" aria-label=\"Link to heading 'Data Structure &amp; Algorithms'\" data-heading-content=\"Data Structure &amp; Algorithms\" class=\"anchor\"></a></h3>\n<p>I always try to keep a balance of new technologies/language and CS theory.   Right now I do have a desire to spend more time reading up on Data Structures and Algorithms and their application to big problems.  This is the stuff that you learn and is timeless, and there is plenty of it to get stuck into!</p>\n<p>I was fortunate enough to do the <a href=\"http://instil.co/courses/writing-concurrent-code-with-lock-free-algorithms/\">'Writing Concurrent Code with Lock-Free Algorithms' course</a> by <a href=\"http://mechanical-sympathy.blogspot.co.uk\">Martin Thompson</a> and I got to hear him speak a couple of weeks ago at the End of Summer Bash event... if you haven't watched one of his talks please take the time to do so <a href=\"http://www.infoq.com/author/Martin-Thompson\">(now)</a>.</p>\n<p>The big take away for me is the fastest, most elegant and performant solutions, come from  using the most appropriate, hand crafted, intelligently selected data structures and algorithms to solve the problem over picking up general purpose tools.</p>\n<p>There is so much more in this area that I want to talk about but not in this post... but definitely add <a href=\"http://mechanical-sympathy.blogspot.co.uk\">Mechanical Sympathy</a> to your blog reader.</p>\n<h3 id=\"functional--reactive-programming\">Functional &amp; Reactive Programming<a href=\"#functional--reactive-programming\" aria-label=\"Link to heading 'Functional &amp; Reactive Programming'\" data-heading-content=\"Functional &amp; Reactive Programming\" class=\"anchor\"></a></h3>\n<p>I completed the <a href=\"https://www.coursera.org/course/progfun\">Functional Programming Principles in Scala</a>, a MOOC on Coursera.  Before that I completed the <a href=\"https://www.coursera.org/course/reactive\">Reactive Programming</a> course.  These were very good, humbling, challenging and rewarding.</p>\n<p>I have been using RX in .NET for years which helped a lot but I still found the Reactive course very worth while.  Both these courses use Scala and I enjoyed getting to learn it a bit better.  I liked how the reactive programming course built up concepts in layers, starting with getting the students to build a priority queue and finishing with reactive system using the <a href=\"http://akka.io\">Akka</a> actor model.</p>\n<h3 id=\"some-books-remote-rework--lean-start-up\">Some Books: Remote, Rework &amp; Lean Start-up<a href=\"#some-books-remote-rework--lean-start-up\" aria-label=\"Link to heading 'Some Books: Remote, Rework &amp; Lean Start-up'\" data-heading-content=\"Some Books: Remote, Rework &amp; Lean Start-up\" class=\"anchor\"></a></h3>\n<p>In the last 6 months I have read these books each twice (well I used audible so they were read to me twice). Wonderful books which resonated with me on so many levels.  They are informative and practical guides which are also quite inspiring.</p>\n<p>I think I really got inspired to start developing outloud.io through my desire to just start something of my own from reading <a href=\"http://theleanstartup.com\">The Lean Startup</a>.</p>\n<h3 id=\"teaching\">Teaching<a href=\"#teaching\" aria-label=\"Link to heading 'Teaching'\" data-heading-content=\"Teaching\" class=\"anchor\"></a></h3>\n<p>As a senior engineer I teach as part of my job, but recently I have been helping my buddy who is learning to program.</p>\n<p>This is a different challenge altogether, starting from the basics and helping to set the mindset and guide the conceptual thinking required.</p>\n<p>He has a degree and a load of music related qualifications and we discussed what would be the best way to start a career in software development.</p>\n<p>I have a degree in Computer Science, and I found it very useful, but not necessarily necessary... well depending on the desired job and in a sense that all that theory is accessible elsewhere.</p>\n<p>He could go back a do a Masters degree in CS, but is the cost worth it? Maybe... but to get the most out of the year (or 2) having some programming experience would be required before hand and thats where I am helping out.</p>\n<p>So, I got to thinking about what are good resources for becoming a programmer and basically ended up recommending the same resources that I use:</p>\n<ul>\n<li>Coursera &amp; MOOCs</li>\n<li>Code School</li>\n<li>Books</li>\n<li>Podcasts</li>\n</ul>\n<p>He has also found some other reasons handy, so I will be sure to link them and his new blog when he gets round to setting it up!</p>\n<h3 id=\"meteor-and-ddp\">Meteor and DDP<a href=\"#meteor-and-ddp\" aria-label=\"Link to heading 'Meteor and DDP'\" data-heading-content=\"Meteor and DDP\" class=\"anchor\"></a></h3>\n<p>I must say <a href=\"https://www.meteor.com\">meteor.js</a> and <a href=\"https://www.meteor.com/blog/2012/03/21/introducing-ddp\">Distributed Data Protocol</a> look very interesting indeed.</p>\n<p>Have watched a few <a href=\"https://www.meteor.com/screencast\">screencasts</a>, something that is well and truly on the radar now.</p>\n<h3 id=\"whats-next\">Whats next?<a href=\"#whats-next\" aria-label=\"Link to heading 'Whats next?'\" data-heading-content=\"Whats next?\" class=\"anchor\"></a></h3>\n<p>I really need to prioritize thats for sure. This is quite a lot I have going on.  It blew my mind when I put it all into Trello... just too much interesting stuff and not enough hours in the day.</p>","date_published":"2014-09-22T00:00:00Z","id":"https://holsee.github.io/devlog-what-ive-been-learning/","summary":"A devlog on months of side learning: MOOCs, functional programming, and more, outside the C# day job.","tags":["devlog"],"title":"Devlog: What I've Been Learning","url":"https://holsee.github.io/devlog-what-ive-been-learning/"},{"content_html":"<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/3jMbzGv_6tA\" title=\"YouTube video\" loading=\"lazy\" allowfullscreen></iframe></div>","date_published":"2014-08-28T00:00:00Z","id":"https://holsee.github.io/elixir-conf-2014-rise-of-the-phoenix-building-an-elixir-web-framework-by-chris-mccord/","summary":"Video: Chris McCord introduces Phoenix, an Elixir web framework, at ElixirConf 2014.","tags":["elixir","elixir-conf"],"title":"Rise of The Phoenix - Elixir Web Framework by Chris McCord","url":"https://holsee.github.io/elixir-conf-2014-rise-of-the-phoenix-building-an-elixir-web-framework-by-chris-mccord/"},{"content_html":"<div class=\"video-embed\"><iframe src=\"https://www.youtube.com/embed/5hDVftaPQwY\" title=\"YouTube video\" loading=\"lazy\" allowfullscreen></iframe></div>","date_published":"2014-08-28T00:00:00Z","id":"https://holsee.github.io/elixir-conf-2014-keynote-think-different-by-dave-thomas/","summary":"Video: Dave Thomas's ElixirConf 2014 keynote, Think Different.","tags":["elixir","elixir-conf"],"title":"Elixir Conf 2014 - Keynote: Think Different by Dave Thomas","url":"https://holsee.github.io/elixir-conf-2014-keynote-think-different-by-dave-thomas/"},{"content_html":"<p>A wonderful series of <a href=\"http://www.imore.com/debug\">Debug Podcasts</a> where the guest <a href=\"https://twitter.com/nitinganatra\">@NitinGanatra</a>, former iOS Apps Director at Apple, speaks about the evolution of the products over the years from a technical insiders perspective. Very enjoyable and eye openning 6 hours of Apple geek goodness...</p>\n<ul>\n<li><a href=\"http://www.imore.com/debug-39-nitin-ganatra-episode-i-system-7-carbon\">Nitin Ganatra episode I: System 7 to Carbon</a></li>\n<li><a href=\"http://www.imore.com/debug-40-nitin-ganatra-episode-ii-os-x-ios\">Nitin Ganatra episode II: OS X to iOS</a></li>\n<li><a href=\"http://www.imore.com/debug-41-nitin-ganatra-episode-iii-iphone-ipad%E2%80%93%E2%80%93\">Nitin Ganatra episode III: iPhone to iPad</a></li>\n</ul>","date_published":"2014-08-28T00:00:00Z","id":"https://holsee.github.io/debug-podcast-the-ganatra-trilogy/","summary":"Six hours of Apple insider history: Nitin Ganatra on the Debug podcast.","tags":["apple","podcast"],"title":"Debug Podcast: The Ganatra Trilogy","url":"https://holsee.github.io/debug-podcast-the-ganatra-trilogy/"},{"content_html":"<p>List of resources related to Algorithm Design and Analysis:</p>\n<ul>\n<li><a href=\"https://class.coursera.org/algo-004/lecture/preview\">Algorithms: Design and Analysis, Part 1</a></li>\n<li><a href=\"https://class.coursera.org/algo2-2012-001/lecture/preview\">Algorithms: Design and Analysis, Part 2</a></li>\n</ul>","date_published":"2014-07-18T00:00:00Z","id":"https://holsee.github.io/algorithms-design-and-analysis-videos/","summary":"A collected list of video resources for algorithm design and analysis.","tags":["algorithms"],"title":"Algorithms: Design and Analysis Videos","url":"https://holsee.github.io/algorithms-design-and-analysis-videos/"},{"content_html":"<p>Quicksort, also known as <i>partition-exchange sort</i>, uses these steps.</p>\n<ol>\n<li> Choose any element of the array to be the pivot.</li>\n<li> Divide all other elements (except the pivot) into two partitions.\n<br/>- All elements less than the pivot must be in the first partition.\n<br/>- All elements greater than the pivot must be in the second partition.\n</li>\n<li> Use recursion to sort both partitions.</li>\n<li> Join the first sorted partition, the pivot, and the second sorted partition.</li>\n</ol>\n<pre class=\"lumis\"><code class=\"language-c\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-type-builtin\">void</span> <span class=\"l-function\">swap</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-type-builtin\">int</span> <span class=\"l-operator\">*</span><span class=\"l-variable\">a</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-type-builtin\">int</span> <span class=\"l-operator\">*</span><span class=\"l-variable\">b</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span> \n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-type-builtin\">int</span> <span class=\"l-variable\">t</span><span class=\"l-operator\">=</span><span class=\"l-operator\">*</span><span class=\"l-variable\">a</span><span class=\"l-punctuation-delimiter\">;</span> \n</div><div class=\"l-line\" data-line=\"3\">  <span class=\"l-operator\">*</span><span class=\"l-variable\">a</span><span class=\"l-operator\">=</span><span class=\"l-operator\">*</span><span class=\"l-variable\">b</span><span class=\"l-punctuation-delimiter\">;</span> \n</div><div class=\"l-line\" data-line=\"4\">  <span class=\"l-operator\">*</span><span class=\"l-variable\">b</span><span class=\"l-operator\">=</span><span class=\"l-variable\">t</span><span class=\"l-punctuation-delimiter\">;</span> \n</div><div class=\"l-line\" data-line=\"5\"><span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"6\">\n</div><div class=\"l-line\" data-line=\"7\"><span class=\"l-type-builtin\">void</span> <span class=\"l-function\">sort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-type-builtin\">int</span> <span class=\"l-variable\">arr</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-type-builtin\">int</span> <span class=\"l-variable-parameter\">beg</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-type-builtin\">int</span> <span class=\"l-variable-parameter\">end</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"8\">  <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">end</span> <span class=\"l-operator\">&gt;</span> <span class=\"l-variable\">beg</span> <span class=\"l-operator\">+</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"9\">    <span class=\"l-type-builtin\">int</span> <span class=\"l-variable\">piv</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">arr</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">beg</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">l</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">beg</span> <span class=\"l-operator\">+</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">r</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">end</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"10\">    <span class=\"l-keyword-repeat\">while</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">l</span> <span class=\"l-operator\">&lt;</span> <span class=\"l-variable\">r</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"11\">      <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">arr</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">l</span><span class=\"l-punctuation-bracket\">]</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-variable\">piv</span><span class=\"l-punctuation-bracket\">)</span> \n</div><div class=\"l-line\" data-line=\"12\">        <span class=\"l-variable\">l</span><span class=\"l-operator\">++</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"13\">      <span class=\"l-keyword-conditional\">else</span> \n</div><div class=\"l-line\" data-line=\"14\">        <span class=\"l-function-call\">swap</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-operator\">&amp;</span><span class=\"l-variable\">arr</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">l</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-operator\">&amp;</span><span class=\"l-variable\">arr</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-operator\">--</span><span class=\"l-variable\">r</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"15\">    <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"16\">    <span class=\"l-comment\">// swapping elements within the array </span>\n</div><div class=\"l-line\" data-line=\"17\">    <span class=\"l-comment\">// to avoid the memory allocation of more arrays.</span>\n</div><div class=\"l-line\" data-line=\"18\">    <span class=\"l-function-call\">swap</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-operator\">&amp;</span><span class=\"l-variable\">arr</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-operator\">--</span><span class=\"l-variable\">l</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-operator\">&amp;</span><span class=\"l-variable\">arr</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">beg</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"19\">    <span class=\"l-function-call\">sort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">arr</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">beg</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">l</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"20\">    <span class=\"l-function-call\">sort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">arr</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">r</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">end</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"21\">  <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"22\"><span class=\"l-punctuation-bracket\">}</span>\n</div></code></pre>\n<pre class=\"lumis\"><code class=\"language-javascript\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-function\">function</span> <span class=\"l-function\">sort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">array</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable-parameter\">less</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"2\"> \n</div><div class=\"l-line\" data-line=\"3\">  <span class=\"l-keyword-function\">function</span> <span class=\"l-function\">swap</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">i</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable-parameter\">j</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span> \n</div><div class=\"l-line\" data-line=\"4\">    <span class=\"l-keyword\">var</span> <span class=\"l-variable\">t</span><span class=\"l-operator\">=</span><span class=\"l-variable\">array</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">i</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">;</span> \n</div><div class=\"l-line\" data-line=\"5\">    <span class=\"l-variable\">array</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">i</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-operator\">=</span><span class=\"l-variable\">array</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">j</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">;</span> \n</div><div class=\"l-line\" data-line=\"6\">    <span class=\"l-variable\">array</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">j</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-operator\">=</span><span class=\"l-variable\">t</span> \n</div><div class=\"l-line\" data-line=\"7\">  <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"8\"> \n</div><div class=\"l-line\" data-line=\"9\">  <span class=\"l-keyword-function\">function</span> <span class=\"l-function\">quicksort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">left</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable-parameter\">right</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"10\">    <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span> <span class=\"l-operator\">&lt;</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"11\">      <span class=\"l-keyword\">var</span> <span class=\"l-variable\">pivot</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">array</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span> <span class=\"l-operator\">+</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-operator\">&gt;&gt;</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"12\">      <span class=\"l-keyword\">var</span> <span class=\"l-variable\">left_new</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">right_new</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"13\">      <span class=\"l-keyword-repeat\">do</span> <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"14\">        <span class=\"l-keyword-repeat\">while</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-function-call\">less</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">array</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">left_new</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">pivot</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"15\">          <span class=\"l-variable\">left_new</span><span class=\"l-operator\">++</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"16\">        <span class=\"l-keyword-repeat\">while</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-function-call\">less</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">pivot</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">array</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">right_new</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"17\">          <span class=\"l-variable\">right_new</span><span class=\"l-operator\">--</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"18\">        <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left_new</span>  <span class=\"l-operator\">&lt;=</span> <span class=\"l-variable\">right_new</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"19\">          <span class=\"l-function-call\">swap</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left_new</span><span class=\"l-operator\">++</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">right_new</span><span class=\"l-operator\">--</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"20\">      <span class=\"l-punctuation-bracket\">}</span> <span class=\"l-keyword-repeat\">while</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left_new</span>  <span class=\"l-operator\">&lt;=</span> <span class=\"l-variable\">right_new</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"21\">      <span class=\"l-function-call\">quicksort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">right_new</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"22\">      <span class=\"l-function-call\">quicksort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left_new</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"23\">    <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"24\">  <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"25\"> \n</div><div class=\"l-line\" data-line=\"26\">  <span class=\"l-function-call\">quicksort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-number\">0</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">array</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span><span class=\"l-operator\">-</span><span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"27\">  <span class=\"l-keyword-return\">return</span> <span class=\"l-variable\">array</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"28\"><span class=\"l-punctuation-bracket\">}</span>\n</div></code></pre>\n<pre class=\"lumis\"><code class=\"language-javascript\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-type-builtin\">Array</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">prototype</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method\">quick_sort</span> <span class=\"l-operator\">=</span> <span class=\"l-keyword-function\">function</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"2\"><span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"3\">    <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-builtin\">this</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"4\">      <span class=\"l-keyword-return\">return</span> <span class=\"l-variable-builtin\">this</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"5\"> \n</div><div class=\"l-line\" data-line=\"6\">    <span class=\"l-keyword\">var</span> <span class=\"l-variable\">pivot</span> <span class=\"l-operator\">=</span> <span class=\"l-variable-builtin\">this</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-type-builtin\">Math</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">round</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-builtin\">this</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span> <span class=\"l-operator\">/</span> <span class=\"l-number\">2</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"7\"> \n</div><div class=\"l-line\" data-line=\"8\">    <span class=\"l-keyword-return\">return</span> <span class=\"l-variable-builtin\">this</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">filter</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-keyword-function\">function</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">x</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span> <span class=\"l-keyword-return\">return</span> <span class=\"l-variable\">x</span> <span class=\"l-operator\">&lt;</span>  <span class=\"l-variable\">pivot</span> <span class=\"l-punctuation-bracket\">}</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">quick_sort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">concat</span><span class=\"l-punctuation-bracket\">(</span>\n</div><div class=\"l-line\" data-line=\"9\">           <span class=\"l-variable-builtin\">this</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">filter</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-keyword-function\">function</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">x</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span> <span class=\"l-keyword-return\">return</span> <span class=\"l-variable\">x</span> <span class=\"l-operator\">==</span> <span class=\"l-variable\">pivot</span> <span class=\"l-punctuation-bracket\">}</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">concat</span><span class=\"l-punctuation-bracket\">(</span>\n</div><div class=\"l-line\" data-line=\"10\">           <span class=\"l-variable-builtin\">this</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">filter</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-keyword-function\">function</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">x</span><span class=\"l-punctuation-bracket\">)</span> <span class=\"l-punctuation-bracket\">{</span> <span class=\"l-keyword-return\">return</span> <span class=\"l-variable\">x</span> <span class=\"l-operator\">&gt;</span>  <span class=\"l-variable\">pivot</span> <span class=\"l-punctuation-bracket\">}</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">quick_sort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"11\"><span class=\"l-punctuation-bracket\">}</span>\n</div></code></pre>\n<pre class=\"lumis\"><code class=\"language-ruby\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-type\">class</span> <span class=\"l-type\">Array</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-keyword-function\">def</span> <span class=\"l-function\">quick_sort</span>\n</div><div class=\"l-line\" data-line=\"3\">    <span class=\"l-keyword-return\">return</span> <span class=\"l-variable-builtin\">self</span> <span class=\"l-keyword-conditional\">if</span> <span class=\"l-variable\">length</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-number\">1</span>\n</div><div class=\"l-line\" data-line=\"4\">    <span class=\"l-variable\">pivot</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">sample</span>\n</div><div class=\"l-line\" data-line=\"5\">    <span class=\"l-variable\">group</span> <span class=\"l-operator\">=</span> <span class=\"l-function-call\">group_by</span><span class=\"l-punctuation-bracket\">{</span> <span class=\"l-punctuation-bracket\">|</span><span class=\"l-variable-parameter\">x</span><span class=\"l-punctuation-bracket\">|</span> <span class=\"l-variable\">x</span> <span class=\"l-operator\">&lt;=&gt;</span> <span class=\"l-variable\">pivot</span> <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"6\">    <span class=\"l-variable\">group</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">default</span> <span class=\"l-operator\">=</span> <span class=\"l-punctuation-bracket\">[</span><span class=\"l-punctuation-bracket\">]</span>\n</div><div class=\"l-line\" data-line=\"7\">    <span class=\"l-variable\">group</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-operator\">-</span><span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">quick_sort</span> <span class=\"l-operator\">+</span> <span class=\"l-variable\">group</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-number\">0</span><span class=\"l-punctuation-bracket\">]</span> <span class=\"l-operator\">+</span> <span class=\"l-variable\">group</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">quick_sort</span>\n</div><div class=\"l-line\" data-line=\"8\">  <span class=\"l-keyword-function\">end</span>\n</div><div class=\"l-line\" data-line=\"9\"><span class=\"l-keyword\">end</span>\n</div></code></pre>\n<pre class=\"lumis\"><code class=\"language-ruby\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-type\">class</span> <span class=\"l-type\">Array</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-keyword-function\">def</span> <span class=\"l-function\">quick_sort</span>\n</div><div class=\"l-line\" data-line=\"3\">    <span class=\"l-variable\">h</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-operator\">*</span><span class=\"l-variable\">t</span> <span class=\"l-operator\">=</span> <span class=\"l-variable-builtin\">self</span>\n</div><div class=\"l-line\" data-line=\"4\">    <span class=\"l-variable\">h</span> <span class=\"l-operator\">?</span> <span class=\"l-variable\">t</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">partition</span> <span class=\"l-punctuation-bracket\">{</span> <span class=\"l-punctuation-bracket\">|</span><span class=\"l-variable-parameter\">e</span><span class=\"l-punctuation-bracket\">|</span> <span class=\"l-variable\">e</span> <span class=\"l-operator\">&lt;</span> <span class=\"l-variable\">h</span> <span class=\"l-punctuation-bracket\">}</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">inject</span> <span class=\"l-punctuation-bracket\">{</span> <span class=\"l-punctuation-bracket\">|</span><span class=\"l-variable-parameter\">l</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable-parameter\">r</span><span class=\"l-punctuation-bracket\">|</span> <span class=\"l-variable\">l</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">quick_sort</span> <span class=\"l-operator\">+</span> <span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">h</span><span class=\"l-punctuation-bracket\">]</span> <span class=\"l-operator\">+</span> <span class=\"l-variable\">r</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">quick_sort</span> <span class=\"l-punctuation-bracket\">}</span> <span class=\"l-operator\">:</span> <span class=\"l-punctuation-bracket\">[</span><span class=\"l-punctuation-bracket\">]</span>\n</div><div class=\"l-line\" data-line=\"5\">  <span class=\"l-keyword-function\">end</span>\n</div><div class=\"l-line\" data-line=\"6\"><span class=\"l-keyword\">end</span>\n</div></code></pre>","date_published":"2014-06-25T00:00:00Z","id":"https://holsee.github.io/quick-sort/","summary":"Quicksort in brief: partition-exchange steps, pivot choice, and complexity.","tags":["algorithms"],"title":"Quick Sort","url":"https://holsee.github.io/quick-sort/"},{"content_html":"<p><em>Some notes on IntroSort...</em></p>\n<blockquote>\n<p>Introsort or introspective sort is a hybrid sorting algorithm that provides both fast average performance and (asymptotically) optimal worst-case performance. It begins with quicksort and switches to heapsort when the recursion depth exceeds a level based on (the logarithm of) the number of elements being sorted. This combines the good parts of both algorithms, with practical performance comparable to quicksort on typical data sets and worst-case O(n log n) runtime due to the heap sort. Since both algorithms it uses are comparison sorts, it too is a comparison sort.</p>\n</blockquote>\n<blockquote>\n<p>Introsort was invented by David Musser in Musser (1997), in which he also introduced introselect, a hybrid selection algorithm based on quickselect (a variant of quicksort), which falls back to median of medians and thus provides worst-case linear complexity, which is optimal. Both algorithms were introduced with the purpose of providing generic algorithms for the C++ Standard Library which had both fast average performance and optimal worst-case performance, thus allowing the performance requirements to be tightened.</p>\n</blockquote>\n<p><a href=\"http://en.wikipedia.org/wiki/Introsort\">Source: Wikipedia</a> | <a href=\"http://www.cs.rpi.edu/~musser/gp/algorithms.html\">David Musser Paper 'Musser (1997)'</a></p>\n<h3 id=\"net-45-introduces-introsort-in-place-of-quicksort\">.NET 4.5 introduces Introsort in place of Quicksort<a href=\"#net-45-introduces-introsort-in-place-of-quicksort\" aria-label=\"Link to heading '.NET 4.5 introduces Introsort in place of Quicksort'\" data-heading-content=\".NET 4.5 introduces Introsort in place of Quicksort\" class=\"anchor\"></a></h3>\n<p>In the Microsoft .NET Framework 4.5, an Introsort implementation is used instead of simple QuickSort.</p>\n<p>If the sort is not successfully completed, the results are undefined.\nThis method uses the introspective sort (introsort) algorithm as follows:</p>\n<ul>\n\t<li>\n\t\tIf the partition size is fewer than 16 elements, it uses an <a href=\"http://en.wikipedia.org/wiki/Insertion_sort\">insertion sort</a> algorithm.\n\t</li>\n\t<li>\n\t\tIf the number of partitions exceeds 2 * Log<sub>N</sub>, where N is the range of the input array, it uses a <a href=\"http://en.wikipedia.org/wiki/Heapsort\">Heapsort</a> algorithm.\n\t</li>\n```csharp\nIntroSort(left, length + left - 1, 2 * IntrospectiveSortUtilities.FloorLog2(keys.Length));\n```\n\t<li>\n\t\tOtherwise, it uses a <a href=\"http://en.wikipedia.org/wiki/Quicksort\">Quicksort</a> algorithm.\n\t</li>\n</ul>\n<p>This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.</p>\n<p>For arrays that are sorted by using the Heapsort and Quicksort algorithms, in the worst case, this method is an O(<sub>n</sub> log <sub>n</sub>) operation, where <sub>n</sub> is the Length of array.</p>\n<p>You can view the full source for .NET 4.5 sorting implementation here: <a href=\"http://referencesource.microsoft.com/#mscorlib/system/array.cs#60647f6f99d677f1#references\">.NET 4.5.1 QuickSort</a></p>\n<pre class=\"lumis\"><code class=\"language-csharp\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\">\n</div><div class=\"l-line\" data-line=\"2\"><span class=\"l-keyword-modifier\">private</span> <span class=\"l-type-builtin\">void</span> <span class=\"l-function-method\">IntroSort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-type-builtin\">int</span> <span class=\"l-variable-parameter\">lo</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-type-builtin\">int</span> <span class=\"l-variable-parameter\">hi</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-type-builtin\">int</span> <span class=\"l-variable-parameter\">depthLimit</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"3\"><span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"4\">    <span class=\"l-keyword-repeat\">while</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">hi</span> <span class=\"l-operator\">&gt;</span> <span class=\"l-variable\">lo</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"5\">    <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"6\">        <span class=\"l-type-builtin\">int</span> <span class=\"l-variable\">partitionSize</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">hi</span> <span class=\"l-operator\">-</span> <span class=\"l-variable\">lo</span> <span class=\"l-operator\">+</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"7\">        <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">partitionSize</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-variable\">IntrospectiveSortUtilities</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">IntrosortSizeThreshold</span> <span class=\"l-comment\">/* 32 */</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"8\">        <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"9\">            <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">partitionSize</span> <span class=\"l-operator\">==</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"10\">            <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"11\">                <span class=\"l-keyword-return\">return</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"12\">            <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"13\">            <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">partitionSize</span> <span class=\"l-operator\">==</span> <span class=\"l-number\">2</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"14\">            <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"15\">                <span class=\"l-function-method-call\">SwapIfGreaterWithItems</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">lo</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"16\">                <span class=\"l-keyword-return\">return</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"17\">            <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"18\">            <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">partitionSize</span> <span class=\"l-operator\">==</span> <span class=\"l-number\">3</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"19\">            <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"20\">                <span class=\"l-function-method-call\">SwapIfGreaterWithItems</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">lo</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-operator\">-</span><span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"21\">                <span class=\"l-function-method-call\">SwapIfGreaterWithItems</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">lo</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"22\">                <span class=\"l-function-method-call\">SwapIfGreaterWithItems</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">hi</span><span class=\"l-operator\">-</span><span class=\"l-number\">1</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"23\">                <span class=\"l-keyword-return\">return</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"24\">            <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"25\">\n</div><div class=\"l-line\" data-line=\"26\">            <span class=\"l-function-method-call\">InsertionSort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">lo</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"27\">            <span class=\"l-keyword-return\">return</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"28\">        <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"29\">\n</div><div class=\"l-line\" data-line=\"30\">        <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">depthLimit</span> <span class=\"l-operator\">==</span> <span class=\"l-number\">0</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"31\">        <span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"32\">            <span class=\"l-function-method-call\">Heapsort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">lo</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"33\">            <span class=\"l-keyword-return\">return</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"34\">        <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"35\">        <span class=\"l-variable\">depthLimit</span><span class=\"l-operator\">--</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"36\">\n</div><div class=\"l-line\" data-line=\"37\">        <span class=\"l-type-builtin\">int</span> <span class=\"l-variable\">p</span> <span class=\"l-operator\">=</span> <span class=\"l-function-method-call\">PickPivotAndPartition</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">lo</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"38\">        <span class=\"l-function-method-call\">IntroSort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">p</span> <span class=\"l-operator\">+</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">hi</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">depthLimit</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"39\">        <span class=\"l-variable\">hi</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">p</span> <span class=\"l-operator\">-</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"40\">    <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"41\"><span class=\"l-punctuation-bracket\">}</span>\n</div></code></pre>\n<p>You can view the latest (MIT licensed) Mono implemention on Github: <a href=\"https://github.com/mono/mono/blob/master/mcs/class/Mono.C5/C5/Sorting.cs\">Mono.C5 Sorting.cs</a></p>","date_published":"2014-06-25T00:00:00Z","id":"https://holsee.github.io/introsort/","summary":"Notes on introsort, the quicksort/heapsort/insertion-sort hybrid real standard libraries use.","tags":["algorithms"],"title":"Introsort","url":"https://holsee.github.io/introsort/"},{"content_html":"<p>You start with an unordered sequence.\nYou create N empty queues.\nYou loop over every item to be sorted.\nOn each loop iteration, you look at the last element in the key.\nYou move that item into the end of the queue which corresponds to that element.\nWhen you are finished looping you concatenate all the queues together into another sequence.\nYou then reapply the procedure described but look at the second last element in the key.\nYou keep doing this until you have looped over every key.\nWhen you complete this process the resulting sequence will be sorted as described above.</p>\n<p>Let n<sub>i</sub> be the number of items in the sequence to be sorted. N is number of integers that each key element can take. Let n<sub>k</sub> be the number of keys in each item.</p>\n<p>The total time to sort the sequence is thus O(n<sub>k</sub>(n<sub>i</sub> + N)).</p>\n<pre class=\"lumis\"><code class=\"language-javascript\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-function\">function</span> <span class=\"l-function\">mergesort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">list</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-keyword-conditional\">if</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"3\">    <span class=\"l-keyword-return\">return</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"4\"> \n</div><div class=\"l-line\" data-line=\"5\">  <span class=\"l-keyword\">var</span> <span class=\"l-variable\">mid</span> <span class=\"l-operator\">=</span> <span class=\"l-type-builtin\">Math</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">floor</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span> <span class=\"l-operator\">/</span> <span class=\"l-number\">2</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">,</span>\n</div><div class=\"l-line\" data-line=\"6\">    <span class=\"l-variable\">left</span>  <span class=\"l-operator\">=</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">slice</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-number\">0</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">mid</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">,</span>\n</div><div class=\"l-line\" data-line=\"7\">    <span class=\"l-variable\">right</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">slice</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">mid</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"8\"> \n</div><div class=\"l-line\" data-line=\"9\">  <span class=\"l-keyword-return\">return</span> <span class=\"l-function-call\">merge</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-function-call\">mergesort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-function-call\">mergesort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"10\"><span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"11\"> \n</div><div class=\"l-line\" data-line=\"12\"><span class=\"l-keyword-function\">function</span> <span class=\"l-function\">merge</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">left</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable-parameter\">right</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"13\">  <span class=\"l-keyword\">var</span> <span class=\"l-variable\">sorted</span> <span class=\"l-operator\">=</span> <span class=\"l-punctuation-bracket\">[</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"14\">  <span class=\"l-keyword-repeat\">while</span> <span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span> <span class=\"l-operator\">&amp;&amp;</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span> <span class=\"l-operator\">&gt;</span> <span class=\"l-number\">0</span> <span class=\"l-operator\">&amp;&amp;</span> <span class=\"l-variable\">right</span> <span class=\"l-operator\">&amp;&amp;</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-variable-member\">length</span> <span class=\"l-operator\">&gt;</span> <span class=\"l-number\">0</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">{</span>\n</div><div class=\"l-line\" data-line=\"15\">    <span class=\"l-keyword\">var</span> <span class=\"l-variable\">b</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-number\">0</span><span class=\"l-punctuation-bracket\">]</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-number\">0</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"16\">    <span class=\"l-variable\">sorted</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">push</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">b</span><span class=\"l-keyword-conditional-ternary\">?</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-number\">0</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-keyword-conditional-ternary\">:</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-number\">0</span><span class=\"l-punctuation-bracket\">]</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"17\">    <span class=\"l-comment\">// remove the element which was added to the sorted array</span>\n</div><div class=\"l-line\" data-line=\"18\">    <span class=\"l-variable\">b</span><span class=\"l-keyword-conditional-ternary\">?</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">splice</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-number\">0</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-keyword-conditional-ternary\">:</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">splice</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-number\">0</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-number\">1</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"19\">  <span class=\"l-punctuation-bracket\">}</span>\n</div><div class=\"l-line\" data-line=\"20\">  <span class=\"l-keyword-return\">return</span> <span class=\"l-variable\">sorted</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-method-call\">concat</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">;</span>\n</div><div class=\"l-line\" data-line=\"21\"><span class=\"l-punctuation-bracket\">}</span>\n</div></code></pre>\n<pre class=\"lumis\"><code class=\"language-ruby\" translate=\"no\" tabindex=\"0\"><div class=\"l-line\" data-line=\"1\"><span class=\"l-keyword-function\">def</span> <span class=\"l-function\">mergesort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">list</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"2\">  <span class=\"l-keyword-return\">return</span> <span class=\"l-variable\">list</span> <span class=\"l-keyword-conditional\">if</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">size</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-number\">1</span>\n</div><div class=\"l-line\" data-line=\"3\">  <span class=\"l-variable\">mid</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">size</span> <span class=\"l-operator\">/</span> <span class=\"l-number\">2</span>\n</div><div class=\"l-line\" data-line=\"4\">  <span class=\"l-variable\">left</span>  <span class=\"l-operator\">=</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-number\">0</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">mid</span><span class=\"l-punctuation-bracket\">]</span>\n</div><div class=\"l-line\" data-line=\"5\">  <span class=\"l-variable\">right</span> <span class=\"l-operator\">=</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-bracket\">[</span><span class=\"l-variable\">mid</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable\">list</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">size</span><span class=\"l-operator\">-</span><span class=\"l-variable\">mid</span><span class=\"l-punctuation-bracket\">]</span>\n</div><div class=\"l-line\" data-line=\"6\">  <span class=\"l-function-call\">merge</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-function-call\">mergesort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-function-call\">mergesort</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"7\"><span class=\"l-keyword-function\">end</span>\n</div><div class=\"l-line\" data-line=\"8\"> \n</div><div class=\"l-line\" data-line=\"9\"><span class=\"l-keyword-function\">def</span> <span class=\"l-function\">merge</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable-parameter\">left</span><span class=\"l-punctuation-delimiter\">,</span> <span class=\"l-variable-parameter\">right</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"10\">  <span class=\"l-variable\">sorted</span> <span class=\"l-operator\">=</span> <span class=\"l-punctuation-bracket\">[</span><span class=\"l-punctuation-bracket\">]</span>\n</div><div class=\"l-line\" data-line=\"11\">  <span class=\"l-keyword-repeat\">until</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">empty?</span> <span class=\"l-keyword-operator\">or</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">empty?</span>\n</div><div class=\"l-line\" data-line=\"12\">    <span class=\"l-keyword-conditional\">if</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">first</span> <span class=\"l-operator\">&lt;=</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">first</span>\n</div><div class=\"l-line\" data-line=\"13\">      <span class=\"l-variable\">sorted</span> <span class=\"l-operator\">&lt;&lt;</span> <span class=\"l-variable\">left</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">shift</span>\n</div><div class=\"l-line\" data-line=\"14\">    <span class=\"l-keyword-conditional\">else</span>\n</div><div class=\"l-line\" data-line=\"15\">      <span class=\"l-variable\">sorted</span> <span class=\"l-operator\">&lt;&lt;</span> <span class=\"l-variable\">right</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">shift</span>\n</div><div class=\"l-line\" data-line=\"16\">    <span class=\"l-keyword-conditional\">end</span>\n</div><div class=\"l-line\" data-line=\"17\">  <span class=\"l-keyword\">end</span>\n</div><div class=\"l-line\" data-line=\"18\">  <span class=\"l-variable\">sorted</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">concat</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">left</span><span class=\"l-punctuation-bracket\">)</span><span class=\"l-punctuation-delimiter\">.</span><span class=\"l-function-call\">concat</span><span class=\"l-punctuation-bracket\">(</span><span class=\"l-variable\">right</span><span class=\"l-punctuation-bracket\">)</span>\n</div><div class=\"l-line\" data-line=\"19\"><span class=\"l-keyword-function\">end</span>\n</div></code></pre>","date_published":"2014-06-23T00:00:00Z","id":"https://holsee.github.io/merge-sort/","summary":"Notes on merge sort: the queue-based mental model, the steps, and the complexity.","tags":["algorithms"],"title":"Merge Sort","url":"https://holsee.github.io/merge-sort/"}],"title":"holsee","version":"https://jsonfeed.org/version/1.1"}