Josh Haas's Web Log

Archive for the ‘Uncategorized’ Category

Stop teaching Shakespeare in schools (except maybe his sonnets)

without comments

LYes, he was a slick, slick dudeet’s be honest. I enjoy Hamlet. I think it’s great writing. I enjoy the game of piecing out Shakespeare’s meaning, catching all the symbolism, watching the way he expertly plays with words.

ANYONE WHO WATCHES A PLAY ABOUT A DUDE WHO MUDDLES AROUND AND GETS HIMSELF KILLED BECAUSE SOMEONE KILLED HIS DAD AND SLEPT WITH HIS MOM AND GOES “OH WOW, I LEARNED SOMETHING ABOUT MYSELF!” PROBABLY NEEDS SOME PRETTY SERIOUS THERAPY.

Just saying.

Why do we put tragedy on a pedestal? I really don’t know. I bet if you ask a random sampling of college educated adults what the deal is with tragedy, why people like it, 90% of the people who manage to evolve any kind of answer at all will come up with “catharsis”. Why? Because that was what Aristotle thought, and in the 10,000 years since he died, no one’s come up with a better answer. But at this point I feel like we’re just saying it because we’re saying it. We’ve been conditioned that if we don’t think Hamlet is the best piece of literature on the planet, there’s something wrong with our cultural taste, so we back-rationalize to the answer we were given in high school English class.

I appreciate Shakespeare because of his writing, but in spite of his plots. Frankly, his plots are pretty… Elizabethan. I don’t buy universal human experience. I buy universal human nature interacting with highly contingent circumstance leading to infinitude of permutations.

The good news is that the people who actually create stuff have all moved on — in fact, they probably moved on a century ago. It’s just, high culture hasn’t gotten the memo yet. Let me give some examples of what I consider modern “great literature”:

Wouldn’t it be funny if the rest of this blog post was just a collection of Fatboy Slim music videos? I could keep going, you know. Don’t make me do that.

Other “real literature”:

The reason I don’t like tragedy is that I don’t like books about easy stuff. Easy stuff is boring. Getting yourself killed off, or slowly poisoning yourself to death with alcohol, or persisting in a semi-alive state as your hopes and expectations are crushed, that’s all pretty easy. You just sort of have to show up. What’s hard is doing something amazing. Creating, bringing life and new forms of complexity into the world. All the things that make a good story — all the conflict, all the ups and downs, the pain and growth, the stupidity and insight, the missed chances and the redeeemed ones — they all matter to me only in the context of someone getting out there and fucking trying.

And the good news is, there’s plenty of people in the universe going out and doing exactly that.

Written by jphaas

December 7th, 2011 at 2:16 pm

Posted in Uncategorized

Learning to be Rational

with one comment

Back in 2006 I was diagnosed with depression. I was in college, and I had run into a simple, common life frustration that probably afflicts 1 in 3 college students, namely unrequited love. But it totally broke me. I didn’t have the coping mechanisms or skills to deal with it and move on. Instead, I retreated from social situations, threw temper tantrums, sat around crying, and scared the hell out of my roommates and friends. At the low point, one evening I walked off campus and headed out in a random direction; I walked for hours and hours in the cold, trying to somehow physically escape from my own mind. Eventually I was freezing and really had to pee, so I stopped in a McDonald’s, turned around, and went home. Afterwards I sat in my dorm room for a couple hours cradling a knife and thinking about killing myself. My roommate came in and I glared at him for a while: he thought I was totally insane. I kind of was.

Eventually one of my good friends force-marched me to Harvard’s mental health center. I started taking antidepressants and seeing a psychologist. I started meditating regularly (also thanks to my friend and her boyfriend). I bought some books on Amazon: I remember reading Lord Chesterfield’s Letters and Mrs. Dalloway. And I wrote stuff: I kept a kind of journal, I poured a lot of heart into my school papers, I wrote long philosophical rants. My previous paradigm for understanding life had failed me, and I needed to figure things out.

I’m not sure if I can really articulate how I thought about things back then. I think I basically believed that a) I was smarter than everyone around me and therefore more worthy, b) therefore I was going to be wildly successful and famous and have all the women, money, power I wanted (in a benevolent, contributing-back-to-humanity kind of way), c) I wasn’t totally sure how I’d get from where I was (socially-awkward nerd with a lot of academic potential but who hadn’t accomplished anything of note in the real world) to where I wanted to be, but I was given to understand it involved a time-based “growing up” process that would kick in eventually. I think the reason I fell apart is that for the first time in my life, I really, really wanted something, and I couldn’t have it, nor did I have the slightest clue how I could get it. The fact that I was book-smart didn’t help me at all. I began to suspect that growing up wasn’t a passive process that would inevitably happen to me, but rather something that I needed to actively take part in, and I had no idea how to do that.

