Sunday, December 18, 2011

Recent Thoughts

So, this morning I was reading an article in this month's Harpers, where a woman had traveled to Cuernavaca with her daughter to learn Spanish. She noted the immediacy of the dead in the life of the host family. I started to think that maybe a great thing about having decidedly distant places for the afterlife is that the dead are not in the backyard complaining to you, wondering why no one cleans their graves, and generally being troublesome for the living. It may be that the progress of Christianity and its cosmology has allowed more freedom from the ancestors.

Second, I occasionally find myself thinking back to 'The Stainless Steel Rat Gets Drafted' and the system of Individual Mutualism. When I was 12 (and read this), the existence of a long line of anarchist thinkers was far from my imagination, so any relation to historical mutualist theory was lost to me. I think I may want to add some of these 19th century thinkers, probably Proudhon more than Kropotkin to my reading list. It's a shame that anarchy and its philosophy have been hidden from young people by rather loud shouts from metal heads (do these still exist?). I think reading Chernyshevsky's 'What is to be Done' over my vacation this summer may have rekindled some interest in the matter. Any technical measures to bring this about should do a little reading into the history of mutual aid or friendly societies as they were known 200 years ago in the US. The big advantage of small scale local social units is that we won't require a revolution in the state to effect the kind of change and organization required to put these ideas into practice.

Unfortunately, the state and finance are balanced in favor of a debt driven consumption system, as anyone who has tried to get a mortgage for a coop can attest. My understanding is that a coop is owned jointly by the tenants, so unlike a condo, cannot be foreclosed at the unit level, only the whole building. This makes bankers hesitant to lend without security. It makes me wonder what other types of organizing property are prevented by the structure of lending and the legal system upholding property.

Monday, December 05, 2011

color themes

Frankly I'm a little excited for emacs 24 to be released (I occasionally build and toy with the trunk to see what's coming). I'm really happy that elpa is going to be standard, color-themes is preinstalled, and life is generally good. Plus this will be the first time I actually care to maintain my .emacs in a version aware fashion, since I'm not sure there aren't things in 23 that I can't live without.

But anyway, I'm using solarized-dark, which I find I almost can't live without now. I would probably give the author a few dollars if he somehow held me hostage, it's that nice. It was worth installing color themes in 23 just to get this feature working.

A million little languages

When we drop down to the algorithm level, I think OO can seriously thwart reuse. In particular, the use of objects to represent simple informational data is almost criminal in its generation of per-piece-of-information micro-languages, i.e. the class methods, versus far more powerful, declarative, and generic methods like relational algebra. Inventing a class with its own interface to hold a piece of information is like inventing a new language to write every short story. This is anti-reuse, and, I think, results in an explosion of code in typical OO applications.

Rich Hickey, from Code Quarterly.

Sunday, December 04, 2011

Republic of Letters

