Wednesday, September 3, 2014

The Catcher in the Rye (4)

After Holden's messy date, he calls up an intellectual friend and arranges for drinks later that night.  Then, another insight into Holden's psyche that helps us to empathize with him.
Anyway, I'm sort of glad they've got the atomic bomb invented.   If there's ever another war, I'm going to sit right the hell on top of it.  I'll volunteer for it, I swear to God I will.
(Salinger 141)
This internal dialogue comes right after Holden reveals that his older brother was in the army "for four goddam years."  Poor kid.
Holden and his friend meet up for drinks.  They talk.  Holden gets mad.  They part ways.  Spotting a pattern, anyone?
Holden gets extremely drunk and reminisces about his dead younger brother.  Holden suddenly decides to go visit home and see his little sister, Phoebe.  He wakes her up, and they have a conversation, which turns to why Holden is home so early.  His sister finds out he was kicked out and refuses to talk to Holden.  He coaxes her back into the conversation, and they discuss various heavy issues.  They bond for a while, when their parents show up and Holden bolts out of the house.  Without a place to stay, Holden turns to old friends, Mr. and Mrs. Antolini.  Holden falls asleep, and wakes up a few hours later with Mr. Antolini patting his head.  This is deemed "perverty", and Holden freaks out and bolts again.

I have to agree with Holden, something about this event feels a little rapey.  This reminds me of a similar scene, albeit from a totally different angle and perspective, in the book The Art of Racing in the Rain.  The scene where the younger niece comes on to the older male protagonist leaves just as bad a taste in this reader's mouth.

I tend to take life at a high speed, and often fail to appreciate the present.  Holden has a similar problem.  His wild and crazy antics are a reflection of his need to appear adult-like, just like myself.  I, like Holden, need to slow down and appreciate the small things.  Adulthood ain't easy.

The Catcher in the Rye (3)

Guess who's back (back back) back again!  Will the real Holden Caulfield please stand up?

Where last we left our intrepid hero, he had two older women hanging on to his every word (or so he wished).  This was in a dive bar.  Flip forward to Holden inside a cab.  He has an utterly ridiculous discussion with the cabbie regarding the survival of fish in the nearby often-frozen duck ponds.
Holden: "All right.  What do they do, the fish and all, when the whole little lake's a solid block of ice, people skating on it and all?"
Cabbie: "What the hellaya mean what do they do?  They stay right where they are, for Chrissake."
(Salinger 82)
...and so on
After a decidedly unpleasant cab ride, Holden arrives at Ernie's (another lame bar), where he proceeds to lamely pick up on chicks.  It doesn't go well.  After a protracted, even herculean effort, Holden concedes defeat and heads to a hotel.  While Holden rides up the elevator to his room, the bellman Maurice starkly asks him
"Innarested in a little tail t'night?"
Shocked, the surprised Holden eventually says he is indeed innarested.  In about 45 minutes, in bursts a hooker into Holden's hotel room.  She attempts to initiate "relations", but Holden just wants to have an innocent chat (this kid is actually pretty sensitive).  Upon discovering this, the girl leaves.  Holden believes all is well, until some time later the girl and Maurice return to his hotel room, demanding an exorbitant price for the encounter.  Some arguing occurs, and Holden is roughed up a bit.  He goes to bed with injured face and pride.

After this episode, Holden schedules himself a date with an old friend, Sally.  They go to see a "show" (movie?) and confess their love for one another.  After that, they go skating and have a fight about their future together.  Holden says something mean and Sally starts crying.  Poor Holden.

Holden is a terrible ladies' man, but he doesn't seem to understand this.  Holden also doesn't understand that he's too young to be acting like this, drinking and flirting and smoking and whatnot.  Holden definitely ought to be a little more wary of people like Maurice.  He, like Willy in Death of a Salesman, is unable to confront the truth about himself.  Holden is clearly a sensitive guy, so if he just reflected on his process and really thought about it, he would get the girls.  Holden needs to take a step back and get a reality check on himself, just like Willy.

I think we all delude ourselves into thinking we are more mature than we really are.  I know I'm guilty of this.  I always feel so grown up at my current age, but I know I will feel even more adult-like a few years into the future.  At fifth grade, I thought I was on top of the world.  I'm sure you know what I mean.  To truly understand myself, I need to take a step back and view my maturity and development objectively, just like Holden.

