Content from 2008-02

SICP Section 1.2

posted on 2008-02-29 19:39:36

I finally finished SICP Section 1.2 last night. I'm tremendously excited because this means that next week I can start tackling Higher Order Functions and (I hope) Closures. At any rate, here is the last month's work:


Living with Ben

posted on 2008-02-29 00:24:09

Living with Ben was pretty bad ass. We stayed up late arguing about stuff that only one of us really knew anything about (computers or philosophy), made crazy playlists, played smash bros, and generally had lots of fun. Dan was awesome too but he just hid in his room a lot and then popped out and surprised everybody with amazingness. You wouldn't know it from looking at the guy but he was totally the comic relief.

I mention this though because Ben and I might end up living together again sometime after May. I'm for it. And just so you all know, I'm really hoping to live within around Peachtree Industrial, near Oglethorpe. So, if you know good apartment complexes, guest houses, etc, Holla.

Anyway, we worked on this one playlist for like...two weeks or something? I don't know. We came up with a first version which was pretty bad ass by itself but it diverted from the direction I had in mind originally (it started off as my baby) after the Broken Social Scene track...or maybe the Ambulance LTD track. Long story short, I spent another few days to come up with this Version 2 which pretty much sticks to my original vision. Here it is for your thoughts and enjoyment:


1. The Faces - Ooh-ooh-la
2. Blind Melon - No Rain
3. Fastball - Out Of My Mind
4. The Five Stairsteps - O-o-h Child
5. Marvin Gaye - Where Are We Going
6. The Beatles - Come Together
7. Ambulance LTD - Young Urban
8. Broken Social Scene - Looks Just Like The Sun
9. Psapp - Tricycle
10. Massive Attack - Teardrop
11. Corinne Bailey Rae - Trouble Sleeping
12. Regina Spektor - On The Radio
13. Gnarls Barkley - St.Elsewhere
14. Jamie Lidell - What's The Use
15. Elliot Smith - Son of Sam
16. Ambulance LTD. - Arbuckles Swan Song
17. Cat Power - Willie

Quote Post

posted on 2008-02-28 18:08:57

This is probably the most succinct way to put what I'm, in part, getting at. Make no mistake, I will flesh out that essay...it just might take a while. For now, I'm back to programming. More soon though guys.

"Civilization advances by extending the number of important operations which we
can perform without thinking about them."
–Alfred North Whitehead

This quote sourced from one of Richard Gabriel's essays, Objects Have Failed. It also appears in The Road Less Taken.

Secondhand Standards

posted on 2008-02-27 05:27:22

Every now and then I see, hear, or read something that sets my brain on fire. I find some connection that I didn't notice before and go off exploring. It happened a week or two ago over lunch at work. Occasionally there are lunch meetings around work-related activities that you can voluntarily attend. This particular lunch had us watching Paul Hawken's speech at Greenbuild 2007. It set the old wheels turning and the dominos toppling over. This is what spilled out...


For me, I think this all started formally with Thoreau. He was the first person who promoted an idealogy that I both a) actually heard and b) identified with. This would've been in the 11th grade. Prior to this I was more or less an anarchist and held no ethos as my own. Long story short, I've moved on but the transcendentalists sort of hold a special place in my heart. And the thing is, while I've hung onto Walden like a treasure I haven't read it in too long. So when Paul Hawken started mentioning transcendentalists in his speech it was a moment of revelation for me as I came full circle.


There's a crystallization of my beliefs here that has taken years and is an ongoing journey so bear with me. The older I've grown the more interest I've taken in the notion of Historical Progress, or at the very least, of charting where the universe has been and where it's going. Particularly in the last two years or so, thinking about forms of social organization and things like Robert Wright's Nonzero and Ray Kurzweil's The Singularity is Near have been interesting brain food. Of course, I've also been following Open Source, flirting with the environmentalists, and trying to figure out the lispers. And I think I see what I identify with and agree with in it all.


