Tuesday, October 28, 2014

Alright let's Shakespeare a little bit

Ok, let's do some Shakespeare.
1. Which currently famous actors and actresses would you cast in the following roles, and why?
  • Cordelia - Only Sigourney Weaver has the raw and blunt honesty required to play Cordelia.  Her matter-of-fact but impassioned speeches are perfectly suited for Cordelia's contemplative monologues.
  • Regan - Regan requires a creature of remote beauty.  Uma Thurman can be icy cold but appealing simultaneously, so this is a good fit.
  • Edmund - Robert Pattinson has the dark, brooding appearance of a traitor.  Edmund and Pattinson would both suck you dry if given the chance.
  • Albany - Albany's kind of a non-entity in this play.  He's a positive influence for Lear, but he doesn't do much of significance.  For him, we need an actor that can fade into the background in an unexciting way.  I think Steve Buscemi could fill such a role.
  • The Fool - Hugh Laurie is the perfect fool.  In House, everything Hugh Laurie says has a double meaning and more significance than meets the eye, just as The Fool.
2. Which character (out of all of them) do you most admire and why?
At the risk of sounding trite, I believe The Fool is the most admirable character in the play.  He never acts in a duplicitous manner, though he is often hard to understand.  He starkly speaks and doesn't soften his words in blind deference to the king.  Like a fine wine, Lear's fool is an acquired taste.  Taken with enough thought, The Fool is arguably the most authentic character in the play.  The Fool is a refreshing break from all of the unclear motives and evilness in the play.
3. Aristotle believes a proper tragedy will evoke a catharsis in its audience.  Which scene induces catharsis?  Can you explain why?  (It will help to review the long definition of catharsis.)
King Lear is not a soothing play.  Throughout the work, terrible things happen and continue to happen.  There is no particular moment when the pressure and upset is relieved, but there is quite an epic conclusion.  The great death scene at the end where many major characters perish could be thought of as cathartic.  Though King Lear and Cordelia (the primary positive or empathetic characters) die, so does Edmund, which is moderately relieving.  I suppose the death scene could be considered cathartic, if for no other reason than some bad guys die.  It's also kind of relieving when King Lear finally dies, because at that point you know he's free of his madness.  As far as I can tell, catharsis doesn't have to be positive, just relieving.
4. When Lear and the Fool are leaving Regan's and headed into the storm, Lear is concerned about going "mad" (crazy or senile).  The storm is a symbol of the brewing madness in Lear's mind.  What aspect of aging frightens you, and what could symbolize it?

Madness is synonymous with the phrase "losing one's mind" for a reason.  More severe mental disorders manifest literally as a shattered psyche; multiple personalities existing in one consciousness.  Lear feels his will slipping away rapidly, and comes to hate and fear this process.  Lear regards the end of his life as something to be conquered and opposed, rather than a natural process to be embraced.  This internal conflict and inevitability of aging is symbolized by the large and tumultuous storm brewing outside.  Just as the atmospheric eddies are barometrically at odds, Lear is at odds with the very process of aging.

No one wants to get old.  Though there's no theoretical upper limit on the age of human cells, in practice people don't often live much past 100.  After life, there's no guarantee that anything else happens.  At all.  So, I suppose I'm most afraid of approaching death.  After all, isn't that what age is a measure of?  One's proximity to death?

Death is often symbolized.  It's a recurring theme in the human psyche, and many a famous artist has touched upon the subject.  If I were to symbolize death in its most haunting form, I would choose blackness.  Lack of sight and vision implies lack of general sensory perception, which is what I'm afraid death might be.  I want to be sure I'll 'continue', but age is certainly an obstacle. 
5. How does reflecting on King Lear (its story and/or particular characters) make you feel "uncomfortably at home"?

Shakespeare comes difficultly to me.  Languages, especially English, are contextual creatures: to fully understand them, one must understand the cultural background.  English is so fragmented and nuanced that a single word can have several meanings depending on pronunciation, spelling and emphasis.  I have very little contextual knowledge of Shakespeare's time, and many of his words appear foreign to me.  However, with an effective "translation" at my side and much effort indeed, I can comprehend The Bard's writing.  When I do bridge that language gap, the characters in King Lear come into sharp relief.

It is easy to empathize with the characters in King Lear.  The important ones are illustrated as nuanced and multidimensional.  Based on an odd formula of drama, emotion and madness, each character's motives are easily understood and sympathized with.  The characters in King Lear are just as human as you or I.  A rage terrible enough to gouge another's eyes out is comprehensible, if not actionable.  We all feel as if a storm is raging when we conflict with a process that comes from within.  We can love Lear and appreciate his folly (as pointed out by The Fool) at the same time; a process which is not easy, even with real people.

King Lear resonates in an uncomfortable way.  In the inhumanity of the characters, we see ourselves.