I think the two ingredients for happiness — for not being depressed — are acceptance and empowerment. It’s okay that things aren’t perfect. It’s okay that I hurt, that my friends hurt, that my apartment is too small and I have razor burn on my neck and my shirts don’t fit right and I had what I thought was a brilliant idea and realized later I was being idiot. It’s okay if things stay like that forever, if I never solve my problems. It’s okay because there’s no platonic ideal out there of how things should be; there’s no judge, no scoring system; just each moment, one by one until we die. That’s acceptance. Empowerment is feeling like, okay, so things are okay as they are, but I’d like them to be different, and I can actually do something about it. I can learn, I can get smarter. I’ll probably fail, repeatedly, but if I care enough and work at it long enough I’ll eventually be able to achieve anything I want.

One of the the things that pulled me out of my depression was a sense of purpose. The system had failed me. I was supposed to be the 1% of the 1%, with the best education that money can buy, ready to take over the world, and instead I was crying on the floor of my dorm room. As I piece-by-piece learned how to manage my emotions, work towards goals, see the world from a broader perspective, I became increasingly outraged that I had to figure this all out for myself. How many other people out there were suffering because they hadn’t gotten the memo? Looking around at my fellow students, a lot of them were pretty miserable. How is that possible? Most of these kids had lived incredibly privileged lives, received loads of attention and care, and were now attending what was allegedly the top educational institution in the world. And they were unhappy? Something had to be done! Viva la revolution, baby!

As the years have passed I’ve grown increasingly less confident that I know how to solve the happiness problem for anyone else. (In 2006-07, I thought it was really simple. Mandatory meditation classes for everyone!) I still feel though like there’s something broken in paradise. I think a lot of my life for the past five years has been a reaction to my experience with depression, my anger at myself for being so slow to learn, my anger at the system for not helping me more.

I’m still piecing things together for myself. Since I started looking, I’ve found a lot of exceptional people who’ve found their own paths towards sanity and rationality. I think the best articulation of what I believe right now comes from one of my former bosses:

…treat your life like a game or a martial art. Your mission is to figure out how to get around your challenges to get to your goals. In the process of playing the game or practicing this martial art, you will become more skilled. As you get better, you will progress to ever-higher levels of the game that will require—and teach you—greater skills. …

This particular game—i.e., your life—will challenge you in ways that will be uncomfortable at times. But if you work through this discomfort and reflect on it in order to learn, you will significantly improve your chances of getting what you want out of life. By and large, life will give you what you deserve and it doesn’t give a damn what you “like.” So it is up to you to take full responsibility to connect what you want with what you need to do to get it, and then to do those things—which often are difficult but produce good results—so that you’ll then deserve to get what you want.

That’s just the way it is, so you might as well accept it. Once you accept that playing the game will be uncomfortable, and you do it for a while, it will become much easier (like it does when getting fit). When you excel at it, you will find your ability to get what you want thrilling. You’ll see that excuses like “That’s not easy” are of no value and that it pays to “push through it” at a pace you can handle. …

With practice, you will eventually play this game like a ninja, with skill and a calm centeredness in the face of adversity that will let you handle most of your numerous challenges well. However, you will never handle them all well: mistakes are inevitable, and it’s important to recognize and accept this fact of life. The good news, as I have mentioned, is that most learning comes through making mistakes—so there is no end to learning how to play the game better. You will have an enormous number of decisions to make, so no matter how many mistakes you make, there will be plenty of opportunities to build a track record of success.

The person who wrote the above founded the world’s biggest hedge fund, which basically printed money straight through all the financial crises of the last decade, so I know he must be doing something right. But I’ve also run into a lot of other people with similar ideas (most of whom are also highly successful).

People in general are terrible at the above. Most people do not act rationally at all, if you define rationality as doing what you yourself would say is what you want. As one small example, I’ve seen statistics that on average, Americans watch 4 hours of TV a day (I dunno how accurate that is but I’ve never heard a statistic that puts it below 4). The scary thing is that that’s an average so there’s a lot of people who watch much more than 4. Do you think anyone on their death beds would honestly say they’re happy they spent a sixth of their life (a quarter of their waking life) watching television? People dream of a life that’s more than 40 years at a job followed by retirement and death, but most of them don’t take the (relatively straightforward) actions that could change things for them. And now everyone is freaking out because the default life path doesn’t even work any more, because we’ve run out of money to pay for the medical bills of all the retired people who spent their lives in front of a desk during the day and a television during the evenings.

I think rationality is a combination of a skill and a world view. You have to see it as important to you to be rational, to act as a human being and contribute to the world vs let yourself get blown around by your own mind, or else it’s not even a possibility. But even if you have the world view, you still have to get good at it.

I think it’s criminally stupid that we don’t have cultural mechanisms to teach this. Our formal education system is actually counterproductive: the world view it instills consists of “sit still and raise your hand”, “there’s a right and a wrong answer to this question”, “the important thing is scoring well and getting the A.”

So people figure it out on their own. For instance, a serial entrepreneur whose blog I like wrote a great post about his personal daily practice for staying mentally, physically, emotionally and spiritually healthy. There’s a lot of good stuff floating around out there, but most people don’t even know it exists, don’t even know they have a need for it.

