## Technology

December 4th, 2013

# How to work with Clojure’s EDN

This is a fantastic little write up about how to work with EDN:

The first place I started with EDN, was with the clojure.edn namespace, which has a very short API documentation and this was my first point of confusion. I could see a read and read-string method… but couldn’t see how I would actually write EDN? Coming from a background that was used to JSON, I expected there to be some sort of equivalent Clojure to-edn function lying ...

December 3rd, 2013

# Scala is horrible

I had to work with Scala for a few weeks at Timeout. I hated it. I notice that most programmers who have been exposed to Scala and Clojure will either prefer Scala or Clojure — I have not yet met anyone who liked them both. Scala or Clojure are extreme opposites. But why do programmers divide over this issue? I was leaning toward the idea that it had something to do with types, with some programmers liking algebraic types (and ...

December 3rd, 2013

# The difference between Scala and Clojure

Check out this matrix that shows which languages have projects that allow them to output code in another language. The difference between Scala and Clojure is extreme. Clojure has more targets than any other language, and Scala has none. Nobody uses Scala to produce some other code, whereas it is clearly a huge source of joy for Clojure programmers.

Source

November 30th, 2013

# What is bound-fn good for?

In Clojure, this is a great example of how and why to use bound-fn:

At work we have some tests that spin up various jetty instances that return sample test data. We use these to mock out other services on our platform and switch the app’s config at test time to point at them instead of the real services. It’s actually a pretty great set up that I plan to talk about at a later date but a specific issue ...

November 30th, 2013

# How to handle loops in bash

This is a great collection of bash tips:

1. for i in $(ls *.mp3) One of the most common mistakes BASH programmers make is to write a loop like this: for i in$(ls *.mp3); do # Wrong! some command $i # Wrong! done for i in$(ls) # Wrong! for i in ls ...

November 30th, 2013

# Church Numerals make all numbers the results of funtions

Lately I’ve been wondering a lot about where numbers come from. My research lead me to this interesting post about Church Numerals.

Assume we have a programming language that doesn’t support numbers or booleans: a lambda is the only value it provides. It is an interesting question whether we can nonetheless create some system that allows us to count, add, multiply, and do all the other things we do with numbers. Church numerals use lambdas to create a representation of numbers. The idea ...

November 24th, 2013

# A brilliant attack on object oriented programming

This is very good. I wish I had written it:

Jake’s on the job

Phil: Hey Jake. I’ve been looking at this class of yours. It’s a little bit too big.

Jake: Sorry. And what’s the issue with that?

Phil: Well, thing is. It’s got too many responsibilities. It does too much.

Jake: And?

Phil: Well think about it. If it does too much, it means that it touches many parts of the system. So the probability of having to touch the class when changing code ...

November 12th, 2013

# Pipe-and-filter architectures are among the most successful design patterns ever

This is the first time I have ever felt like I understood what Storm is for. I have tried to read about Storm, but every description I’ve read leaves me confused. Consider the official description from the Github page: “Distributed and fault-tolerant realtime computation: stream processing, continuous computation, distributed RPC”. Does that tell you anything? I am left confused. This instead make sense to me:

Pipe-and-filter architectures are among the most successful design patterns ever. They dominate data ingestion and processing ...

November 9th, 2013

# Small apps and specialized machines

This is a bit of speculation on my part. I wrote previously about using small apps to build big web sites. I want to re-emphasize the Big Ideas from that article:

1.) big apps eventually become expensive to maintain

2.) small apps are easy to maintain

3.) an architecture of small apps might leave you with a lot of apps, which need to be managed, but managing them becomes a management issue, rather than a technical issue. Technically, the app is easy ...

November 7th, 2013

# Michael Drogalis shows a very concise pipeline

Michael Drogalis has another one of those posts from which I learn a lot. In this case I am impressed that he manages to get the abstract concept of a pipeline down to the minimum of code:

(defn pipeline [] (let [bound 10000 m-ch (chan bound) n-ch (chan bound) o-ch (chan bound)] (go (while true ...

November 7th, 2013

# Object oriented artifacts in a functional world

I love this:

In the world of object-oriented programming, it is common to create classes to represent data elements from your domain. These classes run into all kinds of trouble. First, they tend to breed closely coupled classes like DTOs and XML type mappers. Second, they rarely contain any intelligence and sometimes don’t contain any behavior at all. Third, proliferating concrete classes can make it hard to see common abstractions trying to escape.

In the past, I answered all of those ...

October 16th, 2013

# lsof files of a particular user or process

I sort of knew that lsof was a useful command, but these are nice examples of how to see files in use by just a particular user or process:

6. List files opened by a specific user

In order to find the list of files opened by a specific users, use ‘-u’ option.

# lsof -u lakshmanan

COMMAND PID USER FD TYPE DEVICE SIZE/OFF ...

October 16th, 2013

# The genius of named pipes

The socket system in Unix was a clever breakthrough at the time. Although we can imagine a better design if the whole thing were invented today, the older system is still impressive in how much flexibility it allows.

This is a good comment:

Don’t forget the ordinary UNIX domain socket: you can think of them like TCP connections bound to 127.0.0.1 but not assigned a port number but a path name. This can be useful if you have e.g. 3 ...

October 16th, 2013

# Easy testing of regular expressions

This looks like an awesome way to test regular expressions.

Source

October 9th, 2013

# When can medicine beat evolution?

Interesting:

Trade-offs are endemic in biology. Often, if you use a drug or surgery to optimize something, you will discover penalties elsewhere. If you delay aging & length lifespan as is possible in many species, you might find that you have encouraged cancer or – still worse – decreased reproduction1 as evidenced by the dramatic deaths of salmon or brown antechinus2; if your immune system goes all-out against disease, you either deplete your energetic and chemical reserves3 or risk autoimmune disorders; ...

October 7th, 2013

# Safe monkey patching in Scala

I get how clever and interesting this is.:

The biggest drawback from doing this in Ruby is monkey patches are in the global scope. If you use any class that relies on any monkey patching then that monkey patching is also in your scope. At best it won’t effect any of your code, at worst it can silently override methods in your code. This can lead to horrible problems that will cause you to cry.

Scala however lets you accomplish the same ...

October 7th, 2013

# The open source community is sometimes its own enemy

This is sad on several levels:

I’m considering stepping down from maintaining Capistrano at all, if I had to pick on a shortlist of reasons, it’d be:

I don’t use Rails all that much anymore, and many of the problems people report with Cap are really problems of Rails (i.e the entire manifest/asset pipeline disaster). When people have problems, I’m not equipped to diagnose what might be going wrong, as I simply don’t deploy that way. My rails projects are all Rails ...

September 28th, 2013

# Optional typed systems in Clojure

This is very clever:

Why optional typing?

Dynamic languages have long been criticised for being hard to maintain at scale. When you grow to a large team or a large code base, it becomes more difficult to refactor a code base, to understand how it works, and to make sure it does what it should.

The standard solution is great testing, and obviously we at CircleCI are big fans of great automated testing. However, what we’re really about is productivity, and optional typing ...

September 23rd, 2013

The Padding-Bottom Hack This technique is based on something called intrinsic ratios, but because none of our team’s members could remember, understand or pronounce the term “intrinsic” we just called it the “padding-bottom hack.” Many people learned about this feature back in 2009 in A List Apart’s article “Creating Intrinsic Ratios for Video,” by Thierry Koblentz, and the technique is often used to embed third-party content and media on responsive websites. With the technique, we define the ...

September 19th, 2013

# a jewel-like geometric object that dramatically simplifies calculations of particle interactions

There are models where you add in knowledge of the future as a physical fact of all existing objects (the object extends 4 dimensionally into the future) and then randomness disappears from its interactions (it knew where everything would be in the future). I am curious about models of the universe that reduce everything to a geometry of enough dimensions:

“The number of Feynman diagrams is so explosively large that even computations of really simple processes weren’t done until the age ...

September 12th, 2013

# Supervision hierarchies

I feel like this is the core idea of Erlang:

Recall that at the beginning of this chapter we talked about the idea of a hierarchy of tasks. The basic idea is:

1. Try to perform a task.

2. If you cannot perform the task, then try to perform a simpler task.

To each task we associate an supervisor process—the supervisor will assign a worker to try and achieve the goals implied by the task. If the worker process fails with a non-normal exit then ...

September 12th, 2013

Joe Armstrong’s book about concurrent fault tolerant programming is full of surprising ideas: I love this idea: computers should not have operating systems, they should simply have libraries that programmers can include when they make programs.

In most programming languages it is easy to write a pure function, whose value depends in a deterministic manner on the inputs to the function, but it is much more difficult, and sometimes impossible, to do things like changing the code in ...

September 12th, 2013

# Let it crash

I am learning a lot from Joe Armstrong’s thesis regarding concurrent and fault tolerant programming :

How does our philosophy of handling errors ﬁt in with coding practices? What kind of code must the programmer write when they ﬁnd an error? The philosophy is let some other process ﬁx the error, but what does this mean for their code? The answer is let it crash. By this I mean that in the event of an error, then the program should just ...

September 12th, 2013

# An Erlang example of functional programming

I am fascinated reading through Joe Armstrong’s thesis on concurrent programming and Erlang. He began work on Erlang in 1985 and his work was based on ideas that were developed by the 1970s. This leaves me curious: we’ve known for 40 years how to build robust concurrent applications, so why does the functional style remain a niche? Object oriented programming has been proven a terrible failure: vast graphs of mutable-in-place variables with vast cascades of mutations on every change leads ...

September 12th, 2013

# Difficult code, and easy code, should go in different modules

Joe Armstrong’s these about concurrent programming and Erlang offers a wealth of novel ideas:

When we program we want to structure the code into “dificult” and “easy” modules. The dificult modules should be few and written by expert programmers. The easy modules should be many and written by less experienced programmers. Figure 4.1 shows a generic component (the dificult part), and a number of “plugins” (the easy parts) which are used to parameterise the generic component.

The generic component should hide details of ...

My name is Lawrence Krubner. I run WP Questions .

January 10, 2012 1:09 pm

"Thank you, Charlotte. But what is the main advantage of Kachingle for you? You could perhaps find a more direc..."

January 9, 2012 2:29 pm

"I love your thoughtfulness and tone, however, I have questions about the "Community" of voters you mention. I ..."

December 14, 2011 10:58 am

"Thank you all. I look forward to seeing the emergence of an innovative startup that is able to find the new mo..."

December 14, 2011 9:25 am

"Thank you, Lawrence, for that insightful and balanced review. I am a Kachingler, and I support its business m..."