October 2009
1 post
Team composition
Team makeup
Pragmatist, Perfectionist, Crazy Smart
http://heroku.com/about
Interactions
A quote to start: This quote is the designers’ reflections on designing a programming language (SIMULA).
In the spring of 1967 a new employee at the NCC in a very shocked voice told the switchboard operator: “Two men are fighting violently in front of the blackboard in the...
July 2009
1 post
Really? REALLY? wtf.
js> x = []; js> x[0] = "num0"; num0 js> x[1] = "num1"; num1 js> x[2] = "num2"; num2 js> x num0,num1,num2 js> x["1"] = "str"; str js> x num0,str,num2 js>
Someone please tell me there’s a way to avoid this idiotic behaviour.
February 2009
1 post
January 2009
1 post
November 2008
2 posts
First Clojure program
So, I watched a few of Rich’s videos on Clojure a couple months back, but I finally got an afternoon to spend trying it out.
I skimmed through Ruby Quiz to find an interesting but simple problem, and I decide to write a Sokoban clone.
My initial thought was to do it as a gui app, but I haven’t written any Java code since JDK 1.0-alpha in late 1995, and honestly, I didn’t really...
Configuring Vim, some more
As an addendum to http://items.sjbach.com/319/configuring-vim-right
Here’s a few more that I think are un-live-able-without:
" ease of use keyboard mappings (why do I care about top/bottom of screen?) map H ^ map L $ " buffer switching/management, might as well use those keys for something useful map <Right> :bnext<CR> imap <Right> <ESC>:bnext<CR> map...
August 2008
3 posts
Bill C-61
Canada’s Bill C-61 is an even-worse version of the United States’ DMCA.
For more information, http://www.michaelgeist.ca/ is a reasonable starting point. I rolled up my sleeves and had a go at http://www2.parl.gc.ca/HousePublications/Publication.aspx?Docid=3570473&file=4 which is relatively readable.
Here’s the letter I just posted (yes, on actual paper, in an envelope!) to...
Braid
Braid is very cool. I often enjoyed reading The Inner Product in GDMag, but always got the impression Jonathan was a little “ivory tower”. Turns out, I don’t know shit. Congrats to Mr Blow! (just grabbed the full 360 version: it’s fantastic).
floating point
Floating-point tends to chafe my ass. I was thinking perhaps I’d try to really understand it. These look interesting:
http://citeseer.ist.psu.edu/goldberg91what.html
http://www.cant.ua.ac.be/ieeecc754.html
http://fluorescence.fjfi.cvut.cz/~adamek/nm/ieee754.pdf
Only way to understand something is to implement it though…
[Update]: even better by the looks of it:...
July 2008
4 posts
Second "das keyboard"
So, I just got my second http://www.daskeyboard.com/ in the mail. The first one I had was the “original”, and I loved and continue to love it. I’ve been using it as my work keyboard (where I do the majority of my coding) for the last 3 years or so.
I just got a second one, but it’s the “new” version (the only one they offer now). It’s cleaner design-wise,...
Problems with Vinagre
So, the default remote desktop app in Ubuntu changed from, um, I don’t know what actually, to a new app called “Vinagre”.
You’d think that’d be something I wouldn’t give a patooty about. The first thing you notice is that it has a list on the side that lets you keep track of servers you connect to which seemed nice enough.
I didn’t use it much at first,...
Windows iTunes
I genuinely don’t understand.
I’m not trying to be difficult. I really tried to use iTunes this time. It seemed like the march of inevitability if I wanted to get iPhone apps, and I thought perhaps it would be nice to use. I grabbed the new 7.7 that has iPhone apps, since I wanted to have a look at what was available. It was a little large at 60meg, but hey, whatever, there’s...
Project Euler, problem #10 in F#
Problem’s quite simply stated this time:
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
First typed in solution was simply:
[2..1999999] |> Seq.filter(isprime) |> Seq.fold1(+)
Which got me a number pretty quickly that looked lovely, but was completely wrong. I ran it again, apparently hoping that’d it magically be...
May 2008
12 posts
FSharp Euler #9
The problem statement: A Pythagorean triplet is a set of three natural numbers, a a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. This is another one that’s probably really more “math”-y than programming-y, but I’m enjoying using my new F# hammer to solve these, so...
Euler #8 in FSharp
The problem: Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 ...
Project Euler, problem #7 in FSharp
The problem is: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? Well, this sort of looks like another one that’s intended more for pencil-and-paper solvers than programming-language solvers. But, maybe prime #10001 is very big, so it becomes a problem for code too. My first thought is just to loop with...
Euler Project in F#, problem #6
Kick it, Euler: The sum of the squares of the first ten natural numbers is,1² + 2² + … + 10² = 385 The square of the sum of the first ten natural numbers is,(1 + 2 + … + 10)² = 55² = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640. Find the difference between the sum of the squares of the first...
Euler is streaking in F#, problem #5
Problem #5: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest number that is evenly divisible by all of the numbers from 1 to 20? Speaking of infinite sequences, here’s the solution that seemed obvious to me at first.open Microsoft.FSharp.Math Seq.init_infinite (fun x -> BigInt.FromInt32 x) |>...
…
Because we couldn’t see how the system worked anymore!
Small...
– http://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html
Some more Euler Project, problem #4
This one was pretty straightforward. A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. The hardest part was just reversing the number to be able to tell if it was a palindrome. Unfortunately, when I searched for “reverse string...
More F# thoughts
It’s pretty irritating so far, but I can’t tell if that’s because I don’t know what I’m doing or because I don’t have some key insight into the language structure yet, or what. I find I’m poking around a lot trying to figure out if I need a terminator or a keyword in random places, and because of the structure of the language there’s not as many...
Euler #3
The problem statement: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? The first thing we need to do likely is know if a number is prime:let isprime x = x > 1 && not(Seq.exists (fun n -> x % n = 0) {2..int(sqrt (float x))}) This is a little sneaky. First, it generates a list of numbers from 2 to the square...
Euler Problem #2, redux
This is a similar attempt, not sure if it’s better or worse really, but uses comprehensions instead.{ for i in [1..33] do let x = fib(i) if x < 4000000 && x % 2 = 0 then yield x } |> Seq.sumByInt(fun x -> x)
Euler Problem #2
(only 191 problems to go, currently) Problem #2 was stated as: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … Find the sum of all the even-valued terms in the sequence which do not exceed four million. Pretty straightforward I guess.let rec fib n = if n ...
F# and Project Euler
I was vaguely looking for something that might make me smarter, wouldn’t be at all practical, and also wouldn’t be a huge time investment. I started by working through the exercises of “Introduction to Algorithms” by C/L/R, but I didn’t make it too far. Maybe someday. Project Euler is some math/algorithmic problems that seem to fit the bill. Since I was thinking I...
March 2008
3 posts
Where's my monitoring?
Jenn and I were recently arguing about taking vitamin and other dietary supplements. Historically, I’d been rather dismissive towards them because they always felt very pseudo-scientific, but I’d never really thought about why it was that I felt that way. Obviously it’s possible that they’re filling a very real need, particularly for people who have unusual diets...
foo
Heard the new Foo Fighters on the radio (I assume the latest single), and all I could think was that if Kurt had heard it, he’d have shot himself in the face. … … … But hey, they won a Grammy or whatever. Maybe it’ll be for best Adult Contemporary next time.
bash inputrc tab completion magic incantations
I can’t stand hitting TAB and having it do nothing because there’s two matches. Cycling seems vastly more useful to me. And, history-search (F8 in Windows), but both directions using PgUp/PgDown. I can never remember this magic so here it is for posterity (goes in ~/.inputrc):TAB: menu-complete "\e[Z": "\e-1\C-i" "\e[5~": history-search-backward "\e[6~": history-search-forward Then,...
February 2008
5 posts
Emacs for Vim
I’m having a whack at trying to learn a reasonable amount of Emacs so I can attempt a project more reasonably in sbcl (and Weblocks). I’ve been programming in Vim for about 12 years and my brain/hands are very, very angry at this editor transgression. Mostly because I know I’ll give up, and then try again much later, here’s some stuff that is permanently ingrained in my Vim...
JavaScript framework
I thought I liked jQuery, but it’s just a bit too weird after using it for a bit. I kept having the feeling that it was too much magic and not enough JavaScript. So, I’m using mootools now. It’s very similar, but one or both of the design and documentation is better, and as a result I’m much happier with it.
N+ →
Nick and Kees over at Slick Entertainment just had their 360 XBLA version of “N” (a cool platformer) released today. Just grabbed the full version and it’s a heck of a lot of fun.
1 tag
Arc-ish web programming in Python
There seems to be little more sanity coming to the Arc discussion. Some people are still paniced about HTML generation, but I’m not sure that you really have to use that if you don’t like it. Others are just disappointed because they were hoping for … I don’t know what, some sort of Holy Grail, but it’s, y’know, just a programming language. The terseness it...
1 tag
better flow control
Been poking around the Arc site; I did a quick Vim integration (to allow sending files/forms to the running Arc process), and I’ve been reading its code a little, mostly to get a better understanding of the approach it’s taking for html generation. There’s bad and good, but it’s certainly very terse. Here’s the Arc version of prompt, interstitial, and results:(defop...