I was excited back in college by the Positive Psychology movement, which is trying to mainstream ideas about building character, resiliance, real mental health into the practice of psychology (which today treats unhappiness as a disease, a paradigm that I think is appropriate for certain neurological conditions but inappropriate for the vast majority of people who seek some kind of help or counseling). But I think they may be too hopelessly stuck in the paradigm of applying for grants, doing double-blind trials on twenty undergraduates, and publishing in academic journals, to make any substantial progress in the next 100 years. That’s why I’m more interested in entrepreneurship; it’s not as rigorous, but things move much much faster because the only thing that matters is impactful real world results. For instance, these guys might solve the physical health problem for nerds. We’ll see.

One thing that hasn’t changed for me since college is that my love life is still a disaster. Last night I went out with friends, hoping to end up with a girl at the end of the night, and I screwed things up. This morning, as soon as consciousness returned, I was on my feet, hangover and all, listing the lessons I learned, listing the questions I had for my friends about what I did wrong, and preparing for my morning run. I couldn’t have done that two years ago. Building skills takes time… I’m still not very good at transforming humiliation into learning, anger into determination. I’m still pretty irrational. But that’s okay.

Written by jphaas

December 4th, 2011 at 12:29 am

Posted in Uncategorized

Simple Answers

without comments

It’s Friday and I’m tired. I just built and deployed a new feature for my company, KeywordSmart, that shortens the free trial period for new users by counting “usage” slightly differently. I have no idea if this was a good idea or not. We did it because no one’s been reaching the end of the free trial, but a lot of users have spent a long time on there playing with it. So, the idea is, force people to make a decision: is our software worth paying for or not?

I think it’s a good thing to try, so we are. But trying to get a new product and make it valuable to people and get them to buy it feels like sculpting in the dark. There’s clay going everywhere and you’re definitely doing something, but what is it?

A month or two ago I read The Lean Startup which is a really great, revolutionary book on how to manage entrepreneurial activity. The thesis is that just like in traditional companies you set goals and manage against metrics, you can do the same thing with startups, but the goals and metrics are around learning.

Like all great books it makes things seem really clear and simple. Of course: all we need to do is identify the quantitative assumptions behind our business model, find a way to measure how reality stacks up against those assumptions, and iterate until we’ve gotten reality to match our goals. That’s easy! It’s so clear! I built a really nice report in excel that lays it all out: our goals, numbers, experiments we’re running, features in the pipeline.

Turns out that making a pretty spreadsheet doesn’t equal making a successful business. The numbers don’t tell you what to do; they don’t even tell you what’s necessarily going on. There’s still a lot of taking things on faith, taking risks, pouring time and energy into ideas that might not work out.

I feel like there’s a lot of things in my life where there’s a simple magic formula that if you just follow it, everything will work. If I just followed the rules in The Primal Blueprint I’d be in great physical shape and high energy. Instead I’m on my second cappucino today and craving a third because of the caffeine crash. If I meditated every day, if I always woke up and immediately did the most important thing on my todo list, if I always followed the five step process, if I… I’ve bounced through so many good ideas I’m exhausted just thinking about all of them.

The funny thing is that I think the simple answers are right. When you overlay logic on top of reality, reality changes… there are too many examples of succesful people who were able to start with a vision and make reality follow it for it not to be true. But the path to getting there seems to be infinitely longer than a straight line. Things seem to be incredibly simple and infinitely complex at the same time, which makes me blink just saying that.

I’m not a very patient person. I have a hard time seeing things as they should be while simultaneously accepting things as they are. I kind of just want to skip to the should be. Why can’t we all just apply a little logic and common sense, and have everything just click into place? … is how I think. In the real world, though, things are slow. I’m trying to learn how to go forward one step at a time. Step. Step. Step. Man that’s boring.

Written by jphaas

December 2nd, 2011 at 10:53 pm

Posted in Uncategorized

Fantasy & SF

without comments

Fantasy and science fiction don’t get much respect. They conjure images of sweaty nerds in basements living a fantasy life instead of dealing with their own pathetic realities. People throw dirty words around like “escapist.” It’s not a good scene.

I actually prefer both genres over most other forms of literature. For me part of it is escapist, but part of it is that I feel the nature of the medium allows more scope for interesting stories.

I’ll be honest — a lot of fantasy books and sci fi books are crap. Totally worthless stuff peddled out to keep the nerds in line just as the bodice-rippers are sold to give the desperate housewives their fix. But I’m a big believer in judging things at their best, not at their worst.

Good books are books about human nature. People are selfish animals; we want to hear about ourselves. The fun factor from reading comes from exciting stories that I can relate to. The valuable factor comes from stories that I can learn from. In other words, characters that I identify with who go through experiences that shed light onto my own experience.

(Pretty writing is also nice, but at the end of the day the books that people remember are the books that explore characters or ideas that are important).

Books are little laboratories. What happens if you take a poor boy steeped in the American dream, have him fall in love with a pretty girl from a different social class, and drop him in the roaring 20s? The Great Gatsby. It’s memorable because it says something about what it means to be human, and the way it says it is by creating a little world, with laboratory-controlled circumstances (for instance, Daisy doesn’t become fat and pregnant by the time Gatsby re-encounters her, which would have made it a very different book).

For a book to be good, the laboratory has to be compelling and believable. If there isn’t an internal consistency along the experimental dimensions, nothing can be learned; it’s a void experiment.

