Finally, My New Kindle

|

I just started using my new Kindle from Amazon ($139), and I like it so far. I’ve been lusting after an e-reader for a long time. I don’t like carrying heavy books and papers. Digital not analog for me, please. The iPad’s backlit screen strains my eyes if I read for a long time, and I can’t justify the $500 price tag.


Treme & Engineering: Fight Club & Anti-Consumerism

|

Treme

Treme is a television series about post-Katrina New Orleans. David Simon, the creator of The Wire, uses his story-telling skills to describe how a colorful group of characters try to piece their lives together after the hurricane. In season one, episode two, “Meet De Boys on the Battlefront,” John Goodman’s character, a Tulane University English professor, criticizes the school for disbanding its engineering departments while keeping its liberal arts majors. Disciplines like philosophy and history make us critical thinkers about human life and society, but at the end of the day we still need hard science and math to build the things that feed us, heat our homes, and improve quality of life on a physical level. Goodman’s character has a point.


Sex Diaries of a Recent College Grad

|

A friend of mine who recently graduated from college told me (s)he “used a dating site to ease a transition and came to terms with newfound promiscuity.” I shudder to think what the last part of that description even means. I encouraged my friend to write a post for my blog and enlighten me about his/her life after college. I was hoping for a witty David-Foster-Wallace-esque narrative. I received something à la Daily Intel’s Sex Diaries. Complete confidentiality was a stipulation given the sensitive nature of the info below. Like Ira Glass says before he plays a This American Life program that contains slightly mature content: for those with young children, the below piece of writing “acknowledges the existence of sexual acts.”


How to Cheat Wall Street: Swindle Them With Oil

|

Originally appeared in Saturday Evening Post on April 25, 1964.

The soybean scandal, one of the biggest swindles in American history, broke into the news last fall and is still producing tremors. Losses came to some $150 million [$1.1 billion in 2008 dollars which is pretty hefty]. One large brokerage house was destroyed and 20 leading banks were stuck with millions in bad loans. The man behind the uproar is Anthony DeAngelis, who in his spare time donated bicycles to boys in his neighborhood. A onetime hog processor, De Angelis became the biggest trader in fats and oils. Today, protesting his Innocence, he faces criminal charges that could send him to prison for 185 years. Veteran Wall Street reporter Norman C. Miller reveals the behind-the-scenes story and raises some important questions that still confront the U.S. Agriculture Department and the businessmen who trade in commodities worth billions.


New York Times Perl Web Scraper

|

This Perl script scrapes The New York Times website.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env perl

use strict;
use LWP::UserAgent;
use HTTP::Cookies;
use HTML::TreeBuilder 3;

my $OUTPUT_FILE = 'nyt_top_stories.txt';

# User agent needs to accept cookies to access NYT
my $cookie = 'nyt_cookie.lwp';
my $cookie_jar = HTTP::Cookies->new('file' => $cookie, 'autosave' => 1);

my $content = get_html('http://global.nytimes.com/');
my $tree = HTML::TreeBuilder->new_from_content($content);

# Stores homepage URLS
my @urls;
scan_nyt_tree($tree, 'http://global.nytimes.com/');
$tree->delete();

unlink $OUTPUT_FILE;

# Scrape article from each URL
foreach (@urls) {
    $content = get_html($_);
    # Replace all newline characters, needed for $rawtext extraction
    $content =~ s/\n//g;

    # Extracts headline, byline, dateline, and raw text
    my $headline;
    if ($content =~ m/<nyt_headline .*?>(.*?)< \/NYT_HEADLINE>/) {
        $headline = $1;
    }

    my $byline;
    if ($content =~ m/<nyt_byline .*?>.*?<a \shref.*?>(.*?)< \/a>/) {
        $byline = $1;
    }

    my $dateline;
    if ($content =~ m/class="dateline">.*?Published:\s+([\w\s,]+)< \//) {
        $dateline = $1;
    }

    my $rawtext;
    if ($content =~ m/<NYT_TEXT.*?>(.*)< \/NYT_TEXT>/) {
        $rawtext = $1;
    }

    # Parses article's text by extracting everything between <p> tags
    my $text;
    while ($rawtext =~ m/</p><p>(.*?)< \/p>/g) {
        $text .= "\n\n$1";
    }
    $text =~ s/ +/ /g;              # REPLACE MUTLIPLE SPACES WITH ONE
    $text =~ s/< .*?>//g;           # REMOVE HTML TAGS
    $text =~ s/&mdash;/--/g;        # REPLACE HTML EM-DASH CODE WITH 2 HYPHENS
    $text =~ s/'|&lsquo;/'/g; # REPLACE SMART APOSTROPHES WITH '
    $text =~ s/"|&rdquo;/"/g; # REPLACE SMART QUOTATIONS WITH "
    $text =~ s/&nbsp;/ /g;

    open(OUTPUT, ">>$OUTPUT_FILE") or die("Cannot open $OUTPUT_FILE\n");
    print OUTPUT "$headline\n$byline\n$dateline$text\n\n\n";
    close(OUTPUT);
}