Tuesday, September 23, 2014

The Coding Process

A lot goes into the coding process, and it can be confusing.  That's why I wrote up this guide; to help newcomers navigate the sometimes-difficult process of bringing software live.  It's open-source, so if you have any changes or suggestions you're welcome to help out!  You should really follow the link, because the version here won't be updated.

The Coding Process

  1. Define your project
    • Clearly state what you wish to accomplish
    • Make sure this objective has measurable goals!
  2. Explain your MVP (Minimum Viable Product)
    • This entails the core functionality of your application
    • What does your app need to do work?
    • This is the 80 in the 80-20 rule
  3. Break code into small chunks
    • Make user stories - small detailed explanations of the user's point of view when interacting with your app
    • Example: The user clicks on the button in the center of the screen and an alert appears
    • User stories should be limited in scope
    • User stories are rated in difficulty to facilitate project management
    • User stories don't just have to be for the frontend! The API is a user interface too.
  4. Write a design doc
    • This resembles a program in structure
    • Higher level than actual code
    • Make a comment skeleton in program files explaining what the code should do
  5. Start coding!
    • This should be a minimal amount of work
    • You should have the code already spelled out in the design doc
  6. Know when to stop
    • Don't go for 100% perfection - you'll never finish!
    • Once the MVP is operational, stop coding and review
  7. Review
    • Make sure the app is operational
    • Check for errors, bugs, codesmells and crashes
    • If any fixes need to be made, spell them out clearly now so they don't cause problems later
  8. Code some more
    • Fix any problems revealed in the review process
    • Minor improvements, bug fixes, etc. - no major changes should happen at this point
    • Go back to review when this is done, unless nothing needed changing (highly unlikely)
  9. Review one more time!
    • Come on, I know you didn't look hard enough for that bug. Trust me, you'd rather find it sooner rather than later.
  10. Finalize and start production
    • Bring your app live!
    • No changes should occur at this time
  11. Start the maintenance process
    • You didn't review your app well enough before. I promise.
    • You'll need to make fixes and changes to your app during its lifetime.
    • Follow established criteria for the update cycle.

Contributions

I gladly welcome updates to this manual! Please, fork and submit your changes upstream.

Thursday, September 18, 2014

Tech Club Meeting September 17, 2014

Hey everybody, in case you missed the meeting on September 17th or just want to review the material we covered, here's the video.  We decided to build a breakout-style game in javascript and I covered some programming basics.  We used jsfiddle.net for our demos.  Please make accounts on github and trello if you haven't done so already!


Wednesday, September 10, 2014

Object Orientation


Here's the audio version of this blog post:



These are objects
What is an object?  In real life, a lot of things are objects.  Plants, bicycles, cars, pets, bananas, thoughts, really anything!  Even people could be considered objects (bear with me here).  The question "what is an object" raises some philosophical issues, but it is clear that objects play a large role in our daily lives.

Because objects are so pervasive in our perception of the world, we can say we experience life in an object-oriented way.  For example, take the sentence "I'm going to the store".  Here, "I" refers to the person object that is going to the store.  The store could be interpreted as a destination object, which implies that there is also an origin object.  The subject of our example may plan on driving his car object to the store, or riding a bike object.  At the store, a person can buy food objects.

This example again raises the question, What is an object?
Let's define some criteria for object-ness:

  • An object must have characteristics
    • Tangible characteristics:
      • Color, size, weight, location
    • Non-tangible characteristics:
      • Emotions, personality traits, powered on, powered off
  • An object must have actions
    • Things that it can do or things that can be done to it
      • Run, walk, eat, drive
      • Power on, power off
      • Paint (change color)
      • Grow
  • An object must be identifiable
    • It must be a distinct entity
      • I can have two pens of the same model, but I still have two different pens
Notice how we never specified that an object must physically exist.  Our criteria for an object could include thoughts, conversations or mathematical formulas.

Because objects are so omnipresent in life and the human experience, things we create will reflect this object-oriented way of thinking.  Humans can easily think of problems in terms of objects, so we created many software tools to describe and interact with objects.  Programs that simulate icebergs melting or control aircraft scheduling patterns can be developed in an object-oriented way.

Not how it is
So, this means when we write most programs, it is easiest to write them in an object-oriented way.  This results in minimal effort on the programmer's part.  Well designed object-oriented programs read more like a description of the real world than arcane source code.









Alright, let's see some code.

class Pig:
    #definition for Pig object
    def __init__(self, weight, age, name):
        #a pig has weight (lbs), age (years) and a name
        
        #assigning parameters to pig object
        self.weight = weight
        self.age = age
        self.name = name
    
    def oink(self):
        print "Oink!"
        
    def sayHello(self):
        print "Hello, my name is " + self.name + "."