Many genres try to create this believability by hewing to circumstances that are (allegedly) realistic. This has a face-value logic to it (if you want to be realistic, be realistic), and of course it can be really powerful when done well. But it’s also a huge constraint, because there is a lot of overhead required in creating realism.

I’ve been re-reading Battle Royale, which is about Japanese school children who are forced to kill their classmates. The situation is totally contrived. To come up with a realistic scenario where a whole class of school kids needs to kill each other or die would probably take a whole novel by itself. Battle Royale hand-waves a bit over the setup, and because it does that, it takes an incredibly original look at love, friendship, values, cliques, and cultures. It’s great.

Sci Fi and Fantasy open up an entire universe (ha ha) of experiments that more mainstream genres can’t touch. They give the author permission to throw the existing rules out the window. With a bad author, that leads to derivative crap. With a good author, it leads to brilliance. It’s Picasso deciding that he’s allowed to paint things that don’t actually look like photographs. Actually, it seems really unfair that Picasso isn’t looked down on as “genre painting”, with all that unrealistic blue stuff and funny escapist angles.

The main difference between the two (overgeneralization alert) is that sci fi (or better, “speculative fiction”, which is a little more accurate I think) explores the realm of logical possibilities whereas fantasy explores the realm of a-logical possibilities. Sci fi asks the “what if?”and “what would it be like?” questions. What if there was a galactic civilization whose economy was based around an addictive life-extending drug? What does consumer society look like when the internet becomes so high-bandwidth you can live in it? What would it be like to fall in love with someone from a backwards, militaristic culture that just rediscovered advanced technology?

Fantasy on the other hand allows the exploration of the irrational parts of human experience, the dreams and nightmares, by projecting them on the waking world. What does a little girl’s fantasy world look like? What if you could have a conversation with your own soul? (arguably, this is a sci fi book… there’s definitely a fine line between the two). What if Japan’s subconscious culture baggage manifested as a physical force and stole your wife, or a young man coming of age acted out his personal growth struggles as a video game?

I like fantasy and science fiction because we live in a fantastic, science fictional universe. I very rarely find books with characters that I identify with who live in a world that strictly hews to reality. That’s because our world is so weird, so changing, that real life doesn’t do justice to real life. I honestly think literature that doesn’t bend the rules of reality a little bit is as antique as realist painting.

Anyway, this whole post is actually just a really long lead-in so I can pitch my favorite short story to you. It’s called “Lean Times in Lankhmar” and you can read it as part of this collection (note: there’s a much classier edition that doesn’t look like the cover was designed by a three year old here but it’s not kindle-available). I have yet to meet someone who knows what I’m talking about when I say I love Fritz Leiber’s Fafhrd and the Grey Mouser stories, and each time I bring them up and get blank stares, I die a little inside.

There are five amazing things about this story:

a) The control of tone and atmosphere is pitch-perfect. Every single detail adds together coherently: not one is misplaced. Leiber’s city of Lankhmar is itself a character in all of his stories, and it has more personality and coherence that most writers’ human characters.

b) It’s totally psychologically accurate. The insight into human nature is hilariously exaggerated, but spot on. Leiber is in love with his character’s vices, and because he is, you are too.

c) The writing is absurdly confident. Leiber writes sentences like driving a Ferrari through your neighbor’s lawn and into their swimming pool at 90 miles an hour. There are run-ons. There are appeals to completely made-up and immediately forgotten historical authorities. There are wild exaggerations and crude innuendo. And there are no apologies. It’s great.

d) It’s a real story. There is a beginning, middle, and end; there is an (absolutely hilarious and brilliant) climax; it ends up somewhere different than where it started. It has depth: like most great literature, it is both incredibly cynical and deeply humble.

e) It is actually impossible to write a better ending to a short story than the ending of this one. I was on a literary magazine in college and one of the things I noticed is that no one can end short stories well. It’s like a super-power. This is how you do it. Take notes.

If you read it, I suggest reading the preceding story, “The Cloud of Hate”, first. It’s short, fun, and provides an introduction to the characters, which is important. And then read the rest of the stories because honestly they’re all pretty amazing.

P.S. Apparently the Chinese government (or factions therewithin) are trying to promote more science fiction writing in China because they believe that the Western Sci Fi tradition is the source of a lot of America’s and Europe’s technological creativity.

Written by jphaas

December 1st, 2011 at 4:43 am

Posted in Uncategorized

Out of college for 5 years

without comments

Harvard apparently has a tradition of collecting mini-autobiographies of its graduates every five years. I’m coming up on my fifth year reunion, and I decided to try to hack the process by seeing if I can get them to print a bit.ly link to a google docs presentation. So far I haven’t gotten any indignant howls from the editors, but we aren’t at the deadline yet.

I thought I’d share the presentation because it’s a pretty good summary of where I am and hope to be going.

Written by jphaas

October 19th, 2011 at 12:53 pm

Posted in Uncategorized

We are all the 1%

with 2 comments

