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
Wednesday, September 3, 2014
Friday, August 22, 2014
What's so great about meanjs?
| Yarr |
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 |
- 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
- 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
});
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
. 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.
Thursday, January 9, 2014
The villain in us all
![]() |
| Snidely Whiplash, the Machiavelli of cartoon villains |
Probably the most cited villain in history is Machiavelli. Confusingly, he wasn't actually a villain: he only wrote like he was. In his novel The Prince, Machiavelli paints the picture of a ruthless medieval prince that lets nothing stand in his way. Machiavelli clearly explains that a power seeker "must not have any other object or any other thought, nor must he adopt anything as his art but war". If he had actually believed this, he would have indeed been the picture of power-mad evil, but "it's entirely possible (and perhaps even probable) that Machiavelli was being sarcastic" (Klosterman 13). Klosterman explained that Machiavelli has become the gold-standard of villains because he dared to write on the ethos of villainy. Klosterman believes that society has labeled Machiavelli the way we have because we are trained to fear and hate anybody that is capable of having those kinds of thoughts (and writing them down). Machiavelli's prince obviously knew more than any of the other characters, but empathized with others the least. The prince was so evil that even his creator became a villain. There are, of course, modern-day examples of this type of villainy.
The general public dislikes Kareem Abdul-Jabbar. He was "distant and difficult to love" (Klosterman 172). The problem was that Jabbar made it abundantly clear that he knew the most and cared the least. He spoke utterly frankly and unapologetically and the public couldn't stomach it. He is forever labeled as a villain (of sorts) in the public eye. The same is true of OJ Simpson. The man does not behave remorsefully but nor does he seem to miss his wife at all. He did not flee the country. He did not gracefully step down from the limelight, rather, he basked in the tragedy of his wife's death. It's obvious he's apathetic, and "he's the only person alive who can know what he knows" (Klosterman 179). Yet again, the public hates the man that knows the most and cares the least and Klosterman's formula rings true. To further his point Klosterman offers examples that cater to a modern and "hip" audience.
It is obvious that Klosterman wrote this to adult liberal members of American society. He makes a plethora of references to modern technology like blogs and iPods, but he also wrote about movies, sports and news events from decades past as though the reader had experienced those times themselves. In some portions of the book he even admitted that a reader that did not watch the Clinton scandal or observe the OJ trial would not understand the entire meaning of some passages, but the book was also filled with more accessible examples for younger or older readers. Most of the book, however, was about current villains (terrorists or Walter White) or evildoers that society knows quite a bit about. It's obvious that Klosterman expected progressive persons to read this book because he wrote so casually about sex and other crass subjects, but that is not to say the book was entirely tasteless.
It is impressive the way Klosterman skillfully switched from sardonic to serious. He never poked fun at passages that use the word "rape" and was particularly careful when he writes about Hitler, but other sections of the book were extremely funny and relatable. The author managed to refer to the creator of Megaupload (a popular file-sharing site that was once a hotbed of piracy) as a "350-pound, egocentric German multimillionaire who never went to college and refers to himself as Dr. Evil" (Klosterman 137) without seeming abrasive or insulting. Klosterman made similar remarks about the blogger Perez Hilton and Prince (the singer). Because Klosterman is so adept at dancing on the thin line that separates gratuitous offensiveness and hilarity, I give his book the Dancing Shoes award. Other previous winners of this award have been SNL and The Onion (at times), but Klosterman outshines them all with his undeniable wit and his inspiring sensitivity. The book was masterfully comical while still communicating serious ideas.
This book was eye-opening to me. Until I read it I had assumed some actions were inherently villainous, but Klosterman explained this is not the case. Even apparantly diabolical deeds like robbing banks or hijacking airplanes can be seen as audacious and endearing with the right context. It is difficult to think of similarities between all villains that ever existed, but as more and more examples come to light, Klosterman's formula for villainy becomes truer and truer: the villain is the person that knows the most and cares the least.
Sunday, December 1, 2013
Ubuntu software installation
![]() |
| apt-get moo |
Installing pre-compiled packages in Ubuntu is actually pretty straightforward, but finding your software can be confusing. Let's say you wanted to install Chromium, Google Chrome's open-source equivalent. Do some research and check if the software is available for Ubuntu.
If it is, open up the terminal and type apt-cache search chromium (or apt-cache search packagename). This searches your local repository cache for packages related to the search query. You should see a package called chromium-browser. That's the name of the package we need to install.
![]() |
| Do you see it? |
To install a package, type sudo apt-get install packagename, or in our case, sudo apt-get install chromium-browser. You need to type the package name as it appears in the apt-cache results.
If you want to install another package, I recommend gnome-games. If you want to listen to MP3 files or watch DVDs or something, you should check out the Ubuntu page on Restricted Formats and install the package they recommend.
Sunday, November 24, 2013
Java is OK
![]() |
| The typical entrenched C++ developer when asked about Java |
C++ developers decrying Java as insecure is a paragon of hypocrisy. Because Java doesn't permit access to memory management or pointers, a whole class of bugs and security flaws are rendered impossible. For example, let's say we have an int array called arr that is 5 ints long. In C++, it's perfectly legal for us to reference the value arr[-1] (http://ideone.com/JFrEnm), but in Java such a silly statement is automatically decried as an exception (http://ideone.com/Ah1kLn). The reason is that Java abstracts away the subscript operator (the "hard brackets" []) as a function call that fetches the given index from the internal array implementation, whereas the C++ subscript operator performs simple pointer arithmetic. In C++, arr[3] is identical to *(arr + 3) (http://ideone.com/JFrEnm). The second statement evaluates the address that the arr pointer refers to and adds 3 to it, then dereferences (gets the value at) the new memory location. So in C++, arr[-1] just refers to the value held one unit before the address that arr points to. It's crazy that this is allowed, because THERE IS NO WAY TO KNOW what is held at a memory location beyond the bounds of the array! If this is ever used in real code it's a bug or a hack. Even if out-of-bounds values weren't permitted with the bracket notation, C++ programmers could get around this by doing pointer arithmetic, but there's simply no way to do this in Java.
"If you have Java installed and want to ensure that your system is secure, Oracle strongly recommends that you upgrade to the most recent release."
Similarly, Java throws an exception if one attempts to use a null (uninitialized) pointer (http://ideone.com/dr8enx), but it's perfectly legal to do so in C++. Furthermore, "dangling pointers" are almost impossible to create in Java but are commonplace in C++. Memory leaks are nearly as rare in Java because of the almighty garbage collector. I can't think of a way to create a buffer overflow in Java (that is, I think if an unchecked buffer overflow occurred the program would just stop), which covers a wide variety of holes (please feel free to correct me on this).
![]() |
| Lucifer, the quinteſſential demonic being |
The largest Java security vulnerability is the fact that most users are running Java SE 6, which is no longer supported by Oracle (see http://en.wikipedia.org/wiki/Java_version_history). You can't blame Oracle for pulling support from a version of Java that came out in 2006! People, you need to update your freakin' Java! The update dialogs are annoying for a reason. Later versions of Java are well supported and actively developed by the good people at Oracle. From the Oracle website: "If you have Java installed and want to ensure that your system is secure, Oracle strongly recommends that you upgrade to the most recent release."
![]() |
| Anyone looks like a witch with a carrot on their nose |
Subscribe to:
Posts (Atom)