The Catcher in the Rye (2)

Hear ye, hear ye!  I have yet another riveting update to share with you regarding my obligatory summer reading book, The Catcher in the Rye.  Last we left off, we discovered that the brooding teenage Holden has a good reason to be sad: his younger brother died of leukemia.  Flip forward a few more pages, and we are planted into a flashback involving Holden and one of his classmates.  Holden and Stradlater (the alpha-male classmate dude) get in a rather nasty fight about a girl, and Stradlater drew blood.  Holden and Stradlater obviously feel bad about the whole thing, and seem to just want to move on rather than hold any grudge.  It's hard to say what Holden really wants out of this relationship with Stradlater, because they were previously something that could have been interpreted as friends.  I guess Holden's just having a hard time.

Enter Ackley, the questionably hygienic "older" kid that no one seems to like.  Holden, ever the gentleman, is at least moderately polite to Ackley, most of the time.  After some antagonistic dialogue with Ackley, Holden heads off campus to the train station.  On the train, he meets the mother of one of his classmates and acts all adult-like with her.  Holden eventually arrives in New York, where he goes cruising for chicks at some random bars.  Surprisingly enough, he does meet some (significantly older) women, but they don't hit it off.

Holden awkwardly hitting the town reminds me of the Hogwarts students romping around Hogsmeade, except the Harry Potter kids seem to know their place a little better than Holden does.  Both Holden and Harry Potter and co. seem like they don't really know what they're doing outside of school, but Holden seems a little more streetsmart.

I'm not really a rebellious kid, but I can understand what Holden is trying to do.  His taking off and hitting the town is an attempt to seem grown-up, wild and interesting.  We can all relate.

The Catcher in the Rye (1)

This summer, I'm reading The Catcher in the Rye. So far (as of page 40), the main character, Holden, seems to be yet another angsty and apathetic teenager that doesn't really like anyone or anything. His parents seem to have shipped him off to some sort of boarding/reform school because of some trouble he's gotten into in the past or something. Apparently this didn't really help things, because the first few pages reveal that Holden got kicked out of school (again?). After supplying some (intentionally vague) background information, Holden visits one of his sort-of favorite teachers. The visit is super awkward. After that unfortunate encounter, Holden sort of gets into a fight with one of his semi-friends from school (this is a flashback).

He seems like an overly mopey and judgmental kid until he reveals that his younger brother died of leukemia, at which point you feel like a complete douche for judging him. This mopey I-hate-school-and-don't-understand-changes-happening-in-my-body-and-around-me phase is a pretty common occurrence in teen/YA books. I suppose it's mildly evocative of Ender's Game. Ender, like Holden, has a tough time making friends. I bet those two could have a great mope sesh together.

I can completely empathize with Holden, except for the dead younger brother thing. I feel pretty bad for him as far as that goes. But the whole teenager thing? Ya, I'm living it right now. I hate school too, man. *hugs

Friday, August 22, 2014

What's so great about meanjs?