You see, I have this 90% theory. The theory states that at least 90% of human labor is expended to maintain the status quo and that only a fraction of our energy can go to what we care about or to new and creative things. This has come about because of increasingly complex social strata emerging as political and economic forms cave under the growth of civilization. Not western civilization but all civilization. It's a growing interdependency as Robert Wright describes.


He's more or less nailed it. And this interdependency has occurred through large centralized institutions (particularly corporations and governments) that have driven forward economic progress at the price of independence. It's much harder in the 21st century to figure out how to completely sustain yourself in your basic survival needs without withdrawing from society altogether. The sort of experimentalism that was possible by providing for oneself outside of the traditional means is no longer a realistic goal. We have boxed ourselves in.


This seems to me an ethical issue. It is not an ethical issue because consumerism or capitalism is wrong but because one of the lauded premises (whether actual or not) of our nation was some increased degree of influence over one's destiny. In the present day, this influence is lacking if one wants to live in a social setting but with strong self-provision of needs. This frontier opportunity has gone missing on both the frontier of new societal forms and the independent pursuit of sustenance through life, liberty, and happiness.


This is not, it is important to note, the fault of capitalism or democracy. Rather, these are the limits of these systemic forms under burdens of complexity they are not equipped to handle. They have become our Golden Hammers. (A recent e-mail from a dear friend and former teacher of mine eloquently expresses distress over this fact.) In short, the promised revolutionary nature of America has been lost. The Internet is another thing that has been lauded as inherently free. And like the FSF and Open Source this meant free in the context of freedom, libre, not free as in beer.


Lawrence Lessig was the first to note to us that the internet is not inherently free. That being a man-made thing, like a government, the internet was subject to our control and thus could have its freedom removed. Whether or not that is occurring right underneath us remains a subject of debate. I contend, however, that is has already occurred with regards to our nation and, thanks to globalization, much of the "westernized" world. We are buried under the mountains of our own bureaucracy; democracy and capitalism have become organizational forms which limit our innovation and our efficiency. Most importantly, this has impeded our capacity to do what we love.


And I feel like that is what the transcendentalists realized so long ago. They saw it coming and just maybe saw some of the things we stood to lose. Paul Hawken says Emerson realized that "It's all connected". That's why Thoreau reasoned his way into jail, because if he paid taxes while Texas Rangers raped Mexican women he figured it made him a rapist. That's why my friend Alexa saw people in South America who lived in poverty and slept on the job and instead of asking why they weren't like us, asked why we weren't like them. And that's why Richard Stallman found ethics in software (namely a printer driver). It's why a British journalist decries college and lispers wage a near religious war on tedium and repitition.


These all seem like strange places to find ethics. And maybe they are. But this seems to be the strand that ties together article after article I read about why college is unnecessary or high school is drudgery or work is slavery. And I think if I had to give it a name, I could only call it Efficiency. Because we're just not as efficient as we'd like to be. We've finally lost the right to enough of our time that we're jealous about it. There's a recognition that there should be a way to keep society going without all of us dedicating all our time to make sure that it's still there tomorrow. And in come the environmentalists, shouting about the world we leave our children, talking about building to last.


And if there is one question I'm interested in answering it's this: Surely, there is a way for us to restructure society so that only 70% of human labor or 50% or less has to go to maintaining the status quo. Right? Then the rest could go to creativity or innovation or progress or us. I think there is and I'm not opposed to spending my life trying to answer the question. There do thankfully seem to be a number of revolutionary trends coming about, some of which are already well in swing. But it's late, I have work tomorrow, and much as I'd love to I have to call this a wrap for one night.

Tutorials I’ve been meaning to do…

posted on 2008-02-26 21:50:16

as part of a getting things done streak. You know? Like, learn x y per z. Anyway, aside from reading SICP and writing code, getting it posted on here, and getting this essay up these are the other thing I've been lagging on:
An Emacs Tutorial
Git Tutorial Part 1
Git Tutorial Part 2
A Much more focused collection of *nix & associated utilities sheets
A Massive Index of Cheat Sheets