# Stores a web page's HTML as string
sub get_html {
    my $url = $_[0];
    my $browser = LWP::UserAgent->new();
    $browser->cookie_jar($cookie_jar);

    # $response declared out here to be accessible after while loop
    my $response;
    # Prevents inifinite loops
    my $redirect_limit = 5;
    my $x = 0;

    # Sends GET request, follows redirects until response code 200 received
    # Stores successful request URL
    my $responseCode = 0;
    while ($responseCode != 200 && $x < $redirect_limit) {
        $response = $browser->get($url);
        $responseCode = $response->code;
        print "$url\n";
        #print "response code: $responseCode\n";
        $url = $response->header('Location');
        $x++;
    }
    return $response->content;
}

# Picks out URLs of top NYT articles
sub scan_nyt_tree {
   my ($root, $docbase) = @_;
   foreach my $div ($root->find_by_tag_name('div')) {
       my $class = $div->attr('class') || next;
       if ($class eq 'story') {
           my @children = $div->content_list;
           for (my $i = 0; $i < = $#children; $i++) {
               if (ref $children[$i] and
                   ($children[$i]->tag eq 'h2' ||
                   $children[$i]->tag eq 'h3' ||
                   $children[$i]->tag eq 'h5')) {
                   my @grandchildren = $children[$i]->content_list;
                       # Search sibling if 1st grandchild not <a>
                       if (ref $grandchildren[0] and $grandchildren[0]->tag eq 'a') {
                       push (@urls, URI->new_abs($grandchildren[0]->attr('href') || next, $docbase));
                   }

               }
           }
       }
   }
   return;
}

Australian Adventures: Car Wrecks and Crazy Aussies

|

My friend Adam Urban wrote an exciting series of posts at his blog Aimful Wanderings. He’s currently studying abroad in Australia and has had a good serving of adventures in the outback. These adventures include:

Man, I wish I had been there for these (mis)adventures.


The Best Roommate Horror Stories

|

We all have roommate horror stories. Here are some particularly bad ones I’ve heard from my friends.

  • The roommate who filmed a porno of herself and her boyfriend on your bed.
  • The roommate whose friends smoked pot and vomited in your dormitory floor’s communal male showers. This roommate stayed out late reenacting Fight Club scenes with his wrestling team, played video games all night during final exams with the volume on high, and one day began storing his urine in bottles and leaving them in his room indefinitely.

Number Theory, You Use It Everyday

|

The most beautiful mathematics had no applications in the real world, according to the prominent British mathematician G. H. Hardy. He called them “pure mathematics,” and for him the purest of the pure was number theory, a branch of math that studies the properties of numbers.

Hardy’s A Mathematician’s Apology is a layman-accessible personal essay on theoretical mathematics. It’s hardly an “apology” in the traditional sense of the word. Hardy’s essay is a justification of his life and work.


How to Make Money by Making People Drunk

|

During my sophomore year at Columbia, my friend Peter and I decided to take the student-run Columbia Bartending Agency’s mixology course. We paid $200 for the opportunity to get drunk by 7PM on Thursdays as well as learn to make some drinks. In preparation for the agency’s final exam for certification, Peter and I decided to throw a bar tending party in my room. My roommate was worried about my hosting a loud party in a alcohol-free dorm building and selling alcohol to minors, but I persuaded him by assuring that I would enforce his list of regulations below (which I drew up):

  1. These are not Matt’s rules.
  2. Matt doesn’t know about this event.
  3. Don’t go through Matt’s shit.
  4. Don’t steal Matt’s shit.
  5. Don’t pour drinks on Matt’s shit.
  6. Don’t attract the attention of public safety.
  7. No orgies, “but if one will inevitable arise, you must call me [Matt].”

