This morning I was playing around and decided to try and recreate an example from Structure and Interpretation of Computer Programs (SICP). Along the way I discovered some unexpected gotchas with how Python scopes closures. The example I was trying to reproduce was the following one: (define (make-account balance) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")) (define (deposit amount) (set! balance (+ balance amount)) balance) (define (dispatch m) (cond ((eq? m 'withdraw) withdraw)…
One of my favorite books of all time is “The War of Art” by Stephen Pressfield. I’ve read or listened to this book, cover to cover, more times than I care to recount. Yet every time I come back to it something gets freshly reinvigorated within me. You see, what’s incredible about this book is how, in one brilliant maneuver, Steven simplifies the creative persons struggle by naming their primary enemy. He calls it resistance. Resistance is the union of all…
I’ve recently gotten into doing a lot of lisp programming in emacs, and rainbow-delimiters-mode is a huge help in terms of visually finding your way around. What I wasn’t thrilled with, however, was the default color scheme which is rather bland. So I decided to spice it up. So here’s some better defaults for rainbow delimiters mode: (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;;…
Get to the picture language section of SICP and actually want to draw stuff? Find out how below. Some Background About a month ago I decided to start taking my programming more seriously. I realized that I had done very little recently to develop my craft, and so I set out to find some resources to whip my mind back into shape. Since it had been a while I decided it might be nice to start from the basics – even…
Hey you! Tired of having type all this nonsense just to push up the current git branch?: $ git push origin my-super-long-branch-name Well fear not, just add this simple git alias to push the current branch: pu = !git branch | grep '^\\*' | cut -c3- | xargs git push origin And then just type: $ git pu EDIT: Little did I know there’s a much easier equivalent command $ git push origin HEAD
Technologies: Amazon Mechanical Turk, Javascript, Python Alright, we’re back! I know, I know you missed me. Sorry I left you hanging back there with just a HIT and nothing to fill it in with. This one took a bit, but I swear I’m not slacking…I mean, I’m not always on point, but honestly I think a lot of people will benefit from this post so I wanted to make sure I got it right (read: don’t sound clueless). To…
Technologies: Amazon Mechanical Turk, Javascript, Python In the previous section I briefly ran you through why you might want to use Mechanical Turk. In this section we’re gonna start putting the rubber into contact with the road by designing our assignment. Here’s what we’ll cover: Creating a new assignment. Determining how much to pay. Using Javascript to improve the effectiveness of your HITs. Careful assignment design is crucial to getting the best results from Mechanical Turk. You should strive to design your assignments knowing that…
Technologies: Amazon Mechanical Turk, Javascript, Python What You’ll Learn In This Series How to create and customize a HIT. How to figure out how much to pay workers. How to upload assignments using the API. How to download results and pay workers using the API. How to improve your results by requiring multiple workers to complete each assignment. Mechanical Turk (MTurk) is an exciting new technology for businesses and researchers. At its most basic it lets you create tasks for other people to complete. For…
Eric is starting something new today. He’s starting a more professional blog. Wow…alright sick of the third person…let me switch to something more natural. So I’ve been toying with the idea of taking my blogging a bit more seriously. I’ve tarried at the edge of the deep, dark unknown without really diving in for long enough. So it’s time that I publicly declare my intent in the hopes that’ll actually force me to do this thing. This blog is going…