Yarr
(Note: this is a more technically-oriented article, and I plan to write another, more accessible version in the near future)
I'm sure you've heard the hype: "Node is taking over.  Batten down the hatches, me hearties."  And they're right.  With the new fullstack javascript frameworks that are coming out (namely meanjs and meanio), node, angular, and all their buddies are taking the development world by storm.  To implement a basic blogging service with user accounts, passport authentication, a complete json api and more is as simple as typing
yo meanjs
The way things are going with things like alchemyAPI, node robots and web sockets, us developers will be out of a job some day, which leads me to my point: meanjs is the greatest thing ever (so far).  So, what is meanjs, exactly? (I apologize in advance for all the mean puns)



  • What "mean" means
  • What mean means for me
    • I don't have to learn 4 (four)  flippin' different languages!  Back in the good old days, people needed to learn PHP and SQL for the backend and JavaScript and ActionScript on the frontend.  This process was further complicated when other tools and frameworks emerged, like Java Applets.
  • Wait, how does meanjs change that?
    • From the meanjs site: "MEAN.JS is a full-stack JavaScript solution that helps you build fast, robust and maintainble production web applications using MongoDB, Express, AngularJS, and Node.js."
    • "a full-stack JavaScript solution"
    • You only have to learn one programming language!  That is a very big deal.
  • So why should I use meanjs instead of rolling my own full-stack js framework?
    • One word: boilerplate
    • meanjs is distributed via a yeoman generator
      • This tool autogenerates content common to every fullstack js application, thereby infinitely expediting the development process
      • It even comes with bootstrap ❤ (a beautiful html and css boilerplate compilation)
  • yeoman generator
    • The meanjs yeoman generator generates static boilerplate code fine, but it also generates application-specific modules for you as well
      • The crud module generator automatically generates frontend and backend modules for segments of your application.  However, this is no simple ajax.  In fact, every crud module generated is turned into a REST endpoint, so your entire site interacts using public (or private, should you choose) api calls.
      • This means the api won't get neglected: the usefulness of the application is directly related to how good your api is
      • How to use the crud module generator:
        • yo meanjs:crud-module modulename
  • So, how much does this meanjs thing cost me?
    • Nothing, it's free and open source software (github page) thanks to the superheroic efforts of Amos Haviv :-)
  • Ok, I'm ready to learn this framework.  How many years will it take?
    • Don't make me laugh.  If you've got a good deal of determination, and the ability to reason through problems, you can be up and producing within 2 months.  The framework is, after all, only in its infancy
This framework is so exciting because anyone can pick it up and be superheroic while working with it.  I want to teach everyone that will listen how to code.  With these modern frameworks that make programming so accessible, I plan to share this knowledge with historically underrepresented demographics in computer science, and to level out the playing field for the future.  Frameworks like this will change the world.

Tuesday, August 19, 2014

How to use OAuth with MEANJS

Nodejs logo
Hello, this is a short tutorial on how to use OAuth with meanjs.  It can be followed using another framework, but there are some mean-specific tips in here.  You probably do need node, though.







  • To use oauth with meanjs, you should find a library that has already implemented the handshaking for you (googleapis and Twit)
  • A note about OAuth 1 vs 2:
    • OAuth support is fragmented
    • Lots of node libraries support both
    • Not all services support 1 or 2
  • Note: if you plan on using user-based authentication along with application authentication, it is much easier to use the existing passport integration that meanjs already has in place
    • This makes obtaining session tokens much easier
  • Most often, these libraries will provide easy-to-use interfaces (APIs) where keys are passed as a config object
    • demoTwit.png
    • All you need to do is put in your keys where they are needed
  • To get access tokens, most of the time you need to create a new app
  • These instructions are pretty straightforward usually
  • The callback url can be found in config/env/development.js under the object whose service name you are using
  • Note: if you use a non-standard port on your app, you must specify that port in the callback url (127.0.0.1:3000/callback/)
  • A note on twitter’s api app creator:
    • For some reason, twitter doesn’t like localhost to be in the callback url, so you need to specify localhost using 127.0.0.1 eg
    • 127.0.0.1:3000/auth/twitter/callback
  • This will give you one or two application-specific tokens or secrets
    • These application-specific keys are used to authenticate your app
    • If you need per-user authentication as well, read on
  • To fill in the per-user authentication tokens, you need to interface with passport and the existing meanjs framework for these things
    • These session keys can be obtained from the user object after authenticating eg
var providerData = req.user.providerData || req.user._doc.additionalProvidersData.twitter;

   var T = new Twit({
       consumer_key: config.twitter.clientID,
       consumer_secret: config.twitter.clientSecret,
       access_token: providerData.token,
       access_token_secret: providerData.tokenSecret
   });

  • The branch googleApiDemo of my fork of extra-mean has a demo of something like this, feel free to use it as an example
  • Any questions?  Leave a comment or email me at macsj200@gmail.com

Wednesday, March 19, 2014

Cool dudes that totally had enough going on in their lives

This quarter, I embarked on a mathematical adventure.  The enchanting tome, Men of Mathematics, expanded my horizons and challenged my understanding of modern mathematics.  Ultimately, however, I realized that I'm "too old for this shit".