What Do Algebra and Castro Have in Common?

|

What do algebra and Castro have in common? What are Columbia’s Contemporary Civilization class discussions really like? And what’s the secret weapon of white male Republicans? Here’s some more hilarious quotes I dug up.

Patrick Zimmerli was a lecturer for my beginning music theory course. In addition to being upbeat and nice, he was eccentric and hilarious. He encouraged students to dress up on Wednesdays, which he declared “snazzy-Wednesday.” He playfully embarrassed by making us sing chords, which he said helped him relax after a long day. And he told us to call him “PZ.”

  • PZ to female student Susan who’s wearing a wimple, on a Wednesday at that: Wow, you’re really hot and on. [The class laughs nervously.] Oh, was that not appropriate for me to say?
  • The New York Philharmonic used to be the New York Philharmonic Society – lovers of music. Now they just get paid to be yuppies.
  • I am inclined to let this discussion go on, but I’m just going to end it. We will discuss this at 2AM while ingesting hallucinogenics. – PZ interrupting a pre-class discussion on whether glasses makes one’s vision worse.
  • Is that “merch”? – PZ asking about the shirt of a female student who’s a member of Columbia’s Bhangra student group
  • The brain is not for thinking. Remember that. – PZ
  • For those of you who find this unbelievably boring just sit there eand think about whether we should countinue the human species in its current condition. – PZ after some students have trouble with 4-part reduction.

Columbia’s philosophy classes are the paragon of intellectual discourse.

  • What do you have against happiness! - an indignant student on Kant’s Groundwork on the Metaphysics of Morals during Columbia’s Contemporary Civilization course
  • I don’t think it’s fair to assume they were women. – Contemporary Civilization Professor DEL after Nick makes a comment about Adam Smith’s pin factory and refers to the factory workers as “pin ladies”
  • Sorry, I was totally channelling Rosie the Riveter that whole time. – Nick
  • Okay, Chris. You are not allowed to bring up eunuchs for the rest of the section. – teaching assistant Buyun during a Chinese history class discussion section

Chinese language class cracked me up.

  • Big girl have big dream. Tell me your dreams and aspirations. You can say whatever. This is Chinese class so just say them even though they probably won’t come true. – first-year Chinese language class lecturer Jia Liu
  • Although she’s very beautiful, no one likes her. - Chinese language class exercise
    Why is that? – Jia Liu asks class
    Because she’s bitch. – female student Ruoxi out of left-field

Who else brought a pillow to Columbia’s Frontiers of Science lectures?

  • I think if you’re teaching climate change it’s counter-productive to give everyone a copy of the worksheets. – Sharmila Kamat on saving the Earth one handout at a time

Sometimes I wish I were still M.K.’s roommate.

  • I’m not wearing a diaper because I don’t want gay people to rape me. – M.K. on why he’s not dressing up as a baby to the Village Halloween parade
  • I can’t wait to see James and Rachel hook up. – M.K. on James’ newfound intensity
  • I’m gonna fuck your mom in the ear. – M.K.’s retort to Eric’s “yo mama” jokes
  • I know that shit is real because they film it in my stomach. – M.K. about Pinky and the Brain
  • The things I do for my mom…she really appreciates me. – M.K. about his mother
  • I read somewhere that the chances of your vote counting is one out of five billion. – M.K. on the futility of voting

Keep some people in your life for their entertainment value.

  • Obama has won the election. Attn: all white people report to the cotton fields tomorrow morning. – Phillip H. text message to Joseph Y.
  • If you’re interested in someone as more than a friend, even if it’s somewhere down the line, you should want to bone them. – Mishi C.
  • Have you gone off every exit in New Hampshire? – Margaret W. I have actually explored the surrounding countryside, motherfuckers! – Seth D.

Do you realize you’re speaking to reporters on tape?

  • Misfortune is a spectator sport nowadays…Even white male republicans are using it. – former Barnard College President Judith Shapiro
    It’s the only way they can get elected. – former Barnard Dean Dorothy Denburg