Also, I'm not sure I buy it but there was some pretty optimistic news about Concentrated Solar Power today. I'd love to see more detailed plans and a price/time-to-completion estimate.

Finally, if anyone has any insights about why I'm getting a bad EIP value and a kernel panic whenever I try to transfer large files (or dozens of songs) with my server, feel free to let me know. I will buy you a (coffee/beer/etc). It seems related to this issue from an openSuse user. It could also be related to me using the 8139cp module instead of 8139too for my ethernet card. Whatever, I doubt i'll get anywhere but I'll be looking into it.

Now to grab dinner and finish that essay...

2 Years later…

posted on 2008-02-26 17:42:19

and the NSA/Telcos lawsuits are still going. The Bush Administration is still saying it was necessary to wiretap the phones of hundreds of millions of Americans without warrants. The Government is still pushing to grant retroactive immunity. And it's generally a whole big mess. Doesn't anyone (in our Government) care about privacy or the violation of the Constitution?

Sorry I haven't posted in so long (11 days). I guess I've been distracted. An essay I've working on should be up soon, as should a code/sicp update.

Here are some things to chew on and yell at your local politicans about:
Myth/Facts about Retroactive Immunity
Republicans block FISA talks
Telecom Immunity Passes in the Senate
Domestic Call Database started before 9/11

Seriously, just click yell at your local politicians if you want to help.

One More Reason

posted on 2008-02-15 18:44:31

I knew this day would come sooner or later. I finally ran up against a task that was perfect to use Unix Pipes for. I needed to rename 2335 MP3s and I did it in 1 minute and 40.686 seconds.

Here's the backstory:
I recently got a new MP3 player because my old one died. When I got my last MP3 player I had selected the 2000 songs I actually liked and regularly listened to out of my 17000 or 18000 and copied them to the MP3 player and my PS3. Those songs were sort of a pain to get off my PS3 onto the new player so I figured I might as well keep a separate copy of them somewhere on my desktop. Eventually I'm planning on moving them to my server as well at which point Redline Radio will get up and running again!

Anyway, I copied all the files off of my new MP3 player to my desktop to create said separate copy and found that the filename on each song had been changed to SONG_NAME.b-mtp-XXXX where the X's were the song numbers up to 2335. I'll be damned if I was going to rename all those by hand. So, I thought I'd use Unix Pipes which allow you to take the output from one command and feed it into another command. And just for fun, I timed it.

To time a command you just put the word time in front of it. So to time the change directory command you'd type, "time cd DIRECTORY". To rename all those files I would use the rename command, but it would only rename one file at a time or at best one directory. I had a few hundred directories. So, I needed a command that would find each file by searching through the directories and find is the perfect command for the job. I can call find and tell it to search for files with that weird extension and then each time it does, run rename on the file with a regular expression to change that extension to mp3. And here's how that looks:

time find ./ -type f -exec rename 's/b-mtp-[0123456789]*/mp3/' {} ;

That's it. It says time the find command searching from this directory down for files (ignoring directories, etc) and when you find one rename it based on this regular expression. Done. 2000 files renamed in 2 minutes. And people wonder why I use Linux. Yes, Apple Automator does do this. But do you know why the robot icon for Automator is holding a pipe? That's right. It's an homage to Unix Pipes. You could of course do this in Apple's Terminal. That would be pretty cool. You hear me Dobbs?

Anyway, I've been thinking a bit about Alan Perlis' Programming Epigram: "A language that doesn't affect the way you think about programming, is not worth knowing." And I think there's an analogue for Operating Systems as well in all likelihood. Text editors, too (here comes the Vi vs. Emacs crowd). So, I may be using a blub operating system but I haven't soaked up all I can learn from it yet. I just need to remember to try other things too.

Just for fun, here's one more. This one outputs the 50 largest directories on my hard drive and their sizes to a text file on my desktop. du is Disk Usage, the -S option tells it to not to include subdirectories (so I only get leaves and not branches of the filesystem tree in my results). | passes output from one command as input to the next so | sort -nr passes the list of the directories and their sizes to sort which thanks to the nr switch sorts them in Reverse Numerical order. Greatest first, right? Then | head -n50 takes that output and cuts off everything after the first 50 lines. Finally, > dumps the final output into a text file at the location given. Ta da.