So I thought recently about all the books I've had to read, and those I've read for pleasure. I'll omit purely technical works and focus on literature.
High School Assigned Readings
  • Romeo and Juliet
  • Julius Caesar
  • As I Lay Dying
  • Things Fall Apart
  • The Awakening
  • The Old Man and the Sea
  • Ethan Frome (didn't read it)
  • The Red Badge of Courage (also didn't read it)
  • Fahrenheit 451
  • Animal Farm
  • Thus Spake Zarathustra (I'd read it once and followed up to do a term paper)
College assigned readings
  • Hamlet
  • Henry V
  • History of the Peloponnesian War
  • Crito
  • Phaedo
  • Apology
  • Symposium
Personal Reading (In no particular order)
  • The Trial
  • The Castle
  • Amerika
  • The Stranger
  • Man in Revolt
  • Essays of Montaigne
  • Republic
  • Why I am Not a Christian
  • Power
  • Conquest of Happiness
  • Marriage and Morals
  • The House of Mirth
  • Farewell to Arms
  • In Our Time
  • Mrs Dalloway
  • The Years
  • Orlando
  • To the Lighthouse
  • This Side of Paradise
  • Adam Bede
  • Middlemarch
  • Silas Marner
  • Moll Flanders
  • Felix Holt, the Radical
  • Daniel Deronda
  • Vanity Fair
  • Pride and Prejudice
  • Emma
  • Jane Eyre
  • Wuthering Heights
  • Sense and Sensibility
  • Tess of the D'Urbervilles
  • Rameau's Nephew
  • D'Alembert's Dream
  • The Gay Science
  • Geneology of Morals
  • Ecce Homo
  • Beyond Good and Evil
  • The Antichrist
  • Crime and Punishment
  • Anna Karenina
  • Brothers Karamazov
  • The Merchant of Venice
  • King Lear
  • Macbeth
  • Titus Andonicus
  • Timon of Athens
  • Pericles
  • Dead Souls
  • The Nose, The Overcoat, How Ivan Fyodorovich Quarreled with Ivan Nikiforovitch
  • Plays of Aeschylus
  • Plays of Sophocles
  • Plays of Euripides
  • Brideshead Revisited
  • Devil in Paradise
  • Tropic of Cancer
  • Stand Still Like the Hummingbird
  • The Air Conditioned Nightmare
  • Big Sur and the Oranges of Hieronymus Bosch
  • The Crime of Father Amaro
  • The Master and Margarita
  • Faust (Goethe's version)
  • Angle of Repose
  • The Mill on the Floss
  • 1984
  • Point Counter Point
  • Island
  • Brave New World
  • My Antonia
  • Hard Times
  • Great Expectations
  • Our Mutual Friend
  • Bleak House
  • Franny and Zooey
  • Nine Stories
  • Dubliners
  • Foundation/Robot cycle
  • Dune cycle

Saturday, December 03, 2011

github

Well, I added an account (and some code from Project Euler plus some coursework) on github. I will see how useful this becomes to me. I'm not sure how the public keys will work if I commit as the same person from multiple machines. I will have to experiment with that further.

Friday, December 02, 2011

Resolution

Whereas chickpeas have firm, non-porous outer husks.
Whereas chickpeas have high moisture content within.
Whereas microwave ovens excited water molecules more efficiently than anything else.
Whereas heated water expands and steams, pushing outward material around it.
Whereas a steaming chickpea tends to crackle and pop.
Whereas conventional ovens are perfectly capable of heating delicious foods without massive messes.
Whereas pots are dishwasher safe, while microwaves are hard to fit into a dishwasher.
Finally, whereas once is enough to learn our lesson.

Therefore, let us resolve to not place a plate of uncovered chickpeas in the microwave, regardless of how much time we may believe we'll be saving. Let us further resolve to just take a sharpie and cross off any references to the microwave oven.

Saturday, November 26, 2011

gcc does binary search in switch (not nested if blocks)

So I started looking at Write Great Code, and one of the examples he offers is a comparison of a switch(x) versus if(x==1) else if (x==2) else if ... there were 1-4 matching and a default case.

so I threw that together into a dummy source file, asked for an assembly output, and looked. I was a little surprised to see this:
movl -4(%rbp), %eax
cmpl $2, %eax
je .L4
cmpl $2, %eax
jg .L7
cmpl $1, %eax
je .L3
jmp .L2
.L7:
cmpl $3, %eax
je .L5
cmpl $4, %eax
je .L6
jmp .L2

It looks like it peeks into our variable (argc gets loaded into eax for this example) and starts a binary search of the possible literal values it expects. I didn't turn on any extra optimizations, so I assume this is just a practical good idea. I feel slightly less dumb (at the machine level) feeding ploddingly literal switch statements to gcc now, though I still feel like a chump typing them.

The nested if blocks follow a more familiar pattern... is it 1? well, is it 2? Ok, is it 3? Hmm, what about 4? Well, I give up, lets take this else else else else action. I guess its nice to know this. It may be a reason only a literal can be used in a switch, that the language designers were expecting this type of optimization on the back end.

My take-away from this is that if there is a higher probability of some options, nested if/else blocks make sense. If the possibilities are equally likely, switch makes sense. If the purpose is to guard against bad things (dereferencing a null pointer) if/else is a necessity, and it's proper that gcc didn't optimize it away (it would be disastrous if it did!)