Just yesterday, I was browsing an older Malcolm Gladwell article on the fragility of things. This morning, I saw this new article in the New Yorker on why social network sites won't trigger the next revolution.
He makes an interesting point. High-risk activism which is required to establish the nucleus of a revolution orginates from strong-ties - friends we can depend on, as opposed to the weak-ties that social media specialize in.
Interesting read.
A random walk through a subset of things I care about. Science, math, computing, higher education, open source software, economics, food etc.
Wednesday, September 29, 2010
Friday, September 24, 2010
// Best source code comment
I stumbled onto this exchange on stackoverflow, regarding great source code comments via WalkingRandomly. Many of them are absolutely precious, some nice (short) ones include:
// sometimes I believe compiler ignores all my comments
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
/* This is O(scary), but seems quick enough in practice. */
// somedev1 - 6/7/02 Adding temporary tracking of Login screen
// somedev2 - 5/22/07 Temporary my ass
#define TRUE FALSE //Happy debugging suckers
/* I did this the other way */
double penetration; // ouch
// I don't know why I need this, but it stops the people being upside-down
x = -x;
// I am not sure if we need this, but too scared to delete.
options.BatchSize = 300; //Madness? THIS IS SPARTA!
// no comments for you
// it was hard to write
// so it should be hard to read
// sometimes I believe compiler ignores all my comments
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
/* This is O(scary), but seems quick enough in practice. */
// somedev1 - 6/7/02 Adding temporary tracking of Login screen
// somedev2 - 5/22/07 Temporary my ass
#define TRUE FALSE //Happy debugging suckers
/* I did this the other way */
double penetration; // ouch
// I don't know why I need this, but it stops the people being upside-down
x = -x;
// I am not sure if we need this, but too scared to delete.
options.BatchSize = 300; //Madness? THIS IS SPARTA!
// no comments for you
// it was hard to write
// so it should be hard to read
Saturday, September 18, 2010
Charlie Munger Talk at Michigan
Charlie Munger is an endlessly fascinating guy, better known for being Warren Buffett's partner at Berkshire Hathaway. He is less known, as I chronicled here, for having attended the Math department at my alma mater, the University of Michigan at Ann Arbor.
Recently he spoke at length, at the Ross School of Business. This nearly two hour video is quite interesting. Unfortunately, it requires Silverlight. He sprinkles verbal gems as usual:
Recently he spoke at length, at the Ross School of Business. This nearly two hour video is quite interesting. Unfortunately, it requires Silverlight. He sprinkles verbal gems as usual:
Envy is a really stupid sin because it's the only one you could never possibly have any fun at.
Sunday, September 12, 2010
Art of approximation in science and engineering
An interesting-looking course taught by Sanjoy Mahajan. According to the website:
Simple reasoning techniques for complex phenomena: divide and conquer, dimensional analysis, extreme cases, continuity, scaling, successive approximation, balancing, cheap calculus, and symmetry. Applications from physical and biological sciences, mathematics, and engineering. Examples include bird and machine flight, neuron biophysics, weather, prime numbers, and animal locomotion. Emphasis on low-cost experiments to test ideas and on fostering curiosity about phenomena in the world.He has a working draft of an interesting reading book on the site.
Friday, September 10, 2010
The Underdog
I was recently on a long-haul trans-Atlantic flight, and saw Clint Eastwood's movie "Invictus" starring Morgan Freeman and Matt Damon, two of my favorite actors. It chronicles the story of how an underdog South African rugby team stunned the world, and unified a nation, in 1995 by winning the Rugby World Cup. Despite the poor audio and constant interruption throughout the flight, I thoroughly enjoyed the movie.
The title of the movie is derived from a poem on self-mastery by William Henley, which inspired Nelson Mandela while he was in prison. In the movie, Mandela (played by Morgan Freeman) shares it with Francois Pienaar, the captain of the rugby team (played by Matt Damon).
It is a beautiful poem.
The title of the movie is derived from a poem on self-mastery by William Henley, which inspired Nelson Mandela while he was in prison. In the movie, Mandela (played by Morgan Freeman) shares it with Francois Pienaar, the captain of the rugby team (played by Matt Damon).
It is a beautiful poem.
Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.
In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.
Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds and shall find me unafraid.
It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
Wednesday, September 8, 2010
OOoLaTeX: Getting fonts to work
I've previously written about my enthusiasm for OOoLaTeX, a plugin that lets you typeset LaTeX equations in OpenOffice. I love it because the equations look beautiful, and I can cut paste from my LaTeX manuscripts (and wikipedia sources for lectures).
Recently, my office computer which runs Linux went through an upgrade, and you guessed it right, among the many things that broke was OOoLaTeX.
Getting and installing the plugin was a breeze, as I outlined in my previous post. However, it could not print AMS characters like \mathbf{v} or \boldsymbol{\tau} as it used to (and was supposed to).
But what I had forgotten in the time since I last installed it was how to get the right fonts. My older notes (contained in the previous blog) were not very helpful. Since one of the underlying motivations for this blog goes along the lines of Linus Torvalds' quote "Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it" I thought I'd make more careful notes this time.
1. Download Bakoma fonts from CTAN. They are available as a set of files here, and save them.
2. I saved mine in a newly created directory ~/.fonts/bakoma
3. Since some of the characters are off in the original font set, replace them with the corrected ones found here in a tar-zipped file.
4. Untar, unzip and paste these files in ~/.fonts/bakoma, replacing some of the faulty older ones.
5. Type "fc-cache /panfs/panasas1/users/sshanbhag/.fonts/bakoma" in the terminal
And you should be good to go.
Recently, my office computer which runs Linux went through an upgrade, and you guessed it right, among the many things that broke was OOoLaTeX.
Getting and installing the plugin was a breeze, as I outlined in my previous post. However, it could not print AMS characters like \mathbf{v} or \boldsymbol{\tau} as it used to (and was supposed to).
But what I had forgotten in the time since I last installed it was how to get the right fonts. My older notes (contained in the previous blog) were not very helpful. Since one of the underlying motivations for this blog goes along the lines of Linus Torvalds' quote "Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it" I thought I'd make more careful notes this time.
1. Download Bakoma fonts from CTAN. They are available as a set of files here, and save them.
2. I saved mine in a newly created directory ~/.fonts/bakoma
3. Since some of the characters are off in the original font set, replace them with the corrected ones found here in a tar-zipped file.
4. Untar, unzip and paste these files in ~/.fonts/bakoma, replacing some of the faulty older ones.
5. Type "fc-cache /panfs/panasas1/users/sshanbhag/.fonts/bakoma" in the terminal
And you should be good to go.
Friday, September 3, 2010
"Publish"ing in Matlab
I use GNU Octave as the glue to post-process and make preliminary visualizations most of the time. Every once in a while, however, I need to use its commercial cousin, Matlab.
This Fall, I am teaching an undergrad numerical analysis class, and realized that Matlab has this interesting documenting feature called "Publish", which lets you use a double percent sign %% in addition to the regular % sign used to begin a comment. Using these %% signs, you can divide your code into "cells" which is helpful for selectively testing individual cells -- an added benefit.
Check out a video on how to use this feature at Mathworks.
By proper use of %% and % comments, one can actually produce a nice document (in html, LaTeX or some other options), which is ideal, since now students can submit only a single "M-file", and I can check whether the program works, and the accompanying documentation in one shot.
This Fall, I am teaching an undergrad numerical analysis class, and realized that Matlab has this interesting documenting feature called "Publish", which lets you use a double percent sign %% in addition to the regular % sign used to begin a comment. Using these %% signs, you can divide your code into "cells" which is helpful for selectively testing individual cells -- an added benefit.
Check out a video on how to use this feature at Mathworks.
By proper use of %% and % comments, one can actually produce a nice document (in html, LaTeX or some other options), which is ideal, since now students can submit only a single "M-file", and I can check whether the program works, and the accompanying documentation in one shot.