I like the name “Occupy Wall Street” more than I like the “99%” slogan. I can get behind occupying Wall Street. It probably needs some occupying. Going after the 1%, though, I have a hard time with. I don’t have a million dollars, but I think I’m in the 1%. Same with my friends. We’re not in the 1% of wealth. But we’re in the 1% of something. I have some friends who can do graphic design better than 99% of everyone else in the country. I also have some friends who are in the top 1% of America in terms of their physics knowledge. I know some 1% dancers. Some 1% artists.

I bet if you think about it, you can come up with something that you’re better at than 99 of every hundred people you meet. That’s because people have incredibly diverse sets of talents. The people in Zuccotti Park are part of the 1% of people who care enough and are active enough to get out onto the streets for their beliefs. That’s a really important 1% too.

I passionately believe in the 1%. It makes me happy to see my friends do amazing things that I could never do in a thousand years. It’s exciting, it’s inspiring, it’s what makes us human. “Occupy Wall Street” is possible because of a huge collection of talented people. The tools of the modern revolutionary, in the Arab world and here in the U.S., were put together by technology visionaries like Steve Jobs and the founders of Twitter. A lot of them made a lot of money doing it. I hope they don’t feel isolated because they’re part of the 1%; I’d like them to be comfortable marching side-by-side with the protesters, because they believe in a lot of the same things.

People are rallying in support of “Occupy Wall Street” because we’ve failed collectively to make sure everyone has access to economic opportunities. Creating economic opportunity is a huge challenge, and no one has all the answers. People are angry because the government and the finance sector haven’t contributed much to solving the problem. The honest truth is, they probably never will. Real change comes bottom-up. It comes from people going out there and creating economic opportunity for themselves and for others. If we want change, we need to be the 1%; we need to be ourselves at our best, and share our talents with the world.

I want us to create a world where you can’t walk five feet without tripping over economic opportunity. I want opportunity to pour from every town and city in this country and every city and nation in the world. The only way that happens is if we embrace the 1%; embrace challenge, embrace creation, embrace being our best and making the world a better place. Be the 1% — we’re all counting on you.

Written by jphaas

October 17th, 2011 at 3:15 am

Posted in Uncategorized

Self-experimentation, the programming-free version

without comments

Thinking about it, my previous entry on how I set up a self-experiment over text messages might be a little intimidating for the non-programming crowd. It assumes you know how to ssh into a web server and run terminal commands, set up cron jobs, and have some basic fluency in Python and SQL.

So I wanted to point out that you can get to an 80% solution using no coding at all, just ifttt. The goal, remember, is to get a text message throughout the day with a prompt, and then reply back to that text message and have your response saved. If you don’t care about randomizing the times of day, or auto-generating the metrics, you can do this without any technical knowledge at all.

Step 1. Set up the prompts. Create an ifttt task (see my last post for how to do this) with the “Date & Time” channel as the trigger and the SMS channel as the action. Pick the times of day you want to get emailed, and write the question you want emailed to you.

Step 2. Set up the data capture. If you don’t have an Evernote account, create one — it’s free! Create a notebook within Evernote for storing the results of your experiment. Then, create an ifttt task with the SMS channel as the trigger, and the Evernote channel “create a note” as the action. For the note text, put {{Message}}; this will copy the body of the text message you send in. For the notebook, put the name of your new experiment notebook. Now, every time you reply to a text from ifttt, the reply will be saved in your notebook.

Look ma, no code!

Written by jphaas

October 16th, 2011 at 5:27 pm

Posted in Uncategorized

Self-experimentation using ifttt and a dash of python

with 3 comments

Per my previous post on making the world a more joyful place, I’m interested in self-experimentation. There are a lot of cool things that open up if you can take a scientific approach to your own life, but in the past I haven’t been able to follow through because I lacked the discipline to record data regularly.

What I really want is for data collection to be totally mindless. My ideal is, I get a text message asking me the question, and all I have to do is reply to the message. This is really easy for me since I generally reply to text messages in real time.

Setting something like that up used to be a lot of work. But thanks to a new free service, if this then that, I was able to super-easily set up a simple experiment where I get texted a yes / no question at 5 random times each day, and have the data be automatically collected for me! Here’s a walk-through of how I did it. You’ll need: the internet, an ifttt account, a gmail account, an evernote account, and a webserver where you can publish python scripts and run cron jobs (I use dreamhost — it’s super-cheap shared hosting, perfect for lightweight little things like this).

Prelude: ifttt basics.

ifttt lets you create dead-simple automated tasks by connecting “triggers” (which can be anything from you sending ifttt a email or text message, to you posting on facebook or twitter), to “actions” (which can be ifttt sending you an email or text message, or posting something to a 3rd party account). It integrates with pretty much every popular webservice on the internet, and it’s almost so self-explanatory that it hurts:

My ifttt home page showing the three tasks I created for this experiment

My ifttt home page showing the three tasks I created for this experiment

Step 1: Generate the reminders.

If you’re okay with setting the exact time you get the message, this part is pretty much done: go into ifttt, and create a task with a “Date & Time” trigger and an SMS action.

For me, I wanted to add some randomness to when I get the reminders, so I had to do a little more work. On my web server, I created a script that, when run, sends an email from my gmail account to ifttt. I created a file “email_google.py” with the following contents:

import os
import smtplib
import mimetypes
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.MIMEAudio import MIMEAudio
from email.MIMEImage import MIMEImage
from email.Encoders import encode_base64
import base64

def send_mail(recipient, subject, text):
    user = 'fake@gmail.com'
    pw = 'crazy_random_fake'
    msg = MIMEMultipart()
    msg['From'] = user
    msg['To'] = recipient
    msg['Subject'] = subject
    msg.attach(MIMEText(text))
    mailServer = smtplib.SMTP('smtp.gmail.com', 587)
    mailServer.ehlo()
    mailServer.starttls()
    mailServer.ehlo()
    mailServer.login(user, pw)
    mailServer.sendmail(user, recipient, msg.as_string())
    mailServer.close()
    print('Sent email to %s' % recipient)

And then another file “send_reminder.py” that does the actual work:

import random
import email_google
import time

time.sleep(random.randint(0, 110) * 60) #subtracting 10 minutes to account for ifttt being slow

email_google.send_mail('trigger@ifttt.com', '#myexperiment', 'body')

What this does is sends an email to ifttt anywhere from 0 to 110 minutes after the script is started. I then run this script using a cronjob (“python /path/to/script/send_reminder.py”) — dreamhost’s control panel provides a nice gui for setting up cron jobs so I didn’t have to do this by hand.

Then in ifttt, I set up a task with an email trigger with the hashtag #myexperiment, and an SMS action that sends me the reminder. So whenever the script on my server gets kicked off, it waits a few minutes, then emails ifttt, which sends me a text message!

Step 2: Capture the reply.

I want to be able to reply back to the text message and have that information saved in a database. First, I created a database on my webserver using the sqlite3 command: I ssh’ed in and ran “sqlite3 my_db”. That pops up the sqlite3 command line tool; I ran “create table log (time, input);” to create a table to store the data, and then “.exit” to leave sqlite3.

I then created a simple script that stores a one-word response to the database. I created the file “accept.py” with the following contents:

#!/usr/bin/python

print "Content-type: text/html\n\n"

import cgi
import cgitb
cgitb.enable()

import sqlite3


form = cgi.FieldStorage()
input = form["input"].value.lower()

if input in ('yes', 'no'):
    con = sqlite3.connect('my_db')
    con.execute('insert into log select datetime(), ?', [input])
    con.commit()

print 'success'

This file goes on my web server. I needed to run “chmod 755 accept_input.py” to let Apache run it as a script. What this does: when I go to http://myserver.com/path/to/my/folder/accept.py?input=yes, it saves “yes” to my database, and records the time at which it happened. Likewise, changing the url to “?input=no” saves “no”.

Finally, I need to make ifttt visit that url when I send it a text message. I created a task with an SMS trigger. But what should be the action? Right now ifttt doesn’t have a “visit url” action. However, we can fake it by using the Evernote channel’s “create a link note” channel, which creates a link in your notebook based off of a given url. Evernote visits the url to create the note, so the server registers the hit. We need to get the “yes” or “no” message we send into the url, so I set the “Link URL” field of the action to “http://myserver.com/path/to/my/folder/accept.py?input={{Message}}”.

Voila! Every time we text a reply to ifttt, the body of the reply (a “yes” or “no”) gets stored in our database!

Step 3. Review the results.

I want to see the results of the experiment! For me, the thing I want to track is the percentage of “yes”s for a given day and how that changes over time. So, I wrote one more python script that reads the database and outputs a table:

#!/usr/bin/python

print "Content-type: text/html\n\n"

import cgi
import cgitb
cgitb.enable()

import sqlite3


con = sqlite3.connect('my_db')
results = con.execute("""
    select date(time), (sum(case when input = 'yes' then 1 else 0 end) +0.0) / count(*) 
    from log 
    group by date(time); """)

print """
<html>
<head>
<style>
td {
    padding: 3px;
}
table, tr, td {
    border: 1px solid black;
}
</style>
</head>

<body><table>

"""


for row in results:
    print "<tr><td>", row[0], "</td><td>", row[1], "</td></tr>"
    
print '</table></body></html>'

Save that to your webserver, and remember to run “chmod 755” on it if necessary! Now, you can visit the url of that script and see a nice little report on your experiment.

Bonus step: Backing things up

I’m paranoid, and because dreamhost is cheap shared web-hosting (no offence, guys), I’m not 100% sure a server crash won’t annihilate all my hard-won data! So I set up one more ifttt task to back it up. I used the “Date & Time” trigger, setting it to run once a month. For the action, I told it to save a given url to my Dropbox account which is what I use for all my personal backups. What url? The url of the database… sqlite3 saves its data as a simple file, so when we ran “sqlite3 my_db” above, it created a file called my_db. Since it is in the same folder as your scripts, you can just point your browser to “http://myserver.com/path/to/my/folder/my_db” and it will download the latest version of the database. Or, in our case, have ifttt download it automatically and save it to your dropbox!

Conclusion:

I’m falling in love with ifttt. There’s a lot of stuff that I had to do manually with python and cron jobs, but ifttt is new and I can imagine as they improve their service, more and more of the steps above will be able to be completely automated. In the past, setting something like this up would have been a big pain (although I hear twilio makes interacting with text messages reasonably easy)… but we live in the future, ladies and gentlemen!

Written by jphaas

October 15th, 2011 at 8:49 pm

Posted in Uncategorized

Life in an Open Universe

without comments

I’m continuing to update my thinking about the philosophy / social change project I’ve been writing and talking to people about. I just finished re-articulating to myself what I’m trying to do, and I’d like to share it:

Project Statement

I want to increase the amount of joy in the universe. That is the goal of this project. More specifically, I want to develop a practical understanding of how to help people achieve a state of bliss, and moreover a scalable understanding: I want a series of techniques that can create exponential growth of happiness across the world. My vision is a universe where a life of fulfillment and joy is the status quo for a new person being born, anywhere in the world.

I see this project as falling under the discipline of engineering. I am interested in psychological or cognitive research insofar as accurate understanding of the world is important to the project’s success, but I’m more interested in achieving results than I am in obtaining knowledge. If I find something that works, and I can’t quite explain why it works, so be it. I also see this project as somewhat philosophical, because I believe that achieving the goal will require a strong theory of what happiness is: but again, the point of the theory is to yield results, not the other way around.

Here’s what I mean by joy: an intense gratitude to be alive, combined with a heightened awareness of experience. When I think of joy, I imagine myself 80 years old on my death bed, looking back on my life and facing death with perfect calm because I know that I lived my life to the fullest and I don’t have any regrets or unfinished business. In fact, I don’t even need to pretend I’m 80: right now, in this moment, if I died, would I be thinking “wait wait no I didn’t…” or would I be full of positive emotion, appreciative for the time I’ve had even though there’s more stuff I could do with more time.

I believe joy is a process of continually emptying ourselves of our desires, externalizing them into the world. It is a stream of wanting, acting, and experiencing the results, wanting more, acting further, and again experiencing. We fill with desire; we flush ourselves of it by courageously pursuing it; we experience the blissful calm of emptiness, and into that void we fill with desire once again. Each time through the loop, we grow as people, losing our old selves and gaining ourselves anew.

The fundamental prerequisite for joy is the belief that there is effective action we can take to realize our desires. I think that most unhappiness in the world comes from believing the opposite, that we are powerless to take effective action. This powerlessness creates a stagnation in the process of emptying ourselves of desire: unfulfilled dreams curdle inside of us, and we lose touch with basic experience because our minds are full of stale thoughts. We imagine fantasies, but because we never experience them, we don’t grow past them, but keep experiencing the same mental movies over and over. Instead of feeding ourselves on the richness of new experience, we gnaw on sawdust.

For much of human history, and still today in many parts of the world, the objective circumstances were such that for most people, only extraordinary skill could yield effective results: most people were lucky to eke by and survive. A sense of powerlessness was in fact realistic for most people. I suspect that the Eastern tradition of viewing the goal of life to be emptying oneself of desire arose as a synthesis of two recognitions: that the source of all misery was unrealized desire, and that for the average person, realization of desire was impossible.

I believe that for the industrialized world, we are in a historical position to move beyond that compromise philosophy. Although we still live with pain, sickness, and loss, we do live in a world where the potential for positive experience is such that the ups can match the downs. There’s enough adventure, pleasure, love and beauty to be had in the world that a life of seeking fulfillment isn’t doomed to perpetual frustration.

I see the biggest obstacles today as psychological rather than material. We have material freedom: for most of us, having a roof over our heads and food on the table may sometimes be a struggle but is by and large achievable. However, we don’t always have psychological freedom: we don’t always believe in our ability to get what we want, or even always know what we want. Even though our objective circumstances are those of safety and material wealth, our minds are often still run by fear.

To some degree, this is a result of the process of industrialization itself. Although it achieved massive material wealth, it isn’t conducive to psychological freedom. Rather, the logic of mass production runs to uniformity: the more elements in a system are the same, the easier it is. We can see the results of that thinking in our educational system, which marches students forward through the grades like widgets on a conveyor belt, testing them at regular intervals to establish quality and then shipping them off to appropriate destinations. We can also see that thinking in the 9 – 5 treadmill of ranks, promotions, three weeks of vacation a year and eventual retirement and pension.

Freedom and joy, on the other hand, are individual. We all want different things: free-minded, joyful people explode in their diversity. The essence of freedom is lack of fear, the knowledge that you can take risks and do what you want without getting kicked out of the system. Happy people don’t all wear the exact same tie.

The truly great gift we have, which I am personally very grateful for, is that the economic imperative in our society is transitioning from uniformity to creative diversity. The biggest business challenges are no longer “how do we produce more stuff”, but “what kind of stuff should we produce”? Design, innovative research, and entrepreneurship are becoming increasingly important. The new millionaires are people like Steve Jobs: people who can work with desire and bring a vision to life. We are a fortuitious moment in history where I believe what is needed for joy aligns well with what is needed for economic prosperity. This is the time to create a world where people are happy: we are in a place where I think a society based on happiness can actually work.

