On the topic of tail calls in .NET
Let's say you have implemented a small data pipeline library to replace LINQ.
module TrivialStream = type Receiver<'T> = 'T -> unit type Stream<'T> = Receiver<'T> -> unit module Details =
|#_" -*- mode: clojure; -*-"|
|;; Based on https://github.com/babashka/babashka/blob/master/examples/image_viewer.clj|
|(:require [babashka.fs :as fs]|
|[clojure.java.browse :as browse]|
|[clojure.string :as str]|
|[clojure.tools.cli :refer [parse-opts]]|
|[org.httpkit.server :as server]|
|[_request _response ws-map]|
|(proxy [WebSocketAdapter] |
|(onWebSocketConnect [^Session ws-session]|
|(proxy-super onWebSocketConnect ws-session)|
|(when-let [f (:on-connect ws-map)]|
|(onWebSocketClose [status-code reason]|
|(when-let [f (:on-close ws-map)]|
|(f (.getSession this) status-code reason)))|
This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.
For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai
A couple of weeks ago I listened to .Net Rocks! #1433 about Visual Studio 17 with Kathleen Dollard. A very good episode interest but with stuck with me was Kathleen's comment that after all these years she sees very smart people still struggle with async. This is my and others experience as well.
A few years ago I wrote a blog post on why I thought async in C# isn't that great. I took it down a bit later even though it was popular it was also divisive and my understanding of async had grown which made me want to rewrite the whole piece into something better and less divisive.
I used to think that the implicit coupling in async to the
SynchronizationContext is a major problem for async but today I think that it's a minor problem for most developers. The reason is that if you are writing ASP.NET you will always have the ASP.NET
SynchronizationContext and that gives particular but consistent async behavior. If y
|// Copyright 2017 Mårten Rånge|
|// Licensed under the Apache License, Version 2.0 (the "License");|
|// you may not use this file except in compliance with the License.|
|// You may obtain a copy of the License at|
|// Unless required by applicable law or agreed to in writing, software|
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8
To use the new
phx.new project generator, you can install the archive with the following command:
$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in
It is well-known that a hard disk has a long delay from that we request the data to that we get the data. Usually we measure the hard disk latency in milliseconds which is an eternity for a CPU. The bandwidth of a hard disk is decent good as SSD:s today can reach 1 GiB/second.
What is less known is that RAM has the same characteristics, bad latency with good bandwidth.
You can measure RAM latency and badndwidth using Intel® Memory Latency Checker. On my machine the RAM latency under semi-high load is ~120 ns (The
3r:1w bandwidth is 16GiB/second). This means that the CPU on my machine has to wait for ~400 cycles for data, an eternity.