du -S / | sort -nr | head -n50 > /home/redline/Desktop/50large.txt

For Don and Lex

posted on 2008-02-14 04:18:01

Eduardo Galeano, Voices of Time, Soul in Plain Sight, pg.98:

"According to an ancient belief, the tree of life grows upside down. Its leaves burrow into the earth, its roots gaze at the sky. It offers not its fruits but its origins. Rather than hiding underground what is most intimate, most vulnerable, it bares its roots, exposing them to the winds of the world.
"That's life," says the tree of life."

I haven't fallen off the face of the earth just yet. More soon guys. I'm hoping to get a SICP progress update posted this weekend as well as (maybe) a REAL ESSAY on REAL THINGS!

Expect me to tie together transcendentalists, the green and possibly civil rights movements, and lisp. Yeah, who knows.

Pascal’s Triangle

posted on 2008-02-07 03:25:28

A little over two weeks ago I came up against Exercise 1.12 in the venerable Structure and Interpretation of Computer Programs.


The exercise wants you to write a recursive program to compute elements of Pascal's Triangle.


This exercise has pretty much infuriated me and it's all my own fault. Upon first hearing the problem statement I got it in my head that the function should look something like "(define (pas n)...)". I always think of number series being described in terms of a single argument (i.e. the 12th element) so it seemed natural to me that the pascal's triangle function should be computed in this way even though it is not, in some sense, a traditional series.


After a while, I cracked and read the precursor text (but not the code) to Eli Bendersky's solution and noticing that he defined the function with two arguments (for columns and rows) arrived fairly quickly with that insight at what seems to be the more or less standard solution. I have had this much completed for a week but gotten stalled trying to figure out the problem of a pascal function that takes one argument.


As of today I've solved the problem though and hoped to share my results here. First, the throwaway code that ended up being good for nothing!



(define (is-one? element)
(define (is-one-iter ones count flag)
(cond ((< element 5) #t)
((= ones element) #t)
((> ones element) #f)
((= flag 1) (is-one-iter (+ ones 1) count (- flag 1)))
(else (is-one-iter (+ ones count) (+ count 1) (+ flag 1)))))
(is-one-iter 4 2 0))
;Value: is-one?

That code tests to see whether a given element equals one and it does take a single argument which is nice. I couldn't figure out a way to use it to compute the actual elements though.


After a little bit of experimenting I stumbled on this number sequence (OEIS #A080956) which when put in the following procedure would allow me to compute n from a given column and row.


EDIT: Corrected dyslexic mistake in my code (I'd replaced all instances of col with row and vice versa). See comments.



(define (n-from-rowcol row col)
(define (f x)
(- (/ (* (+ x 1) (- 2 x)) 2)))
(+ row col (f (- row 1))))
;Value: n-from-rowcol

Now all I had to do was find a way to reverse the function to give me the inputs if I gave it the output. I actually stumbled upon another number sequence (OEIS #A000124, also known as the Lazy Caterer's Sequence) which when put into the following procedure returns the correct column and row for a given element. At last, working code:



(define (pascal n)
(define (pas col row)
(cond ((= col 1) 1)
((= row 1) 1)
((= col row) 1)
(else (+ (pas (- col 1) row)
(pas (- col 1) (- row 1))))))
(define (colrow-from-n)
(define (col-iter count)
(define (f x)
(- (/ (+ (square x) x 2) 2) x))
(cond ((> (f count) n) (pas (- count 1) (- n (- (f (- count 1)) 1))))
((= (f count) n) (pas (f count) 1))
(else (col-iter (+ count 1)))))
(col-iter 1))
(colrow-from-n))
;Value: pascal

Any insights into cleaner code, better algorithms, or comparisons between the two number series are welcomed.


Unless otherwise credited all material Creative Commons License by Brit Butler