So, my vision is a world where joy is a birthright, not a rare occurence. My guiding assumption is that building this world is a practical goal. My hypothesis is that the biggest current obstacle is that society still trains people counterproductively, and that working together we can re-train ourselves to become proficient at achieving our desires, to believe we’re capable of getting what we want out of life and to take effective action to make it happen.

Written by jphaas

October 10th, 2011 at 11:02 pm

Posted in Uncategorized

Flesh and Spirit

without comments

Here’s my prediction and my vision for the next few decades.

There is a fundamental disunity in our society between the meaningful and the material that’s in the process of healing itself. Meaning is the realm of the emotions, values, and love: the subject of literature, the source of spiritualism, the pause in the middle of a street to notice the architecture of the buildings around you. Material is the logic of human organization and prosperity: vision statements, goal achievement, corporations and society, the down payment on your mortgage.

At some point earlier in the century, the rift between the two modes of concern was so extreme that to embrace one was to totally reject the other. This is what “Turn on, tune in, drop out” meant. Total rejection of bourgeoise existence; live free and love free under the stars. Fuck the man, burn down the military-industrial complex, and let’s all build community gardens. Government was a dystopia waiting to happen; corporations turned free people into rats on an endless treadmill; family values were a hypocritical lie used to enforce social obedience.

At some point, though, the material world started getting exciting. The information technology revolution put the power in the hands of the hacker, and YouTube gave voice to the disenfranchised (and the bored). Young people in their 20s could start making serious cash in business and finance, and companies became smarter about recruiting them and sending them around the world. The best and the brightest increasingly started playing the game, and the world of material power softened to embrace things like personal growth and social responsibility. I’m drawing a sketch of the transformation here; for a full blown portrait, read Bobos in Paradise.

This remarkable subversion of hippy idealism by the mainstream is a great accomplishment of our society. The line between hipster and marketing executive is getting blurry. Corporations are doing truly exciting things, and the process of creative destruction that represents capitalism at its best is slowly eating its way into every sector. Social barriers are becoming fuzzier, and the world is a more connected, more communicative place.

On the other hand we’ve lost a lot of the stark idealism that comes from absolutism, the clarity that comes from drawing a sharp line between the things of the world and the things of the spirit. We all hear the cliches about the only important things in life being the people we care about, the little moments, the journey rather than the destination, but those cliches don’t characterize the way that most people actually comport themselves. The coexistence of material, goal-driven, logical, business pragmatic thinking, and the need to stop — and smell the air around us — is an uneasy one. I sometimes feel like we scurry through the turning cogs like rats, sometimes greasing ourselves through to find a bit of fresh air, an interstice of peace, and sometime getting lost in the grinding darkness.

My prediction — which I put forward as a self-fulfilling prophecy — is that we are seeing a transformation from a synthesis based on tolerance to a synthesis based on true union. We can’t reject one mode and have the other. A world based on hippy idealism doesn’t function. We have six-point-seven billion people on a spinning globe in space; if we don’t think, we’re going to kill ourselves off out of sheer stupidity. Logic, organization, the ability to frame and execute against a vision, are the only things standing between us and chaos. Likewise, a world where the logic of acquiring material power takes precedence quickly transforms itself into a nightmare, an inhuman hell that ineluctably trends towards evil because of the sheer pain it creates to be a cog in such a machine.

The alternative is a new idealism that embraces rather than rejects logic. This idealism is absolute: it pus the human spirit on a pedestal and defies all forces that seek to control or suppress it. It values freedom, love, peace, and being alive in the moment, and rejects questing for status or power or money. But it plays the game. It sets a vision for the world that it wants, and then does what it takes to get there. It builds gardens in cities, and art installations in the desert. It makes sure people are fed and clothed, and given opportunities to make their lives into something meaningful, and challenges them to live up to their responsibility to co-create the world. It thinks long-term about the impacts it has on our environment and natural resources, but it’s also not afraid to crack a few eggs to make omelets. Rather than smashing its computers and fleeing its cubicles, it wants to sit in the boardroom, because that’s the bully pulpit, because power is a necessity, not an impediment, for doing good.

I see this all around me. Yesterday I was at a workshop where a bunch of 20-something designers and creators talked about the work they were doing. All of it was creative and fun, inspirational and freeing; it was also commercially viable. My generation’s best minds are working on endeavors that reflect a desire to empower people, to enjoy life and have fun, but that also accrue power to themselves: they want to change the world in a logical, self-accelerating way.

Like any transformation, there’s a trend, and then there’s the variety of actual experience. For everyone who gets it, there’s a thousand who are still stuck in inertia from previous revolutions. It’s hard to maintain an outlook of joy and optimism while fighting in the trenches of daily life, of hewing to idealistic visions when your investors want you to turn a profit. But it’s doable. My goal is to help, by articulating clearly what the transition is, and building institutions that support it. Being here, at this time, is an incredible gift. Actually, it’s always a gift, no matter which generation you live in, but this is our gift, so let’s learn to enjoy it together.

Written by jphaas

September 26th, 2011 at 1:04 am

Posted in Uncategorized