#make a new pig named Spider pig that weighs 40 lbs.
#and is 3 years old
SpiderPig = Pig(40, 3, "Spider Pig")

#make spider pig introduce himself
SpiderPig.sayHello()

#make spider pig oink
SpiderPig.oink()

Here's a link to an editable and runnable version of that example.

The programming language I used to write that example is called Python (named after Monty Python's Flying Circus).  If you want a more in-depth introduction, check out my blog posts Python Intro and Python Intro Part Deux.  I also wrote an introduction to Java, another object oriented programming language.

Monday, September 8, 2014

Argument Unpacking in Python (holy balls!)

Hey y'all, I'm here to teach you about Argument Unpacking.  Please, try to remain in your seats.
Woah that guy just got Argument Unpacking













So I had to do some screen scraping (follow that link).  Yuck, right?  Except no, I get some weird sick pleasure out of screen scraping (I volunteer to do it).

(Skip this if you know what screen scraping is)
So in short screen scraping is when you translate a hard-to-traverse website into a nice data structure like json.

Anyways, I was writing a screen scraper for the paint mixer.  I made classes for my data templates (yay go me).  At first, I thought it would be easy to just iterate through the table cells using BeautifulSoup (a very cool and excellent Python html parser).  That was not good.


for cell in cells:
   if cellNumber == 0:
    try:
     cardNumber = cell.contents[0]
    except IndexError:
     cardNumber = None
   elif cellNumber == 1:
    try:
     firstName = cell.contents[0]
    except IndexError:
     firstName = None
   elif cellNumber == 2:
    try:
     lastName = cell.contents[0]
    except IndexError:
     lastName = None
   elif cellNumber == 3:
    try:
     email = cell.contents[0]
    except IndexError:
     email = None
   elif cellNumber == 4:
    try:
     balance = cell.contents[0]
    except IndexError:
     balance = None

^^^ Holy Mother that is bad

I knew Python just had to have a better alternative to this (the word pythonic is a thing, talk about a language dating itself), so I did me some googling and came upon a glorious find: argument unpacking.
This is going to be you in a few sentences











The Astute Reader (tm):  Wow, that traversal Max was talking about seemed really array-like!  I bet there's an easier way to do that!
Me:  Gee thanks captain obvious!  You don't think I was lamenting that with every line I wrote?  I knew I was so close!
The Astute Reader (tm):  Ok, that was an obvious lead-in to Argument Unpacking.  Let's have it, then.

Ok, here it is...drumroll please.

I have a method that takes 6 parameters:

def method_with_lots_of_freaking_parameters(x1, y1, x2, y2, x3, y3):
 print "Haha I'm not even going to use those arguments!"

And I have a list with those parameters stored just itching to be passed to that method
superswaglist = [5, 1, 3, 6, 6, 6]  #wow this is super contrived huh?

Without Argument Unpacking, this is how you'd have to call that method
method_with_lots_of_freaking_parameters(superswaglist[0], superswaglist[1], superswaglist[2], superswaglist[3], superswaglist[4], superswaglist[5])  #puke

But with this blessed tool (In the Name of Python We Pray), we simply call

method_with_lots_of_freaking_parameters(*superswaglist)  #wow such ease
I couldn't agree more
This tool condensed 56 lines of code into one for my screen scraper tool.  Be excited.

PS If you want a tutorial on screen scraping let me know in the comments!

Thursday, September 4, 2014

Tech Club primer

The Beautiful
I recently started a Tech Club at my school.  It's super awesome, and you should go.  If you're interested in science, the future, academia or art, you'll have a place here!  Tech Club is a group of like-minded individuals that love to discuss the future and the possibilities modern technology provides.


You do not need to be a 'computer person' to enjoy Tech Club.  If you're interested in discussing the future and imagining things to come, you'll fit in just fine!







To get an idea of what Tech Club is all about, watch this video:



And this one:



Here are just a few projects we might work on:

  • A game
    • a board game (chess, monopoly, not already an app)
    • Chess engine (AI)
    • one ai learns lots of games
  • Public forum (on canvas)
    • a qa system
  • Moodle...
    • old version of canvas
    • mobile end of lms
  • Online dance ticketing system
  • Better version of canvas
  • Math stuff
    • visualization
    • numerical analysis
  • Fractals
  • Recreate twitter or facebook for fun
  • bio printer
  • quad copter stuff
  • bluetooth control app
  • music listening stuff
  • new iteration of social media
    • gps on gopro
    • online db of experiences
  • PowerSchool screen scraper
    • stay signed in
  • zupas...
    • app to simulate sandwich assembly
    • sell to zupas
    • (quizlet)
  • Booster juice ordering app
  • online bus tracking system
    • schedule online

If you're interested in attending, fill out the Tech Club Application.  There's zero commitment involved in signing up, in fact, we encourage drop ins!