The author of Men of Mathematics, E.T. Bell, wrote about mathematicians that changed our world.  This book was written in the late 1930s, shortly after Einstein formulated his theory of general relativity and quantum mechanics was just beginning to be understood.  While this book does not require advanced knowledge of mathematics, it is obvious that Bell expected this book to be read by intellectuals with a keen interest in math.  He wrote this book to make the world understand the men behind these earth-shattering discoveries.  The lives and works of mathematicians could be considered a dry topic by some, but Bell does an effective job of keeping the reader engaged.

This book offers a short synopsis of the lives and discoveries of a multitude of mathematicians, up to 1937.  These were some weird dudes.  Euler (left) made the most contributions to mathematics in history (and did most of his good stuff when he was blind!).  Newton invented calculus because he didn't want to go outside and mingle with intellectual plebs.  Lagrange (sort of) figured out a solution to the three body problem, the only question to ever make Newton's head ache.

Euler was a busy dude.  He was, in fact, "the most prolific mathematician in history".  Some even referred to him as "analysis incarnate".  "It has been estimated that sixty to eighty large quarto volume will be required for the publication of his collected works".  Euler has yet to be surpassed (as of 2013) as an algorist (one who develops algorithms).  And, as previously mentioned, he was blind for the last 17 years of his life.  Did this hold him back?  No!  When he realized he was going blind (for the second time), he taught his son to be a mathematical scribe.  Some of Euler's greatest works were done during this time.  Euler had a supernatural gift for linking apparently unrelated equations; he loved beautiful formulas for their own sake.  Euler's strangest gift to us most definitely lies in the relation e^{i \pi} + 1 = 0.  Think about that for a second.  That is super weird.  Euler continued his legacy in his close associate and quasi-student, Lagrange.

Lagrange was the apple of Napoleon's eye and the protege of Euler.  He became a senator, a count of the empire, and a Grand Officer of the Legion of Honor (thanks to Napoleon).  Lagrange was strictly against diagrams; the preface of his textbook read "No diagrams will be found in this work".  Ironically, he served as a stepping stone for Einstein's theory of general relativity by describing mechanics as the geometry of space of four dimensions (three cartesian coordinates for position and one for time).  He tackled the three-body problem (the gravitational interaction between the sun, the earth and the moon), thereby partially solving the only problem that Newton couldn't figure out.

Newton, too, was a busy dude.  He invented (yes Ms. Colberg, I said "invented") calculus!  His successors point to him "as the supreme intellect that the human race has produced".  High praise indeed, but well deserved.  He was convinced that light is indeed a particle (kind of) about 400 years before the rest of the world caught up with him.  He formulated the universal law of gravitation, and he came up with those famous three laws of motion.  Newton's brain changed the world.

This book is about math, but it is not a math textbook.  To avoid giving readers death by boredom, Bell peppers the mathematics with short biographical synopses about the men behind the principles.  Without this human element, this book would be dull and common.  To engage the reader further, Bell occasionally adopts a humorous tone: when explaining that Lagrange felt no connection to his biological mother that left him on the steps of a church as a baby, the author quotes Lagrange as saying "You are only my stepmother", then parenthetically comments "a good pun in English, but not in French", making it clear that Bell is a real person that enjoys a good laugh now and then.  Bell also makes sparing but charming use of alliteration ("decisive die") to make the reader sit up and re-engage with the book.  Bell uses italics and varied typesetting to the same effect as the aforementioned alliteration (see what I did there?).

To make the mathematics of this book slightly less daunting, the author makes copious use of diagrams and mathematical typesetting.  The author explains a concept and later reinforces it algebraically or visually.  This helps to break the monotony of reading academic mathematical proofs.  While Bell explains how a mathematical concept works, he also explains how the mathematician derived the concept, reminding the reader of the purpose of the book.

This book is well grounded and not self-important.  Though the title and the mathematics discussed may sound daunting, the author does a good job of writing so a non-math-major can understand the concepts.  Bell is not an elitist, but he does write in such a way that at least a modicum of intelligence and critical thinking is required to fully understand and appreciate his book.  Therefore, I give this book a superciliousness factor of 6 (10 being the Principia by dearest Newton, 1 being Beavis and Butthead).  If you have an interest in mathematics and would like to learn more about "the lives and achievements of the great mathematicians", I highly recommend that you read this book.