July 27th, 2014

# Understanding Ring Middleware

I am very, very stupid. Despite the great post by Darren Holloway, I was still wondering when you get the request and when do you get the response in a Ring Middleware.

Ryan Evans offers this simple middleware as an example:

(defn my-middleware [app] (fn [request] ;; This is where you’d do any processing on the request ;; Finally, keep the chain going by calling app (app request)))

The ...

July 26th, 2014

# TJ Holowaychuk leaves NodeJS for Go

TJ Holowaychuk built out some of the most important nmp modules for NodeJS, but now he is leaving for Go.

Go versus Node

If you’re doing distributed work then you’ll find Go’s expressive concurrency primitives very helpful. We could achieve similar things in Node with generators, but in my opinion generators will only ever get us half way there. Without separate stacks error handling & reporting will be mediocre at best. I also don’t want to wait 3 years for the ...

July 26th, 2014

More than most projects, it seems like Node.js has seen a lot of churn in its leadership.

January 2012:

Citing a desire to work on research projects after three years of focused work, Node.js creator and project leader Ryan Dahl sent out a message today that he will be “ceding my position as gatekeeper to Isaac Schlueter”. He stated:

I am still an employee at Joyent and will advise from the sidelines but I won’t be involved in the day-to-day bug fixes. ...

July 26th, 2014

# Adding real continuous loop behavior to Clojure apps

Interesting:

A while loop that is always true will continue to run until terminated, but it’s not really the cleanest way to obtain the result as it doesn’t allow for a clean shutdown. We can use a scheduled thread pool that will start and execute the desired command in a similar fashion as the while loop, but with a much greater level of control. Create a file in the src directory called scheduler.clj and enter the following code:

(ns pinger.scheduler ...

July 22nd, 2014

# The problems of object oriented programming and strict typing

This is good, though too specific to Java:

The biggest problem I’ve encountered over the years looking at Java code is that it always seems to be the product of someone who fancies themselves as an architect. They must, because so often I find I’m reading code that looks more like a plan for something that solves a problem, rather than something that actually solves a problem. It’s not a subtle distinction. There are deep layers of abstraction and mountains of ...

July 22nd, 2014

# How much can a developer possibly know?

The amount that programmers need to know is growing, so experienced programmers end up facing situations like the one described here by Tim Bray:

Where I’m stuck · I have a tab open to a page in the Gra­dle doc­s: Chap­ter 50. Depen­den­cy Man­age­ment. It has 63 header-delimited sec­tions or­ga­nized in­to 10 top-level sub­sec­tion­s, and it’s chap­ter 50 of 65 (plus five ap­pen­dices). ¶ Short sto­ry: I’m get­ting an in­com­pre­hen­si­ble Groovy er­ror try­ing to do some­thing that should be sim­ple, and fol­low­ing ...

July 21st, 2014

# Pretty-print JSON from Clojure

Interesting:

What’s next? Oh, pretty-printing. Yeah, I pretty-print my JSON to go over the wire. It’s nice for debugging. I mean, who wants to curl one long, 1000-character line of JSON? Put some whitespace, please! How to do that?

(cheshire.core/generate-string mp {:pretty true}) That’s right, it’s basically built in, but you have to specify it. But, oh man, that’s long. I don’t want to type that, especially because my lazy fingers are going to not do it one time, then I’m going ...

July 21st, 2014

# PrettyPrinting for test results

An interesting test style:

If the expression passed to is an S-expr, and the first element of the is recognized as a function. Then is prints that first symbol directly, then evaluates all the arguments to the function and prints the results. For instance:

expected: (function-name (arg1) (arg2)) actual: (not (function-name “1st arg value” “2nd arg value”))

However, if is does not recognize that first element as a function, the whole expression passed to is is evaluated for the actual, and you get:

expected: (something-that-evaluates-to-bool ...

July 21st, 2014

# Why is uberjar such a rare option?

I find this very surprising. My first serious exposure to the JVM was via Clojure, which has the awesome Leinengen build tool, which has an uberjar option. Therefore I thought uberjar was common on the JVM. But no. Now that I am working with Java, I find that it is rare for anyone to put jars inside of jars:

You can add jars to the jar’s classpath, but they must be co-located, not contained in the main jar.

That was in 2008, ...

July 20th, 2014

# Buildr as a continuous integration tool?

Interesting to read an old post from 2008 in which Liz Douglas stretch Buildr to the point that it becomes almost a continuous integration tool:

A few months ago the idea of myself writing such words (“Things I like about Buildr“) seemed very unlikely and I dare say that my project buddies may be surprised at the statement. Buildr, for those unfamiliar, is a build tool for Java applications that is written in Ruby. It’s key benefit is its concise ...

July 20th, 2014

# Should project packaging/building be complicated?

Working with Java for the first time in 10 years. Using Buildr as my build tool. I have a certain admiration for Buildr and all that it allows:

Here’s another example:

jjtree = jjtree(_(‘src/main/jjtree’), :in_package=>’com.acme’) compile.from javacc(jjtree, :in_package=>’com.acme’), jjtree

This time, the variable jjtree is a file task that reads a JJTree source file from the src/main/jjtree directory, and generates additional source files in the target/generated/jjtree directory. The second line creates another file task that takes those source files, runs JavaCC on them, and ...

July 20th, 2014

# Clojure encourages small functions

This is very true:

I have only two small Clojure projects, and other than writing tools on which nothing major depends, these projects will probably be the only ones in my current position. The rest will be done in Web languages and Perl. So, I enjoy a chance to enhance the Clojure projects.

I do not know why, and am not aware of any conscious prejudice, but writing Clojure code encourages me to create small functions, and external Clojure projects, like ...

July 19th, 2014

# The difference between strict static typing and design-by-contract

When I write Clojure, I write pre and post assertions, following the pattern known as “design by contract”:

(defn fetch [ctx] {:pre [ (map? ctx) (string? (:database-query-to-call ctx)) (map? (:database-where-clause-map ctx)) ] :post [(future? %)]} “2014-07-01 – first we check the cache. If we get ...

July 18th, 2014

# Classpath hell in Java

I rarely work in Java, and every time I recall what a pain it is to figure out the classpath. I finally set my classpath in the manifest to something hardcoded:

Main-Class: com/company/Main Class-Path: /Users/lkrubner/projects/launchopen/lofdg/target/

and at the terminal I compile my “.class” files in the same directory as the “.java” files:

javac src/com/company/*.java

Then I move them:

mv src/com/company/*.class target/com/company/

Then I create my jar file:

jar vcfm fakeDataGeneratror.jar manifest.txt target/com/company/*

which I call:

java -jar fakeDataGeneratror.jar

There are some important text files that ...

July 2nd, 2014

# Testing RESTful APIs with cURL

This is great:

I believe it’s just as easy, for basic operations, to use CURL as you are likely to be in a terminal window anyway at such an early stage in development. For this reason, I thought I’d cover using CURL for the 4 basic RESTful methods (GET, POST, PUT and DELETE).

The following assumes you already have an application with a RESTful endpoint of ‘users’:

GET – This will get all users in our application.

1 curl http://www.mydemoapp.com/users POST – Here we are posting ...

July 2nd, 2014

# Why would a sane programmer use PHP rather than Clojure for a RESTful API?

This question on StackOverflow seems a bit sad:

I did look at both Laravel, Sympfony2 and Codeigniter for this REST Api. They all had some elements I liked and some I disliked. My main concern was how to do the authentication because I had a rather complex algorithm where my users can log in with the apps’ access_token or access_tokens served by Google or Facebook. I also perfer being in complete control of my framework and the frameworks mentioned above had ...

June 30th, 2014

# mongodump and mongorestore

This is a good overview for using mongodump and mongorestore:

Once you’ve taken the backup of a MongoDB database using mongodump, you can restore it using mongorestore command. In case of an disaster where you lost your mongoDB database, you can use this command to restore the database. Or, you can just use this command to restore the database on a different server for testing purpose.

1. Restore All Database without Mongod Instance

If you’ve taken a backup without mongod instance, use this ...

June 29th, 2014

# Waste my screen like it’s 1996

A lot of the screen space here is fixed and does not scroll. Reminds me of frames circa 1996.

Source

June 28th, 2014

# A simple regex rule

Don’t ever use this:

.*

.*?

Why? Because the first one is greedy and will almost always match too much.

This is a nice example:

Most people new to regular expressions will attempt to use . They will be surprised when they test it on a string like This is a first test. You might expect the regex to match and when continuing after that match, .

But it does not. The regex will match first. Obviously not what we ...

June 28th, 2014

# Unix and C are the ultimate computer viruses

This is a very good take on “worse is better”. This also bears on the micro-services debate. Simple implementation allowed Unix to become the world’s favorite operating system. Is there redundant code in a Unix distro? Sure, you’ve got a lot of utilities that all have code for reading files. But if, instead of a bunch of small utilities, you tried to build the one ultimate tool that does everything (the monolithic framework) you would never get anything like the ...

June 27th, 2014

# The cost of small apps

Micro services become popular:

Though they aren’t a particularly new idea, Microservices seem to have exploded in popularity this year, with articles, conference tracks, and Twitter streams waxing lyrical about the benefits of building software systems in this style.

I previously wrote about my preference for an architecture of small apps. But it is worth noting, this approach has its downside:

Where a monolithic application might have been deployed to a small application server cluster, you now have tens of separate services ...

June 27th, 2014

# Maybe Unicorn works for Ruby

Since I said so many bad things about Unicorn, it is only fair that I also link to this piece that makes Unicorn sound good:

Unicorn was faster than Passenger or Thin with /borat and had the second highest transaction rate for the same. It had the shortest duration of both longest and shortest transaction with /borat as well. It was one of only two that actually finished the /pi test, and did so faster than Thin. Unicorn had the highest ...

June 26th, 2014

# Regular expressions: greedy and lazy matching

This is a great tutorial on regular expressions:

As you’ve seen, a greedy quantifier will try to match as much as it possibly can and only give back matched characters as needed. Every time the engine greedily consumes one more character (or repeated token in general), it has to remember that it made that choice. It will therefore persist its current state and store it so it can come back to it later in a process we call backtracking. When ...

June 24th, 2014

# Is the FizzBuzz test really hard?

I have been a fan of John Lawrence Aspden for several years now, but this post on FizzBuzz is especially good, both funny and illustrative of what I think is a common work process in Clojure:

;; I decided to use pull it out your ass driven development, where ;; you just pull the answer out of your ass.

;; First bit, print out the numbers from 1 to 100 (range 100) ;-> (0 1 2 3 4 5 6 7 8 9 10 ...

June 24th, 2014

Interesting:

Using ZFS as a replacement of Git for is probably not a good idea, but just to give you a sense of what ZFS supports at the file system level, let me go through a few typical git-like operations:

Creating a repository

Committing or tagging a version

Branching

Pushing and pulling changes from other storage pools, possibly on other machines

Notably missing is support for merging, which ZFS does not have direct support for as far as I’m aware.

Creating a repository

First, let’s create a filesystem ...

June 24th, 2014

# Managing multiple Future objects in PHP

I have previously said negative things about Joe Watkin’s attempts to facillitate using objects and multiple threads in PHP.

However, here is an approach to Futures in PHP that does seem easy and interesting to me:

Managing Multiple Futures

Commonly, you may have many similar tasks you wish to parallelize: instead of compressing one file, you want to compress several files. You can use the FutureIterator class to manage multiple futures, via the convenience function Futures().

$futures = array(); foreach ($files as $file) ... Read More Source June 24th, 2014 No Comments # Refactoring fat models I had a job interview at Bookspan.com. At first I talked to a guy named Tom. I assumed he was the leader of the tech team, so I talked about my wide experience. He seemed confused by my recent experience with Ruby. He asked if I was a serious PHP programmer? I said a few negative things about PHP, since most corporations are now pulling away from it. PHP is going out of fashion (as you can see in this ... Read More Source June 24th, 2014 No Comments # Eventual consistency is probably the only consistency that one can hope for using Javascript and WebSockets On the one hand, I am very impressed with this article: Eventual Consistency in Real-time Web Apps. On the other hand, how can anyone keep up with what is best practice in the land of Javascript, when every week seems to bring a new framework or methodology? Having said that, I’ll point out that there is no way to ensure a 1-to-1 match between one’s backend model and one’s front-end model, so all one can do is pick one to ... Read More Source June 24th, 2014 No Comments # PHP-FPM with Nginx I already linked to this, but I will link again because, seriously, this is one of the best setup tutorials I’ve seen: One of the greatest strengths of PHP-FPM is its ability to scale its worker processes up and down as load on the server increases. PHP-FPM can have several “pools” of PHP handlers: one for each different Web application, with different numbers of worker processes and different rules about when to add more processes or kill idle processes. Our needs ... Read More Source June 24th, 2014 No Comments # Docker is the future Something like Docker is probably the future. Clearly, virtual machines is becoming a popular way to manage dependencies. However, Docker still has problems: Misconception: If I use Docker then I don’t need a configuration management (CM) tool! This is partially true. You may not need the configuration management as much for your servers with Docker, but you absolutely need an orchestration tool in order to provision, deploy, and manage your servers with Docker running on them. This is where a tool like ... Read More Source June 17th, 2014 No Comments # Emacs struggles to get a good package manager Kind of pathetic that the world’s best text editor only got package-support in 2012: GNU Emacs 24 (released in June 2012) introduced official support for packages, that is, a way of installing extensions from a remote repository. This was a huge step forward for Emacs, as it not only allowed users to easily find and install extensions, but it also made it possible for extensions to build upon other extensions without having to tell the user “great you want to install ... Read More Source June 3rd, 2014 No Comments # The strange way my memory works I was at a job interview today and I said “Do you remember that essay that James Garret wrote in 2004, in which he coined the acronym ‘AJAX’ “? Feeling uncertain about what I said, when I got home I decided to check my facts, and found that his name is actually “Jesse James Garrett“. I find it strange that my memory would hang onto his middle name rather than his first name. I am also surprised that the term “AJAX” ... Read More Source June 1st, 2014 No Comments # Avoid overcrowding your web server with too many unneeded processes This is some very good advice (I’ve been thinking of using Arch Linux for future projects, as I understand it is an extremely minimalist Linux): Avoid overcrowding your web server with too many unneeded processes. For example, if your server is purely for web serving, avoid running (or even installing) X-Windows on the machine. On Windows, avoid running Microsoft Find Fast (part of Office) and 3-dimensional screen savers that result in 100% CPU utilization. Some of the programs that you can consider ... Read More Source June 1st, 2014 No Comments # Using Apache Flood to test websites I only just learned about Flood. In the past I used ab, which is a severely limited tool, in that it only sends HEAD requests. What I have often wanted is a tool that was as simple as ab, but which could send parameters, make a GET request, and give me more feedback than CURL. The XML config for flood suggests it is nowhere as easy to use as ab, but it still looks fairly simple and it looks like ... Read More Source June 1st, 2014 No Comments # How does PHP work I like this graph about PHP execution. The white boxes show how things worked as long ago as PHP4 and the gray boxes show all the new and optional stuff: Source June 1st, 2014 No Comments # PHP and Squid This is interesting: Perhaps the most significant change to PHP performance I have experienced since I first wrote this article is my use of Squid, a web accelerator that is able to take over the management of all static http files from Apache. You may be surprised to find that the overhead of using Apache to serve both dynamic PHP and static images, javascript, css, html is extremely high. From my experience, 40-50% of our Apache CPU utilisation is in ... Read More Source June 1st, 2014 No Comments # Threads in a Unix process While doing research for the post I just wrote about Joe Watkins and threads in PHP, I came across this graphic, which I thought did a nice job of showing threads in a Unix process: Source June 1st, 2014 No Comments # Setup is hard, and it wastes an extraordinary amount of developer time I was just looking at this article, PHP with PHP-FPM, and it brought back memories of Timeout.com. All of the developers who worked at Timeout eventually had to set up the company CMS, and this was something of a hazing process, in that every developer later remembered the experience with dread. The CMS was a massive Symfony project — without question, the largest PHP code base I have encountered in 14 years of working with PHP. I’ll give you a ... Read More Source May 31st, 2014 No Comments # Using Xdebug to profile PHP Interesting overview of using Xdebug: I’ve sorted the execution time of each call in order to determine which calls are the most expensive. The call to the Default_Model_Platform model’s hot() method ranks up towards the top, and because I know this data changes only every few hours, now I can safely cache it and thereby eliminate this expensive database query (which is indeed a fairly large JOIN operation). After implementing caching I again profile the page and indeed have eliminated that ... Read More Source May 31st, 2014 No Comments # Do not ever use MemCache 6 tips about PHP performance: #1. Upgrade Your PHP Distribution #2. Use a Profiler #3. Tone Down Error Reporting #4. Take Advantage of PHP’s Native Extensions #5. Use a PHP Accelerator #6. Avoid Expensive Operations Through Memory Caching Missing from the list is “Ask yourself if PHP is the correct language for what you are trying to do.” I think of this especially in regard to the 6th tip, about memory caching. If you start using something like MemCache, then you ... Read More Source May 31st, 2014 No Comments # Why Joe Watkins is wrong about pthreads in PHP Over at Reddit Joe Watkins wrote about pthreads in PHP. Someone asks: Is there a facility to use thread-local storage? and Joe Watkins replies: The static scope of a class entry can be considered thread local, in a way. Complex members (objects and resources) are nullified when creating new threads, but simple members (arrays/strings/numbers/mixture of any of the above) are copied, so in the static scope can be class::$config which contains connection info to whatever and class::$connection can be the connection itself, ... Read More Source May 31st, 2014 No Comments # In PHP, the foreach() loop is a performance murderer I didn’t know this: Source May 31st, 2014 No Comments # Building a recommendation engine for one’s customers This is a great overview of building a prediction engine. Some of the math is over my head. Of these approaches, the only one I have the slightest familiarity with is cosine similarity. Source May 4th, 2014 No Comments # The further rise of polyglot programming Interesting: Almost every language shows a long-term downhill trend. With the exception of Java and (recently) CSS, all of these languages have been decreasing. This was a bit of a puzzler and made me wonder more about the fragmentation of languages over time, which I’ll explore later in this post as well as future posts. My initial guess is that users of languages below the top 12 are growing in share to counterbalance the decreases here. It’s also possible that ... Read More Source May 2nd, 2014 No Comments # Design by contract in Clojure I posted a comment here: I have gotten in the habit of doing 2 things: 1.) I used :pre and :post conditions as you are doing here 2.) I also use dire so when the :pre or :post conditions fail and an Assert exception is thrown, I can capture the arguments and the return value and write a meaningful error message: https://github.com/MichaelDrogalis/dire I do a lot of this: :post [(:discount %)] I also test for value ranges: :post [ (> (:totals %) 100) (< (:totals %) 1000) ] I am thinking I might ... Read More Source April 21st, 2014 No Comments # What is the correct way to handle errors when making HTTP calls? I like this: I wanted a simpler solution that: treated exceptions as exceptions was general enough to leverage clj-http exception gave informative error messages in the right place A quick side note on exceptions vs happy paths everywhere. Some will say a bad response isn’t an exception, but is something to be expected. I agree. This is something that should be handled at the app level though, and not the library level – if I get a 401 as an end user I expect to ... Read More Source April 21st, 2014 No Comments # The problem with frameworks This is funny: Let’s pretend I’ve decided to build a spice rack. I’ve done small woodworking projects before, and I think I have a pretty good idea of what I need: some wood and a few basic tools: a tape measure, a saw, a level, and a hammer. If I were going to build a whole house, rather than just a spice rack, I’d still need a tape measure, a saw, a level, and a hammer (among other things). So I go to ... Read More Source April 21st, 2014 No Comments # The system at Twitter This looks like a great talk about the system at Twitter: Late 2012 architecture Many open source components Memcache, redis, MySQL, etc. Necessarily heterogeneous Organized around services Distinct responsibilities Isolated from each other Distributed computation and data RPC between systems Multiplexing HTTP frontend Crucial for modularity, load balancing Programming the datacenter Concerns include Partial failures Deep memory hierarchies Split heaps Dynamic topologies Changes in variance, latency tails Heterogeneous components Operator errors Taming the resulting complexity is the central theme of our work. Source April 21st, 2014 No Comments # Clojure versus Erlang WhatsApp was recently bought by Facebook, for$19 billion. This is the first time a startup had a big success, using Erlang as the basis for all of its technology.

The most stable commercial computing device in history is a telephone switch developed at Ericson and built with Erlang. It can handle millions of simultaneous connections, it has 1.7 million lines of code, and it averages 1 hour of downtime every 20 years.

The one language I would like to learn, other ...

April 21st, 2014

# Fast setup with Vagrant and Ruby 2.0

This is a good overview:

How to do it:

download and install Vagrant – I use version 1.2.7 You can check that with:

vagrant -v

You should see:

Vagrant version 1.2.7

create a folder for your Rails application and go to it

mkdir rorapp cd rorapp

vagrant init precise32 http://files.vagrantup.com/precise32.box

This is your virtual machine (server) that will hold and run your Rails application. If you check now, Vagrant created a config file in your rorapp folder, called Vagrantfile. You’ll change that a little on next step. make ...

April 21st, 2014

# Formal proofs for software: prove small theorems, not grand ones

Interesting:

For “you can’t prove anything big enough to be useful!”, consider the Quark project:

http://goto.ucsd.edu/quark/

showed you don’t need to prove a program of interesting size. You can defend millions of lines of buggy code with a “software firewall” made of formally verified code. Verify the right thousand lines of code that the rest needs to use to talk to anything else, and you have very strong security properties for the rest of the code. seL4 and CompCert are clearly also quite useful programs.

… I don’t think the technology ...

April 18th, 2014

# Kill your process and restart it is still a popular hack in Ruby land

I find it surprising that this is still accepted as best practice in the Ruby community:

But it’s not all bad news. The Ruby core developers are aware of the problem, and there are some changes (3GenGC, oldgen space estimation) being tested which may bring relief. But right now, for users of Ruby 2.1, this is a very real problem that could easily affect you in production. What did we do? We used a combination of Unicorn::OobGC and unicorn-worker-killer to help tame ...

April 18th, 2014

# Vagrant is easy

This page offers a simple explanation of how to start using Vagrant:

Getting Vagrant started

Before you can run vagrant, you’ll need to download and install a few things:

The Vagrant tool – This is the actual vagrant tool itself. It manages virtual machines Virtualbox – Virtualbox is the virtual machine where your code will run If you have an app that already has a Vagrantfile in it, it’s very easy to get started. At the command line change into the folder with the ...

April 18th, 2014

# What is devops?

A devop is like a sysadmin, so why do we need a new word? Because of the new emphasis on automation:

A DevOps person isn’t someone who develops, and who does Ops. It’s someone who does only Ops, but through Development.

The last time I looked for a senior sysadmin — less than a year ago — I didn’t get anyone who was comfortable programming in Perl/Python/Ruby until I started using the term DevOps.

There are companies where the developers are ...

April 8th, 2014

# Forked processes, concurrency, and memory problems

Last week I expressed my doubts about Unicorn (and the idea that it uses processes, therefore it uses Unix, therefore it must be good). Here is another article that looks at Unicorn, and in particular the memory consumption that goes along with forked processes:

Unicorn uses forked processes to achieve concurrency. Since forked processes are essentially copies of each other, this means that the Rails application need not be thread safe.

This is great because it is difficult to ensure that ...

April 7th, 2014

# Yahoo has some very stupid programmers

Good lord, why is this developer at Yahoo so slow on the uptake?

Thank you for your submission to Yahoo! Unfortunately we are unable to reproduce the bug due to insufficient information. Please provide us with a proof of concept or any other additional evidence required to reproduce the issue.

** The attacker would have to know the invitation id correct?

One has the sense that the person reporting the bug is shocked by the lack of concern shown by Yahoo:

d4d1a179c0f3 changed ...

April 7th, 2014

# The Clojure workflow still suffers and the REPL is not a cure all

Stuff like this happens to me:

Here is a scenario that you might recognize. You’ve done a pretty substantial refactor, including new dependencies in project.clj. You need to bounce the REPL. Knowing that this will take forever you immediately switch to Prismatic. 15 minutes later you look at your Emacs again where you notice that there is a syntax error so the REPL didn’t launch. You parse the impossibly long stack trace and fix the bug. cider-jack-in again and switch back ...

April 6th, 2014

# Behavior driven development is broken

This is very good:

If it takes you ten lines to communicate the idea of adding subpages, then you’ve wasted my time. I’m not alone in thinking this. BDD expert Elizabeth Keogh tells us:

“If your scenario starts with ‘When the user enters ‘Smurf’ into ‘Search’ text box…’ then that’s far too low-level. However, even “When the user adds ‘Smurf’ to his basket, then goes to the checkout, then pays for the goods” is also too low-level. You’re looking for something ...

April 5th, 2014

# Why has Linux not seen more forks?

Strong language, and strong opinions, as always, from Linus Torvalds. Now that I think about it, isn’t it amazing that Linux remains stable, even after all these years. I remember someone predicting, years ago, that Linux would split apart into a million useless forks, just like Unix did a long time ago. But that never happened. There are a lot of distros, but the kernel remains 100% under the control of Torvalds. That must mean people trust him. And ...

April 4th, 2014

# Using Gloss to change bytes into Clojure data structures

Interesting:

I started creating a very simple protocol to allow clients to connect via telnet. So it is:

PUT LSA |*

We have two main commands, PUT and LSA. For PUT, author is the guy speaking, via is who noted it, and the fact is the statement itself. And for LSA command, you can pass the author’s name and the system will return all the facts spoken by the author. * means you want to read all the facts.

Any other command ...

April 4th, 2014

# Hashmaps versus btrees

Interesting:

Unsuprisingly, a hash map performs far and above the rest. This is to be expected, mapping is exactly what hash maps are for and, in most situations, they should perform insertions and lookups with amortized O(1) time complexity. However, for situations where you made wish to preserve order, a tree may be a better choice. For that, you can see that a well-tuned btree was outperforming a red/black tree by more than 2 times.

As memory architectures begin to behave more ...

April 4th, 2014

# Just Libraries – the composition of small apps

Clojure favors the composition of small apps. The Clojure community has shown a resistance to monolithic frameworks like Rails. Now Immutant is moving further down the small app road.

For its second major release, Immutant will simply be a collection of libraries, one for each of the commodity services currently available to applications using an Immutant 1.x container: web, scheduling, messaging, caching, and transactions. These services will be provided by the following underlying components: Undertow, Quartz, HornetQ, Infinispan, and Narayana, ...

March 31st, 2014

# The worst web site ever: healthcare.gov

What an incredible disaster. I say this as a professional who develops websites. Several states, such as Kentucky, built their own web sites, which have worked great. But the Federal site, even 6 months after launch, remains a disaster.

This is the error message I got when I just now tried to sign up:

Today’s the last day to sign up for Obamacare if you’re planning on using the healthcare.gov website. Unfortunately for people who tried to log onto the ...

March 31st, 2014

# Java 8 has an Optional to deal with NullPointerException

I don’t think I am impressed with this. The idea is borrowed from Scala. I have no love for Java or Scala, and I only follow Java because it impacts Clojure. If this enables Clojure to do something clever with NullPointerException, then maybe I will reevaluate this.

Source

March 31st, 2014

# Content Security Policy and Ruby and Clojure

Although I love Clojure, I must admit that Ruby and Rails have an impressive depth of gems to help with every aspect of web development, including security. John P Hackworth recently wrote of the weakness of the Clojure eco-system, although his criticism is also an attack on the whole of idea of “small libraries that compose well” which amounts to an attack on the idea of “small pieces, loosely joined”. Clearly, good security can be achieved with small libraries that ...

March 31st, 2014

# Using Clojure to build a microservices CMS

Many of us become cynical about technologies that promise big breakthroughs in productivity, so we become overly careful in our choices, but this is a good question for managers to always be asking:

“Why would a large organisation with a mix of technologies and legacy systems want to muddy the waters with a completely new language?”

If you want to make the conservative choice, and stick with what you already have, you should be able to articulate the reasons as clearly as ...

March 30th, 2014

# eat food for food in foods when food isnt ‘chocolate’

Of the many attempts to re-invent Javascript, the mostly puzzling to me are those that do not fix any problems, and then invents some more. I realize there is a strong desire to borrow ideas from Ruby and bring them to Javascript, but where one can’t do that cleanly, one shouldn’t do it at all.

It’s a tool, that is all. Ambiguous code is a poorly thought out contrived example with a simple solution. To me, this: eat food for ...

March 30th, 2014

# Chris Granger: more problems with object oriented programming

At this point the evidence against object oriented programming seems overwhelming. I’ve linked to many articles here on this blog. Chris Granger offers another take on this issue:

Programming is unobservable

We can’t see how our programs execute. We can’t see how our changes affect our programs. And we can’t see how our programs are connected together. That basically means we can’t observe anything. The state of the art in observability is a stepwise debugger, which forces us to stop the world ...

March 30th, 2014

# NoSQL is a new of doing things, not a drop-in replacement for SQL

I like this:

Both NoSQL and Erlang had a burst of use and interest but because they were seen as silver bullets. Soon people realized you couldn’t simply translate your imperative code to Erlang and see improvements but instead regressions. Additionally, throwing your relational data at a NoSQL databases caused the same.

I feel the NoSQL culture and programmers haven’t retracted to the core yet as much as Erlang. Though Erlang may see another surge of misuse and misinterpretation now with the ...

March 27th, 2014

# The advantages of Ruby on Unicorn

This is an interesting way to look at things. Since so much of Ruby code is not thread safe, the fact that Unicorn spins up processes that don’t talk to each other is the most safe way to get concurrency in Ruby. That is a good point, though it is equivalent to saying “Since the code is broken, the the application server to do something weird to compensate for the brokenness.” Clearly, some people have good results with this, though ...

March 27th, 2014

# More negative views about Rails

Rails lacks a story for concurrency. This is written by a Go programmer. Their criticisms are similar to mine, though for me the answer is “use Clojure” and so I end up doing JVM tuning, which is brought up as something scary to keep people away from jRuby. My impression is that the case against jRuby is weaker than the case against MRI Ruby (the C version).

Rails is fundamentally – and catastrophically – slow.

This well-known set of webapp ...

March 25th, 2014

# If Unix is good for Unicorn, why can’t Unicorn handle slow connections?

In what I now think of as a famous essay, Ryan Tomayko said “I like Unicorn because it’s Unix“. There must be something to this because the essay has been widely quoted, and I remember it, and I have re-read 3 times in the last 4 years. It had an impact.

And yet, nothing in it convinced me to adopt that model. I rejected it and went ...

March 24th, 2014

# Photon could save PHP

I have been extremely critical of PHP for the last 2 years. See “Why PHP is obsolete“. However, I just stumbled across Photon, which seems to address some of the core problems I see with PHP (especially the lack of any tools for dealing with concurrency):

Why targeting Mongrel2?

Mongrel2 is a very well designed, high performance server developed by pragmatic users who do not like bloated software. The use of ZeroMQ as the communication hub makes it extremely flexible while keeping ...

March 24th, 2014

# The tremendous innovation in Javascript

There is no question that tremendous innovation is happening in the vast extended eco-system that touches upon Javascript. Sadly, I am not much interested in it. Maybe that is because I am not focused on the frontend right now. But also because I’m interested in solving these issues in other ways. All the same, Sam Ruby’s walkthrough of Angular.js is interesting:

We have a model, view, and controller on the client, seemlessly interacting with the model, view, and controller on ...

March 24th, 2014

# Radical workarounds for the limits of MongoDB

Whoa. This gives me interesting ideas:

To reduce lock contention, we decided to run multiple MongoDB instances on one machine and create more granular databases in each instance. Basically data is stored in different instances based on its usage and in every MongoDB instance one database is created for each partner.

Some people hate the fact that MongoDB forces you to do more in your own app, but I prefer designing with those constraints in mind.

This has similarities to ...

March 24th, 2014

I feel like I’ve been away from HTML for awhile. 10 years ago I thought of myself as having some design skill, and I did a lot of front-end work, but in 2009, I moved to New York City and worked in some big companies with strict divisions of labor. I was a backender, and backenders are never frontenders. So I’ve been away from the frontend for awhile. It is slowly becoming foreign territory to me. I was surprised to ...

March 24th, 2014

# Why is the technology for blogs so difficult?

The web is broken and can never be fixed. The only way forward is to start over again, to get rid of the Internet Protocol, the Transmission Control Protocol and the Hypertext protocol, and to invent a new protocol that fixes the problems with the old protocols. I am doubtful this can be achieved.

Back in 2005, David Heinemeier Hansson offered a Rails tutorial showing how you could create a blog in 15 minutes

:

This was a world changing moment. ...

March 24th, 2014

# Once again, the shift to “smart services, dumb pipes”

Yesterday I linked to the article over at Martin Fowler’s website where he wrote about the shift away from complex routing frameworks, towards a system of “smart services, dumb pipes”. Here is one more data point:

At Digg our SOA consisted of many Python backend services communicating with each other as well as being used by our PHP frontend servers and Tornado API servers. They used Apache Thrift for defining the interfaces, clients and as the underlying protocol.

…Coming off the Digg ...

March 24th, 2014

# Often businesses handle a degree of inconsistency in order to respond quickly to demand

Perfect consistency is too rigid for most businesses, and it is painful when technical teams try to enforce this on a company, out of some ideological commitment to doing things the “correct” computer science way. “Eventual consistency” has been the standard that businesses have striven after since the Arab-Hindu cultures first invented dual-entry accounting, more than 500 years ago, and this is the standard that tech teams should enable for the businesses they serve.

Choosing to manage inconsistencies in this ...

March 24th, 2014

# What kind of standards are useful to your team?

I love this:

Its a bit of a diochotomy that microservice teams tend to eschew the kind of rigid enforced standards laid down by enterprise architecture groups but will happily use and even evangelise the use of open standards such as HTTP, ATOM and other microformats.

The key difference is how the standards are developed and how they are enforced. Standards managed by groups such as the IETF only become standards when there are several live implementations of them in the wider ...

March 24th, 2014

# The conceptual model of the world will differ between systems

Decentralization of data management presents in a number of different ways. At the most abstract level, it means that the conceptual model of the world will differ between systems. This is a common issue when integrating across a large enterprise, the sales view of a customer will differ from the support view. Some things that are called customers in the sales view may not appear at all in ...

March 23rd, 2014

# A complexity that is frankly breathtaking

How can anyone possibly think this is a good idea?

To quote James Lewis and Martin Fowler:

Certainly, many of the techniques in use in the microservice community have grown from the experiences of developers integrating services in large organisations. The Tolerant Reader pattern is an example of this. Efforts to use the web have contributed, using simple protocols is another approach derived from these experiences – a reaction away from central standards that have reached a complexity that is, frankly, ...

March 23rd, 2014

# The pushback against the monolithic framework

I am pleased to think that others are as ready as I am to abandon the concept of the monolithic framework:

Monolithic applications can be successful, but increasingly people are feeling frustrations with them – especially as more applications are being deployed to the cloud . Change cycles are tied together – a change made to a small part of the application, requires the entire monolith to be rebuilt and deployed. Over time it’s often hard to keep a good modular ...

March 23rd, 2014

# Leave the error checking in your code

I leave the asserts in my Clojure code. I see a similarity of spirit expressed in the sentiment of James Hague (I especially like the use of the word “reckless”):

That error checking is great during development was not controversial, but opinions after that were divided. One side believed it wasteful to keep all that byte and cycle eating around when you knew it wasn’t needed. The other group claimed you could never guarantee an absence of bugs, and wouldn’t ...

March 23rd, 2014

# A defense of MongoDB

I posted this on Hacker News and now re-post it here.

MongoDB offers the greatest benefit to those who have an evolving concept of their schema, and that tends to be startups, though I have worked in large firms that entirely re-invented their schemas. I worry that I would seem tedious if I listed the places that I have worked, and yet, on Hacker News, when I speak in abstract terms, I tend to get downvoted, so I will name a ...

March 21st, 2014

# Announcing Humorus-MG

I just released Humorus-MG. This is an admin CMS for managing a collection in MongoDB. The app is written in Clojure.

The README contains an unintentional mini-manifesto of what I believe about creating web software. This part in particular comes close to summarizing the kind of software that I would like to create this year:

—————-

1.) This app will never have more than 2,000 lines of Clojure code. None of my apps will ...

March 20th, 2014

# Why I use MongoDB

I posted this on HackerNews. I am in agreement with what Jun Xu wrote.

I think this is true:

“For a technology startup with limited resources, broadly adopting a new DBMS means betting its own future on the DBMS. ”

It has become popular to attack MongoDB, but I think it is difficult to get an objective view of what people are doing with it. If you want to read a really scathing attack on MongoDB, consider this post:

http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/

But I recall reading that ...

March 9th, 2014

# Criticker gives away all of its users passwords

Criticker gives away all of its users passwords in plain text. Of course the site is written in PHP. While you can make mistakes in any language, this kind of laziness is what you expect in PHP.

Every request contains the secret key in the url. So all I need to do is capture a single request sent by the app and I have the key. Easy.

My theory was that I’d get the list of users that the app had ...

March 8th, 2014

# Working with images using Clojure

I am intrigued by Mike Anderson’s “imagez” library:

Source

March 8th, 2014

# How to monitor Clojure apps?

Interesting:

Powerful stream primitives

(where (or (service #”^api”) (service #”^app”)) (where (tagged “exception”) (rollup 5 3600 (email “dev@foo.com”)) (else (changed-state (email “ops@foo.com”)))))

Riemann streams are just functions which accept an event. Events are just structs with some common fields like :host and :service You can use dozens of ...

March 8th, 2014

# How to bankrupt a successful software company

Interesting:

Quark 5 and OS9 was what we were used to, but it was pretty miserable. The things that stick out:

Restarting your computer and losing your unsaved work over software freezes was a regular part of your day. Like, many times a day. We had all these crazy workarounds to achieve certain effects like drop shadows or change-and-repeat. It was all pretty rudimentary and hard to standardize across many designers in a department. Shapes were pretty much a non-issue, so we had to ...

March 7th, 2014

# The downside of Unit Testing

Interesting:

I’m back in Java-land these days, which is culturally very pro-unit testing. After getting exposed to it again for a few months again I’ve come to side with the author here. I’ve never really been comfortable with the amount of time certain people dedicate to unit testing, especially the TDD crowd, but in my hiatus something has arisen in popularity which has made it all the worse: mockito. Prior to mockito, unit testing was (more or less) limited to testing that ...

March 4th, 2014

# Darren Holloway walks through the philosophy of Ring/Clojure

Darren Holloway has written a post that should be added to the wiki on Github where Ring is hosted. He covers all the stuff that had me the most confused when I started doing web development with Clojure. He offers easy examples in pseudo-code to get the basic ideas across. I wish every project on Github had an introductory tutorial written in this style.

An excerpt:

Ring Conceptually

Technically, Ring isn’t a framework or an application, but rather a specification ...

March 4th, 2014

# What it is like to think you are talented when you are ignorant

Despite the “worst practices” approach, the thing worked.

I like this story very much. My own story is a bit different, circa 2000-2005 I built a CMS out of PHP, and I did eventually find good ways to structure it, and I remain an opponent of “object oriented programming”. But other than that, a lot of this story overlaps my own.

Despite what I now refer to as my “worst practices” approach, the thing worked. Every bad tutorial, every anti-PHP ...

March 3rd, 2014

# Emotional intelligence and success with Bitcoin

Or rather, maladaptive ways to deal with stress:

After Mt. Gox was hacked for the first time in summer of 2011, a friend asked Powell to help out, and soon, the San Francisco entrepreneur found himself on a plane to Tokyo. After landing, he rushed to Shibuya station, where he was met by his friend, Roger Ver, one of the world’s biggest bitcoin supporters who just happened to live across the street from Mt. Gox. Without bothering to drop off ...

March 3rd, 2014

# The difference between database indexes and database histograms

Several things occurred to me when I read this, some of them off-topic, including my use of MongoDb, and how I have been unthinkingly re-creating histograms without even giving them that name. I do not regard that as a problem with MongoDb, it gives flexibility by doing very little itself, everyone using it is hopefully aware of the need to re-create database functionality within one’s own app.

Then I asked myself the question: how does Oracle estimate that there are ...

March 3rd, 2014

# I still don’t get PAAS

This is the problem for me:

In my ideal world, deploying my apps wouldn’t require any platform-specific code, or if it did, that code would be portable between platforms.

If I have to be aware of my servers, at all, then I’m still doing sysadmin, and if I have to do sysadmin, I want all the tools of sysadmin. I don’t want to do sysadmin on a crippled account that limits my options. Maybe someday there will be a real PAAS such ...

March 1st, 2014

# What is correct HTML syntax?

Matias Meno of Colorglare asks the question “TO CLOSE OR NOT TO CLOSE?”

This is from Ian Hickson in 2006, regarding the emergence of HTML5:

Regarding your original suggestion: based on the arguments presented by the various people taking part in this discussion, I’ve now updated the specification to allow “/” characters at the end of void elements.

To which Sam Ruby responded:

This is big. PHP’s nl2br function is now HTML5 compliant. WordPress won’t have to completely convert to HTML4 before people who ...

February 9th, 2014

# Bloated software promises a stability which might be a liability

Interesting:

IT organizations are facing accelerating pressure to support companies’ growing need for business agility, innovation, customer responsiveness, and adaptability. This pressure doesn’t stop with so-called systems of engagement. It goes all the way back to systems of record. In fact, the distinction between the two is starting to erode. Enterprises are responding to this pressure by upgrading application architectures within and around the system-of-record tier. They are starting to view the “stability” of their legacy applications as a liability rather ...

February 9th, 2014

# Drupal is bloated software

Stuff like Drupal offers ease of use for standard operations, and yet, when I work with clients, I find they have very few “standard” operations. Everything needs to be customized, and that is where Drupal becomes difficult:

Drupal, much like many other CMSs, follows a development methodology that I call reverse development. It is the simple idea that the most fundamental moving parts of the technology have been already built for you, or are modifiable using a trivial UI, and ...

February 9th, 2014

# What is a Spruce Goose software project?

I have worked on software that was just like this:

Now the Spruce Goose was trying to fly. People couldn’t take their eyes off it. Who could comprehend its size! Three hundred-foot wingspan, seven-story tail, 200 tons of plane with room for 700 soldiers. It upstaged even the ocean liners lounging nearby. There it was, $25 million worth of prototype seaplane, skating along toward take-off, engines cackling and fuming. Howard Hughes, America’s most publicized aviator, designed it, swore by it, ... Read More Source February 9th, 2014 No Comments # Getting useful info out of git logs Interesting: git churn It’s possible to get valuable insight from history of a project not only by viewing individual commits, but by analyzing sets of changes as a whole. For instance, git-churn is a simple but valuable script that wraps git log to compile stats about which files change the most. For example, to see where the development of an app was focused on in the past 6 months:$ git churn –since=’6 months ago’ app/ | tail Incidentally, such analysis also highlights ...

February 7th, 2014

# The most difficult thing about programming

Everything is working, then it breaks, and you never know why. The technologies we rely on are too numerous and complicated for us to understand them all — this is disempowering. I find this the most difficult thing about being a programmer: the surprise that even we can not understand all the technologies we use.

When I’d finished this article, I wanted to spell check the content. emacs-ispell mode decided to go on strike. It could not find aspell, the ...

February 5th, 2014

# Trying to use the Formative library

This is an interesting problem. I have records in a MongoDb database. Every record has a “created-at” field, stored as a datetime. This is a screenshot of the value:

When I load this value via into a form via Formative, all the values fill in except for the year. Check out the screenshot:

I wonder if this is a bug or if I have to reformat the datetime?

Source

February 5th, 2014

# Working with Clojure and Dire

Here is a puzzle. I had a function “fetch” in namespace “controller” and it calls a function in namespace “secretary”. The secretary stores documents away, and then later gets them back, or it might return nothing, if there is nothing to return. I have a query “paginate-items” which on some pages correctly returns nothing, because on some pages there is nothing to paginate. But this function has been giving me problems. I decided to split my “fetch” function into a ...

February 4th, 2014

# Git is complicated because there are 5 places content can go

Interesting:

Why do these Places Exist? These places are part of the power and flexibility of Git over other systems.

With an index, we can choose how to commit a multitude of changes, without having to commit to all our changes at once. This is a great flexibility. With the local repository versus the remote repository, we turn Git into a distributed version control system, where each repository is conceptually just as equal to the next one. With stash, ...

February 3rd, 2014

# Lisp as a mathematical formalism for recursive functions

Very interesting:

One of my favorite classes in school was 15-453: Formal Languages, Automata, and Computation, which used Sipser’s Introduction to the Theory of Computation:

One aspect that I really enjoyed was that there was a narrative; we started with Finite State Automata (FSA), analyzed the additional power of Pushdown Automata (PDA), and saw it culminate in Turing Machines (TM). Each of these models look very similar and have a natural connection: they are each just state machines with different types ...

January 28th, 2014

# Mistakes that startups make

This reminds of the change between Symfony 1.x and 2.0:

The first mistake was made about 3 years ago, when we started building a new product, LiveRebel. When making the choice of technology we decided on the new web application framework Play, which fitted most of our development requirements very very well. Of course 6 months later Play committers made a decision to completely break backwards-compatibility for Play 2. So we were stuck with a technology that had an uncertain ...

January 23rd, 2014

# Why PHP is obsolete

I was a huge fan of PHP back in the year 2000. I started using it right before the official release of 4.0 in April of that year. At that time, if you wanted to build a website, the main alternatives were C, Java, Perl and ASP. My criticism of those 4 were:

1.) C — too complicated for a fast changing website. Compiling an app took time, compiling was slower back then, there were fewer Open Source tools, and ...

January 23rd, 2014

# A language non-programmers praise while getting drinks at a bar

Interesting:

When out with friends recently, one of them mentioned how awesome Julia is. I was surprised to hear someone talk about it, even from another person in science. She turned and gushed about how awesome it was, how supportive the community was, even though she was “not really someone who likes programming.” And she liked it so much she was telling her friends about it at a bar!

If you make a programming language that people who don’t like programming love ...

January 20th, 2014

# No one reads anyone else’s code for fun

Interesting:

First, when I did my book of interviews with programmers, Coders at Work, I asked pretty much everyone about code reading. And while most of them said it was important and that programmers should do it more, when I asked them about what code they had read recently, very few of them had any great answers. Some of them had done some serious code reading as young hackers but almost no one seemed to have a regular habit of reading ...

January 17th, 2014

# The argument against type hinting in Clojure

Intersting:

But it doesn’t hurt, does it? So one might think: “It doesn’t help, but it doesn’t hurt either, so I sprinkle hints all over the place to give myself some info on what this function returns.” And indeed this thinking is wrong. By now it should be clear that type hints are a low-level construct. Using them in the above mentioned way over specifies the types the functions take and return. You basically lock the code which could in theory be ...

January 17th, 2014

# Aliases for namespace qualified keywords in Clojure

Interesting:

However what happens if two libraries modify the same map? On the same key? Then we are in trouble, because one overwrites the other. To remedy this issue, Clojure provides (similar to Symbols) namespace-qualified keywords. Simply add a double-colon in front and the keyword will be qualified with the current namespace. user=> ::foo :user/foo Using the fully-qualified form, we can create keywords with an arbitrary namespace. user=> :my.company.division.project.module-a/keyword :my.company.division.project.module-a/keyword So we can communicate with a library using its own qualified keywords. The library can then ...

January 17th, 2014

# Why are forums so badly designed?

This is ugly. I wonder why, since the 90s, forums have always had such awful graphic design?

Source

January 14th, 2014

# The awful magic syntax of Scala

Interesting:

Magic Syntax Over the years I’ve found that the easiest programming languages to get started with are those with the ‘simplest’ syntax. Simplicity is a hard thing to define, but in this case it is not the same as flexible. It’s actually closer to regular, or limited with extension options. I’ve found Lisp, Ruby and HyperTalk to be great examples. I’ve found AppleScript and Perl to be terrible.

Scala is easily the worst I’ve seen. That punctuation-strewn build system I was forced ...

January 12th, 2014

# Your app is not real time if anything blocks

Interesting:

(My background: I work for Google, I did a real-time web prototype using the client libraries for GChat back in 2009 when real-time search was all the rage, my Noogler mentor at Google was the frontend tech lead for the eventual real-time search product we launched, and before Google I’d worked in financial software, where real-time responsiveness really is required.) I think that the folks currently building prototypes in Meteor dramatically underestimate the difficulty of scaling up real-time software to production-grade ...

January 11th, 2014

See screenshot. I was served the same ad 3 times on 1 page. This has to be a broken ad technology, yes? This cannot be deliberate: that would be idiotic.

Source

January 8th, 2014

# Functional programs are much more readily appreciated as mathematical objects

Interesting:

I write to you because of a rumor of efforts to replace the introductory programming course of our undergraduate curriculum the functional programming language Haskell by the imperative language Java, and because I think that in this case the Budget Council has to take responsibility lest the decision be taken at the wrong level.

You see, it is no minor matter. Colleagues from outside the state (still!) often wonder how I can survive in a place like Austin, Texas, automatically assuming ...

January 6th, 2014

# Deploying Clojure to production

This is a very interesting architecture for Clojure:

And this is an interesting bit of deploy info:

#!/bin/bash

set -u # Treat unset variables as an error set -e # Exit immediately if a simple command exits with a non-zero status

APP_HOME=/var/www/rssminer cd $APP_HOME INDEX_PATH=/var/rssminer/index TMP_INDEX_PATH=/var/rssminer/index2 LOG_DIR=/var/log/rssminer sudo mkdir -p$LOG_DIR && sudo chown deploy $LOG_DIR PER_MONGTH=date +”%Y-%m” # year-month- SHARED=”${LOG_DIR}/${PER_MONGTH}” nohup java -server -Dsun.jnu.encoding=UTF-8 ... Read More Source January 5th, 2014 No Comments # What are the advantages of functional programming? On Hackers News someone asked if those of us working with Clojure missed Object Oriented programming (OO). I responded: Short answer: no. Longer answer: an argument can be made that OO is a proven failure, and that there exists 40 years of evidence that OO is a failure. I will start by talking about the general case, and then I will narrow my remarks to the web, since that is what you are asking about. The least charitable way to describe OO is this: ... Read More Source January 4th, 2014 No Comments # The end of the HTML/CSS guru I am actually surprised this lasted so long. I switched to CSS in 2000. But apparently what mattered was not the practitioners, but the browsers themselves: once they unified on standards, the need for specialists disappeared. The reason the Web Standards Movement mattered was that the browsers sucked. The stated goal of the Movement was to get browser makers on board with web standards such that all of our jobs as developers would be easier. What we may not have realized ... Read More Source January 3rd, 2014 No Comments # Where Google fails at search Martins Programming Blog says there is a post on Hacker News with the title “Why is Clojure so slow?” So I run this search on Hacker News: “Why is Clojure so slow” site:news.ycombinator.com I get 9 pages of results, and none of them point me to the article. Source January 2nd, 2014 No Comments # Why git won as a distributed version control system Interesting: The third problem was Bazaars stance on completely immutable history. Software developers aren’t historians or lawyers. A lot of users were keen to keep their history simple. They cared about tracking what changes had happened to their trunk and having that sequence of changes be legible, not really about the individual commits and mistakes that led up to the patch that landed on trunk. Git offered “rebase”, which basically reapplies local changes on top of the upstream tree. Git is ... Read More Source December 31st, 2013 No Comments # Kill processes running on a certain port This is clever: searchAndDestroy() { lsof -i TCP:$1 | grep LISTEN | awk ‘{print $2}’ | xargs kill -9 echo “Port”$1 “found and killed.” }

Source

December 29th, 2013

# How to listen for the delivery of a promise in Clojure

The problem:

add-watch was alpha in Clojure 1.2:

it is still alpha now, in Clojure 1.5:

I am curious what the plan is for add-watch?

http://nurkiewicz.blogspot.com/2013/03/promises-and-futures-in-clojure.html

and this struck me:

And here is where the greatest disappointment arrives: neither future nor promise in Clojure supports listening for completion/failure asynchronously. … As much as I love Clojure concurrency primitives like STM and agents, futures feel a bit underdeveloped. Lack of event-driven, asynchronous callbacks that are invoked whenever futures ...

December 29th, 2013

# The lack of future listeners in Clojure

Interesting:

Futures behave pretty much the same way in Clojure from user perspective – they are containers for a single value (of course it can be a map or list – but it should be immutable) and trying to dereference future before it is resolved blocks. Also just like promises, futures can only be resolved once and dereferencing resolved future has immediate effect. The difference between the two is semantic, not technical. Future represents background computation, typically in a thread ...

December 28th, 2013

# How to reload an app in the REPL with Clojure

I have been working with Clojure now for much of the last 18 months, so I am no longer a complete noob. But I was slow to get used to working at the REPL. Working with the REPL is taken for granted in the Clojure community, so much so it is tough to find step-by-step instructions for doing it. For me, a confusing issue for a long while was, if I wanted to get back into an app, what are ...

December 27th, 2013

# Clojure is concise

So now I have a working, multi-threaded CMS, written in Clojure, and it has less than 1400 lines of code. This is a beautiful language.

Source

December 25th, 2013

# Dependency Injection is more important than dependency injection frameworks

Interesting:

I was one of the earliest adopter of Spring in Norway. We developed a large system where we eventually had to start thinking about things like different mechanisms for reuse of XML configuration. Eventually, this evolved into the @Autowire and component-scan which took away the problem with huge configuration files, but in return reduced the ability to reason about the whole source code – instead isolating developers in a very small island in the application.

The applications tended to blossom in ...

December 25th, 2013

# The rise of the algorithm economy

Interesting:

They seem to agree on one thing: from a workaday perspective, math is essentially useless. Lisp programmers (we are told) should be thankful that mathematics was used to work out the Lambda Calculus, but today mathematics is more a form of personal enlightenment than a tool for getting anything done.

This view is mistaken. It has prevailed because it is possible to be a productive and well-compensated programmer — even a first-rate hacker — without any knowledge of science or ...

December 25th, 2013

# Why Scala should be outlawed

Wow:

/** * Join 22 futures. The returned future is complete when all * underlying futures complete. It fails immediately if any of them * do. */ def join[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V](a: Future[A],b: Future[B],c: Future[C],d: Future[D],e: Future[E],f: Future[F],g: Future[G],h: Future[H],i: Future[I],j: Future[J],k: Future[K],l: Future[L],m: Future[M],n: Future[N],o: Future[O],p: Future[P],q: Future[Q],r: Future[R],s: Future[S],t: Future[T],u: Future[U],v: Future[V]): Future[(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V)] = join(Seq(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v)) map { _ => (Await.result(a),Await.result(b),Await.result(c),Await.result(d),Await.result(e),Await.result(f),Await.result(g),Await.result(h),Await.result(i),Await.result(j),Await.result(k),Await.result(l),Await.result(m),Await.result(n),Await.result(o),Await.result(p),Await.result(q),Await.result(r),Await.result(s),Await.result(t),Await.result(u),Await.result(v)) }

Source

December 25th, 2013

# When programmers say “types” what do they mean?

Interesting:

What To Know Before Debating Type Systems I would be willing to place a bet that most computer programmers have, on multiple occasions, expressed an opinion about the desirability of certain kinds of type systems in programming languages. Contrary to popular conception, that’s a great thing! Programmers who care about their tools are the same programmers who care about their work, so I hope the debate rages on.

There are a few common misconceptions, though, that confuse these discussions. This article ...

December 25th, 2013

# Music is training for concurrent programming

I suspect music is the best training for concurrent programming. This is interesting:

Rich Hickey Q&A by Michael Fogus Best known as the inventor of Clojure, a Lisp that runs on the Java Virtual Machine and the first new member of the Lisp family to attract any widespread interest since Scheme and Common Lisp, Rich Hickey has been a software developer and consultant for two decades. Prior to starting work on Clojure, he made four attempts to combine Lisp with either Java or ...

December 25th, 2013

# What I learned from Clojure

Someone on Hacker News asked “Why use Functional Programming”. I wrote this in response:

I don’t have an answer for you, but for the last year I have been learning Clojure, and I have found it fascinating. I do not think this will satisfy you, but I would like to share some of the things that I find interesting about Clojure.

Lately I’ve been studying the source code of Aleph, a web server written by Zach Tellman. Zach is a very ...

December 24th, 2013

# This is why Rails sucks

50 minutes of Yehuda Katz talking about Rails. He says he wants to answer the accusation that there is too much bulk in Rails. He argues that much of that bulk is doing important stuff that you don’t know about, and that if they do their jobs intelligently, as designers of a framework, you should never have to think about all the cool stuff that the code is doing for you, but that you should be grateful that all that ...

December 21st, 2013

# How to organize namespaces in Clojure?

This is good:

You can think of namespaces as a tool to express something about your application. Here are some ideas to get you started:

Group functions into namespaces based on type of data they manipulate. For example, functions to manipulate customer data go in the “customer” namespace. This technique is familiar from object-oriented languages, but it has the same limitations: where do you put functions concerning relationships among two or more types? The OO answer would be to make a new ...

December 19th, 2013

# Contract programming in Clojure

I’ve been drifting toward a contract style in my Clojure code. Among other things I’m discovering along the way, I’ve been rethinking the need to be clear about arguments to function. This used to seem like the Right Way:

December 17th, 2013

# The marriage of math and computers

Amazing:

On last Thursday at the Heidelberg Laureate Forum, Vladimir Voevodsky gave perhaps the most revolutionary scientific talk I’ve ever heard. I doubt if it generated much buzz among the young scientists in advance, though, because it had the inscrutable title “Univalent Foundations of Mathematics,” and the abstract contained sentences like this one: “Set-theoretic approach to foundations of mathematics work well until one starts to think about categories since categories cannot be properly considered as sets with structures due to ...

December 14th, 2013

# Can we avoid firewalls by re-using obsolete ports?

Port numbers under 1000 tend to be associated with essential network services, so these are the least likely ports to be restricted by firewalls, yes? I am looking through the list of unix network socket ports on Wikipedia.

I am intrigued by the number of lower port numbers that seem to be available because their original official use has gone obsolete.

For instance: http://en.wikipedia.org/wiki/Xerox_Network_Systems

had ports 52, 54 and 58. Current status:

“Last used by Xerox for communication with the DocuTech 135 Publishing System, ...

December 14th, 2013

# When will media companies understand technology?

The big media event today is Beyonce’s new video. So of course, the server is down? The error is a WordPress error. When do media people learn how to use software and servers to handle big spikes in traffic?

Source

December 13th, 2013

# The heyday of unix

Usually when something is at its peak its victory seems so natural that no one really appreciates it in the moment. It is worth noting that Microsoft lost momentum with developers at some point in the period 2000 – 2005, and this has lead to the heyday of Unix, mostly Linux. All of the competitors are dead. I am not sure what comes after Unix, but it is noteworthy how much it dominates the landscape for applications that do not ...

December 9th, 2013

# Find all field names in MongoDb

I am switching from PHP/Mysql to Clojure/MongoDb. In Clojure, hyphens in names are more idiomatic than underscores. So I wanted to find all the field names, so I could see where the underscores were. Having done a straight import of all of my database tables into a single MongoDb collection, I ran this Javascript at the Mongo shell to get all the field names.

var arrayOfFieldNames = [];

var items = db.tma.find();

while(items.hasNext()) { item = items.next(); for(var index in ...

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 ...

September 11th, 2013

# History seems to have favored the run-time checks plus the process approach to fault-containment

My god, what is wrong with the tech industry? Apparently the problems with object oriented programming and static type enforcement were well known many decades ago, and yet we are still fighting these awful ideas.

This is amazing, considering how long ago it was written:

There is considerable controversy about how to modularize software. Starting with Burroughs’ Espol and continuing through languages like Mesa and Ada, compiler writers have assumed perfect hardware and contended that they can provide good isolation ...

September 10th, 2013

# The security system depends on limited knowledge of internal names

Interesting:

We require that the names of processes are unforgeable. This means that it should be impossible to guess the name of a process, and thereby interact with that process. We will assume that processes know their own names, and that processes which create other processes know the names of the processes which they have created. In other words, a parent process knows the names of its children.

In order to write COPLs we will need mechanisms for ﬁnding out the names ...

September 10th, 2013

# Concurrency oriented programming languages

Interesting:

Characteristics of a COPL

COPLs are characterised by the following six properties:

1. COPLs must support processes. A process can be thought of as a self-contained virtual machine.

2. Several processes operating on the same machine must be strongly isolated. A fault in one processe should not adversely ecect another process, unless such interaction is explicitly programmed.

3. Each process must be identiﬁed by a unique unforgeable identiﬁer. We will call this the Pid of the process.

4. There should be no shared state between ...

September 10th, 2013

# A Lisp love letter

All of this sounds fascinating:

Fluchtpunkt Lisps

The German school of Lisp is described by Kazimir Majorinc as a Spartan movement13 in Lisp implementation.14 While I can agree with this categorization, I think that there’s more to the German school than just one aspect. In fact, I would say that to meet the criteria of the German school, a Lisp must take a philosophical stand in its implementation.

I’d like to propose a new term for the kinds of Lisps that fall into ...

September 1st, 2013

# The best beginner’s tutorial for Enlive

Bridesmere post’s the best tutorial for folks just starting with Enlive:

When using Enlive, it’s helpful to know that the library generally uses an internal data structure representation of HTML (called nodes in the documentation). Most functions and macros operate on and return nodes, or collections of them; a few return strings, which you need in order to render the HTML to the outside world (in my case when defining Compojure routes).

The simplest thing we can do is read in an ...

August 25th, 2013

# Ian Hickson is always wrong about everything

Ian Hickson is one of the great failures of the tech industry. He appears to be wrong about every single issue that he has an opinion on. He appears to belong to a particular tribe, the tribe know as “Very smart men who admire how smart they are and who are wrong about everything”. Steve Ballmer and Larry Summers are also proud members of that tribe.

Source

August 24th, 2013

# An intro to macros

Interesting:

For extra credit, let’s take a bigger example in the same vein as our custom ifWorkday. I am making a game, and in it, I want an easy abstraction that gives me back one of several options with a custom percent chance. Ideally, something like

(if25 (doFirst) (doSecond))

where the number corresponds to the percent chance that the next item will be executed and returned. In this example, (doFirst) will only happen 25% of the time and (doSecond) 75% of the time. ...

August 8th, 2013

# Programming languages do not influence thinking?

I find this amazing:

Perhaps PHP’s idioms and influences of style can account for an application’s charmlessness? Well, such idiomatic arguments are dangerously close to aesthetic ones; besides, I have little truck with even weak versions of Whorfianism, especially when it comes to a deliberate intellectual exercise like programming.

Wow. I truly have trouble imagining how someone can possibly believe what is said in these sentences. When it comes to human spoken languages, we could debate Whorfianism, but in programming languages? ...

August 8th, 2013

Interesting.

Source

August 6th, 2013

# How to deal with the “copy” command when someone aliases it

I just had this exact problem, and the solution is good to know:

cp is non-interactive by default so a lot of people, myself included, set an alias to include the -i flag so that cp was interactive by default.

alias cp=cp -i But I used to enjoy the fact that if I set this alias it would prompt me when overwriting files but if there was a situation where I wanted it to be non-interactive I could do that by specifying -f. ...

August 5th, 2013

The casual reference to Java here tells you everything about where the core team wants to (stupidly) take PHP:

Synchronization: All of the objects that pthreads creates have built in synchronization in the ( familiar to java programmers ) form of ::wait and ::notify. Calling ::wait on an object will cause the context to wait for another context to call ::notify on the same object. This allows for powerful synchronization between Threaded Objects in PHP.

Wait, Threaded Objects ? A Stackable, ...

August 3rd, 2013

# Visualizing Alexander Grothendieck

Kind of amazing:

Starting in the 1950s, Alexander Grothendieck revolutionized math by introducing many new concepts: schemes, stacks, motives, topoi and more. He wrote over 6000 pages! And then, after many quarrels with the mathematical establishment of France, he disappeared into the Pyrenees, where he now lives in seclusion.

The Stacks Project is an open-source reference book with many authors which aims to explain a lot of the math Grothendieck and his collaborators created. It’s currently 4000 pages ...

August 3rd, 2013

# Is Apache faster than Nginx?

This guys says that once he turned off Allow_Override, Apache became faster than Nginx.

Source

August 3rd, 2013

# Switching from Unix Sockets to TCP/IP in Nginx

Excellent article:

PHP-FPM: Socket vs TCP/IP and sysctl tweaking In our entire WordPress-Nginx series we have used sockets for FPM (in between Nginx & PHP).

Sockets are slightly faster as compared to TCP/IP connection. But they are less scalable by default.

If you start getting errors like:

connect() to unix:/var/run/php5-fpm.sock failed or **apr_socket_recv: Connection reset by peer (104)**(as faced ovidiu here)

Then it means you need to either switch to TCP/IP or tweak with linux-system parameter so that your OS can handle large number of ...

August 3rd, 2013

# Setting up Nginx to work over a Unix file socket

This is the best article I’ve ever read on setting up Nginx.

Preface : To begin and preface this article, this is the exact stack that I am running and I have set this up on a Rackspace Cloud Server. So I know that it is portable and will work on a multitude of different environments. Secondly I know that it works, I know this because the article you are reading was published on a site using it. Furthermore, I have ...

August 2nd, 2013

# Dynamically mapping requests to work processes

Damn, this is way over my head:

BLENDER OVERVIEW Blender is a Thrift and HTTP service built on Netty, a highly-scalable NIO client server library written in Java that enables the development of a variety of protocol servers and clients quickly and easily. We chose Netty over some of its other competitors, like Mina and Jetty, because it has a cleaner API, better documentation and, more importantly, because several other projects at Twitter are using this framework. To make Netty work with ...

August 2nd, 2013

# What is Clojure Expresso for?

I have never done logic programming so I have probably missing the obvious. I see this:

symbolic expression manipulation with expresso Expresso expressions are clojure s-expressions. Even if expresso can use custom types to better represent for example poynomials internally they will implement ISeq so that they can be used like regular s-expressions in every regard.

I mostly think of manipulating s-expressions in the context of macros. Is there another reason to do this?

Source

August 1st, 2013

# Undefined method render’ for SomeTemplate

I was given the task of upgrading our internal wiki from Redmine 1.1 to Redmine 2.2. I ran into a bug:

undefined method render’ for burndown_charts

This was 2 months ago. I searched all over the internet for info on this and found very little. But I now notice that Taryn East has run into exactly the same problem:

I recently had to scratch my head over a strange exception message I’d never seen before:

undefined method `render’ for # The problem was, it ...

July 30th, 2013

# Licklider on April 25th, 1963: an intergalatic network of computers

It is amazing to see the tentative outlines of the Internet as they first begin to appear:

Dictating the foregoing paragraph led me to see more clearly than I had seen it before that the problem of achieving homogeneity within a set of correlated languages is made difficult by the fact that there will be, at a given time, only one time-sharing system in operation on a given computer, whereas more than one programming language with its associated debugging language may be simultaneously in use. The time-sharing control ...

July 30th, 2013

# An architecture of small apps

I am currently working at a well known magazine company. For their website we use a monstrous PHP/Symfony CMS which we call “megatron”. There has been some discussion about adopting a better architecture. The current system is very slow: it takes an average of 10 seconds to render a page. The North American websites for this company get 23 million page views a month. We rely on several cache strategies, including Varnish and also the built-in cache system that is ...

July 29th, 2013

# When I buy a desktop, I want it to *be* a desktop… not a iPad.

I love this line:

To sum up my experience: when I buy a desktop, I want it to *be* a desktop… not a iPad.

A good post by Taryn East:

For some time now my ageing (and now quite flaky) Macbook Pro has been running Lucid Lynx (an older version of Ubuntu). I’ve been biding my time and avoiding upgrading since, well, April 2010, I guess.

For most of the time it was because upgrading your only machine that you rely on for ...

July 29th, 2013

# The true problem with git

This is really the core problem with git:

Do not rebase commits that you have pushed to a public repository.

If you follow that guideline, you’ll be fine. If you don’t, people will hate you, and you’ll be scorned by friends and family.

When you rebase stuff, you’re abandoning existing commits and creating new ones that are similar but different. If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with git ...

July 29th, 2013

# Talking Points Memo: Twilight Of The CMS

Back in 2011 Talking Points Memo Labs posted an essay about the problem with the monolithic CMS, as an architecture for software. I liked this essay very much and I sent the URL to many people. But late in 2012, Talking Points Memo moved to new servers, and apparently none of the Lab essays were ported to the new servers. I have written to Talking Points Memo several times about this. At first they said this was a temporary issue, ...

July 24th, 2013

Ruby Glasses sends me to a post about Yammer. I’m now working a contract gig at Timeout.com and the tech team uses Yammer to chat about tech news. So I was interested in the article. I also posted the article to Yammer, so the rest of the tech team would see it.

Taryn East picked 2 very good quotes out of the article:

Highlights for me:

Yammer’s biggest rule of thumb is “2 to 10 people, 2 to 10 weeks,” ...

July 24th, 2013

# How to become amazing on FourSquare

I am working on FourSquare integration for Timeout.com. I just put the app on my phone and checked in. I found some great tips about what to do and what not to do:

Foursquare Number Crunching Learn these rules if you want to succeed in the game of Foursquare! Whether you play for points, badges or mayorships, these rules should give you a better understand about how the game/social network works!

2 Check-ins – Each new venue requires a minimum of 2 check-ins ...

June 28th, 2013

# Lisp for the individual genius who can not work with others

Interesting:

The Lisp Curse does not contradict the maxim of Stanislav Datskovskiy: Employers much prefer that workers be fungible, rather than maximally productive. Too true. With great difficulty does anyone plumb the venality of the managerial class. However, the last lines of his essay are problematic. To wit:

As for the “free software” world, it eagerly opposes industrial dogmas in rhetoric but not at all in practice. No concept shunned by cube farm hells has ever gained real traction among the ...

June 28th, 2013

# Simplicity is only bad if it limits flexibility

Robin Ward wants us to think that EmberJs is better than AngularJs. He writes a very long post full of examples, and yet, strangely, when I was done reading it, I was ready to believe that Angular is better than Ember.

This is the first thing they wrote that I disagreed with:

A few years ago, many Rails developers I knew were excited about Sinatra. Sinatra is far simpler than Rails. It allocates a fraction of the objects Rails does. ...

June 28th, 2013

# Clojure solves the inversion-of-control problem

Interesting:

The emphasis on concurrency via shared, immutable data promotes standard, dynamic methods for libraries and functions to interact. Since a user can trust that data is immutable and reliable, there is no need for things like defensive copying as is standard practice (or should be) in multi-threaded object systems like java. It’s simply not easy or expedient to go out of your way to destroy someone else’s data. This trust in data integrity coupled with the syntactic ...

June 28th, 2013

# The engineering architecture design builder facade factory aggregator anti-pattern builder pure contract pattern structure failure

Funny:

Structure Every entity (Object, Class, whatever) should consist of at least three classes:

An Interface. An Implementation class (there should be at most one implementation class per interface). A Factory used to create the implementation. This should be a substitute for the implementation class’s public constructor. Further suggestions include:

Rather than a single interface, consider creating a deep hierarchy of interfaces. Have a few classes named things like FooVisitor, BarAdapter, and BazProxy. But remember: this means you should also have, for example, an BarAdapterFactory and BarAdapterImpl, ...

June 19th, 2013

# Social Networks of the American Revolution

Interesting:

Rest assured that we only collected metadata on these people, and no actual conversations were recorded or meetings transcribed. All I know is whether someone was a member of an organization or not. Surely this is but a small encroachment on the freedom of the Crown’s subjects. I have been asked, on the basis of this poor information, to present some names for our field agents in the Colonies to work with. It seems an unlikely task.

If you want to ...

June 3rd, 2013

This is an important tip about ssh and Github. I redid my ssh keys like 5 times before I finally found out what the real problem was.

A common mistake is cloning using the default (HTTPS) instead of SSH. You can correct this by going to your repository, clicking the ssh button left to the URL field and updating the URL of your origin remote like this:

Source

May 28th, 2013

# Why use the REPL when doing Clojure development?

This conversation is good. Some highlights:

There are two phases which seem, in java land at least, to get conflated.

1. Poking an API to learn it’s capabilities and behaviour. 2. Writing tests to prove the correctness of your use of the API.

These are quite different phases, each important in their own way

1. is the ‘kicking the tyres’, open the bonnet, boot etc when you’re looking at car to see if it’s what you want to buy.

2. is the MOT, looking at ...