May 2011
30 posts
1 tag
April 2011
37 posts
1 tag
Alter-ego: J2D2
Just thought I should let you know, if you see ‘j2d2’ follow you, that’s me. It’s my nonrobotic, alter-ego on tumblr.
wanna take a look?
1 tag
Differences between Node.js and Erlang →
I was inspired by a tweet from Chris Dixon to find some data comparing Erlang and Node.js. I find the data interesting, so I’m posting it here too.
The basic idea is to compare Node.js’s performance against another asynchronous system, Erlang. Erlang is the reigning concurrent networks and some folks from the Node.js have been making some fishy claims about how “I/O has been...
1 tag
4 tags
ZeroMQ: Super Sockets
I spoke about ZeroMQ to NYCPython tonight as part of a PyCon 2011 recap.
Thank you to Spotify for hosting the event!
Follow up links
My simple ZMQ examples
0MQ Guide
PDF of slides, in case Flash isn’t working for you.
1 tag
Parsing is hard; let’s go shopping.
– Jorge Ortiz (@jorgeortiz85)
1 tag
1 tag
The hardest thing is to go to sleep at night, when there are so many urgent...
– Donald Knuth
3 tags
j2player →
First, you should try it! No guarantees it works outside Chrome or iPhones yet…
Motivation
I spend most of my time building server’s and only occasionally do I hack on frontend stuff. Yet, I find interface design so interesting.
To satisfy some of my design curiosities I’ve been teaching myself Javascript and building a music player to reinforce my knowledge. I’m...
1 tag
2 tags
1 tag
2 tags
Simple example of function composition in Haskell
I’m watching A Taste Of Haskell by Simon Peyton Jones. One of the features he talks about, function composition, resonated with me as a useful example of how functional programmers think about problems.
Function composition is important to functional programming languages because it lets us put functions together, to get a desired result, and none of the linked functions require storing...
1 tag
Scale Fail
nosql:
Josh Berkus:
Better than MongoDB is Web scale.
Original title and link: Scale Fail (NoSQL databases © myNoSQL)
HA
1 tag
Computer science also differs from physics in that it is not actually a science....
– Richard Feynman, Feynman Lectures on Computation, 1970
2 tags
Brene Brown: The power of vulnerability
2 tags
Instantiating AWS Micro Instances with Erlang
After writing a lot of Python code recently, I’ve been wanting to work in another language for a few days. It’s a bit like a mental vacation, if you pick the right language to play with.
I chose the black sand beaches of Erlang.
About The Code
The idea is to simply connect to Amazon’s API and request some number of AWS micro instances be instantiated. Most of Amazon’s...
5 tags
Matt Spitz from Meebo discusses the benefits of using coroutines to build massively concurrent web applications.
I really dig coroutines. Brubeck, my web framework, uses at least three coroutines for handling each web request. Microarmy also uses coroutines to parallelize each SSH request.
When I use coroutines, I typically also use a scheduler and my coroutines are usually implemented as...
1 tag
"Errors" On Floating Point Calculations
Thank you to everyone who pointed out that the code in the last post is not showing errors, but is instead showing how floating points numbers actually work.
The inspiration for the post came from Ronald telling me that one of javascript’s most reported bugs is that 0.1+0.2 does not equal 0.3. This link suggests Douglas Crockford himself made that claim while also insisting Javascript made...
1 tag
A bunch of floating point errors
Python
$ python
>>> 0.1 + 0.2
0.30000000000000004
Javascript
$ node
> 0.1 + 0.2
0.30000000000000004
Ocaml
$ ocaml
# 0.1 +. 0.2;;
- : float = 0.300000000000000044
Java
Code
public class FPError {
public static void main(String args[]) {
System.out.println(0.1+0.2);
}
}
Running it
$ javac FPError.java
$ java FPError
0.30000000000000004
C
...
1 tag
1 tag
6 tags
microarmy
I spent some time hacking on a new testing tool today. The idea is to quickly turn on some number of AWS micro instances and have them slam a webserver simultaneously, using siege.
Siege is a pretty flexible load testing tool. You can configure different payloads and frequencies and all kinds of good stuff. So the trick for microarmy is to get Siege on a bunch of computers quickly and coordinate...
3 tags
SSH with Python's paramiko
The paramiko module is a robust way to support SSH from inside Python. It’s documentation, however, is not straight-forward.
After googling around for a little bit I was able to put a few functions for simplifying the experience. Hopefully readers of this blog find it useful.
def ssh_connect(host, username, private_key, port=22):
"""Helper function to initiate an ssh connection to a...
1 tag
Ranking Methods in Machine Learning →
By Dr. Shivani Agarwala
1 tag
When people give you advice, they’re really just talking to themselves in the...
– Austin Kleon (via marco)
1 tag
1 tag
2 tags
Meandering In Ocaml
Ronald has been talking about Ocaml for a little while now. He’s usually on point when he finds a new language so when he started talking about Ocaml, I put it in my list of things to play with soon.
Installing Ocaml
If you’re just reading about Ocaml, then skip to the next section. If you want to know how to install Ocaml, keep reading.
As you may know from previous posts,...
3 tags
Runnable Ascii Art
orbitz: I just made a python module caleld queue_monad.py
orbitz: that's going tohave ot change soon
apgwoz: post the source!
orbitz: it's empty righ tnow :)
apgwoz: blargh.
orbitz: It's pretty lame anyways, it just lets me compose functions wiht shortcircuit
jdroid-: some module
orbitz: so i can do runQueue(compose([f1, f2, f3, f4]))
jdroid-: use greenlets
orbitz: and f2 can stop the hwoel thing if it knows it's got the goods
orbitz: I'll use buttlets
apgwoz: i'd rather use bluelets
jdroid-: let (_|_) = f a b;;
orbitz: _|_ is bottom in haskell
orbitz: I think you mean: let (_|_) = f a p;;
jdroid-: HAHAHA
orbitz: in haskell you could do
orbitz: let f a p = ( . )( .)
orbitz: let f a p = ( . )( . ) i like my titites even
gregory80: ha
orbitz: not sure if that will compile, probably
orbitz: Prelude> let f a p = ( . )( . )
orbitz: Prelude> :t f
orbitz: f :: t -> t1 -> (a1 -> b -> c) -> a1 -> (a -> b) -> a -> c
apgwoz: haha
4 tags
n8han/All-Aboard - GitHub →
coderspiel:
Almost-realtime streaming API for train departure statuses that I presented at last night’s Hack and Tell. Implemented in Scala with Unfiltered and Netty—you know the drill.
curl -i http://technically.us:7979/ny
This presentation, from last night’s Hack & Tell, rocked. The speakers keep getting better and better!
I posted a panoramic to the meetup page too:...
2 tags
Some Black Magic Python for n00bs
I had lunch with an old friend yesterday and we were discussing Python. He had a background in Perl and PHP so I knew some of the higher-order aspects of Python wouldn’t be clear to him yet. He also had rudimentary knowledge of Python decorators, a tool I use all the time.
In an effort to help, I wrote up some code that demonstrates some of these concepts. I think it will be useful to...
2 tags
Lexical "Closures" Using Lambda in Python
First, I’m simplifying information from this post on Stack Overflow.
The Issue
Lambda, in Python, is not lexically scoped. This can lead to tricky bugs if you’re not careful.
Consider the following code.
def foo():
print 'Foo!'
Simple enough. A function foo prints the string ‘Foo!’.
Let’s play with the scoping of Python and figure out what happens when...
2 tags
Speed tests for *json and cPickle in Python
I have been mulling over some changes I need to make to DictShield to make the document serialization options friendlier to caching.
Initially, I thought I’d pickle the python objects and store that. So I figured I’d build a pickling layer for DictShield that would be cache friendly.
>>> import cPickle
>>> import datetime
>>>...