{"@attributes":{"version":"2.0"},"channel":{"title":"Roberto Selbach","link":"https:\/\/rselbach.com\/","description":"Recent content on Roberto Selbach","generator":"Hugo","language":"en-US","lastBuildDate":"Wed, 01 Jul 2026 18:51:58 -0400","item":[{"title":"\u8c22\u8c22\u4f60\uff0c\u4e2d\u56fd\uff01 (Thank you, China!)","link":"https:\/\/rselbach.com\/blog\/2026-07-01-thank-you-china\/","pubDate":"Wed, 01 Jul 2026 18:51:58 -0400","guid":"https:\/\/rselbach.com\/blog\/2026-07-01-thank-you-china\/","description":"<p>First things first: Happy Canada Day, everyone! Bonne f\u00eate du Canada, tout le monde !<\/p>\n<p>Yes, I know. Starting a post that celebrates Canada Day with a giant title thanking China might feel a bit ironic, if not entirely contradictory.\nBut stick with me for a minute. Because if you are a Canadian working in tech right now, navigating a world where our longest-standing friendship\nand alliance has ruptured into open hostility from the US government, you should be thanking them too.<\/p>\n<p>For decades, the Canadian tech ecosystem operated under an unspoken assumption: we were fundamentally part of the same digital backyard as Silicon Valley.\nWe relied on the same infrastructure, trusted the same partners, and assumed that a shared border meant shared access to the future of technology.<\/p>\n<p>The rise of large language model regulation in the US has shattered that illusion. As LLMs became the foundational infrastructure for the next generation\nof software, the narrative shifted toward a suffocating, centralized reality. Suddenly, it looked like access to &ldquo;intelligence&rdquo; would be controlled by a couple\nof trillion-dollar American tech giants, operating under the tight regulatory grip and arbitrary &ldquo;national security mandates&rdquo; of an increasingly\nauthoritarian and hostile US government. That&rsquo;s&hellip; not great.<\/p>\n<p>The message to us and to the rest of the world was clear: if you want to build next-gen software, you have to rent it from them and you have to behave or they&rsquo;ll turn off the tap.<\/p>\n<p>When the US government forced Anthropic to turn Fable and Mythos off a couple of weeks ago, it hit me how all of a sudden things could turn. And that&rsquo;s when\nI starting thinking about how different things could have been had China not chosen the path of opensource.<\/p>\n<h2 id=\"the-open-source-weapon\">The Open-Source Weapon<\/h2>\n<p>Had Chinese AI labs followed the American playbook, the trap would have snapped shut.<\/p>\n<p>When the US president put measures to prevent chips from being sold to China, they inadvertently scored one of the biggest own goals ever, because faced with severe hardware\nrestrictions and intense domestic competition, Chinese companies and research labs like Alibaba, Z.AI and Moonshot took a radically different path. While American companies felt safe\nin closing their gates, shifting from open research to aggressive, closed-source monopolies, the Chinese chose to weaponize open weights.<\/p>\n<p>They realized the fastest way to bypass the American monopoly was to simply give the models away.<\/p>\n<p>And they didn&rsquo;t just dump mid-tier toys. Their models are improving at a much higher pace compared to the American ones and have pretty much caught up in practical terms. They&rsquo;ve\nconsistently commoditized the technology that the US would love to leverage against us.<\/p>\n<h1 id=\"autonomy-through-proliferation\">Autonomy through Proliferation<\/h1>\n<p>There is a profound irony here. China has long been known for its heavy domestic internet censorship and state oversight. Yet, they&rsquo;ve inadvertently become the world&rsquo;s greatest\nguarantor of decentralized, open-source AI infra.<\/p>\n<p>By flooding the ecosystem with high-quality opensource models, they&rsquo;ve made it functionally impossible for an authoritarian US government to lock down the future of software development.<\/p>\n<p>Once a model like <a href=\"https:\/\/huggingface.co\/zai-org\/GLM-5.2\">GLM 5.2<\/a> or <a href=\"https:\/\/huggingface.co\/moonshotai\/Kimi-K2.7-Code\">Kimi K2.7<\/a> are on <a href=\"https:\/\/huggingface.co\/\">Hugging Face<\/a>, downloaded, and running locally on hardware right here in Canada, the gates cannot be closed. It belongs to the global developer community.\nBetter yet, it can be fine-tuned, quantized, and run entirely offline.<\/p>\n<p>This isn&rsquo;t about blind defence of the Chinese government or anything. It&rsquo;s a pragmatic look at power dynamics: hegemony is the absolute enemy of innovation, and proliferation is the ultimate antidote to bullying.<\/p>\n<p>When global superpowers compete by releasing open infrastructure, developers win. In fact, the aggressive opensourcing of Chinese frontier models may threaten the duopoly of Anthropic and OpenAI. OpenAI has already postponed their IPO, as companies start having trouble reconciling the costs of inference charged by these labs with whatever gains in productive they&rsquo;re seeing from them.<\/p>\n<p>Because Chinese labs chose to open up their models, the dream of an API-locked AI dystopia where Canada and other &ldquo;middle powers&rdquo; can be frozen out at the border is dead. We have choices, which means we have autonomy.<\/p>\n<p>So, to the engineers and teams pushing the boundaries of open weights on the other side of the world, from a developer celebrating a complicated Canada Day: <strong>\u8c22\u8c22\u4f60\uff0c\u4e2d\u56fd\u3002<\/strong> You kept the future of AI open when our neighbours tried to lock it away.<\/p>"},{"title":"Updated LLM Coding Workflow","link":"https:\/\/rselbach.com\/blog\/2026-05-20-update-llm-workflow\/","pubDate":"Wed, 20 May 2026 18:51:58 -0400","guid":"https:\/\/rselbach.com\/blog\/2026-05-20-update-llm-workflow\/","description":"<p>Back in January <a href=\"https:\/\/rselbach.com\/llms-are-tools-not-replacements\/\">I posted about how I view LLMs<\/a>, which included my workflow of doing LLM-assisted coding. To summarize, my workflow was:<\/p>\n<ol>\n<li>Reverse rubber-ducking<\/li>\n<li>Planning and writing a spec file<\/li>\n<li>Implement each phase of the plan, one by one<\/li>\n<li>Validation and commit<\/li>\n<\/ol>\n<p>I can say lots have changed since January. For one, models are significantly better and more reliable. As well, I feel like I&rsquo;ve got better at steering them. If I look at the above list by itself, without details, it doesn&rsquo;t feel like things changed so much, but look closer and it&rsquo;s a whole new world. My current workflow is an evolution of the above.<\/p>\n<p>Before continuing, let me make something clear: this is my <em>professional<\/em> workflow. It&rsquo;s what I use to write production code on cloud services.<\/p>\n<h2 id=\"phase-0-reverse-rubber-ducking\">Phase 0: Reverse Rubber-ducking<\/h2>\n<p>I still have this, but I no longer use a chat interface. I start directly with an agent (almost always <a href=\"https:\/\/opencode.ai\">OpenCode<\/a>) and I now first get the agent to engage with the code before anything else. Let&rsquo;s say I need to make a change to the flux capacitors, so I go and tell the agent what I think happens:<\/p>\n<blockquote>\n<p>This is cloud-service-foo and it handles requests to create farbelizer connectors. I believe it then nimbolizes the farbelizers before sending them to cloud-service-bar that processes them through the flux capacitors. Check what the actual flow is and summarize it for me.<\/p>\n<\/blockquote>\n<p>Most of the times &ndash; though not always &ndash; I know exactly how the flow works, but I do this to sort of prime the LLM for discussing what I want to change. I just found that it tends to work well for me; better then just telling it directly what I want to change.<\/p>\n<p>An indirect effect of doing this is that sometimes it will tell me something that doesn&rsquo;t meet my understanding, so I ask details to figure out if it&rsquo;s really something I missed or just something the LLM got wrong.<\/p>\n<p>When I know the LLM has the context, I will say something like<\/p>\n<blockquote>\n<p>I have an issue where if the farbelizer connector starts with &ldquo;foo&rdquo;, then the flux capacitors should suppress the harmonic back-feeding before it reaches the primary gimbal housing.<\/p>\n<\/blockquote>\n<p>I often add a little more about what the actual goal is, but it&rsquo;s something like this. This usually causes the LLM to tell me what it thinks should be done. It will sometimes ask a question or two, but eventually it will give me a solution. Many times the solution is one I know I don&rsquo;t want due to some constraint and I will tell it. Sometimes I steer it a bit more and tell it what I think we should do.<\/p>\n<p>And then when I&rsquo;m happy, I&rsquo;ll say:<\/p>\n<blockquote>\n<p>Plan a series of independent PRs to implement this. List which ones can be done in parallel vs linearly<\/p>\n<\/blockquote>\n<p>That&rsquo;s it. That&rsquo;s the entire plan phase now. I no longer need a spec file.<\/p>\n<h2 id=\"phase-1-implementation\">Phase 1: Implementation<\/h2>\n<p>Given the list of PRs, I will ask it to implement them either a few in parallel or, if there&rsquo;s a dependency, one by one. I also now let the LLM agent commit its changes. (if they were in parallel, I also let it push the changes.)<\/p>\n<p>Again, that&rsquo;s it?<\/p>\n<h2 id=\"phase-2-validation\">Phase 2: Validation<\/h2>\n<p>I then test the work locally, I still insist on doing that because I don&rsquo;t want to cause a SEV. I&rsquo;ll then push the branches and review the diffs myself in GitHub before asking for others to review: I want to avoid wasting people&rsquo;s time.<\/p>\n<h3 id=\"you-still-have-to-watch-them\">You still have to watch them<\/h3>\n<p>I had an interesting interaction with GPT 5.5 a few weeks ago, where it wrote code that was akin to this:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">attempt<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#ae81ff\">0<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">attempt<\/span><span style=\"color:#f92672\">++<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">attempt<\/span> &gt; <span style=\"color:#a6e22e\">maxAttempts<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">errTooManyAttemps<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t}\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">fetchData<\/span>(<span style=\"color:#a6e22e\">ctx<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#66d9ef\">nil<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">switch<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">case<\/span> <span style=\"color:#a6e22e\">errors<\/span>.<span style=\"color:#a6e22e\">Is<\/span>(<span style=\"color:#a6e22e\">err<\/span>, <span style=\"color:#a6e22e\">errTimeout<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Println<\/span>(<span style=\"color:#e6db74\">&#34;Warning: Timeout occurred. Retrying...&#34;<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">case<\/span> <span style=\"color:#a6e22e\">errors<\/span>.<span style=\"color:#a6e22e\">Is<\/span>(<span style=\"color:#a6e22e\">err<\/span>, <span style=\"color:#a6e22e\">context<\/span>.<span style=\"color:#a6e22e\">Canceled<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Println<\/span>(<span style=\"color:#e6db74\">&#34; -&gt; Context was canceled. Exiting...&#34;<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">default<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">err<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t}\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#a6e22e\">time<\/span>.<span style=\"color:#a6e22e\">Sleep<\/span>(<span style=\"color:#ae81ff\">100<\/span> <span style=\"color:#f92672\">*<\/span> <span style=\"color:#a6e22e\">time<\/span>.<span style=\"color:#a6e22e\">Millisecond<\/span>) \n<\/span><\/span><span style=\"display:flex;\"><span>\t}\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>When I saw that, I immediately knew it didn&rsquo;t look right, so I asked the agent about the case with the <code>context.Canceled<\/code> and it happily explained to me that it would log the error and then return with <code>default:<\/code>. I said, no, it won&rsquo;t, that&rsquo;s not how Go switches work. And it insisted! &ldquo;I understand your confusion, but because there is no <code>break<\/code> statement, the code will simply fall through the next case.&rdquo;<\/p>\n<p>No, it forking won&rsquo;t! So I told it to prove it by writing a test that returned a context canceled. It did, caught the infinite loop and conceded.<\/p>\n<p>My point? They can still make mistakes. I have to check them.<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>That said, I will concede that the LLMs are so much better now and that these errors are getting more and more rare. My flow is much quicker than before. I still review code like a caveman, I still make sure the LLM gets what I want it to do. But I basically killed the entire &ldquo;plan&rdquo; step. It&rsquo;s just not needed. And I almost never write code by hand.<\/p>"},{"title":"Your App Subscription Is Now My Weekend Project","link":"https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/","pubDate":"Sun, 18 Jan 2026 20:13:59 +0000","guid":"https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/","description":"<p>I pay for a lot of small apps. One of them was <a href=\"https:\/\/wisprflow.ai\">Wispr Flow<\/a> for dictation. That&rsquo;s $14 CAD\/month that I was paying until I had a few lazy days visiting my mother. And then on the afternoon of New Year&rsquo;s Day, I vibecoded <a href=\"https:\/\/github.com\/rselbach\/jabber\">Jabber<\/a>.<\/p>\n<p>Now, don&rsquo;t get me wrong, Jabber is not &ldquo;production quality.&rdquo; I would never sell it as a product or even recommend it to other people, but it does what <em>I<\/em> needed from Wispr Flow, and it does <em>exactly<\/em> the way I want it to. For free.<\/p>\n<p>At work, I&rsquo;m often asked to make small videos showing some support agent how something works, or sharing some knowledge with new team members, or just a regular demo of something. In the past, I used to use <a href=\"https:\/\/loom.com\">Loom<\/a>, which costs $15\/month. So after creating Jabber, I got excited and vibecoded <a href=\"https:\/\/github.com\/rselbach\/reel\">Reel<\/a>.<\/p>\n<p>Reel does <em>exactly<\/em> what I wanted Loom to do: I can record my camera, I can move it around, and I get to trim the video after it&rsquo;s done (I don&rsquo;t remember being able to do that with Loom).<\/p>\n<p>Then just yesterday, a friend of mine was telling me how he got tired of paying for <a href=\"https:\/\/typora.io\">Typora<\/a> and decided to vibecode his own Markdown editor. And <em>that<\/em> gave me the idea of creating an editor for my blog.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_78d5019e463792fd.webp 320w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_c43c6101a7a73158.webp 480w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_bcf469546854ae82.webp 640w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_5e753896967024b0.webp 800w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_6ed8313eb1c9d29e.webp 960w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_386a480e1a7889dd.webp 1100w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_2090bdb842f89417.webp 1280w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_be11856be330c4b8.webp 1600w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_48867d25b3635d9d.webp 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z.png\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"2484\" height=\"1458\" srcset=\"https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_478d7be13c06585c.png 320w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_3bbb1b9395c99769.png 480w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_689f99c891599ed3.png 640w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_94e5c0e2ce8f3565.png 800w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_93c0ec5ddcee15f8.png 960w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_4acaf30c0475fa51.png 1100w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_5d28c9253e530c8a.png 1280w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_8b4b8e96b6fe762a.png 1600w, https:\/\/rselbach.com\/your-sub-is-now-my-weekend-project\/image-2026-01-18T21-04-02Z_hu_63288fb36f989a69.png 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>That&rsquo;s <a href=\"https:\/\/github.com\/rselbach\/hugora\">Hugora<\/a>! Yes, horrible name, but who cares? It&rsquo;s just for me. I get to edit my <a href=\"https:\/\/gohugo.io\">Hugo<\/a> blog <em>just the way I like<\/em>. It even shows my site theme.<\/p>\n<p>You see the pattern here?<\/p>\n<p>All of these $10\/month apps are suddenly a weekend project for me. I&rsquo;m an engineer, but I have never written a single macOS application. I&rsquo;ve never even read Swift code in my life, and yet, I now can get an app up and running in a couple of hours. This is <em>crazy<\/em>.<\/p>\n<p>Last year, a <a href=\"https:\/\/medium.com\/@stephanemboghossian\/software-is-becoming-a-commodity-273741174d04\">Medium post predicted<\/a>:<\/p>\n<blockquote>\n<p>Most standalone apps will be \u201cfeatures, not products\u201d in the long run \u2014 easy to copy and bundle into larger offerings.<\/p>\n<\/blockquote>\n<p>And I think we&rsquo;re there. I don&rsquo;t know what that means for the future of our industry, but it does seem like a big shift.<\/p>\n<p>I&rsquo;m still skeptical of vibecoding in general. As I mentioned above, I would not trust my vibecoding enough to make these into products. If something goes wrong, <em>I<\/em> don&rsquo;t know how to fix it. Maybe my LLM friends can, but I don&rsquo;t know. But vibecoding is 100% viable for personal stuff like this: <strong>we now have apps on demand.<\/strong><\/p>"},{"title":"Being Specific when Pairing with Bots","link":"https:\/\/rselbach.com\/being-specific-when-pairing-with-bots\/","pubDate":"Wed, 14 Jan 2026 13:12:00 -0500","guid":"https:\/\/rselbach.com\/being-specific-when-pairing-with-bots\/","description":"<p>A couple of days ago I posted about <a href=\"https:\/\/rselbach.com\/llms-are-tools-not-replacements\/\">my workflow<\/a> and I made light fun of something I do:<\/p>\n<blockquote>\n<p>I also give it context to save time. The agents nowadays are very smart and can find their way, but I can shortcut that by giving it hints \u201cin <code>internal\/foo\/foo.go<\/code> there\u2019s a function called <code>DoFoo()<\/code> and it does this and that and I want it to do that other thing before that\u201d or whatever. Less tokens, faster iteration. <strong>This is probably astrology for nerds, pure superstition at this point, but I still do it.<\/strong><\/p>\n<\/blockquote>\n<p>Turns out, maybe it&rsquo;s not really astrology for nerds? Today, <a href=\"https:\/\/x.com\/sqs\/status\/2011432209165799547?s=20\">Quinn Slack shared<\/a> an article about <a href=\"https:\/\/ampcode.com\/how-to-pair-with-an-agent\">How To Pair with an Agent<\/a> and in it, the author says <em>&ldquo;The more you can specify, the better&rdquo;<\/em> and gives this example of a good, specified prompt:<\/p>\n<blockquote>\n<p><strong>Specified prompt:<\/strong><\/p>\n<blockquote>\n<p>Build a new API endpoint for user notifications. Follow the pattern in <code>src\/api\/messages.ts<\/code> as your reference. Run the API tests after each step. Don&rsquo;t move on until they pass.<\/p>\n<\/blockquote>\n<p>You gave it a reference to follow and a way to check its own work. Now you can step away. Let the agent iterate until the tests pass.<\/p>\n<\/blockquote>\n<p>So maybe it&rsquo;s not astrology for nerds, but a good practice? I always felt like it gave me better results, but I wasn&rsquo;t 100% sure if it wasn&rsquo;t just a superstition. Nice to see it&rsquo;s probably not.<\/p>"},{"title":"Thoughts on Amp's ad-supported business model","link":"https:\/\/rselbach.com\/amps-ad-supported-business-model\/","pubDate":"Tue, 13 Jan 2026 14:19:23 +0000","guid":"https:\/\/rselbach.com\/amps-ad-supported-business-model\/","description":"<p>I&rsquo;m agent-agnostic, in which I don&rsquo;t use only one. I keep changing from time to time. <a href=\"https:\/\/rselbach.com\/llms-are-tools-not-replacements\/\">My earliest forays into agentic programing<\/a> were with <a href=\"https:\/\/claude.ai\/claude-code\">Claude Code<\/a>, which was then and still is probably the gold standard. But since then I&rsquo;ve tried quite a few: <a href=\"https:\/\/chatgpt.com\/features\/codex\/\">Codex CLI<\/a> (good models, barebones agent), <a href=\"https:\/\/factory.ai\">Droid<\/a> (not a fan), <a href=\"https:\/\/opencode.ai\">OpenCode<\/a> (big fan!), and <a href=\"https:\/\/ampcode.com\">Amp<\/a>.<\/p>\n<p>I&rsquo;ve been using Amp for a while, but only from time to time to see its evolution. With the move to Opus 4.5, I found that Amp has become very capable and I started using it more and more until it became my go-to agent.<\/p>\n<p>The one downside of Amp is that it can get expensive. Since it&rsquo;s not tied to any of the labs, it needs to charge API pricing, which can get expensive if you use it a lot, <a href=\"https:\/\/x.com\/thdxr\/status\/2002076272248361063\">though maybe less than most people think<\/a>.<\/p>\n<p>But it&rsquo;s undeniable that there is a psychological impact at seeing money constantly being drawn as you use, even if at the end of the day you&rsquo;d spend the same as with a subscription.<\/p>\n<p>These are challenges the Amp people have been working on for a while. Then not that long ago, they came up with a first attempt: an ad-supported free tier. You could use Amp up to $10 worth of API per day as long as you agreed to see ads on your agent.<\/p>\n<p>To be clear, <em>ads are optional<\/em>. You only see the ads if you choose to and if you do, you get $10 worth of inference per day, using some cheaper models. This is how the ads appear:<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_9673fff176ee1d6a.webp 320w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_14c12858541a97e.webp 480w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_48565f2511c82ae.webp 640w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_c5ea9ffc0256a587.webp 800w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_632f3bd0e076edd9.webp 960w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_ace846ed036a1847.webp 1100w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_6ca448b9c43f90fa.webp 1280w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_1aa1282a28039c26.webp 1600w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_a2f1316732abdb8c.webp 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp.png\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"2836\" height=\"1988\" srcset=\"https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_abea963ca0a5c6a4.png 320w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_1ef74a2160024bb1.png 480w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_94b9271bcfd9b3a.png 640w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_c859162e5922d6ba.png 800w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_54eb671290100749.png 960w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_1c171955b1ced642.png 1100w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_238a0ec6367568b0.png 1280w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_a1d8fa7fd82874e5.png 1600w, https:\/\/rselbach.com\/amps-ad-supported-business-model\/amp_hu_f73ddc34e776dec1.png 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>Personally, I find them unobstructive, but opinions may vary. Now, you may notice that I emphasized the fact that these ads are options. The reason why I did so is that it appears that the idea of ads hits a nerve in some people. Ever since their free tier came out, I&rsquo;ve seen several tweets of people announcing their refusal to ever try Amp because they don&rsquo;t want ads.<\/p>\n<p>Now Amp came up with a next step, whereas paying customers can also enable Amp Free and get those $10 a day of inference and their balance will only be drawn from once they exhaust their free allowance. That&rsquo;s the equivalent of $300 a month of free inference. Not only that, but you can use that free allowance with Opus 4.5.<\/p>\n<p>I understand the aversion to ads. I share it. But $300\/month is an incredible value to ignore. So I decided to enabled Amp Free and use Amp exclusively this month to see how much I will have\nspent by the end of the month. My suspicion is that I&rsquo;ll spend less than my Claude Max subscription.<\/p>\n<p>But something that I think is very important to remember is that there&rsquo;s a whole world of engineers outside of the developed world. For a developer in, say, South America, the cost of a\nClaude or Codex subscription is prohibitive. This is keeping a whole world of engineers out of the LLM revolution. Amp&rsquo;s approach offers a way for them to have access to\npremium models they otherwise wouldn&rsquo;t have access to.<\/p>"},{"title":"LLMs Are Tools, Not Replacements","link":"https:\/\/rselbach.com\/llms-are-tools-not-replacements\/","pubDate":"Mon, 12 Jan 2026 20:19:23 +0000","guid":"https:\/\/rselbach.com\/llms-are-tools-not-replacements\/","description":"<p>I\u2019ve been meaning to write this post for a bit, but never found the right time. I guess this is it. Until sometime last year, I was more or less an AI-skeptic. I say more or less because I was always very interested in the technology. I built my own LLM to learn about it and I thought then, as I do now, that the <em>technology<\/em> is incredible.<\/p>\n<p>And yet, I had tried using LLMs to help with coding and my experiences were not great. I used LLMs to write one-off scripts for me, they were very good at that. But whenever I tried to use them to help me write \u201cproduction code\u201d, they would hallucinate or get stuck in \u201cbug loop\u201d. I felt like I was spending more time dealing with the aftermath than I\u2019d do writing it all by hand. I even disabled Copilot autocomplete because I felt like it was distracting.<\/p>\n<p>Fast forward to today and most of my code is written by LLMs. How this change happened is a combination of how much the tooling improved but also the recognition that I was holding it wrong.<\/p>\n<p>Now, don\u2019t get me wrong. This post is not meant to convince anyone of anything. I\u2019m not selling anything here. This post is for engineers who are curious about how others work with LLMs and trying to find their own workflow. I\u2019ll show you exactly how I work now and how it works <em>for me<\/em>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"the-bug-that-changed-my-mind\">The bug that changed my mind<\/h2>\n<p>As mentioned, I was a bit of a skeptic. I knew LLMs were good at writing one-off scripts and I was using them a lot for that, but not more than that. Then one day someone asked for help with a bug.<\/p>\n<p>We had this multicell architecture and we had a proxy\/multiplexer that would decide where any given request should be routed to. Once that decision was made, the request would be proxied to an ALB using a custom transport. The ALB had resource mappings to know where inside a given cell things were hosted, so the custom transport requested a URL from the ALB, the ALB responded with a redirect to the actual destination inside the cell it belonged to. The custom transport would require the request and make it to the correct destination.<\/p>\n<p>The bug: seemingly at random, some requests would succeed and some would not and no one could figure out why. So I started looking and quickly found that it wasn\u2019t random at all: requests with bodies would fail. When I saw that, I immediately thought it was the custom transport eating the body, except I remembered writing that transport and found it hard to believe the issue was there. And upon looking at the code, it seemed fine. I added logging and went about trying to reproduce the issue. The code seemed correct, but the issue was still there.<\/p>\n<p>After a while, I decided to try Claude Code. I launched it on the repo and explained the problem. I\u2019ll admit I did not have high expectations, but hoped that maybe it could give me some insight that would help. To my surprise, in about 40s it came back saying it had found the issue: the transport was eating the request bodies. My first reaction was being frustrated because I knew I had already looked at it and the issue was not there. I thought Claude was being dumb. Except I noticed it was showing code that didn\u2019t look like what I was looking at. Long story short: at some point, someone had copied and pasted some code and added a second custom transport somewhere where it shouldn\u2019t, and <em>that<\/em> transport had a bug.<\/p>\n<p>I didn\u2019t fully convert then, but I started paying more attention. I began using LLMs for debugging and code reviews, things where being wrong was mostly harmless and I could verify the output easily. Over time, that expanded. Now we\u2019re here.<\/p>\n<h2 class=\"wp-block-heading\" id=\"the-mistake-i-made-early-on\">The mistake I made early on<\/h2>\n<p>When I first tried AI coding tools, I treated them like code generators. Describe what you want, get code back, paste it in, repeat. This was the intuitive way to use them, and it\u2019s wrong as far as I am concerned.<\/p>\n<p>For those one-off scripts I mentioned before, I recognize now that I was \u201cvibe coding\u201d them. But that was fine because they were only going to be used by me. But I don\u2019t let LLMs write unsupervised code that I need to ship for others. So the problem is that generated code requires review. Review requires understanding. If you didn\u2019t think through the implementation yourself, you\u2019re now reading code you don\u2019t fully understand, looking for bugs you can\u2019t anticipate, in an approach you didn\u2019t choose. You\u2019re doing\u00a0<em>more<\/em>\u00a0cognitive work than if you\u2019d just written it yourself, and the code is probably worse.<\/p>\n<p>The mental shift that made everything click for me was that LLMs are tools, just like LSPs were tools, and pre-LLM autocomplete was a tool. They\u2019re not a replacement, but a complement. A junior engineer who has read everything but never built anything. Lots of talent but absolutely not trusted unsupervised.<\/p>\n<h2 class=\"wp-block-heading\" id=\"my-workflow\">My workflow<\/h2>\n<p>This is how <em>I<\/em> work with LLMs. I found that this works very well for me. I am aware that it is a much more involved workflow than a lot of people\u2019s.<\/p>\n<h3 class=\"wp-block-heading\" id=\"phase-0-reverse-rubber-ducking\">Phase 0: Reverse Rubber-ducking<\/h3>\n<p>I don\u2019t start in an agent. I start in <a href=\"https:\/\/claude.ai\">Claude<\/a>, just chatting.<\/p>\n<p>Before I write any code, I want to understand the domain. If I\u2019m implementing auto-updates for a macOS app, I am asking Claude about how Sparkle works. Not \u201cimplement auto-updates for me\u201d, but \u201chow does Sparkle choose when to prompt the user?\u201d or whatever. I want to know the concepts, gotchas, tradeoffs, etc. I often talk about some other app and ask \u201chow does X do this?\u201d<\/p>\n<p>This is basically rubber-ducking in reverse. I\u2019m building my own mental model through conversation. By the time I\u2019m ready to touch the code, I actually understand what I\u2019m about to do. This matters because it means I now can review what the LLM produces. I develop an intuition for what to expect, which in turn lets me quickly spot when something is wrong.<\/p>\n<p>This phase gives me confidence, and that matters. And of course, this is mostly for areas I am not already familiar with. But even when am familiar, I find that these conversations give me insights or what I need to ask when doing the plan.<\/p>\n<h3 class=\"wp-block-heading\" id=\"phase-1-plan\">Phase 1: Plan<\/h3>\n<p>Now I move to an agent. Lately I\u2019ve been using <a href=\"https:\/\/ampcode.com\">Amp<\/a>, but the specific tool matters less than the process. This could be Claude Code, Codex CLI, etc. My process is tool-agnostic.<\/p>\n<p>I don\u2019t say \u201cbuild me X.\u201d Instead, I start another conversation, mostly a Q&amp;A. \u201cHow would you approach this?\u201d, \u201cWhat are the steps?\u201d, etc. I challenge it when something sounds off. I often ask the LLM to pushback to my ideas if it thinks they\u2019re not good. I may still insist but it\u2019s good to have some pushback here and there. We go back and forth until I\u2019m satisfied with the approach.<\/p>\n<p>Then I ask it to split the plan into the smallest self-contained, testable phases. This is critical. I want each phase to be something I can review, run, and validate before moving on. Those codebase-wide big changes re where things go off the rails.<\/p>\n<p>Finally, I have it write everything to a <code>spec.md<\/code> file. This serves two purposes: (1) it\u2019s a reference I can point the LLM to if context gets lost, and (2) it\u2019s documentation of what we decided and why. For longer projects, this is how I resume after a break. I also make manual adjustments to this plan when needed, though this is getting more and more rare.<\/p>\n<h3 class=\"wp-block-heading\" id=\"phase-2-implement-each-phase-of-the-plan-one-by-one\">Phase 2: Implement each phase of the plan, one by one<\/h3>\n<p>Now the agent starts writing code, one phase at a time.<\/p>\n<p>I watch the diffs as they flow in and because I was part of the planning and did my homework in Phase 0, I know what to expect. A quick glance usually is enough to tell me if it\u2019s writing what we discussed or going off-script. That\u2019s why the prep work matters: review is fast when you understand what you\u2019re looking at.<\/p>\n<p>I also give it context to save time. The agents nowadays are very smart and can find their way, but I can shortcut that by giving it hints \u201cin <code>internal\/foo\/foo.go<\/code> there\u2019s a function called <code>DoFoo()<\/code> and it does this and that and I want it to do that other thing before that\u201d or whatever. Less tokens, faster iteration. This is probably astrology for nerds, pure superstition at this point, but I still do it. <em>(Hi, it&rsquo;s me, from the future: <a href=\"https:\/\/rselbach.com\/being-specific-when-pairing-with-bots\/\">maybe it&rsquo;s not astrology?<\/a>)<\/em><\/p>\n<p>Here\u2019s a little trick I\u2019ve started using: cross-agent reviews. Once Amp finishes a phase, I\u2019ll ask Claude Code or Codex to review the diff. Different models and harnesses catch different things. It\u2019s not foolproof, but it\u2019s cheap and occasionally catches something I missed.<\/p>\n<h3 class=\"wp-block-heading\" id=\"phase-3-validation-commit-and-handoff\">Phase 3: Validation, commit, and handoff<\/h3>\n<p>Once a phase looks good, I test it. I run and do what I can to validate it. I\u2019ve mostly reviewed the code both by myself and using an LLM.<\/p>\n<p>If something is wrong, I iterate with the agent. I point out the problem and let it fix it. This usually works and only very occasionally I have to take over and fix it myself.<\/p>\n<p>When I\u2019m happy, I commit. This is an easy rollback point if something goes wrong afterwards. At this point I use Amp\u2019s <code>\/handoff<\/code> command to start a fresh context for the next phase. This is a forced boundary: the agent will start clean (though it can reference the previous phase in Amp), it will re-read the spec and we continue. This helps prevent context rot, which is where long sessions start to drift.<\/p>\n<h2 class=\"wp-block-heading\" id=\"trust-boundaries\">Trust Boundaries<\/h2>\n<p>I rely on LLMs heavily but I don\u2019t <em>trust<\/em> them.<\/p>\n<p>These are the lines I don\u2019t let them cross:<\/p>\n<ul class=\"wp-block-list\">\n <li>\n <strong>Nothing ships without my review.<\/strong> I read every line before it goes in. I am too anxious to ship something I don\u2019t understand. That prep work from Phase 0 is not just about understanding, but about making review fast enough that this is sustainable\n <\/li>\n <li>\n <strong>Don\u2019t let the LLM write tests unsupervised.<\/strong> I learned this one the hard way. When a test fail, LLMs often \u201cfix\u201d the test to make it pass. I\u2019ve heard this is less likely nowadays but I\u2019ve been burned and trust isn\u2019t easily restored. So there. Now I\u2019m extremely careful about letting them modify test code. Only thing I do like to use LLMs for in testing is asking them \u201cdo the tests cover the case where this, this, and this happen?\u201d Helps finding holes in the coverage.\n <\/li>\n <li>\n <strong>Debugging is still mostly me.<\/strong> This is ironic, given that debugging a bug was my entry point into using LLMs more and more, but I\u2019ve found that for my day-to-day debugging, I\u2019m usually faster on my own. I reach for an LLM if I\u2019m stuck, not as a first resort. Maybe this is muscle memory or maybe the tooling is weaker here. Either way, I don\u2019t force it.\n <\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"what-still-doesnt-work-well\">What still doesn\u2019t work well<\/h2>\n<p>I want to be honest about the limitations, because the hype around these tools is exhausting.<\/p>\n<p>I don\u2019t think they\u2019re good at complex refactoring across many files. The agent loses the thread. It will make changes that are locally correct but globally inconsistent. For big refactors, I still do a lot of manual work. I feel like the quality of code after an LLM-assisted refactor is not great quality.<\/p>\n<p>Also, anything requiring deep context about the codebase\u2019s history. Why is this weird workaround here? What\u2019s the implicit contract this function has with its callers? The agent doesn\u2019t know, heck most people don\u2019t either, but whereas a human might be reluctant, LLMs will happily remove that code that seemed inconsequential but that now breaks some contract with a client.<\/p>\n<p>And the final one can be controversial, but I think they\u2019re bad at novel architecture decisions. Don\u2019t get me wrong, ask an LLM to design something and it will, but then you ask it \u201coh but what if\u2026\u201d and it will immediately \u201cyes good point\u201d and redesign it all. It just goes along with whatever you last said. It doesn\u2019t know how to make decisions. It shouldn\u2019t be surprising given how LLMs work, but our brains tend to anthropomorphize everything and then these things become counterintuitive. So I still have to think about architecture myself.<\/p>\n<h2 class=\"wp-block-heading\" id=\"the-real-lesson\">The Real Lesson<\/h2>\n<p>These tools have changed a lot \u2014 GPT 5.2 and Opus 4.5 are watershed moments IMO \u2014 but not as much as my own approach did. I stopped trying to skip the thinking part and started using LLMs to enhance it. The agent participates in discovery, planning, obviously implementation, and also reviews, but I am still driving.<\/p>\n<p>If you bounced off these tools, it might be worth trying again with a different approach, it\u2019s all I\u2019m saying.<\/p>\n<p>I\u2019ve found that my workflow is more work upfront, but dramatically less work overall. More importantly, it lets me focus on the interesting parts and helps me with the drudgery.<\/p>"},{"title":"Trying out Codex CLI","link":"https:\/\/rselbach.com\/trying-out-codex-cli\/","pubDate":"Mon, 25 Aug 2025 11:34:28 +0000","guid":"https:\/\/rselbach.com\/trying-out-codex-cli\/","description":"<p>A while ago I was a little skeptical of AI-assisted coding. Mostly because my experience had been with CoPilot autocomplete and it was really not good. I still avoid AI autocomplete to this day, even if I can see it got better because I still find it distracting and often still not great.<\/p>\n<p>That said,\u00a0<a href=\"https:\/\/www.anthropic.com\/claude-code\">Claude Code<\/a>\u00a0shook my world view and I\u2019ve been daily driving it ever since. I need to write a post about how I use this agent, but tl;dr I use it for the boring parts of coding and to help me read and review code (especially my own) instead of using it to write feature code.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_7d1366156bb333ee.webp 320w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_25fea0e5ee6b544.webp 480w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_fa4a148aecef7291.webp 640w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_210a95795089566e.webp 800w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_6ea1cecfcd5f7ebc.webp 960w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_5a1fcc0795ef888f.webp 1100w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_995980500d33bd5.webp 1280w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time.png\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1536\" height=\"1024\" srcset=\"https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_3070d215d3059a4b.png 320w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_8f334f205d6ea739.png 480w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_2b17926e19ed5b50.png 640w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_b729aa366ed6a4ac.png 800w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_b18a34b1464796e7.png 960w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_263d62b6158552a2.png 1100w, https:\/\/rselbach.com\/trying-out-codex-cli\/distracted-old-time_hu_982506bf92a111cd.png 1280w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>I have been happy with Claude Code, but I also heard very good things about the new GPT-5 model for coding and wanted to check it out. Enter the\u00a0<a href=\"https:\/\/github.com\/openai\/codex\">Codex CLI<\/a>. It\u2019s OpenAI\u2019s answer to Claude Code.<\/p>\n<p>I am approaching this with a very open mind. I completely understand that it is early times in Codex CLI land and thus I did not expect it to have feature parity with Claude. I\u2019m ok with that, just to get that out of the way.<\/p>\n<h2 id=\"the-onboarding-was-rough.wp-block-heading\">The onboarding was rough<\/h2>\n<p>My first experience with it was that it wouldn\u2019t install due to an issue in the post-install of a dependency (<code>ripgrep<\/code>, which, I must say, I already had installed.) I went to file a ticket and say that someone else had\u00a0<a href=\"https:\/\/github.com\/openai\/codex\/issues\/2501\">already done so<\/a>.<\/p>\n<p><em>No matter!<\/em>\u00a0I thought. I figured out how to get around it and then decided to try it. I opened a local repo and typed\u00a0<code>\/init<\/code>.<\/p>\n<p>Codex decided it wanted to run tests to check the status of the repo. Fair enough, go ahead. It then failed to compile my Go code, claiming the Go toolchain wasn\u2019t available. I was confused by that, so I closed Codex CLI and ran\u00a0<code>go version<\/code>, all good. I ran my tests, all passed.\u00a0<em>Wut?<\/em><\/p>\n<p>I tried again and this time I told it that I checked and I had the toolchain installed. It tried again, no dice. It kept trying until eventually I stopped and did some digging. That\u2019s when I learned that\u00a0<strong>Codex CLI runs inside a sandbox and doesn\u2019t share my shell\u2019s environment<\/strong>. Ok, that was a little upsetting. So I asked Codex CLI how we could provision the sandbox with Go. It proceeded to look for Go\u00a0<strong><span style=\"color: red\">1.13<\/span><\/strong>, which was release over\u00a0<em>six years ago<\/em>. It asked me to download the tarball and leave it in a certain directory and it would take from there.<\/p>\n<p>Ok, time for some more digging. It\u2019s a this point that I must point out that the Codex CLI documentation is basically non-existent, and being a relatively newcomer, there\u2019s not a lot of resources out there. Again, I get it, let\u2019s just get through this initial steps.<\/p>\n<p>I keep at it until I figure the issue: though my shell\u2019s\u00a0<code>PATH<\/code>\u00a0includes Go 1.25, the sandbox\u2019s did not. I couldn\u2019t quite figure out why but I did manage to get it working by telling GPT where to find the Go binaries.<\/p>\n<h2 id=\"once-it-got-working.wp-block-heading\">Once it got working<\/h2>\n<p>Now, once I got it working, things went a lot smoother. I quickly got used to the differences from Claude Code (and they are many) and got somewhat comfortable with it. I got GPT to analyze my code and look for bugs and it found a minor one that had escaped Claude for a long time. That was cool.<\/p>\n<p>I found that it tends to be a little noisier than Claude Code, because CC tends to hide somethings behind its quirky verbs (\u201clampoonig\u2026\u201d, etc) This isn\u2019t necessarily a negative, just different and something to get used to.<\/p>\n<p>I miss the TODO lists that Claude Code creates and follows. Again, not a huge deal. The part that it needs to improve is tool calling. More than once I saw it calling some Go tool with bad parameters. And also, it doesn\u2019t seem to quite grasp the error messages.<\/p>\n<p>Case in point, I asked it to run a linter, so it started running\u00a0<code>golangci-lint<\/code>, but it ran it at the root of the repo, where there are no Go files, and without parameters, which resulted in an error \u201cNo Go files\u201d. It didn\u2019t seem to understand this error and concluded\u00a0<code>golangci-lint<\/code>\u00a0wasn\u2019t installed.<\/p>\n<p>It then entered a loop trying the same command over and over again until I interrupted it and told it to pass\u00a0<code>.\/...<\/code>\u00a0to include subdirectories. It then tried again with the parameters, but bizarrily this time it decided that the\u00a0<code>golangci-lint<\/code>\u00a0would be in\u00a0<code>.\/bin<\/code>, which is not true at all. So I had to tell it where to find it. And then it worked fine.<\/p>\n<h2 id=\"conclusion.wp-block-heading\">Conclusion<\/h2>\n<p>It\u2019s early days and it\u2019s clear there\u2019s some ground to make up if they want to catch up, but I also remember the early days of Claude Code. The CC team iterated quickly and we got to where we are today, and I\u2019m hoping the Codex team will do the same. They seem very active in answering questions on X, so I have hope.<\/p>\n<p>I\u2019m hopefuly and interested. I\u2019ll keep an eye on it.<\/p>"},{"title":"Cedilla in Fedora 2025","link":"https:\/\/rselbach.com\/cedilla-in-fedora-2025\/","pubDate":"Fri, 09 May 2025 11:29:08 +0000","guid":"https:\/\/rselbach.com\/cedilla-in-fedora-2025\/","description":"<p>Years ago\u00a0<a href=\"http:\/\/localhost:1313\/cedilha-no-fedora-25\/\">I posted about getting the c-cedilla (\u00e7) working in Fedora<\/a>\u00a0when using the US International keyboard with deadkeys. This has been a struggle for decades now and every time I set up a new Linux installation, I need to look it up.<\/p>\n<p>That wouldn\u2019t be such a problem, weren\u2019t for the fact that the way to accomplish this seemingly simple task keeps changing over the years, so most of the information you find online is awfully out of date.<\/p>\n<p>So for 2025, based on my experience with Fedora 42 (the current version at time of writing) \u2013 I suspect it would work similarly with other distros, but I cannot confirm it \u2013 this is how I did it.<\/p>\n<p>First add these two lines to\u00a0<code>\/etc\/environment<\/code>\u00a0\u2013<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-bash\" data-lang=\"bash\"><span style=\"display:flex;\"><span>export GTK_IM_MODULE<span style=\"color:#f92672\">=<\/span>cedilla\n<\/span><\/span><span style=\"display:flex;\"><span>export QT_IM_MODULE<span style=\"color:#f92672\">=<\/span>cedilla\n<\/span><\/span><\/code><\/pre><\/div><p>And then in your home dir, add a file named\u00a0<code>.XCompose<\/code>\u00a0with this \u2013<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>&lt;dead_acute&gt; &lt;C&gt;\t\t\t: &#34;\u00c7&#34;\tU0106 # LATIN CAPITAL LETTER C WITH CEDILLA\n<\/span><\/span><span style=\"display:flex;\"><span>&lt;dead_acute&gt; &lt;c&gt;\t\t\t: &#34;\u00e7&#34;\tU0107 # LATIN SMALL LETTER C WITH CEDILLA\n<\/span><\/span><\/code><\/pre><\/div><p>Then reboot and it should just work. To be fair, this is the easiest it\u2019s been for years to get this done.<\/p>\n<p>As a bonus, there are a few other changes that I\u2019ve made in my\u00a0<code>.XCompose<\/code>\u00a0file to solve some annoyances I have with the\u00a0<code>US-intl<\/code>\u00a0keyboard in Linux. When I type fast, I tend to accidentally end up with a lot of mistakenly accented consonants that I don\u2019t need in any of the languages I write in.<\/p>\n<p>These are, of course, entirely up to you if you want them and have nothing to do with the cedilla.\u00a0<a href=\"https:\/\/github.com\/rselbach\/c-cedilla-fix\">You can find them on Github.<\/a><\/p>\n<p>Hopefully the search engine gods will help someone out there find this when they need it. Might just be me in the not-too-distant future.<\/p>"},{"title":"How to Make :x Just Save Instead of Save and Quit","link":"https:\/\/rselbach.com\/how-to-make-x-just-save-instead-of-save-and-quit\/","pubDate":"Sat, 26 Apr 2025 11:25:42 +0000","guid":"https:\/\/rselbach.com\/how-to-make-x-just-save-instead-of-save-and-quit\/","description":"<p>I\u2019m going to leave this here in case someone out there is looking for the same thing, because this one was hard to figure out for me.<\/p>\n<p>I\u2019ve been using\u00a0<a href=\"https:\/\/www.vim.org\/\">vim<\/a>\u00a0for a long time. Decades. Although it has never been my main editor (I used to be a proud\u00a0<a href=\"https:\/\/emacs.org\/\">emacs<\/a>\u00a0guy), vim is the editor I always go to when I need to edit something quickly.<\/p>\n<p>My main editor these days is\u00a0<a href=\"https:\/\/code.visualstudio.com\/\">Visual Studio Code<\/a>, with the\u00a0<a href=\"https:\/\/github.com\/VSCodeVim\/Vim\/\">VsCodeVim<\/a>\u00a0extension. I still use vim often from the vscode integrated terminal, which is ironic.<\/p>\n<p>Anyway, after so many years using vim, I have developed muscle memory that is hard to let go of. I am very used to doing quick edits and using\u00a0<code>:x<\/code>\u00a0to save and exit. It\u2019s a hard habit to quit.<\/p>\n<p>But when working on vscode, this behaviour is not exactly ideal. I don\u2019t need to close the active editor, so I decided to try and modify that behaviour by only saving the file instead of saving and closing the editor.<\/p>\n<p>After a lot of trial and error and reading the extension source code, I finally found the solution:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-json\" data-lang=\"json\"><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">&#34;vim.normalModeKeyBindingsNonRecursive&#34;<\/span><span style=\"color:#960050;background-color:#1e0010\">:<\/span> [\n<\/span><\/span><span style=\"display:flex;\"><span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#f92672\">&#34;before&#34;<\/span>: [ <span style=\"color:#e6db74\">&#34;:&#34;<\/span>, <span style=\"color:#e6db74\">&#34;x&#34;<\/span>, <span style=\"color:#e6db74\">&#34;&lt;enter&gt;&#34;<\/span> ],\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#f92672\">&#34;commands&#34;<\/span>: [ <span style=\"color:#e6db74\">&#34;:w&#34;<\/span> ]\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span>]<span style=\"color:#960050;background-color:#1e0010\">,<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">&#34;vim.commandLineModeKeyBindingsNonRecursive&#34;<\/span><span style=\"color:#960050;background-color:#1e0010\">:<\/span> [\n<\/span><\/span><span style=\"display:flex;\"><span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#f92672\">&#34;before&#34;<\/span>: [ <span style=\"color:#e6db74\">&#34;x&#34;<\/span> ],\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#f92672\">&#34;commands&#34;<\/span>: [ <span style=\"color:#e6db74\">&#34;:w&#34;<\/span> ]\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span>]<span style=\"color:#960050;background-color:#1e0010\">,<\/span>\n<\/span><\/span><\/code><\/pre><\/div><p>In both cases, I am replacing\u00a0<code>:x<\/code>\u00a0with\u00a0<code>:w<\/code>, which is the behaviour I want. But this needs to be done in two different ways. When the editor is in NORMAL mode, we need to look for the entire sequence of commands (<code>:x&lt;enter&gt;<\/code>).<\/p>\n<p>But if you type in\u00a0<code>:<\/code>\u00a0and wait a second, the editor will enter command line mode, in which we then need to capture the command (<code>x<\/code>) and then replace it with the\u00a0<code>:w<\/code>\u00a0command.<\/p>\n<p>Hopefully this will show up on a search engine or AI output that will help someone out there not have to spend as much time as I did trying to look for this solution.<\/p>"},{"title":"X-Touch Mini for Flight Simulation","link":"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/","pubDate":"Tue, 09 May 2023 14:24:04 +0000","guid":"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/","description":"<p>Since I was a kid, I\u2019ve loved aviation. Being poor and all, I could never dream of pursuing it in real life, so flightsimming has been my \u201ccheap\u201d fix for many years. I put cheap in quotes because this is an expensive hobby, even if you don\u2019t overdo it. Although I spend quite a lot of money on software, I try to keep things in check on the hardware department, as flightsim equipment can be <em>very<\/em> expensive. For GA flying, it would be great to have a <a href=\"https:\/\/realsimgear.com\/products\/realsimgear-g1000-suite-for-x-plane-p3d-and-fsx\">G1000<\/a>, but at $2,199 USD, that\u2019s a no from me.<\/p>\n<p>Also, I\u2019ve long flown the Boeing 737NG series, and setting up the MCP (the autopilot panel) with the mouse is quite the immersion killer, not to mention quite hard during busy phases of a flight. But \u20ac 1,299 is also not worth it, in my opinion.<\/p>\n<p>That said, I\u2019d really like some hardware controls. And that\u2019s when I ran into the <a href=\"https:\/\/www.behringer.com\/product.html?modelCode=P0B3M\">Behringer X-Touch Mini<\/a>. The X-Touch Mini is not made for flightsimming, though; it\u2019s a MIDI controller and as such, it doesn\u2019t have the \u201cniche tax.\u201d I got it from Amazon at $180 CAD.<\/p>\n<p><a href=\".\/IMG_0847-8.png\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_15f998a9fde4d8c9.webp 320w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_73ea8555a000eaa0.webp 480w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_a0b4c1a85bd6c458.webp 640w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_bc1475077797d891.webp 800w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_542bcb1c2892c930.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768.png\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"768\" srcset=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_a30040ab92f01446.png 320w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_89b993afb2b2ba8a.png 480w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_55b427a15938e2ba.png 640w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_38825d2e219846b1.png 800w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/IMG_0847-8-1024x768_hu_f158a2ff2ae54de9.png 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>With some tinkering, I could make this control many planes, from the B737 to the Twin Otter. It\u2019s great. I\u2019ve long used <a href=\"https:\/\/www.spadnext.com\/home.html\">SPAD.neXt<\/a> to control all my planes for two reasons:<\/p>\n<ol>\n<li>I like tinkering with LVARs and also most third-party planes don\u2019t expose all their controls to the simulator<\/li>\n<li>I like the fact that it autoswitches to the correct control profile for whatever plane I\u2019m using<\/li>\n<\/ol>\n<p>As an example, here\u2019s how I set up a knob to control the checklists on the Honda Jet.<\/p>\n<p><a href=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/screenshot-2023-05-06-084634\/\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_a376e70484da283b.webp 320w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_f34bb6559d3295c8.webp 480w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_10c02eb05a9f7777.webp 640w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_38120228f52507e8.webp 800w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_f19adb183dea2148.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559.png\"\n alt=\"A screenshot of SPAD.neXt\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"559\" srcset=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_c0168320b6fab216.png 320w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_5dbdd57fc2c7de28.png 480w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_3f78683e0ce55058.png 640w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_45cd4c5e714f196d.png 800w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-06-084634-1024x559_hu_ac77b55f0faca93d.png 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>It\u2019s amazing! Also, I\u2019ve been flying the ATR72-600 lately. Great plane! Also, it is similar enough to the Bombardier DHC8 (a.k.a. Dash-8) that it scratches my itch to fly regional Canadian routes, so I followed the excellent <a href=\"https:\/\/www.youtube.com\/watch?v=YS-2_swi-18\">Les O\u2019Reilly\u2019s tutorial on setting the X-Touch Mini up for the ATR 72-600<\/a>. Seriously, if you want to learn SPAD.neXt, <a href=\"https:\/\/www.youtube.com\/@LesOReilly\">check out his channel<\/a>, it\u2019s great.<\/p>\n<p>However, I ran into an issue.<\/p>\n<h2 id=\"x-touch-mini-leds-not-working\">X-Touch Mini Leds not working<\/h2>\n<p>I could not get my leds to work with SPAD.neXt. No matter what I sent to the channel, the leds would not respond. I rewatched Les\u2019 video, searched forums all over and never saw anyone having the same issue. I started suspecting a hardware problem. Eventually, I downloaded the editor from <a href=\"https:\/\/www.behringer.com\/product.html?modelCode=P0B3M\">the Behringer\u2019s website,<\/a> solely for the purpose of seeing if I could get the leds to activate with it, to discard a hardware issue. This is when I found this \u2014<\/p>\n<p><a href=\".\/Screenshot-2023-05-09-at-10.17.23-AM.png\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_7557756b0a2ec39f.webp 320w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_7d8df576d9fbf91e.webp 480w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_736592ca27e7b1d7.webp 640w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_4958531eb67a3feb.webp 800w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_864557f93dfae248.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911.png\"\n alt=\"Screenshot of the X-Touch Mini editor with the Global CH field highlighted\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"911\" srcset=\"https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_b52741ba1b23b425.png 320w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_ae6edfd5c0203b04.png 480w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_82924941e21f19b6.png 640w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_a0b8a1a602012716.png 800w, https:\/\/rselbach.com\/x-touch-mini-for-flight-simulation\/Screenshot-2023-05-09-at-10.17.23-AM-1024x911_hu_d12b502e03a5be32.png 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>For some reason, my X-Touch Mini came with the global channel set to channel 12, instead of channel 1 as, it seems, is the normal setting. This is why none of the settings worked, so if you run into the same issue, now you know. So to fix this, there are two possibilities:<\/p>\n<ol>\n<li>Change all your SPAD.neXt settings to send the command to channel 11 (the channels are actually 0-based, so channel 12 in the UI is actually channel 11 in SPAD.neXt); or<\/li>\n<li>Change the global channel in the Behringer editor to 1 \u2014 which will be default channel 0 in SPAD.neXT. This is what I\u2019ve done.<\/li>\n<\/ol>\n<p>Once that was done, everything worked perfectly. The LEDs change status even if a channel happens inside the simulator, so you can rely on them to know the current status of your automatics and navigation\/comms. Really happy with the setup.<\/p>"},{"title":"Impressions on the Keychron Q6","link":"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/","pubDate":"Sat, 29 Apr 2023 22:52:41 +0000","guid":"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/","description":"<p>I\u2019ve had a soft spot for mechanical keyboards for a long time. It\u2019s a clich\u00e9, I know. I\u2019m not a fan of loud mechanical keyboards, mind you. I\u2019ve had my hands on <a href=\"https:\/\/www.cherrymx.de\/en\/cherry-mx\/mx-original\/mx-blue.html\">Cherry MX Blues<\/a> and found them to be so loud as to be a distraction during calls. And I found the <a href=\"https:\/\/www.cherrymx.de\/en\/cherry-mx\/mx-original\/mx-red.html\">Cherry MX Reds<\/a> to be, well, too quiet. I found the Goldilocks zone to be in the <a href=\"https:\/\/www.gateron.co\/products\/gateron-switch-set?variant=40017397448793\">Gateron MX Browns<\/a>.<\/p>\n<p>I have also come to particularly like the <a href=\"https:\/\/keychron.com\">Keychron<\/a> keyboards. They have a bit of a shaky reputation online, but I\u2019ve never had any problems with my Keychrons and I adore them. This <a href=\"https:\/\/www.keychron.com\/products\/keychron-k8-tenkeyless-wireless-mechanical-keyboard\"><strong>Keychron K8<\/strong><\/a> with Gateron Brows keys has been my main keyboard for the last 2-3 years.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_152bf0cc5f119c2a.webp 320w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_d59cbe9e97b75f17.webp 480w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_8084779d6d6022ab.webp 640w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_a29c016ebffd2249.webp 800w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_2f5bacf10ed7b2e5.webp 960w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_f917414e1a78edca.webp 1100w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_e07cc4b6c2601275.webp 1280w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_519083df592c7491.webp 1600w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_5403014124e796c0.webp 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled.jpeg\"\n alt=\"Picture of a Keychron K8 keyboard\"\n loading=\"lazy\"\n decoding=\"async\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_463f916f50d464e0.jpeg 320w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_647b12900d5aafac.jpeg 480w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_7fa2c17480803b0e.jpeg 640w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_16f818bb952474c5.jpeg 800w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_14cb7ad0e3ccffde.jpeg 960w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_3eef1d2e2006f796.jpeg 1100w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_1a2cf84498e16ebb.jpeg 1280w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_ea0e63cdd5dd4b17.jpeg 1600w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0827-scaled_hu_c90666dd94e96507.jpeg 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>It is an awesome keyboard. I like how it feels, I like how it sounds, and I like how it <em>clicks<\/em>. It\u2019s great.<\/p>\n<p>The only thing my K8 lacked was a numpad, and since I have a certain passion for flight simulation, a numpad is something useful. I could buy a USB numpad. But where\u2019s the fun in that? So this was the beginning of my search for a new keyboard.<\/p>\n<p>After some online conversations, I settled for another Keychron favourite, the <a href=\"https:\/\/www.keychron.com\/products\/keychron-k4-wireless-mechanical-keyboard-version-2\">K4<\/a>.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_f1ba7c3d243e2f87.webp 320w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_b27c36e98712bc91.webp 480w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_9d1c2c7495effc56.webp 640w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_418ed3a321d00a20.webp 800w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_bdec488ec9453ad5.webp 960w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_cf0f4bc1b0368456.webp 1100w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_a7b1955d4d9d004c.webp 1280w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_b33133b73f0d0f73.webp 1600w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_f436b5f61041ea61.webp 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled.jpeg\"\n alt=\"A picture of a Keychron K4 keyboard\"\n loading=\"lazy\"\n decoding=\"async\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_39acd882d5897dc8.jpeg 320w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_e521688214e1ec1e.jpeg 480w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_7f8b7401f57ba525.jpeg 640w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_b5b39f53d5f99099.jpeg 800w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_f55ac861ced6efbb.jpeg 960w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_3fa9e49e062c732f.jpeg 1100w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_e3f89b77bb94b239.jpeg 1280w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_c5ba9ee391509c48.jpeg 1600w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0828-scaled_hu_71337c831d40a6ec.jpeg 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>And this keyboard feels\u00a0<em>amazing<\/em>. I cannot stress this enough: it\u2019s the most pleasurable clicking experience of my life. In theory, it has the same Gateron G Pro Browns as my K8, but for some reason, it feels better. I\u2019m not sure how else to put this: they feel less metallic-y. I don\u2019t know how else to put it.<\/p>\n<p>Great size, great feel, great quality. I fell in love with this keyboard the moment I unboxed it. Except it has a terrible flaw that might be evident from the picture, but that I never noticed until I started using it. Do you see it? It\u2019s right there by the arrow keys. Do you see it now?<\/p>\n<p>There\u2019s no spacing. The arrows are right under the Enter key but there\u2019s no padding space between them and, say, the 0 key on the numpad. Years of muscle memory down the drain. I could not reliably hit the arrows without looking. I tried. The layout of the Del, End, PgUp, PgDown keys was also a bit foreign to me, although I was able to adapt relatively quickly to them. The arrows keys though, I simply could not. I replaced them with some texturized rubber keys but I was still unable to hit them reliably. It was a pity.<\/p>\n<p>Enter the mighty <a href=\"https:\/\/www.keychron.com\/products\/keychron-q6-qmk-custom-mechanical-keyboard\">QMK Q6<\/a>.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_e195ae1f64df8002.webp 320w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_44fb04664ad39063.webp 480w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_536c324ca6caa3b9.webp 640w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_b142b1ede2a8ba56.webp 800w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_c61e62e3bd01882d.webp 960w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_79f5bf2b6d0f782a.webp 1100w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_f64b4def9c955ad.webp 1280w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_ae5693a8c39ac673.webp 1600w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_3cf1b22277d8c75b.webp 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled.jpeg\"\n alt=\"A picture of a Keychron Q6 keyboard\"\n loading=\"lazy\"\n decoding=\"async\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_657f5aa59fa32575.jpeg 320w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_390798d20d3e971c.jpeg 480w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_16598edf4a245c40.jpeg 640w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_59d967b0e95d4713.jpeg 800w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_b2f4a9236c136d08.jpeg 960w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_32ebc9d21944511.jpeg 1100w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_88ad227a36a38316.jpeg 1280w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_df28c21ac757ad8f.jpeg 1600w, https:\/\/rselbach.com\/impressions-on-the-keychron-q6\/IMG_0829-scaled_hu_e94a03432eeb36b9.jpeg 2048w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>This keyboard is a beast! It weights 2.5Kg, which is insane. But OMG it feels so, so good. If I had to choose, I would still pick the\u00a0<em>feel<\/em> of the K4, but it\u2019s close. The Q6 has better keycaps though.<\/p>\n<p>In terms of sound, it sounds very close to the K8, maybe a tad softer but it\u2019s hard to tell. In terms of feel, it\u2019s between the K4 and K8. It feels closer to the K8 than to the K4, but yeah, somewhat in the middle between the two.<\/p>\n<p>I love it. I credit it for the fact that I am writing this right now: I just feel like typing! I really like this. As an additional bonus, its firmware\u2019s source code is open source. I don\u2019t plan to use it for anything, but it\u2019s good to know.<\/p>\n<p>However, it is not perfect. Don\u2019t get me wrong: I\u2019m very happy with this keyboard but it does have one extremely questionable design decision that I honestly can\u2019t understand: it doesn\u2019t have feet. It just lies flat on the desk which feels quite awkward to me. I cannot understand the decision to do that. I solved it with some cheap adhesive rubber feet, so all is good, but why Keychron decided to ship it like this is beyond. So be aware of this.<\/p>\n<p>Other than that, I absolutely love it.<\/p>"},{"title":"In which I reminisce about the last few years","link":"https:\/\/rselbach.com\/in-which-i-reminisce-about-the-last-few-years\/","pubDate":"Sat, 29 Apr 2023 09:54:15 +0000","guid":"https:\/\/rselbach.com\/in-which-i-reminisce-about-the-last-few-years\/","description":"<p>I just checked and it\u2019s been exactly 1,594 days since I last posted on this blog. That\u2019s 4 years, 4 months, and 12 days. This was, as is often the case with these, not planned. When I last wrote something here, I was working in a team set up as an R&amp;D lab. Work felt quite fun and exciting and writing about it felt natural.<\/p>\n<p>I then changed to jobs to a startup where things felt a tad different. It was a weird time for me: I met some great people there, people I still talk to and call friends. We put together a small team where I got to do some of the most fun work. Some of the people in that team I still talk to every single day. We\u2019re still trying to put the group back together in some form in another company. And yet, my time in that company, outside that small team, made me feel quite small and inadequate. Writing about it did not feel natural.<\/p>\n<p>I then joined HashiCorp, a company I\u2019ve admired for years. I won\u2019t go as far as saying this was a dream of mine, but when I got the offer, it sort of felt like it. I\u2019ve been here for about two and a half years now and I\u2019ve met some extremely brilliant people, and a few that I can call friends. I should have written about it. I wish I had. But by this time, the writing habit was already gone and life does what life does.<\/p>\n<p>What else happened over the last few? Well, we became Canadian citizens. That was a blast, even if pandemic-style remove ceremony was a bit awkward.<\/p>\n<p><figure class=\"post-figure\"><img src=\"https:\/\/lh3.googleusercontent.com\/DS7Ey_xk_Mu2CLgrLlld0-53fdizwU1UAS-TtWp8X0z7vLi2x62-g6jw07CqlkUX40B87UNXT1hJLZRMwzqnQqw29hxnvg7GJl2oAx0GqiTrIFLeGudXlSzAkd1ERwN4ZOp5xALbGsg4bYuBFczrp7g8qtdezSpMshoQEXgkIACiH_Y0cJLLPCirfgykA5GTffWEb-4wdLNFgPKcTi7tZ7FENwugfTGz9MtbRKMVX1WVawlfz7LSBiANwYX2HLtTyxU3qE4_Q-R3DhzgBmdgJESyz_5yMqELQqe5wUtxEweaT-N6Zu15Whf9vFhgNH_22JOhcBcBSSYVUVu7G1AhzWC_y6FYmy4G_46Bu99wmhb1ZNtnFjJQOJLFNhYpO0Lsd_k0jfdUnigEPBe3A7Gwto8cdJJVmsiEpMFikiSjGXnfA6UZHhkx_RPTshOuFTuUQDJVu-YdlXdRyz2Ew4d7XaZCewe3bKeNyIyQ8XjN-ED1MmrXzZ764WPzgdnt2tZ82XFr4GQCWuGaYM56rMg29-Og__y1viEHvWvLA2T9YmVsogHeczixSbMwX7LBvCW-pyDQ5guwX3fab9_tRL0pc0-xRd6SZDDMAtFxx9JZ13xSOVSzR7bBSgSJDVH44lzhFGiB1eVDvADbODmxInPvMOts8d20u4M6XsZuEzBvUrVq3msbQhTgLqJIKTylmvGySNKCmgRCibg-5F0hlk5yCrwSYH5z4YadGWWasiikp497SX3WGyqc-p5DaOx18rCOoxaUvrtjnrdh16-ku9lzbK6wr7pLjWlOPjfkgZLx3fgaMAA2YWQYQs8QLJDjGz7OyY3dNeDrfM8gKerRc34wtVP000vX58FZBv7tcK4KaI3idfCSrUVZN_u4r8W1l4P-2qR2eJagztyeO4jXuwem_tlXHrZfos8ctySnNVzKO682pA=w2642-h1982-s-no?authuser=0\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\">\n<\/figure>\n<\/p>\n<p>We bought a house and got a new dog, Loki. He\u2019s an English Cocker Spaniel, as would be expected of us, as he\u2019s our 5th \u2014<\/p>\n<p><figure class=\"post-figure\"><img src=\"https:\/\/lh3.googleusercontent.com\/rfZ9UNxEiV6mPiwQIckzbaM1dFLt5roHuFK94xTtotc5Y--tRdduuIkvzI4o9xe7_w2wjsqRI6nYb7foqHl7Vlp3B7AwrCBonidDsXplt6awsnFctD8ebrrF2evr3f8b6gICYKOF0C7sJdENONokFpwUa2-XJ3fe7kXyDRSyCOhCMf8U97jkyiFfIwNlmnVZi3sDylVzmWzKsANEKMiBMs11JMm63QApOj1N3NSc4B7nvcsXVuuWDMpE6Z1uKlrxHm3f61_a4SOQlQVnq-jh0BPI_ogZh65cG1jKEKZIp8L1R4pgVIqLIJ2x6163jm1pcHADfLSNdcvNnhuO8BEduvjKSocDRzebjhdwxfDGdGRdXzNBrsHPy9-Ij-FDAejak_Z4726joXDoA6gZ0mx88UaKPbWOSQBrOqe5Gcfiyg_P8wt4BEekfONqOfhQxW--NZcOk8tJT8b6I-1D13dbwOaZ24mmlkUGigDew9hi3UV--Uv00-m9Zd6Gq7bY4_PYk54XtvDlk7ywu4NDLYCzZq1GC_xFp2tvUdjjH2fB2iw-cb4jkKZb98mFk5CV57tedubaQg_gFVaDZ5E4IXLz40DiKQ5K8QO76RuYc7yRVwR-Aj5fAKAtebJPEAVr74xnt5bb5EadpPgQTmD_VyK6M41YfkoWuTws6hKSvrIXz4GKfwOdx9R0sWkm-HL7Olbepnkb2dmtE90xheyi0M0vaKyP5O5WzzaIrVnxofdTbAlmtTHSu39JmHtQZklBEqVMyuldq0z5S0BRo-oC1PiahhVZ4YuLhn675rGN_5Xqi6g8Mhq_5TV1jVfk1uRLpUVGe28NfJDIMLObdHCQojgOw3CwFj29kXNwkrqZMWG9nfW2-6OuU5fQWv28sNfoVOb_w6eFM9nQgETKpzXPoRNeMTlxDkulzZ2IlZaBDBHUUSJ_jw=w2642-h1982-s-no?authuser=0\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\">\n<\/figure>\n<\/p>\n<p>All in all, I can\u2019t complain. On the other hand, I am getting older, which sucks, let me tell you that.<\/p>\n<p>Anyway, I\u2019d like to get back to writing a bit, I used to enjoy it quite a bit. We\u2019ll see. Hopefully it won\u2019t be another four years until the next post.<\/p>"},{"title":"The Last of Us Part II","link":"https:\/\/rselbach.com\/the-last-of-us-part-ii\/","pubDate":"Sat, 20 Jun 2020 14:05:33 +0000","guid":"https:\/\/rselbach.com\/the-last-of-us-part-ii\/","description":"<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n I&#8217;ve finished the game last night. I haven&#8217;t stopped thinking about it ever since. It was, to be very honest, a transformative experience, as far as videogames go. I understand why some people hate it and I&#8217;m sorry because I understand how much it sucks when you want to enjoy something but can&#8217;t. Art is subjective and no one is right or wrong.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n That said, I want to talk about what I&#8217;ve experienced. Again, this is\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">my<\/em>\u00a0experience with the game. I&#8217;m sure yours will be different and it is\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">fine<\/em>. If you hate this game, you&#8217;re not wrong. You feel what you feel.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n With that out of the way, let me begin with the least controversial theme: the gameplay.\n<\/p>\n<h2 class=\"_7T4UafM1PdBGycd5na9nF\" id=\"gameplay\">Gameplay<\/h2>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n I thought the gameplay was an improvement on the first game. I don&#8217;t mean only the added functionality like ropes, and dogs tracking you. But the mission structures were more varied and some of them were, well, epic.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n The sky bridge was awesome. So was trying to get near the sniper (Tommy) by advancing behind cover. The stalkers were a fun addition which gave me a lot of jump scares. That huge new infected monster at ground zero was&#8230; argh! Kill it now! The entire time spent on the seraphite island was amazing.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n I also loved little things like figuring out the code for the safes.\n<\/p>\n<h2 class=\"_7T4UafM1PdBGycd5na9nF\" id=\"the-story\">The Story<\/h2>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n This is what is dividing people, and it&#8217;s fine. Art that everybody agrees on is boring. The way I see the story, it is one of mirrored character journeys (as much of popular culture is.) Through three characters, we see the same journey at different points. I think this is genius. Here&#8217;s how I figure.\n<\/p>\n<h3 class=\"_1qeIAgB0cPwnLhDF9XSiJM\" id=\"joel\"><strong class=\"_12FoOEddL7j_RgMQN0SNeU\">Joel<\/strong><\/h3>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n First all all, yes, it sucked to see him killed. That&#8217;s the point: we are supposed to be angry that he&#8217;s dead, that he&#8217;s killed in such a way. This is very much intended: it puts us in the place of Ellie. It is perfectly expected that you&#8217;d feel\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">rage<\/em>\u00a0towards his killers. I think it becomes a problem when that rage is instead directed towards the game itself, a work of fiction, because then it makes it really hard to appreciate the rest of it.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n Let&#8217;s talk about his character journey, shall we? In the first part, we meet Joel at the onset of the pandemic. We don&#8217;t know much about him before then but all signs point to an average joe and a good dad. Then his daughter gets murdered and we skip 20 years, by which time we are to understand that Joel is\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">not<\/em>\u00a0a good man anymore. We learn that he was a killer, a robber, smuggler. He says he killed innocent people, he robbed (and presumably killed) good samaritans. He absolutely did not care for Ellie in the least at first. He wanted to abandon her to the soldiers and run when they caught up to them in Boston. It was Tess who made him stop.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n In the first game, Joel was a &#8220;bad person,&#8221; a broken man who then had his redemption by protecting (and ultimately caring for) Ellie. (More on the &#8220;bad person&#8221; in quotes later.)\n<\/p>\n<h3 class=\"_1qeIAgB0cPwnLhDF9XSiJM\" id=\"abby\"><strong class=\"_12FoOEddL7j_RgMQN0SNeU\">Abby<\/strong><\/h3>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n Abby&#8217;s journey is the same as Joel&#8217;s. Her dad gets murdered by a smuggler and that breaks her. She becomes a\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">bad person.<\/em> We&#8217;re made to understand that prior to the events in Seattle, she was a cold-hearted killer. She rose though the ranks of the WLF by becoming the &#8220;top scar killer&#8221; and even her friends think she&#8217;s, to steal Mel&#8217;s description, piece of sh*t. She&#8217;s a murderer.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n And then comes Lev. At first, she too doesn&#8217;t care too much. He is just a scar. You see how Abby dehumanizes the seraphites all the time, the difficulty she has with ever calling them anything other than &#8220;scars.&#8221; She leaves them there but then she feels guilty and, reluctantly at first, goes back to them.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n Abby was a &#8220;bad person&#8221;\u00a0who had her redemption by protecting and caring for Lev. In a way, Abby&#8217;s journey is what we would have seen if we were able to follow Joel through those 20 skipped years.\n<\/p>\n<h3 class=\"_1qeIAgB0cPwnLhDF9XSiJM\" id=\"ellie\"><strong class=\"_12FoOEddL7j_RgMQN0SNeU\">Ellie<\/strong><\/h3>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n This is where things get interesting. Ellie is living in Jackson the life that Joel and Abby lived\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">before<\/em>\u00a0their own traumatic events. When Joel dies, this matches the deaths of Joel&#8217;s daughter and Abby&#8217;s father. This is where Ellie is going to turn bad.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n And we see that transformation unfold. We see\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">our Ellie<\/em>\u00a0slowly go down the same path that Abby and Joel took years before and that we never got to see. She is consumed by rage.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n Ellie is now becoming a\u00a0&#8220;bad person&#8221;\u00a0as well. But she&#8217;s not all the way there yet.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n She&#8217;s also consumed by remorse. When she tortures\u00a0Nora, she comes back to Dina visibly shaking and saying &#8220;I made her talk&#8230;&#8221; She&#8217;s devastated about what she&#8217;s done. Later she kills Owen and pregnant Mel, and again, that\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">breaks<\/em> her. And yet, she cannot stop.\n<\/p>\n<h3 class=\"_1qeIAgB0cPwnLhDF9XSiJM\" id=\"ellie-vs-abby-why-didn8217t-ellie-kill-her\"><strong class=\"_12FoOEddL7j_RgMQN0SNeU\">Ellie vs Abby: why didn\u2019t Ellie kill her?<\/strong><\/h3>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n The final confrontation is amazing. Abby is now in a different place, she&#8217;s now where Joel was after Ellie. It&#8217;s hard for us to forgive her, because we have seen her kill Joel, but nevertheless, that&#8217;s the place she is in. When Ellie cuts her down from that beach post, her first reaction is to run and cut Lev down. Lev is her Ellie. She doesn&#8217;t want to fight Ellie, she only wants to save Lev, just like Joel only cared about saving Ellie at the end.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n But Ellie still can&#8217;t let go. She needs this! Or so she thinks. And so they fight. The fight fell heavy and, to me, very real. It was amazing and painful to watch and even worse to participate in. I did not want to fight Abby. All I wanted was for those two women to find peace now.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n And then Ellie is about to kill her and she remembers Joel. More specifically, she remembers her very last conversation with Joel, about her inability to forgive but willingness to try. She also sees the changed man, who changed <em class=\"_7s4syPYtk5hfUIjySXcRE\">for and because<\/em> of her, the man who went from &#8220;bad&#8221; to <em class=\"_7s4syPYtk5hfUIjySXcRE\">a &#8220;good&#8221; person<\/em>. Killing Abby &#8212; who&#8217;s now on her own redemption path &#8212; will only turn Ellie into the bad person that Abby and Joel were.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n And Ellie stops the cycle. She will\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">not<\/em>\u00a0go down the same road. She honours Joel by refusing to become a bad person, something Joel would never have wanted for her. She will honour Joel by going back to the life\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">both of them<\/em>\u00a0wanted for her.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n Will she get it? Will JJ and Dina be waiting back in Jackson? We may never know, but I sure hope so.\n<\/p>\n<h3 id=\"8220bad-people8221\">\u201cBad people\u201d<\/h3>\n<p>I think the biggest takeaway for me in this painful, yet wonderful journey of a game is how none of the protagonists were good or bad. Everybody is the hero of their own story. Since we played the first game as Joel with Ellie, that is\u00a0<em>our<\/em> story and we are entirely on their side. But they were not \u201cgood,\u201d not when it comes to the many lives they took over the course of their journey. We saw all those kills as completely justified: they were goons, they were going to shoot us! But then, from their perspective, they were doing the same thing we were. And the thing is, that doesn\u2019t mean everyone is equally justified. It only means that\u00a0<em>from their own points of view<\/em>, Ellie and Joel were the villains.<\/p>\n<p>If doesn\u2019t matter if we believe Joel was justified in taking Ellie from the hospital: from the point of view of Abby, her loving dad was murdered. It\u2019s also not about convincing you and me that there are not moral absolutes. It\u2019s that none of this matters\u00a0<em>to the characters themselves<\/em>.<\/p>\n<h2 class=\"_7T4UafM1PdBGycd5na9nF\" id=\"conclusions\">Conclusions<\/h2>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n Again, I&#8217;ve finished this game almost 24 hours ago and I am still thinking about it. This game made me\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">feel<\/em>\u00a0so many feelings. It made me mad, sad, and happy. Art that gets you to feel something is, well, good art in my book.\n<\/p>\n<p class=\"_1qeIAgB0cPwnLhDF9XSiJM\">\n If you hated this game, it&#8217;s fine. We can&#8217;t all love the same thing. I am not trying to convince anyone, just sharing what\u00a0<em class=\"_7s4syPYtk5hfUIjySXcRE\">I<\/em>\u00a0felt. I absolutely loved it with all my heart. This game will stay with me for a long time.\n<\/p>"},{"title":"Zero values in Go and Lazy Initialization","link":"https:\/\/rselbach.com\/zero-values-in-go-and-lazy-initialization\/","pubDate":"Mon, 17 Dec 2018 13:40:11 +0000","guid":"https:\/\/rselbach.com\/zero-values-in-go-and-lazy-initialization\/","description":"<p>I\u2019m a big fan of the way Go does <em>zero values<\/em>, meaning it initializes every variable to a default value. This is in contrast with the way other languages such as, say, C behave. For instance, the printed result of the following C program is unpredictable.<\/p>\n<pre><code>#include &lt;stdio.h&gt;\n\nint main(void) {\n int i;\n printf(&quot;%d\\n&quot;, i);\n return 0;\n\n}\n<\/code><\/pre>\n<p>The value of <code>i<\/code> will be whatever happens to be at the position in memory where the compiler happened to allocate the variable. Contrast this with the equivalent program in Go \u2014<\/p>\n<pre><code>package main\n\nimport &quot;fmt&quot;\n\nfunc main() {\n var i int\n fmt.Println(i)\n}\n<\/code><\/pre>\n<p>This will always print `` because <code>i<\/code> is initialized by the compiler to the default value of an <code>int<\/code>, which happens to be 0.<\/p>\n<p>This happens for <em>every<\/em> variable of <em>any<\/em> type, including our own custom types. What\u2019s even cooler is that this is done recursively, so if you the fields inside a <code>struct<\/code> will also be themselves initialized.<\/p>\n<p>I strive to make all my zero values useful, but it\u2019s not always that simple. Sometimes you need to use different default values for your fields, or maybe you need to initialize one of those fields. This is especially important when we remember that <strong>the zero value of a pointer is nil<\/strong>.<\/p>\n<p>Imagine the following type \u2014<\/p>\n<pre><code>type Foobar struct {\n db *DB\n}\n\nfunc NewFoobar() *Foobar {\n return &amp;Foobar{db: DB.New()}\n}\n\nfunc (f *Foobar) Get(key string) (*Foo, error) {\n foo, err := db.Get(key)\n if err != nil {\n return nil, err\n }\n return foo, nil\n}\n<\/code><\/pre>\n<p>In the example above, our zero value is no longer useful: we\u2019d cause a runtime error because <code>db<\/code> will be <code>nil<\/code> inside the <code>Get()<\/code> function. We\u2019re forced to call <code>NewFoobar()<\/code> before using our functions.<\/p>\n<p>But there\u2019s a simple trick to make the <code>Foobar<\/code> zero value useful again. As it turns out, being lazy sometimes pays off. Our technique is called <em>lazy initialization<\/em> \u2014<\/p>\n<pre><code>type Foobar struct {\n dbOnce sync.Once\n db *DB\n}\n\n\/\/ lazy initialize db\nfunc (f *Foobar) lazyInit() {\n f.dbOnce.Do(func() {\n f.db = DB.New()\n })\n}\n<\/code><\/pre>\n<p>We added a <a href=\"https:\/\/golang.org\/pkg\/sync\/#Once\"><code>sync.Once<\/code><\/a> to our type. From the Go docs:<\/p>\n<blockquote>\n<p>Once an object that will perform exactly one action.<\/p>\n<\/blockquote>\n<p>The function we pass to <a href=\"https:\/\/golang.org\/pkg\/sync\/#Once.Do\"><code>sync.Once.Do()<\/code><\/a> is guaranteed to run <em>once<\/em> and <em>only once<\/em>, so it is perfect for initializations. Now we can call <code>lazyInit()<\/code> at the top of our exported function and it will ensure <code>db<\/code> is initialized \u2014<\/p>\n<pre><code>func (f *Foobar) Get(key string) (*Foo, error) {\n f.lazyInit()\n\n foo, err := db.Get(key)\n if err != nil {\n return nil, err\n }\n return foo, nil\n}\n\n...\n\nvar f Foobar\nfoo, err := f.Get(&quot;baz&quot;)\n<\/code><\/pre>\n<p>We are now free to use our zero value with no additional initialization. I love it.<\/p>\n<p>Of course, it is not always possible to use zero values. For example, our <code>Foobar<\/code> assumes a magical object <code>DB<\/code> that can be initialized by itself, but in real life we probably need to connect to an external database, authenticate, etc and then pass the created <code>DB<\/code> to our <code>Foobar<\/code>.<\/p>\n<p>Still, using lazy initialization allows us to make a lot of objects\u2019 zero values useful that would otherwise not be.<\/p>"},{"title":"Playing with Go module proxies","link":"https:\/\/rselbach.com\/go-proxies\/","pubDate":"Wed, 29 Aug 2018 19:13:50 +0000","guid":"https:\/\/rselbach.com\/go-proxies\/","description":"<p>(This article has been graciously <a href=\"https:\/\/vectorified.com\/ru-go-proxies\">translated to Russian here<\/a>. Huge thanks to <a href=\"https:\/\/vectorified.com\/\">Akhmad Karimov<\/a>.)<\/p>\n<p>I wrote a <a href=\"https:\/\/rselbach.com\/intro-to-go-modules\/\">brief introduction to Go modules<\/a> and in it I talked briefly about Go modules proxies and now that <a href=\"https:\/\/blog.golang.org\/go1.11\">Go 1.11 is out<\/a>, I thought I\u2019d play a bit these proxies to figure our how they\u2019re supposed to work.<\/p>\n<h1 id=\"why\">Why<\/h1>\n<p>One of the goals of Go modules is to provide reproducible builds and it does a very good job by fetching the correct and expected files from a repository.<\/p>\n<p>But what if the <a href=\"https:\/\/blog.github.com\/2016-02-03-january-28th-incident-report\/\">servers<\/a> <a href=\"https:\/\/blog.bitbucket.org\/2012\/09\/19\/post-mortem-on-our-availability-earlier-today\/\">are<\/a> <a href=\"https:\/\/about.gitlab.com\/2017\/02\/10\/postmortem-of-database-outage-of-january-31\/\">offline<\/a>? What if the repository <a href=\"https:\/\/www.theregister.co.uk\/2016\/03\/23\/npm_left_pad_chaos\/\">simply vanishes<\/a>?<\/p>\n<p>One way teams deal with these risks is by vendoring the dependencies, which is fine. But Go modules offers another way: the use of a module proxy.<\/p>\n<h1 id=\"the-download-protocol\">The Download Protocol<\/h1>\n<p>When Go modules support is enabled and the <code>go<\/code> command determines that it needs a module, it first looks at the local cache (under <code>$GOPATH\/pkg\/mods<\/code>). If it can\u2019t find the right files there, it then goes ahead and fetches the files from the network (i.e. from a remote repo hosted on Github, Gitlab, etc.)<\/p>\n<p>If we want to control what files <code>go<\/code> can download, we need to tell it to go through our proxy by setting the <code>GOPROXY<\/code> environment variable to point to our proxy\u2019s URL. For instance:<\/p>\n<pre><code>export GOPROXY=http:\/\/gproxy.mycompany.local:8080\n<\/code><\/pre>\n<p>The proxy is nothing but a web server that responds to the module download protocol, which is a very simple API to query and fetch modules. The web server may even serve static files.<\/p>\n<p>A typical scenario would be the <code>go<\/code> command trying to fetch <code>github.com\/pkg\/errors<\/code>:<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_e2116515e438fb80.webp 320w, https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_602695c5108d673f.webp 480w, https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_8acd6e31448bec74.webp 640w, https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_1aa63827aa9a757b.webp 800w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/go-proxies\/goproxyseq.png\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"800\" height=\"334\" srcset=\"https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_f79ab5f401ce078b.png 320w, https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_a8ec5017b275f4af.png 480w, https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_81914c2798a4c428.png 640w, https:\/\/rselbach.com\/go-proxies\/goproxyseq_hu_c2beb9149487fbac.png 800w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>The first thing <code>go<\/code> will do is ask the proxy for a list of available versions. It does this by making a <code>GET<\/code> request to <code>\/{module name}\/@v\/list<\/code>. The server then responds with a simple list of versions it has available:<\/p>\n<pre><code>v0.8.0\nv0.7.1\n<\/code><\/pre>\n<p>The <code>go<\/code> will determine which version it wants to download \u2014 the latest unless explicitly told otherwise<sup id=\"fnref-1943-0\"><a href=\"#fn-1943-0\">1<\/a><\/sup>. It will then request information about that given version by issuing a <code>GET<\/code> request to <code>\/{module name}\/@v\/{module revision}<\/code> to which the server will reply with a JSON representation of the <code>struct<\/code>:<\/p>\n<pre><code>type RevInfo struct {\n Version string \/\/ version string\n Name string \/\/ complete ID in underlying repository\n Short string \/\/ shortened ID, for use in pseudo-version\n Time time.Time \/\/ commit time\n}\n<\/code><\/pre>\n<p>So for instance, we might get something like this:<\/p>\n<pre><code>{\n &quot;Version&quot;: &quot;v0.8.0&quot;,\n &quot;Name&quot;: &quot;v0.8.0&quot;,\n &quot;Short&quot;: &quot;v0.8.0&quot;,\n &quot;Time&quot;: &quot;2018-08-27T08:54:46.436183-04:00&quot;\n}\n<\/code><\/pre>\n<p>The <code>go<\/code> command will then request the module\u2019s <code>go.mod<\/code> file by making a <code>GET<\/code> request to <code>\/{module name}\/@v\/{module revision}.mod<\/code>. The server will simply respond with the contents of the <code>go.mod<\/code> file (e.g. <code>module github.com\/pkg\/errors<\/code>.) This file may list additional dependencies and the cycle restarts for each one.<\/p>\n<p>Finally, the <code>go<\/code> command will request the actual module by getting <code>\/{module name}\/@v\/{module revision}.zip<\/code>. The server should respond with a byte blob (<code>application\/zip<\/code>) containing a zip archive with the module files where each file <em>must<\/em> be prefixed by the full module path <em>and<\/em> version (e.g. <code>github.com\/pkg\/errors@v0.8.0\/<\/code>), i.e. the archive should contain:<\/p>\n<pre><code>github.com\/pkg\/errors@v0.8.0\/example_test.go\ngithub.com\/pkg\/errors@v0.8.0\/errors_test.go\ngithub.com\/pkg\/errors@v0.8.0\/LICENSE\n...\n<\/code><\/pre>\n<p>And <em>not<\/em>:<\/p>\n<pre><code>errors\/example_test.go\nerrors\/errors_test.go\nerrors\/LICENSE\n...\n<\/code><\/pre>\n<p>This seems like a lot when written like this, but it\u2019s in fact a very simple protocol that simply fetches 3 or 4 files:<\/p>\n<ol>\n<li>The list of versions (only if <code>go<\/code> does not already know which version it wants)<\/li>\n<li>The module metadata<\/li>\n<li>The <code>go.mod<\/code> file<\/li>\n<li>The module zip itself<\/li>\n<\/ol>\n<h1 id=\"creating-a-simple-local-proxy\">Creating a simple local proxy<\/h1>\n<p>To try out the proxy support, let\u2019s create a very basic proxy that will serve static files from a directory. First we create a directory where we will store our in-site copies of our dependencies. Here\u2019s what I have in mine:<\/p>\n<pre><code>$ find . -type f\n.\/github.com\/robteix\/testmod\/@v\/v1.0.0.mod\n.\/github.com\/robteix\/testmod\/@v\/v1.0.1.mod\n.\/github.com\/robteix\/testmod\/@v\/v1.0.1.zip\n.\/github.com\/robteix\/testmod\/@v\/v1.0.0.zip\n.\/github.com\/robteix\/testmod\/@v\/v1.0.0.info\n.\/github.com\/robteix\/testmod\/@v\/v1.0.1.info\n.\/github.com\/robteix\/testmod\/@v\/list\n<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>These are the files our proxy will serve. You can <a href=\"https:\/\/github.com\/robteix\/go-proxy-blog\">find these files on Github<\/a> if you\u2019d like to play along. For the examples below, let\u2019s assume we have a <code>devel<\/code> directory under our home directory; adapt accordingly.<\/p>\n<pre><code>$ cd $HOME\/devel\n$ git clone https:\/\/github.com\/robteix\/go-proxy-blog.git\n<\/code><\/pre>\n<p>Our proxy server is simple (it could be even simpler, but I wanted to log the requests):<\/p>\n<pre><code>package main\n\nimport (\n &quot;flag&quot;\n &quot;log&quot;\n &quot;net\/http&quot;\n)\n\nfunc main() {\n addr := flag.String(&quot;http&quot;, &quot;:8080&quot;, &quot;address to bind to&quot;)\n flag.Parse()\n\n dir := &quot;.&quot;\n if flag.NArg() &gt; 0 {\n dir = flag.Arg(0)\n }\n\n log.Printf(&quot;Serving files from %s on %s\\n&quot;, dir, *addr)\n\n h := handler{http.FileServer(http.Dir(dir))}\n\n panic(http.ListenAndServe(*addr, h))\n}\n\ntype handler struct {\n h http.Handler\n}\n\nfunc (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n log.Println(&quot;New request:&quot;, r.URL.Path)\n h.h.ServeHTTP(w, r)\n}\n<\/code><\/pre>\n<p>Now run the code above:<\/p>\n<pre><code>$ go run proxy.go -http :8080 $HOME\/devel\/go-proxy-blog\n2018\/08\/29 14:14:31 Serving files from \/home\/robteix\/devel\/go-proxy-blog on :8080\n\n$ curl http:\/\/localhost:8080\/github.com\/robteix\/testmod\/@v\/list\nv1.0.0\nv1.0.1\n<\/code><\/pre>\n<p>Leave the proxy running and move to a new terminal. Now let\u2019s create a new test program. we create a new directory <code>$HOME\/devel\/test<\/code> and create a file named <code>test.go<\/code> inside it with the following code:<\/p>\n<pre><code>package main\n\nimport (\n &quot;github.com\/robteix\/testmod&quot;\n)\n\nfunc main() {\n testmod.Hi(&quot;world&quot;)\n}\n<\/code><\/pre>\n<p>And now, inside this directory, let\u2019s enable Go modules:<\/p>\n<pre><code>$ go mod init test\n<\/code><\/pre>\n<p>And we set the <code>GOPROXY<\/code> variable:<\/p>\n<pre><code>export GOPROXY=http:\/\/localhost:8080\n<\/code><\/pre>\n<p>Now let\u2019s try building our new program:<\/p>\n<pre><code>$ go build\ngo: finding github.com\/robteix\/testmod v1.0.1\ngo: downloading github.com\/robteix\/testmod v1.0.1\n<\/code><\/pre>\n<p>And if you check the output from our proxy:<\/p>\n<pre><code>2018\/08\/29 14:56:14 New request: \/github.com\/robteix\/testmod\/@v\/list\n2018\/08\/29 14:56:14 New request: \/github.com\/robteix\/testmod\/@v\/v1.0.1.info\n2018\/08\/29 14:56:14 New request: \/github.com\/robteix\/testmod\/@v\/v1.0.1.mod\n2018\/08\/29 14:56:14 New request: \/github.com\/robteix\/testmod\/@v\/v1.0.1.zip\n<\/code><\/pre>\n<p>So as long as <code>GOPROXY<\/code> is set, <code>go<\/code> will only download files from out proxy. If I go ahead and delete the repository from Github, things will continue to work.<\/p>\n<h1 id=\"using-a-local-directory\">Using a local directory<\/h1>\n<p>It is interesting to note that we don\u2019t even need our <code>proxy.go<\/code> at all. We can set <code>GOPROXY<\/code> to point to a directory in the filesystem and things will still work as expected:<\/p>\n<pre><code>export GOPROXY=file:\/\/home\/robteix\/devel\/go-proxy-blog\n<\/code><\/pre>\n<p>If we do a <code>go build<\/code> now<sup id=\"fnref-1943-1\"><a href=\"#fn-1943-1\">2<\/a><\/sup>, we\u2019ll see <em>exactly<\/em> the same thing as with the proxy:<\/p>\n<pre><code>$ go build\ngo: finding github.com\/robteix\/testmod v1.0.1\ngo: downloading github.com\/robteix\/testmod v1.0.1\n<\/code><\/pre>\n<p>Of course, in real life, we probably will prefer to have a company\/team proxy server where our dependencies are stored, because a local directory is not really much different from the local cache that <code>go<\/code> already maintains under <code>$GOPATH\/pkg\/mod<\/code>, but still, nice to know that it works.<\/p>\n<p>There is a <a href=\"https:\/\/github.com\/gomods\/athens\">project called Athens<\/a> that is building a proxy and that aims \u2014 if I don\u2019t misunderstand it \u2014 to create a central repository of packages \u00e0 la npm.<\/p>\n<li id=\"fn-1943-0\">\n Remember that <code>somepackage<\/code> and <code>somepackage\/v2<\/code> are treated as different packages.&#160;<a href=\"#fnref-1943-0\">&#8617;<\/a>\n<\/li>\n<li id=\"fn-1943-1\">\n That&#8217;s not strictly true as now that we&#8217;ve already built it once, <code>go<\/code> has cached the module locally and will not go to the proxy (or the network) at all. You can still force it by deleting <code>$GOPATH\/pkg\/mod\/cache\/download\/github.com\/robteix\/testmod\/<\/code> and <code>$GOPATH\/pkg\/mod\/github.com\/robteix\/testmod@v1.0.1<\/code>)&#160;<a href=\"#fnref-1943-1\">&#8617;<\/a> <\/fn><\/footnotes>"},{"title":"Introduction to Go Modules","link":"https:\/\/rselbach.com\/intro-to-go-modules\/","pubDate":"Sat, 18 Aug 2018 18:08:20 +0000","guid":"https:\/\/rselbach.com\/intro-to-go-modules\/","description":"<p>This post is also available in other languages:<\/p>\n<ul>\n<li>Russian: <a href=\"https:\/\/howtorecover.me\/vvedenie-v-go-modules\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043c\u043e\u0434\u0443\u043b\u0438 Go<\/a><\/li>\n<li>Uzbek: <a href=\"https:\/\/pngflare.com\/uz-go-modules\">Go modullariga kirish<\/a><\/li>\n<\/ul>\n<p>The upcoming version 1.11 of the Go programming language will bring experimental support for\u00a0<em>modules<\/em>, a new dependency management system for Go. A few days ago, <a href=\"https:\/\/rselbach.com\/playing-with-go-modules\/\">I wrote a quick post about it<\/a>. Since that post went live, things changed a bit and as we\u2019re now very close to the new release, I thought it would be a good time for another post with a more hands-on approach. So here\u2019s what we\u2019ll do: we\u2019ll create a new package and then we\u2019ll make a few releases to see how that would work.<\/p>\n<h2 class=\"wp-block-heading\" id=\"creating-a-module\">Creating a Module<\/h2>\n<p>So first things first. Let\u2019s create our package. We\u2019ll call it \u201ctestmod\u201d. An important detail here: **this directory should be\u00a0**<strong><em>outside<\/em><\/strong> <strong>your<\/strong> <strong><code>$GOPATH<\/code><\/strong> <strong>because by default, the modules support is disabled inside it<\/strong>. Go modules is a first step in potentially eliminating <code>$GOPATH<\/code> entirely at some point.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ mkdir testmod\n<\/span><\/span><span style=\"display:flex;\"><span>$ cd testmod\n<\/span><\/span><\/code><\/pre><\/div><p>Our package is very simple:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">package<\/span> <span style=\"color:#a6e22e\">testmod<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">import<\/span> <span style=\"color:#e6db74\">&#34;fmt&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#75715e\">\/\/ Hi returns a friendly greeting<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">Hi<\/span>(<span style=\"color:#a6e22e\">name<\/span> <span style=\"color:#66d9ef\">string<\/span>) <span style=\"color:#66d9ef\">string<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Sprintf<\/span>(<span style=\"color:#e6db74\">&#34;Hi, %s&#34;<\/span>, <span style=\"color:#a6e22e\">name<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>The package is done but it is still not a <em>module<\/em>. Let\u2019s change that.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go mod init github.com\/robteix\/testmod\n<\/span><\/span><span style=\"display:flex;\"><span>go: creating new go.mod: module github.com\/robteix\/testmod\n<\/span><\/span><\/code><\/pre><\/div><p>This creates a new file named <code>go.mod<\/code> in the package directory with the following contents:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>module github.com\/robteix\/testmod\n<\/span><\/span><\/code><\/pre><\/div><p>Not a lot here, but this effectively turns our package into a\u00a0<em>module<\/em>. We can now push this code to a repository:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ git init\n<\/span><\/span><span style=\"display:flex;\"><span>$ git add *\n<\/span><\/span><span style=\"display:flex;\"><span>$ git commit -am <span style=\"color:#e6db74\">&#34;First commit&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>$ git push -u origin master\n<\/span><\/span><\/code><\/pre><\/div><p>Until now, anyone willing to use this package would <code>go get<\/code>\u00a0it:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go get github.com\/robteix\/testmod\n<\/span><\/span><\/code><\/pre><\/div><p>And this would fetch the latest code in <code>master<\/code>. This still works, but we should probably stop doing that now that we have a Better Way\u2122. Fetching <code>master<\/code> is inherently dangerous as we can never know for sure that the package authors didn\u2019t make change that will break our usage. That\u2019s what modules aims at fixing.<\/p>\n<h2 class=\"wp-block-heading\" id=\"quick-intro-to-module-versioning\">Quick Intro to Module Versioning<\/h2>\n<p>Go modules are\u00a0<em>versioned<\/em>, and there are some particularities with regards to certain versions. You will need to familiarize yourself with the concepts behind <a href=\"https:\/\/semver.org\">semantic versioning<\/a>.<\/p>\n<p>More importantly, Go will use repository tags when looking for versions, and some versions are different of others: e.g. versions 2 and greater should have a different import path than versions 0 and 1 (we\u2019ll get to that.) As well, by default Go will fetch the latest <em>tagged version<\/em> available in a repository. This is an important gotcha as you may be used to working with the master branch. What you need to keep in mind for now is that to make a release of our package, we need to tag our repository with the version. So let\u2019s do that.<\/p>\n<h2 class=\"wp-block-heading\" id=\"making-our-first-release\">Making our first release<\/h2>\n<p>Now that our package is ready, we can release it to the world. We do this by using version tags. Let\u2019s release our version 1.0.0:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ git tag v1.0.0\n<\/span><\/span><span style=\"display:flex;\"><span>$ git push --tags\n<\/span><\/span><\/code><\/pre><\/div><p>This creates a tag on my Github repository marking the current commit as being the release 1.0.0.<\/p>\n<p>Go doesn\u2019t enforce that in any way, but a good idea is to also create a new branch (\u201cv1\u201d) so that we can push bug fixes to.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ git checkout -b v1\n<\/span><\/span><span style=\"display:flex;\"><span>$ git push -u origin v1\n<\/span><\/span><\/code><\/pre><\/div><p>Now we can work on <code>master<\/code> without having to worry about breaking our release.<\/p>\n<h2 class=\"wp-block-heading\" id=\"using-our-module\">Using our module<\/h2>\n<p>Now we\u2019re ready to use the module. We\u2019ll create a simple program that will use our new package:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">package<\/span> <span style=\"color:#a6e22e\">main<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">import<\/span> (\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;fmt&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;github.com\/robteix\/testmod&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">main<\/span>() {\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Println<\/span>(<span style=\"color:#a6e22e\">testmod<\/span>.<span style=\"color:#a6e22e\">Hi<\/span>(<span style=\"color:#e6db74\">&#34;roberto&#34;<\/span>))\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>Until now, you would do a <code>go get github.com\/robteix\/testmod<\/code> to download the package, but with modules, this gets more interesting. First we need to enable modules in our new program.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go mod init mod\n<\/span><\/span><\/code><\/pre><\/div><p>As you\u2019d expect from what we\u2019ve seen above, this will have created a new <code>go.mod<\/code> file with the module name in it:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>module mod\n<\/span><\/span><\/code><\/pre><\/div><p>Things get much more interesting when we try to build our new program:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go build\n<\/span><\/span><span style=\"display:flex;\"><span>go: finding github.com\/robteix\/testmod v1.0.0\n<\/span><\/span><span style=\"display:flex;\"><span>go: downloading github.com\/robteix\/testmod v1.0.0\n<\/span><\/span><\/code><\/pre><\/div><p>As we can see, the <code>go<\/code> command automatically goes and fetches the packages imported by the program. If we check our <code>go.mod<\/code> file, we see that things have changed:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>module mod\n<\/span><\/span><span style=\"display:flex;\"><span>require github.com\/robteix\/testmod v1.0.0\n<\/span><\/span><\/code><\/pre><\/div><p>And we now have a new file too, named <code>go.sum<\/code>, which contains hashes of the packages, to ensure that we have the correct version and files.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>github.com\/robteix\/testmod v1.0.0 h1:9EdH0EArQ\/rkpss9Tj8gUnwx3w5p0jkzJrd5tRAhxnA=\n<\/span><\/span><span style=\"display:flex;\"><span>github.com\/robteix\/testmod v1.0.0\/go.mod h1:UVhi5McON9ZLc5kl5iN2bTXlL6ylcxE9VInV71RrlO8=\n<\/span><\/span><\/code><\/pre><\/div><h2 class=\"wp-block-heading\" id=\"making-a-bugfix-release\">Making a bugfix release<\/h2>\n<p>Now let\u2019s say we realized a problem with our package: the greeting is missing ponctuation! People are mad because our friendly greeting is not friendly enough. So we\u2019ll fix it and release a new version:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-diff\" data-lang=\"diff\"><span style=\"display:flex;\"><span>\/\/ Hi returns a friendly greeting\n<\/span><\/span><span style=\"display:flex;\"><span>func Hi(name string) string {\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">- return fmt.Sprintf(&#34;Hi, %s&#34;, name)\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">+ return fmt.Sprintf(&#34;Hi, %s!&#34;, name)\n<\/span><\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>We made this change in the v1 branch because it\u2019s not relevant for what we\u2019ll do for v2 later, but in real life, maybe you\u2019d do it in <code>master<\/code>\u00a0and then back-port it. Either way, we need to have the fix in our v1 branch and mark it as a new release.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ git commit -m <span style=\"color:#e6db74\">&#34;Emphasize our friendliness&#34;<\/span> testmod.go\n<\/span><\/span><span style=\"display:flex;\"><span>$ git tag v1.0.1\n<\/span><\/span><span style=\"display:flex;\"><span>$ git push --tags origin v1\n<\/span><\/span><\/code><\/pre><\/div><h2 class=\"wp-block-heading\" id=\"updating-modules\">Updating modules<\/h2>\n<p>By default, Go will not update modules without being asked. This is a Good Thing\u2122 as we want predictability in our builds. If Go modules were automatically updated every time a new version came out, we\u2019d be back in the uncivilized age pre-Go1.11. No, we need to\u00a0<em>tell<\/em> Go to update a modules for us.<\/p>\n<p>We do this by using our good old friend <code>go get<\/code>:<\/p>\n<ul class=\"wp-block-list\">\n <li>\n run\u00a0<code>go get -u<\/code>\u00a0to use the latest\u00a0<i>minor or patch<\/i>\u00a0releases (i.e. it would update from 1.0.0 to, say, 1.0.1 or, if available, 1.1.0)\n <\/li>\n <li>\n run\u00a0<code>go get -u=patch<\/code>\u00a0to use the latest\u00a0<i>patch<\/i>\u00a0releases (i.e., would update to 1.0.1 but\u00a0<i>not<\/i> to 1.1.0)\n <\/li>\n <li>\n run <code>go get package@version<\/code>\u00a0to update to a specific version (say, <code>github.com\/robteix\/testmod@v1.0.1<\/code>)\n <\/li>\n<\/ul>\n<p>In the list above, there doesn\u2019t seem to be a way to update to the latest\u00a0<em>major<\/em> version. There\u2019s a good reason for that, as we\u2019ll see in a bit.<\/p>\n<p>Since our program was using version 1.0.0 of our package and we just created version 1.0.1,\u00a0<em>any<\/em> of the following commands will\u00a0update us to 1.0.1:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go get -u\n<\/span><\/span><span style=\"display:flex;\"><span>$ go get -u<span style=\"color:#f92672\">=<\/span>patch\n<\/span><\/span><span style=\"display:flex;\"><span>$ go get github.com\/robteix\/testmod@v1.0.1\n<\/span><\/span><\/code><\/pre><\/div><p>After running, say, <code>go get -u<\/code>\u00a0our <code>go.mod<\/code>\u00a0is changed to:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>module mod\n<\/span><\/span><span style=\"display:flex;\"><span>require github.com\/robteix\/testmod v1.0.1\n<\/span><\/span><\/code><\/pre><\/div><h2 class=\"wp-block-heading\" id=\"major-versions\">Major versions<\/h2>\n<p>According to semantic version semantics, a major version is\u00a0<em>different<\/em> than minors. Major versions can break backwards compatibility. From the point of view of Go modules, a major version is a\u00a0<em>different package<\/em> completely. This may sound bizarre at first, but it makes sense: two versions of a library that are not compatible with each other are two different libraries.<\/p>\n<p>Let\u2019s make a major change in our package, shall we? Over time, we realized our API was too simple, too limited for the use cases of our users, so we need to change the <code>Hi()<\/code>\u00a0function to take a new parameter for the greeting language:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">package<\/span> <span style=\"color:#a6e22e\">testmod<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">import<\/span> (\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;errors&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;fmt&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#75715e\">\/\/ Hi returns a friendly greeting in language lang<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">Hi<\/span>(<span style=\"color:#a6e22e\">name<\/span>, <span style=\"color:#a6e22e\">lang<\/span> <span style=\"color:#66d9ef\">string<\/span>) (<span style=\"color:#66d9ef\">string<\/span>, <span style=\"color:#66d9ef\">error<\/span>) {\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">switch<\/span> <span style=\"color:#a6e22e\">lang<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">case<\/span> <span style=\"color:#e6db74\">&#34;en&#34;<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Sprintf<\/span>(<span style=\"color:#e6db74\">&#34;Hi, %s!&#34;<\/span>, <span style=\"color:#a6e22e\">name<\/span>), <span style=\"color:#66d9ef\">nil<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">case<\/span> <span style=\"color:#e6db74\">&#34;pt&#34;<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Sprintf<\/span>(<span style=\"color:#e6db74\">&#34;Oi, %s!&#34;<\/span>, <span style=\"color:#a6e22e\">name<\/span>), <span style=\"color:#66d9ef\">nil<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">case<\/span> <span style=\"color:#e6db74\">&#34;es&#34;<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Sprintf<\/span>(<span style=\"color:#e6db74\">&#34;\u00a1Hola, %s!&#34;<\/span>, <span style=\"color:#a6e22e\">name<\/span>), <span style=\"color:#66d9ef\">nil<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">case<\/span> <span style=\"color:#e6db74\">&#34;fr&#34;<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Sprintf<\/span>(<span style=\"color:#e6db74\">&#34;Bonjour, %s!&#34;<\/span>, <span style=\"color:#a6e22e\">name<\/span>), <span style=\"color:#66d9ef\">nil<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">default<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#e6db74\">&#34;&#34;<\/span>, <span style=\"color:#a6e22e\">errors<\/span>.<span style=\"color:#a6e22e\">New<\/span>(<span style=\"color:#e6db74\">&#34;unknown language&#34;<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t}\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>Existing software using our API will break because they (a) don\u2019t pass a language parameter and (b) don\u2019t expect an error return. Our new API is no longer compatible with version 1.x so it\u2019s time to bump the version to 2.0.0.<\/p>\n<p>I mentioned before that some versions have some peculiarities, and this is the case now. **Versions 2\u00a0**<strong><em>and over<\/em><\/strong> <strong>should change the import path.<\/strong> They are different libraries now.<\/p>\n<p>We do this by appending a new\u00a0<em>version path<\/em> to the end of our module name.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>module github.com\/robteix\/testmod\/v2\n<\/span><\/span><\/code><\/pre><\/div><p>The rest is the same as before, we push it, tag it as v2.0.0 (and optionally create a v2 branch.)<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ git commit testmod.go -m <span style=\"color:#e6db74\">&#34;Change Hi to allow multilang&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>$ git checkout -b v2 <span style=\"color:#75715e\"># optional but recommended<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>$ echo <span style=\"color:#e6db74\">&#34;module github.com\/robteix\/testmod\/v2&#34;<\/span> &gt; go.mod\n<\/span><\/span><span style=\"display:flex;\"><span>$ git commit go.mod -m <span style=\"color:#e6db74\">&#34;Bump version to v2&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>$ git tag v2.0.0\n<\/span><\/span><span style=\"display:flex;\"><span>$ git push --tags origin v2 <span style=\"color:#75715e\"># or master if we don&#39;t have a branch<\/span>\n<\/span><\/span><\/code><\/pre><\/div><h2 class=\"wp-block-heading\" id=\"updating-to-a-major-version\">Updating to a major version<\/h2>\n<p>Even though we have released a new incompatible version of our library, existing software\u00a0<em>will not break<\/em>, because it will continue to use the existing version 1.0.1. <code>go get -u<\/code>\u00a0<em>will not<\/em> get version 2.0.0.<\/p>\n<p>At some point, however, I, as the library user, may want to upgrade to version 2.0.0 because maybe I was one of those users who needed multi-language support.<\/p>\n<p>I do it but modifying my program accordingly:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">package<\/span> <span style=\"color:#a6e22e\">main<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">import<\/span> (\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;fmt&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;github.com\/robteix\/testmod\/v2&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">main<\/span>() {\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">g<\/span>, <span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">testmod<\/span>.<span style=\"color:#a6e22e\">Hi<\/span>(<span style=\"color:#e6db74\">&#34;Roberto&#34;<\/span>, <span style=\"color:#e6db74\">&#34;pt&#34;<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#66d9ef\">nil<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\tpanic(<span style=\"color:#a6e22e\">err<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t}\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Println<\/span>(<span style=\"color:#a6e22e\">g<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>And then when I run <code>go build<\/code>, it will go and fetch version 2.0.0 for me. Notice how even though the import path ends with \u201cv2\u201d, Go will still refer to the module by its proper name (\u201ctestmod\u201d).<\/p>\n<p>As I mentioned before, the major version is for all intents and purposes a completely different package. Go modules does not link the two at all. That means we can use two incompatible versions in the same binary:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">package<\/span> <span style=\"color:#a6e22e\">main<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">import<\/span> (\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;fmt&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;github.com\/robteix\/testmod&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">testmodML<\/span> <span style=\"color:#e6db74\">&#34;github.com\/robteix\/testmod\/v2&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">main<\/span>() {\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Println<\/span>(<span style=\"color:#a6e22e\">testmod<\/span>.<span style=\"color:#a6e22e\">Hi<\/span>(<span style=\"color:#e6db74\">&#34;Roberto&#34;<\/span>))\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">g<\/span>, <span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">testmodML<\/span>.<span style=\"color:#a6e22e\">Hi<\/span>(<span style=\"color:#e6db74\">&#34;Roberto&#34;<\/span>, <span style=\"color:#e6db74\">&#34;pt&#34;<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#66d9ef\">nil<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\tpanic(<span style=\"color:#a6e22e\">err<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t}\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Println<\/span>(<span style=\"color:#a6e22e\">g<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>This eliminates a common problem with dependency management: when dependencies depend on different versions of the same library.<\/p>\n<h2 class=\"wp-block-heading\" id=\"tidying-it-up\">Tidying it up<\/h2>\n<p>Going back to the previous version that uses only testmod 2.0.0, if we check the contents of <code>go.mod<\/code>\u00a0now, we\u2019ll notice something:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>module mod\n<\/span><\/span><span style=\"display:flex;\"><span>require github.com\/robteix\/testmod v1.0.1\n<\/span><\/span><span style=\"display:flex;\"><span>require github.com\/robteix\/testmod\/v2 v2.0.0\n<\/span><\/span><\/code><\/pre><\/div><p>By default, Go does not remove a dependency from <code>go.mod<\/code>\u00a0unless you ask it to. If you have dependencies that you no longer use and want to clean up, you can use the new <code>tidy<\/code> command:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go mod tidy\n<\/span><\/span><\/code><\/pre><\/div><p>Now we\u2019re left with only the dependencies that are really being used.<\/p>\n<h2 class=\"wp-block-heading\" id=\"vendoring\">Vendoring<\/h2>\n<p>Go modules ignores the <code>vendor\/<\/code>\u00a0directory by default. The idea is to <em>eventually<\/em> do away with vendoring[^0]. But if we still want to add vendored dependencies to our version control, we can still do it:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go mod vendor\n<\/span><\/span><\/code><\/pre><\/div><p>This will create a <code>vendor\/<\/code>\u00a0directory under the root of your project containing the source code for all of your dependencies.<\/p>\n<p>Still, <code>go build<\/code>\u00a0will ignore the contents of this directory by default. If you want to build dependencies from the <code>vendor\/<\/code>\u00a0directory, you\u2019ll need to ask for it.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go build -mod vendor\n<\/span><\/span><\/code><\/pre><\/div><p>I expect many developers willing to use vendoring will run <code>go build<\/code> normally on their development machines and use <code>-mod vendor<\/code>\u00a0in their CI.<\/p>\n<p>Again, Go modules is moving away from the idea of vendoring and towards using a Go module proxy for those who don\u2019t want to depend on the upstream version control services directly.<\/p>\n<p>There are ways to guarantee that <code>go<\/code> will not reach the network at all (e.g. <code>GOPROXY=off<\/code>) but these are the subject for a future blog post.<\/p>\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n<p>This post may seem a bit daunting, but I tried to explain a lot of things together. The reality is that now Go modules is basically transparent. We import package like always in our code and the <code>go<\/code> command will take care of the rest.<\/p>\n<p>When we build something, the dependencies will be fetched automatically. It also eliminates the need to use <code>$GOPATH<\/code> which was a roadblock for new Go developers who had trouble understanding why things had to go into a specific directory.<\/p>\n<p><del datetime=\"2018-08-21T13:06:20+00:00\">Vendoring is (unofficially) being deprecated in favour of using proxies.<\/del>[^0] I may do a separate post about the Go module proxy. <em>(Update: <a href=\"https:\/\/rselbach.com\/go-proxies\/\">it\u2019s live<\/a>.) [^0]: I think this came out a bit too strong and people left with the impression that vendoring is being removed right now. It isn\u2019t. Vendoring still works, albeit slightly different than before. There seems to be a <em>desire<\/em> to replace vendoring with something better, which may or may not be a proxy. But for now this is just it: a desire for a better solution. Vendoring is not going away until a good replacement is found (if ever.)<\/em><\/p>"},{"title":"New licence plate","link":"https:\/\/rselbach.com\/new-licence-plate\/","pubDate":"Mon, 30 Jul 2018 12:51:35 +0000","guid":"https:\/\/rselbach.com\/new-licence-plate\/","description":"<p><em>Update: the licence plate application has since been refused. The reason given is that they don\u2019t allow offensive messages. All I can think of is that they misread it as being \u201cGOP HER,\u201d which doesn\u2019t mean anything but they may have assumed it was some code, new slang or something.<\/em><\/p>\n<p>I live in Quebec and only recently the province opened registrations for personalized license plates. At first I didn\u2019t even consider it, but this morning I impulse-bought one:<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/new-licence-plate\/image_hu_af4c421f0774952e.webp 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/new-licence-plate\/image.png\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"320\" height=\"161\" srcset=\"https:\/\/rselbach.com\/new-licence-plate\/image_hu_4849fcc2a045b8d9.png 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>This will of course be a homage to my favourite mascot, <a href=\"https:\/\/blog.golang.org\/gopher\">Go\u2019s<\/a>.<\/p>"},{"title":"Playing With Go Modules","link":"https:\/\/rselbach.com\/playing-with-go-modules\/","pubDate":"Fri, 20 Jul 2018 15:42:36 +0000","guid":"https:\/\/rselbach.com\/playing-with-go-modules\/","description":"<p><em>Update: much of this article has been rendered obsolete by changes made to Go modules since. <a href=\"https:\/\/rselbach.com\/intro-to-go-modules\/\">Check this more recent post that\u2019s up to date<\/a>.<\/em><\/p>\n<p>Had some free time in my hands, so I decided to check out the new Go modules. For those unaware, the next Go release (1.11) will include a new functionality that aims at addressing package management called \u201cmodules\u201d. It will still be marked as experimental, so things may very well change a lot.<\/p>\n<p>Here\u2019s how it works. Let\u2019s say we create a new package:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>rselbach@wile ~\/code $ mkdir foobar\n<\/span><\/span><span style=\"display:flex;\"><span>rselbach@wile ~\/code $ cd foobar\/\n<\/span><\/span><\/code><\/pre><\/div><p>Our <code>foobar.go<\/code> will be very simple:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">package<\/span> <span style=\"color:#a6e22e\">foobar<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">import<\/span> (\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">&#34;fmt&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">&#34;io&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">&#34;github.com\/pkg\/errors&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">WriteGreet<\/span>(<span style=\"color:#a6e22e\">w<\/span> <span style=\"color:#a6e22e\">io<\/span>.<span style=\"color:#a6e22e\">Writer<\/span>, <span style=\"color:#a6e22e\">name<\/span> <span style=\"color:#66d9ef\">string<\/span>) <span style=\"color:#66d9ef\">error<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">_<\/span>, <span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Fprintln<\/span>(<span style=\"color:#a6e22e\">w<\/span>, <span style=\"color:#e6db74\">&#34;Hello&#34;<\/span>, <span style=\"color:#a6e22e\">name<\/span>); <span style=\"color:#a6e22e\">err<\/span> <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#66d9ef\">nil<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">errors<\/span>.<span style=\"color:#a6e22e\">Wrapf<\/span>(<span style=\"color:#a6e22e\">err<\/span>, <span style=\"color:#e6db74\">&#34;Could not greet %s&#34;<\/span>, <span style=\"color:#a6e22e\">name<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#66d9ef\">nil<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>Notice we\u2019re using Dave Cheney\u2019s excellent <code>errors<\/code> package. Until now, <code>go get<\/code> would fetch whatever it found on that package\u2019s repository. If Dave ever decided to change something drastic in the package, our code would probably break without us even knowing about it until too late.<\/p>\n<p>That\u2019s where Go modules come into play, as it will help us (1) formalize the dependency and (2) lock a particular version of it to our code. First we need to turn on the support for modules in our package. We do this by using the new <code>go mod<\/code> command and giving out module a name:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go mod -init -module github.com\/rselbach\/foobar\n<\/span><\/span><span style=\"display:flex;\"><span>go: creating new go.mod: module github.com\/rselbach\/foobar\n<\/span><\/span><\/code><\/pre><\/div><p>After that, you will notice that a new file called <code>go.mod<\/code> will be created in our package root. For now, it only contains the module name we gave it above:<\/p>\n<pre><code>module github.com\/rselbach\/foobar\n<\/code><\/pre>\n<p>But it does more than that, for now the <code>go<\/code> command is aware that we are in a module-aware package and will behave accordingly. See what happens when we first try to build this:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go build\n<\/span><\/span><span style=\"display:flex;\"><span>go: finding github.com\/pkg\/errors v0.8.0\n<\/span><\/span><span style=\"display:flex;\"><span>go: downloading github.com\/pkg\/errors v0.8.0\n<\/span><\/span><\/code><\/pre><\/div><p>It sees that we are using an external package and then it goes out, finds the latest version of it, downloads it, and adds it to our <code>go.mod<\/code> file:<\/p>\n<pre><code>module github.com\/rselbach\/foobar\n\nrequire github.com\/pkg\/errors v0.8.0\n<\/code><\/pre>\n<p>From now one, whenever someone uses our package, Go will also download version 0.8.0 of Dave\u2019s errors package. If version 0.9.0 completely breaks compatibility, it will not break our code for it will continue to be compiled with correct version.<\/p>\n<p>If we change <code>go.mod<\/code> to require version 0.7.0, our next <code>go build<\/code> will fetch it as well:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go build\n<\/span><\/span><span style=\"display:flex;\"><span>go: finding github.com\/pkg\/errors v0.7.0\n<\/span><\/span><span style=\"display:flex;\"><span>go: downloading github.com\/pkg\/errors v0.7.0\n<\/span><\/span><\/code><\/pre><\/div><p>If you\u2019re wondering where the packages are, they\u2019re stored under <code>$GOPATH\/src\/mod<\/code>:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ ls -l ~\/go\/src\/mod\/github.com\/pkg\/\n<\/span><\/span><span style=\"display:flex;\"><span>total 0\n<\/span><\/span><span style=\"display:flex;\"><span>dr-xr-xr-x 13 rselbach staff 416 20 Jul 07:44 errors@v0.7.0\n<\/span><\/span><span style=\"display:flex;\"><span>dr-xr-xr-x 14 rselbach staff 448 20 Jul 07:40 errors@v0.8.0\n<\/span><\/span><\/code><\/pre><\/div><p><em>What about vendoring?<\/em><\/p>\n<p>Good thing you asked. This is where I don\u2019t like Go modules\u2019 approach. It specifically aims at doing away with vendoring. Versioning is obviously taken care of by the modules functionality itself while disponibility is supposed to be taken care of by something like caching proxies.<\/p>\n<p>I don\u2019t see it. First of all, not everybody is Google. Maintaining cache proxies is extra work that many organizations don\u2019t have the resources for. Also, what about when we\u2019re working from home? Or on the commute? Sure, a VPN solves this, but then it\u2019s one more thing we need to maintain.<\/p>\n<p>That doesn\u2019t mean you can\u2019t vendor with Go modules. It\u2019s simply not the default way it works. Let\u2019s see how it works though. Let\u2019s say we want to vendor our dependencies:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ go mod -vendor\n<\/span><\/span><span style=\"display:flex;\"><span>rselbach@wile ~\/code\/foobar $ ls -la\n<\/span><\/span><span style=\"display:flex;\"><span>total 24\n<\/span><\/span><span style=\"display:flex;\"><span>drwxr-xr-x 6 rselbach staff 192 20 Jul 08:01 .\n<\/span><\/span><span style=\"display:flex;\"><span>drwxr-xr-x 33 rselbach staff 1056 20 Jul 07:14 ..\n<\/span><\/span><span style=\"display:flex;\"><span>-rw-r--r-- 1 rselbach staff 252 20 Jul 07:22 foobar.go\n<\/span><\/span><span style=\"display:flex;\"><span>-rw-r--r-- 1 rselbach staff 72 20 Jul 07:43 go.mod\n<\/span><\/span><span style=\"display:flex;\"><span>-rw-r--r-- 1 rselbach staff 322 20 Jul 07:44 go.sum\n<\/span><\/span><span style=\"display:flex;\"><span>drwxr-xr-x 4 rselbach staff 128 20 Jul 08:01 vendor\n<\/span><\/span><\/code><\/pre><\/div><p>Notice how <code>go mod<\/code> now has created a <code>vendor<\/code> directory in our module root. Inside it you\u2019ll find the source code for the modules we are using. It also contains a file with a list of packages and versions:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>$ cat vendor\/modules.txt\n<\/span><\/span><span style=\"display:flex;\"><span># github.com\/pkg\/errors v0.7.0\n<\/span><\/span><span style=\"display:flex;\"><span>github.com\/pkg\/errors\n<\/span><\/span><\/code><\/pre><\/div><p>We can now add this to our repository. But it\u2019s not all done. Surprisingly, when modules support is enabled, the <code>go<\/code> command will ignore our <code>vendor<\/code> directory completely. In order to actually use our vendor directory, we need to explicitely tell <code>go build<\/code> to use it<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-console\" data-lang=\"console\"><span style=\"display:flex;\"><span>go build -v -getmode=vendor\n<\/span><\/span><\/code><\/pre><\/div><p>This essentially emulates the behaviour of previous version of Go.<\/p>"},{"title":"An LRU in Go (Part 2)","link":"https:\/\/rselbach.com\/an-lru-in-go-part-2\/","pubDate":"Fri, 15 Jun 2018 15:41:49 +0000","guid":"https:\/\/rselbach.com\/an-lru-in-go-part-2\/","description":"<p>So we created a concurrency-safe LRU in the last post, but it was too slow when used concurrently because of all the locking.<\/p>\n<p>Reducing the amount of time spent waiting on locks is actually not trivial, but not undoable. You can use things like the <code>sync\/atomic<\/code> package to cleverly change pointers back and forth with basically no locking needed. However, our situation is more complicated than that: we use two separate data structures that need to be updated atomically (the list itself and the index.) I don\u2019t know that we can do that with no mutexes.<\/p>\n<p>We can, however, easily lessen the amount of time spent waiting on mutexes by using <em>sharding<\/em>.<\/p>\n<p>You see, right now we have a single <code>list.List<\/code> to hold the data and a <code>map<\/code> for the index. This means that when one goroutine is trying to add, say, <code>{&quot;foo&quot;: &quot;bar&quot;}<\/code>, it has to wait until another finishes updating <code>{&quot;bar&quot; : &quot;baz&quot; }<\/code> because even though the two keys are not related at all, the lock needs to protect the entire list and index.<\/p>\n<p>A quick and easy way to go around this is to split the data structures into shards. Each shard has its own data structures:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">type<\/span> <span style=\"color:#a6e22e\">shard<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">cap<\/span> <span style=\"color:#66d9ef\">int<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">len<\/span> <span style=\"color:#66d9ef\">int32<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">sync<\/span>.<span style=\"color:#a6e22e\">Mutex<\/span> <span style=\"color:#75715e\">\/\/ protects the index and list<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">idx<\/span> <span style=\"color:#66d9ef\">map<\/span>[<span style=\"color:#66d9ef\">interface<\/span>{}]<span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">Element<\/span> <span style=\"color:#75715e\">\/\/ the index for our list<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">List<\/span> <span style=\"color:#75715e\">\/\/ the actual list holding the data<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>And so now, our LRU looks a bit different:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">type<\/span> <span style=\"color:#a6e22e\">LRU<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">cap<\/span> <span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#75715e\">\/\/ the max number of items to hold<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">nshards<\/span> <span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#75715e\">\/\/ number of shards<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">shardMask<\/span> <span style=\"color:#66d9ef\">int64<\/span> <span style=\"color:#75715e\">\/\/ mask used to select correct shard for key<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">shards<\/span> []<span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">shard<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>The methods in LRU are now also much simpler as all they do is call an equivalent method in a given shard:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> (<span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">LRU<\/span>) <span style=\"color:#a6e22e\">Add<\/span>(<span style=\"color:#a6e22e\">key<\/span>, <span style=\"color:#a6e22e\">val<\/span> <span style=\"color:#66d9ef\">interface<\/span>{}) {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">shard<\/span>(<span style=\"color:#a6e22e\">key<\/span>).<span style=\"color:#a6e22e\">add<\/span>(<span style=\"color:#a6e22e\">key<\/span>, <span style=\"color:#a6e22e\">val<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>So now it\u2019s time to figure out how to select the correct shard for a given key. In order to prevent two different values of the same key to be stored in two different shards, we need a given key to always return the same shard. We do this by passing a byte representation of the key through the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function\">Fowler\u2013Noll\u2013Vo hash function<\/a> to generate a hash as an <code>int32<\/code> number. We do a logical <code>AND<\/code> between this hash and a shard mask.<\/p>\n<p>The hard part is actually getting a byte representation of a key. It would be trivial if the key was of a fixed type (say, <code>int<\/code> or <code>string<\/code>) but we actually use <code>interface{}<\/code>, which gives us a bit more work to do. The <code>shard()<\/code> function actually is a large <code>type switch<\/code> that tries to find the quickest way possible to find the byte representation of any given type.<\/p>\n<p>For instance, if the type is <code>int<\/code>, we do:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">const<\/span> <span style=\"color:#a6e22e\">il<\/span> = <span style=\"color:#a6e22e\">strconv<\/span>.<span style=\"color:#a6e22e\">IntSize<\/span> <span style=\"color:#f92672\">\/<\/span> <span style=\"color:#ae81ff\">8<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">intBytes<\/span>(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#66d9ef\">int<\/span>) []<span style=\"color:#66d9ef\">byte<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span> <span style=\"color:#f92672\">:=<\/span> make([]<span style=\"color:#66d9ef\">byte<\/span>, <span style=\"color:#a6e22e\">il<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">0<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">1<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#f92672\">&gt;&gt;<\/span> <span style=\"color:#ae81ff\">8<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">2<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#f92672\">&gt;&gt;<\/span> <span style=\"color:#ae81ff\">16<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">3<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#f92672\">&gt;&gt;<\/span> <span style=\"color:#ae81ff\">24<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">il<\/span> <span style=\"color:#f92672\">==<\/span> <span style=\"color:#ae81ff\">8<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">4<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#f92672\">&gt;&gt;<\/span> <span style=\"color:#ae81ff\">32<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">5<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#f92672\">&gt;&gt;<\/span> <span style=\"color:#ae81ff\">40<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">6<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#f92672\">&gt;&gt;<\/span> <span style=\"color:#ae81ff\">48<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">b<\/span>[<span style=\"color:#ae81ff\">7<\/span>] = byte(<span style=\"color:#a6e22e\">i<\/span> <span style=\"color:#f92672\">&gt;&gt;<\/span> <span style=\"color:#ae81ff\">56<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">b<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>We do similar things to all of the known types. We also check for custom types that provide a <code>String() string<\/code> method (i.e. implement the <code>Stringer<\/code> interface.) This should allow for getting the byte representation for the vast majority of types people are likely to want to use as a key. If, however, the type is unknown and is not a Stringer (nor has a <code>Bytes() []byte<\/code> method), then we fall back to using <a href=\"https:\/\/golang.org\/pkg\/encoding\/gob\/#Encoder\">gob.Encoder<\/a>, which will work but is <em>very<\/em> slow to make it realistic usable.<\/p>\n<p>So what does all of this does for us? Now we never lock the entire LRU when doing operations, instead locking only small portions of it when needed, this results in my less time spent waiting for mutexes on average.<\/p>\n<p>We can play around with how many shards we want depending on how much data we store, but we can potentially have thousands of very small shards to provide very fine locking. Of course, since dealing with sharding does have a small overhead, at some point it is not worth adding more.<\/p>\n<p>The following benchmarks were done with 10000 shards and without concurrency \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>BenchmarkAdd\/mostly_new-4 1000000 1006 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkAdd\/mostly_existing-4 10000000 236 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGet\/mostly_found-4 5000000 571 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGet\/mostly_not_found-4 10000000 289 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemove\/mostly_found-4 3000000 396 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemove\/mostly_not_found-4 10000000 299 ns\/op\n<\/span><\/span><\/code><\/pre><\/div><p>And this with 10000 shards with concurrent access \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>BenchmarkAddParallel\/mostly_new-4 2000000 719 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkAddParallel\/mostly_existing-4 10000000 388 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGetParallel\/mostly_found-4 10000000 147 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGetParallel\/mostly_not_found-4 20000000 126 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemoveParallel\/mostly_found-4 10000000 142 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemoveParallel\/mostly_not_found-4 20000000 338 ns\/op\n<\/span><\/span><\/code><\/pre><\/div><p>Still, each shard still locks completely at every access, we might do better than that.<\/p>\n<p><a href=\"https:\/\/github.com\/rselbach\/lru_blogpost\/tree\/master\/sharded\/lru\">Source code on Github.<\/a><\/p>"},{"title":"An LRU in Go (Part 1)","link":"https:\/\/rselbach.com\/an-lru-in-go-part-1\/","pubDate":"Wed, 13 Jun 2018 14:35:39 +0000","guid":"https:\/\/rselbach.com\/an-lru-in-go-part-1\/","description":"<p>In my job, I often catch myself having to implement a way to keep data in memory so I can use them at a later time. Sometimes this is for caching purposes, sometimes it\u2019s to keep track of what I\u2019ve sent some other service earlier so I can create a diff or something. Reasons are plenty.<\/p>\n<p>I noticed that I keep writing versions of the same thing over and over and when we\u2019re doing that, maybe it\u2019s time to try and create a more generic solution. So let\u2019s start simple, shall we? What we want is to implement a least-recently-used list (LRU) with no fuss.<\/p>\n<h2 id=\"na\u00efve-lru\">Na\u00efve LRU<\/h2>\n<p>We start with a simple and very na\u00efve implementation (<a href=\"https:\/\/github.com\/rselbach\/lru_blogpost\/tree\/master\/naive\/lru\">see the full implementation on Github<\/a>.)<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">type<\/span> <span style=\"color:#a6e22e\">LRU<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">cap<\/span> <span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#75715e\">\/\/ the max number of items to hold<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">idx<\/span> <span style=\"color:#66d9ef\">map<\/span>[<span style=\"color:#66d9ef\">interface<\/span>{}]<span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">Element<\/span> <span style=\"color:#75715e\">\/\/ the index for our list<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">List<\/span> <span style=\"color:#75715e\">\/\/ the actual list holding the data<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>We don\u2019t have much there, we have a doubly-linked list <code>l<\/code> to hold the data and a <code>map<\/code> to serve as an index. In true Go fashion, we create an initializer \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">New<\/span>(<span style=\"color:#a6e22e\">cap<\/span> <span style=\"color:#66d9ef\">int<\/span>) <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">LRU<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#f92672\">&amp;<\/span><span style=\"color:#a6e22e\">LRU<\/span>{\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">cap<\/span>: <span style=\"color:#a6e22e\">cap<\/span>,\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>: <span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">New<\/span>(),\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">idx<\/span>: make(<span style=\"color:#66d9ef\">map<\/span>[<span style=\"color:#66d9ef\">interface<\/span>{}]<span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">Element<\/span>, <span style=\"color:#a6e22e\">cap<\/span><span style=\"color:#f92672\">+<\/span><span style=\"color:#ae81ff\">1<\/span>),\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#a6e22e\">l<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>This is nice. Package users will initialize the list with something like <code>l := lru.New(1000)<\/code> and joy will spread thoughout the land. But I strongly believe the empty value of a struct should also be usable, which is not the case here :<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">var<\/span> <span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#a6e22e\">LRU<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">Add<\/span>(<span style=\"color:#e6db74\">&#34;hello&#34;<\/span>, <span style=\"color:#e6db74\">&#34;world&#34;<\/span>)\n<\/span><\/span><\/code><\/pre><\/div><p>This will panic because neither <code>l<\/code> nor <code>idx<\/code> are initialized. My go-to solution for this is to always provide a simples unexported initialization function that is run at the beginning of each exported method and makes sure the initialization is done.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> (<span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">LRU<\/span>) <span style=\"color:#a6e22e\">lazyInit<\/span>() {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">==<\/span> <span style=\"color:#66d9ef\">nil<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">l<\/span> = <span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">New<\/span>()\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">idx<\/span> = make(<span style=\"color:#66d9ef\">map<\/span>[<span style=\"color:#66d9ef\">interface<\/span>{}]<span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">Element<\/span>, <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">cap<\/span><span style=\"color:#f92672\">+<\/span><span style=\"color:#ae81ff\">1<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>Now, let\u2019s see how we\u2019d add a new item to the list \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> (<span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">LRU<\/span>) <span style=\"color:#a6e22e\">Add<\/span>(<span style=\"color:#a6e22e\">k<\/span>, <span style=\"color:#a6e22e\">v<\/span> <span style=\"color:#66d9ef\">interface<\/span>{}) {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">lazyInit<\/span>()\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#75715e\">\/\/ first let&#39;s see if we already have this key<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">le<\/span>, <span style=\"color:#a6e22e\">ok<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">idx<\/span>[<span style=\"color:#a6e22e\">k<\/span>]; <span style=\"color:#a6e22e\">ok<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#75715e\">\/\/ update the entry and move it to the front<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">le<\/span>.<span style=\"color:#a6e22e\">Value<\/span>.(<span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">entry<\/span>).<span style=\"color:#a6e22e\">val<\/span> = <span style=\"color:#a6e22e\">v<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">MoveToFront<\/span>(<span style=\"color:#a6e22e\">le<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">idx<\/span>[<span style=\"color:#a6e22e\">k<\/span>] = <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">PushFront<\/span>(<span style=\"color:#f92672\">&amp;<\/span><span style=\"color:#a6e22e\">entry<\/span>{<span style=\"color:#a6e22e\">key<\/span>: <span style=\"color:#a6e22e\">k<\/span>, <span style=\"color:#a6e22e\">val<\/span>: <span style=\"color:#a6e22e\">v<\/span>})\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">cap<\/span> &gt; <span style=\"color:#ae81ff\">0<\/span> <span style=\"color:#f92672\">&amp;&amp;<\/span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">Len<\/span>() &gt; <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">cap<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">removeOldest<\/span>()\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>We call <code>lazyInit<\/code> to make sure everything is initialized than we check whether the key already is in our list. If it is, we only need to update the value and move it to the front of the list as it\u2019s now become the most-recently-used.<\/p>\n<p>If, however, the key was not already in our index, then we need to create a new entry and push it to the list. By the way, this is the first time we see <code>entry<\/code>, which is an unexported type that we actually store in our list.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">type<\/span> <span style=\"color:#a6e22e\">entry<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">key<\/span>, <span style=\"color:#a6e22e\">val<\/span> <span style=\"color:#66d9ef\">interface<\/span>{}\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>Finally, we check whether by adding the new element, we just passed the capacity of the list (if cap is less than 1, we treat as there being no limit to capacity, by the way). If we are over capacity, we go ahead and delete the oldest element in the list.<\/p>\n<p>This is a na\u00efve implementation, but it\u2019s also very fast.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>BenchmarkAdd\/mostly_new-4 2000000 742 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkAdd\/mostly_existing-4 10000000 153 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGet\/mostly_found-4 10000000 222 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGet\/mostly_not_found-4 20000000 143 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemove\/mostly_found-4 10000000 246 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemove\/mostly_not_found-4 20000000 142 ns\/op\n<\/span><\/span><\/code><\/pre><\/div><p>Getting and removing elements is in the same ballpark as accessing a built-in Go <code>map<\/code>. Getting an existing item adds a bit of overhead on top of accessing the <code>map<\/code> because it also needs to move the element to the front of the list, but that\u2019s a very fast pointer operation so it\u2019s not that bad.<\/p>\n<p>Adding has to check for an existing item as well as adding\/moving the list element, so it\u2019s relatively slower, but still good enough for my immediate needs.<\/p>\n<p>There is a big problem though. This implementation is not at all safe for concurrent use. Sure, package users could protect it with a <code>sync.Mutex<\/code> but we may want to hide the complexity from them.<\/p>\n<p>The (once again na\u00efve) solution is to protect the list and map accesses with a <code>sync.Mutex<\/code> of our own.<\/p>\n<h2 id=\"concurrent-safe-na\u00efve-lru\">Concurrent-safe Na\u00efve LRU<\/h2>\n<p>Not much needs to be changed to make our na\u00efve implementation safe for concurrent use (<a href=\"https:\/\/github.com\/rselbach\/lru_blogpost\/tree\/master\/naive-mutex\/lru\">full implementation on Github<\/a>.). We add a mutex \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">type<\/span> <span style=\"color:#a6e22e\">LRU<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">cap<\/span> <span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#75715e\">\/\/ the max number of items to hold<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">sync<\/span>.<span style=\"color:#a6e22e\">Mutex<\/span> <span style=\"color:#75715e\">\/\/ protects the idem and list<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">idx<\/span> <span style=\"color:#66d9ef\">map<\/span>[<span style=\"color:#66d9ef\">interface<\/span>{}]<span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">Element<\/span> <span style=\"color:#75715e\">\/\/ the index for our list<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">list<\/span>.<span style=\"color:#a6e22e\">List<\/span> <span style=\"color:#75715e\">\/\/ the actual list holding the data<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>And at the top of every exported entrypoint we do something like \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> (<span style=\"color:#a6e22e\">l<\/span> <span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">LRU<\/span>) <span style=\"color:#a6e22e\">Add<\/span>(<span style=\"color:#a6e22e\">k<\/span>, <span style=\"color:#a6e22e\">v<\/span> <span style=\"color:#66d9ef\">interface<\/span>{}) {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">Lock<\/span>()\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">defer<\/span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">Unlock<\/span>()\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">l<\/span>.<span style=\"color:#a6e22e\">lazyInit<\/span>()\n<\/span><\/span><\/code><\/pre><\/div><p>Et voil\u00e0, we\u2019re safe for concurrent use. But let\u2019s see what the benchmarks tell us.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>BenchmarkAdd\/mostly_new-4 2000000 819 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkAdd\/mostly_existing-4 10000000 200 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGet\/mostly_found-4 10000000 277 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGet\/mostly_not_found-4 10000000 219 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemove\/mostly_found-4 5000000 325 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemove\/mostly_not_found-4 10000000 220 ns\/op\n<\/span><\/span><\/code><\/pre><\/div><p>Overall the code is slightly slower due to the (for now minimal) overhead of the mutex operations. However, although we are safe for concurrent use, we\u2019re not really taking advantage of it, the entire code is completely sequential. An <code>Add<\/code> will prevent anyone from getting an item. Even a call to <code>Len()<\/code> locks everyone out.<\/p>\n<p>This will be clear if we modify the tests to run in parallel.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>BenchmarkAddParallel\/mostly_new-4 1000000 1040 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkAddParallel\/mostly_existing-4 5000000 433 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGetParallel\/mostly_found-4 5000000 293 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkGetParallel\/mostly_not_found-4 10000000 289 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemoveParallel\/mostly_found-4 5000000 305 ns\/op\n<\/span><\/span><span style=\"display:flex;\"><span>BenchmarkRemoveParallel\/mostly_not_found-4 10000000 291 ns\/op\n<\/span><\/span><\/code><\/pre><\/div><p>On average, the calls will take longer because most of the times they\u2019ll have to wait for another operation to finish and free the mutex.<\/p>\n<p>In the next post, we\u2019ll try and cut on the locking considerably.<\/p>"},{"title":"How to use FileServer with Gorilla\u2019s Subrouter","link":"https:\/\/rselbach.com\/how-to-use-fileserver-with-gorillas-subrouter\/","pubDate":"Wed, 29 Nov 2017 16:57:06 +0000","guid":"https:\/\/rselbach.com\/how-to-use-fileserver-with-gorillas-subrouter\/","description":"<p>I\u2019ve just spent much more time than I ever wanted to get this right, so here\u2019s how I did it for future reference.<\/p>\n<p>I have a function that returns an <code>http.Handler<\/code>, kind of like this:<\/p>\n<pre><code>func Handler(prefix string) http.Handler {\n r := mux.NewRouter().PathPrefix(prefix).Subrouter()\n r.HandleFunc(&quot;\/foo\/&quot;, fooHandler).Methods(&quot;GET&quot;)\n r.HandleFunc(&quot;\/bar\/&quot;, barHandler).Methods(&quot;GET&quot;)\n return r\n}\n<\/code><\/pre>\n<p>The <code>prefix<\/code> could be something like \u201c\/api\/\u201d or \u201c\/ui\u201d or whatever, so this <code>http.Handler<\/code> will serve <code>\/api\/foo<\/code> and <code>\/api\/bar<\/code>, for example. So far so good.<\/p>\n<p>Now, I also want to serve some static files under the prefix\u2019s \u201croot\u201d (again, something like \u201c\/api\/\u201d.) My initial thinking was something like this:<\/p>\n<pre><code>r.Handle(&quot;\/&quot;, http.StripPrefix(prefix, http.Dir(&quot;.\/somedir&quot;)))\n<\/code><\/pre>\n<p>It works fine for anything under the root of \u201c.\/somedir\u201d but it failed with a 404 error for anything under different subdirectories. I found some answers online, but they never seemed to use a subrouter and thus didn\u2019t work for me at all.<\/p>\n<p>I finally figured it out:<\/p>\n<pre><code>r.PathPrefix(&quot;\/&quot;).Handler(http.StripPrefix(prefix, http.FileServer(http.Dir(&quot;.\/somedir&quot;))))\n<\/code><\/pre>\n<p>It wasn\u2019t obvious to me at all.<\/p>"},{"title":"SciTech links (November 4 2017)","link":"https:\/\/rselbach.com\/scitech-links-november-4-2017\/","pubDate":"Sat, 04 Nov 2017 19:34:16 +0000","guid":"https:\/\/rselbach.com\/scitech-links-november-4-2017\/","description":"<p>China wants <a href=\"http:\/\/en.people.cn\/n3\/2017\/1102\/c90000-9288036.html\">to be the first country to build a practical space-based solar power station<\/a>. Space-based solar power would presumably be much more sustainable and clean than fossil fuels and more efficient than the current sustainable energy sources we have on Earth. There are many problems still to be solved before these power plants can exist so China\u2019s expectations are more wishful thinking than based on reality.<\/p>\n<p>Astronomers have found <a href=\"https:\/\/arxiv.org\/abs\/1710.11099\">a massive gas-giant that is astonishingly 23.9% as massive as the star it orbits<\/a>. For comparison, Jupiter is the largest planet in our solar system but its mass is only 0.09% of that of the Sun.<\/p>\n<p>An <a href=\"http:\/\/rapidcityjournal.com\/news\/local\/communities\/belle_fourche\/fifty-three-year-old-nuclear-missile-accident-revealed\/article_653347a4-04e8-5c29-a778-3a6a6c3cfd84.html\">interesting article<\/a> about an accident involving a Minuteman I nuclear missile 53 years ago. A short-circuit caused one of the retrorockets to fire and as a result the cone containing the nuclear warhead detached and fell into the silo. Ultimately the warhead casing was intact and nothing more serious happened, but the story reminded me of <a href=\"https:\/\/en.wikipedia.org\/wiki\/1980_Damascus_Titan_missile_explosion\">the Damascus Incident<\/a> in which a fuel leak on the Titan caused a <em>major<\/em> accident. Eric Schlosser\u2019s book, <a href=\"https:\/\/www.amazon.ca\/Command-Control-Damascus-Accident-Illusion\/dp\/1594202273\/ref=sr_1_1\/131-2349598-2291116?s=books&amp;ie=UTF8&amp;qid=1509731190&amp;sr=1-1\">Command and Control: Nuclear Weapons, the Damascus Accident, and the Illusion of Safety<\/a>, is a fantastic tale of this and other \u201cbroken arrow\u201d incidents.<\/p>"},{"title":"Science and tech links (October 21, 2017)","link":"https:\/\/rselbach.com\/science-and-tech-links-october-21-2017\/","pubDate":"Sat, 21 Oct 2017 12:11:54 +0000","guid":"https:\/\/rselbach.com\/science-and-tech-links-october-21-2017\/","description":"<p>Rodney Brooks writes about the <a href=\"https:\/\/www.technologyreview.com\/s\/609048\/the-seven-deadly-sins-of-ai-predictions\/\">7 Deadly Sins of AI Predictions<\/a>. The text articulates a lot of my personal doubts about much of what I see on the news regarding AI. Some people seemed to read this article as a rebutal of AI itself, which I find puzzling as I did not read that at all. If anything, Brooks seems to believe AI will be much bigger than we can possible imagine. He does talk about <em>predictions<\/em> being flawed. I can\u2019t argue with that.<\/p>\n<p>The Canadian Space Agency is worried about Canada\u2019s vulnerability to solar flares and the like. As a first step, it has published <a href=\"https:\/\/buyandsell.gc.ca\/cds\/public\/2017\/09\/05\/58a932796831d9786a1d4e91a5efa27d\/rfp_9f045-17-0348.pdf\">a request for proposals to run studies on the effects of space weather events on the Canadian infrastructure<\/a> (PDF). The study won\u2019t focus only on cataclysmic scenarios but also at more-routine effects of space weather, like solar wind, flares that affect radio frequencies, radiation storms that send particles towards us and geomagnetic storms that can disrupt satellite systems and other technologies. If you know me, you\u2019ll know a solar flare frying the electrical grid is my nightmare scenario.<\/p>\n<p>After six years in service, the first Chinese space station, Tiangong 1,<br>\n<a href=\"https:\/\/www.theguardian.com\/science\/2017\/oct\/13\/tiangong-1-chinese-space-station-will-crash-to-earth-within-months\">is set to fall back to earth sometime in the next few months.<\/a> Still not clear exactly when, it should happen late this year or early 2018. I\u2019d love to get my hand at a piece of that. As a space exploration geek, I find it incredibly sad that the Chinese space program is relatively secret. I\u2019d love to know more.<\/p>"},{"title":"Caddy and the Importance of Licenses","link":"https:\/\/rselbach.com\/caddy-and-the-importance-of-licenses\/","pubDate":"Sat, 16 Sep 2017 13:27:57 +0000","guid":"https:\/\/rselbach.com\/caddy-and-the-importance-of-licenses\/","description":"<p>I haven\u2019t commented on the recent brouhaha caused by <a href=\"https:\/\/caddyserver.com\">Caddy<\/a>\u2018s <a href=\"https:\/\/caddyserver.com\/blog\/accouncing-caddy-commercial-licenses\">decision to offer commercial licences<\/a>, so I\u2019ll do it briefly here before moving to the important part.<\/p>\n<p>I am fine with it. I don\u2019t <em>love<\/em> it, but it\u2019s fine. The Caddy authors have every right to try to profit from their work. Best of luck to them, they deserve it. Do I think they mangled the announcement? Yes. Do I think the amount of vitriol out there was justified? No. But again, it\u2019s fine.<\/p>\n<p>But I want to talk about something else and I\u2019ll use this episode to illustrate it. Matt Holt published his thoughts on the experience in <a href=\"https:\/\/caddy.community\/t\/the-realities-of-being-a-foss-maintainer\/2728\">The Realities of Being a FOSS Maintainer<\/a>. It\u2019s a nice read, but there is something there that I think we should not overlook.<\/p>\n<p>Midway through Matt\u2019s post, he clarifies the situation with their build server, that they removed[note]Most likely made private[\/note] from Github.<\/p>\n<blockquote>\n<p>To clarify, the Caddy build server was once open source, but we closed it up in the interest of focusing the technical attention of our community and our limited development resources (mostly time) on Caddy itself. The build server is not generalizable, and only exists to serve the Caddy project. As such, we\u2019re taking it under our wings to develop and maintain it as needed. If you find some old source code still online, be aware that no license file was added to the code, and we have not granted others any license to use it.<\/p>\n<\/blockquote>\n<p>This highlights the importance of checking the license of \u201cFOSS\u201d software. Being open source means something. It doesn\u2019t just mean \u201chosted on Github.\u201d Just because you find a piece of code on Github, it doesn\u2019t mean you can freely use it. It sucks, but as the above paragraph shows, it matters.<\/p>\n<p>What Matt is saying here is that although his build server was open source, it no longer is and if you have the code, you were never granted any license to use it. This cannot be, of course. Either it was never open source to begin with, or you were granted a license to use it. Which one is it?<\/p>\n<p>Since Matt makes it clear that \u201cno license file was added to the code,\u201d that means it\u2019s the former: it was never open source, no matter what he says now. Whether intentionally or not, people were misled into thinking it was.<\/p>\n<p>People would find the code on Github and assume it was open source. That\u2019s why checking the license is important. A project without a license is <em>not<\/em> open source and you are at risk.<\/p>\n<p>I\u2019ve seen small projects on Github before with no license information at all. It always made me uncomfortable. Now I see I was right.<\/p>\n<p>I want to make clear this is not about Caddy or Matt. Again, I\u2019m fine with their decision. My points are general:<\/p>\n<ul>\n<li>Properly license your open source software.<\/li>\n<li>Check the license of software you use.<\/li>\n<\/ul>\n<p>If you don\u2019t, this will get back to bite you.<\/p>"},{"title":"Returns in Go and C#","link":"https:\/\/rselbach.com\/returns-in-go-and-c\/","pubDate":"Fri, 15 Sep 2017 15:55:40 +0000","guid":"https:\/\/rselbach.com\/returns-in-go-and-c\/","description":"<p>Whenever someone posts anything related to the Go programming language on Hacker News, it never takes long before someone complains about error handling. I find it interesting because it is <em>exactly<\/em> one of things I like the most about Go.<\/p>\n<p>I don\u2019t want to <em>specifically<\/em> talk about error handling though. I want to talk about a feature that is intrinsically tied to it in Go: the ability of functions to return multiple values<\/p>\n<p>For instance, in Go it is common and idiomatic to write functions like this \u2014<\/p>\n<pre><code>func Divide(a, b float64) (float64, error) {\n if b == 0 {\n return 0.0, errors.New(&quot;divide by zero&quot;)\n }\n return a \/ b, nil\n}\n<\/code><\/pre>\n<p>So the caller would do:<\/p>\n<pre><code>result, err := Divide(x, y)\nif err != nil {\n \/\/ do error handling...\n}\n<\/code><\/pre>\n<p>Some people deplore this. I absolutely love it. I find it so much clearer than, for instance, what we often have to do in C#. You see, C# didn\u2019t have multiple returns (until very recently; see below) so you ended up with a few options.<\/p>\n<p>First, you can simple throw exceptions.<\/p>\n<pre><code>public SomeObject GetObjectById(int id) {\n if (!SomeObjectRepo.Has(id))\n throw new ArgumentOutOfRangeException(nameof(id));\n \/\/ ...\n}\n...\ntry\n{\n var obj = GetObjectById(1);\n \/\/ do something with obj\n}\ncatch (ArgumentOutOfRangeException ex)\n{\n \/\/ error handling\n}\n<\/code><\/pre>\n<p>I find the flow difficult to read. Particularly because variables are scoped within the try-catch so often you need to first declare something above the <code>try<\/code> and then test it after the <code>catch<\/code>.<\/p>\n<p>A second option is to return <code>null<\/code>:<\/p>\n<pre><code>public SomeObject GetObjectById(int id)\n{\n if (!SomeObjectRepo.Has(id))\n return null;\n\n \/\/ go get the object\n}\n...\nvar obj = GetObjectById(1);\nif (obj == null) \n{\n \/\/ do error handling\n}\n<\/code><\/pre>\n<p>This looks closer to what I like but it still has some serious downsides. You don\u2019t get any error information. What made it fail? I don\u2019t know. As well, this doesn\u2019t work for non-nullable types. A method returning a, say, <code>int<\/code> cannot return <code>null<\/code>. Sure, you could return <code>int?<\/code> instead of <code>int<\/code> and then test for <code>.HasValue<\/code> but that\u2019s cumbersome and artificial.<\/p>\n<p>A third option is the use of a generic return type. Something like \u2014<\/p>\n<pre><code>public class Result&lt;T&gt;\n{\n public T Value {get;protected set;}\n public Exception Exception {get; protected set;}\n\n public bool IsError =&gt; Exception != null;\n\n public Result() : this(default(T)) {}\n public Result(T value)\n {\n Value = value;\n }\n\n public static Result&lt;T&gt; MakeError(Exception exception)\n {\n return new Result&lt;T&gt;\n {\n Value = default(T),\n Exception = exception\n };\n }\n}\n<\/code><\/pre>\n<p>You could then use this to return values like \u2014<\/p>\n<pre><code>public Result&lt;int&gt; Divide(int a, int b)\n{\n if (b == 0)\n {\n return Result&lt;int&gt;.MakeError(new DivideByZeroException());\n }\n\n return new Result&lt;int&gt;(a \/ b);\n}\n...\nvar res = Divide(8, 4);\nif (res.IsError)\n{\n \/\/ do error handling, e.g.\n throw res.Exception;\n}\n\/\/ do something with res.Value (2)\n<\/code><\/pre>\n<p>This works, but it looks <em>artificial<\/em>. You need to create instances of <code>Result&lt;T&gt;<\/code> all around all the time. It is not that bad if your codebase uses this throughout and it becomes automatic for all programmers envolved. When it\u2019s an exception to the rule, it is horrible.<\/p>\n<p>A very similar solution is to return something like <code>Tuple&lt;T1, T2, ...&gt;<\/code> \u2014<\/p>\n<pre><code>public Tuple&lt;int,Exception&gt; Divide(int a, int b)\n{\n if (b == 0)\n return new Tuple&lt;int,Exception&gt;(0, new DivideByZeroException());\n return new Tuple&lt;int,Exception&gt;(a\/b, null);\n}\n...\nvar res = Divide(1, 2);\nif (res.Item2 != null) \/\/ Item2 is the exception\n{\n \/\/ do error handling\n}\n\/\/ do something with res.Item1\n<\/code><\/pre>\n<p>Same principle. It\u2019s ugly and artificial, but it will come back to us.<\/p>\n<p>The way the C# authors found to work around this problem is the idiomatic try-pattern, which consists in creating non-exception-throwing versions of methods. For example, if we go back to the first C# example above (<code>GetObjectById()<\/code>), we could create a second method like so \u2014<\/p>\n<pre><code>public bool TryGetObjectById(int id, out SomeObject result) {\n try \n {\n result = GetObjectById(id);\n return true;\n }\n catch\n {\n result = default(SomeObject);\n return false;\n }\n}\n...\nSomeObject result;\nif (!TryGetObjectById(1, out result))\n{\n \/\/ do error handling\n}\n\/\/ do something with result\n<\/code><\/pre>\n<p>Note that ever since C# 7.0 you can declare the <code>out<\/code> variable directly inside the method call as such \u2014<\/p>\n<pre><code>if (!TryGetObjectById(1, out var result))\n<\/code><\/pre>\n<p>Which spares you of declaring your <code>out<\/code> variables arguably at the expense of clarity.<\/p>\n<p>This method is idiomatic and found everywhere in the .NET Framework. I actually like it but it still has the problem of losing important information, namely what caused the method to fail: all you get is <code>true<\/code> or <code>false<\/code>.<\/p>\n<p>In C# 7.0, the language authors came up with a new solution: they added syntactic sugar to the language to make the tuple solution a bit more appealing \u2014<\/p>\n<pre><code>public (int, Exception) Divide(int a, int b)\n{\n if (b == 0)\n return (0, new DivideByZeroException());\n\n return (a \/ b, null);\n}\n...\nvar (res, err) = Divide(1, 2);\nif (err != null) \n{\n \/\/ do error handling\n}\n<\/code><\/pre>\n<p>Suddenly this becomes very familiar to a Go programmer. In the background, this is using a tuple. In fact, you can check that this is so by using the method above like this \u2014<\/p>\n<pre><code>var res = Divide(1, 2);\nif (res.Item2 != null)\n \/\/ do error handling\n\/\/ use res.Item1\n<\/code><\/pre>\n<p>You will see that <code>res<\/code> is of type <code>System.ValueTuple<\/code>. Also, if you create a library in C# 7.0 and then try to use it with a program in older versions of C#, you will see that the exposed type of the method is a tuple. This is actually nice because it means this big language change is backwards compatible.<\/p>\n<p>All that said, I haven\u2019t seen many uses of the new tuple returns in C# code in the wild. Maybe it\u2019s just early (C# 7.0 has been out for only a few months.) Or maybe the try-pattern is simply way too ingrained in the way of doing things in C#. It\u2019s more idiomatic.<\/p>\n<p>I sure prefer the new (Go-like) way.<\/p>"},{"title":"Happy Birthday Canada","link":"https:\/\/rselbach.com\/happy-birthday-canada\/","pubDate":"Sat, 01 Jul 2017 18:30:48 +0000","guid":"https:\/\/rselbach.com\/happy-birthday-canada\/","description":"<p>My adopted country is celebrating its 150th anniversary today. I want to say that I feel privileged to be here for it. This is where my family and I decided to make our home.<\/p>\n<p>Happy birthday, bonne f\u00eate, Canada! Merci de tout! \ud83c\udde8\ud83c\udde6<\/p>"},{"title":"SciTech Links (June 5, 2017)","link":"https:\/\/rselbach.com\/scitech-links-june-5-2017\/","pubDate":"Mon, 05 Jun 2017 17:53:15 +0000","guid":"https:\/\/rselbach.com\/scitech-links-june-5-2017\/","description":"<ul>\n<li>The Institute for Energy Economics and Financial Analysis reports that <a href=\"http:\/\/ieefa.org\/ieefa-asia-indias-electricity-sector-transformation-happening-now\/\">India is cancelling plans for huge coal power stations because solar energy prices are lower<\/a>, which, if true, represents a huge threshold for sustainable energy productions. If solar energy is cheaper than coal (and other types of energy), that means the market itself will naturally migrate over.<\/li>\n<li>A company is <a href=\"https:\/\/www.newscientist.com\/article\/2133311-human-tests-suggest-young-blood-cuts-cancer-and-alzheimers-risk\/\">suggesting that young blood cuts cancer and Alzheimer\u2019s risk<\/a>, which seems like a huge deal. That said, a healthy dose of skepticism is warranted. For example, the company\u2019s trial did not have a placebo test group.<\/li>\n<li>A new paper describes a test in which they were able <a href=\"https:\/\/www.cell.com\/neuron\/fulltext\/S0896-6273(15)00090-2\">to restore damaged brain cells<\/a> in mice using stem cells.<\/li>\n<\/ul>"},{"title":"Casting objects and boxing","link":"https:\/\/rselbach.com\/casting-objects-and-boxing\/","pubDate":"Thu, 30 Mar 2017 19:13:02 +0000","guid":"https:\/\/rselbach.com\/casting-objects-and-boxing\/","description":"<p>I\u2019m back from a trip to a customer.<\/p>\n<p><em>How was it?<\/em><\/p>\n<p>Okay. I got more snow that I expected on the way there, so the drive wasn\u2019t much fun. Then again, a part of the trip goes through a beautiful forest that was worth everything else.<\/p>\n<p><em>Cool!<\/em><\/p>\n<p>Also, while showing the customer a new feature, the app crashed.<\/p>\n<p><em>Typical. Blame it on Murphy!<\/em><\/p>\n<p>That\u2019s what I did at first. Then I blamed it on the developer. And then I finally went looking at the C# code to find out why it happened.<\/p>\n<p><em>What was it?<\/em><\/p>\n<p>It turned out to be a rather common but not obvious mistake. See the code below and tell me what is the value of each of <code>doubleF<\/code>, <code>doubleI<\/code>, and <code>doubleO<\/code>.<\/p>\n<pre><code>float f = 0.0;\nint i = (int)f;\nobject o = f;\n\nvar doubleF = (double) f;\nvar doubleI = (double) i;\nvar doubleO = (double) o;\n<\/code><\/pre>\n<p><em>I\u2019m sensing a catch here, but I\u2019ll bite. They\u2019re all cast from the same original variable <code>f<\/code> so I\u2019m guessing they\u2019d all end up 0.0\u2026?<\/em><\/p>\n<p>You would, wouldn\u2019t you? But you\u2019re wrong.<\/p>\n<p><em>Waaat?<\/em><\/p>\n<p>The final line in that code will throw an <code>InvalidCastException<\/code> at you \u2014 and crash your app if you don\u2019t catch it, as was the case in our app.<\/p>\n<p><em>Wait what? How? How come you can\u2019t cast 0.0 to <code>double<\/code>?<\/em><\/p>\n<p>Well, you can. For instance, this works perfectly \u2014<\/p>\n<pre><code>var d = (double) 0.0f;\n<\/code><\/pre>\n<p>But this doesn\u2019t \u2014<\/p>\n<pre><code>object f = 0.0f;\nvar d = (double) d;\n<\/code><\/pre>\n<p><em>It makes no sense!<\/em><\/p>\n<p>Actually it does. The problem is taking <code>object<\/code> to mean \u201canything.\u201d Which incidentally it does, just not the way most people think. You see, <code>object<\/code> is a type representing <code>Object<\/code>, which is a class other types inherit from but not all. You can store anything as <code>object<\/code> because <code>Object<\/code> <em>boxes<\/em> whatever object you put in it. It stores the value internally but the compiler doesn\u2019t know what type is stored there.<\/p>\n<p><em>No no no! I know for a fact that you can too check what type is stored in an object<\/em><\/p>\n<p>You\u2019re right, you can. For instance \u2014<\/p>\n<pre><code>object o = \/* something *\/\nConsole.WriteLine(o.GetType());\n<\/code><\/pre>\n<p>This will print the type of whatever you put in the variable <code>o<\/code>. But this is at run time: <strong>the compiler doesn\u2019t know<\/strong>.<\/p>\n<p>That\u2019s why we using casting. If we <strong>know for a fact<\/strong> that variable <code>o<\/code> will contain a, say, <code>int<\/code>, we can help the compiler and tell it about it with a cast. Remember, <strong>when you cast something, you are telling the <em>compiler<\/em> what type will be stored in the variable<\/strong>. The compiler can\u2019t be held responsible if you lie to it.<\/p>\n<p>Let\u2019s get back at the original problem \u2014<\/p>\n<pre><code>object o = 1.0f;\nvar d = (double) o;\n<\/code><\/pre>\n<p>You <em>told<\/em> the compiler that <code>o<\/code> will be a <code>double<\/code>, but it isn\u2019t. Remember a <code>double<\/code> is a shorthand for the struct <code>Double<\/code> as <code>float<\/code> is for <code>Single<\/code>. And guess what? A <code>Double<\/code> is not a <code>Single<\/code>. When you stored a <code>float<\/code> in the variable <code>o<\/code> of type <code>object<\/code>, the <code>float<\/code> value was boxed inside an object of type <code>Object<\/code>. When you cast, the compiler has to unbox whatever was inside <code>o<\/code> and guess what, the value stored in <code>o<\/code> is of a different structure, with different methods and storage, than what you told it it was. You could <em>convert<\/em> between them, but <em>they are not the same<\/em>.<\/p>\n<p>So the compiler expects an object of type <code>Double<\/code> but it has a <code>Single<\/code> and things fail miserably.<\/p>\n<p><em>But you just said that we can convert between them! Why don\u2019t the compiler does it?<\/em><\/p>\n<p>It could. But think of how this would work out in real life. Remember the compiler doesn\u2019t know what will be inside <code>o<\/code> so it needs to test what the value is. It would need to test if the type is a, say, <code>string<\/code>. If it is, then convert <code>string<\/code> to <code>Double<\/code>. If it isn\u2019t then check if it is a <code>Int32<\/code>. Then a <code>Int64<\/code>. Then a <code>DateTime<\/code>. The number of possibilities is enormous and the compiler would have to generate all this code <em>every time it needs it finds a cast<\/em>. This would be a <em>lot<\/em> of code. It would be so much code in fact that you\u2019d be mad not to put it all in separate methods. It would also be slow so the compiler won\u2019t do this by default.<\/p>\n<p>That\u2019s why we have the <code>Convert<\/code> class, which in turn depends on types implementing the <code>IConvertible<\/code> interface. Whenever you want to <em>convert<\/em> a value of TypeA to TypeB, you can use this conversion methods. You can do \u2014<\/p>\n<pre><code>object o = 1.0f;\nvar d = Convert.ToDouble(o);\n<\/code><\/pre>\n<p>The compiler authors had to make a decision: either they\u2019d generate lots of slow code to test for the type and convert the value, or they\u2019d leave the decision for the programmer who can call <code>Convert.ToSomething<\/code> when needed.<\/p>\n<p><em>And they chose the former.<\/em><\/p>\n<p>Exactly. I believe it was reasonable. If you <em>know<\/em> something will be of a given type at run time, you can still cast it. Otherwise, you should convert it.<\/p>"},{"title":"Retreating back into my bubble","link":"https:\/\/rselbach.com\/retreating-back-into-my-bubble\/","pubDate":"Tue, 31 Jan 2017 18:31:32 +0000","guid":"https:\/\/rselbach.com\/retreating-back-into-my-bubble\/","description":"<p>A few months back I decided to try and burst out of my bubble. I then decided to follow some public figures from all sides on Facebook and Twitter. On Facebook this is particularly weird because you\u2019re forced to <em>like<\/em> the page. So it tells the world <em>\u201cRoberto likes Mrs. Public-Figure\u201d<\/em>, which is sometimes undesirable.<\/p>\n<p>Still, I wanted to see what both sides of the political spectrum were saying. Also, I consider myself a centrist so I expected to agree with everyone on at least something.<\/p>\n<p>Anyway, my town suffered a terrorist attack a couple of days ago and as soon as the identity of the suspect became known, the media started drawing conclusions based on who he \u201cliked\u201d on Facebook. That got me thinking: someone will eventually go through my social media and conclude I believe in <em>X<\/em> because I \u201clike\u201d <em>Y<\/em> on FB, even though I may only \u201clike\u201d <em>Y<\/em> because I want to be informed and not because I necessarily agree with them.<\/p>\n<p><a href=\"http:\/\/www.independent.co.uk\/news\/world\/americas\/donald-trump-muslim-immigration-ban-facebook-check-iraq-sudan-syria-mana-yegani-a7551256.html\">There are also reports<\/a> that US Border agents now require people to provide social network credentials so that their political leanings can be attested. Regardless on my personal opinions about this, the fact is that someone with access to my FB account can quickly draw the conclusion that I lean this or that way because of the pages I like, even though I liked them only to be informed.<\/p>\n<p>I then realized that it\u2019s time to give up on my bubble-bursting experiment. I \u201cunliked\u201d pretty much every public figure on Facebook.<\/p>"},{"title":"Cedilha no Fedora 25","link":"https:\/\/rselbach.com\/cedilha-no-fedora-25\/","pubDate":"Tue, 06 Dec 2016 19:38:20 +0000","guid":"https:\/\/rselbach.com\/cedilha-no-fedora-25\/","description":"<p>Quem utiliza teclado US Internacional para escrever no Linux j\u00e1 deve ter dado de cara com o fato de que na maioria das distribui\u00e7\u00f5es, a combina\u00e7\u00e3o \u2018+c gera um \u201c\u0107\u201d em vez de um \u201c\u00e7\u201d. Resolver isso no Fedora 25 \u00e9\u00a0f\u00e1cil, mas n\u00e3o evidente.<\/p>\n<p><strong>tl;dr<\/strong> \u2013 eu criei <a href=\"https:\/\/github.com\/robteix\/c-cedilla-fedora\">este script<\/a> que faz todos\u00a0os passos abaixo automaticamente. Basta rodar isso:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-bash\" data-lang=\"bash\"><span style=\"display:flex;\"><span>curl https:\/\/raw.githubusercontent.com\/robteix\/c-cedilla-fedora\/master\/c-cedilla-fedora | bash\n<\/span><\/span><\/code><\/pre><\/div><p>Se voc\u00ea preferir n\u00e3o executar o script, continue lendo.<\/p>\n<p>Primeiro, vamos criar um novo mapa de teclado para seu usu\u00e1rio. Rode o comando abaixo:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-bash\" data-lang=\"bash\"><span style=\"display:flex;\"><span>sed -e <span style=\"color:#e6db74\">&#39;s,\\xc4\\x86,\\xc3\\x87,g&#39;<\/span> <span style=\"color:#ae81ff\">\\\n<\/span><\/span><\/span><span style=\"display:flex;\"><span> -e <span style=\"color:#e6db74\">&#39;s,\\xc4\\x87,\\xc3\\xa7,g&#39;<\/span> <span style=\"color:#ae81ff\">\\\n<\/span><\/span><\/span><span style=\"display:flex;\"><span> &lt; \/usr\/share\/X11\/locale\/en_US.UTF-8\/Compose &gt; ~\/.XCompose\n<\/span><\/span><\/code><\/pre><\/div><p>Isso copia o arquivo de mapeamento de teclas do Fedora para o diret\u00f3rio <tt>$HOME<\/tt> do usu\u00e1rio, substituindo o \u201c\u0106\u201d por um \u201c\u00c7\u201d.<\/p>\n<p>Agora vamos configurar o GNOME para que ele n\u00e3o controle a configura\u00e7\u00e3o do teclado, para que possamos\u00a0usar nossa pr\u00f3pria:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-bash\" data-lang=\"bash\"><span style=\"display:flex;\"><span>gsettings set org.gnome.settings-daemon.plugins.keyboard active false\n<\/span><\/span><\/code><\/pre><\/div><p>Para selecionar o <em>input method<\/em> apropriado, o Fedora fornece um programinha\u00a0chamado <tt>im-chooser<\/tt> que n\u00e3o \u00e9 instalado por padr\u00e3o. Para instal\u00e1-lo:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-bash\" data-lang=\"bash\"><span style=\"display:flex;\"><span>sudo dnf install im-chooser\n<\/span><\/span><\/code><\/pre><\/div><p>Por fim, executamos o <tt>im-chooser<\/tt> e escolhemos \u201cUse X Compose table\u201d:<\/p>\n<p>Clique em \u201cLog out\u201d para aplicar as modifica\u00e7\u00f5es e a partir de agora deve ser poss\u00edvel gerar o\u00a0c-cedilha com a combina\u00e7\u00e3o \u2018+c.<\/p>"},{"title":"The Woman the Mercury Astronauts Couldn\u2019t Do Without","link":"https:\/\/rselbach.com\/the-woman-the-mercury-astronauts-couldnt-do-without\/","pubDate":"Fri, 02 Dec 2016 13:31:17 +0000","guid":"https:\/\/rselbach.com\/the-woman-the-mercury-astronauts-couldnt-do-without\/","description":"<p>Must-read article on \u201chuman computer\u201d Katherine Johnson. Not only was she a key figure in pushing NASA\u2019s efforts forward, but she did it while fighting misogyny and racism:<\/p>\n<blockquote>\n<p>Outside the gates, the caste rules were clear. Blacks and whites lived separately, ate separately, studied separately, socialized separately, worshipped separately, and, for the most part, worked separately. At Langley, the boundaries were fuzzier. Blacks were ghettoed into separate bathrooms, but they had also been given an unprecedented entr\u00e9e into the professional world. Some of Goble\u2019s colleagues were Yankees or foreigners who\u2019d never so much as met a black person before arriving at Langley. Others were folks from the Deep South with calcified attitudes about racial mixing. It was all a part of the racial relations laboratory that was Langley, and it meant that both blacks and whites were treading new ground together. The vicious and easily identifiable demons that had haunted black Americans for three centuries were shape-shifting as segregation began to yield under pressure from social and legal forces. Sometimes the demons still presented themselves in the form of racism and blatant discrimination. Sometimes they took on the softer cast of ignorance or thoughtless prejudice. But these days, there was also a new culprit: the insecurity that plagued black people as they code-shifted through the unfamiliar language and customs of an integrated life.<\/p>\n<p>Katherine understood that the attitudes of the hard-line racists were beyond her control. Against ignorance, she and others like her mounted a day-in, day-out charm offensive: impeccably dressed, well-spoken, patriotic, and upright, they were racial synecdoches, keenly aware that the interactions that individual blacks had with whites could have implications for the entire black community. But the insecurities, those most insidious and stubborn of all the demons, were hers alone. They operated in the shadows of fear and suspicion, and they served at her command. They would entice her to see the engineer as an arrogant chauvinist and racist if she let them. They could taunt her into a self-doubting downward spiral, causing her to withdraw from the opportunity that Dr. Claytor had so meticulously prepared her for.<\/p>\n<\/blockquote>\n<p>Source: <em><a href=\"http:\/\/nautil.us\/issue\/43\/heroes\/the-woman-the-mercury-astronauts-couldnt-do-without\">The Woman the Mercury Astronauts Couldn\u2019t Do Without<\/a><\/em><\/p>"},{"title":"New stuff coming in C# 7.0","link":"https:\/\/rselbach.com\/new-stuff-coming-in-c-7-0\/","pubDate":"Tue, 30 Aug 2016 20:10:32 +0000","guid":"https:\/\/rselbach.com\/new-stuff-coming-in-c-7-0\/","description":"<p>Mads Torgersen wrote a blog post highlighting <a href=\"https:\/\/blogs.msdn.microsoft.com\/dotnet\/2016\/08\/24\/whats-new-in-csharp-7-0\/\">what\u2019s new in C# 7.0<\/a>:<\/p>\n<blockquote>\n<p>C# 7.0 adds a number of new features and brings a focus on data consumption, code simplification and performance.<\/p>\n<\/blockquote>\n<p>The changes all seem to be in line with the recent trends of borrowing syntax sugar from other languages to C#. Nothing wrong with that: copy what\u2019s good and shed what\u2019s bad.<\/p>\n<p>One of the changes is related to <code>out<\/code> variables. These are the C# way to deal with not being able to return multiple values (see below for good news on that front). It\u2019s basically the same as passing by reference in, say, C. For instance:<\/p>\n<pre><code>int myOutVar;\nchangeMyOutVar(out myOutVar);\n<\/code><\/pre>\n<p>You could have the value of <code>myOutVar<\/code> set inside <code>changeMyOutVar<\/code>. Simple. What is changing in C# 7.0 is that you would no longer need to predeclare <code>myOutVar<\/code>:<\/p>\n<pre><code>changeMyOutVar(out int myOutVar);\n<\/code><\/pre>\n<p>The scope of the new variable will be the enclosing block. I have to say it: I don\u2019t like it. It <em>feels<\/em> obfuscated to me. The variable doesn\u2019t <em>look<\/em> like it should be in that scope. Compare with this popular Go idiom:<\/p>\n<pre><code>if err := DoSomething(); err != nil {\n return err;\n}\n<\/code><\/pre>\n<p>The variable <code>err<\/code> is created <em>inside<\/em> the <code>if<\/code> and its scope is there as well. I know a lot of people who hate this for the same reason I don\u2019t like the way the new <code>out<\/code> variables are to be created in C#. I find\u00a0it much more clear in Go though.<\/p>\n<p>The feature I\u00a0<em>absolutely loved<\/em> to read about is\u00a0<em>tuples<\/em>. Error handling in .NET is often done with exceptions, which I find clunky and cumbersome. With tuples, we might be able to move to something more Go-like:<\/p>\n<pre><code>(User, bool) FindUser(string username) {\n var found = _userList.Find(u =&gt; u.Username == username);\n if (found == null)\n return null, false;\n return found, true;\n}\n<\/code><\/pre>\n<p>So we could do something like:<\/p>\n<pre><code>var (user, ok) = FindUser(&quot;someusername&quot;);\nif (!ok) {\n \/\/ user not found, deal with this\n}\n<\/code><\/pre>\n<p>Check his post for more features.<\/p>"},{"title":"Millie 0.9.6, or \u201cinstallers are hard\u201d","link":"https:\/\/rselbach.com\/millie-0-9-6-or-installers-are-hard\/","pubDate":"Sun, 28 Aug 2016 22:08:43 +0000","guid":"https:\/\/rselbach.com\/millie-0-9-6-or-installers-are-hard\/","description":"<p>I\u2019ve been terribly busy with work lately and so I haven\u2019t really had much time for my side projects. I did however managed to get a new version of Millie out of the door.<\/p>\n<p><a href=\"https:\/\/github.com\/robteix\/millie\/releases\/tag\/v0.9.6\">Got get it here.<\/a><\/p>\n<p>Changes are mostly infrastructural though.<\/p>\n<h3 id=\"user-8220visible8221-changes\">User \u201cvisible\u201d changes:<\/h3>\n<ul>\n<li>Add .deb installation files for Linux<\/li>\n<li>Add support for electron-builder<\/li>\n<li>New settings system<\/li>\n<li>Fix missing icon on Win64 installer<\/li>\n<li>Split generation of 32- and 64-bit installers on windows<\/li>\n<\/ul>\n<h3 id=\"minor-changes-and-fixes\">Minor changes and fixes<\/h3>\n<ul>\n<li>Merge branch \u2018builder\u2019 of github.com:robteix\/millie<\/li>\n<li>Ignore backups<\/li>\n<li>Add missing dependency<\/li>\n<li>Ignore main.js.map<\/li>\n<li>Remove warning on unknown props<\/li>\n<li>Cleanup<\/li>\n<li>Move background declaration to MillieView<\/li>\n<li>Stop loading old settings<\/li>\n<li>Add script to generate release files<\/li>\n<li>Remove log file left from first commit<\/li>\n<\/ul>\n<p>That said, this release reminded me of how hard installers are to get right.\u00a0Actually, they\u2019re hard to do\u00a0<em>at all<\/em>.<\/p>\n<p>MacOS installers can basically only be made on macOS due to there not seeming to be decent implementations of DMG anywhere else. You can compile and create a ZIP file with your binaries, sure, but who wants that? To create a nice DMG, you need to be on macOS.<\/p>\n<p>Windows is also hard to do in other systems. Not impossible, just annoying. You can get by with Mono in Linux or macOS but you need to get around a bug here and there. It works though.<\/p>\n<p>Linux installers (meaning .dpkg and .rpm) are easy to do in macOS but\u00a0<em>barely\u00a0doable<\/em> on Windows.<\/p>\n<p>In practice you end up having to create each installer on its own environment. Linux and Windows are easy to do with VMs, but you\u2019ll need a macOS box eventually.<\/p>\n<p>Windows has its own share of problems though. I hear they\u2019re working on\u00a0<em>finally<\/em> fixing their dumb limitations on path length but it\u2019s definitely not there yet. This is important when working with things like npm that create paths hundreds of levels deep. Trying to something simple like deleting a node_modules directory on Windows is an exercise in frustration.<\/p>\n<p>The installers for this release were all created in a Linux VM though. It was the closest thing I got to building\u00a0it all in a single platform. No DMG for macOS though.<\/p>"},{"title":"I\u2019m sad today","link":"https:\/\/rselbach.com\/im-sad-today\/","pubDate":"Mon, 01 Aug 2016 13:25:21 +0000","guid":"https:\/\/rselbach.com\/im-sad-today\/","description":"<p>So this is me today.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/im-sad-today\/640px-Sad-pug_hu_4636eb3abaf53eb1.webp 320w, https:\/\/rselbach.com\/im-sad-today\/640px-Sad-pug_hu_672248251be25151.webp 480w, https:\/\/rselbach.com\/im-sad-today\/640px-Sad-pug_hu_760c1e2e8e75362a.webp 640w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/im-sad-today\/640px-Sad-pug.jpg\"\n alt=\"640px-Sad-pug\"\n loading=\"lazy\"\n decoding=\"async\" width=\"640\" height=\"427\" srcset=\"https:\/\/rselbach.com\/im-sad-today\/640px-Sad-pug_hu_b64054d3376160e1.jpg 320w, https:\/\/rselbach.com\/im-sad-today\/640px-Sad-pug_hu_43a6d8305972048.jpg 480w, https:\/\/rselbach.com\/im-sad-today\/640px-Sad-pug_hu_4abf7097cab4afb8.jpg 640w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>Years ago, my wife and I had a friends couple we worked with for some years. Someday they stopped talking to us. They refused to answer our calls or answer our emails. They never accepted out friend requests on Facebook.<\/p>\n<p>We never knew why.<\/p>\n<p>This happened over 10 years ago so naturally life moved on. From time to time, it happens that I see something from them on Facebook seen as we have a lot of friends in common, but neither of us acknowledges the present of the other.<\/p>\n<p>I recently joined a Slack team and to my (and I\u2019m sure his) surprise, my former-friend was there as well. Over the course of the next few weeks, we\u2019d be talking in the same channel to other people but again, never directly to each other. I wanted to but I knew he was mad at me for something and I didn\u2019t want to force it. What I did try doing was to engage in the channel as if nothing ever happened, just like everyone else.<\/p>\n<p>But it was unconfortable. There was always that elephant in the room. So last Thursday I send him a message in private. I told him I never knew what I had done but that I apologized for whatever it was. I told him that he didn\u2019t have to forgive me but I would really appreciate knowing what it was.<\/p>\n<p>But he wouldn\u2019t answer. So today I decided that there was no point in making two people uncomfortable all the time and I left the channel.<\/p>\n<p>In the end, it\u2019s no big deal. As I said, this was something that happened (whatever it was) over 10 years ago. But it makes me sad that I\u2019ll never know what I did wrong.<\/p>\n<p>(Image <a href=\"https:\/\/creativecommons.org\/licenses\/by-sa\/3.0\/deed.en\">CC-BY-SA<\/a>\u00a0by\u00a0<a href=\"https:\/\/commons.wikimedia.org\/wiki\/File:Sad-pug.jpg\">Wikimedia Commons<\/a>)<\/p>"},{"title":"Une lettre ouverte \u00e0 la madame qui a point\u00e9 son doigt vers ma fille","link":"https:\/\/rselbach.com\/une-lettre-ouverte-a-la-madame-qui-a-pointe-son-doigt-vers-ma-fille\/","pubDate":"Wed, 27 Jul 2016 15:36:32 +0000","guid":"https:\/\/rselbach.com\/une-lettre-ouverte-a-la-madame-qui-a-pointe-son-doigt-vers-ma-fille\/","description":"<p>Conscient du fait que mon fran\u00e7ais n\u2019est pas tr\u00e8s bon (j\u2019apprends), je pense cependant qu\u2019il est important de l\u2019\u00e9crire dans cette langue, car vous m\u2019avez fait savoir que toute autre langue n\u2019est pas acceptable.<\/p>\n<p>Il y a quelques jours, j\u2019\u00e9tais chez un restaurant Valentine avec ma fille de six ans. Nous y \u00e9tions all\u00e9s parce qu\u2019elle adore leur hot-dog et puisqu\u2019elle avait fait un super effort \u00e0 l\u2019\u00e9cole ce jour-l\u00e0, j\u2019avais d\u00e9cid\u00e9 de la r\u00e9compenser. Vos raisons pour y \u00eatre doivent \u00eatre encore plus mondaines que \u00e7a.<\/p>\n<p>Nous sommes arriv\u00e9s au Qu\u00e9bec depuis moins de trois mois et ma fille est toujours en train d\u2019apprendre le fran\u00e7ais. Et bien qu\u2019elle s\u2019efforce de se faire comprendre par un monde qui ne la comprend pas, elle a encore des difficult\u00e9s. Elle devient souvent frustr\u00e9e. Et pourtant elle pers\u00e9v\u00e8re. Sachez que je suis tr\u00e8s fier d\u2019elle.<\/p>\n<p>Elle venait d\u2019entrer \u00e0 l\u2019\u00e9cole avant les vacances d\u2019\u00e9t\u00e9, juste pour apprendre le fran\u00e7ais. Un jour, les \u00e9l\u00e8ves devraient avoir un examen de math\u00e9matique et les enseignantes avaient d\u00e9cid\u00e9 de sortir ma fille de la salle pour continuer \u00e0 \u00e9tudier le fran\u00e7ais. Ma fille a commenc\u00e9 \u00e0 pleurer et supplier. Les enseignantes ne comprenaient pas pourquoi. Ils m\u2019ont alors appel\u00e9 et je suis all\u00e9 \u00e0 l\u2019\u00e9cole. En y arrivant, nous avons finalement compris\u00a0: elle se croyait punie et elle ne savait pas ce qu\u2019elle avait fait pour le m\u00e9riter. Elle implorait le pardon. C\u2019est de ce genre de situation \u00e0 laquelle elle doit faire face tous les jours.<\/p>\n<p>Encore une fois, elle a six ans.<\/p>\n<p>Elle a perdu toutes ses amies. Elle a d\u00fb laisser presque tous ces jouets. En tant que p\u00e8re, \u00e7a me brise le c\u0153ur de la voir en regardant des autres enfants qui jouent, parce que je sais qu\u2019elle veut jouer avec eux, mais elle est souvent g\u00ean\u00e9e \u00e0 cause du fran\u00e7ais.<\/p>\n<p>Je suis certain que vous serez d\u2019accord avec moi quand je dis que \u00e7a n\u2019est pas facile pour un adulte, et encore moins pour une petite fille. Mais elle fait un vrai effort l\u00e0 et je suis tellement fier d\u2019elle. Vraiment fier.<br>\nEt c\u2019est pour cette raison qu\u2019il m\u2019a fait tellement mal quand vous avez d\u00e9cid\u00e9 de lui r\u00e9primander de ne pas parler fran\u00e7ais avec son papa.<\/p>\n<p>Elle jacassait comme d\u2019habitude quand vous l\u2019avez interrompue pour me dire qu\u2019il fallait parler fran\u00e7ais au Qu\u00e9bec. \u00c7a m\u2019a surpris un peu, mais j\u2019ai commenc\u00e9 quand m\u00eame \u00e0 vous expliquer qu\u2019elle apprenait. Vous avez d\u00e9cid\u00e9 de m\u2019ignorer et de pointer votre doigt \u00e0 une petite fille et de crier \u00ab\u00a0en fran\u00e7ais !\u00a0\u00bb<\/p>\n<p>Je suis un nouvel arrivant et je n\u2019avais aucune id\u00e9e, \u00e0 ce moment-l\u00e0, comment r\u00e9agir. Je ne savais pas si vous auriez l\u2019appui du reste des gens chez le restaurant ou pas. Mon instinct \u00e9tait juste de prot\u00e9ger ma fille de vous. Ma petite fille qui se prot\u00e9geait derri\u00e8re moi, intimid\u00e9e par une madame qui partait en col\u00e8re pour quelque chose qu\u2019elle ne comprenait pas.<\/p>\n<p>Et pourquoi ?<\/p>\n<p>Je vous demande, madame, c\u2019est \u00e0 quoi exactement que vous vous attendiez ? Je comprends que vous consid\u00e9rez votre langue importante. En g\u00e9n\u00e9ral, j\u2019appuie l\u2019id\u00e9e que tout le monde doit \u00eatre capable de se communiquer en fran\u00e7ais au Qu\u00e9bec. Je pense que c\u2019est absolument juste que personne ne vous demande de parler l\u2019anglais ou d\u2019autre langue, quelle qu\u2019elle soit. Vous \u00eates au Qu\u00e9bec et le fran\u00e7ais devrait \u00eatre suffisant pour y vivre. Je suis d\u2019accord avec tout \u00e7a.<\/p>\n<p>Mais si ma fille veut parler \u00e0 son papa en sa langue maternelle, qu\u2019est-ce que vous avez \u00e0 voir avec \u00e7a ?<br>\nEssayez de vous mettre dans notre place. Essayez de vous imaginer \u00e0 un autre pays. Est-ce que vous arr\u00eatiez de parler fran\u00e7ais avec vos enfants ou votre conjoint ? Soyez honn\u00eate.<\/p>\n<p>Je ne sais vraiment pas ce que vous pensiez \u00e0 r\u00e9ussir, madame, mais ce que vous avez r\u00e9ussi \u00e0 faire c\u2019est de me faire repenser le Qu\u00e9bec et les qu\u00e9b\u00e9cois. Vous m\u2019avez fait me demander si les qu\u00e9b\u00e9cois sont tous des colons. C\u2019est ce que vous avez r\u00e9ussi, madame.<\/p>\n<p>Mais m\u00eame l\u00e0, vous avez \u00e9chou\u00e9.<\/p>\n<p>Lorsque vous \u00eates partie, des gens chez le resto sont venus s\u2019excuser de vous. Une femme a donn\u00e9 \u00e0 ma fille des crayons et une feuille de papier pour qu\u2019elle puisse dessiner afin d\u2019arr\u00eater de pleurer.<\/p>\n<p>J\u2019ai donc conclu que non, vous ne repr\u00e9sentez pas le Qu\u00e9bec. La plupart des qu\u00e9b\u00e9cois avec qui j\u2019ai eu le plaisir d\u2019interagir m\u2019ont trait\u00e9 avec respect. La plupart des qu\u00e9b\u00e9cois avec qui j\u2019en ai parl\u00e9 m\u2019ont dit la m\u00eame chose\u00a0: vous, et ceux comme vous, avez perdu la guerre. Vous \u00eates une relique d\u2019un pass\u00e9 honteux de cette belle province. Vous repr\u00e9sentez le pass\u00e9.<\/p>\n<p>Ma fille est l\u2019avenir. Deal with it.<\/p>"},{"title":"Philae Lander signing off","link":"https:\/\/rselbach.com\/philae-lander-signing-off\/","pubDate":"Wed, 27 Jul 2016 13:17:58 +0000","guid":"https:\/\/rselbach.com\/philae-lander-signing-off\/","description":"<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\">\n <p lang=\"en\" dir=\"ltr\">\n It\u2019s time for me to say goodbye. Tomorrow, the unit on <a href=\"https:\/\/twitter.com\/ESA_Rosetta?ref_src=twsrc%5Etfw\">@ESA_Rosetta<\/a> for communication with me will be switched off forever&#8230;\n <\/p>\n <p>\n &mdash; Philae Lander (@Philae2014) <a href=\"https:\/\/twitter.com\/Philae2014\/status\/757938537803153408?ref_src=twsrc%5Etfw\">July 26, 2016<\/a>\n <\/p>\n<\/blockquote>\n<p>And so ends one of the most exciting science missions in recent years. The team at ESA managed a remarkable feat while also engaging the rest of us emotionally. Great job to all involved.<\/p>"},{"title":"Best icecream I\u2019ve ever had","link":"https:\/\/rselbach.com\/best-icecream-ever\/","pubDate":"Mon, 25 Jul 2016 16:52:58 +0000","guid":"https:\/\/rselbach.com\/best-icecream-ever\/","description":"<p>Years ago, I was part of a project that went completely off the rails. A little context: we were a services company and we had local offices in cities all over the country. My team provided 2nd-level support which means we often had the PMs call us from those via an annoying Nextel radio.<\/p>\n<p>I won\u2019t go through the details but suffice it to say this project envolved one such branch going rogue and committing actual fraud, with criminal proceedings and all. People were on the edge, and the relationship with that branch was increasingly hostile. There was also an internal power struggle in the company between some directors at that point. In other words, a clusterfuck I\u2019ll always cherish, if by cherish you mean hate hate hate. Anywho\u2026<\/p>\n<p>One time, there was a national holiday on a Thursday and we were going to make it a long weekend. As customary, I communicated with all the PMs about contigency plans. This PM then told us that we could not take Friday off because the customer wanted us to fly over there. We were supposed to be at the customer\u2019s site early Friday morning. That meant we would have to fly Thrusday afternoon. I wasn\u2019t happy.<\/p>\n<p>It immediatly felt arbitrary too. As I said, the relationship was not good and we suspected he was just trying to cost us our days off. I knew enough of the customer to be fairly sure they would not have requested us that Friday. Why did the customer want us then? There was nothing yet on production and if it was just to show progress, surely we could move it to Monday. At worst, can\u2019t we make it over the phone? No, no, no, he said. The customer was adamant that we be there on Friday. Sucked to be us.<\/p>\n<p>So we flew over Thursday afternoon and on Friday morning we headed to the customer\u2019s offices only to find it closed. They too had made it a long weekend and wouldn\u2019t be back until Monday.<\/p>\n<p>Normally I would be furious over the waste of time but to be honest, both I and my colleague smiled at that. It confirmed that the PM just tried to screw us and the customer have never asked for us. We headed back to the local office.<\/p>\n<p>Before coming in, we both bought ourselves some icecream. My friend stayed in the little garden in front and I went in. The PM immediatly saw me and demanded to know why I wasn\u2019t at the customer yet. I didn\u2019t answer. Instead I grabbed the Nextel radio and headed back out with the PM following. I then sat down on the grass and called my director. Smiling and staring at the PM, I told him about the office being closed. The PM\u2019s face froze when my director asked to talk to him.<\/p>\n<p>We sat outside under the sun, enjoying our icecreams while the PM got shouted at. It was the best icecream I\u2019ve ever had.<\/p>"},{"title":"Is it really as bad as it looks?","link":"https:\/\/rselbach.com\/as-bad-as-it-looks\/","pubDate":"Mon, 18 Jul 2016 11:39:00 +0000","guid":"https:\/\/rselbach.com\/as-bad-as-it-looks\/","description":"<p><strong><em>Hi, I have a question<\/em><\/strong><\/p>\n<p>Do you ever not?<\/p>\n<p><strong><em>\u201cLearning never exhausts the mind.\u201d<\/em><\/strong><\/p>\n<p>Leonardo DaVinci? I\u2019m proud of you. Go ahead.<\/p>\n<p><strong><em>Thank you. I\u2019ve been reading all these horrific news stories about the Olympic games and Rio\u2026<\/em><\/strong><\/p>\n<p>Oh that. Yeah, I\u2019ve been getting asked that question regularly lately.<\/p>\n<p><strong><em>Is it really that bad?<\/em><\/strong><\/p>\n<p>Yes and no. There is a lot of sensationalism out there. But it\u2019s bad and, at least to us Brazilians, not at all unexpected\u00a0because Rio is widely known as a hellhole among us.<\/p>\n<p>Years ago, when the games were announced, most of us in Brazil expected the worst. Rio is widely perceived by Brazilians as a hellhole.<\/p>\n<p>I spent a whole month there once because of work and it left a strong mark in me. I\u2019ve seen people being mugged, a dead body was left outside my hotel one night, I was in the middle of a shooting between rival gangs, and \u2014 cr\u00e8me de la cr\u00e8me \u2014 one day some big shot drug trafficker was killed in jail and what followed was, to me, surreal. The city is beautiful though.<\/p>\n<p><strong><em>What happened?<\/em><\/strong><\/p>\n<p>All thoughout that day, people kept telling me about the news of this guy who got killed. I could not care less, to be honest. But at the end of the day I finally understood when I tried leaving the office and people said I was nuts. I wasn\u2019t allowed to go because the drug gangs issued a curfew on the city.<\/p>\n<p>A. Curfew. On. The. City.<\/p>\n<p>At times like that, commerces close their doors all over the place and the police completely disappears.<\/p>\n<p><strong><em>That\u2019s insane! How is anyone safe during the games?!<\/em><\/strong><\/p>\n<p>Well, here\u2019s where I point out that it\u2019s probably not as bad as you\u2019d think.<\/p>\n<p><strong><em>Wait what<\/em><\/strong><\/p>\n<p>Hold on. First of all, it is not in the gangs\u2019 interest to attract international attention. They already have full control over\u00a0the city, the police, etc. It\u2019s in their best interest to wait the games out and then continue with business as usual. I doubt\u00a0there will be problems with the drug traffic.<\/p>\n<p>Second, there will be 50,000 security personnel there. FIFTY THOUSAND. And again, it\u2019s in the powers that be\u2019s interests\u00a0that foreigners have a good time there. It will suck for people from Rio who will be hounded by the police and the army, though.<\/p>\n<p>Just a couple of weeks ago the Brazilian Congress passed a special law granting de facto immunity to members of security forces who happen to commit crimes against civilians during the games. It\u2019s going to be fun.<\/p>\n<p><strong><em>Wait what? Immunity<\/em><\/strong><\/p>\n<p><em>De facto<\/em>. What the law does is transfer the authority of judging these cases to militaty justice. In practice, it means immunity. And the reason for the law was exactly to allow the police and the army to trump people\u2019s rights in order to keep the peace. It\u2019s so very Rio.<\/p>\n<p><strong><em>And terrorism?<\/em><\/strong><\/p>\n<p>Yeah, I don\u2019t know. As we\u2019ve seen these past weeks, you don\u2019t need much to kill people. A rental truck is enough. So yes, there\u00a0might be something. Then again, 50,000 security personnel. I\u2019m guessing there might be easier targets out there. In short, I don\u2019t know but I don\u2019t think the risk is high enough to worry about it.<\/p>\n<p>What will be horrible is already happening and mostly hidden from foreigners. It\u2019s the human rights abuses against the poor. That to is very Rio. They\u2019re make every effort to hide the poor and prevent them from being seen, no matter the cost. Thousands have been forcebly relocated already.<\/p>\n<p>And in the end, what for? The city (and its people) won\u2019t come out better after the games than before.<\/p>\n<p><strong><em>It\u2019s depressing<\/em><\/strong><\/p>\n<p>Indeed.<\/p>"},{"title":"Ubuntu on Windows","link":"https:\/\/rselbach.com\/ubuntu-on-windows\/","pubDate":"Fri, 27 May 2016 18:04:05 +0000","guid":"https:\/\/rselbach.com\/ubuntu-on-windows\/","description":"<p>I\u2019ve just installed Git on a Windows 10 box using <tt>apt-get<\/tt>.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_536f3a90927e32c6.webp 320w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_3d6366a218f173a1.webp 480w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_632ef03d5822bef6.webp 640w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_7869863c4bf26ecf.webp 800w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_96bd86ea9b0f2d86.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get.png\"\n alt=\"apt-get\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1025\" height=\"768\" srcset=\"https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_317a8bece888ac6e.png 320w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_5785b3d0deeefed3.png 480w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_a0654d985ab718ef.png 640w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_c6868c82293d444d.png 800w, https:\/\/rselbach.com\/ubuntu-on-windows\/apt-get_hu_19ddcd4a9768dba1.png 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>What a glorious time to be alive \ud83d\ude09<\/p>"},{"title":"How do I add an unknown attribute to an element in ReactJS?","link":"https:\/\/rselbach.com\/add-unknown-attribute-element-reactjs\/","pubDate":"Thu, 17 Mar 2016 12:34:22 +0000","guid":"https:\/\/rselbach.com\/add-unknown-attribute-element-reactjs\/","description":"<p>There\u2019s this project I\u2019ve been working on in ReactJS and Chrome and I needed to use a <code>&lt;webview&gt;<\/code> component. In case you\u2019re not familiar with <code>&lt;webview&gt;<\/code>, it looks something like this \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-html\" data-lang=\"html\"><span style=\"display:flex;\"><span>&lt;<span style=\"color:#f92672\">webview<\/span> <span style=\"color:#a6e22e\">src<\/span><span style=\"color:#f92672\">=<\/span><span style=\"color:#e6db74\">&#34;https:\/\/robteix.com&#34;<\/span>&gt;&lt;\/<span style=\"color:#f92672\">webview<\/span>&gt;\n<\/span><\/span><\/code><\/pre><\/div><p>One of the coolest features of <code>&lt;webview&gt;<\/code> is the ability to isolate scope or <em>partition<\/em> it. When you use a partition, all cookies, local and session storage, etc, will be stored separately from other partitions. All you need to do is add the <code>partition<\/code> attribute. So I had something similar to this inside one of my components \u2014<\/p>\n<pre><code>return (\n &lt;webview id=&quot;foo&quot; \n src=&quot;https:\/\/somewebsite.com\/&quot;\n partition=&quot;persist:foobar&quot; \/&gt;\n);\n<\/code><\/pre>\n<p>To my surprise, multiple <code>&lt;webview&gt;<\/code>s were sharing the same session data. Not good. A quick glance in the app storage directory told me that no partition was being created. What\u2019s wrong?<\/p>\n<p>We can look at the HTML output for hints \u2014<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-html\" data-lang=\"html\"><span style=\"display:flex;\"><span>&lt;<span style=\"color:#f92672\">webview<\/span> <span style=\"color:#a6e22e\">id<\/span><span style=\"color:#f92672\">=<\/span><span style=\"color:#e6db74\">&#34;foo&#34;<\/span> <span style=\"color:#a6e22e\">src<\/span><span style=\"color:#f92672\">=<\/span><span style=\"color:#e6db74\">&#34;https:\/\/somewebsite&#34;<\/span> <span style=\"color:#a6e22e\">class<\/span><span style=\"color:#f92672\">=<\/span><span style=\"color:#e6db74\">&#34;MyComponent__component___3U2KV&#34;<\/span> <span style=\"color:#a6e22e\">data-reactid<\/span><span style=\"color:#f92672\">=<\/span><span style=\"color:#e6db74\">&#34;.0.0.0.2:$MyComponent.0&#34;<\/span> <span style=\"color:#a6e22e\">tabindex<\/span><span style=\"color:#f92672\">=<\/span><span style=\"color:#e6db74\">&#34;-1&#34;<\/span>&gt;&lt;\/<span style=\"color:#f92672\">webview<\/span>&gt;\n<\/span><\/span><\/code><\/pre><\/div><p>No <code>partition<\/code> to be found. The reason is React doesn\u2019t know what to do with that attribute and as a result it is not output. There are good reasons for this, but the main one is that properties may (and often do) work differently accross browsers and React needs to be able to deal with this.<\/p>\n<p>But how can we add the attribute that we need then? You could add some JavaScript to get the element but that\u2019s not very reactive. The reactive way to do this is to leverage <code>ref<\/code>, which can provide a reference to an element.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-jsx\" data-lang=\"jsx\"><span style=\"display:flex;\"><span>&lt;<span style=\"color:#f92672\">Element<\/span> <span style=\"color:#a6e22e\">ref<\/span><span style=\"color:#f92672\">=<\/span>{<span style=\"color:#a6e22e\">somevar<\/span>} \/&gt;\n<\/span><\/span><\/code><\/pre><\/div><p>In this code, <code>somevar<\/code> will hold a reference to <code>&lt;Element&gt;<\/code>. Better yet, just use a function instead.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-jsx\" data-lang=\"jsx\"><span style=\"display:flex;\"><span>&lt;<span style=\"color:#f92672\">Element<\/span> <span style=\"color:#a6e22e\">ref<\/span><span style=\"color:#f92672\">=<\/span>{<span style=\"color:#66d9ef\">function<\/span>(<span style=\"color:#a6e22e\">e<\/span>) { <span style=\"color:#a6e22e\">e<\/span>.<span style=\"color:#a6e22e\">Something<\/span>(); }} \/&gt;\n<\/span><\/span><\/code><\/pre><\/div><p>Or in ES6 syntax.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-jsx\" data-lang=\"jsx\"><span style=\"display:flex;\"><span>&lt;<span style=\"color:#f92672\">Element<\/span> <span style=\"color:#a6e22e\">ref<\/span><span style=\"color:#f92672\">=<\/span>{(<span style=\"color:#a6e22e\">e<\/span>) =&gt; <span style=\"color:#a6e22e\">e<\/span>.<span style=\"color:#a6e22e\">Something<\/span>() } \/&gt;\n<\/span><\/span><\/code><\/pre><\/div><p>Which finally takes us to our problem: how do we add the <code>partition<\/code> attribute? Easy peasy.<\/p>\n<pre><code>return (\n &lt;webview id=&quot;foo&quot; \n src=&quot;https:\/\/somewebsite.com\/&quot;\n ref={elm =&gt; elm &amp;&amp; elm.setAttribute('partition', 'persist:foobar')} \/&gt;\n);\n<\/code><\/pre>\n<p>And that\u2019s it, a simple way to add unknown attributes to elements in React.<\/p>"},{"title":"Clashing method names in Go interfaces","link":"https:\/\/rselbach.com\/clashing-method-names-go-interfaces\/","pubDate":"Fri, 11 Mar 2016 01:13:26 +0000","guid":"https:\/\/rselbach.com\/clashing-method-names-go-interfaces\/","description":"<p>I wrote about <a href=\"https:\/\/rselbach.com\/interfaces-go-c\/\">how the Go and C# compilers implement interfaces<\/a> and mentioned how C# deals with clashing method names but I didn\u2019t talk about how Go does it, so here it is.<\/p>\n<p>Two interfaces with the same method name that need to behave differently is very likely a sign of bad API design and we should fix it instead. But sometimes we can\u2019t help it (e.g. the interfaces are part of a third-party package). How do we deal with it then? Let\u2019s see.<\/p>\n<p>Given two interfaces<\/p>\n<pre><code>type Firster interface {\n DoSomething()\n}\n\ntype Seconder interface {\n DoSomething()\n}\n<\/code><\/pre>\n<p>We implement them like this<\/p>\n<pre><code>type MyStruct struct{}\n\nfunc (ms MyStruct) DoSomething() {\n log.Println(&quot;Doing something&quot;)\n}\n<\/code><\/pre>\n<p>We can <a href=\"http:\/\/play.golang.org\/p\/peyb-wv7L8\">run this little test here<\/a> to verify that <code>MyStruct<\/code> implements both interfaces.<\/p>\n<p>But what if we need <code>DoSomething()<\/code> to do something different depending on whether <code>MyStruct<\/code> is being cast as <code>Firster<\/code> or <code>Seconder<\/code>?<\/p>\n<p>Go doesn\u2019t support any kind of explicit declaration of interfaces when implementing methods. We can\u2019t do something like, say<\/p>\n<pre><code>type MyStruct struct{}\n\nfunc (ms MyStruct) Firster.DoSomething() {\n log.Println(&quot;Doing something&quot;)\n}\n\nfunc (ms MyStruct) Seconder.DoSomething() {\n log.Println(&quot;Doing something&quot;)\n}\n<\/code><\/pre>\n<p>That won\u2019t work. The solution is to wrap <code>MyStruct<\/code> with a new type that reimplements <code>DoSomething()<\/code>. Like this<\/p>\n<pre><code>type SeconderWrapper struct {\n MyStruct\n}\n\nfunc (sw SeconderWrapper) DoSomething() {\n log.Println(&quot;Doing something different&quot;)\n}\n<\/code><\/pre>\n<p>Now when we need to pass it to a function expecting <code>Seconder<\/code>, we can wrap <code>MyStruct<\/code><\/p>\n<pre><code>ms := MyStruct{}\nuseSeconder(SeconderWrapper{ms})\n<\/code><\/pre>\n<p>That will run the <code>DoSomething()<\/code> from <code>SeconderWrapper<\/code>. When passing it as <code>Firster<\/code>, the original <code>DoSomething()<\/code> will be called instead. You can <a href=\"http:\/\/play.golang.org\/p\/iwEvW7hkx4\">see this in action here<\/a>.<\/p>"},{"title":"Interfaces in Go and C#","link":"https:\/\/rselbach.com\/interfaces-go-c\/","pubDate":"Wed, 09 Mar 2016 14:26:33 +0000","guid":"https:\/\/rselbach.com\/interfaces-go-c\/","description":"<p>I make no secret of the fact that I love Go. I think it\u2019s a wonderfully designed language and it gave me nothing but pleasure in the years I\u2019ve been working with it full time.<\/p>\n<p>Now however I am working on a project that requires the use of C#, which prompted me to realize something.<\/p>\n<p>When people ask about Go, most people talk about channels and concurrency but I think one of the most beautiful aspects of Go is its implementation of interfaces.<\/p>\n<p>To see what I mean, let\u2019s define a simple interface in Go.<\/p>\n<pre><code>type Greeter interface {\n Hello() string\n}\n<\/code><\/pre>\n<p>Now say we have a type that implements this interface<\/p>\n<pre><code>type MyGreeter struct {}\n\nfunc (mg MyGreeter) Hello() string {\n return &quot;Hello World&quot;\n}\n<\/code><\/pre>\n<p>This is it. <code>myGreeter<\/code> <em>implicitly<\/em> implements the <code>Greeter<\/code> interface and we can pass it along to any function that accepts a <code>Greeter<\/code>.<\/p>\n<pre><code>func doSomethingWithGreeter(g Greeter) {\n \/\/ do something\n}\n\nfunc main() {\n mg := myGreeter{}\n doSomethingWithGreeter(mg)\n}\n<\/code><\/pre>\n<p>The fact that the implementation is actually important, but we\u2019ll get to that. Let\u2019s first do the same thing in C#.<\/p>\n<pre><code>interface Greeter\n{\n string Hello();\n}\n<\/code><\/pre>\n<p>And then we create a class that implements the interface.<\/p>\n<pre><code>class MyGreeter\n{\n public string Hello()\n {\n return &quot;Hello world&quot;;\n }\n}\n<\/code><\/pre>\n<p>We quickly find out that the compiler doesn\u2019t like this.<\/p>\n<pre><code>public static string doSomething(Greeter g)\n{\n return g.Hello ();\n}\n\npublic static void Main (string[] args)\n{\n MyGreeter mg = new MyGreeter ();\n doSomething (mg);\n}\n<\/code><\/pre>\n<p>The compiler complains that it cannot convert <code>MyGreeter<\/code> to type <code>Greeter<\/code>. That\u2019s because the C# compiler requires classes to <em>explicitly<\/em> declare the interfaces they implement. Changing <code>MyGreeter<\/code> as below solves the problem.<\/p>\n<pre><code>class MyGreeter : Greeter\n{\n public string Hello()\n {\n return &quot;Hello world&quot;;\n }\n}\n<\/code><\/pre>\n<p>And voil\u00e0, everything works.<\/p>\n<p>Now, we might argue that it is not much different. All you have to do is to declare the interface implemented by the class, right? Except it does make a difference.<\/p>\n<p>Imagine that you cannot change <code>MyGreeter<\/code>, be it because it\u2019s from a third-party library or it was done by another team.<\/p>\n<p>In Go, you could declare the <code>Greeter<\/code> interface in your own code and the <code>MyGreeter<\/code> that is part of somebody else\u2019s package would \u201cmagically\u201d implement it. It is great for mocking tests, for example.<\/p>\n<p>Implicit interfaces is an underrated feature of Go.<\/p>\n<p><strong>Update:<\/strong> someone on Twitter pointed me to the fact that C# not only also has implicit interfaces but that this is the default state of things. That is true in a literal sense, but it\u2019s not the same thing.<\/p>\n<p>Imagine in our C# above, we have a second interface.<\/p>\n<pre><code>interface IAgreeable\n{\n string Hello();\n string Bye();\n}\n<\/code><\/pre>\n<p>(Yes, I was also told that in C# we should always name interfaces like <code>ISomethingable<\/code>. I disagree but there it is.)<\/p>\n<p>We then implement our class thusly<\/p>\n<pre><code>class MyClass : Greeter, IAgreeable\n{\n public string Hello() {\n return &quot;Hello world&quot;;\n }\n public string Bye() {\n return &quot;Bye world&quot;;\n }\n}\n<\/code><\/pre>\n<p>It now correctly implements both interfaces and all is well with the world. Until, that is, the <code>Hello()<\/code> method needs to be different for each interface in which case you will need to do an <em>explicit<\/em> implementation.<\/p>\n<pre><code>class MyClass : Greeter, IAgreeable\n{\n\u00a0 \u00a0 string Greeter.Hello() {\n return &quot;Hello world from Greeter&quot;;\n }\n public string Hello() {\n return &quot;Hello world from !Greeter&quot;;\n }\n public string Bye() {\n return &quot;Bye world&quot;;\n }\n }\n<\/code><\/pre>\n<p>And then the compiler will call the appropriate <code>Hello()<\/code> depending on the cast.<\/p>\n<pre><code>public static string doSomething(Greeter g)\n{\n return g.Hello ();\n}\npublic static string doSomethingElse(IAgreeable g)\n{\n return g.Hello ();\n}\npublic static void Main (string[] args)\n{\n MyClass mg = new MyClass ();\n Console.Out.WriteLine(doSomething (mg));\n Console.Out.WriteLine(doSomethingElse (mg));\n}\n<\/code><\/pre>\n<p>This will print<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-text\" data-lang=\"text\"><span style=\"display:flex;\"><span>Hello world from Greeter\n<\/span><\/span><span style=\"display:flex;\"><span>Hello world from !Greeter\n<\/span><\/span><\/code><\/pre><\/div><p>Personally I consider two interfaces with clashing method names that need to behave differently a design flaw in the API, but reality being what it is, sometimes we need to deal with this.<\/p>"},{"title":"Github\u2019s Swift Style guide","link":"https:\/\/rselbach.com\/githubs-swift-style-guide\/","pubDate":"Mon, 25 Jan 2016 15:27:12 +0000","guid":"https:\/\/rselbach.com\/githubs-swift-style-guide\/","description":"<p>Github has published a <a href=\"https:\/\/github.com\/github\/swift-style-guide\">Swift Style Guide<\/a>:<\/p>\n<blockquote>\n<p>When you have to meet certain criteria to continue execution, try to exit early. So, instead of this:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-swift\" data-lang=\"swift\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">if<\/span> n.isNumber {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#75715e\">\/\/ Use n here<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>} <span style=\"color:#66d9ef\">else<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><\/blockquote>\n<p>use this:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-swift\" data-lang=\"swift\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">guard<\/span> n.isNumber <span style=\"color:#66d9ef\">else<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#75715e\">\/\/ Use n here<\/span>\n<\/span><\/span><\/code><\/pre><\/div><p>Feels very Go-like.<\/p>"},{"title":"Invincible breaks my heart","link":"https:\/\/rselbach.com\/invincible-breaks-my-heart\/","pubDate":"Wed, 16 Dec 2015 22:38:26 +0000","guid":"https:\/\/rselbach.com\/invincible-breaks-my-heart\/","description":"<p>Spoilers abound. You\u2019ve been warned.<\/p>\n<p>From the very beginning, Robert Kirkman maintained that\u00a0<strong>Invincible<\/strong> was his attempt at doing the whole superhero thing\u00a0right. There is a running gag in this book that on every cover (at least for a lot time if not since the beginning), they take a little jab at the superhero genre as done by other houses.<\/p>\n<p>As news appeared that there would be a reboot, Kirkman was quick to declare that he was not going to be a dick to his readers and would not erase the whole timeline. By calling the arc \u201c<strong>REBOOT?<\/strong>\u201d with a question mark, he could not have made this more clearer. Also, the cover tagline:<\/p>\n<p><a href=\".\/img2015-12-16_04.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_15749038391b1ae2.webp 320w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_230b50d9e8d66384.webp 480w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_fb792bfd7fd89e77.webp 640w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_6f80963bee49aeb0.webp 800w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_30f003d5bb7cd2d5.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04.jpg\"\n alt=\"img2015-12-16_04\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"107\" srcset=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_206e96c901207e47.jpg 320w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_eff6cef48be89403.jpg 480w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_fd9efb13eb94aa33.jpg 640w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_75c4e0d0160ad6f.jpg 800w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_04_hu_7ba516a0b894188b.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>And so we reach the end of the arc\u00a0and Kirkman did keep his promise: the timeline was not erased. But maybe it should? That is the question that he leaves us with.<\/p>\n<p>Mark is taken back to just before he gets his powers. He then deals the best he can with what he knows is coming: Nolan\u2019s attempt at conquering the world for the Viltrumite Empire and the consequent deaths of so many in the process. That\u2019s the \u201chero stuff\u201d and although it\u2019s well done, none of it will matter.<\/p>\n<p>Mark has also to deal with being young again, living with his parents. His wife of many years now barely knows and definitely doesn\u2019t care for him. And his daughter wasn\u2019t born yet. How do you deal with this?<\/p>\n<p>During the first two issues of the arc, Mark\u2019s personal life was mostly a B plot. But in this final issue, it becomes central.<\/p>\n<p><a href=\".\/img2015-12-16_45.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_604b5b44c4438447.webp 320w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_ec98b122ea94e26.webp 480w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_ae0db18218296122.webp 640w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_ee3fc0aefdd7743b.webp 800w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_5e2ada57c4e98fc8.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45.jpg\"\n alt=\"img2015-12-16_45\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"630\" srcset=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_be8d9d75d639659e.jpg 320w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_ded38f896eaaaf56.jpg 480w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_c317493a68d1293.jpg 640w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_cdce0a7795999349.jpg 800w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img2015-12-16_45_hu_55b83dc2ab933f3f.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Mark gets a chance to go back to his original timeline, to his wife, to his daughter. But he\u2019s asked for a sacrife. A hero\u2019s sacrifice.<\/p>\n<p>The beings that brought Mark here explain that by setting himself in another path, he can fix the future, he can fix all the things that happened to Earth in the original timeline. All he has to do is make the choice.<\/p>\n<p><a href=\".\/img18.21.24.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_bfb96a67e79f2934.webp 320w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_c386dd95380b497.webp 480w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_dd342944ef6e608.webp 640w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_500be8a2d7364a74.webp 800w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_96f91b37ec872fa9.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24.jpg\"\n alt=\"img18.21.24\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"518\" srcset=\"https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_7b24a74c8b4a31ec.jpg 320w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_3e512475d15121f3.jpg 480w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_2a1a035f2f255d0d.jpg 640w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_3046cf89038b7fa7.jpg 800w, https:\/\/rselbach.com\/invincible-breaks-my-heart\/img18.21.24_hu_d8ec6968c23f36ad.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>But he says no. Mark wants to go back to his wife and daughter. There is nothing that can make him change his mind.<\/p>\n<p>He doomed his planet and he is a disgrace, they say. I can live with that, he responds and goes back only to find desolation where the battle against Thragg is apparently finished \u2013 and apparently lost \u2014 I suppose we\u2019ll learn more about that soon.<\/p>\n<p>And of course, Kirkman had to throw one extra punch at the guy. As a father, the reveal at then end of what Mark has lost is heartbreaking.<\/p>\n<p><strong>Invincible<\/strong> remains the only book that has\u00a0<em>never<\/em> once disappointed me in any of its arcs. This is amazing for a story ongoing for over 10 years and 126 issues.<\/p>\n<p>Now excuse me while I go hug my daughter.<\/p>"},{"title":"Simplicity is Complicated \u2013 The dot Post","link":"https:\/\/rselbach.com\/simplicity-is-complicated-the-dot-post\/","pubDate":"Thu, 03 Dec 2015 16:32:13 +0000","guid":"https:\/\/rselbach.com\/simplicity-is-complicated-the-dot-post\/","description":"<blockquote>\n<p>Go is often described as a simple language. It is not, it just seems that way. Rob explains how Go\u2019s simplicity hides a great deal of complexity, and that both the simplicity and complexity are part of the design.<\/p>\n<\/blockquote>\n<p>Source: <em><a href=\"http:\/\/www.thedotpost.com\/2015\/11\/rob-pike-simplicity-is-complicated\">Simplicity is Complicated \u2013 The dot Post<\/a><\/em><\/p>"},{"title":"The Evolutionary Psychology Nonsense","link":"https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/","pubDate":"Mon, 23 Mar 2015 22:58:14 +0000","guid":"https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/","description":"<p><a href=\"https:\/\/evolution-institute.org\/images\/posts\/2015\/03\/mind-1272x400.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_9d3efb6807961cfd.webp 320w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_7f6c4e9cebd2a658.webp 480w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_967f2e7662ce292a.webp 640w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_c5e39c9c0e0ef497.webp 800w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_180a2660d66e4c8b.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400.jpg\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"322\" srcset=\"https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_9bed260ad3f45d73.jpg 320w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_af34301f9f38e5f1.jpg 480w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_3a8e3eb2344e95dc.jpg 640w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_e2592009b2f843ba.jpg 800w, https:\/\/rselbach.com\/the-evolutionary-psychology-nonsense\/mind-1272x400_hu_a7f148330a224d82.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>I have a friend who is all into the whole evolutionary psychology fad. It\u2019s useful when you want to rationalize bad behaviour. I once told him that evolutionary psychology was pseudoscience to which he replied saying that I was just trying to negate the world as-is.<\/p>\n<p>But apparently I\u2019m not alone, as <a href=\"https:\/\/evolution-institute.org\/article\/evolutionary-psychology-is-neither\/\">Jonathan Marks writes<\/a>\u00a0(emphasis is mine) \u2014<\/p>\n<blockquote>\n<p>I can\u2019t shake the feeling that <strong>the methodologies I have encountered in evolutionary psychology would not meet the standards of any other science<\/strong>.\u00a0 For a notable example, it is apparently a revelation to evolutionary psychology that one cannot readily generalize about the human condition from a sample of humans that is Western, Educated, Industrialized, Rich, and Democratic.\u00a0Perhaps this was news in psychology \u2013 creationist, evolutionary, or otherwise \u2013 but, sad to say, everybody else who works with cultural diversity knew that a really long time ago.<\/p>\n<\/blockquote>"},{"title":"Avoiding Avoidance Behaviour","link":"https:\/\/rselbach.com\/avoiding-avoidance-behaviour\/","pubDate":"Fri, 13 Mar 2015 13:06:36 +0000","guid":"https:\/\/rselbach.com\/avoiding-avoidance-behaviour\/","description":"<p>I am currently trying a new approach to deal with my social phobia. Basically it involves avoiding avoidance behaviours. You see, people with social anxiety tend to avoid problematic situations and run to metaphorical safe places. After a while, <strong>the avoidance behaviours become almost automatic, almost imperceptible<\/strong>.<\/p>\n<p>Almost but not quite.<\/p>\n<p>We behave so without thinking but we recognize the behaviour while we\u2019re doing it. <strong>And that\u2019s exactly when we have to force ourselves to avoid avoidance.<\/strong> It is very difficult and the temptation of avoidance is almost irresistible. The problem, of course, is the more we avoid things, the harder it is to stop doing it later in life.<\/p>\n<p>Last night I posted something to Facebook \u2014<\/p>\n<p><a href=\"https:\/\/www.facebook.com\/robteix\/posts\/10153208453849048\">https:\/\/www.facebook.com\/robteix\/posts\/10153208453849048<\/a><\/p>\n<p>The voices of social anxiety immediately started working in my head. \u201cFriendA will mock\u00a0at you,\u201d they shout. \u201cFriendB will think you\u2019re pathetic.\u201d And so they went. I came this close to deleting the post before stopping and forcing myself to ignore the voices.<\/p>\n<p>It is not easy.\u00a0<strong>It is so not easy that I am writing a blog post about it<\/strong>. Social phobia makes my mind work against me: it constantly attacks me, my self-esteem, and my confidence. It would be so much easier to just delete the post.<\/p>\n<p>Dealing with social anxiety involves many counter-intuitive measures: it forces socially anxious people to go against what our own brains tell us is not the safest route.<\/p>\n<p>I need to keep working on it. I\u2019ll need to continue to force myself into doing more of what I desperately want to avoid. Let\u2019s see how it goes.<\/p>"},{"title":"Why do Salespeople Believe in Magic?","link":"https:\/\/rselbach.com\/why-do-salespeople-believe-in-magic\/","pubDate":"Wed, 11 Mar 2015 20:29:31 +0000","guid":"https:\/\/rselbach.com\/why-do-salespeople-believe-in-magic\/","description":"<p>File this one under techies\u00a0complaining about non-techies. Over the years, I have noticed a pattern with salespeople, <strong>they have a firm belief in wishful thinking<\/strong>. They\u00a0<em>honestly<\/em> believe that wishing something to be true will magically make it so.<\/p>\n<p><a href=\".\/Wishful_Thinking.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/why-do-salespeople-believe-in-magic\/Wishful_Thinking_hu_7689a164a786158e.webp 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/why-do-salespeople-believe-in-magic\/Wishful_Thinking.jpg\"\n alt=\"Wishful_Thinking\"\n loading=\"lazy\"\n decoding=\"async\" width=\"447\" height=\"398\" srcset=\"https:\/\/rselbach.com\/why-do-salespeople-believe-in-magic\/Wishful_Thinking_hu_6e8b4005b034c6c7.jpg 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>The specific pattern I noticed many a time goes something like this.<\/p>\n<p>The customer wants something done and goes through their account manager to request that. The account manager \u2014 a fancy name for salesperson \u2014 commits to a date without talking to the developer first. They then go to the developer and tell her something to the effect of \u201cyeah, I\u2019m going to need that by Friday morning.\u201d The exasperated developer explains that this is not feasible and the account manager responds by simply repeating that they will need it by Friday. They usually leave at this point satisfied that everything is fine.<\/p>\n<p>Come Friday, the account manager is then horrified to discover that the feature is not ready. \u201cBut we made a commitment with the customer,\u201d they\u2019ll say, emphasizing the \u201cwe\u201d that never was.<\/p>\n<p>This has happened some many times in my career that I should no longer be surprise and yet I still do. Every time.<\/p>\n<p>Of course, what they are really doing is <strong>trying to put pressure on the developers<\/strong> so that they will hurry up and deliver on the desired timeframe. And to be fair, it can sometimes work, but if the developer tells them\u00a0<strong>in no uncertain terms<\/strong> that the deadline is not feasible, then the salesperson is\u00a0taking the risk by herself.<\/p>\n<p>By committing to a date with the customer before talking to the developer, the salesperson has already taken a big risk. <strong>They will then try to spread that risk by sharing it with the developer<\/strong>. Since the developer never had a chance to agree with that in the first place, it is only fair that she should be able to refuse to take the risk if she doesn\u2019t believe it is worth it. Why should she?<\/p>\n<p>And yet, <strong>we developers often accept the risk by being passive and simply accepting it<\/strong>. This problem can be exacerbated by managers who are also passive. Many years ago I worked at a company where the engineering power that be were submissive to the sales department, which led to some of the worst experiences in my life as a developer, including the\u00a0Project From Hell.<\/p>\n<p>At the time, I led the engineering services group, so whenever a new project came about that required software development, it had to go through me for analysis. Another group leader analysed the infrastructure projects. Then one day this large project showed up on my desk. I looked over it along with the infrastructure guy and we agreed that it was a monster of a project, including developing a huge distributed nationwide (Brazil) infrastructure, a huge system developed from scratch, and a lot of technology transfer and end-user training.<\/p>\n<p>The project had some timeframes attached to it and although they were tight, they were not what immediately caught out eyes. We saw the pricing they were offering the customer and it was clear to us that it was low. We raised the issue but were told not to worry about it.\u00a0<strong>There are valid business reasons to do projects at a loss\u00a0sometimes<\/strong>, so it was okay, except the exact wording to us was, \u201cplease limit yourselves to your\u00a0<em>little<\/em> expertise sphere.\u201d Ok then.<\/p>\n<p>We talked to our teams and we committed to the dates defined in the project documentation. Again, it was a little tight but feasible: we would have many months to get things ready for initial deployment.<\/p>\n<p>About a week after we approved the statement of work, I received a call from the customer. At this point, I had not yet engaged the customer at all, so they had gotten my phone number from their sales rep. The customer was possessed. <strong>This person I had never talked to before was shouting at me on the phone<\/strong>\u00a0that we were late. It took me a while to call him down and understand what the issue was.<\/p>\n<p>As it turns out, the sales team, in an effort to get the customer\u2019s signatures before the end of the quarter, changed the statement of work after we had gone through it, moving the dates to\u00a0<em>right that\u00a0very moment.<\/em> We had not even started working on the project yet and the customer was expecting it to be ready right then. <strong>We were late before we even started<\/strong>.<\/p>\n<p>Many stressful meetings later we managed to agree on some new dates, but they were much tighter than the ones originally in the statement of work and would required us to\u00a0outsource parts of the project to a contractor to help speed up things. Incidentally, what we paid the contractor for\u00a0<em>only a part of the project<\/em> was more than what our company made on the project. <strong>All because the sales team wanted to make sure they got their commission in that quarter<\/strong>.<\/p>\n<p>The people responsible would eventually be let go of the company, in great part due to this, but that did not prevent the company from losing at least an order of magnitude more than what it made from that project.<\/p>\n<p>And still, I continue to see salespeople ignoring the developers and then trying to share the fallout. <strong>Developers need to stand firmly by their professional evaluations\u00a0of deadlines and technical feasibilities<\/strong>.<\/p>\n<p>Of course, if you turn out to be wrong, all of this is moot.<\/p>"},{"title":"Goodbye, Mr. Spock.","link":"https:\/\/rselbach.com\/goodbye-mr-spock\/","pubDate":"Fri, 27 Feb 2015 19:31:53 +0000","guid":"https:\/\/rselbach.com\/goodbye-mr-spock\/","description":"<p><a href=\".\/leonard_nimoy_02.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_6c6f0decf5e4195e.webp 320w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_a5796f7ae96a06af.webp 480w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_e3dbc833f9cf4b34.webp 640w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_19b937628b8d1d0a.webp 800w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_c27485715b38d9af.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768.jpg\"\n alt=\"Leonard Nimoy\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"768\" srcset=\"https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_1c603e5d227574e3.jpg 320w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_14a65417df2a587b.jpg 480w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_c1550139bcf5f4f.jpg 640w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_3795dcaaf83a42a7.jpg 800w, https:\/\/rselbach.com\/goodbye-mr-spock\/leonard_nimoy_02-1024x768_hu_c41862b1f07f2547.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>I am sad. <a title=\"The New York Times\" href=\"http:\/\/www.nytimes.com\/2015\/02\/27\/arts\/television\/leonard-nimoy-spock-of-star-trek-dies-at-83.html?module=Notification&version=BreakingNews&region=FixedTop&action=Click&contentCollection=BreakingNews&contentID=30440287&pgtype=article\" target=\"_blank\">The New York Times<\/a> \u2014<\/p>\n<blockquote>\n<p>Leonard Nimoy, the sonorous, gaunt-faced actor who won a worshipful global following as Mr. Spock, the resolutely logical human-alien first officer of the Starship Enterprise in the television and movie juggernaut \u201cStar Trek,\u201d died on Friday morning at his home in the Bel Air section of Los Angeles. He was 83.<\/p>\n<\/blockquote>\n<p>I am actually sad. As much as <strong>Star Trek<\/strong> was a part of my life, I had not felt this way when other cast members passed away in the past.<\/p>\n<p>I suppose Nimoy was different somehow. My theory is that as Spock, he would (almost) never smile and that made his rare smile that much more important. When I think of Nimoy\/Spock, it is his smile that I picture in my mind. When out of character, he was\u00a0<em>always<\/em> smiling. This contrast forces an emotional connection or something. I don\u2019t know.<\/p>\n<p>What I do know is I am sad. For whatever\u2019s worth, Nimoy was a part of my life.<\/p>\n<p>You\u2019ll be missed, Mr. Nimoy. I have been, and always shall be, your fan.<\/p>"},{"title":"My social anxiety screwed me royally this week","link":"https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/","pubDate":"Sat, 18 Oct 2014 11:48:19 +0000","guid":"https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/","description":"<p><a href=\".\/1024px-Sadness_4.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_33ee231265395f65.webp 320w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_72feabd47b89ade1.webp 480w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_a2fb02df0eab4609.webp 640w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_561332c27302fdf7.webp 800w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_161389565aa8c168.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678.jpg\"\n alt=\"By Christopher Walker (Sadness) CCBY\u2212SA2.0(http:\/\/creativecommons.org\/licenses\/by\u2212sa\/2.0)CC BY-SA 2.0 (http:\/\/creativecommons.org\/licenses\/by-sa\/2.0), via Wikimedia Commons\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"678\" srcset=\"https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_55bf45ec843e39d4.jpg 320w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_4adc2eab52a3e49a.jpg 480w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_c8d036771b3550ff.jpg 640w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_cca4686209ccd1bf.jpg 800w, https:\/\/rselbach.com\/my-social-anxiety-screwed-me-royally-this-week\/1024px-Sadness_4-1024x678_hu_40052fa7f3de9e2b.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>A few years ago I <a href=\"https:\/\/rselbach.com\/2011\/08\/04\/my-need-for-anonymity\/\" title=\"My need for anonymity\">wrote<\/a> about how social anxiety makes me use fake accounts on the web.<\/p>\n<blockquote>\n<p>I love coding. I have done it since I was a kid and it\u2019s the best thing I know how to do. And then there is open source. Open source projects should be the perfect venue for me to have f un. Except I am scared stiff by the idea that someone might laugh at the code. It came to a point where it is impossible for me to contribute. Then I\u2019ve come up with a solution: an alias. For the past several years I\u2019ve lived two different lives online: one as myself and another as an alias. I keep them strictly separate.<\/p>\n<\/blockquote>\n<p>Actually I today use more than one single separate life. Looking at my Chrome identities menu I count four (including the real me), but I actually have more around that I have abandoned.<\/p>\n<p>It has allowed me to do what I like to do. I don\u2019t have to be afraid because I know all I have to do is abandon one account and start over with another. It\u2019s a good solution but it has some issues.<\/p>\n<p>I have been offered this\u00a0<em>great<\/em> job in the past by the manager of someone I\u2019ve worked together. It was one of the Big Tech Companies, a place I <em>really<\/em>\u00a0would love to work. All great, right? Except the offer was not addresses to Roberto Teixeira, but to one of my aliases. Tough luck. I\u2019ve soon abandoned that alias for good.<\/p>\n<p>So yes, it sucks. But not as much as it has sucked this week.<\/p>\n<p>I\u2014under an alias\u2014have been working with a developer of a big open source project out there to try to solve a problem we were having at work.\u00a0And I found a solution that was pretty clever. That developer checked it out and thought it was great and then we both wrote a proposal and submitted it. And it was\u00a0accepted and our change will be part of their next major release.<\/p>\n<p>I\u2019m not saying it was something revolutionary or anything. Still, it was something I am very proud of. And there will be a name there in the changelog\/release notes\/whatever but\u00a0it will not be my name.<\/p>\n<p>This happened the same week I learned that someone I\u2013the real me; real name and everything\u2013interviewed with a few months\u00a0ago had dismissed me for not having open source contributions.<\/p>\n<p>In short, I am sad and angry. Fuck social anxiety. \ud83d\ude41<\/p>\n<p>(<em>photo: Christopher Walker (Sadness) \/ <a href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/2.0\">CC BY-SA 2.0<\/a> \/ via Wikimedia Commons<\/em>)<\/p>"},{"title":"From Kerbin to Laythe and Back","link":"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/","pubDate":"Thu, 25 Sep 2014 19:29:21 +0000","guid":"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/","description":"<p>Even though I\u2019ve been playing Kerbal Space Program for over a year, I have only barely explored the outer kerbolar system. I have been around Jool before and I have even landed on Laythe but never managed to make a round trip until this week.<\/p>\n<p>Traveling all the way to Jool\u2019s moon Laythe and back is not easy<sup>[<i><strong>citation needed<\/strong><\/i>]<\/sup>. It\u2019s not so much getting there\u2014although that\u2019s not trivial, either\u2014but we want to <em>land<\/em> on Laythe <em>and<\/em> we want to get back to orbit later: that takes a lot of fuel.<\/p>\n<p>This is my adventure.<\/p>\n<h2 id=\"mission-overview\">Mission Overview<\/h2>\n<p>The Kerbal Air and Space Agency (KASA) will be sending two separate missions: the <strong>Laythe Recovery System (LARS)<\/strong> and the <strong>Laythe Orbital Landing System (LOLS)<\/strong>. The LARS stack is controlled by an automated probe and its function is to carry fuel for the travel back.<\/p>\n<p><a href=\".\/screenshot31.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_3f4b96bc64bec8ec.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_d30fe1caecdc6b8e.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_495d7addc31b5e1d.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_e6093f521dc0ae6b.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_abf5db97b0f36e7f.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31.jpg\"\n alt=\"screenshot31.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_a320d42201779c62.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_d056bf5b3c151353.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_9e16ee53c462f497.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_e4b43be18bf68bf6.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot31_hu_f525f37f9a0665d9.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Although huge, it is only as heavy as it needs to be to deliver fuel, lacking scientific instrumentation and communication systems other than the Clamp-O-Tron\u2019s acquisition signal.<\/p>\n<p>The second stack is LOLS, which will carry a 3-kerbal crew, the lander itself, and all the scientific instruments: a gravioli detector, a termometer, a barometer, and a Mystery Goo\u2122.<\/p>\n<p>The two stacks will launch a couple of days between them and will meet in orbit around Jool over two years later. LOLS will then rendezvous with LARS, dock, and transfer any remaining fuel from its tanks and then drop its large tank before the LARS will then make the Hoffman transfer to Laythe<sup id=\"fnref-1\"><a href=\"#fn-1\" rel=\"footnote\">1<\/a><\/sup>.<\/p>\n<h2 id=\"lars-launch-and-trans-joolian-insertion-burn\">LARS Launch and Trans-joolian Insertion Burn<\/h2>\n<p>The first of the two missions to launch was LARS, the rationale being that if something were to go wrong later that prevented the LOLS launch, LARS could wait in Jool orbit for the several years until a new interplanetary window opened to allow LOLS\u2014or its successor\u2014to go rendezvous with it. It would be harder to keep a Kerbal crew waiting there<sup id=\"fnref-2\"><a href=\"#fn-2\" rel=\"footnote\">2<\/a><\/sup>.<\/p>\n<p>Also, to minimze the risks, LARS was launched as soon as the window opened, allowing for more time to deal with any issues with LOLS later. This resulted in a night launch.<\/p>\n<p><a href=\".\/screenshot32.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_11591f81349fb758.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_2111a878d7fc7e04.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_444bda4d0daa940d.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_1269c5fc556483b7.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_3529215ff986c9bf.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32.jpg\"\n alt=\"screenshot32.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_a3d232049cfd5bd0.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_ac15e1ea72a5670.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_101cc5229f06ca9a.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_ab40b2ad8e5ab04.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot32_hu_fb34239cd78069f4.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Showing that LARS was not too heavy, it quickly started accelerating towards terminal velocity and we lower the thrust to about 80% so we don\u2019t waste fuel fighting drag.<\/p>\n<p><a href=\".\/screenshot34.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_4a30015e5b37249f.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_f4983873f68ce4d5.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_3f8365584ce44f3d.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_3e240cb58b864a74.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_89f28f6317199519.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34.jpg\"\n alt=\"screenshot34.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_5a3af5c07c951d4.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_a996c6e4df7b0ed8.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_991dbc9cb50343bd.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_1fdc59666f9848fe.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot34_hu_8e128dfdde01b6d3.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>At 7300m we start the roll program to begin gaining horizontal speed. A little later, just passing the 10,000m mark our two first boosters run dry and we have a beautiful separation.<\/p>\n<p><a href=\".\/screenshot35.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_ceab067356cc93ab.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_97275314c68c9d44.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_702f5c71036644ac.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_af2fc48e79e2b419.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_588466fb75af530.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35.jpg\"\n alt=\"screenshot35.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_8a2aadd04f33c5c3.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_c04eb7fc7cc7cea6.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_aa7f3132dd955527.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_9286a84601b62cd0.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot35_hu_6b2db0093c914774.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>At its parking altitude of 240Km, the probe circularizes its orbit and, as Robert Heinlein would have said it, we are halfway to anywhere<sup id=\"fnref-3\"><a href=\"#fn-3\" rel=\"footnote\">3<\/a><\/sup>.<\/p>\n<p><a href=\".\/screenshot37.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_3d89f2ae612cf9ec.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_ae9f4780dafc62ab.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_f4267ffe88e6fdc1.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_f560ef44d6058689.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_f62467048d8fdb.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37.jpg\"\n alt=\"screenshot37.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_a44b3fd33d788927.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_2004577b91e86e4d.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_796c58948e8f696.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_e19b0c1723a38c92.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot37_hu_789534e262ac0759.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>About 2 hours after settling in its parking orbit, LARS is GO for TJI. This burn adds the 1,907m\/s delta-V needed for LARS to reach Jool.<\/p>\n<p><a href=\".\/screenshot38.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_cb980ee9ff40f7a0.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_91911c3568e850d1.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_294f20400368e31e.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_b384f7b3d3e4c7ff.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_6a57af0f73d485dd.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38.jpg\"\n alt=\"screenshot38.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_e8f7db63174ca825.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_4bfb94d45dd50dcb.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_37624f3eb6838a2e.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_42efd003a525cb8.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot38_hu_ea95765a3f57d138.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>After the burn is done, LARS is on its way. Time to remember to extend our four Gigantor solar panels to ensure the probe will have power in its journey<sup id=\"fnref-4\"><a href=\"#fn-4\" rel=\"footnote\">4<\/a><\/sup>.<\/p>\n<p><a href=\".\/screenshot40.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_aa5b7346beaccfb5.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_7980f51bb6829e2f.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_33c7b9e3140c03e.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_850688e25c168c12.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_e70274ca3391a634.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40.jpg\"\n alt=\"screenshot40.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_fc2466cfffc11825.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_f20b0021407f63d5.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_505adcc26958dcb6.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_b005cc74e51906d4.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot40_hu_75909a2ca1190845.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>With LARS now on the way, the KSP staff turns its attention to their next mission: LOLS.<\/p>\n<h2 id=\"lols-launch-and-trans-joolian-insertion-burn\">LOLS Launch and Trans-joolian Insertion Burn<\/h2>\n<p>LOLS presents its own set of challenges. It is considerably heavier than LARS because not only it carries a similar amount of fuel\u2014which it will spend much more quickly due to the extra mass\u2014but it also adds the crew, large capsule, and scientific instrumentation.<\/p>\n<p>With the greater weight, the engines struggle to lift off the launch pad. It takes almost 20 seconds to clear the flag pole by the pad.<\/p>\n<p><a href=\".\/screenshot41.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_d5f294a2c066b692.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_83beb5943a5d968f.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_7184519388d9bae6.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_176a7c8440babfb4.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_82703d48c3995e2f.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41.jpg\"\n alt=\"screenshot41.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_dd2caee64d782b35.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_76f3ed5428b66ac.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_a2612e3762cb6777.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_d7b55268b79e16d8.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot41_hu_d55d0a19f40aefec.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>It never comes close to terminal velocity while in the atmosphere and the throttle remains at 100% all the way. It begins roll program at 7300m and has barely accelerated past the 200m\/s mark at this point.<\/p>\n<p><a href=\".\/screenshot42.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_57dbc2c5e770b91a.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_63f9342dd1bfa132.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_289b1c4ac0efdc59.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_2c392d0ad57000f9.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_128a93cda0babd2a.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42.jpg\"\n alt=\"screenshot42.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_a37ac1499dc2bf0.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_71cf457bb018c4ec.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_a39816b3643b6846.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_9d19e6a38cc2739d.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot42_hu_31c50bc08cdfbd43.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>After another beautiful separation, the speed is mounting a bit faster now\u2026<\/p>\n<p><a href=\".\/screenshot43.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_af4233517f403d89.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_4d490ffa9a8e75e9.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_79074674baa442c4.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_1e9a3cfd382d7a26.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_9253f89912c8a5b8.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43.jpg\"\n alt=\"screenshot43.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_c89829e132bcf638.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_4adbe963de27d8c5.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_911c58caef8fa5db.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_e6c7eed49e93099.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot43_hu_61b2084496ad3ec0.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>\u2026 but it still takes a while. As well, although LARS managed to reach orbit on its second stage alone\u2013albeit running on fumes at the end\u2014, LOLS had to rely on the third stage to reach orbit, spending half its fuel tank.<\/p>\n<p><a href=\".\/screenshot46.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_c5ebddbb874259d.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_c8b853ab6f44276c.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_3354a3eeaa5f077a.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_7fc3f1be5858dcdb.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_a448cd32610cc7c6.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46.jpg\"\n alt=\"screenshot46.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_656962ab9922fa78.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_6426574e50811899.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_4417f6a4e926bbff.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_a222758f58792347.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot46_hu_dba571f1400d7deb.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>About 90 minutes after reaching the parking orbit, LOLS is GO for TJI. Delta-V needed is 1,904m\/s.<\/p>\n<p><a href=\".\/screenshot47.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_1c6f417a223a3650.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_a917cc3db0d6a1a.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_86eb4646b6e11f62.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_3b465392d11bc61f.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_644be26a6d5dc885.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47.jpg\"\n alt=\"screenshot47.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_b66631e0a95ff7a6.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_831fb25cd982e27a.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_ef973087f106b047.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_6dfa2c8a80502011.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot47_hu_1bdbc52415866007.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Over a million kilometers behind LARS, LOLS is now on its way for the long, nearly-two-year-long journey to Jool.<\/p>\n<h2 id=\"deep-space-transfer\">Deep space Transfer<\/h2>\n<p>During the long transfer period spend after escaping Kerbin\u2019s sphere of influence and before the encouter with Jool, the crew does some science.<\/p>\n<p><a href=\".\/screenshot50.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_82164f18811f1e43.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_a1653e49f1ad8fc4.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_aeefebf6ae402ff3.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_2127e8743b9d597d.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_b88da7051952f1bd.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50.jpg\"\n alt=\"screenshot50.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_6ef176c7808409a7.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_cfd84310c393eaf6.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_2305a8f249208fab.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_e9a3c540178c9a94.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot50_hu_6251bae2418a18f9.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Tonmen Kerman goes EVA for a while and reports back to Kerbin. They also do a crew report and use the gravioli detector for some extra science production.<\/p>\n<p>The original plan was to have LARS arriving first and waiting for LOLS to arrive. That would make sense as LARS is an automated probe while LOLS is carrying actual kerbals. That is why mission control<sup id=\"fnref-5\"><a href=\"#fn-5\" rel=\"footnote\">5<\/a><\/sup> na\u00efvely launched LARS first. As it turns out, it was a mistake.<\/p>\n<p><a href=\".\/screenshot49.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_e952c21755f27ddf.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_3303234b29b774d8.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_11efae439cfd85d7.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_5183258aee48d1cc.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_d4b577b700308d1f.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49.jpg\"\n alt=\"screenshot49.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_180c58d2c0094d2a.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_6a2308c11e9d5278.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_d0677313e1f1177c.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_583f2e1301593374.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot49_hu_c01931522ced7648.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>As you can see in this picture, LARS <em>is<\/em> indeed ahead of LOLS. However, due to their positions in relation to Jool itself, LOLS ends up getting caught by the Jool sphere of influence <em>before<\/em> LARS. This caught mission control by surprise and almost ended the mission as all its attention was on the LARS approach and only by sheer dumb luck they noticed LOLS encountering Jool SOI.<\/p>\n<p><a href=\".\/screenshot51.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_6852670c5c84bfcd.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_37474c7648881cd9.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_7824e96c0b4de981.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_9efd388c3f75061f.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_d45979e6c4168eb7.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51.jpg\"\n alt=\"screenshot51.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_b6444cfe9410b832.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_f7cf0b38e97d00c9.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_9c979bc4a6c1df94.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_900a1f14eea668b2.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot51_hu_e0f17fa7f92eba6f.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>In retrospect, this makes perfect sense. In the 1-2 days following the launch of LARS, Kerbin and Jool were moving in relation with each other. Kerbin, having a much lower orbit than Jool\u2019s, was moving faster and since it was \u201cbehind\u201d Jool, this meant both planets were actually getting closer to each other so LOLS had a slightly shorter trip than LARS. That\u2019s orbital mechanics for you.<\/p>\n<h2 id=\"lols-aerobreaking-and-joolian-orbit-insertion-burn\">LOLS Aerobreaking and Joolian Orbit Insertion Burn<\/h2>\n<p>One year, 270 days into the mission, LOLS, already deep inside the joolian SOI, maneuvered to adjust its periapsis to 110Km above Jool. Jool\u2019s atmosphere begins at around 138Km of its sea level, which is not that much considering how big the planet is. But that atmosphere is <em>very<\/em> dense, which is good for aerobreaking, saving us some precious fuel.<\/p>\n<p><a href=\".\/screenshot52.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_51204ba89503145e.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_f965420b2d556ad3.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_f36cb495d1e32d35.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_760f4225ad78a39d.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_27ca036823e3f0e6.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52.jpg\"\n alt=\"screenshot52.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_8961447cd0a33dc1.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_d30f5e6362b10bf4.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_58d2e4915887886c.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_858aef8f6d73db6.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot52_hu_78bc4452f7b7fe82.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Two days later, LOLS reaches Jool\u2026<\/p>\n<p><a href=\".\/screenshot53.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_c3214cc45c9b3d26.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_a974ab0a944a599f.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_6c06988bdbd69069.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_f37fafec2182164c.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_6a661da2b7a8b5cd.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53.jpg\"\n alt=\"screenshot53.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_62dc25faa6a24b4e.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_c113ebfb700a500.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_89f4da681f04630a.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_f8ddf1f3596d4078.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot53_hu_7a06f0fbb97ef92c.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>\u2026 and falls 30Km into its dense atmosphere for some heartstopping aerobreaking.<\/p>\n<p><a href=\".\/screenshot54.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_ff86db5bc8c31a3f.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_5666cffcb6cddc48.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_5a870a0b8fd130df.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_76caef9dba61065a.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_fb451ce2786fb0bd.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54.jpg\"\n alt=\"screenshot54.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_5299ca59045455b5.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_b7be1f7f0b7a6c86.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_8e7714b7a02f7287.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_a4c7af4b51fb52df.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot54_hu_e8616f53f9768a0f.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Mission control found 105Km to be a great aerobreaking altitude as LOLS re-emerged from the atmosphere with an apoapsis of a tad over 500Km, which required <em>very<\/em> little delta-V during the Joolian Orbit Insertion burn to reach the desired parking orbit of 400Km. The crew adjusted their apoapsis and periapsis and waited for the LARS to arrive. This was the early hours of <strong>1y 273d MET<\/strong><sup id=\"fnref-6\"><a href=\"#fn-6\" rel=\"footnote\">6<\/a><\/sup>.<\/p>\n<h2 id=\"lars-aerobreaking-and-joolian-orbit-insertion-burn\">LARS Aerobreaking and Joolian Orbit Insertion Burn<\/h2>\n<p>Twenty seven days after the arrival of LOLS in Jool, LARS enters Jool\u2019s SOI. LARS will try for an approach with a periapsis a little lower: 105Km. The 5Km difference doesn\u2019t sound much but considering the density of Jool\u2019s atmosphere, it makes a difference.<\/p>\n<p>Despite mission control\u2019s best efforts to point it retrograde, LARS insisted in going nose first.<\/p>\n<p><a href=\".\/screenshot55.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_7a4bc317b2e81303.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_6d91ebc685f2d1f7.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_16dc5c4191afade2.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_60adfa74a4ee3e23.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_8c8461b55b4a081b.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55.jpg\"\n alt=\"screenshot55.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_5379803f29a3d0ee.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_fe090234109ec8ce.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_5da7212e49fae0c8.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_d80dbc00c39658a.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot55_hu_4cda095e198ef142.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>LARS leaves the atmosphere with a apoapsis of a little under 400Km, again leaving little delta-V for the JOI burn. It parks at 280Km. This is 1y 386d MET, meaning the intrepid kerbal crew waited in orbit for 113 days for LARS, even though their total mission time so far was a little under 2 days shorter than LARS\u2019.<\/p>\n<p><a href=\".\/screenshot57.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_da63ad1d5722b4fc.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_3c6188017a9df223.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_56d200fd607530.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_7c0e27a680338606.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_5911ca57f8df291d.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57.jpg\"\n alt=\"screenshot57.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_63f15904af51dd3c.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_d335d5187a792ac5.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_b292081314dec8ed.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_57522dfcc4e08313.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot57_hu_2ef12918db65a7b2.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<h2 id=\"rendezvous-and-docking\">Rendezvous and Docking<\/h2>\n<p>As soon as LARS settled in its parking orbit, the LOLS crew starts working on the rendezvous maneuver. A good encounter happens after 5 orbits around Jool.<\/p>\n<p><a href=\".\/screenshot58.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_fb9e8b6ae2d30ceb.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_709a5161904a649.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_7218f3e6a050d71e.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_56d608ed62931ec6.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_be65c83a7496db74.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58.jpg\"\n alt=\"screenshot58.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_ad45df91b4c74159.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_7a316f63d0d9801c.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_3cbbf699e847d250.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_a5ac2ba5338532e5.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot58_hu_6b7622b2e9184281.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n<a href=\".\/screenshot59.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_eedab0b7fe1bab2c.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_422e444ec3131a22.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_7347eb4607e94546.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_4804e0f4833722c4.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_733ac862db474b7d.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59.jpg\"\n alt=\"screenshot59.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_ad0a0d935ff6c088.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_d778350cfeb8bc06.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_604bcd7451a6fd67.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_98d9c6a5711d94ba.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot59_hu_bd86a3e91d3903c0.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n<a href=\".\/screenshot61.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_3dfc97bfbf4b5528.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_6931768377e48a16.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_271e95aeb63a8565.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_daa7943f21009f89.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_4e4dae5ad302c2b1.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61.jpg\"\n alt=\"screenshot61.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_d8e095a5f9fabf76.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_afef58fe3aa65da7.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_2cb1178367b13e75.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_77463c0d382276a0.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot61_hu_958093d13ad14422.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Once docked, the crew transfers all the fuel remaining on the LOLS main tank to LARS and ejects it. From now on, LARS will be doing the heavy lifting of the Trans-laythean Injection.<\/p>\n<h2 id=\"trans-laythean-injection-and-laythean-orbit-injection\">Trans-laythean Injection and Laythean Orbit Injection<\/h2>\n<p>(I mentioned early on that rendezvous in Jool orbit proved to be a mistake. The why might become more clear from this picture.)<\/p>\n<p><a href=\".\/screenshot62.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_63832e069a4e305.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_4a1a53d6355e0ef2.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_a36bfbdc095e3343.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_d2d3121208d571c4.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_5ad8cb29150aad6a.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62.jpg\"\n alt=\"screenshot62.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_ca911c60fe201983.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_93ef4785e2cb05fd.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_4efecc59cd6892fb.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_5a968c8ed6241aef.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot62_hu_71cc727444aa612d.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>The two small extra boosters added to LOLS made it a bit too much for the Clamp-O-Tron docking port to hold. When LARS ignited its engine for TLI, the centre of mass shifted slightly but enough to make LOLS wobble and put on too much stress on the docking port, which then broke. (Thankfully I had quicksaved just before the burn and was able to recover.)<\/p>\n<p>The crew slowly pushes on the throttle to ease on the clamp-o-tron stress. Same thing during LOI: easy on the throttle. The crew and mission control also agreed to skip the aerobreaking, the rationale being that Laythe\u2019s atmosphere is low (55Km) and not very dense so it would probably not help them all that much and they did not want to put on more stress on the docking port.<\/p>\n<p><a href=\".\/screenshot63.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_55cbd95555cfba94.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_d06ada2911bd38c1.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_cbc9bac17af0e2cf.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_56923ff90faf4515.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_b27a24603d984eed.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63.jpg\"\n alt=\"screenshot63.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_58aa8cbe5491c20b.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_2862258ad489c27.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_a3c9b71f8dfdee72.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_2a6fddf39de75094.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot63_hu_f25623cb85359424.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<h2 id=\"undocking-lols-and-landing\">Undocking LOLS and Landing<\/h2>\n<p>At this point, the crew transfers fuel from the LARS main tank to the three LOLS tanks and undocked. Time to land.<\/p>\n<p>Laythe is touch to land for two basic reasons:<\/p>\n<ol>\n<li>It\u2019s almost entirely made of oceans, with some relatively small islands and continents; and also<\/li>\n<li>The islands and continents are rough! Lots of mountains and steep slopes.<\/li>\n<\/ol>\n<p>The crew ultimately picked the continent that looks sort of like a large \u2018C\u2019 with an internal sea.<\/p>\n<p><a href=\".\/screenshot66.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_64033c83419f8164.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_fa10c98765a83076.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_c653adca49db9fe9.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_c488a244d7459723.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_36e529ea5c846e6e.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66.jpg\"\n alt=\"screenshot66.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_4e32b3815a0f2485.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_fb4a8824b4778b12.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_7ae59354ceececaa.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_36740859ce9102bd.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot66_hu_79478b6990a1845e.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>(It took me a few tries and one big scare as just before landing I noticed a deep valley just ahead.)<\/p>\n<p><a href=\".\/screenshot67.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_b01371b13c4db757.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_2bb1f5907b1b85ae.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_c8cd47cd718ceffc.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_a18d970da5f8e7d.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_aa68c72fd20e1169.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67.jpg\"\n alt=\"screenshot67.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_d32e026fb86765b6.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_64b768dd6e433ae9.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_5f3518b3bd2488b1.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_b6a8ae552942a2b8.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot67_hu_33048eb30a26fa6b.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>LMP Donbro Kerman uses the retro rockets plus the parachutes to slow the LOLS down and slowly descend.<\/p>\n<p><a href=\".\/screenshot68.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_c3fb9edf0831bb8f.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_1b7113a751a73d56.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_caa0ef0ed9deca94.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_624c3d9bdd477681.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_fcf7b57ceb8d0b92.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68.jpg\"\n alt=\"screenshot68.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_7398ba1fa0b3f649.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_33c1a932ae1fd1d8.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_334359de885efb11.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_7d79fc38f9007ece.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot68_hu_50ef757b4ed2478f.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>He also has to rotate LOLS around to make sure it lands in a way to prevent it from tumbling over the slope.<\/p>\n<p><a href=\".\/screenshot69.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_13c3c712a6c138f6.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_953fd6d48d36acde.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_e3f2ed0ef73cbee3.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_ac9f99d87673a233.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_2152902e39fa5cae.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69.jpg\"\n alt=\"screenshot69.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_a5b2bafab20343ff.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_f36fe4ed0f212185.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_8fae458c6c01efad.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_bdf6a54c15fce268.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot69_hu_7f7c785450ec325a.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>It all ends well though, as Commander Roley Kerman steps out of LOLS and steps on Laythe.<\/p>\n<h2 id=\"laythe-base\">Laythe Base<\/h2>\n<p>The crew has to remain on the surface until the next interplanetary window before they could go back to Kerbin, which means: time for some science! With some gravioli detection, temperature and barometric measurements, EVA reports, crew reports, Mystery Goo\u2122 observation, and some surface samples, the LOLS crew gets well over a thousand science points.<\/p>\n<p>And they had some fun too, like this little night rave or whatever. This is Donbro standing by the lander legs while Tomner jumps by the flag.<\/p>\n<p><a href=\".\/screenshot71.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_582ccadc85733f5e.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_42b2bc31ee0cd5e7.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_19204296ff8df0ad.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_16f367ccf2a2bdfe.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_60f0bcfd0cefbf58.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71.jpg\"\n alt=\"screenshot71.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_7c9241ff6b757254.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_f9581e5f8bf95fcc.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_6296e21f0652b4d3.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_f5ebbe5be0cd8457.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot71_hu_9719d6a711086b0c.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Commander Roley was asleep and missed the shenanigans. Probably for the best.<\/p>\n<h2 id=\"takeoff-and-rendezvous\">Takeoff and rendezvous<\/h2>\n<p>After a couple of years on Laythe, the crew was eager to go back home.<\/p>\n<p><a href=\".\/screenshot73.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_2bf1fdd4f7754a3d.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_57c8bb61663d72f.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_f9437db1426dbeb2.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_adcc1b92865738e1.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_5b597d6ab7e0984a.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73.jpg\"\n alt=\"screenshot73.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_e5b05887a3e170b6.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_3c12ffae3a468518.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_e2ecaf1f07e5ecb.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_1ab7464e962b65cf.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot73_hu_a87278401cd432c6.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>LOLS rendezvous with LARS, which patiently waited all these years in orbit.<\/p>\n<p><a href=\".\/screenshot74.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_b9395f24e7bad88b.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_a7db7d42962a6b1.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_2c8a82a19e50caca.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_c450b6808c8838e6.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_d635f3633d82f578.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74.jpg\"\n alt=\"screenshot74.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_8fd1f160a376b52d.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_e5b65bc51e07253c.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_c6ec67f0c8f4a2fd.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_973d04dd6c157c1b.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot74_hu_e9971d7ba47203ac.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n<a href=\".\/screenshot75.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_39d580b04a2c6013.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_747953eec06443e6.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_3cd471e5b9b97c5e.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_cdf51204d3f3bed.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_b0ffd79a844b28d7.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75.jpg\"\n alt=\"screenshot75.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_622be8af09dcc750.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_d65d2559ed22a525.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_f498bd307d38a830.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_bb63476201a24274.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot75_hu_53bc90b9cb6f5f86.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n<a href=\".\/screenshot77.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_6b207e58b83b316e.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_63b4de355f845c8a.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_7e9c2c89b5ec2075.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_ed6a8c78a920e87c.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_bf2e7eefe3019322.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77.jpg\"\n alt=\"screenshot77.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_b3d824d3c7d91317.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_5ff98d3995bb4faa.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_5c18a8e35fc5af51.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_cc7b25d2df977596.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot77_hu_6b8a6cac3c4fd98b.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>The crew now transfers the remaining fuel from the LOLS tank to LARS\u2019 and jettisons it. Time to go home.<\/p>\n<h2 id=\"the-jorney-home\">The jorney home<\/h2>\n<p>The jorney back is largely uneventful, starting with the transfer from Laythe back to Jool. Now that they got rid of the LOLS tanks, the Clamp-O-Tron docking port is more than capable of holding the capsule in place.<\/p>\n<p>Back in orbit around Jool, LARS is GO for Trans-Kerbal Injection.<\/p>\n<p><a href=\".\/screenshot78.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_1ee6c4aef2124c70.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_4b6404ac37b846c3.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_63aeb59e10ad8562.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_f35788319224ef47.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_8d797154c2c063dd.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78.jpg\"\n alt=\"screenshot78.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"626\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_37641369228c31f8.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_49930f11a90c618c.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_7115ede729faae28.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_de3c592d79d663b5.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot78_hu_5c0814459a60db36.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>And the long journey back to Kerbin is now underway.<\/p>\n<p>Two years later, the crew maneuvers to reach Kerbin with a periapsis of 30Km for some heavy aerobreaking.<\/p>\n<p><a href=\".\/screenshot79.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_de972b692f7534fc.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_7fd066931d2a0c14.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_29ae07f13e566f18.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_684bad8da8d87a55.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_23ead3d19b9eeeb4.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79.jpg\"\n alt=\"screenshot79.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"626\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_d69facf0809f5bd7.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_d80fe13facaf13a2.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_7ab6490c7d48c292.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_49dfa08add8a7a1c.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot79_hu_8cb29ee9d1ed616c.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>They reemerge from Kerbal atmosphere with an apoapsis of almost 2,000Km and running of fumes. The remaining fuel is then used to lower the apoapsis a little bit without changing the periapsis too much. This made sure that on the second periapsis pass, the stack will not make it out of the atmosphere again.<\/p>\n<p>At this point, mission control tries for a bonus mission objective. They plan to land both the LOLS capsule <em>and<\/em> the LARS rockets at the same time and try to recover the LARS hardware costs. After they stop burning in the reentry, the LOLS capsule undocks from LARS and mission control constantly switch between the two to try and land both.<\/p>\n<p>Unfortunately, saving the LARS was a failure. As soon as the parachutes opened, LARS disintegrated, leaving only the RCS tank and docking port to slowly land.<\/p>\n<p><a href=\".\/screenshot80.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_888567b5743604a8.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_ff228601518594c1.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_c264ec7602ca9f53.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_2647ec3ad28a70e8.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_46f0190b7bfc9d9c.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80.jpg\"\n alt=\"screenshot80.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_7609c7aae547d168.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_94d60886f7f1233e.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_2679541a0efd189b.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_930fad68a8e13670.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot80_hu_27d9ceae294086.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>The LOLS capsule on the other hand had a beautiful descent.<\/p>\n<p><a href=\".\/screenshot82.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_d31a3e23415bb14d.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_f362a67df314e64a.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_4a25a80ec3543ae4.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_21d87daedfe45d99.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_6e2afbdce5b026e.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82.jpg\"\n alt=\"screenshot82.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_cd3b0dfda8f34e63.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_5f609e5086715cf3.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_47000a7a66d62927.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_cd46339b77bc838.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot82_hu_80d56951bb315707.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>After LOLS splashed down, the capsule, its science payload, and its crew were successfuly recovered. Mission accomplished!<\/p>\n<p><a href=\".\/screenshot83.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_4fc45dba71713b78.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_b2f9fa224c546878.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_c747f2dd1b74df8.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_84880c325286c521.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_a7feff0d8d7079fc.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83.jpg\"\n alt=\"screenshot83.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_33da35ba2a910a61.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_b5f06975efbd16fc.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_415d08ff15cf319e.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_40acfa0477b102bb.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot83_hu_44111c47d82a8078.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>The remaining LARS parts were found to not be recoverable.<\/p>\n<p><a href=\".\/screenshot84.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_689489dce4de60e1.webp 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_5e9998e6c2c372e3.webp 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_cc1ca77d8e5e9c45.webp 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_9d6dcc80c397662d.webp 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_aa41899de168d4e6.webp 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84.jpg\"\n alt=\"screenshot84.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"1024\" height=\"640\" srcset=\"https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_cdb206129ddb3c16.jpg 320w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_6bc8d40982fef6a.jpg 480w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_86fb4c9d13baa09e.jpg 640w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_165b006838658b04.jpg 800w, https:\/\/rselbach.com\/from-kerbin-to-laythe-and-back\/screenshot84_hu_f2aed908df75565e.jpg 960w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<h2 id=\"a-few-closing-remarks\">A few closing remarks<\/h2>\n<p>I was pretty pleased to have completed my longest mission yet. Still, a few things I would have changed.<\/p>\n<p>I wasted fuel by not aerobreaking in Laythe. Also, I am sure there is an optimal altitude that I could have reached Jool for a better aerobreaking. I did try several but going even a bit under 105Km seemed to be too much as the ship never came back out of the atmosphere. A little over 110Km and the apoapsis would end up in the millions of kilometers.<\/p>\n<p>Another thing is that I made the hop in Jool orbit between Kerbin and Laythe. I am not sure it is possible but I think I will try in the future to go directly to Laythe. It must be terribly difficult but a scenario would be to arrive in such an angle that you could aerobreak in Jool and come out with a path leading to Laythe directly, hopefully with some extra aerobreaking. This would be optimal but would require a lot of precision. I don\u2019t think I could make it but it sure sounds like it would be fun.<\/p>\n<p>I should also have scheduled the LOLS-LARS rendezvous to happen in orbit around Laythe instead of Jool to avoid the wobbly lander problem. The LOLS was low on fuel by that time though, so I am not really sure I could have pulled it off anyway.<\/p>\n<p>And I could have taken at least one more Mystery Goo\u2122 as I could have observed it in orbit aroud Laythe for some extra points.<\/p>\n<p>And finally, I <em>love<\/em> this game so much. You learn more every time you play it. This whole thing, including designing both stacks and doing some testing, was done over the course of a few days, mostly last weekend with the return from Laythe to Jool and then Kerbin done over a couple of nights this week.<\/p>\n<p>I thank Squad for this great game.<\/p>\n<p>May your solar panels be always unobstructed.<\/p>\n<p><strong>UPDATE:<\/strong> this whole story was created way before KSP 1.0 came out. The aerobreaking maneuvers here would not have worked due to the lack of heat shields. As well, a scientist kerbal in the crew would solve my issue above with only taking a single Mystery Goo\u2122 as kerbal scientists can reset experiments in flight.<\/p>\n<li id=\"fn-1\">\n That would turn out to be a mistake, as we\u2019ll see.<a href=\"#fnref-1\" rev=\"footnote\">\u21a9<\/a>\n<\/li>\n<li id=\"fn-2\">\n Not really, actually, as Kerbals don\u2019t seem to care\u2026<a href=\"#fnref-2\" rev=\"footnote\">\u21a9<\/a>\n<\/li>\n<li id=\"fn-3\">\n Heinlein\u2019s actual quote was \u201cOnce you get to earth orbit, you\u2019re halfway to anywhere in the solar system.\u201d I suppose it can be used for Kerbin and the kerbolar system.<a href=\"#fnref-3\" rev=\"footnote\">\u21a9<\/a>\n<\/li>\n<li id=\"fn-4\">\n You learn that the hard way in KSP. How many a time I have arrived somewhere after warping time just to find my ship completely dead because there was no electrical power left.<a href=\"#fnref-4\" rev=\"footnote\">\u21a9<\/a>\n<\/li>\n<li id=\"fn-5\">\n That\u2019s me.<a href=\"#fnref-5\" rev=\"footnote\">\u21a9<\/a>\n<\/li>\n<li id=\"fn-6\">\n Mission Elapsed Time<a href=\"#fnref-6\" rev=\"footnote\">\u21a9<\/a><\/fn><\/footnotes>"},{"title":"Things I wish I knew one year ago","link":"https:\/\/rselbach.com\/things-i-wish-i-knew-one-year-ago\/","pubDate":"Fri, 29 Aug 2014 00:47:23 +0000","guid":"https:\/\/rselbach.com\/things-i-wish-i-knew-one-year-ago\/","description":"<p>About an year ago, I started a new project in a stealth startup. Aside from the fact that it would provide currency that could then be exchanged for goods and services, including food for me and my family, one of the biggest reasons I took the job was that I was going to get to learn a lot of new things.<\/p>\n<p>Now, over a year later I can say that learn I did. And I caught myself thinking of what I wish I knew back in the beginning. The following list is probably not exaustive but it\u2019s a good example of what I\u2019ve learned. These are mostly things I\u2019ve dealt with on rewrites, redesigns, or are things that I still struggle with.<\/p>\n<h2 id=\"javascript-is-magical-and-thats-not-good\">JavaScript is magical and that\u2019s not good<\/h2>\n<p>I already had a general idea of the issues with JavaScript, but I really failed to grasp how <em>magical<\/em> JavaScript is. And when I say magical, I don\u2019t mean the good kind that conjures fluffy rabbits inside hats. I mean evil dark magic that would make Voldermort cry. I mean magic in the sense of a language that never seems to behave just the way you think it should.<\/p>\n<p>I wish I knew back then how much work I would need to spend to do what seemed at first to be basic, simple stuff. I often caught myself fighting JavaScript instead of working with it.<\/p>\n<h2 id=\"angularjs-is-awesome-but-the-web-works-on-jquery\">AngularJS is <em>awesome<\/em> but the web works on jQuery<\/h2>\n<p>I think <a href=\"https:\/\/angularjs.org\/\">AngularJS<\/a> is fantastic. Really I do. I am not at all sorry for having picked it for the project. I think it\u2019s well-designed and logical and yes, it is magical sometimes, but often in a good way.<\/p>\n<p>But\u2026<\/p>\n<p>I wish I knew back then how much work I would have to do making AngularJS and <a href=\"http:\/\/jquery.com\/\">jQuery<\/a> work together, and you <em>have<\/em> to make them work together because honestly, unless you want to reinvent the wheel for every little thing, you will end up using jQuery components. We will revisit that later.<\/p>\n<p>So yeah, AngularJS is great but for it to work properly, you <em>have<\/em> to do things the Angular way and that means turning a lot of jQuery components into AngularJS directives. Once you get the hang of it, it gets much easier and faster but there\u2019s a bit of a learning curve there.<\/p>\n<h2 id=\"asynchronously-have-you-think-undefined\">asynchronously have You think undefined<\/h2>\n<p>You have to think asynchronously to work with JavaScript. For a while, it was painful and it surely added to my perception of JavaScript being magical. JavaScript is entirely asynchronous and works like a turn-based game. This can be annoying at first and I caught myself working around this in all kinds of wrong ways. I wish I knew back then what I know now so I\u2019d embrace the async\u2019ness from the get-go. Things would be so much easier.<\/p>\n<h2 id=\"large-single-page-web-applications-rock-but\">Large single-page web applications rock but\u2026<\/h2>\n<p>Picking AngularJS as my framework of choice, I designed the web client for the project to be almost purely implemented inside the browser in JavaScript as a single-page app. This has some very good consequences, chief among them responsiveness. The application feels <em>fast<\/em>. Sure it has to download a lot of JavaScript up front, but (1) this is not nearly as bad as I expected it to be and (2) with caching this is done once and that\u2019s it. Switching from a \u201cpage\u201d to the other is essentially instantaneous as it\u2019s all pre-loaded AJAX parts of the page. The server actually has to do very little.<\/p>\n<p>But now, if I could start all over again, I would not do it like one big single-page app. It\u2019s just too much JavaScript code and I\u2019ve already established how I feel about that. I never have the feel that things are stable, even though there are integration tests passing all the time. I can\u2019t explain it but it all feels like a big house of cards, like it\u2019s all going to come tumbling down all of a sudden. I simply don\u2019t trust the code. I would much rather use JavaScript sparingly, to do <em>some<\/em> things but surely not all. I have been fixing this slowly by isolating some parts of the application as separate, but to do it for everything would require a rewrite that I don\u2019t have the time for right now.<\/p>\n<h2 id=\"trust-the-go-standard-lib\">Trust the Go standard lib<\/h2>\n<p>As an alternative title, \u201cdon\u2019t go too fancy with <a href=\"https:\/\/golang.org\">Go<\/a>.\u201d It\u2019s not that I didn\u2019t trust it, but I sure did try things that honestly didn\u2019t make sense. I am looking right at you, <a href=\"https:\/\/github.com\/go-martini\/martini\">Martini<\/a>, I had to do a lot of work to get rid of you.<\/p>\n<p>As it turns out, the standard library is really good. And for the things that are not in the standard lib, there are packages that are really well done and work <em>with<\/em> the standard lib, not against it. I love you, <a href=\"http:\/\/www.gorillatoolkit.org\/\">Gorilla Toolkit<\/a>.<\/p>\n<h2 id=\"never-assume-jquery-components-will-do-what-you-need\">Never assume jQuery components will do what you need<\/h2>\n<p>The current state of JavaScript is such that there is literally\u2014in the figurative sense\u2014an infinite number of components out there ready for you to use. As far as I can tell, <em>anything<\/em> I could ever possibly conceive of has already done and hosted on Github. There are time pickers, calendars, and even a business hours widget display ready for you.<\/p>\n<p>And yet.<\/p>\n<p>I am yet to find one single component that is flexible enough to work for my needs without extensive modifications. And it\u2019s not like I have especially unique needs. I am talking about things that are to the best of my knowledge pretty basic. But no, they never do that one tiny thing you need them to and I spend a lot of time implementing features I need.<\/p>\n<h2 id=\"bootstrap-responsiveness\">Bootstrap responsiveness<\/h2>\n<p>For a long time I misunderstood how Bootstrap deals with responsive design. Trusting Bootstrap\u2019s system is a must. It works very well. I wish I understood it better back then. It would have saved me a lot of time. And related:<\/p>\n<h2 id=\"dont-use-an-existing-bootstrap-theme\">Don\u2019t use an existing Bootstrap theme<\/h2>\n<p>It\u2019s just not worth it. Back then, we didn\u2019t have a designer and we wanted to have our minimum viable product as quickly as possible so we went after something ready. We chose a premium theme that is very popular. It was good looking and seemed really nice. Boy do I wish I had a time machine now.<\/p>\n<p>We are now stuck with it. Switching to something else is something we will have to do eventually and let me tell you: it will be painful. These themes change <em>everything<\/em> and not in a way that we could simply switch themes painlessly. It permeates everything.<\/p>\n<h2 id=\"think-of-touchscreens-from-the-beginning\">Think of touchscreens from the beginning<\/h2>\n<p>Oh boy. You do a lot of nice stuff and then one day you try it on a tablet and <em>nothing works<\/em> just as your co-founder tells you that your first customer will use the app <em>exclusively<\/em> on tablets. Then you start panicking and sobbing and crying and running for help. You then find out about the hack that is <a href=\"http:\/\/touchpunch.furf.com\/\">jQueryUI Touch Punch<\/a> and although it fixes some of the problems it creates new ones and then there\u2019s <a href=\"http:\/\/jquerymobile.com\/\">jQuery Mobile<\/a> which is OMG fantastic except lo and behold it doesn\u2019t play well together with AngularJS. And then you find some projects on Github trying to get jQuery Mobile to work alongside with AngularJS but they\u2019re no longer maintained and won\u2019t really work that well and\u2026<\/p>\n<p>Well, it would be best to think about touch support from the get go.<\/p>\n<h2 id=\"stop-worrying-about-the-size-of-your-javascript\">Stop worrying about the size of your JavaScript<\/h2>\n<p>Or actually, do worry, but for the right reasons. One of the things I learned is that the web is full of outdated and\/or otherwise uninformed advice.<\/p>\n<p>Stop laughing.<\/p>\n<p>Yes, it\u2019s obvious, but still. With little experience with web frontend programming, I used to worry about the size of my JavaScript code. And the web doesn\u2019t really help. Search a bit and you will find people telling you how horrendous it would be to download 100Kb of JavaScript and how the only way to save your customers is to access files from popular CDNs.<\/p>\n<p>It turns out that\u2019s kind of like cargo cult programming. It\u2019s just a bunch of people repeating something they heard somewhere. Things change. We measured them.<\/p>\n<p>Concatenating and minifying our files and serving them gzip\u2019d and with aggressive caching is actually faster. Even concatenation is about to become irrelevant now that <a href=\"http:\/\/www.chromium.org\/spdy\">SPDY<\/a> is becoming more common (IE11 now supports SPDY3 and the upcoming versions of Safari for OSX and iOS will as well.)<\/p>\n<p>The first access to our app downloads almost 1MB of JavaScript code and CSS files. It sounds horrible but it\u2019s really fast, even on bad 3G with with <code>defer<\/code> and <code>async<\/code>. Speaking of which.<\/p>\n<p>Most of the advice repeated as a mantra on the web is from before browser support for <code>&lt;script defer&gt;<\/code> and <code>&lt;script async&gt;<\/code> was widespread.<\/p>\n<hr>\n<p>I think that\u2019s about it. Now all I need is a time machine.<\/p>"},{"title":"More on validating with Go","link":"https:\/\/rselbach.com\/more-on-validating-with-go\/","pubDate":"Sat, 03 May 2014 04:29:55 +0000","guid":"https:\/\/rselbach.com\/more-on-validating-with-go\/","description":"<p>A few days ago <a href=\"http:\/\/robteix.com\/blog\/2014\/04\/29\/package-validate\/\">I posted<\/a> about a new Go package called <a href=\"https:\/\/github.com\/go-validator\/validator\">validator<\/a> that we initially developed for our own internal use at project7.io but what fun is internal stuff, right? So we opensourced it.<\/p>\n<p>Then <a href=\"https:\/\/twitter.com\/mholt6\">Matthew Holt<\/a> pointed me to <a href=\"https:\/\/github.com\/martini-contrib\/binding\/issues\/9\">an ongoing discussion<\/a><br>\non validation happening on <a href=\"https:\/\/github.com\/martini-contrib\">martini-contrib\u2019s github<\/a>. By the way, if you don\u2019t know martini yet, <a href=\"https:\/\/github.com\/go-martini\/martini\">go rectify that right now<\/a>.<\/p>\n<p>And today I learned about <a href=\"https:\/\/github.com\/pengux\/check\">check<\/a>, which takes a completely different<br>\napproach to data validation than the one we took, which by the way is totally fine and you should check it out.<\/p>\n<p>Good to know we were not the only ones with the problem. Although I\u2019m happy with how our package turned out, I kind of wish<br>\nI had found these other guys earlier. Could have shared some code or just ideas.<\/p>"},{"title":"[ANN] Package validator","link":"https:\/\/rselbach.com\/ann-package-validator\/","pubDate":"Tue, 29 Apr 2014 19:22:35 +0000","guid":"https:\/\/rselbach.com\/ann-package-validator\/","description":"<p>The thing about working in a startup under stealth mode is you can\u2019t often talk about what you\u2019re doing. Thankfully, from time to time, an opportunity appears that lets us at least share something tangential.<\/p>\n<p>A large part of our project at project7.io involves receiving data from a client (generally in JSON) for processing. This involves unmarshaling the JSON into a <code>struct<\/code>, something that Go does very well. But then comes the boring part: checking that the information sent from the client is correct and complete before doing anything with it.<\/p>\n<p><em>The boring life of validating stuff<\/em><\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">t<\/span>.<span style=\"color:#a6e22e\">Username<\/span> <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#e6db74\">&#34;&#34;<\/span> <span style=\"color:#f92672\">&amp;&amp;<\/span> <span style=\"color:#a6e22e\">t<\/span>.<span style=\"color:#a6e22e\">Age<\/span> &gt; <span style=\"color:#ae81ff\">18<\/span> <span style=\"color:#f92672\">&amp;&amp;<\/span> <span style=\"color:#a6e22e\">t<\/span>.<span style=\"color:#a6e22e\">Foo<\/span> <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#66d9ef\">nil<\/span> <span style=\"color:#f92672\">&amp;&amp;<\/span> len(<span style=\"color:#a6e22e\">t<\/span>.<span style=\"color:#a6e22e\">Bar<\/span>.<span style=\"color:#a6e22e\">Baz<\/span>) &gt; <span style=\"color:#ae81ff\">8<\/span> <span style=\"color:#f92672\">&amp;&amp;<\/span> <span style=\"color:#f92672\">...<\/span>\n<\/span><\/span><\/code><\/pre><\/div><p>We had to do this often and for a large number of different structs and sometimes a <code>struct<\/code> gained a new field and we had to go back and see that it was being properly validated everywhere. It was so boring that we ended up writing something to make it easier for us. We\u2019ve been using this for a while and now we decided to open source it in the hopes that it might be useful for others.<\/p>\n<p><a href=\"https:\/\/github.com\/go-validator\/validator\">Package validator<\/a> implements validation of variables. Initially we had implemented <a href=\"http:\/\/json-schema.org\/\">JSONschema<\/a> but we don\u2019t always deal with JSON, we also get data as XML and sometimes as <code>form-encoded<\/code>. So we changed our approach and went right to the <code>struct<\/code> definitions.<\/p>\n<p><em>A struct definition with some validation rules attached<\/em><\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">type<\/span> <span style=\"color:#a6e22e\">T<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">A<\/span> <span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#e6db74\">`validate:&#34;nonzero&#34;`<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">B<\/span> <span style=\"color:#66d9ef\">string<\/span> <span style=\"color:#e6db74\">`validate:&#34;nonzero,max=10&#34;`<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">C<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">Ca<\/span> <span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#e6db74\">`validate:&#34;min=5,max=10&#34;`<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">Cb<\/span> <span style=\"color:#66d9ef\">string<\/span> <span style=\"color:#e6db74\">`validate:&#34;min=8, regexp:^[a-zA-Z]+&#34;`<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>This allowed us to attach validation rules right to the data structure definitions. Then instead of large, boring list of <code>if<\/code> statements, we were able to validate in single function call.<\/p>\n<p><em>Validating an instance of a struct<\/em><\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">valid<\/span>, <span style=\"color:#a6e22e\">_<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">validator<\/span>.<span style=\"color:#a6e22e\">Validate<\/span>(<span style=\"color:#a6e22e\">t<\/span>); !<span style=\"color:#a6e22e\">valid<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#75715e\">\/\/ not valid, so return an http.StatusBadRequest of something<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><h2 id=\"multiple-rules-for-different-situations\">Multiple rules for different situations<\/h2>\n<p>We often use the same <code>struct<\/code> to deal with different data coming from the client. Sometimes we only care about one or two of the fields in one scenario, so we also supported multiple rules like, say<\/p>\n<p><em>A struct with two different sets of rules<\/em><\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">type<\/span> <span style=\"color:#a6e22e\">T<\/span> <span style=\"color:#66d9ef\">struct<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">A<\/span> <span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#e6db74\">`foo:&#34;nonzero&#34; bar:&#34;min=5,max=10&#34;`<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">B<\/span> <span style=\"color:#66d9ef\">string<\/span> <span style=\"color:#e6db74\">`bar:&#34;nonzero&#34;`<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>In scenario <code>foo<\/code>, we need <code>A<\/code> to be non-zero, but we don\u2019t care for what is in <code>B<\/code>. In the <code>bar<\/code> scenario, however, we need <code>B<\/code> to be non-zero and the value of <code>A<\/code> to be between 5 and 10, inclusive. To validate, we then make <code>validator<\/code> use a different tag name for each case<\/p>\n<p><em>WithTag() FTW<\/em><\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">t<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">T<\/span>{<span style=\"color:#a6e22e\">A<\/span>: <span style=\"color:#ae81ff\">3<\/span>}\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">validator<\/span>.<span style=\"color:#a6e22e\">WithTag<\/span>(<span style=\"color:#e6db74\">&#34;foo&#34;<\/span>).<span style=\"color:#a6e22e\">Validate<\/span>(<span style=\"color:#a6e22e\">t<\/span>) <span style=\"color:#75715e\">\/\/ valid<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">validator<\/span>.<span style=\"color:#a6e22e\">WithTag<\/span>(<span style=\"color:#e6db74\">&#34;bar&#34;<\/span>).<span style=\"color:#a6e22e\">Validate<\/span>(<span style=\"color:#a6e22e\">t<\/span>) <span style=\"color:#75715e\">\/\/ invalid<\/span>\n<\/span><\/span><\/code><\/pre><\/div><p>We can also change the tag by using <code>SetTag<\/code> with will then make the tag name persistent until changed again by another call to <code>SetTag<\/code>.<\/p>\n<p>Please refer to <a href=\"http:\/\/godoc.org\/gopkg.in\/validator.v1\">http:\/\/godoc.org\/gopkg.in\/validator.v1<\/a> for a lot more documentation, use cases, and how to access the individual validation errors found for each field.<\/p>"},{"title":"Easter Eggs in the Apollo Program","link":"https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/","pubDate":"Sun, 26 Jan 2014 02:57:28 +0000","guid":"https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/","description":"<p>On the way to the Moon, the Apollo crew and ground control needed precise information about the position, speed, and acceleration of the stack. Getting that information was a feat of engineering involving very clever solutions that deserve a post of their own, but the easiest piece of the puzzle was the position.<\/p>\n<p>To figure out where exactly the Apollo was at any given moment, the crew used a <a href=\"http:\/\/history.nasa.gov\/computers\/Ch2-5.html\">guidance computer<\/a> designed by the MIT along with a <a href=\"http:\/\/timeandnavigation.si.edu\/multimedia-asset\/apollo-sextant-and-eye-piece\">sextant<\/a>, not much unlike the ones used for centuries by sea captains.<\/p>\n<p>The CM pilot would pick a specific star (or planet sometimes) that could be placed within view of the sextant optics, he\u2019d then align the sextant viewport with the chosen star, and then tell the guidance computer to calculate the position by telling it which star he had just pointed the sextant to.<\/p>\n<p>The astronauts had a table of stars they could use, each accompanied by an octal code that could be fed to the computer. In this list, along with well-known stars\u2014such as Sirius (15), Rigel (12), and the Sun (46)\u2014were three oddly named stars.<\/p>\n<p><a href=\".\/apollo1_crew.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/apollo1_crew_hu_795e8a9059f99d8a.webp 320w, https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/apollo1_crew_hu_8f997fa814e75adc.webp 480w, https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/apollo1_crew_hu_9736bf3a50d57989.webp 640w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/apollo1_crew.jpg\"\n alt=\"apollo1_crew\"\n loading=\"lazy\"\n decoding=\"async\" width=\"640\" height=\"480\" srcset=\"https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/apollo1_crew_hu_b2fb558f2e242967.jpg 320w, https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/apollo1_crew_hu_aa6ebf886680f81b.jpg 480w, https:\/\/rselbach.com\/easter-eggs-in-the-apollo-program\/apollo1_crew_hu_9eaba33ebbee470c.jpg 640w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a>(Credit: Nasa)<\/p>\n<p>While helping with the development of this system, the crew of Apollo I decided to have a little fun and added references to themselves by changing the names of some stars to parts of their own names spelled backwards:<\/p>\n<ul>\n<li><em>Navi<\/em> (03) for Gus Grisson\u2019s middle name (Ivan)<\/li>\n<li><em>Regor<\/em> (17) for Roger Chaffee<\/li>\n<li><em>Dnoces<\/em> (20) for Edward White II.<\/li>\n<\/ul>\n<p>In reality, <em>Navi<\/em> was <a href=\"http:\/\/en.wikipedia.org\/wiki\/Gamma_Cassiopeiae\"><em>\u03b3 Cassiopeiae<\/em><\/a>, <em>Regor<\/em> was <a href=\"http:\/\/en.wikipedia.org\/wiki\/Gamma_Velorum\"><em>\u03b3 Velorum<\/em><\/a>, and <em>Dnoces<\/em> was <a href=\"http:\/\/en.wikipedia.org\/wiki\/Talitha_Borealis\"><em>\u03b9 Ursae Majoris<\/em><\/a>.<\/p>\n<p>After the crew lost their lives in a tragic fire\u2014the first fallen in the American space manned program\u2014the people at NASA kept those names in all their documentation and literature.<\/p>"},{"title":"Exemplo de texto de MBA","link":"https:\/\/rselbach.com\/exemplo-de-texto-de-mba\/","pubDate":"Wed, 07 Aug 2013 18:31:05 +0000","guid":"https:\/\/rselbach.com\/exemplo-de-texto-de-mba\/","description":"<p>Um amigo publicou um texto no Facebook hoje que me lembrou do MBA. Vou deixar o texto aqui, como exemplo do tipo de texto comum em escolas de neg\u00f3cio e deixar o julgamento ao leitor:<\/p>\n<blockquote>\n<p>ASSALTO MUITO INTERESSANTE.<\/p>\n<p>Durante um assalto, em Guangzhou, China, o assaltante de bancos gritou para todos no banco: \u201cN\u00e3o se mova O dinheiro pertence ao Estado Sua vida pertence a voc\u00ea\u2026\u201d<\/p>\n<p>Todo mundo no banco deitou-se calmamente no ch\u00e3o. Isso \u00e9 chamado de \u201cMudando o conceito mental\u201d Mudar a forma convencional de pensar.<\/p>\n<p>Quando uma senhora apresentou-se sobre a mesa provocativamente, em que o ladr\u00e3o gritou para ela: \u201cPor favor, seja civilizada isto \u00e9 um assalto e n\u00e3o um estupro!\u201d<\/p>\n<p>Isso \u00e9 chamado de \u201cser profissional\u201d Concentre-se apenas no que voc\u00ea est\u00e1 treinado para fazer!<\/p>\n<p>Quando os assaltantes voltaram para casa, o ladr\u00e3o mais jovem (MBA treinee), disse ao ladr\u00e3o mais velho (que s\u00f3 completou seis anos na escola prim\u00e1ria): \u201cBig brother, vamos contar o quanto n\u00f3s temos.\u201d<\/p>\n<p>O assaltante mais velho rebateu e disse: \u201cVoc\u00ea \u00e9 muito est\u00fapido. H\u00e1 tanto dinheiro que vai nos levar muito tempo para contar. Hoje \u00e0 noite, o notici\u00e1rio da TV vai nos dizer o quanto n\u00f3s roubamos do banco\u2026!\u201d<\/p>\n<p>Isso \u00e9 chamado de \u201cexperi\u00eancia\u201d. Hoje em dia, a experi\u00eancia \u00e9 mais importante do que as qualifica\u00e7\u00f5es do papel!<\/p>\n<p>Depois que os ladr\u00f5es sa\u00edram, o gerente do banco disse ao supervisor banc\u00e1rio para chamar a pol\u00edcia rapidamente. Mas o supervisor lhe disse: \u201cEspere, vamos retirar U$ 10 milh\u00f5es do banco para n\u00f3s mesmos e adicion\u00e1-lo aos 70 milh\u00f5es d\u00f3lares que j\u00e1 foram desviados do banco\u201d.<\/p>\n<p>Isso \u00e9 chamado de \u201cnadar \u00e0 favor da mar\u00e9.\u201d Convertendo uma situa\u00e7\u00e3o desfavor\u00e1vel para a sua vantagem!<\/p>\n<p>O supervisor diz: \u201cVai ser bom para n\u00f3s se houver um assalto a cada m\u00eas.\u201d<\/p>\n<p>Isso \u00e9 chamado de \u201cmorte do t\u00e9dio\u201d. Felicidade pessoal \u00e9 mais importante do que o seu trabalho.<\/p>\n<p>No dia seguinte, o notici\u00e1rio da TV informou que U$ 100 milh\u00f5es, foram retirados do banco. Os ladr\u00f5es contaram e contaram e contaram, mas eles s\u00f3 podiam contar o montante de U$20 milh\u00f5es. Os ladr\u00f5es estavam muito irritados e reclamaram: \u201cN\u00f3s arriscamos nossas vidas e s\u00f3 levamos 20 milh\u00f5es de d\u00f3lares. O gerente do banco levou 80 milh\u00f5es de d\u00f3lares com apenas um estalar de seus dedos. Parece que \u00e9 melhor ser educado do que ser um ladr\u00e3o..!\u201d<\/p>\n<p>Isso \u00e9 chamado de \u201cConhecimento que vale tanto quanto ouro!\u201d<\/p>\n<p>O gerente do banco estava sorrindo feliz porque suas perdas no mercado de a\u00e7\u00f5es foram agora cobertas por este roubo.<\/p>\n<p>Isso \u00e9 chamado de \u201cAproveitando a oportunidade.\u201d Ousadia para assumir riscos!<\/p>\n<p>Ent\u00e3o, quem s\u00e3o os ladr\u00f5es reais aqui?<\/p>\n<p>Conde de Kakflour<\/p>\n<\/blockquote>"},{"title":"Join us on App.Net","link":"https:\/\/rselbach.com\/join-us-on-app-net\/","pubDate":"Sat, 18 May 2013 18:08:49 +0000","guid":"https:\/\/rselbach.com\/join-us-on-app-net\/","description":"<p>I liked the idea behind App.Net (or ADN for the initiated) from the start; I\u2019ve happily signed up during the initial funding effort and before it even existed. It is quite like Twitter, although it does have some pretty interesting API advantages that allow clients to do things that are not possible in Twitter such as\u00a0creating private chat rooms (with <a href=\"http:\/\/patter-app.net\">Patter<\/a>.) I found a text by Matt Gemmell, <a href=\"http:\/\/mattgemmell.com\/2013\/04\/05\/app-net-for-conversations\/\">App.Net for conversations<\/a>, that sums it up nicely:<\/p>\n<blockquote>\n<p>The interesting part, though, is what you\u00a0<em>won\u2019t<\/em>\u00a0be used to from Twitter. There are no ads, anywhere. Because it\u2019s a paid service, there\u2019s no spam at all; I\u2019ve certainly never seen any. There\u2019s an active\u00a0_and happy\u00a0_developer community, which ADN actually\u00a0<a href=\"http:\/\/thenextweb.com\/insider\/2013\/03\/01\/app-net-developer-payouts\/\">financially rewards<\/a>. There\u2019s a rich, modern,\u00a0<a href=\"http:\/\/developers.app.net\/\">relentlessly improved API<\/a>. And again because it\u2019s a paid service, there\u2019s a commensurately (and vanishingly) low number of Bieber fans, teenagers, illiterates, and sociopaths.<\/p>\n<\/blockquote>\n<p>But the real difference I notice is in the conversations. On Twitter, the back-and-forth tends to be relatively brief, not only in terms of the 140-character limit, but also the number of replies. There\u2019s a certain fire-and-forget sensibility to Twitter; it\u2019s a noticeboard rather than a chatroom. Then there\u2019s the keyword-spam (woe betide the person who mentions iPads, or MacBooks, or broadband, or\u00a0<a href=\"https:\/\/twitter.com\/ddfreyne\/status\/319185269549051904\">just about <em>anything<\/em><\/a>). Oh, and let\u2019s not forget the fact that any malcontent with internet access can create an account (or two, or ten) in seconds. Not a happy mixture.<\/p>\n<p>I\u2019d add that there seems to be less of a popular clique on ADN. Popular users seem to be much more engaging with \u201cregular people\u201d than on Twitter. And there\u2019s the developers\u2026 although most of the rush is now behind us, it was fun to follow the\u00a0developers working on ADN clients. It was a very collaborative effort, with alpha builds floating around and discussions about whether this or that should be done in a certain way.<\/p>\n<p>As for the developers of ADN proper, well, you can try asking ADN CEO and Founder <a href=\"https:\/\/alpha.app.net\/dalton\">Dalton<\/a> something to see if he\u2019ll answer you in about 30 seconds. He actually does. \ud83d\ude42<\/p>\n<p>It all feels like a big community where everyone feels a bit like they own the place as well and want it to thrive. Again I think Matt is on the money on why this is so:<\/p>\n<blockquote>\n<p>We value what we pay for. We not only pay for things which we deem to be of value, but we\u00a0<em>also<\/em>\u00a0retrospectively\u00a0<em>assign and justify value<\/em>\u00a0based on what we\u2019ve paid. Any consumer is familiar with the simple psychology of cost equating as much to value\u00a0<em>after<\/em>\u00a0the transaction as value does to cost beforehand (likely\u00a0<em>moreso<\/em>, from my own experience). At its core, I don\u2019t think that the reason for the noticeably different, warmer, more discursive \u201cfeel\u201d of ADN is any more complicated than that.<\/p>\n<\/blockquote>\n<p>I personally love the service and I think you should consider it too. There is a free tier account that allows you to follow up to 40 people for free, as long as you\u2019re invited by a current user. If you\u2019re interested, I have a few invites.<\/p>\n<p>Feel free to comment on this post by using <a href=\"https:\/\/plus.google.com\/113816409376221973603\/posts\/PUCrdNaNHsj\">this Google+ thread<\/a> or also by talking to me on, where else, ADN, where I\u2019m <a href=\"https:\/\/alpha.app.net\/robteix\">@robteix<\/a>. And of course Twitter isn\u2019t going anywhere and <a href=\"http:\/\/twitter.com\/robteix\">I\u2019m there too<\/a>.<\/p>"},{"title":"Why is Change So Difficult?","link":"https:\/\/rselbach.com\/why-is-change-so-difficult\/","pubDate":"Tue, 30 Apr 2013 22:37:30 +0000","guid":"https:\/\/rselbach.com\/why-is-change-so-difficult\/","description":"<p><a title=\"About\" href=\"https:\/\/rselbach.com\/about\/\" target=\"_blank\">I have long been a bit of a nomad<\/a>. What is interesting to me is that I don\u2019t really like change too much. <strong>I am a creature of habit<\/strong> and yet, here I am.<\/p>\n<p><a href=\".\/Brazil_argentina_allegory.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/why-is-change-so-difficult\/Brazil_argentina_allegory_hu_1cf88eee909fa282.webp 320w, https:\/\/rselbach.com\/why-is-change-so-difficult\/Brazil_argentina_allegory_hu_7fbe2e10abf4ef4e.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/why-is-change-so-difficult\/Brazil_argentina_allegory.jpg\"\n alt=\"Brazil_argentina_allegory\"\n loading=\"lazy\"\n decoding=\"async\" width=\"550\" height=\"514\" srcset=\"https:\/\/rselbach.com\/why-is-change-so-difficult\/Brazil_argentina_allegory_hu_f51c4cc65ffbdf4f.jpg 320w, https:\/\/rselbach.com\/why-is-change-so-difficult\/Brazil_argentina_allegory_hu_c43fcec5d9219fe8.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>Four years ago, I moved to Argentina due to professional reasons. At the time, I had my mind set that I was going to give it a try and come back if it didn\u2019t work out. <strong>It was a hard decision too, since my wife and I were pregnant of our daughter.<\/strong> But we took the plunge anyway. We knew we could always come back and as Terry Pratchett wrote in one of his <strong>Discworld<\/strong> novels \u2014<\/p>\n<blockquote>\n<p>Why do you go away? So that you can come back. So that you can see the place you came from with new eyes and extra colors. And the people there see you differently, too. Coming back to where you started is not the same as never leaving.<\/p>\n<\/blockquote>\n<p>I am now leaving, returning to my old country. It is mostly due to the economic situation in Argentina. I was able to mostly protect myself by keeping my savings in Brazil as well as transferring as much money as I could from Argentina. But still, I need to make a move. Our daughter is growing up and should start school soon so if we\u2019re going, we should go now.<\/p>\n<p>I officially <a title=\"Goodbye Intel\" href=\"https:\/\/rselbach.com\/2013\/04\/22\/goodbye-intel\/\" target=\"_blank\">left my job<\/a>\u00a0about a week ago. My wife and daughter left soon after as\u00a0I stayed to put our affairs in order \u2014 selling stuff, closing accounts, the whole thing \u2014 and now it\u2019s my time. I am leaving in the morning.<\/p>\n<p>Being here alone made me think about \u2014 and fear \u2014 the future.\u00a0<strong>Why is change always so difficult?<\/strong><\/p>\n<p>It isn\u2019t that I have doubts about the decision itself.\u00a0<strong>I know it is the best move for us.<\/strong> But I still fear it.<\/p>\n<p>Will I ever find another job again? Am I too old to do these things? Will my daughter learn to speak the language? Rationally and logically I know the answers to these questions. But the fear of change is there.<\/p>\n<p>What I learned \u2014 or at least what I tell myself \u2014 is that it\u2019s fine to be afraid. <strong>Being afraid just means you are about to do something brave<\/strong>. Or stupid. Starting tomorrow, I find out which.<\/p>\n<p>_Adi\u00f3s, Argentina.**\u00a0**_See you all on the other side.<\/p>"},{"title":"Goodbye Intel","link":"https:\/\/rselbach.com\/goodbye-intel\/","pubDate":"Mon, 22 Apr 2013 16:06:20 +0000","guid":"https:\/\/rselbach.com\/goodbye-intel\/","description":"<p>Eight years ago I joined a great company in <a href=\"http:\/\/intel.com\">Intel<\/a>. It has been a great ride but as of a few minutes ago, I have informed my manager that I quitting my job for personal reasons.<\/p>\n<p>A couple of years ago, I relocated to the software development centre in Cordoba, Argentina. It was always meant to be a temporary assignment but it ended up being longer than my family and I ever thought. And as\u00a0our daughter grows up, it becomes ever more difficult to engage in international relocations, so my wife\u2014who also works at Intel, by the way\u2014and I decided that we needed to act. We set a hard deadline for the move and stuck to it. This is it.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/goodbye-intel\/DSC02120-580x435_hu_6e7879116979176a.webp 320w, https:\/\/rselbach.com\/goodbye-intel\/DSC02120-580x435_hu_6581624d6b556416.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/goodbye-intel\/DSC02120-580x435.jpg\"\n alt=\"My wife, daugher, and I at the Intel Minigolf side during the last Kids@work Day\"\n loading=\"lazy\"\n decoding=\"async\" width=\"580\" height=\"435\" srcset=\"https:\/\/rselbach.com\/goodbye-intel\/DSC02120-580x435_hu_6525eeb17d7f583e.jpg 320w, https:\/\/rselbach.com\/goodbye-intel\/DSC02120-580x435_hu_8bc965ec9db3efd2.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>My wife and daughter will be flying to Brazil in two weeks and I should follow some short time later, once I\u2019m done closing everything behind. We\u2019ll be relocating to Curitiba, where my wife and I first met 13 years ago, so it\u2019s fitting.<\/p>\n<p>So this is it. Good bye, Intel, it\u2019s been fun and I wish you all the best.<\/p>"},{"title":"Linux Kernel Linked List Explained","link":"https:\/\/rselbach.com\/linux-kernel-linked-list-explained\/","pubDate":"Fri, 04 Jan 2013 20:13:22 +0000","guid":"https:\/\/rselbach.com\/linux-kernel-linked-list-explained\/","description":"<p>I appreciate beautiful, readable code. And if someone were to ask me for an example of beautiful code, I\u2019ve always had the answer ready: the linked list implementation in the Linux kernel.<\/p>\n<p>The code is <em>gorgeous<\/em> in its simplicity, clarity, and amazing flexibility. If there\u2019s ever a museum for code, this belongs there. It is a masterpiece of the craft.<\/p>\n<p>I was just telling a friend about it while we talked about beautiful code and he found this piece that I share here: <a href=\"http:\/\/isis.poly.edu\/kulesh\/stuff\/src\/klist\/\">Linux Kernel Linked List Explained<\/a>.<\/p>"},{"title":"Container changes in C++11","link":"https:\/\/rselbach.com\/container-changes-in-c11\/","pubDate":"Sat, 15 Dec 2012 14:41:36 +0000","guid":"https:\/\/rselbach.com\/container-changes-in-c11\/","description":"<p>The recently approved C++11 standard brings a lot of welcome changes to C++ that modernize the language a little bit. Among the many changes, we find that containers have received some special love.<\/p>\n<h1 id=\"initialization\">Initialization<\/h1>\n<p>C++ was long behind modern languages when it came to initializing containers. While you could do<\/p>\n<p>[cpp]int a[] = {1, 2, 3};[\/cpp]<\/p>\n<p>for simple arrays, things tended to get more verbose for more complex containers:<\/p>\n<p>[cpp]<br>\nvector<string> v;<br>\nv.push_back(\u201cOne\u201d);<br>\nv.push_back(\u201cTwo\u201d);<br>\nv.push_back(\u201cThree\u201d);<br>\n[\/cpp]<\/p>\n<p>C++11 has introduced an easier, simpler way to initialize this:<\/p>\n<p>[cpp]<br>\nvector<string> v = {\u201cOne\u201d, \u201cTwo\u201d, \u201cThree\u201d};<br>\n[\/cpp]<\/p>\n<p>The effects of the changes are even better for things like <strong>map<\/strong>s, which could get cumbersome quickly:<\/p>\n<p>[cpp]<br>\nmap&lt;string, vector<string> &gt; m;<br>\nvector<string> v1;<br>\nv1.push_back(\u201cA\u201d);<br>\nv1.push_back(\u201cB\u201d);<br>\nv1.push_back(\u201cC\u201d);<\/p>\n<p>vector<string> v2;<br>\nv2.push_back(\u201cA\u201d);<br>\nv2.push_back(\u201cB\u201d);<br>\nv2.push_back(\u201cC\u201d);<\/p>\n<p>m[\u201cOne\u201d] = v1;<br>\nm[\u201cTwo\u201d] = v2;<br>\n[\/cpp]<\/p>\n<p>This can now be expressed as:<\/p>\n<p>[cpp]<br>\nmap&lt;string, vector<string>&gt; m = One,<\/p>\n<pre><code> {&quot;Two&quot;, {&quot;Z&quot;, &quot;Y&quot;, &quot;X&quot;}}};\n<\/code><\/pre>\n<p>[\/cpp]<\/p>\n<p>Much simpler and in line with most modern languages. As an aside, there\u2019s another change in C++11 that would be easy to miss in the code above. The declaration<\/p>\n<p>[cpp]map&lt;string, vector<string>&gt; m;[\/cpp]<\/p>\n<p>was illegal until now due to &raquo; always being evaluated to the right-shift operator; a space would always be required, like<\/p>\n<p>[cpp]map&lt;string, vector<string> &gt; m[\/cpp]<\/p>\n<p>No longer the case.<\/p>\n<h1 id=\"iterating\">Iterating<\/h1>\n<p>Iterating through containers was also inconvenient. Iterating the simple <em>vector v<\/em> above:<\/p>\n<p>[cpp]<br>\nfor (vector<string>::iterator i = v.begin();<\/p>\n<pre><code> i != v.end(); i++)\ncout &lt;&lt; i &lt;&lt; endl;[\/cpp]\n<\/code><\/pre>\n<p>Modern languages have long had some <em>foreach<\/em> equivalent that allowed us easier ways to iterate through these structures without having to explicitly worry about iterators types. C++11 is finally catching up:<\/p>\n<p>[cpp]<br>\nfor (string s : v)<\/p>\n<pre><code>cout &lt;&lt; s &lt;&lt; endl;\n<\/code><\/pre>\n<p>[\/cpp]<\/p>\n<p>As well, C++11 brings in a new keyword, <em>auto<\/em>, that will evaluate to a type in compile-type. So instead of<\/p>\n<p>[cpp]<br>\nfor (map&lt;string, vector<string> &gt;::iterator i = m.begin();<\/p>\n<pre><code> i != m.end(); i++) {\n<\/code><\/pre>\n<p>[\/cpp]<\/p>\n<p>we can now write<\/p>\n<p>[cpp]<br>\nfor (auto i = m.begin(); i != m.end(); i++) {<br>\n[\/cpp]<\/p>\n<p>and <em>auto<\/em> will evaluate to <em>map&lt;string, vector<string>&gt;::iterator<\/em>.<\/p>\n<p>Combining these changes, we move from the horrendous<\/p>\n<p>[cpp]<br>\nfor (map&lt;string, vector<string> &gt;::iterator i = m.begin();<\/p>\n<pre><code> i != m.end(); i++)\nfor (vector&lt;string&gt;::iterator j = i-&gt;second.begin();\n j != i-&gt;second.end(); j++)\n cout &lt;&lt; i-&gt;first &lt;&lt; ': ' &lt;&lt; *j &lt;&lt; endl;\n<\/code><\/pre>\n<p>[\/cpp]<\/p>\n<p>to the much simpler<\/p>\n<p>[cpp]<br>\nfor (auto i : m)<\/p>\n<pre><code>for (auto j : i.second)\n cout &lt;&lt; i.first &lt;&lt; ': ' &lt;&lt; j &lt;&lt; endl;\n<\/code><\/pre>\n<p>[\/cpp]<\/p>\n<p>Not bad.<\/p>\n<p>C++11 support varies a lot from compiler to compiler, but all of the changes above are already supported in the latest versions of GCC, LLVM, and MSVC compilers.<\/p>"},{"title":"FOR is evil or something","link":"https:\/\/rselbach.com\/for-is-evil-or-something\/","pubDate":"Mon, 19 Nov 2012 13:31:16 +0000","guid":"https:\/\/rselbach.com\/for-is-evil-or-something\/","description":"<blockquote>\n<p>Have you ever wondered how FORs impact your code? How they are limiting your design and more important how they are transforming your code into an amount of lines without any human meaning?<\/p>\n<\/blockquote>\n<p>How can you not want to read an article that starts like that? I had to steal the intro from the original. Seriously, I have used FOR since I learned BASIC back in the day. I never thought about how it was limiting my design. I. Must. Learn. How.<\/p>\n<p>The article I am referring to is, <a href=\"http:\/\/www.lordofthejars.com\/2012\/10\/avoiding-fors-anti-if-campaign.html\">Avoiding FORs \u2013 Anti-If Campaign<\/a>. Eager learner I, I could not not read it.<\/p>\n<p>After the resplendent intro, <em>Avoiding FOR<\/em> goes on to show \u201chow to transform a simple example of a for [\u2026], to something more readable and well designed.\u201d<\/p>\n<p>It takes this unreadable piece of code \u2014 that I now recognize as unreadable:<\/p>\n<p>[java]<br>\npublic class Department {<\/p>\n<pre><code>private List resources = new ArrayList();\n\npublic void addResource(Resource resource) {\n this.resources.add(resource);\n}\n\npublic void printSlips() {\n\n for (Resource resource : resources) {\n if(resource.lastContract().deadline().after(new Date())) {\n\n System.out.println(resource.name());\n System.out.println(resource.salary());\n }\n }\n}\n<\/code><\/pre>\n<p>}[\/java]<\/p>\n<p>My eyes hurt already. Thankfully the author transforms the aberration above into this clean, much more readable snippet:<\/p>\n<p>[java]public class ResourceOrderedCollection {<\/p>\n<pre><code> private Collection&lt;Resource&gt; resources = new ArrayList&lt;Resource&gt;();\n\n\n\npublic ResourceOrderedCollection() {\n super();\n}\n\npublic ResourceOrderedCollection(Collection&lt;Resource&gt; resources) {\n this.resources = resources;\n}\n\npublic void add(Resource resource) {\n this.resources.add(resource);\n}\n\npublic void forEachDo(Block block) {\n Iterator&lt;Resource&gt; iterator = resources.iterator();\n\n while(iterator.hasNext()) {\n block.evaluate(iterator.next());\n }\n\n}\n\npublic ResourceOrderedCollection select(Predicate predicate) {\n\n ResourceOrderedCollection resourceOrderedCollection = new ResourceOrderedCollection();\n\n Iterator&lt;Resource&gt; iterator = resources.iterator();\n\n while(iterator.hasNext()) {\n Resource resource = iterator.next();\n if(predicate.is(resource)) {\n resourceOrderedCollection.add(resource);\n }\n }\n\n return resourceOrderedCollection;\n}\n<\/code><\/pre>\n<p>}<\/p>\n<p>public class Department {<\/p>\n<pre><code>private List&lt;Resource&gt; resources = new ArrayList&lt;Resource&gt;();\n\npublic void addResource(Resource resource) {\n this.resources.add(resource);\n}\n\npublic void printSlips() {\n new ResourceOrderedCollection(this.resources).select(new InForcePredicate()).forEachDo(new PrintSlip());\n}\n<\/code><\/pre>\n<p>}[\/java]<\/p>\n<p>Wait, what? Is this an Onion article?<\/p>\n<p>Snarky Mode Off.<\/p>\n<p>I understand what the author wanted to do, but really, the example used is so off the left field that it\u2019s not even funny.<\/p>"},{"title":"Rolling out your own Fusion Drive with the recovery partition","link":"https:\/\/rselbach.com\/rolling-out-your-own-fusion-drive-with-the-recovery-partition\/","pubDate":"Fri, 09 Nov 2012 11:18:34 +0000","guid":"https:\/\/rselbach.com\/rolling-out-your-own-fusion-drive-with-the-recovery-partition\/","description":"<p><a href=\".\/Screen-Shot-2012-11-09-at-9.32.21-AM.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/rolling-out-your-own-fusion-drive-with-the-recovery-partition\/Screen-Shot-2012-11-09-at-9.32.21-AM-580x493_hu_ba3f32ea2a9fbc3e.webp 320w, https:\/\/rselbach.com\/rolling-out-your-own-fusion-drive-with-the-recovery-partition\/Screen-Shot-2012-11-09-at-9.32.21-AM-580x493_hu_c5c6b4672cb76a4b.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/rolling-out-your-own-fusion-drive-with-the-recovery-partition\/Screen-Shot-2012-11-09-at-9.32.21-AM-580x493.jpg\"\n alt=\"disk utility showing Fusion Drive\"\n loading=\"lazy\"\n decoding=\"async\" width=\"580\" height=\"493\" srcset=\"https:\/\/rselbach.com\/rolling-out-your-own-fusion-drive-with-the-recovery-partition\/Screen-Shot-2012-11-09-at-9.32.21-AM-580x493_hu_c2010ef35fd9cb07.jpg 320w, https:\/\/rselbach.com\/rolling-out-your-own-fusion-drive-with-the-recovery-partition\/Screen-Shot-2012-11-09-at-9.32.21-AM-580x493_hu_c7043bb5aef60ad2.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>My Macbook Pro has two disks, an HDD and an SSD, each of 240GB or so. With the details of Apple\u2019s Fusion Drive coming out I decided to do what any reasonable geek would do to their production computer: I\u2019ve decided to implement my own untested, highly experimental and barely understood Fusion Drive.<\/p>\n<p>One of the things that initially put me off doing this was that according to the 3,471,918 tutorials that have popped up in the last 10 minutes would cause me to lose my Mountain Lion recovery partition because these partitions are not supported in a Fusion drive. Turns out this is not exactly true.<\/p>\n<p>Fusion Drive is just a marketing term for a what essentially is a CoreStorage logical volume spanning an SSD <em>and<\/em> an HDD. And although you cannot have the recovery partition inside a CS logical volume, it doesn\u2019t mean you can\u2019t have <em>both<\/em> a recovery partition <em>and<\/em> a Fusion Drive at the same time. It\u2019s all in the <a href=\"http:\/\/developer.apple.com\/library\/mac\/#documentation\/Darwin\/Reference\/ManPages\/man8\/diskutil.8\">diskutil man page<\/a>, by the way:<\/p>\n<blockquote>\n<p>Create a CoreStorage logical volume group. The disks specified will become the (initial) set of physical volumes; more than one may be specified. <strong>You can specify partitions<\/strong> (which will be re-typed to be Apple_CoreStorage) or whole-disks (which will be partitioned as GPT and will contain an Apple_CoreStorage partition). The resulting LVG UUID can then be used with createVolume below. All existing data on the drive(s) will be lost. Ownership of the affected disk is required.<\/p>\n<\/blockquote>\n<p>What matters is what\u2019s in bold above: we\u2019re not limited to using whole disks. So here\u2019s what I did.<\/p>\n<p>I rebooted my system and held the <strong>option<\/strong> key so I could select my recovery partition as the start up disk. Once the OSX recovery started up, I launched a terminal to do the dirty work.<\/p>\n<pre><code>diskutil list\n<\/code><\/pre>\n<p>From this I noted two things: (a) the main SSD partition (the one holding my OSX and that sited by my recovery partition) and (b) the disk name of my HDD. They were respectively <em>disk0s2<\/em> and <em>disk1<\/em> in my case, but they\u2019ll very likely be different for you. Then the magic begins.<\/p>\n<pre><code>diskutil cs create &quot;Fusion Drive&quot; disk0s2 disk1\n<\/code><\/pre>\n<p>(For crying out loud, you need to change disk0s2 and disk1 for whatever makes sense on your system!)<\/p>\n<p>That created the coreStorage logical volume. Then I listed it all again to note what the new logical volume UUID was.<\/p>\n<pre><code>diskutil list\n<\/code><\/pre>\n<p>The UUID is a long number identifier like F47AC10B-58CC-4372-A567-0E02B2C3D479. You\u2019ll need that one next to actually create the volume where you\u2019ll be installing your system.<\/p>\n<pre><code>diskutil coreStorage createVolume F47AC10B-58CC-4372-A567-0E02B2C3D479 jhfs+ &quot;Macbook FD&quot; 100%\n<\/code><\/pre>\n<p>The command above will create a volume named \u201cMacbook FD\u201d using 100% of the logical volume we had created earlier.<\/p>\n<p>I then restored my Time Machine backup and that\u2019s it.<\/p>\n<p><strong>Update:<\/strong> Note that after this process, the Recovery partition will still be present and things that require it (such as Find My Mac) will work fine. Some people correctly pointed out, however, that you can no longer boot from the recovery partition by using the menu from holding \u2325 (<strong>option)<\/strong> during boot. I\u2019m not sure why that is, but fear not, it will still boot normally from pressing\u00a0<strong>\u2318R (command + R)<\/strong>.<\/p>"},{"title":"Not a-ok","link":"https:\/\/rselbach.com\/not-a-ok\/","pubDate":"Thu, 08 Nov 2012 17:48:39 +0000","guid":"https:\/\/rselbach.com\/not-a-ok\/","description":"<p>I have a little confession to make: our family is going through a rough patch. Both my wife and I are having problems. No, not between us. And both are experiencing very different sorts of problems. But the happening-at-the-same-time complicates the one-supports-the-other thing.<\/p>\n<p>And to compound to that, I have been sick.<\/p>\n<p>As I sat in the waiting room at the hospital the other day, waiting for some exams, I felt like this is one of the worst times of my life. I feel tired, unmotivated, unappreciated, and generally unhappy. And fucking hopeless. That\u2019s the worst part, I suppose.<\/p>\n<p>I also have been distancing myself from friends lately. Ostensibly to avoid distractions in a time where I am having to give all and a bit more to a project I do not believe in. Truth be told, I just don\u2019t feel like small talk but I also don\u2019t want bring others down to my Dark Hole of Misery. And so I\u2019m trying to keep some distance.<\/p>\n<p>I feel lost. I look at my friends and how they all seem to have it all figured out already. I\u2019m still trying to figure out who the fuck I am. I was so sure when I was younger. I was so fucking <em>good<\/em> at what I did. Now? I just don\u2019t know anymore. I feel unhappy.<\/p>\n<p>I know some people who will be So. Fucking. Happy. reading the paragraph above. This one\u2019s for free for you guys.<\/p>\n<p>But not all is bad news. I actually got some good news last night. I can\u2019t tell the details although I know some of you know exactly what this is about. Anyway, I now have a set date for it and it\u2019s in under six months from now.<\/p>\n<p>I\u2019m actually confident that this will make it all better somehow. Just have to wait.<\/p>\n<p>Sorry for the downer, but I felt like writing something.<\/p>"},{"title":"How I accidentally because a domain squatter","link":"https:\/\/rselbach.com\/how-i-accidentally-because-a-domain-squatter\/","pubDate":"Fri, 02 Nov 2012 00:39:23 +0000","guid":"https:\/\/rselbach.com\/how-i-accidentally-because-a-domain-squatter\/","description":"<p>A couple of days ago, I was listening to one of my favourite podcasts, <a href=\"http:\/\/5by5.tv\/frequency\">The Frequency<\/a>, when one of the hosts, Dan Benjamin, thought of a cool domain name, <a href=\"http:\/\/ohitson.com\">ohitson.com<\/a> and checked to see if it was available. Turns out it was and he said he was registering right there and then. Now, two things: (a) I was listening to a recorded podcast, not live; and (b) I thought to myself, damn it! it <em>is<\/em> a cool domain name.<\/p>\n<p>The next day, I launched <a href=\"http:\/\/hover.com\">Hover<\/a> and checked the domain name and to my surprise it was available. I simply thought either Dan had given up on it or, most likely, I had misunderstood the domain name he was talking about and fortunately that had made me thing of <em>this<\/em> cool domain name. I even checked Google to make sure \u201cOh, it\u2019s on\u201d was really written like that \ud83d\ude1b<\/p>\n<p>Obviously I went ahead and registered the name. After that, I listed to that day\u2019s The Frequency and heard Dan tell Haddie something to the effect of \u201coh, I forgot to register that domain yesterday!\u201d That\u2019s when I thought, oh-oh, maybe I <em>had<\/em> heard the correct domain name.<\/p>\n<p>As it turns out, I was just listening to today\u2019s episode and guess what? Dan mentions that someone registered it due to his mention on the show (which is technically true.)<\/p>\n<p>But I am a nice guy. I offered to transfer the domain to Dan for free just a few minutes ago. Not sure he\u2019ll see my posts to app.net or Twitter. If not, I\u2019ll try again a few times. I really don\u2019t have any intention to keep this domain name as long as he still wants it. Sounds unfair.<\/p>\n<p><strong>Update 7 Nov 2012:<\/strong> can you believe he actually accepted my offer? What a douche! Just kidding, it was the Fair Thing to Do\u2122 and I\u2019m happy to say the domain has been transferred to His Benjaminship already.<\/p>"},{"title":"The day a videogame changed my life","link":"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/","pubDate":"Thu, 04 Oct 2012 15:32:42 +0000","guid":"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/","description":"<p>Last night, as I tried getting my three year-old to sleep so I could play my brand-new copy of <a href=\"http:\/\/www.easports.com\/nhl\">NHL 13<\/a>, I had an epiphany of sorts. It dawned on me how much videogames influenced my real-life pleasures. And the story actually started a long time ago.<\/p>\n<p><figure class=\"post-figure\"><img src=\"http:\/\/cd.textfiles.com\/gifgalaxy\/PROGRAMS\/VGACOPY.GIF\"\n alt=\"http:\/\/cd.textfiles.com\/gifgalaxy\/PROGRAMS\/VGACOPY.GIF\"\n loading=\"lazy\"\n decoding=\"async\">\n<\/figure>\n The story begins in a rather pleasant Saturday afternoon in late 1993. We went into a shoddy building, walked up the stairs to the first floor and found this rather unassuming office at the end of the hall. We skimmed over a thick catalog of game titles and started picking a few we wanted to try. They were cheap, pirated games. After selecting the titles, the guy there noted them down and asked us to wait. In the back, two guys got some floppy disks and started copying the games for us with <a href=\"http:\/\/www.moenk.de\/pages\/vgacopy.html\">VGAcopy<\/a>. Nice!<\/p>\n<p>Of the games we bought, only one I can still remember: <a href=\"http:\/\/www.nhl94.com\/\">NHL Hockey<\/a>. To that day, I had only a general idea of what hockey was: Soccer on the ice. We picked it simply because the clerk there told us it was good.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/538253-nhl-hockey-dos-screenshot-title-screens_hu_5e9dc46518a9b1b3.webp 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/538253-nhl-hockey-dos-screenshot-title-screens.jpg\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"320\" height=\"200\" srcset=\"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/538253-nhl-hockey-dos-screenshot-title-screens_hu_807d0d3d60c289b5.jpg 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n We went home that day and probably tried some of the other, now-forgotten games, but then we installed NHL Hockey from the floppies to MS-DOS. We were both hooked instantly! The game had an arena atmosphere that later version never quite managed to reproduce. We did not know the many rules of hockey, we learned as we played. I remember vividly as my friend pumped up the volume on the PC when the game would play an 8-bit version of \u201cWe will rock you\u201d while two cartoon hands clapped on the virtual jumbotron.<\/p>\n<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/nhl96_hu_a692f8cf56862e5e.webp 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/nhl96.jpg\"\n alt=\"http:\/\/www.igcent.com\/images\/stories\/nhl96.jpg\"\n loading=\"lazy\"\n decoding=\"async\" width=\"325\" height=\"425\" srcset=\"https:\/\/rselbach.com\/the-day-a-videogame-changed-my-life\/nhl96_hu_284eeb936c7fe723.jpg 320w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n We played that game throughout that night and into Sunday. It was fast. It was fun. We were hooked. NHL 96 was the first game I ever legally bought. And I\u2019ve bought almost every version since then.<\/p>\n<p>Back to how it influenced my real-life, playing the game got me into Hockey as a sport. A Brazilian hooked on Hockey? Not supposed to happen, but one likes what one likes. It also indirectly started my love affair with Canada, but that\u2019s a different story. Following Hockey was not easy until I found a radio that streamed games and later the League started offering live vide streaming for which I have been gladly paying an exorbitant amount of money for half a decade or so. I\u2019ve experienced a similar effect thanks to the <a href=\"http:\/\/www.easports.com\/madden-nfl\">Madden<\/a> and <a href=\"http:\/\/en.wikipedia.org\/wiki\/NBA_Live_series\">NBA Live<\/a> series, but NHL Hockey will always be a special case for me.<\/p>\n<p>I realized that thru hockey I\u2019ve made friends, some of whom are <em>real<\/em> good friends. And all of this started because a couple of decades ago we got some pirated games in a Saturday afternoon.<\/p>\n<p>Want to make a comment or suggestion? Do you feel like you need to correct me for not fitting the Standard Brazilian Specification? Feel free to talk to (or scream at) me, I\u2019m <a href=\"https:\/\/alpha.app.net\/robteix\">@robteix on App.net<\/a> and <a href=\"http:\/\/twitter.com\/robteix\">also on Twitter<\/a>.<\/p>"},{"title":"In which Rob gets app.net","link":"https:\/\/rselbach.com\/in-which-rob-gets-app-net\/","pubDate":"Sun, 19 Aug 2012 23:48:24 +0000","guid":"https:\/\/rselbach.com\/in-which-rob-gets-app-net\/","description":"<p>I got myself an app.net account (<a href=\"https:\/\/alpha.app.net\/robteix\">@robteix<\/a>) a couple of days ago. [Cue the <a href=\"http:\/\/ihave50dollars.com\/\">ihave50dollars.com<\/a> jokes.] Still haven\u2019t really used it a lot but am starting to enjoy the discussions about the API development.<\/p>\n<p>I joined mostly to support the idea\u2014which I must admit is pretty insane. But what would the world be without insane ideas? ADN will <strong>never<\/strong> be Twitter or Facebook, but maybe it doesn\u2019t need to be. Maybe it really only needs to be a same environment for people like me. I like it.<\/p>\n<p>They do need a better name though.<\/p>\n<ul>\n<li>Posted using BlogPress from my iPhone<\/li>\n<\/ul>"},{"title":"Could something like \u201cApollo 18\u201d really have existed?","link":"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/","pubDate":"Sat, 17 Sep 2011 11:01:45 +0000","guid":"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/","description":"<p>Conspiracy theories and hoaxes abound when it comes to mankind\u2019s arrival at our moon (or the non-arrival.) One such hoaxes is the <strong>Apollo 20<\/strong>, a purported top secret mission that back to the moon back in 1976 to fetch some aliens living there. The secret would have been revealed by no other than William Rutledge, who claims to have been an astronaut in that mission and who nowadays lives and writes out of Rwanda.<\/p>\n<p>Arguably this theory was never as popular as its always popular theory that NASA spent billions of dollars to fabricate the moon landings but somehow forgot to paint stars in the ceiling.<\/p>\n<p>Now however a film promises to inspire the masses who believe NASA has been sending secret missions to Luna. The movie is <a href=\"http:\/\/apollo18movie.net\/\">Apollo 18<\/a>.<br>\n<a href=\".\/apollo-18-movie1.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/apollo-18-movie_thumb1_hu_fff8483717afdb28.webp 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/apollo-18-movie_thumb1_hu_cfcbd06f41d0e061.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/apollo-18-movie_thumb1.jpg\"\n alt=\"apollo-18-movie\"\n loading=\"lazy\"\n decoding=\"async\" width=\"544\" height=\"304\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/apollo-18-movie_thumb1_hu_82d6a349e8556ed3.jpg 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/apollo-18-movie_thumb1_hu_13cee43e7aab9751.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n(Promotional picture)<\/p>\n<p>The movie\u2019s premise is that after the Apollo program was cancelled, NASA would have flown another mission and found, of course, aliens and that\u2019s why we\u2019ve never been back to the Moon. It\u2019s one more movie in the style of <a href=\"http:\/\/www.cloverfieldmovie.com\/\">Cloverfield<\/a>, where the audience is expected to pretend to be watching to real top-secret leaked footage.<\/p>\n<p>Domension Films\u2019 big cahuna, Bob Weinstein, stated,<\/p>\n<blockquote>\n<p>We didn\u2019t shoot anything, we found it. Found, baby!<\/p>\n<\/blockquote>\n<p>The movie is of course a work of fiction. That\u2019s not hard to figure out, even if you could not look up the actors who were in the movie. For instance, the astronauts of Apollo 18 in the movie are supposed to be Nathan Walker, John Grey e Benjamin Anderson, but the astronaut corps roster was very well known and none of these gentlemen were part of it. Although none of the crews for the cancelled flights (Apollos 18, 19 and 20) were never officially named \u2013 what would be the point? \u2013, one can infer from the assignment rotation system NASA used that <a href=\"http:\/\/nssdc.gsfc.nasa.gov\/planetary\/lunar\/apollo_18_20.html\">the Apollo 18 crew would likely be<\/a>:<\/p>\n<ul>\n<li>\n<p>Richard Gordon<\/p>\n<\/li>\n<li>\n<p>Vance Brand<\/p>\n<\/li>\n<li>\n<p>Harrison Schmitt<\/p>\n<\/li>\n<\/ul>\n<p>Except Schmitt was activated to the Apollo 17 main crew when it became clear that it would be the last chance for a scientist to step on the moon. Somebody \u2013 Joe Engle, perhaps \u2013 would have to replace him on Apollo 18.<\/p>\n<p>But the hoax is not really about the movie itself, but about the general idea that NASA ran more missions than we know about. So, could something like Apollo 18 really have existed? Could NASA have performed this secretly?<\/p>\n<p>It is unfortunately impossible to prove a negative, but at least we can think of how likely would that be. I can\u2019t really see how such a thing could have been done. To begin with, there\u2019s this:<br>\n<a href=\".\/flickr-3743794970-original1.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flickr-3743794970-original_thumb1_hu_ff52c6be73fbc97b.webp 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flickr-3743794970-original_thumb1_hu_3bf46401c489c0ef.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flickr-3743794970-original_thumb1.jpg\"\n alt=\"flickr-3743794970-original\"\n loading=\"lazy\"\n decoding=\"async\" width=\"615\" height=\"478\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flickr-3743794970-original_thumb1_hu_9d6930aacc207657.jpg 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flickr-3743794970-original_thumb1_hu_3e5184e805e9134f.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n(Image credit: <strong><a href=\"http:\/\/www.flickr.com\/photos\/vanderkroew\/\">Euclid vanderKroew<\/a>)<\/strong><\/p>\n<p>You see, the <strong>Saturn V<\/strong> was big. <em>Really big<\/em>. Not easy to hide, then. It seems highly unlikely that NASA could have launched a Saturn V out of Cape Canaveral without it being seen.<\/p>\n<p>I also saw this argument on some forum that NASA would have prefferred a night launch to improve the chances to keep it a secret, but the thing is, that big dumb rocket is not very subtle either.<br>\n<a href=\".\/3743667306_c2b398ee5b_z1.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/3743667306_c2b398ee5b_z_thumb1_hu_10aa58099a01a5c5.webp 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/3743667306_c2b398ee5b_z_thumb1_hu_d32ad5559a58a9f6.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/3743667306_c2b398ee5b_z_thumb1.jpg\"\n alt=\"3743667306_c2b398ee5b_z\"\n loading=\"lazy\"\n decoding=\"async\" width=\"584\" height=\"440\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/3743667306_c2b398ee5b_z_thumb1_hu_59868e971073ceb6.jpg 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/3743667306_c2b398ee5b_z_thumb1_hu_8f07c68e50740718.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n(Image credit: <a href=\"http:\/\/www.flickr.com\/photos\/vanderkroew\/\">Euclid vanderKroew<\/a>)<\/p>\n<p>And then if we discard a launch in the continental US, it would have to be from either a platform at sea or from somewhere in North Africa. Problem here is that the logistics of accomplishing such an feat \u2013 let alone in absolute secrecy \u2013 are just fenomenal.<\/p>\n<p>As well, the Saturn V was a very public project. All its parts were very well tracked and it\u2019s possible to know where most parts are even today. And some of those parts are <em>huge<\/em>, not the kind that you can stow in the back of a black unmarked van.<\/p>\n<p>And then there are other factors, of course. We\u2019re used to the image of three astronauts sitting on top of a rocket and a mission control room with, say, 20 or 30 people.<br>\n<a href=\".\/2985911950_0f3a207a10_z1.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/2985911950_0f3a207a10_z_thumb1_hu_b78641ed20d64cb7.webp 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/2985911950_0f3a207a10_z_thumb1_hu_4ebee8944b5a002a.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/2985911950_0f3a207a10_z_thumb1.jpg\"\n alt=\"2985911950_0f3a207a10_z\"\n loading=\"lazy\"\n decoding=\"async\" width=\"584\" height=\"329\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/2985911950_0f3a207a10_z_thumb1_hu_f5e0b27b62cd9f85.jpg 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/2985911950_0f3a207a10_z_thumb1_hu_b454ab42f143a13.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n(Image credit: <a href=\"http:\/\/www.flickr.com\/photos\/doctorow\/\">Cory Doctorow<\/a>.)<\/p>\n<p>But an Apollo flight involved a lot more people than that. In <a href=\"http:\/\/www.amazon.com\/gp\/product\/0670814466\/ref=as_li_ss_tl?ie=UTF8&amp;tag=itsuptoyoma-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399369&amp;creativeASIN=0670814466\">A Man on the Moon: The Voyages of the Apollo Astronauts<\/a> (Awesome gift! Thank you Stulzer!), Andrew Chalkin estimates the figure at 500,000 workers altogether. <a href=\"http:\/\/www.amazon.com\/gp\/product\/0618507574\/ref=as_li_ss_tl?ie=UTF8&amp;tag=itsuptoyoma-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399369&amp;creativeASIN=0618507574\">Others state the number is more like 400,000 people<\/a>.<\/p>\n<p>Regardless of the actual figure, it should be clear that such a mission would require the collaboration of <strong>hundreds of thousands of people<\/strong> all around the world (more on that below.)<\/p>\n<p>And contrary to what some might want to believe, the Apollo program was not something entirely done behind closely guarded doors at some Air Force base. It involved a <em>lot<\/em> of private contractors. GE, IBM, Boeing, GM\u2026 the list of contractors can occupy several pages. To assume that all the employees involved who have since likely changed jobs multiple times and retired would be able to keep this a secret for four decades really stretches one\u2019s imagination.<br>\n<a href=\".\/figc-31.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/figc-3_thumb1_hu_dc937cdafa18ea09.webp 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/figc-3_thumb1_hu_97d71ce34b1f4ad3.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/figc-3_thumb1.jpg\"\n alt=\"figc-3\"\n loading=\"lazy\"\n decoding=\"async\" width=\"584\" height=\"444\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/figc-3_thumb1_hu_ed923066baaf4e5.jpg 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/figc-3_thumb1_hu_25104e9d3a047a27.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n(Image credit: <a href=\".\/figc-32.jpg\">history.nasa.gov<\/a>)<\/p>\n<p>As big as the contractors\u2019, the list of academic institutions involved in the program is amazing. Virtually every major US university and institute was included, but the list also included institutions form Australia, Belgium, Canada, England, Finland, Germany, Japan, Scotland and Switzerland. And that takes me to what is, to me, the most important thing to consider.<\/p>\n<p>In order to fly to the Moon, you don\u2019t just point the rocket, turn on the ignition and wait for it to reach its destination. It\u2019s a complex voyage with huge preparations, calculations and adjustments. Orbital mechanics was one of the most interesting things I\u2019ve even studied. But I digress.<\/p>\n<p>An interesting challenge for NASA was to be able to communicate and track the ship all the way to the Moon and back.<br>\n<a href=\".\/flight-profile-p171.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flight-profile-p17_thumb1_hu_e79b9473e10c3ee3.webp 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flight-profile-p17_thumb1_hu_63cd4231938db0cd.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flight-profile-p17_thumb1.jpg\"\n alt=\"flight-profile-p17\"\n loading=\"lazy\"\n decoding=\"async\" width=\"584\" height=\"396\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flight-profile-p17_thumb1_hu_d4d2422bcdd8483.jpg 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/flight-profile-p17_thumb1_hu_f443d779fe8c14f0.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n(Escaneado pelo autor. NASA Apollo 11 Press Kit Pg 17)<\/p>\n<p>Nowadays NASA added a whole network of satellites to assist the tast, but back when Mercury and Apollo were underway, the tracking depended on a network of tracking stations, vessels and aircraft all around the world.<\/p>\n<p>That network was the <strong>Manned Space Flight (Tracking) Network<\/strong>. Starting from Apollo 10, the <strong>Deep Space Network<\/strong> was added to assist.<br>\n<a href=\".\/MSFN1.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/MSFN_thumb1_hu_32292ec6dec9b909.webp 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/MSFN_thumb1_hu_395ced17d8198e18.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/MSFN_thumb1.jpg\"\n alt=\"MSFN\"\n loading=\"lazy\"\n decoding=\"async\" width=\"584\" height=\"391\" srcset=\"https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/MSFN_thumb1_hu_5186c56a338298f5.jpg 320w, https:\/\/rselbach.com\/could-something-like-apollo-18-really-have-existed\/MSFN_thumb1_hu_6604e06c963f814f.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><br>\n(Scanned by the author from NASA Apollo 11 Press Kit, Pg 172)<\/p>\n<p>It\u2019s interesting to know that over the course of its evolution, NASA\u2019s networks included a station in Havana, Cuba. That station was dismantled after years of service due to the Cuban revolution. As Brazilian, I also find special interest in that there was even one station along with the Brasilia International Airport, even though it was quickly disassembled and shipped to Madagascar.)<\/p>\n<p>Although those were NASA installations, they employed locals. These stations all around the world had been performing duties for years under heavy media scrutiny and to expect that all of a sudden they would be able to do it in complete secrecy is beyond reasonable belief. That and the local workers who also had to keep secrets for four decades make the most absurd hole in the hoax.<\/p>\n<p>Now remember that the Apollo missions were tracked and monitored by several governments including, of course, the Soviet Union. In <a href=\"http:\/\/www.amazon.com\/gp\/product\/0312308655\/ref=as_li_ss_tl?ie=UTF8&amp;tag=itsuptoyoma-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399369&amp;creativeASIN=0312308655\">Two Sides of the Moon<\/a>, Russian cosmonaut Alexei Leonov \u2013 trained to be the first man on the moon \u2013 states that all the missions were followed by the Russians in a very well equipped Space Transmissions Corps, in Moscow. Now you need the secret to be kept by the Soviets and then, after the USSR fell, by the several nations that sprouted from it.<\/p>\n<p>And the Apollo missions were tracked by amateur astronomers and radio operators all over.<\/p>\n<p>Of course that nothing here proves beyond any doubt that such secret missions were <em>impossible<\/em>, just unreasonable unlikely. But since you can\u2019t prove a negative, no matter how improbale, there will still be plenty of people who believe.<\/p>"},{"title":"My need for anonymity","link":"https:\/\/rselbach.com\/my-need-for-anonymity\/","pubDate":"Thu, 04 Aug 2011 19:54:38 +0000","guid":"https:\/\/rselbach.com\/my-need-for-anonymity\/","description":"<p>Much has been said about the pros and cons of anonymity lately, prompted by Google+ TOS which require the use of one\u2019s real name. No pseudonyms allowed, except apparently if you call yourself Lady Gaga or 50 Cent.<\/p>\n<p>I have seen many kinds of arguments both for and against the use of aliases and I will not repeat them here. There is however one use of aliases that I haven\u2019t seen stated anywhere and that coincidentally affects me personally. Perhaps this is so because the problem I am about to present is not so common after all. Or perhaps it is common but people decide not to talk about it. I have no way of knowing.<\/p>\n<p>Anonymity is a vital necessity to people with a certain kind of disability, a mental disorder. I am such a person. As some of my friends know and others mock, I suffer from a mental condition called social phobia, also known as social anxiety. I take medications that help me overcome some of the most serious effects and that allow me to do things like write about it on this very blog.<\/p>\n<p>Social anxiety manifests itself in varying degrees in all kinds of social interactions. And the levels of manifestations are not what you might expect. I regularly make presentations without a second thought. I\u2019ve given talks to hundreds of people. And yet, ordering a pizza over the phone is terrifying experience to me. No matter how many times I\u2019ve done it, I still have to \u201cprepare\u201d myself every time. I rehearse, play several unlikely scenarios in my head until I finally get the courage to dial the number and talk to the person on the other side. One characteristic of this anxiety disorder is that rationally I <em>know<\/em> that there is nothing wrong; there is no risk in calling the pizza place. But the brain acts as if there were. But I digress.<\/p>\n<p>I love coding. I have been doing it since I was a kid and it\u2019s the best thing I know how to do. And then there is open source. Open source projects should be the perfect venue for me to have fun. Except I am scared stiff by the idea that someone might laugh at the code. It came to a point where it is impossible for me to contribute. Then I\u2019ve come up with a solution: an alias. For the past several years I\u2019ve lived two different lives online: one as myself and another as an alias. I keep them strictly separate.<\/p>\n<p>Using the alias, I actively contribute to several different projects. And I enjoy it all. And it would be impossible for me to do that using my own name. My pseudonym allows me to work around my condition. It allows me to <em>live<\/em> my life.<\/p>\n<p>I understand the rationale behind the requirement for real names on Google+. But I also know that the requirement makes it impossible for people like me to be really free on the Internet. So far, Google hasn\u2019t figured out my alias. Hopefully it never will.<\/p>\n<p>(Photo by\u00a0<a href=\"http:\/\/www.fotopedia.com\/users\/abhishekb\">Abhishek Singh<\/a>)<\/p>"},{"title":"Chrome and the new Lion full-screen behaviour","link":"https:\/\/rselbach.com\/chrome-and-the-new-lion-full-screen-behaviour\/","pubDate":"Tue, 02 Aug 2011 02:19:42 +0000","guid":"https:\/\/rselbach.com\/chrome-and-the-new-lion-full-screen-behaviour\/","description":"<p><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/chrome-and-the-new-lion-full-screen-behaviour\/2687444500_e8beddd5e7_b1-580x375_hu_1bf9e00037cd176c.webp 320w, https:\/\/rselbach.com\/chrome-and-the-new-lion-full-screen-behaviour\/2687444500_e8beddd5e7_b1-580x375_hu_d928c3ce85f16a15.webp 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/chrome-and-the-new-lion-full-screen-behaviour\/2687444500_e8beddd5e7_b1-580x375.jpg\"\n alt=\"Three wise monkeys by Anderson Mancini\"\n loading=\"lazy\"\n decoding=\"async\" width=\"580\" height=\"375\" srcset=\"https:\/\/rselbach.com\/chrome-and-the-new-lion-full-screen-behaviour\/2687444500_e8beddd5e7_b1-580x375_hu_9ccb7eb42cba4ff3.jpg 320w, https:\/\/rselbach.com\/chrome-and-the-new-lion-full-screen-behaviour\/2687444500_e8beddd5e7_b1-580x375_hu_b27f8b9bce018a6b.jpg 480w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/p>\n<p>While I was ranting about the annoyances I found in OS X Lion today, a friend commented he had no issues at all, except for the full-screen mode. I got curious because the new Lion full-screen mode is probably the only new feature I found interesting. What did Apple do so wrong?<\/p>\n<p>The answer: <em>Google Chrome<\/em>.<\/p>\n<p>Wait, what? My friend was complaining that in Chrome you needed to use a keyboard shortcut in order to leave full-screen mode. That, he continued, was because Apple had given programmers too much freedom to implement the new feature any way they wanted. And he knew that, he assured me, because he had searched Google and confirmed it.<\/p>\n<p>The new full-screen mode in Lion is implemented as a window behaviour not enabled by default, but adding it to a window is remarkably easy*:<\/p>\n<p>[go]<br>\nNSWindowCollectionBehavior behavior = [window collectionBehavior];<br>\nbehavior |= NSWindowCollectionBehaviorFullScreenPrimary;<br>\n[window setCollectionBehavior:behavior];<br>\n[\/go]<\/p>\n<p>Adding the NSWindowCollectionBehaviorFullScreenPrimary behaviour to a window will enable a small button to its top right corner. When enabled, the mode will allocate a new Desktop for the full-screen app and will also add an icon to the system menu to allow you to quickly leave full-screen mode.<\/p>\n<p>And that\u2019s the little icon my friend complained Chrome wasn\u2019t showing, forcing him to use a keyboard shortcut. Imagine the trepidity! And all because of Apple.<\/p>\n<p>I tried to explain that the problem was that Chrome\u2019s windows still didn\u2019t support the new full-screen behaviour but my friend\u2019s version of reality was unswayable: Chrome supported the new behaviour and the problem was Apple. He had searched Google to confirm it. What could I possibly do?<\/p>\n<p>Search it myself is what. And search I did. And I found <a href=\"http:\/\/code.google.com\/p\/chromium\/issues\/detail?id=74065#c39\">this comment<\/a> on Chromium\u2019s bug tracker:<\/p>\n<blockquote>\n<p>Comment <a href=\"http:\/\/code.google.com\/p\/chromium\/issues\/detail?id=74065#c39\">39<\/a> by <a href=\"http:\/\/code.google.com\/u\/rsesek@chromium.org\/\">rsesek@chromium.org<\/a>, Jul 15, 2011<\/p>\n<p>We had a conversation with one of our designers, and what we\u2019re going to do right now is remove the fullscreen button so we don\u2019t advertise a behavior that we don\u2019t really implement. That change just landed and will hit Canary\/Dev channels soon.<\/p>\n<p>Long-term, we\u2019re going to implement a proper fullscreen interface for Lion. In this interface, we\u2019ll also experiment with having a collapsable toolbar. Until then, fullscreen will operate as it does on Leopard\/Snow Leopard.<\/p>\n<\/blockquote>\n<p>So there it is, straight from the source. Chromium \u2014 same as Chrome \u2014 still doesn\u2019t support the new behaviour. Done. Nothing like reality to end a discussion.<\/p>\n<p>Except my friend would not yield. Apple still needs to fix Chrome and anyone who disagrees \u2014 presumably that Chromium developer himself \u2014 is to be disregarded as an Apple fanboy.<\/p>\n<p>If however you don\u2019t want to wait for Google (or is it Apple?0 to release Chrome with the new full-screen behaviour, you can get by using <a href=\"http:\/\/chpwn.com\/apps\/maximizer.html\">Maximizer<\/a>, which adds the behaviour to any application window.<\/p>\n<ul>\n<li>Yes, I do realize that if you\u2019re supporting multiple OSX versions and, even worse, multiple platforms, things get slightly more complex, but still.<\/li>\n<\/ul>\n<p>(<a href=\"http:\/\/www.flickr.com\/photos\/ektogamat\/2687444500\/sizes\/l\/in\/photostream\/\">Image by Anderson Mancini<\/a>)<\/p>"},{"title":"Jeff Greason on the near future of space exploration","link":"https:\/\/rselbach.com\/jeff-greason-on-the-near-future-of-space-exploration\/","pubDate":"Sun, 24 Jul 2011 15:50:32 +0000","guid":"https:\/\/rselbach.com\/jeff-greason-on-the-near-future-of-space-exploration\/","description":"<p>Fascinating TEDx talk about the near future of space exploration. <a href=\"http:\/\/youtu.be\/m8PlzDgFQMM\">Jeff Greason \u2013 Rocket Scientist: Making Space Pay and Having Fun Doing It<\/a>:<\/p>"},{"title":"\u201c\u00bfPor qu\u00e9 est\u00e1n todos hablando ingl\u00e9s?\u201d","link":"https:\/\/rselbach.com\/por-que-estan-todos-hablando-ingles\/","pubDate":"Wed, 13 Jul 2011 19:32:22 +0000","guid":"https:\/\/rselbach.com\/por-que-estan-todos-hablando-ingles\/","description":"<p>I\u2019ve been spending an insalubrious amount of time on <a href=\"https:\/\/plus.google.com\/\">Google +<\/a>. I managed to plump for a pretty good group to follow and as a consequence I\u2019ve been getting consistently interesting content. As for myself, I mostly I post in English. A couple of days ago, I posted something most inconsequential and it would have been an unreservedly unremarkable post wasn\u2019t it for the fact that it was geolocated in Cordoba, Argentina, which caused it to attract the attention of people nearby. In the middle of the comments, someone asked, in Spanish: \u201c<em>why is everyone speaking English?<\/em>\u201d That was a fair question and it touched something that has bugged me in the past.<\/p>\n<p>Some part of my brain must miss the good old times of hunting and gathering as I ended up as a nomadic man\u2014albeit one who doesn\u2019t hunt and at most gathers food from grocery stores, so there might be a flaw in my theory. My rootless nature made me move a lot. This and the nature of my work caused me to make friends in several places other than my native Brazil<a href=\"https:\/\/plus.google.com\/\">1<\/a>.<\/p>\n<p>We\u2019ve already established that I communicate in Portuguese. Working at a US-based multinational as well as with open source, I also use English quite a bit\u2014and my aforesaid rootlessness has taken me to inhabit the beautiful state of Oregon in the past. Oh and did I mention I am currently putting in a tour of duty in Argentina?<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/thomasthomas\/274884308\/\"><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/por-que-estan-todos-hablando-ingles\/274884308_8a9b319c87_z-300x226.jpg\"\n alt=\"The Myth of the Tower of Babel\"\n loading=\"lazy\"\n decoding=\"async\" width=\"300\" height=\"226\">\n<\/figure>\n<\/a><\/p>\n<p>The result of all of this\u2014<a href=\"http:\/\/boards.straightdope.com\/sdmb\/archive\/index.php\/t-330951.html\">in blatant contrast with the pre-Tower of Babel times when everybody obviously spoke English<\/a>\u2014is that I communicate daily in multiple languages. There isn\u2019t a day\u2014well, weekday\u2014I don\u2019t have to speak Spanish, Portuguese, English and French with someone or another. And that is fine and actually quite nice: you do lose languages if you don\u2019t use them. Not like riding a bike, I suppose. Regardless, it is not a problem to communicate 1:1 in those languages. But what about 1:many conversations?<\/p>\n<p>Blogging is a clear example. Should I blog in Portuguese as some keep telling me I should? I cannot reasonably expect my non-Brazilian readers to understand Portuguese. If I write in French, my Quebecer friends will be happy but what about the rest? Nationalistic rants aside, English <em>is<\/em> an international language nowadays, just as Latin and French once were. Aside from <em>very<\/em> few people, the vast majority of the people I know can understand English and that\u2019s why I use it most often than any other.<\/p>\n<p>Ideally, one would use their own native language and computer translation would do the rest. Unfortunately we are not there yet. I will admit that computer translation is getting better and better and it is fairly good if you write clear, short sentences. And it will get better. But I am skeptic that we will ever get to the point where the algorithms will be able to deal with subtleties, innuendos and all the puns that make up human interactions.<\/p>\n<p>The way I see, I currently have a few options \u2013<\/p>\n<ul>\n<li>\n<p><strong>I write in Portuguese, as the ever vigilant Brazilian crowd demands it.<\/strong> That would soothe the wrathful nationalists who believe me a Traitor Of The Fatherland\u2122. But it also limits my already limited audience; not good.**<br>\n** <\/p><\/p>\n<\/li>\n<li>\n<p><strong>I write multiple versions of the same thing in each language.<\/strong> That would begin to feel like actual work, not fun. Also, having tried that in the past, I\u2019ve learned that after I was done with the first version, the others never came out naturally.**<br>\n**<\/p>\n<\/li>\n<li>\n<p><strong>I write in English.<\/strong> Sure it makes me a bootlicking lackey of the imperialist Yankees in the eyes of the insecure, but it also helps me reach pretty much everyone I know.**<br>\n**<\/p>\n<\/li>\n<\/ul>\n<p>But using English is not a perfect solution either. For once, I am obviously not a native speaker and thus have an imperfect and narrow vocabulary. As well, I don\u2019t share the cultural experiences that help define the subtleties of English. And finally, there are heaps of topics that just <em>feel wrong<\/em> in English: such as local\u2014as in Brazilian\u2014topics. It just feels weird.<\/p>\n<p>Back to Google+, I have created Circles for Portuguese and French, but these are not much valuable until Google comes up with some system of set arithmetic that would allow me to say something to the effect of \u201cPost this to members of Circle X who also happen to be members of Circle French.\u201d Until then, English is my best bet.<\/p>\n<p><a href=\"https:\/\/plus.google.com\/\">1<\/a> Experience tells me that I am required to point out that we, cheerful Brazilians, speak Portuguese, not Spanish.<\/p>\n<p>(Image Credit: <a href=\"http:\/\/www.flickr.com\/photos\/thomasthomas\/\">ThomasThomas<\/a>, Creative Commons)<\/p>"},{"title":"Godwin\u2019s Law is anything but","link":"https:\/\/rselbach.com\/godwins-law-is-anything-but\/","pubDate":"Mon, 11 Jul 2011 14:43:57 +0000","guid":"https:\/\/rselbach.com\/godwins-law-is-anything-but\/","description":"<p>I\u2019ve got many gripes with the internet, I\u2019ll admit. One of those is the overuse of Godwin\u2019s Law. Actually, it\u2019s a double offence because not only people overuse it, but this Law is anything but.<\/p>\n<p>But let\u2019s start with the misuse. I posted a while ago to Facebook that I had finished reading <a href=\"http:\/\/www.amazon.com\/gp\/product\/1451651686\/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1451651686&amp;linkCode=as2&amp;tag=itsuptoyoma-20\">The Rise and Fall of the Third Reich<\/a> and I mentioned how scary it was that a place right in the heart of \u201ccivilized\u201d Europe could have fallen to that madness so quickly. A small discussion formed with some people until one of my geek friends commented something to the effect of\u2014<\/p>\n<blockquote>\n<p>Let\u2019s stop this because Roberto already Godwinned in the original post!<\/p>\n<\/blockquote>\n<p>You see, us geeks are good at that: repeating some meme without thinking much about them.<\/p>\n<p>But that\u2019s how I see \u201cGodwin\u201d being used all over the place. A discussion killer. And the discussion did get killed, unfortunately. It\u2019s like Godwin\u2019s Law says \u201cif someone mentions Nazis, the discussion is over\u201d but that\u2019s not what the \u201claw\u201d says\u2014<\/p>\n<blockquote>\n<p>As an online discussion continues, the probability of a reference or comparison to Hitler or to Nazis approaches 1.<\/p>\n<\/blockquote>\n<p>Which is actually true. Just like\u2014<\/p>\n<blockquote>\n<p>As an online discussion continues, the probability of a reference or comparison to Snow White and the Seven Dwarves approaches 1.<\/p>\n<\/blockquote>\n<p>Obviously, as a discussion grows, the probability of referencing <em>anything<\/em> will approach 1! Here\u2019s Godwin himself back in 2008 about his \u201claw\u201d\u2014<\/p>\n<blockquote>\n<p>Although deliberately framed as if it were a law of nature or of mathematics, its purpose has always been rhetorical and pedagogical: I wanted folks who glibly compared someone else to Hitler or to Nazis to think a bit harder about the Holocaust.<\/p>\n<\/blockquote>\n<p>I find it ironic that his little experiment for making people think harder about the Holocaust is now used as a tool to <em>avoid<\/em> mentions to it.<\/p>\n<p>You see, I get where Godwin was trying to go. You see glib comparisons with the Nazi all the time and yes, they suck. But going from that to making one of the most defining moments of the last Century completely off-limits is preposterous! Nazi comparisons are often valid and should <em>not<\/em> be avoided, especially by misusing an old usenet meme.<\/p>\n<p>Again, His Godwinness\u2014<\/p>\n<blockquote>\n<p>Still, I sometimes have some ambivalence about the Law, which is far beyond my control these days. Like most parents, I\u2019m frequently startled by the unexpected turn my 18-year-old offspring takes. [\u2026] When I saw the photographs from Abu Ghraib, for example, I understood instantly the connection between the humiliations inflicted there and the ones the Nazis imposed upon death camp inmates\u2014but I am the one person in the world least able to draw attention to that valid comparison.<\/p>\n<\/blockquote>\n<p>Avoiding comparing things to something as defining as Nazi Germany is an arbitrary limitation that makes no sense.<\/p>\n<p>That\u2019s not to say that all Nazi comparisons are valid. There really are plenty of dishonest Nazi comparisons out there, such as <a href=\"http:\/\/www.pressherald.com\/news\/Governor-says-IRS-new-gestapo-in-radio-address.html\">this one<\/a>, by an American governor\u2014<\/p>\n<blockquote>\n<p>We the people have been told there is no choice. You must buy health insurance or pay the new Gestapo \u2014 the IRS.<\/p>\n<\/blockquote>\n<p>This because the Supreme Court of the United States had upheld a law that represented the first steps of that country in <strong>following<\/strong> the rest of the civilized world in providing its citizens with basic healthcare. <em>Healthcare! Oh the evils of that Gestapo!<\/em><\/p>\n<p>But it\u2019s unreasonable to expect people to <em>completely<\/em> ignore a huge part of our history in hope that dishonest governors won\u2019t make silly comparisons, which they\u2019ll do anyway.<\/p>"},{"title":"Anagramizer, a simple anagram solver in Go","link":"https:\/\/rselbach.com\/anagramizer-a-simple-anagram-solver-in-go\/","pubDate":"Tue, 21 Jun 2011 00:18:27 +0000","guid":"https:\/\/rselbach.com\/anagramizer-a-simple-anagram-solver-in-go\/","description":"<p>This weekend I took the family to celebrate Father\u2019s Day away from town. We went around getting to know parts of the province we live in and never been to.<\/p>\n<p><a href=\".\/IMG_0402.jpg\"><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/anagramizer-a-simple-anagram-solver-in-go\/IMG_0402-300x225.jpg\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\" width=\"300\" height=\"225\">\n<\/figure>\n<\/a>We came back yesterday and the plan today was for a nice, calm day at home (it\u2019s a holiday of some sort here.) Then I got engaged in a game called <strong>Hanging with Friends<\/strong>, a mix of the traditional hangman with a bit of Scrabble.<\/p>\n<p>Since English isn\u2019t my first language, I have a limited vocabulary, which leaves me at a disadvantage against my English-speaking friends. I can handle the \u201changman\u201d part of the game where I have to guess the word my friends come up with; but when it becomes \u201cScrabble\u201d and I\u2019ve got to form words using only a given set of letters and still make them difficult enough that a native English speaker will have problems figuring them out, then it\u2019s tough.<\/p>\n<p>An itch that needed some scratching. Enter <a href=\"http:\/\/robteix.com\/w\/Anagramizer\">Anagramizer<\/a>.<\/p>\n<p>When I woke up this morning, I decided to write a little program to help me. You call it cheating, I call it having a bit of nerd fun.<\/p>\n<p>Being that I\u2019m currently in love with <a href=\"http:\/\/golang.org\">Go<\/a>, I decided to write in that language and it was really easy and quick to do it. It took me about half an hour to write the program that did what I needed. But then\u2026<\/p>\n<p>I succumbed to the temptation and started adding bells and whistles. Admittedly it was mostly for my own amusement and trying stuff in Go, but by the time we were leaving for lunch, the program had more options than the KDE audio volume utility (see what I did just there?)<\/p>\n<p>I decided to <a href=\"http:\/\/robteix.com\/w\/Anagramizer\">make it available to anyone<\/a> who wants to play with it. It served its purpose of entertaining me for about half a day \ud83d\ude42<\/p>\n<p>It\u2019s now available on\u00a0<a href=\"https:\/\/github.com\/robteix\/anagramizer\">Github<\/a> and released under a BSD licence.<\/p>"},{"title":"Euler 9 in Go","link":"https:\/\/rselbach.com\/euler-9-in-go\/","pubDate":"Tue, 14 Jun 2011 15:30:06 +0000","guid":"https:\/\/rselbach.com\/euler-9-in-go\/","description":"<p>For fun I picked one of the Euler algorithms I had played with before and\nrewrote it in <a href=\"http:\/\/golang.org\">Go<\/a>. Instead of carrying over the nested-loop search, this\nversion first eliminates <code>c<\/code> using the fixed sum and solves the Pythagorean\nequation for <code>b<\/code>. Only <code>a<\/code> remains to search.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">package<\/span> <span style=\"color:#a6e22e\">main<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">import<\/span> (\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;fmt&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#e6db74\">&#34;os&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">func<\/span> <span style=\"color:#a6e22e\">main<\/span>() {\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">const<\/span> <span style=\"color:#a6e22e\">sum<\/span> = <span style=\"color:#ae81ff\">1000<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#66d9ef\">for<\/span> <span style=\"color:#a6e22e\">a<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#ae81ff\">1<\/span>; <span style=\"color:#a6e22e\">a<\/span> &lt; <span style=\"color:#a6e22e\">sum<\/span><span style=\"color:#f92672\">\/<\/span><span style=\"color:#ae81ff\">3<\/span>; <span style=\"color:#a6e22e\">a<\/span><span style=\"color:#f92672\">++<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#a6e22e\">numerator<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">sum<\/span> <span style=\"color:#f92672\">*<\/span> (<span style=\"color:#a6e22e\">sum<\/span> <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">2<\/span><span style=\"color:#f92672\">*<\/span><span style=\"color:#a6e22e\">a<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#a6e22e\">denominator<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#ae81ff\">2<\/span> <span style=\"color:#f92672\">*<\/span> (<span style=\"color:#a6e22e\">sum<\/span> <span style=\"color:#f92672\">-<\/span> <span style=\"color:#a6e22e\">a<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">numerator<\/span><span style=\"color:#f92672\">%<\/span><span style=\"color:#a6e22e\">denominator<\/span> <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#ae81ff\">0<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#66d9ef\">continue<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t}\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#a6e22e\">b<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">numerator<\/span> <span style=\"color:#f92672\">\/<\/span> <span style=\"color:#a6e22e\">denominator<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#a6e22e\">c<\/span> <span style=\"color:#f92672\">:=<\/span> <span style=\"color:#a6e22e\">sum<\/span> <span style=\"color:#f92672\">-<\/span> <span style=\"color:#a6e22e\">a<\/span> <span style=\"color:#f92672\">-<\/span> <span style=\"color:#a6e22e\">b<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t<span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#a6e22e\">a<\/span> &lt; <span style=\"color:#a6e22e\">b<\/span> <span style=\"color:#f92672\">&amp;&amp;<\/span> <span style=\"color:#a6e22e\">b<\/span> &lt; <span style=\"color:#a6e22e\">c<\/span> {\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Println<\/span>(<span style=\"color:#a6e22e\">a<\/span> <span style=\"color:#f92672\">*<\/span> <span style=\"color:#a6e22e\">b<\/span> <span style=\"color:#f92672\">*<\/span> <span style=\"color:#a6e22e\">c<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t\t<span style=\"color:#66d9ef\">return<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t\t}\n<\/span><\/span><span style=\"display:flex;\"><span>\t}\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">fmt<\/span>.<span style=\"color:#a6e22e\">Fprintln<\/span>(<span style=\"color:#a6e22e\">os<\/span>.<span style=\"color:#a6e22e\">Stderr<\/span>, <span style=\"color:#e6db74\">&#34;no solution&#34;<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>\t<span style=\"color:#a6e22e\">os<\/span>.<span style=\"color:#a6e22e\">Exit<\/span>(<span style=\"color:#ae81ff\">1<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>The divisibility check rejects values of <code>a<\/code> that would produce a fractional\n<code>b<\/code>. The program uses constant space, examines fewer than <code>sum \/ 3<\/code> candidates,\nand prints <code>31875000<\/code>.<\/p>"},{"title":"How to set up Emacs on Windows","link":"https:\/\/rselbach.com\/how-to-set-up-emacs-on-windows\/","pubDate":"Mon, 13 Jun 2011 18:38:49 +0000","guid":"https:\/\/rselbach.com\/how-to-set-up-emacs-on-windows\/","description":"<p>Just so I have it documented somewhere for future reference, here\u2019s how to quickly set <a href=\"http:\/\/www.gnu.org\/software\/emacs\/\">GNU Emacs<\/a> up on Windows.<\/p>\n<ol>\n<li>\n<p>Download it from <a href=\"http:\/\/ftp.gnu.org\/gnu\/emacs\/windows\/\">http:\/\/ftp.gnu.org\/gnu\/emacs\/windows\/<\/a><\/p><\/p>\n<\/li>\n<li>\n<p>Unzip it to, say, C:emacs or something like that<\/p>\n<\/li>\n<li>\n<p>Set the environment variable HOME to C:emacs and include C:emacsbin to the PATH<\/p>\n<\/li>\n<li>\n<p>If you want to have a \u201c<strong>Open with _G_NU Emacs<\/strong>\u201d option on the context menu, just create a registry file (call it emacs.reg or whatever.reg) with the contents below and double-click it to import it into the registry.<\/p>\n<\/li>\n<\/ol>\n<pre><code>REGEDIT4 \n[HKEY\\_CLASSES\\_ROOT*shell]\n\n[HKEY\\_CLASSES\\_ROOT*shellemacsmenu] \n@=&amp;ldquo;Open with &amp;GNU; Emacs&amp;rdquo;\n\n[HKEY\\_CLASSES\\_ROOT*shellemacsmenucommand] \n@=&amp;ldquo;C:emacsbinrunemacs.exe &amp;rdquo;%1&amp;ldquo;&amp;rdquo;\n<\/code><\/pre>\n<p><em>Et voil\u00e0<\/em>! As well, for my preferred colour scheme, we need to use <strong>color-theme<\/strong> from <a href=\"http:\/\/www.nongnu.org\/color-theme\/\">http:\/\/www.nongnu.org\/color-theme\/<\/a> and set it up in your .emacs file:<\/p>\n<pre><code>(add-to-list 'load-path &quot;c:\/emacs\/.emacs.d&quot;)\n(require 'color-theme)\n(color-theme-initialize)\n(when (display-graphic-p)\n (color-theme-subtle-hacker)\n<\/code><\/pre>"},{"title":"Euler 15 in Python","link":"https:\/\/rselbach.com\/euler-15-in-python\/","pubDate":"Sat, 07 Aug 2010 22:39:27 +0000","guid":"https:\/\/rselbach.com\/euler-15-in-python\/","description":"<p>This one isn\u2019t even funny\u2026<\/p>\n<blockquote>\n<p>Starting in the top left corner of a <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>2<\/mn><mo>\u00d7<\/mo><mn>2<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">2 \\times 2<\/annotation><\/semantics><\/math><\/span> grid, there are 6 routes (without backtracking) to the bottom right corner.<\/p>\n<\/blockquote>\n<p><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/euler-15-in-python\/p_015.gif\"\n alt=\"The six routes through a 2 by 2 grid, using only right and down moves\"\n loading=\"lazy\"\n decoding=\"async\" width=\"208\" height=\"151\">\n<\/figure>\n<\/p>\n<p>How many routes are there through a <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>20<\/mn><mo>\u00d7<\/mo><mn>20<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">20 \\times 20<\/annotation><\/semantics><\/math><\/span> grid?<\/p>\n<p>Your first thought would be to generate the routes, but for a <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>20<\/mn><mo>\u00d7<\/mo><mn>20<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">20 \\times 20<\/annotation><\/semantics><\/math><\/span> grid, those amount to BILLIONS and you\u2019d try to do it recursively too! Forget it.<\/p>\n<p>But if you have some CompSci-level math background, though, you\u2019ll remember this one\u2014reading <a href=\"http:\/\/www.amazon.com\/gp\/product\/0321637135?ie=UTF8&amp;tag=itsuptoyoma-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0321637135\">The Art of Computer Programming, Vol. 4<\/a> also helps. It\u2019s a matter of combinatorics and if we take <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>w<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">w<\/annotation><\/semantics><\/math><\/span> for the width and <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>h<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">h<\/annotation><\/semantics><\/math><\/span> for the height, all we need to calculate is:<\/p>\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><semantics><mrow><mfrac><mrow><mo stretchy=\"false\">(<\/mo><mi>w<\/mi><mo>+<\/mo><mi>h<\/mi><mo stretchy=\"false\">)<\/mo><mo stretchy=\"false\">!<\/mo><\/mrow><mrow><mi>w<\/mi><mo stretchy=\"false\">!<\/mo><mtext>\u2009<\/mtext><mi>h<\/mi><mo stretchy=\"false\">!<\/mo><\/mrow><\/mfrac><mi mathvariant=\"normal\">.<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">\n\\frac{(w+h)!}{w!\\,h!}.\n<\/annotation><\/semantics><\/math><\/span><p>Every path consists of exactly 20 moves right and 20 moves down. Choosing which\n20 of the 40 positions are right moves uniquely determines a path, so the\nanswer is the binomial coefficient <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mo fence=\"true\">(<\/mo><mfrac linethickness=\"0px\"><mn>40<\/mn><mn>20<\/mn><\/mfrac><mo fence=\"true\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">\\binom{40}{20}<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">from<\/span> math <span style=\"color:#f92672\">import<\/span> comb\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>width <span style=\"color:#f92672\">=<\/span> height <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">20<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(comb(width <span style=\"color:#f92672\">+<\/span> height, width))\n<\/span><\/span><\/code><\/pre><\/div><p><code>math.comb<\/code> computes the integer result directly, without constructing three\nfactorials. The answer is <code>137846528820<\/code>.<\/p>"},{"title":"Euler 11 in Python","link":"https:\/\/rselbach.com\/euler-11-in-python\/","pubDate":"Fri, 06 Aug 2010 17:19:56 +0000","guid":"https:\/\/rselbach.com\/euler-11-in-python\/","description":"<p>Project Euler\u2019s problem #11 statement goes:<\/p>\n<blockquote>\n<p>In the <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>20<\/mn><mo>\u00d7<\/mo><mn>20<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">20 \\times 20<\/annotation><\/semantics><\/math><\/span> grid below, four numbers along a diagonal line have been marked in bold.<\/p>\n<\/blockquote>\n<p>08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08<br>\n49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00<br>\n81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65<br>\n52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91<br>\n22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80<br>\n24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50<br>\n32 98 81 28 64 23 67 10 <strong>26<\/strong> 38 40 67 59 54 70 66 18 38 64 70<br>\n67 26 20 68 02 62 12 20 95 <strong>63<\/strong> 94 39 63 08 40 91 66 49 94 21<br>\n24 55 58 05 66 73 99 26 97 17 <strong>78<\/strong> 78 96 83 14 88 34 89 63 72<br>\n21 36 23 09 75 00 76 44 20 45 35 <strong>14<\/strong> 00 61 33 97 34 31 33 95<br>\n78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92<br>\n16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57<br>\n86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58<br>\n19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40<br>\n04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66<br>\n88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69<br>\n04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36<br>\n20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16<br>\n20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54<br>\n01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48<\/p>\n<p>The product of these numbers is <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>26<\/mn><mo>\u00d7<\/mo><mn>63<\/mn><mo>\u00d7<\/mo><mn>78<\/mn><mo>\u00d7<\/mo><mn>14<\/mn><mo>=<\/mo><mn>1<\/mn><mtext>\u2009<\/mtext><mn>788<\/mn><mtext>\u2009<\/mtext><mn>696<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">26 \\times 63 \\times 78 \\times 14 = 1\\,788\\,696<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<p>What is the greatest product of four adjacent numbers in any direction (up, down, left, right, or diagonally) in the <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>20<\/mn><mo>\u00d7<\/mo><mn>20<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">20 \\times 20<\/annotation><\/semantics><\/math><\/span> grid?<\/p>\n<p>This one is remarkably easy but also was quite fun. I think it\u2019s because it reminds me of the kind of work we\u2019d do during our Algorithms classes during my first year in college. And so this one goes to my Algorithms teacher, Ricardo Vargas Dornelles\u2014best teacher I\u2019ve ever had too.<\/p>\n<p>Only four directions are necessary: reversing any group gives the same\nproduct. Describing those directions as row and column offsets keeps one loop\nresponsible for every case and makes the boundary check explicit.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">from<\/span> math <span style=\"color:#f92672\">import<\/span> prod\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>grid_text <span style=\"color:#f92672\">=<\/span> <span style=\"color:#e6db74\">&#34;&#34;&#34;<\/span><span style=\"color:#ae81ff\">\\\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">&#34;&#34;&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>grid <span style=\"color:#f92672\">=<\/span> [\n<\/span><\/span><span style=\"display:flex;\"><span> [int(number) <span style=\"color:#66d9ef\">for<\/span> number <span style=\"color:#f92672\">in<\/span> line<span style=\"color:#f92672\">.<\/span>split()]\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">for<\/span> line <span style=\"color:#f92672\">in<\/span> grid_text<span style=\"color:#f92672\">.<\/span>splitlines()\n<\/span><\/span><span style=\"display:flex;\"><span>]\n<\/span><\/span><span style=\"display:flex;\"><span>directions <span style=\"color:#f92672\">=<\/span> ((<span style=\"color:#ae81ff\">0<\/span>, <span style=\"color:#ae81ff\">1<\/span>), (<span style=\"color:#ae81ff\">1<\/span>, <span style=\"color:#ae81ff\">0<\/span>), (<span style=\"color:#ae81ff\">1<\/span>, <span style=\"color:#ae81ff\">1<\/span>), (<span style=\"color:#ae81ff\">1<\/span>, <span style=\"color:#f92672\">-<\/span><span style=\"color:#ae81ff\">1<\/span>))\n<\/span><\/span><span style=\"display:flex;\"><span>length <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">4<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>rows <span style=\"color:#f92672\">=<\/span> len(grid)\n<\/span><\/span><span style=\"display:flex;\"><span>columns <span style=\"color:#f92672\">=<\/span> len(grid[<span style=\"color:#ae81ff\">0<\/span>])\n<\/span><\/span><span style=\"display:flex;\"><span>largest <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">0<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> row <span style=\"color:#f92672\">in<\/span> range(rows):\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">for<\/span> column <span style=\"color:#f92672\">in<\/span> range(columns):\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">for<\/span> row_step, column_step <span style=\"color:#f92672\">in<\/span> directions:\n<\/span><\/span><span style=\"display:flex;\"><span> end_row <span style=\"color:#f92672\">=<\/span> row <span style=\"color:#f92672\">+<\/span> (length <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">1<\/span>) <span style=\"color:#f92672\">*<\/span> row_step\n<\/span><\/span><span style=\"display:flex;\"><span> end_column <span style=\"color:#f92672\">=<\/span> column <span style=\"color:#f92672\">+<\/span> (length <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">1<\/span>) <span style=\"color:#f92672\">*<\/span> column_step\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#f92672\">not<\/span> (<span style=\"color:#ae81ff\">0<\/span> <span style=\"color:#f92672\">&lt;=<\/span> end_row <span style=\"color:#f92672\">&lt;<\/span> rows <span style=\"color:#f92672\">and<\/span> <span style=\"color:#ae81ff\">0<\/span> <span style=\"color:#f92672\">&lt;=<\/span> end_column <span style=\"color:#f92672\">&lt;<\/span> columns):\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">continue<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> product <span style=\"color:#f92672\">=<\/span> prod(\n<\/span><\/span><span style=\"display:flex;\"><span> grid[row <span style=\"color:#f92672\">+<\/span> offset <span style=\"color:#f92672\">*<\/span> row_step][column <span style=\"color:#f92672\">+<\/span> offset <span style=\"color:#f92672\">*<\/span> column_step]\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">for<\/span> offset <span style=\"color:#f92672\">in<\/span> range(length)\n<\/span><\/span><span style=\"display:flex;\"><span> )\n<\/span><\/span><span style=\"display:flex;\"><span> largest <span style=\"color:#f92672\">=<\/span> max(largest, product)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(largest)\n<\/span><\/span><\/code><\/pre><\/div><p>Every valid group is visited exactly once. Since there are four fixed\ndirections and four values per product, the traversal is linear in the number\nof grid cells. It prints <code>70600674<\/code>.<\/p>"},{"title":"Euler 10 in Python","link":"https:\/\/rselbach.com\/euler-10-in-python\/","pubDate":"Fri, 06 Aug 2010 01:07:00 +0000","guid":"https:\/\/rselbach.com\/euler-10-in-python\/","description":"<p>I decided to take on Project Euler\u2019s problem #10. Its statement goes like this:<\/p>\n<blockquote>\n<p>The sum of the primes below 10 is <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>2<\/mn><mo>+<\/mo><mn>3<\/mn><mo>+<\/mo><mn>5<\/mn><mo>+<\/mo><mn>7<\/mn><mo>=<\/mo><mn>17<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">2 + 3 + 5 + 7 = 17<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<\/blockquote>\n<p>Find the sum of all the primes below two million.<\/p>\n<p>A Sieve of Eratosthenes finds every prime below the limit together instead of\nrunning a separate divisibility test for every number. A <code>bytearray<\/code> stores one\nbyte per candidate and supports crossing out a whole arithmetic progression at\nonce.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">from<\/span> math <span style=\"color:#f92672\">import<\/span> isqrt\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>limit <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">2_000_000<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>sieve <span style=\"color:#f92672\">=<\/span> bytearray(<span style=\"color:#e6db74\">b<\/span><span style=\"color:#e6db74\">&#34;<\/span><span style=\"color:#ae81ff\">\\x01<\/span><span style=\"color:#e6db74\">&#34;<\/span>) <span style=\"color:#f92672\">*<\/span> limit\n<\/span><\/span><span style=\"display:flex;\"><span>sieve[:<span style=\"color:#ae81ff\">2<\/span>] <span style=\"color:#f92672\">=<\/span> <span style=\"color:#e6db74\">b<\/span><span style=\"color:#e6db74\">&#34;<\/span><span style=\"color:#ae81ff\">\\x00\\x00<\/span><span style=\"color:#e6db74\">&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> prime <span style=\"color:#f92672\">in<\/span> range(<span style=\"color:#ae81ff\">2<\/span>, isqrt(limit <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">1<\/span>) <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#f92672\">not<\/span> sieve[prime]:\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">continue<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> start <span style=\"color:#f92672\">=<\/span> prime <span style=\"color:#f92672\">*<\/span> prime\n<\/span><\/span><span style=\"display:flex;\"><span> count <span style=\"color:#f92672\">=<\/span> (limit <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">1<\/span> <span style=\"color:#f92672\">-<\/span> start) <span style=\"color:#f92672\">\/\/<\/span> prime <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> sieve[start:limit:prime] <span style=\"color:#f92672\">=<\/span> <span style=\"color:#e6db74\">b<\/span><span style=\"color:#e6db74\">&#34;<\/span><span style=\"color:#ae81ff\">\\x00<\/span><span style=\"color:#e6db74\">&#34;<\/span> <span style=\"color:#f92672\">*<\/span> count\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(sum(number <span style=\"color:#66d9ef\">for<\/span> number, is_prime <span style=\"color:#f92672\">in<\/span> enumerate(sieve) <span style=\"color:#66d9ef\">if<\/span> is_prime))\n<\/span><\/span><\/code><\/pre><\/div><p>Starting at <code>prime * prime<\/code> is sufficient because smaller multiples already\nhave a smaller prime factor. The sieve runs in <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>O<\/mi><mo stretchy=\"false\">(<\/mo><mi>n<\/mi><mi>log<\/mi><mo>\u2061<\/mo><mi>log<\/mi><mo>\u2061<\/mo><mi>n<\/mi><mo stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">O(n\\log\\log n)<\/annotation><\/semantics><\/math><\/span> time, uses\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>O<\/mi><mo stretchy=\"false\">(<\/mo><mi>n<\/mi><mo stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">O(n)<\/annotation><\/semantics><\/math><\/span> space, and prints <code>142913828922<\/code>.<\/p>"},{"title":"Euler 9 in C","link":"https:\/\/rselbach.com\/euler-9-in-c\/","pubDate":"Wed, 04 Aug 2010 00:43:42 +0000","guid":"https:\/\/rselbach.com\/euler-9-in-c\/","description":"<p>The language can make a brute-force search faster, but eliminating unnecessary\nwork is better. Substituting <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>c<\/mi><mo>=<\/mo><mn>1000<\/mn><mo>\u2212<\/mo><mi>a<\/mi><mo>\u2212<\/mo><mi>b<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">c = 1000 - a - b<\/annotation><\/semantics><\/math><\/span> into the Pythagorean equation\nand solving for <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>b<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">b<\/annotation><\/semantics><\/math><\/span> leaves only one variable to search:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-c\" data-lang=\"c\"><span style=\"display:flex;\"><span><span style=\"color:#75715e\">#include<\/span> <span style=\"color:#75715e\">&lt;stdio.h&gt;<\/span><span style=\"color:#75715e\">\n<\/span><\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">int<\/span> <span style=\"color:#a6e22e\">main<\/span>(<span style=\"color:#66d9ef\">void<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>{\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">const<\/span> <span style=\"color:#66d9ef\">int<\/span> sum <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">1000<\/span>;\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">for<\/span> (<span style=\"color:#66d9ef\">int<\/span> a <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">1<\/span>; a <span style=\"color:#f92672\">&lt;<\/span> sum <span style=\"color:#f92672\">\/<\/span> <span style=\"color:#ae81ff\">3<\/span>; <span style=\"color:#f92672\">++<\/span>a) {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">const<\/span> <span style=\"color:#66d9ef\">int<\/span> numerator <span style=\"color:#f92672\">=<\/span> sum <span style=\"color:#f92672\">*<\/span> (sum <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">2<\/span> <span style=\"color:#f92672\">*<\/span> a);\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">const<\/span> <span style=\"color:#66d9ef\">int<\/span> denominator <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">2<\/span> <span style=\"color:#f92672\">*<\/span> (sum <span style=\"color:#f92672\">-<\/span> a);\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> (numerator <span style=\"color:#f92672\">%<\/span> denominator <span style=\"color:#f92672\">!=<\/span> <span style=\"color:#ae81ff\">0<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">continue<\/span>;\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">const<\/span> <span style=\"color:#66d9ef\">int<\/span> b <span style=\"color:#f92672\">=<\/span> numerator <span style=\"color:#f92672\">\/<\/span> denominator;\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">const<\/span> <span style=\"color:#66d9ef\">int<\/span> c <span style=\"color:#f92672\">=<\/span> sum <span style=\"color:#f92672\">-<\/span> a <span style=\"color:#f92672\">-<\/span> b;\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> (a <span style=\"color:#f92672\">&lt;<\/span> b <span style=\"color:#f92672\">&amp;&amp;<\/span> b <span style=\"color:#f92672\">&lt;<\/span> c) {\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">printf<\/span>(<span style=\"color:#e6db74\">&#34;%d %d %d = %d<\/span><span style=\"color:#ae81ff\">\\n<\/span><span style=\"color:#e6db74\">&#34;<\/span>, a, b, c, a <span style=\"color:#f92672\">*<\/span> b <span style=\"color:#f92672\">*<\/span> c);\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#ae81ff\">0<\/span>;\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span> }\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">fputs<\/span>(<span style=\"color:#e6db74\">&#34;no solution<\/span><span style=\"color:#ae81ff\">\\n<\/span><span style=\"color:#e6db74\">&#34;<\/span>, stderr);\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">return<\/span> <span style=\"color:#ae81ff\">1<\/span>;\n<\/span><\/span><span style=\"display:flex;\"><span>}\n<\/span><\/span><\/code><\/pre><\/div><p>The divisibility check ensures that <code>b<\/code> is an integer. This searches fewer\nthan <code>sum \/ 3<\/code> candidates in constant space and prints\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>200<\/mn><mo>\u00d7<\/mo><mn>375<\/mn><mo>\u00d7<\/mo><mn>425<\/mn><mo>=<\/mo><mn>31<\/mn><mtext>\u2009<\/mtext><mn>875<\/mn><mtext>\u2009<\/mtext><mn>000<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">200 \\times 375 \\times 425 = 31\\,875\\,000<\/annotation><\/semantics><\/math><\/span>.<\/p>"},{"title":"Euler 9","link":"https:\/\/rselbach.com\/euler-9\/","pubDate":"Tue, 03 Aug 2010 17:45:17 +0000","guid":"https:\/\/rselbach.com\/euler-9\/","description":"<p>So the other night I was a bit bored and decided to do something to pass the time. I first came across Project Euler a while ago, but had never gone further than problem #1. Boredom is a great motivator and I went through problems #2 thru #9 last night and I decided to post my solutions in search of better ones. Feel free to comment with your suggestions.<\/p>\n<p>Project Euler\u2019s Problem #9 statement is \u2014<\/p>\n<blockquote>\n<p>A Pythagorean triplet is a set of three natural numbers, <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>a<\/mi><mo>&lt;<\/mo><mi>b<\/mi><mo>&lt;<\/mo><mi>c<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">a &lt; b &lt; c<\/annotation><\/semantics><\/math><\/span>, for which:<\/p>\n<\/blockquote>\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><semantics><mrow><msup><mi>a<\/mi><mn>2<\/mn><\/msup><mo>+<\/mo><msup><mi>b<\/mi><mn>2<\/mn><\/msup><mo>=<\/mo><msup><mi>c<\/mi><mn>2<\/mn><\/msup><mi mathvariant=\"normal\">.<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">\na^2 + b^2 = c^2.\n<\/annotation><\/semantics><\/math><\/span><p>For example, <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msup><mn>3<\/mn><mn>2<\/mn><\/msup><mo>+<\/mo><msup><mn>4<\/mn><mn>2<\/mn><\/msup><mo>=<\/mo><mn>9<\/mn><mo>+<\/mo><mn>16<\/mn><mo>=<\/mo><mn>25<\/mn><mo>=<\/mo><msup><mn>5<\/mn><mn>2<\/mn><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">3^2 + 4^2 = 9 + 16 = 25 = 5^2<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<p>There exists exactly one Pythagorean triplet for which <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>a<\/mi><mo>+<\/mo><mi>b<\/mi><mo>+<\/mo><mi>c<\/mi><mo>=<\/mo><mn>1000<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">a + b + c = 1000<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<p>Find the product <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>a<\/mi><mi>b<\/mi><mi>c<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">abc<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<p>Using <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>c<\/mi><mo>=<\/mo><mn>1000<\/mn><mo>\u2212<\/mo><mi>a<\/mi><mo>\u2212<\/mo><mi>b<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">c = 1000 - a - b<\/annotation><\/semantics><\/math><\/span> removes one variable immediately. Substituting that\ninto <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msup><mi>a<\/mi><mn>2<\/mn><\/msup><mo>+<\/mo><msup><mi>b<\/mi><mn>2<\/mn><\/msup><mo>=<\/mo><msup><mi>c<\/mi><mn>2<\/mn><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">a^2 + b^2 = c^2<\/annotation><\/semantics><\/math><\/span> and solving for <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>b<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">b<\/annotation><\/semantics><\/math><\/span> gives<\/p>\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><semantics><mrow><mi>b<\/mi><mo>=<\/mo><mfrac><mrow><mn>1000<\/mn><mo stretchy=\"false\">(<\/mo><mn>1000<\/mn><mo>\u2212<\/mo><mn>2<\/mn><mi>a<\/mi><mo stretchy=\"false\">)<\/mo><\/mrow><mrow><mn>2<\/mn><mo stretchy=\"false\">(<\/mo><mn>1000<\/mn><mo>\u2212<\/mo><mi>a<\/mi><mo stretchy=\"false\">)<\/mo><\/mrow><\/mfrac><mi mathvariant=\"normal\">.<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">\nb = \\frac{1000(1000 - 2a)}{2(1000 - a)}.\n<\/annotation><\/semantics><\/math><\/span><p>That leaves only the possible values of <code>a<\/code> to search:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span>total <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">1000<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> a <span style=\"color:#f92672\">in<\/span> range(<span style=\"color:#ae81ff\">1<\/span>, total <span style=\"color:#f92672\">\/\/<\/span> <span style=\"color:#ae81ff\">3<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span> numerator <span style=\"color:#f92672\">=<\/span> total <span style=\"color:#f92672\">*<\/span> (total <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">2<\/span> <span style=\"color:#f92672\">*<\/span> a)\n<\/span><\/span><span style=\"display:flex;\"><span> denominator <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">2<\/span> <span style=\"color:#f92672\">*<\/span> (total <span style=\"color:#f92672\">-<\/span> a)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> numerator <span style=\"color:#f92672\">%<\/span> denominator:\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">continue<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> b <span style=\"color:#f92672\">=<\/span> numerator <span style=\"color:#f92672\">\/\/<\/span> denominator\n<\/span><\/span><span style=\"display:flex;\"><span> c <span style=\"color:#f92672\">=<\/span> total <span style=\"color:#f92672\">-<\/span> a <span style=\"color:#f92672\">-<\/span> b\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> a <span style=\"color:#f92672\">&lt;<\/span> b <span style=\"color:#f92672\">&lt;<\/span> c:\n<\/span><\/span><span style=\"display:flex;\"><span> print(a <span style=\"color:#f92672\">*<\/span> b <span style=\"color:#f92672\">*<\/span> c)\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">break<\/span>\n<\/span><\/span><\/code><\/pre><\/div><p>The divisibility check ensures that <code>b<\/code> is a natural number. The triplet is\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mo stretchy=\"false\">(<\/mo><mn>200<\/mn><mo separator=\"true\">,<\/mo><mn>375<\/mn><mo separator=\"true\">,<\/mo><mn>425<\/mn><mo stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">(200, 375, 425)<\/annotation><\/semantics><\/math><\/span>, so the program prints <code>31875000<\/code> in linear time and constant\nspace.<\/p>"},{"title":"Euler 6","link":"https:\/\/rselbach.com\/euler-6\/","pubDate":"Tue, 03 Aug 2010 17:35:28 +0000","guid":"https:\/\/rselbach.com\/euler-6\/","description":"<p>So the other night I was a bit bored and decided to do something to pass the time. I first came across <a href=\"http:\/\/projecteuler.net\">Project Euler<\/a> a while ago, but had never gone further than problem #1. Boredom is a great motivator and I went through problems #2 thru #9 last night and I decided to post my solutions in search of better ones. Feel free to comment with your suggestions.<\/p>\n<p>Project Euler\u2019s Problem #6 statement is \u2014<\/p>\n<blockquote>\n<p>The sum of the squares of the first ten natural numbers is:<\/p>\n<\/blockquote>\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><semantics><mrow><msup><mn>1<\/mn><mn>2<\/mn><\/msup><mo>+<\/mo><msup><mn>2<\/mn><mn>2<\/mn><\/msup><mo>+<\/mo><mo>\u22ef<\/mo><mo>+<\/mo><msup><mn>10<\/mn><mn>2<\/mn><\/msup><mo>=<\/mo><mn>385.<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\n1^2 + 2^2 + \\cdots + 10^2 = 385.\n<\/annotation><\/semantics><\/math><\/span><p>The square of the sum of the first ten natural numbers is:<\/p>\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(<\/mo><mn>1<\/mn><mo>+<\/mo><mn>2<\/mn><mo>+<\/mo><mo>\u22ef<\/mo><mo>+<\/mo><mn>10<\/mn><msup><mo stretchy=\"false\">)<\/mo><mn>2<\/mn><\/msup><mo>=<\/mo><msup><mn>55<\/mn><mn>2<\/mn><\/msup><mo>=<\/mo><mn>3025.<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\n(1 + 2 + \\cdots + 10)^2 = 55^2 = 3025.\n<\/annotation><\/semantics><\/math><\/span><p>Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>3025<\/mn><mo>\u2212<\/mo><mn>385<\/mn><mo>=<\/mo><mn>2640<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">3025 - 385 = 2640<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<p>Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.<\/p>\n<p>The two sums have closed forms, so there is no need to iterate at all:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span>n <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">100<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>total <span style=\"color:#f92672\">=<\/span> n <span style=\"color:#f92672\">*<\/span> (n <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>) <span style=\"color:#f92672\">\/\/<\/span> <span style=\"color:#ae81ff\">2<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>sum_of_squares <span style=\"color:#f92672\">=<\/span> n <span style=\"color:#f92672\">*<\/span> (n <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>) <span style=\"color:#f92672\">*<\/span> (<span style=\"color:#ae81ff\">2<\/span> <span style=\"color:#f92672\">*<\/span> n <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>) <span style=\"color:#f92672\">\/\/<\/span> <span style=\"color:#ae81ff\">6<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(total <span style=\"color:#f92672\">*<\/span> total <span style=\"color:#f92672\">-<\/span> sum_of_squares)\n<\/span><\/span><\/code><\/pre><\/div><p>This performs a constant number of integer operations and prints <code>25164150<\/code>.<\/p>"},{"title":"Euler 5","link":"https:\/\/rselbach.com\/euler-5\/","pubDate":"Tue, 03 Aug 2010 17:30:36 +0000","guid":"https:\/\/rselbach.com\/euler-5\/","description":"<p>So the other night I was a bit bored and decided to do something to pass the time. I first came across <a href=\"http:\/\/projecteuler.net\">Project Euler<\/a> a while ago, but had never gone further than problem #1. Boredom is a great motivator and I went through problems #2 thru #9 last night and I decided to post my solutions in search of better ones. Feel free to comment with your suggestions.<\/p>\n<p>Project Euler\u2019s Problem #5 statement is \u2014<\/p>\n<blockquote>\n<p>2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.<\/p>\n<\/blockquote>\n<p>What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?<\/p>\n<p>The number must be the least common multiple of every integer from 1 through\n20. Python\u2019s integer <code>lcm<\/code> implements exactly that operation:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">from<\/span> math <span style=\"color:#f92672\">import<\/span> lcm\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>answer <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">1<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> number <span style=\"color:#f92672\">in<\/span> range(<span style=\"color:#ae81ff\">2<\/span>, <span style=\"color:#ae81ff\">21<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span> answer <span style=\"color:#f92672\">=<\/span> lcm(answer, number)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(answer)\n<\/span><\/span><\/code><\/pre><\/div><p>This prints <code>232792560<\/code>. Folding the LCM keeps only the prime powers required\nby the numbers seen so far, with no brute-force search.<\/p>"},{"title":"Euler 4","link":"https:\/\/rselbach.com\/euler-4\/","pubDate":"Tue, 03 Aug 2010 17:26:51 +0000","guid":"https:\/\/rselbach.com\/euler-4\/","description":"<p>So the other night I was a bit bored and decided to do something to pass the time. I first came across <a href=\"http:\/\/projecteuler.net\">Project Euler<\/a> a while ago, but had never gone further than problem #1. Boredom is a great motivator and I went through problems #2 thru #9 last night and I decided to post my solutions in search of better ones. Feel free to comment with your suggestions.<\/p>\n<p>Project Euler\u2019s Problem #4 statement is \u2014<\/p>\n<blockquote>\n<p>A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>9009<\/mn><mo>=<\/mo><mn>91<\/mn><mo>\u00d7<\/mo><mn>99<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">9009 = 91 \\times 99<\/annotation><\/semantics><\/math><\/span>.<\/p>\n<\/blockquote>\n<p>Find the largest palindrome made from the product of two 3-digit numbers.<\/p>\n<p>Searching downward lets us stop as soon as the remaining products cannot beat\nthe best palindrome already found. Starting the inner loop at <code>a<\/code> also avoids\nchecking both <code>a * b<\/code> and <code>b * a<\/code>.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span>largest <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">0<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> a <span style=\"color:#f92672\">in<\/span> range(<span style=\"color:#ae81ff\">999<\/span>, <span style=\"color:#ae81ff\">99<\/span>, <span style=\"color:#f92672\">-<\/span><span style=\"color:#ae81ff\">1<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> a <span style=\"color:#f92672\">*<\/span> a <span style=\"color:#f92672\">&lt;=<\/span> largest:\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">break<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">for<\/span> b <span style=\"color:#f92672\">in<\/span> range(a, <span style=\"color:#ae81ff\">99<\/span>, <span style=\"color:#f92672\">-<\/span><span style=\"color:#ae81ff\">1<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span> product <span style=\"color:#f92672\">=<\/span> a <span style=\"color:#f92672\">*<\/span> b\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> product <span style=\"color:#f92672\">&lt;=<\/span> largest:\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">break<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> str(product) <span style=\"color:#f92672\">==<\/span> str(product)[::<span style=\"color:#f92672\">-<\/span><span style=\"color:#ae81ff\">1<\/span>]:\n<\/span><\/span><span style=\"display:flex;\"><span> largest <span style=\"color:#f92672\">=<\/span> product\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(largest)\n<\/span><\/span><\/code><\/pre><\/div><p>This prints <code>906609<\/code> (<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mn>993<\/mn><mo>\u00d7<\/mo><mn>913<\/mn><mo>=<\/mo><mn>906<\/mn><mtext>\u2009<\/mtext><mn>609<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">993 \\times 913 = 906\\,609<\/annotation><\/semantics><\/math><\/span>).<\/p>"},{"title":"Euler 3","link":"https:\/\/rselbach.com\/euler-3\/","pubDate":"Tue, 03 Aug 2010 17:24:39 +0000","guid":"https:\/\/rselbach.com\/euler-3\/","description":"<p>So the other night I was a bit bored and decided to do something to pass the time. I first came across <a href=\"http:\/\/projecteuler.net\">Project Euler<\/a> a while ago, but had never gone further than problem #1. Boredom is a great motivator and I went through problems #2 thru #9 last night and I decided to post my solutions in search of better ones. Feel free to comment with your suggestions.<\/p>\n<p>Project Euler\u2019s Problem #3 statement is \u2014<\/p>\n<blockquote>\n<p>The prime factors of 13195 are 5, 7, 13 and 29.<\/p>\n<\/blockquote>\n<p>What is the largest prime factor of the number 600851475143 ?<\/p>\n<p>There is no need to build a list of every divisor and test each one for\nprimality. Instead, divide each factor out as soon as it is found. This makes\nthe remaining number smaller throughout the search.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span>number <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">600_851_475_143<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>largest_factor <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">1<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">while<\/span> number <span style=\"color:#f92672\">%<\/span> <span style=\"color:#ae81ff\">2<\/span> <span style=\"color:#f92672\">==<\/span> <span style=\"color:#ae81ff\">0<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> largest_factor <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">2<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> number <span style=\"color:#f92672\">\/\/=<\/span> <span style=\"color:#ae81ff\">2<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>factor <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">3<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">while<\/span> factor <span style=\"color:#f92672\">*<\/span> factor <span style=\"color:#f92672\">&lt;=<\/span> number:\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">while<\/span> number <span style=\"color:#f92672\">%<\/span> factor <span style=\"color:#f92672\">==<\/span> <span style=\"color:#ae81ff\">0<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> largest_factor <span style=\"color:#f92672\">=<\/span> factor\n<\/span><\/span><span style=\"display:flex;\"><span> number <span style=\"color:#f92672\">\/\/=<\/span> factor\n<\/span><\/span><span style=\"display:flex;\"><span> factor <span style=\"color:#f92672\">+=<\/span> <span style=\"color:#ae81ff\">2<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">if<\/span> number <span style=\"color:#f92672\">&gt;<\/span> <span style=\"color:#ae81ff\">1<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> largest_factor <span style=\"color:#f92672\">=<\/span> number\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(largest_factor)\n<\/span><\/span><\/code><\/pre><\/div><p>After removing every possible factor up to the square root of the remaining\nnumber, anything left must itself be prime. The answer is <code>6857<\/code>, found in\nconstant space and at most square-root time.<\/p>"},{"title":"Euler 8","link":"https:\/\/rselbach.com\/euler-8\/","pubDate":"Tue, 03 Aug 2010 12:50:50 +0000","guid":"https:\/\/rselbach.com\/euler-8\/","description":"<p>So the other night I was a bit bored and decided to do something to pass the time. I first came across <a href=\"http:\/\/projecteuler.net\">Project Euler<\/a> a while ago, but had never gone further than problem #1. Boredom is a great motivator and I went through problems #2 thru #9 last night and I decided to post my solutions in search of better ones. Feel free to comment with your suggestions.<\/p>\n<p>Project Euler\u2019s Problem #8 statement is \u2014<\/p>\n<blockquote>\n<p>Find the greatest product of thirteen consecutive digits in the 1000-digit number.<\/p>\n<\/blockquote>\n<p>73167176531330624919225119674426574742355349194934<br>\n96983520312774506326239578318016984801869478851843<br>\n85861560789112949495459501737958331952853208805511<br>\n12540698747158523863050715693290963295227443043557<br>\n66896648950445244523161731856403098711121722383113<br>\n62229893423380308135336276614282806444486645238749<br>\n30358907296290491560440772390713810515859307960866<br>\n70172427121883998797908792274921901699720888093776<br>\n65727333001053367881220235421809751254540594752243<br>\n52584907711670556013604839586446706324415722155397<br>\n53697817977846174064955149290862569321978468622482<br>\n83972241375657056057490261407972968652414535100474<br>\n82166370484403199890008895243450658541227588666881<br>\n16427171479924442928230863465674813919123162824586<br>\n17866458359124566529476545682848912883142607690042<br>\n24219022671055626321111109370544217506941658960408<br>\n07198403850962455444362981230987879927244284909188<br>\n84580156166097919133875499200524063689912560717606<br>\n05886116467109405077541002256983155200055935729725<br>\n71636269561882670428252483600823257530420752963450<\/p>\n<p>A sliding window avoids multiplying the same twelve digits again for every\nposition. Zeroes need a little care because they cannot be divided back out of\nthe running product, so the window tracks how many it contains.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span>number <span style=\"color:#f92672\">=<\/span> <span style=\"color:#e6db74\">&#34;&#34;&#34;<\/span><span style=\"color:#ae81ff\">\\\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">73167176531330624919225119674426574742355349194934\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">96983520312774506326239578318016984801869478851843\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">85861560789112949495459501737958331952853208805511\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">12540698747158523863050715693290963295227443043557\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">66896648950445244523161731856403098711121722383113\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">62229893423380308135336276614282806444486645238749\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">30358907296290491560440772390713810515859307960866\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">70172427121883998797908792274921901699720888093776\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">65727333001053367881220235421809751254540594752243\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">52584907711670556013604839586446706324415722155397\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">53697817977846174064955149290862569321978468622482\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">83972241375657056057490261407972968652414535100474\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">82166370484403199890008895243450658541227588666881\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">16427171479924442928230863465674813919123162824586\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">17866458359124566529476545682848912883142607690042\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">24219022671055626321111109370544217506941658960408\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">07198403850962455444362981230987879927244284909188\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">84580156166097919133875499200524063689912560717606\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">05886116467109405077541002256983155200055935729725\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">71636269561882670428252483600823257530420752963450\n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">&#34;&#34;&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>digits <span style=\"color:#f92672\">=<\/span> [int(digit) <span style=\"color:#66d9ef\">for<\/span> digit <span style=\"color:#f92672\">in<\/span> <span style=\"color:#e6db74\">&#34;&#34;<\/span><span style=\"color:#f92672\">.<\/span>join(number<span style=\"color:#f92672\">.<\/span>split())]\n<\/span><\/span><span style=\"display:flex;\"><span>window_size <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">13<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>product <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">1<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>zeroes <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">0<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>largest <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">0<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> index, digit <span style=\"color:#f92672\">in<\/span> enumerate(digits):\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> digit <span style=\"color:#f92672\">==<\/span> <span style=\"color:#ae81ff\">0<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> zeroes <span style=\"color:#f92672\">+=<\/span> <span style=\"color:#ae81ff\">1<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">else<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> product <span style=\"color:#f92672\">*=<\/span> digit\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> index <span style=\"color:#f92672\">&gt;=<\/span> window_size:\n<\/span><\/span><span style=\"display:flex;\"><span> outgoing <span style=\"color:#f92672\">=<\/span> digits[index <span style=\"color:#f92672\">-<\/span> window_size]\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> outgoing <span style=\"color:#f92672\">==<\/span> <span style=\"color:#ae81ff\">0<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> zeroes <span style=\"color:#f92672\">-=<\/span> <span style=\"color:#ae81ff\">1<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">else<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> product <span style=\"color:#f92672\">\/\/=<\/span> outgoing\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> index <span style=\"color:#f92672\">&gt;=<\/span> window_size <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">1<\/span> <span style=\"color:#f92672\">and<\/span> zeroes <span style=\"color:#f92672\">==<\/span> <span style=\"color:#ae81ff\">0<\/span>:\n<\/span><\/span><span style=\"display:flex;\"><span> largest <span style=\"color:#f92672\">=<\/span> max(largest, product)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(largest)\n<\/span><\/span><\/code><\/pre><\/div><p>Each digit enters and leaves the product once, making this linear-time. It\nprints <code>23514624000<\/code>.<\/p>"},{"title":"Euler 7","link":"https:\/\/rselbach.com\/euler-7\/","pubDate":"Mon, 02 Aug 2010 19:27:58 +0000","guid":"https:\/\/rselbach.com\/euler-7\/","description":"<p>So the other night I was a bit bored and decided to do something to pass the time. I first came across <a href=\"http:\/\/projecteuler.net\">Project Euler<\/a> a while ago, but had never gone further than problem #1. Boredom is a great motivator and I went through problems #2 thru #9 last night and I decided to post my solutions in search of better ones. Feel free to comment with your suggestions.<\/p>\n<p>Project Euler\u2019s Problem #7 statement is \u2014<\/p>\n<blockquote>\n<p>By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.<\/p>\n<\/blockquote>\n<p>What is the 10001st prime number?<\/p>\n<p>A sieve finds all the primes up to a limit in one pass. For the nth prime,\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>n<\/mi><mo stretchy=\"false\">(<\/mo><mi>log<\/mi><mo>\u2061<\/mo><mi>n<\/mi><mo>+<\/mo><mi>log<\/mi><mo>\u2061<\/mo><mi>log<\/mi><mo>\u2061<\/mo><mi>n<\/mi><mo stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">n(\\log n + \\log\\log n)<\/annotation><\/semantics><\/math><\/span> is an upper bound when <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>n<\/mi><mo>\u2265<\/mo><mn>6<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">n \\ge 6<\/annotation><\/semantics><\/math><\/span>, so the sieve can be\nsized without guessing or repeatedly growing it.<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-python\" data-lang=\"python\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">from<\/span> math <span style=\"color:#f92672\">import<\/span> ceil, isqrt, log\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>n <span style=\"color:#f92672\">=<\/span> <span style=\"color:#ae81ff\">10_001<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>limit <span style=\"color:#f92672\">=<\/span> ceil(n <span style=\"color:#f92672\">*<\/span> (log(n) <span style=\"color:#f92672\">+<\/span> log(log(n))))\n<\/span><\/span><span style=\"display:flex;\"><span>sieve <span style=\"color:#f92672\">=<\/span> bytearray(<span style=\"color:#e6db74\">b<\/span><span style=\"color:#e6db74\">&#34;<\/span><span style=\"color:#ae81ff\">\\x01<\/span><span style=\"color:#e6db74\">&#34;<\/span>) <span style=\"color:#f92672\">*<\/span> (limit <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>)\n<\/span><\/span><span style=\"display:flex;\"><span>sieve[:<span style=\"color:#ae81ff\">2<\/span>] <span style=\"color:#f92672\">=<\/span> <span style=\"color:#e6db74\">b<\/span><span style=\"color:#e6db74\">&#34;<\/span><span style=\"color:#ae81ff\">\\x00\\x00<\/span><span style=\"color:#e6db74\">&#34;<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> prime <span style=\"color:#f92672\">in<\/span> range(<span style=\"color:#ae81ff\">2<\/span>, isqrt(limit) <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">if<\/span> <span style=\"color:#f92672\">not<\/span> sieve[prime]:\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">continue<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span> start <span style=\"color:#f92672\">=<\/span> prime <span style=\"color:#f92672\">*<\/span> prime\n<\/span><\/span><span style=\"display:flex;\"><span> count <span style=\"color:#f92672\">=<\/span> (limit <span style=\"color:#f92672\">-<\/span> start) <span style=\"color:#f92672\">\/\/<\/span> prime <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span>\n<\/span><\/span><span style=\"display:flex;\"><span> sieve[start : limit <span style=\"color:#f92672\">+<\/span> <span style=\"color:#ae81ff\">1<\/span> : prime] <span style=\"color:#f92672\">=<\/span> <span style=\"color:#e6db74\">b<\/span><span style=\"color:#e6db74\">&#34;<\/span><span style=\"color:#ae81ff\">\\x00<\/span><span style=\"color:#e6db74\">&#34;<\/span> <span style=\"color:#f92672\">*<\/span> count\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>primes <span style=\"color:#f92672\">=<\/span> (number <span style=\"color:#66d9ef\">for<\/span> number, is_prime <span style=\"color:#f92672\">in<\/span> enumerate(sieve) <span style=\"color:#66d9ef\">if<\/span> is_prime)\n<\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">for<\/span> _ <span style=\"color:#f92672\">in<\/span> range(n <span style=\"color:#f92672\">-<\/span> <span style=\"color:#ae81ff\">1<\/span>):\n<\/span><\/span><span style=\"display:flex;\"><span> next(primes)\n<\/span><\/span><span style=\"display:flex;\"><span>\n<\/span><\/span><span style=\"display:flex;\"><span>print(next(primes))\n<\/span><\/span><\/code><\/pre><\/div><p>Multiples below <code>prime * prime<\/code> were already crossed out by smaller primes.\nThe answer is <code>104743<\/code>; for sieve limit <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>L<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">L<\/annotation><\/semantics><\/math><\/span>, it runs in\n<span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>O<\/mi><mo stretchy=\"false\">(<\/mo><mi>L<\/mi><mi>log<\/mi><mo>\u2061<\/mo><mi>log<\/mi><mo>\u2061<\/mo><mi>L<\/mi><mo stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">O(L\\log\\log L)<\/annotation><\/semantics><\/math><\/span> time and <span class=\"katex\"><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>O<\/mi><mo stretchy=\"false\">(<\/mo><mi>L<\/mi><mo stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">O(L)<\/annotation><\/semantics><\/math><\/span> space.<\/p>"},{"title":"Why can\u2019t people buy newer cars in Argentina?","link":"https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/","pubDate":"Fri, 21 May 2010 14:57:41 +0000","guid":"https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/","description":"<p>This is part of <a href=\"https:\/\/rselbach.com\/?cat_ID=239\">a series of posts<\/a> about Argentina and the City of Cordoba. These are little facts I wish I knew about before I came here as an expat.<\/p>\n<p>One of the first things I noticed when I arrived in Cordoba, Argentina, was the amount of old cars going around. And I\u2019m not talking about 10-year-old cars, I\u2019m talking about 30 years or so!<\/p>\n<p>You can really find some rarities such as the Citro\u00ebn 3cv happily racing around town all the time. As a consequence of all that, you can also find a disproportionate amount of cars stalled on the streets, people trying to do something under the hood. It\u2019s really amazing how many broken down cars you\u2019ll see every day.<\/p>\n<p><a href=\".\/IMG_01041.jpg\"><figure class=\"post-figure\"><picture>\n <source type=\"image\/webp\" srcset=\"https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/IMG_0104_thumb1_hu_414a77ac9864075e.webp 320w, https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/IMG_0104_thumb1_hu_bfd6436e9631fe31.webp 480w, https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/IMG_0104_thumb1_hu_20163477b9c28272.webp 640w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <img src=\"https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/IMG_0104_thumb1.jpg\"\n alt=\"Citro\u00ebn 3cv\"\n loading=\"lazy\"\n decoding=\"async\" width=\"644\" height=\"484\" srcset=\"https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/IMG_0104_thumb1_hu_941e18ced89bd45.jpg 320w, https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/IMG_0104_thumb1_hu_6d4ee77e08915b3f.jpg 480w, https:\/\/rselbach.com\/why-cant-people-buy-newer-cars-in-argentina\/IMG_0104_thumb1_hu_867c852382ad7aed.jpg 640w\" sizes=\"(max-width: 1100px) 100vw, 1100px\">\n <\/picture>\n<\/figure>\n<\/a><\/p>\n<p>I used to wonder why that was. Now I understand.<\/p>\n<p>There is no credit in Argentina. Well, technically there is, but it\u2019s so expensive that it\u2019s as if it doesn\u2019t exist. That\u2019s why people normally need to buy stuff with cash upfront. Cars, of course, happen to be expensive and most people can\u2019t save enough to buy newer cars like that. The same is true for several other goods, but cars happen to be the most visible symptom.<\/p>\n<p>From time to time, coincidently around election time, the federal government creates some credit program. These programs are temporary and limited in the number of people who can apply.<\/p>\n<p>And then there\u2019s a second problem\u2014informality. In order to avoid taxes and benefits, most companies hire people either with no documentation or with phoney pay information, e.g. if someone\u2019s salary is, say, $1,000, the companies would register the employee as being paid $250 instead, thus being able to pay less taxes.<\/p>\n<p>And thus even with those government credit programs, most people can\u2019t even qualify as they can\u2019t show enough income.<\/p>"},{"title":"How can I get rid of (not so) old books?","link":"https:\/\/rselbach.com\/how-can-i-get-rid-of-not-so-old-books\/","pubDate":"Sat, 27 Mar 2010 00:02:37 +0000","guid":"https:\/\/rselbach.com\/how-can-i-get-rid-of-not-so-old-books\/","description":"<p>I\u2019m not a big believer in keeping books forever, even though I do keep some. Most books, however, I just want to read and pass along.<\/p>\n<p>It just so happens that I have a ton of books that I want to get rid of. I could throw them away, but it somehow feels wrong. Also, I could donate them to some school, but considering where I live now, I assume this too will bring me one hell of a bureaucratic nightmare. Also, most of the books are either in English or Portuguese, so schools would probably not use them anyway.<\/p>\n<p>With very few exceptions, all the books are either mathematics, economics, programming, or scifi. I thought I\u2019d simply take the books to the office and give them away to anyone who\u2019d like to have them.<\/p>\n<p>But then my wife gave me an idea. Instead of taking the books and giving them outright, I started sending random emails to a mailing list with geeky questions, often related to the book topic. Whoever answers correctly first, gets the book.<\/p>\n<p>This worked amazingly well.<\/p>\n<ol>\n<li>\n<p>It created a fun environment for all involved. People actually want to get the answers right. Others learn by, well, learning the winning answer.<\/p><\/p>\n<\/li>\n<li>\n<p>For books that normally no one would care about, the fact that you have to win to get it suddenly adds value. It\u2019s no longer a book no one wants, it now is an award.<\/p>\n<\/li>\n<li>\n<p>All of a sudden everybody loves me \ud83d\ude09<\/p>\n<\/li>\n<\/ol>\n<p>Had I just announced I had a bunch of books, people would get by, pick a few they cared about and that would have been it. No fun. So every now and then I take a few books from home and then give them away to quiz winners.<\/p>\n<p>It\u2019s actually lots of fun.<\/p>"},{"title":"Why do things take so long in Argentina?","link":"https:\/\/rselbach.com\/why-do-things-take-so-long-in-argentina\/","pubDate":"Fri, 26 Mar 2010 14:12:20 +0000","guid":"https:\/\/rselbach.com\/why-do-things-take-so-long-in-argentina\/","description":"<p>Coincidences have a way of catching one\u2019s attention, haven\u2019t they? Yesterday I was riding the bus home with a colleague from work. I was telling him how my life here wasn\u2019t perfect because I couldn\u2019t buy a car. It turns out that I would need to hold a national ID card (called DNI) to purchase a car. Actually, one needs to obtain the DNI to do pretty much anything like opening a bank account. Interestingly enough, you need the DNI for small, simple tasks like ordering cable TV, phone lines, Internet access, etc, but one can easily buy a house \u2013 or many houses \u2013 without the DNI.<\/p>\n<p>The process of obtaining the DNI is simple. If you\u2019re a citizen, your parents will have used your birth certificate to get your first DNI, which is mandatory from a very early age. Over the years, you are required to update your DNI when you reach certain ages (8, 16, 25, if I\u2019m not mistaken) and everytime you change address. All you need is the original DNI and some address verification and you\u2019re done. If you\u2019re an expat like myself, you need your passport, your resident visa, and some address verification. Again, very simple. You go, apply and wait for the document to be ready. And that\u2019s where the problem resides\u2026 in parts of the country, the DNI takes <em>years<\/em> to be ready. Even in Buenos Aires, it can take more than one year for your DNI to be ready for pick-up.<\/p>\n<p>Now how could such a simple and yet much needed document take so long to be manufactured?<\/p>\n<p>So there I was, talking to this colleague about all of this. He told me that when he had to change his at 16, it took two years. And he\u2019s a national. He told me it\u2019s usually because government workers don\u2019t have the incentive to work harder. He\u2019s probably right, as this is the case everywhere else in the world. Still, this might explain why a simple document can take 2-3 weeks to be created, but not years. When I stepped out of my ride, I bumped into a girl who lives in our building. She told me she was frustrated because she had lost her DNI a couple of years back and the new one wasn\u2019t ready yet. She had just went to the Identification Office to check. Coincidences\u2026 I then told her about my story and she told me so other tales of horror and I shared some of my own, like when I needed a document notarized and it took a month to do it. And that was it.<\/p>\n<p>Fast forward a day.<\/p>\n<p>My wife is currently having classes and she asked me to get her a textbook she needs. I went to this bookstore on my way to work. I strolled into the store and worked my way to the textbooks section and quickly found the one my wife needed. I picked it up and headed to the checkout, content that I wouldn\u2019t have to hunt for the book in other stores. I held the book and the cash in my hand. \u201cI\u2019d like to take this\u201d I told the lady at checkout, who in turn looks around and goes \u201cDid you pick a number?\u201d<\/p>\n<p><em>What. Fucking. Number.<\/em><\/p>\n<p>\u201cWhat number?\u201d I asked, confused. She then pointed me to this little thingamajig near the entrance. \u201cI\u2019m sorry, I don\u2019t get it\u2026\u201d And then she half-mockingly explained to me that I had to pick the number and wait my turn for a salesperson to help me. \u201cBut I don\u2019t need any help. I have the book and the money right here!\u201d<\/p>\n<p>No use. I had to pick a number and wait for one of the two saleswomen to call it. So there I was, holding the book I wanted, with the cash to pay for it, standing by the checkout \u2013 where the lady was doing nothing by the way \u2013 and waiting for someone to \u201chelp me.\u201d In any half-civilized place our business would have been over by now. The store would have made money and I would be on my way to work. Simple.<\/p>\n<p>\u201c<em>Twenty!!!!!!!\u201d<\/em> shouted a lady. It was my number. So I went to her \u2013 looking pissed, I\u2019m sure. I told her I\u2019d like to please take this textbook. \u201cOh, certainly!\u201d So she goes to a computer terminal and asks if I\u2019m paying with a credit card. I wave the cash and say \u201c<em>efectivo\u201d<\/em> to make sure she gets it. Then she asks what the book is for. <em>For reading, duh!<\/em> I tell her that it\u2019s for a course, then she types something and asks which school. \u201cLady, sorry but all I want to to take this textbook with me. I have the cash right here. I\u2019ve had both the book and the cash in my hands for like 15 minutes already. All that\u2019s missing is for that lady at checkout to get the money so I can get out of here.\u201d And yes, I was pissed and I didn\u2019t really sounded friendly and half the store was staring at me. She said apologetically, \u201cI\u2019m sorry, but I need to register who purchased the book and where it will be used.\u201d<\/p>\n<p><em>Why?!?!<\/em><\/p>\n<p>\u201cLady, seriously, I don\u2019t want to give any more information. I want to buy this book and that\u2019s it. You either take my money or not. Your choice. Just let me know so I can get out of here.\u201d<\/p>\n<p>The whole store was following our exchange. Everyone surely thinking that I was the mean foreigner who\u2019s going to explore them and steal their water (it\u2019s a local thing.) She told me to go to the checkout I had been to 15 minutes earlier. The lady took my money and asked if I wanted a receipt. D-U-H!<\/p>\n<p>So I realized it has to be a cultural thing. Bureaucracy is so entrenched in their lives that they don\u2019t even realize it anymore. They just think it\u2019s the best way of doing things. The problem I had to get a document notarized is a perfect example. I went to a notary, who then notarized my document. It took two days, which is already ridiculous, but still\u2026 the problem is that after he notarizes it, he has to send the document to the Notary Guild Office so that they in turn can verify that the notarizing notary was in fact a certified notary and that the notarization was correctly notarized. I am not even kidding.<\/p>\n<p>Argentina has a lot of great things. Things that I actually love. But in terms of bureaucracy, it\u2019s really, really a mess. And the very people have been \u201cinfected\u201d by it so that they are bureaucratic at heart. It\u2019s actually really sad.<\/p>"},{"title":"Suquia Creek","link":"https:\/\/rselbach.com\/suquia-creek\/","pubDate":"Wed, 27 Jan 2010 17:49:56 +0000","guid":"https:\/\/rselbach.com\/suquia-creek\/","description":"<p><a href=\".\/image1.jpg\"><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/suquia-creek\/image_thumb2.jpg\"\n alt=\"image\"\n loading=\"lazy\"\n decoding=\"async\" width=\"158\" height=\"240\">\n<\/figure>\n<\/a>Things are starting to get busier on my new project. It is, alas, still listed as Restricted Secret, which means I cannot really talk about its details. Nor could I even reveal its codename, even though codenames reveal nothing about what a project really is. For the sake of making referring to it slightly less annoying for me, I\u2019ll refer to it using a made-up codename in the best traditions of the company\u2019s history of naming things for lakes, peaks, creeks, and towns. So the secret project shall henceforth be known as <strong>Suquia Creek<\/strong> (being the creek across from my house.)<\/p>\n<p>Since I cannot give any details on Suquia Creek, what could I possibly talk about? A lot, it turns out. I can talk about things I\u2019m learning while working on the project.<\/p>\n<p><em>Ah boy, am I learning!<\/em><\/p>\n<p>It turns out Suquia Creek is going to be the longest, most complex project I\u2019ve worked on. Until SC came along, the longest project of my life had been Lava Peak, which ran for about two years. But that included post-launch activities. We managed to go from ideation to shipping in just under a quarter (I even won an award because of that back in 2007.) Suquia Creek, on the other hand, is scheduled to ship in 2014! That\u2019s nearly half a decade of work.<\/p>\n<p>As well, for earlier projects I only had to worry about software. Suquia Creek, however, is also hardware. And on the software side, off the top of my head, it involves \u2014<\/p>\n<ul>\n<li>\n<p>Processor \u00b5code<\/p><\/p>\n<\/li>\n<li>\n<p>Chipset code<\/p>\n<\/li>\n<li>\n<p>BIOS extensions<\/p>\n<\/li>\n<li>\n<p>Firmware code<\/p>\n<\/li>\n<li>\n<p>Drivers<\/p>\n<\/li>\n<li>\n<p>An SDK<\/p>\n<\/li>\n<li>\n<p>User-level apps<\/p>\n<\/li>\n<li>\n<p>And a few other things I can\u2019t say without revealing more than I should.<\/p>\n<\/li>\n<\/ul>\n<p>Bottom line: it\u2019s huge as far as I\u2019m concerned! And we should support multiple versions of Windows and one distro release of Linux. It also involves several cross-functional, geographically-dispersed teams based mainly in Argentina and the US, but also with some smaller efforts coming out of China, India, and Israel. That amounts to six different timezones, for a current maximum time difference of 17 hours.<\/p>\n<p>And then we come back to schedule. I have no idea what I\u2019ll be doing at home during this weekend, but I have to have a rough idea of what we\u2019ll be delivering on, say, week 41 of 2013! <em>That assumes the world will not end in 2012, of course<\/em>.<\/p>\n<p>This week we had our first engineering meeting to plan on a tentative schedule. Late next month I\u2019ll be flying around between Silicon Valley and Silicon Forest to work out the (semi-)hard schedule. By then, we\u2019ll actually have one internal alpha release in place already. After that, we\u2019ll have another alpha before our first \u201crelease\u201d, an internal proof of concept, which will then be used by customer as part of a (quasi-confidential) pilot. The customer? One of the world\u2019s largest\u2026 well, can\u2019t say what is their industry yet. It\u2019s huge though.<\/p>\n<p>After that pilot I expect to be able to open up a bit on what the project actually does. In the meantime, I\u2019m going to be sharing my learning experience.<\/p>\n<p>It\u2019s going to be an exciting half-decade for me :\u2013)<\/p>"},{"title":"A Decade as a Linux Pro","link":"https:\/\/rselbach.com\/a-decade-as-a-linux-pro\/","pubDate":"Fri, 18 Dec 2009 18:44:49 +0000","guid":"https:\/\/rselbach.com\/a-decade-as-a-linux-pro\/","description":"<p>After <a href=\"http:\/\/robteix.com\/english\/2009\/12\/16\/the-grumpiest-post-ive-ever-written\/\">I recently accepted my old age<\/a>, I was talking to some friends who, to their own surprise, found they were old too. We were talking about when each of us started <em>working<\/em> with Linux and a friend noticed <a href=\"http:\/\/ruda.livejournal.com\/138637.html\">he had been working with Linux for 10 years<\/a>. That\u2019s when <em>I<\/em> realized it\u2019s been a decade since I was first paid to work with the operating system.<\/p>\n<p>I had been using Linux for a little while. My first contact with it was in mid 1995. I had bought a computer magazine from the UK that had this pink CD-ROM with something called <strong>Linux-FT<\/strong>.<\/p>\n<p>One of the cool things about Linux-FT was that it had a licensed copy of the Motif window manager, which was pretty cool at the time. I had been using some RISC boxes in college running CDE, so I felt right at home.<\/p>\n<p><a href=\"https:\/\/rselbach.com\/images\/posts\/2009\/12\/infomagic.jpg\"><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/images\/posts\/2009\/12\/infomagic_thumb.jpg\"\n alt=\"infomagic\"\n loading=\"lazy\"\n decoding=\"async\">\n<\/figure>\n<\/a>Not long after that, a friend who was an administrator at a new ISP let me borrow his Walnut Creek CD-set containing Slackware 2.1 or 2.2 (I\u2019m not sure anymore. Old age, remember?) Then I purchased a copy of the wonderful InfoMagic 5-CD set containing Slackware, Red Hat, mirrors of some FTP site and another distro I can\u2019t remember either (<em>Shit! I\u2019m old\u2026<\/em>)<\/p>\n<p>Then in 1999 I was hired to help this company migrate from Windows to Linux. It was the first time I was ever paid to do anything related to Linux.<\/p>\n<p>I went to work at Conectiva the next year, where I learned I didn\u2019t know anything. <em>What the heck do I do now?<\/em> That\u2019s also where I learned like never before, made lots of friends, and found the love of my life. (<em>No, not another Linux distribution! I mean my wife! What\u2019s wrong with you?)<\/em><\/p>\n<p>In 2004 I left Conectiva and started working with one of the company\u2019s founders on another Linux project. The work itself was interesting, but it was also my first contact with something that I would see a lot more in the future: the downright dishonesty of Linux entrepreneurs in Brazil. Of course, I then thought it was an isolated thing and decided I didn\u2019t want to be a part of that and left the company in 2005.<\/p>\n<p>That\u2019s when I came to Intel to work at the CSO, a \u201cpersonal\u201d project of Andy Grove. CSO had a simple mission: to foster Linux usage by financing and providing engineering to business with good ideas. How great is <em>that?<\/em> I was going to work on my passion (Linux) and meet all kinds of people who shared it with me. What could possibly go wrong?<\/p>\n<p><em>Oh boy.<\/em><\/p>\n<p>In the following year I\u2019d see things that would still make me sick years later. From businesspeople to self-appointed free software leaders, all I saw was guile and greed. It was such a disappointment that I requested a change. I stopped working with Brazilian businesses and projects completely, moving to support projects in other countries. Things were much better, which is another disappointment and one of the reasons why I hold us Brazilians in such low regard as a people.<\/p>\n<p>Outside Brazil things were very different and despite some funny things here and there, I am proud of the Linux work I\u2019ve done, especially the megalarge project with the government of Venezuela. I even met Hugo Chavez, which is funny considering my political stand \ud83d\ude42<\/p>\n<p>Regardless, I was also getting disappointed at other things as well. After years developing projects such as KDE, I was bored to death. I started witnessing things being done on other platforms and suddenly the Linux desktop just felt stale to me. <em>It was dull and lifeless<\/em> and at the same time I was doing all these cool stuff on Windows.<\/p>\n<p>Add to all that the fact that KDE started getting full of kids adding more and more useless features\u2026 and politics\u2026 ever heard the one about the moppet who decided that all KDE About boxes should contain a thank-you note to American troops worldwide? And he wasn\u2019t even American? You know what?<\/p>\n<p><em>Screw Linux.<\/em><\/p>\n<p>I dropped it like you wouldn\u2019t believe. And it felt good. Not having to edit configuration files to do something simple made stuff pleasant again. I was introduced to Mac OS X and I loved it. It was Linux on steroids. All the good stuff without the kludge.<\/p>\n<p>No more politics. No more GNU Slash Linux. No more open source vs. free software. No revolutionary-audio-framework-of-the-month. No juvenile cockiness. No rWindoze. No Micro$oft.<\/p>\n<p>Just fun.<\/p>\n<p>After nearly 15 years, I\u2019m truly free.<\/p>"},{"title":"The Grumpiest Post I\u2019ve Ever Written","link":"https:\/\/rselbach.com\/the-grumpiest-post-ive-ever-written\/","pubDate":"Wed, 16 Dec 2009 22:31:19 +0000","guid":"https:\/\/rselbach.com\/the-grumpiest-post-ive-ever-written\/","description":"<p>So today <a href=\"http:\/\/twitter.com\/sulagarcia\/statuses\/6728366820\">I was called grumpy<\/a>, which was inconsiderate and uncalled-for, so I did what every stable adult man would do. I complained to the one person who\u2019s required by God and Country to always be supportive: my wife. \u201cWho the hell does she think she is calling me grumpy?\u201d I asked. And my wife went \u201cwell, you totally are,\u201d which was an inconsiderate and uncalled-for answer. \u201cHey! You\u2019re my wife! You\u2019re <em>supposed<\/em> to <em>love<\/em> me!\u201d and she was \u201cI do love you! And that\u2019s why I need to be honest.\u201d<\/p>\n<p><em>Crap.<\/em><\/p>\n<p>It\u2019s not that I could not live with the idea of being grumpy. It\u2019s just that I don\u2019t see myself like that. Or rather I didn\u2019t. Now I kind of do.<\/p>\n<p>There are a couple of young kids who are all high on the whole GNU Fucking Slash Linux. Not unusual. When we\u2019re young, the world does seem a lot more black and white. That\u2019s fine. Kids will rebel and Linux\u2026 <em>Ops, sorry!<\/em> GNU <em>Slash<\/em> Linux provides an outlet from which all the rebellion that a young nerd can muster. I mean, it\u2019s not like these kids get invited to the parties where popular kids do their rebelling, <em>right<\/em>? Again, that\u2019s all fine and dandy. Been there.<\/p>\n<p>But then these kids\u2014high as they are on GNU Slash Kool-aid\u2014forget that <em>they<\/em>\u2019re the new kids on the block. I mean, seriously people, Linux isn\u2019t new anymore. There is a lot of people who came before you kids came out of daddy\u2019s place. <em>No shit<\/em>.<\/p>\n<p>Let\u2019s face it, this is part of being young. You feel like you have all the answers and everyone else in the world failed to see The Truth. No problem with that. Except\u2026<\/p>\n<p>Except that shit means I\u2019m now officially old!<\/p>\n<p><em>Motherfucker.<\/em><\/p>\n<p>Today I see a friend commenting about Linux and one of these cocky, know-it-all kids jumped on his case like he was some kind of newbie or something. Hell, that actually got me angry. And then it hit me.<\/p>\n<p>Doesn\u2019t <em>that<\/em> make me grumpy?<\/p>\n<p><em>So. Fucking. Be. It.<\/em> I hereby accept the label of grumpy and shall sport it with pride.<\/p>\n<p><a href=\"https:\/\/rselbach.com\/images\/posts\/2009\/12\/Grumpiness.jpg\"><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/images\/posts\/2009\/12\/Grumpiness_thumb.jpg\"\n alt=\"Grumpiness\"\n loading=\"lazy\"\n decoding=\"async\">\n<\/figure>\n<\/a><\/p>\n<p>So my friend works with and improves Linux for years and then a kid comes out of nowhere\u2014having never done more than tweeting about Linux\u2014and dares berate the guy? <em>Go suck an egg, son!<\/em> The guy I\u2019m talking about knows more Linux\u2014and note how I dropped that slash shit and I don\u2019t even care\u2014on his pinky toe than all your friends together. <em>Kid!<\/em><\/p>\n<p><em>Goddammit.<\/em><\/p>\n<p>-rst.<\/p>\n<p>P.S.: I\u2019m not really angry. Or am I?<\/p>"},{"title":"The Delusion of Not Being Deluded","link":"https:\/\/rselbach.com\/the-delusion-of-not-being-deluded\/","pubDate":"Tue, 15 Dec 2009 17:04:40 +0000","guid":"https:\/\/rselbach.com\/the-delusion-of-not-being-deluded\/","description":"<p>Ever came across someone who wanted to show off how independent and free their own thinking was? I have, many times. Discussing with these people is an amusing and yet wretched event. It\u2019s like goping to a funny dentist. She may be funny, but she\u2019s still going to bore a deep hole in your tooth. And boy, will it hurt! At least one of you will be laughing, right?<\/p>\n<p>I happen to know a couple of people who have got such strong conviction of their own uniqueness in being free from delusion that they cannot avoid being delusional themselves. Both are on this righteous crusade to extricate people from their self-foisted enslavement in the hands of evil Apple. <em>Wait, what?<\/em> Yes, that\u2019s right. From Apple! Apparently to some people, the operating system or the phone we use is the wrong one and we are pulling the wools over our own eyes into thinking otherwise. Fortunately for all of us, there are these cavaliers in shiny armor who will rescue us from ourselves. <em>Dude, seriously? How much more fucked-up delusional can one get?!<\/em><\/p>\n<p><a href=\"https:\/\/rselbach.com\/images\/posts\/2009\/12\/image.jpg\"><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/images\/posts\/2009\/12\/image_thumb.jpg\"\n alt=\"image\"\n loading=\"lazy\"\n decoding=\"async\">\n<\/figure>\n<\/a><\/p>\n<p>I don\u2019t know if those guys did too much role-playing in their lives (and I don\u2019t mean in bed) or it\u2019s just too much <a href=\"http:\/\/www.worldofwarcraft.com\">World of Warcraft<\/a>. I don\u2019t really know. But if there is one thing I <em>do<\/em> know, it\u2019s that it\u2019s delusional. Why is this so? It\u2019s really a synthesis of a couple of things \u2014<\/p>\n<ul>\n<li>\n<p><strong>Belief that one is right about something.<\/strong> Being fair, we are all like this. If you ponder about it, this is the very definition of having an opinion. Nobody thinks they are wrong about their opinions.<\/p><\/p>\n<\/li>\n<li>\n<p><strong>Self-aggrandizement.<\/strong> Again, to a variable degree, we\u2019re all like that. We all love to think we are more than what we really are. Probably a defense mechanism. Without that, we\u2019d all have killed ourselves by the time we reached puberty. Or maybe not all of us, because I am super awesome.<\/p>\n<\/li>\n<li>\n<p><strong>Strong illusions.<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>What exactly is a delusion? A delusion is the belief that an illusion is real. We all have illusions, but a few go farther. They have such strong illusions that they begin believing in them.<\/p>\n<p>These people actually <em>believe<\/em> that there is a war going on. A struggle between good and evil. A conflict between freedom and slavery. And let\u2019s face it, <em>everyone<\/em> wants to be one of the good guys. Except supervilains. Supervilains want to be on the wrong side. <em>Always<\/em>.<\/p>\n<p>Once you are set on the idea that (a) there is something like black-and-white good and evil, and that (b) the fucking clash is on, there\u2019s really no stopping you. You need to fight to Good Fight. But since there really isn\u2019t a war going on, the only way to fight it is by making up stuff as you go. So you pick your villains (say, Microsoft and Apple) and your heroes (say, Google and GNU) and you go out saving us ignorant civilians. From ourselves. And from Apple. Because Apple is, like, super evil. <em>Ah, if everyone was like Google\u2026<\/em><\/p>\n<p><em>Holy. Shit. People.<\/em> Grow the fuck up!<\/p>\n<p>Let\u2019s all pretend for a moment that there really <em>is<\/em> a war going on. That Google is out there fighting for our rights to free goodies in exchange for nothing at all. That Microsoft really owns the world\u2019s Secret Cabal and Bill Gates sits down everyday to plan what evil deed needs to be done that day. Let\u2019s say all of this is real. Wouldn\u2019t it be a lot more productive for you to focus on your enemies and leave us civilians alone? Go ahead, wear your fancy penguin costume and take pictures of yourself peeing on the Microsoft logo. A lot of people will <em>love<\/em> that. And more importantly, you will feel like you\u2019ve finally accomplished something! You won a battle for the good guys! <em>Hooray!<\/em><\/p>\n<p>But please leave the rest of us alone.<\/p>\n<p>-rst.<\/p>\n<p>P.S.: a friend just sent me this picture, which says a lot. I think the message is: <em>Dude, don\u2019t be a fag!<\/em><\/p>\n<p><a href=\"http:\/\/theduty.tumblr.com\/post\/283874180\/fyi\"><figure class=\"post-figure\"><img src=\"https:\/\/rselbach.com\/images\/posts\/2009\/12\/image1.jpg\"\n alt=\"image\"\n loading=\"lazy\"\n decoding=\"async\">\n<\/figure>\n<\/a><\/p>"}]}}