Hackers fly for free
I was in Europe for a bit this summer. I wanted to go to a technology conference to meet fellow hackers internationally. I saw that EuroPython (the Python language conference of Europe) was in Florence, Italy this year. They were offering scholarships for students for free tickets to the conference plus hotel. I applied, pointing to my many contributions to Python like my Python web framework. I got it, and had a fantastic time. It was incredibly well-organized, and I met some brilliant hackers. My room-mates made Kivy touch platform, psyco, and the Italian Pirate Bay. I met Armin Rigo, the hero-genius behind PyPy. I gave a talk about my minimalist with-statement based Python templating system. Google also hosted a programming competition, Google Code Jam. I got 2nd place among all contestants at the conference and I won a nice new Android phone! It was a good trip that paid for itself.
Teach yourself Git in 2 minutes
Git is very simple. It's very powerful, but fundamentally very logical and very simple. If you try to learn everything you can do with git, then the information will flood your brain and drown you. That's true of any powerful tool like Photoshop and Unix. But if you just want to use git to backup your code changes, develop new branches, and share your source, git is actually as straightforward as SVN. Avoid complex and dangerous commands like git-rebase. I've worked on large codebases with distributed teams and I've never needed anything more than basic commit, branch/merge, and push/pull. Git also has useful log, diff, and grep tools for quickly finding out information about your code. Git Flow: Git for HumansTo use git without brain augmentation surgery, you should make a simple, consistent system for yourself with a handful of commands. Or just use my system. You want to commit often, so it's good to create bash shortcuts so that you use git more often. The 2-letter shortcuts encourage you to commit more often and keep everyone's code up to date. You'll never be afraid of losing code. Here's my main workflow, commit and push:
$ # make changes, fix bugs... $ cm "fixed bug 214 in the UI" $ ph I'm constantly checking the status to see if I forgot to add files or commit something:
$ sl # On branch master nothing to commit (working directory clean) If I'm branching, I create a branch, make my changes, and then merge.
$ ct -b newfeature # make changes
$ ct master $ me newfeature And then I can push my changes and delete the branch.
$ ph $ bh -d newfeature You want to commit often, so always cm (git commit -a -m) and ph (git push) after even small changes. The 2-letter shortcuts encourage you to commit more often and keep everyone's code up to date. The codes are easy to remember because they are consistent. The codes are always 2 letters, composed of precisely the first letter of the command and the last letter (including all of the options). By using the last letter of the command including options, the shortcut tricks your mind into thinking of the full command every time you type it. Normally, you forget commands with abbreviations of the first letters, but with my system you remember the whole command every time so you can still use git on other systems and other peoples' computers. Git Flow ExamplesWhere is this variable myVar declared (git grep)?
$ gp myVar How is my branch different from master (git diff --ignore-space-change)?
$ de master I forgot, did I commit all my changes, what files did I forget to add (git status -uall)?
$ sl How do I make a new branch (git checkout -b)?
$ ct -b mybranch How do I merge it back (git merge)?
$ #ensure you've committed all changes in your branch $ ct master $ me mybranch How do I delete my branch after I've merged changes (git branch -d)?
$ bh -d mybranch How do I pull and push my changes (git pull, git push)?
$ pl $ ph What changes were made recently (git log)?
$ lg What branches exist and branch am I on (git branch)?
$ bh What if I screwed up and want to remove all the code in my branch without merging (git branch -D, since caps are harder)?
$ bh -D mybranch How do I make a new repository?
$ git init I just added new files to my code, how do I add them to my git repository?
$ ad . Below are my bash aliases. Add these to your ~/.bashrc file so that you can use these shortcuts too:
alias ad='git add' alias pl='git pull' alias ph='git push' alias cm='git commit -a -m' alias sl='git status -uall' alias lg='git log' alias gp='git grep' alias de='git diff --ignore-space-change' alias me='git merge' alias bh='git branch' alias ct='git checkout'
Don't write on the whiteboard
I recently interviewed at a major technology company. I won't mention the name because, honestly, I can't remember whether I signed an NDA, much less how strong it was. I did well. Mostly because of luck. I normally step over myself when I interview. I guess I've improved over the years. Here are a few tips to ace your own interview. 1. Don't write on the whiteboardWhen I interviewed at Palantir around 5 years ago, I had a lot of trouble with this. Yes, I knew next to nothing about computer science then, but I should have been able to answer many of those questions. For example, Palantir asked me to write an API for a hash table, and I forgot set key and get key, the most basic operations. The alien situation of the whiteboard contributed to my nervousness. I didn't get an offer from Palantir. Most people think you have to write on the whiteboard. Steve Yegge recommends that you practice writing code on a whiteboard and even buy and bring your own marker to the interview. That's pretty extreme and truly conveys the capriciousness of modern-day tech interviewing. The interviewer started by asking me to code up a simple recursive calculation, using any language I wanted. "I dont like to write on whiteboards," I said. "It feels unnatural and distracting. I'd prefer to write on paper." "Okay," he shrugged. The interviewers don't care. Use paper. 2. Bring your own paper and penSo I asked for some paper and a pen. But there was no paper around, only some post-it notes. My mistake. You should always have paper and pen anyway to write down ideas. On the subway, in line for movie tickets. Or you can keep a few sheets of paper with your resume and folder you brought to the interview (you did that, right?). Moleskines are excellent notebooks. Some of the best programmers figure out the high-level overview on paper before they write a single line of new code. 3. Use PythonEven if you are a C++ systems guru. Even if you only know how to use Eclipse to program Java. Learn Python and use it during your interview. Python's philosophy is very simple and consistent. It's largely composed of a subset of the ideas in Java and C++. 80% of Python is based around the dictionary (HashMap). It will take you a few days to learn and not much longer to master. You will waste a lot of time writing string manipulation code and initialization code that you can do in one line of Python. Get to the algorithm. All I had was a post-it note, a tiny amount of space. So I wrote down the algorithm in Python line-by-line on the post-it note. 4. Write short algorithms, then make them half as long, then make them shorter, then ask an expert how they would make it even shorterFive minutes later, I had my algorithm. It took up less than a few lines. He looked at it, yea, that looks correct. "Normally people write it in Java and it takes them a while and it takes up a lot more space on the whiteboard. They spend a lot of time manipulating the input string." Since my first interview at Palantir, I had done a lot of practice problems. The highest value problems I know of are on Project Euler. The site posts a sequence of problems of increasing difficulty which you have to solve with increasing efficiency. To become a great hacker, just do those problems in order (in Python!). Then take your solution and do it in half the lines. Now, read more of the Python docs (maybe read about generators and list comprehensions and decorators) and make it even shorter. Finally, look at the solutions posted on the Project Euler site. Stand in awe of the 1-line solutions. Weep in joy over the solutions of the guy who answered the problems using just pen and paper and his brain. The highest value courses I took are algorithms and advanced algorithms courses. I was lucky enough to study under Robert Tarjan. But I also did every problem in CLRS, the standard (and very well-written) algorithms textbook. If you do all that, you won't be nervous at your big interview. You'll be bored. 5. Write tests on your own code, sometimesI say sometimes instead of always because, first, it is impossible to test every case. 100% test coverage is a myth. Any non-trivial program is going to have too many edge cases to check, computationally. You need to test the high-value parts. You need to test the parts that you keep breaking. Finally, as you finish, the interviewer will look at your code and ask you to write tests for it. So, pre-empt him and describe the tests that you would write yourself. Write edge case tests. Run the tests in your mind. Does your algorithm work? Remember, the interviewer will ask you to do this anyway, so just do it yourself and you will be one step ahead and score well. The highest value book I read which taught me practical programming techniques is Programming Pearls. It also teaches you the importance of tests and how to write them in a pain-free way. Read this book, it's very short. He asked me to write tests for my code, find corner cases. He then asked me 3 other problems. They were Dan Tunkelang type problems. He ran out of problems and there were 15 minutes left. "Normally there's not enough time to ask more than 1 or 2", he said. So we just talked about VMs for 15 minutes. He taught me a lot about virtual machines. This brings up lesson 6: 6. Understand what you don't know, why you don't know it, have an interest in itRead random Wikipedia articles. You don't have to understand it all, just know enough to be able to ask someone who is knowledgeable. Usually, they can teach you a lot from the seed of what you read. But you need that seed, that germ of interest. This will make your questions good and your conversations interesting. People like to talk about themselves. Always carry some knowledge and some ignorance as fuel for them talk about themselves and teach you. The interviewer will leave with a positive impression of you. Don't just read blogs. Read research papers published by successful company. Read Google's MapReduce, GFS, and BigTable papers. Read Yahoo's Hadoop and PNUTS papers. Read Amazon's Dynamo paper. Big companies have big systems, and they will expect at least some familiarity with how they work. These papers are hard. If you have no systems experience, it may take you a day to read through a single one. In the end, you will understand not just how these systems work, but how to think about these systems and design one yourself. 7. Use esoteric tricks you know, teach the interviewerYou're not supposed to use libraries in these coding exercises. But if you know something cool, just use it. In the worst case, the interviewer will tell you to rewrite it. In the best case, he will be interested and ask more questions about it. You will teach him. I taught the next interviewer about the memoization decorator in Python. Memoization takes a complicated dynamic programming problem and makes it blazingly fast. He asked me to solve a problem. I wrote an O(N^2) algorithm, then made it O(N) with just one more line of code on my post-it note (still no paper). I taught him about how I often write a file-backed cached version of @memoized that writes to a file so that I can persist the quick results between runs from the shell. He's a C++ guy, so I taught him about Python decorators as well. 8. Think how you think, go with it.Studies on creativity have shown that if you tell people to be more creative, they end up less creative. If you split two painters up and tell them that the most creative person wins a prize, the paintings will be boring or the same. People forced into creativity think in the same way. So, don't think outside the box. Just think how you think to the extreme. Go with it. The third interviewer asked me to design a game API. He wanted a low-level design, but I misunderstood, so I started adding artificial intelligence features that would suggest moves for you to make. I wasn't sure what he was asking, and I kind of tried to clarify, but then I just went with it. My main interest is AI and machine learning. He was impressed by the originality, and I eventually answered his original questions too. You can usually tell when someone is being genuinely sincere by the manner in which they go out of their way to tell you, versus when they are just mouthing the words. He honestly implored, "it was really great talking to you." 9. Give reasons for your opinions, not just opinionsI asked the next interviewer how much he liked mobile development and he said he liked it. I was learning iPhone development. I played with Android too, but I told him I found the XML for UI distasteful. He asked, "Why?" I said you always want to put as much as you can into code because it gives you power. For example, you want to create and manage a repetitive UI element in code to avoid repetition. Avoiding repetition is the whole point of good coding. He said that Android has a solution for the repetition in the form of XML templates or something. "Oh, I didn't know that," I said. I thought about it more. "Yea," I observed, "the solution to the problem of XML, in enterprise, is often more XML." He chortled. At a previous interview, a CTO was looking for an employee #1. He was just leaving Google to start a new startup, and he asked me what my thoughts were about Amazon Web Services. I said, "they're good." I didn't realize that he did not have much experience with them (having been at Google), and wanted some real constructive feedback. I didn't realize that he was testing to see my experience and familiarity with AWS. More importantly, he was testing my reasoning ability and judgment. I have been running an EC2 instance continuously to run this blog for the past 5 years. It scales well and is very simple. I've used nearly every single one of their technologies since they came out. I invest all of my savings in Amazon because I know this technology will net them billions of dollars. I should have said this. Instead, all I said was "they're good." 10. Interview the interviewerThe last interviewer asked me some simple questions that reminded me of a harder problem I had in one of the companies I started. So I asked him how he would solve my problem. I was trying to find the phrases in a document that correspond to scientific terms in order to link them to Wikipedia automatically. The vocabulary is composed of words and sequences of words like "DNA", "p53ase", "phospholipid bilayer", and "congenital determined myoglasia peptide". Documents are research papers, which can be long. There are a lot of terms (a hundred thousand biological terms, and many more if we include other sciences). How would you find and label all of the phrases in a document efficiently and what is the big-O running time? He got the O(vocabulary size * document size) algorithm pretty easily, but I told him that there is an O(document size) solution. Can you solve it? Try it out. It's a fun, practical problem. I pushed him a little bit but he didn't get it. I interviewed the interviewer and stumped him (although I'm sure he would get it if he thought about it longer). 11. Mention your projects and passions firstAfter finishing up all of the problems in 40 minutes, I had 5 minutes left with the last interviewer. I started telling him about my minimalist python web framework and he said, "That's so interesting, that's what we should have been talking about instead of going over these questions." I got the offer this time, but I would much rather do a PhD instead. I want to learn how to push the boundaries of knowledge, not just apply what I learned in these books.
How to win a Nobel Prize
Richard Hamming, who made Hamming Codes among other things, once gave a famous talk about how to do good research and become a great scientist. His talk is often passed around research circles to introduce new grad students to the process. The printed version is an exact transcript of his talk, so it rambles. It's not as tight as a proper essay, and it's a little long and repetitive for today's blog age. It is, however, a classic, so I am posting some notes with the major points here. If you like it, I recommend you read the whole thing since it has many interesting anecdotes. You might notice that a lot of this advice works well in business and startups, and even life in general as well (like "don't get angry"). You and Your Research Notes: First, decide that you want to do significant Nobel Prize -level work. It's okay to reach. It's not all about luck, since lots of great scientists (Einstein, Shannon) made many great contributions. They got many hits, so it doesn't seem like pure luck. "Luck favors the prepared mind." One of the characteristics you see, and many people have it including great scientists, is that usually when they were young they had independent thoughts and had the courage to pursue them. Einstein challenged ideas about the speed of light when he was 12. You need brains, but only a certain amount, and you probably have enough. You need courage to dare to think through some impossible thoughts and follow through. Perservere. People worry about age, but that might be a social effect. It is hard to work on small problems after you win a Nobel Prize young. You need to plant acorns that will become oak trees. What most people think are the best working conditions, are not. One of the better times of the Cambridge Physical Laboratories was when they had practically shacks - they did some of the best physics ever. Not having enough programmers can force you to invent automatic programming. You have to have drive, work hard. Knowledge grows like compound interest. So, effort is important, but you have to apply effort sensibly, or you just spin wheels. Great scientists can tolerate ambiguity. They know that a theory works, why it works, but also where it doesn't work, and they live in a balance between believing it and not believing it. Darwin wrote down everything that contradicted his beliefs, lest he forget. Great scientists are committed to their problems, emotionally, so as to not drop them. Creativity comes out of subconscious, so focus all your conscious efforts on a problem so that your subconscious also works on the problem for you. You should be working on the most important problems in your field. Why aren't you? Important problems have an method of attack (unlike, say, teleportation). Most scientist work on problems they do not believe to be important. Great scientists keep 10 or 20 important problems in their heads and are prepared to attack them when they come across new techniques. Keep your office door open. You have less short-run efficiency, but achieve more in the long run by learning more from others. By changing a problem slightly you can often do great work rather than merely good work. Instead of attacking isolated problems, I made the resolution that I would never again solve an isolated problem except as characteristic of a class. The mathematician knows that the business of abstraction frequently makes things simple. You need to sell your work. There are three things you have to do in selling. You have to learn to write clearly and well so that people will read it, you must learn to give reasonably formal talks, and you also must learn to give informal talks. You can get what you want in spite of top management. You have to sell your ideas there also. Drive and commitment. The people who do great work with less ability but who are committed to it, get more done that those who have great skill and dabble in it, who work during the day and go home and do other things and come back and work the next day. One problem is the problem of personality defects, like trying to control everything yourself. You find this happening again and again; good scientists will fight the system rather than learn to work with the system and take advantage of all the system has to offer. You should dress according to the expectations of the audience spoken to. If I am going to give an address at the MIT computer center, I dress with a bolo and an old corduroy jacket or something else. I know enough not to let my clothes, my appearance, my manners get in the way of what I care about. An enormous number of scientists feel they must assert their ego and do their thing their way. They have got to be able to do this, that, or the other thing, and they pay a steady price. Now you are going to tell me that somebody has to change the system. I agree; somebody's has to. Which do you want to be? The person who changes the system or the person who does first-class science? Which person is it that you want to be? On the other hand, we can't always give in. There are times when a certain amount of rebellion is sensible. Originality is being different. You can't be an original scientist without having some other original characteristics. I'm not against all ego assertion; I'm against some. Don't get angry. Another thing you should look for is the positive side of things instead of the negative. Don't give alibis for why you can't do something. To yourself try to be honest. If you really want to be a first-class scientist you need to know yourself, your weaknesses, your strengths, and your bad faults, like my egotism. How can you convert a fault to an asset? How can you convert a situation where you haven't got enough manpower to move into a direction when that's exactly what you need to do? In summary, I claim that some of the reasons why so many people who have greatness within their grasp don't succeed are: they don't work on important problems, they don't become emotionally involved, they don't try and change what is difficult to some other situation which is easily done but is still important, and they keep giving themselves alibis why they don't. They keep saying that it is a matter of luck. I've told you how easy it is; furthermore I've told you how to reform. Therefore, go forth and become great scientists! QA Section: If you read all the time what other people have done you will think the way they thought. If you want to think new thoughts that are different, then do what a lot of creative people do - get the problem reasonably clear and then refuse to look at any answers until you've thought the problem through carefully how you would do it, how you could slightly change the problem to be the correct one. How to avoid the Nobel Prize effect: somewhere around every seven years make a significant, if not complete, shift in your field. The moment that physics table I always ate at lost the best people, I left. The moment I saw that the same was true of the chemistry table, I left. I tried to go with people who had great ability so I could learn from them and who would expect great results out of me. By deliberately managing myself, I think I did much better than laissez faire.
Sentiment analysis using transfer learning from reviews to news
I'm going to describe some failed experiments in my research in sentiment analysis. I am using LDA and supervised LDA. I will be developing other custom models that incorporate blog comments, and I will be training using stochastic optimization in future iterations. DataNYT: A corpus of medium-length (500-3000 words) articles from the New York Times. It contains nearly every article from January 1, 2008 through September 2011. It contains 115,586 documents and 118,028,937 words. It contains over 100,000 unique words. YELP: A corpus of short (10-500 words) local business reviews, almost exclusively restaurants, from the Yelp.com website. Each review is labeled with 1,2,3,4, or 5 stars by the author of the review to indicate the quality of the restaurant the text describes. It contains 152327 documents and 19,753,615 words. It also contains over 100,000 unique words, many of which are misspellings. ExperimentsI ran several experiments to figure out what information can be extracted about sentiments in the new york times articles dataset NYT. I created a vocabulary nytimes_med_common based on the NYT dataset using words that appear in less than 40% of the documents and more than 0.1% of the documents. This removes very common words and very rare which aren't informative about the document collection in general. First, I ran LDA on the NYT dataset using the nytimes_med_common vocabulary. On the most recent 2000 articles, I extracted 40 topics represented below. The topics closely follow the lines of politics, education, international news, and so on. They closely model the different sections of the newspaper. (lda_c_2011_10_16). I ran sLDA on the YELP dataset using the nytimes_med_common vocabulary. This excludes many features of the YELP dataset which are specific to restaurant reviews, and misspellings (e.g. "terrrrrible"). On the first 10000 reviews of the dataset, I extracted 50 topics. The topics computed include a few topics which describe negative words. Many of the topics generally describe specific kinds of restaurants (ice cream shops, thai foods) in detail in generally neutral or positive terms. There is a chinese food topic with generally negative terms. The topics with the most extreme coefficients do seem to give a good sense of the polarity of the words contained within. Based on informal analysis, it looks like the topics would have good word intrusion and document intrusion properties. (yelp_slda_2011_10_17) I ran LDA on the NYT dataset starting from the model and the topics extracted from the sLDA on the YELP dataset. This did not work very well, and got about the same topics as LDA from scratch. Perhaps a better experiment would be to take the topics with the most predictive coefficients, the 5-10 of them, and run LDA starting with those. (yelptopics_nytimes_lda_c_2011_10_17). More interestingly, I created a lexicon of the words with high coefficients for predicting the polarity of Yelp reviews using Naive Bayes (yelp_lexicon and yelp_lexicon_small). I ran LDA on the NYT dataset using the yelp_lexicon as a vocabulary. This brought out a few topics that did not strictly follow along with the newspaper sections. For example, there is an epidemic/disease topic. There is a "corrections" topic with words like the following: incorrectly, misidentified, erroneously, incorrect, correction. The topic on employment reveals a strong motivator: paid, contract, negotiations, wages, executives, employees, unions, manager, compensation. Many of the topics do match up, like baseball and football and music and food and books, but it is just a much more noisy set of topics. It is easier to find the same section topics when that section uses a lot of review-filled words (like food, music, and book reviews). Many of the topics are unidentifiable, perhaps I used too many topics. But some are interesting, such as topic 029 using yelp_lexicon_small: winner, favorite, amazing, perfect, fantastic, outstanding, with other words in various sections of the newspaper. A final experiment I ran on the Yelp dataset using nytimes_med_common vocabulary. I ran sLDA on the Yelp dataset to generate topics with coefficients. I then ran inference on the news articles using these generated topics and coefficients. The distribution of predicted ratings looks Gaussian with mean 3.5 and standard deviation .25 . Nearly all the documents are clustered to be labeled between 3 and 4 stars, with less than 5% below 3 or over 4. Even at the extremes, the documents with the highest predicted label have many death-related and terrorism-related articles. The negative extremes are also not consistent. My next experiment will be to try to isolate topics which relate specifically to sentiment, independent of domain. One idea I have relates to fixing topics when training (an idea Chong Wang introduced to me). My idea is to run LDA on the yelp dataset to generate domain topics. Then, I will run sLDA with those topics fixed plus 2-10 extra topics which are unfixed. The fixed topics will act as background with middling coefficients, I predict, and the remaining trained topics will end up with extreme coefficients and will contain strong sentiment words independent of topics in the domains.
Bloody October
Markets are going to crash within the next month, maybe today. October is the month of volatility and big crashes ('29, '88, and many other examples). Politicians are muddling around with salvaging EuroZone, decentralized group disaffection has spread to the US and New York, billionaire hedge funder John Paulson is being harassed, VIX is absurdly high, congress is playing around with crazy ideas about taxing imports from China, the second largest world economy Japan is in a nuclear sink, and the tech sector which has bolstered the economy is slowing down. I'd keep my money out of exposure to the market's beta for a few weeks. Update: I was wrong!
Everything you know is wrong
We live in a time that is a combination Gutenberg printing, Industrial Revolution, nation-state building, roaring 20's, civil rights movement, and so on all combined into one. We don't know what the world is going to look like in 20 years. All we know is that it cannot possibly look like it does now. Everything is broken. Education is broken. It no longer makes economical sense to teach kids in groups at the same pace by underpaid teachers in physical buildings together. What kinds of geniuses will the world produce under this new system in 10 years? Media is broken. Books were one of the last pieces of media to cross into the digital normalcy. Books are one of the most important parts of civilization. It brought humanity out of the dark ages. Now, no knowledge can be controlled due to artificial scarcity. Students don't buy textbooks. How will the economics of information work? Opportunity is broken. You used to have to know someone in the record business.You had to have a friend in a university. You needed to get that interview at that big company. In the 21st century, you produce your own hit movie, you make your own billion-dollar company, you create your own job and job title, you publish your own book. How will people capitalize on overabundance of opportunity? What will they make? Communism and socialism and capitalism are broken. Communism is dead. Europe is feeling the weight of overpromised social services. Capitalism causes the smartest minds to spin wheels, cash out, and let the market crash, and it has hardly had new ideas in 200 years. Lack of scarcity, ease of group formation, near symmetrical information, and a large wealthy satisfied middle class corrupt past fundamental assumptions. What will the economy look like in a digital age? Privacy is broken. Cameras are everywhere. The government monitors your every email and phone call. They know everywhere your cell phone goes. Your friends post photos and create permanent records of what you do. Your computer keeps a fingerprint of nearly everything you do or think. How will we avoid abuse of this information? Will we have a new fascism? Secrecy is broken. Wikileaks demonstrates that a secret known by enough people will be known by everyone. Everyone knows about Freemasons. Wikipedia has instructions for cooking crack. You can build a nuclear reactor. Everyone knows everything. How will governments keep secrets? Will they at all? The political social contract is broken. Democratic republics were necessary due to the inability of citizens to participate in direct democracy with limited communication. Today, people feel disenfranchised, and a revolution originally limited to despotic countries extends to disaffected groups in democratic strongholds. Arab countries won't look like they do now, but neither will the US. How will the US participative democracy work in a digital age? War is broken. China is making air drones that can attack and target and destroy aircraft carriers. Carriers cost $100 billion each and now a group can destroy them for a million dollars. Cyberattacks cripple government and business targets from zombie computers within borders with no state attribution. Many of the tools that the US has armed itself with for trillions of dollars to defend the country are entirely useless today. How will we avoid war? Who will win if we fail?
Who are you? You are everybody. You are nobody.
Who are you? Who am I? Do you think you control what you do? It makes me sad to think about, but if you watch very closely, if you take special care to be aware of every little situation, you realize that you don't. Why did you do X yesterday? Because you chose to? Nope. Everyone in that same external situation would have done the same thing, probably. My friend gave me a thought experiment once. What if, in 1000 years, someone built a machine that could do quite a lot to your brain and specifically your conscious thoughts. What if it could do the most intrusive thing: what if it could literally plant a thought in your head? What if a machine could let anyone make your conscious think about a certain thought? It makes you think. And then I realized, that is already the case. Yellow banana. Banana banana. Mmm, Bananas! You just thought of a banana. Maybe multiple bananas. Maybe you could taste them a bit. I planted that in your mind. When you read a book, those thoughts root themselves in the forefront of your consciousness. Books work because they are the raw stuff of thought fed directly into the brain. The sum of the things that pass through your consciousness define you and your actions. Language is a super mind-control machine. That's what makes it so powerful. And so dangerous. Language is not quite the same as the posited machine. The brain is sophisticated enough to be able to select its inputs. You can cut out hearing someone. You can avoid reading a book. You can even absorb language in a negative state-of-mind so that the ideas pass through your consciousness pre-criticized and undigestible. Instead of being absorbed those ideas are scorned. Some people live life this way, but that inhibits learning. Such people do not grow, they miss out on new ideas which are correct because they leave this critical filter on over everything. Sadly, these people saw an idea that said they should be critical and always have their filter on. This was the last thing they ever learned. I used to always have my filter on. Now, I don't. And, usually, we don't have this filter on. We are open to the people around us. We read books without remembering to turn on the filter, so that the ideas reprogram our very thinking. Maybe we should, maybe not. Nevertheless, it has strong implications on our free agency. The New York Times writes of some strong meditators who learn to observe external stimuli dispassionately. Whereas some might be distracted by an event, enough to miss another event, these meditators merely objectively noticed the event, and then the following one. The thought was not forced into their minds, but merely presented in front of them. Don't think "banana", instead think "he just said banana." Maybe this is the answer. Maybe we can both grow and learn and also have control over what we are.
In praise of praise
The most interesting and successful of my blog posts are ones I wrote for myself. I wrote them because they clarified thoughts that I had or judgments that I had reserved but never finely expressed. Not every one of the essays of such kind has been fantastically successful, but many have. I wrote about Facebook in a passion one hour and posted it to let off some steam. It became fantastically viral. Why? Does it matter why? Why do I try to replicate that? In fact, whenever I try to copy elements of that explicitly I fail. Rather, there is something about the emotion I had in that topic that was conveyed in the essay. Emotions can be hard to fake. But I get praise for some of my posts, the impassioned ones I write for myself. The praise externalizes a reward for writing. I seek out more external rewards like a rat in a cage. But it never genuinely comes. I demotivate, stop writing for months. Spontaneously, I graze the lever of internal gratification with a piece for me, with an audience of one. I feel complete. But the emotion impacts others, and praise rolls out. It's as if I finally figure out how to run the hampster wheel out of the pure joy of running, but every time I do a treat rolls down the chute. Perhaps this is the nature of success. The treats must be resisted, but this is very difficult when you are hungry. I always fail. Success always leads me to fail. Even now, I feel as though I write this for someone else.
The Gossips
Henry Peach Robinson (1830-1901) Wayside Gossip, 1883. Albumen print http://www.ssplprints.com/image/123584/robinson-h-p-henry-peach-wayside-gossip-1883 
Robinson sets up a landscape narrative with a few possible interpretations of the scene. His use of lighting and the structure of the scene reinforce these interpretations. The nature of the photograph forces a broadness in viewpoints. This one scene forms the intersection from several narratives which portray themselves in this one snapshot. We focus on three women. Who gossips? The two women together by the river may be gossiping. A first interpretation implies that they gossip about the stroller, the third. The photographer designs a tension in this photo by posing the figures in such a way as to reveal a story in a single frame. The path on which the woman walks meanders all of the way back, and yet the two seated women look at the stroller only when she is close enough to be in earshot. They stop talking, watching until she leaves. The photographer tells a story with each element of the piece. The textured trees and ground provide a backdrop to focus the eyes on the figures. In a sea of repetition, each detail of individual variation of a leaf deindividualizes and is lost, pointing the viewer to look away at the mass as a whole or moreso to the subjects. The two women and the stroller stare at each other. The viewer finds himself following the gaze of both parties, searching for meaning in their glances. The grass and trees are also blurred at portions. Presumably the wind moved the trees and grass slightly, creating a blur on the negative. The blur indicates the passage of time as they stare at each other. This does not distract. The path is worn, so it is a well-known path that the gossiping figures knew she could walk down at any time. They aren't scheming, which would cause an out-of-the-way encounter, but merely idle gossip over lunch. The picnic basket indicates a small meal eaten there. The setting displays a prominent vanishing point in the upper left of the painting just below the corner. This balances the image since the two figures on the right are the most white. Two faces emphasize the right half of the print. Emphasizing the third figure on the left, the vanishing point draws the eyes along the lines of the river and the path to the left to balance the image. The figure on the left is standing on a walking stick, probably to hold the pose for a long time. The other two also have their hands supporting themselves for a long pose. These poses are taken carefully to attempt to produce a natural image meant to capture a single moment. Careful study, however, reveals the true nature of the poses, and yet these poses still convey an effect of a normal extended conversation. The seated women are not particularly dressed up for a special event, but rather they seem more natural. It is posed but the are using quotidian pastoral attire. Their clothes give away the time of the photograph, as well as the setting in a rural area. The viewer can feel the quaint aspirations of this rural township, whose most interesting days soak in gossip. The flat contrast in the background de-emphasizes the outline of the trees and grass. It focuses the energy of the viewer on the tension in the figures, on the actual drama and story rather than the setting. The top of the sky is a beige, so it is easy to ignore it over the also flat contrast trees. The whitest parts of the image are the white aprons in the center on the figures on the right, with the left figure's apron a little darker given the position of the sun. The lighting is behind this woman. The final white is the white of the path on which the woman walks, suggesting a purity in her intentions. The path symbolizes her more innocent actions in contrast to the gossipers who perform darker acts of gossip. The photographer uses lighting to emphasize their deceptiveness. The gossipers look at the figure on the left, but they hide their eyes in the shade of their bonnet. Hiding eyes classically inspires feelings of deceit. They lack smiles due to the unwelcome friend. Of course, it may just be that holding a smile for a while in a portrait is hard; it is generally unusual in portraiture, and someone cannot be staring at the sun waiting for exposure so shaded eyes are required. Nevertheless, the photographer uses these necessities to enhance the image's narrative. The setting is open and rational and not quite but mostly static. Certainly, nobody is bustling in the background. The wind however has blurred some leaves. We are in a secluded rural area. The women here found a private place to talk amongst themselves away from eavesdroppers, by the wayside, which surprises them when the figure on the left appears. It halts their conversation. The other interpretation creates a gossiper of the woman on the left. Perhaps the woman is merely participating in gossip as she meets new people on her walk. They can all be genially discussing the matters of the day, the tidbits of the week. They could be great friends, or strangers becoming new friends. They gossip about local news and people they both know in common. It is odd that she doesn't approach closer and keeps her distance. No mouths are open on either side, implying they are merely staring each other down. Moreover, they are all staring. Normally, one of the ones not speaking of the two on the right would be looking around at random other objects. The faces are portrayed in profile or semi-profile view which strongly captures their roundness and detail. It generally is a very painterly landscape and figure photo. The dress details are captured well, and he makes sure to position the figures on the right so that the sunlight captures everything. The sun, by the way, is clearly high in the sky; but not noon, which would be overhead, behind the woman on the left. Not behind the other two, the sun lies somewhere on the left. The photo is in a landscape orientation with a size of 13 inches by 10 inches. The large size allows a lot of the detail in the texture and the small faces show up, but not so much that they look blown up. In very good condition, the glossy print paper is caused by the albumen print. Without abrasions or damage, the quality of the image is preserved. Despite close inspection, no hand-tinting or painting is apparent. The whitest part of the image are the white dresses of the women on the right, which if you indicate as purity, then might imply that they are not gossiping but it is the traveler sneaking by on the path who is. She is darker, muddying the purity of the path with her presence, which is entirely in the shadow given the sun behind her. She meets them, slides back onto her walking stick, and begins to chatter about the juicy tellings she overheard. This is the most consistent interpretation of her position and stature. The picture appears to be taken at a great height above the others. Perhaps the landscape slopes up quickly, or perhaps the photo is taken on a stage. The photo is clearly taken many feet above the others. This high view makes the spectator not feel the part of a participator in the gossip. In fact, the viewer becomes a bit of the subject of the gossip, overseeing that someone is telling stories, but too high up and far away to tell exactly what. Too far away to hear or see anybody's mouth moving at all. It is a view more common in painting rather than photography; people shoot photos at waist or head level due to the physicality of holding the camera. In conclusion, the photo evokes the sense of a daily story which happens in the rural farmland of the UK every day in these times in the 19th century. Gossip happens matter-of-factly as they go on their normal days. This is not a special event, nor is the moment captured unique to one particular story. It evokes a sense of several stories which may happen many times throughout the week.
Your website is unviral
Your website is probably unviral. Everybody wants his or her website to go viral. As web designers and entrepreneurs it is our goal to create buzz; an unstoppable avalanche of traffic; a self-feeding hurricane. For many entrepreneurs PayPal, YouTube and Facebook are the alpha and omega of marketing and strategic growth. The goal is to emulate the distinguishing characteristics of these products in an attempt to achieve similar heights. Some websites succeed and grow on the same trajectory or faster. They usually exist in fundamentally social businesses like email, payment services or social networking in places without such networks. However, there is also a special cadre of websites which lies in a no-man's land untouched by virality. Not only is it difficult for these sites to become viral, but the nature of the business actively fights its own online growth, behaving much like a tumor suppressor gene. These businesses never experience exponential growth and all of their growth paths, even if strong, are linear. Some examples quickly come to mind: male enhancement pills, adult diapers, schizophrenia medicine. The online world is in the habit of thinking itself as viral by nature. Virality, some think, is built into the very fabric of the Internet. It is not. In fact, one of the most profitable online businesses is unviral: online dating. Dating websites carry such a stigma that some couples successfully matched online invent a fictionalized romantic encounter to conceal the fact that they were mouse-selected by a filtering process and a geographic search. Although dating websites provide immense value, arguably more than almost any other online service, users will often strive to hide their enrollment from even their closest friends. Maybe especially their closest friends. Dating websites are unviral. They do not spread by word of mouth. As a matter of fact, they actively suppress this form of growth due to the nature of their service. Many an experienced entrepreneur has made the mistake of underestimating the unvirality of online dating. Your website may be unviral too, although it may be less than obvious. Perhaps it only demonstrates certain elements of unvirality; for instance, would your users tell all of their friends about your service, or only some? Would they actively deny using or even knowing about your website to certain friends, acquaintances, or co-workers if asked? Is it embarrassing? That would be pretty bad for your virality. If this is the case you must face the facts: your website is unviral. Look at examples of of purely viral websites: PayPal, the old Hotmail, YouTube and the current Facebook (not the old version that limited itself to college students) all display or once displayed growth without any symptoms of unvirality. I told everyone about Hotmail when it was launched: cousins, teachers, pen-pals. Users of contagious sites like this may not actively evangelize to literally everyone (as they do with, say, YouTube) but they certainly wouldn't avoid a discussion or hold back praise once the topic was broached. In contrast, there are many sites that quickly provoke responses of "yea that's weird," when mentioned. In these instances unvirality dominates and kills growth. Though unvirality is not a death sentence, it does limit a potential for greater growth. In some instances, unvirality is inherent to the service or structure of the business. But if this is the case, why should an entrepreneur involve himself with it and how can he manage to save it from the depths of unvirality? Two Answers: Anonymity and Covert Transformation- The Internet supports anonymity which allows users to praise a product they love to others--thousands or even millions of other strangers--while avoiding the embarrassment and reluctance to share a product or website that often results in unvirality. Anonymous forums and reviews abound for even the most unviral of products.
- Secondly: The web entrepreneur can covertly transform an unviral business into a viral one by euphemizing or disguising its true purpose. For example: Create a website with dating tools but market it as a social network. Facebook at Harvard worked this way with its subtle but pivotal "relationship status." Give users a guise under which to refer their friends and thus avoid the focus on unviral traits, such as the embarrassment endorsing a dating site, that would otherwise prevent the expansion of your user base.
Utility vs. ViralityMany people confuse utility with virality, but these are actually very independent qualities. Entrepreneurs may believe that if they have developed a good product it will naturally become viral. This could not be further from the truth. Often, people will want to tell their friends about a product they find useful but this is not a necessarily so. Some of the most useful online services actually discourage such talk. Something can be useful and viral (such as Facebook), useful and not viral (dating websites; most products ever created), not useful and viral (lolcatz; chia pets; almost all 4chan memes) and something can most definitely be neither useful nor viral (almost everything). Utility and virality are therefore orthogonal. They represent two different dimensions which can intersect but do not necessarily do so. In fact, something extremely useful--something that you and many others may pay thousands of dollars for to bring yourselves joy for a lifetime--may be strictly unviral. As I mentioned earlier, people will actively go out of their way to not talk about some very useful products. Many medical products fall into this category. Utility is one dimension of a service and it is clearly distinct from virality, though by no means mutually exclusive. The realm of influence between utility and virality is vast and depends mostly on the nature of the business. The lesson: just because your website is useful, does not mean it will be viral. Just because it is viral, it may not be useful and thus will die once the virus finishes spreading. First, solve the utility problem: build something useful. Then, you have to solve the distribution problem, and I gave 2 techniques for doing so: anonymity and covert transformations. Do you have other ideas?
How to hack Silicon Valley, meet CEO's, make your own adventure
It was my sophomore year. Everyone was making plans for fall break. What are you going to do? You don't know? There are only 4 days left before break. Before this particular fall break, I was busy with classes and had thus neglected to make plans. Some students were going skiing, others on class trips, others to homes nearby. Where are you going? I had no idea. However, around this time, I was reading a lot about California. I read work by entrepreneur and essayist, Paul Graham, in which he says that the San Francisco Bay Area is the best place to start a company. He described the energy, but I couldn't palpate it. If I were to take his word, it's an ethereal, magical place. That day, James Currier, internet entrepreneur, stood before me and a packed class full of eager students. His eyes were shot open, a purple glaze lit them afire. His wavy hair burst out atop his skinny head. Gaunt and fearless, he embraced the air as he swung his arms widely to make his point. “Silicon Valley is absolutely the place to be,” he said. “It’s where all technology happens. It’s where Google started, it’s where Apple, Yahoo, Intel, Oracle, and so many other technology companies started. Some of the smartest people in the world lived there at Stanford, Berkeley, and Xerox PARC. It is a magical forever-sunny wonderland where dreams come true and it rains investments and acquisitions.” He went on to make even more grandiose claims. Startups? Risky? Not at all when you do things right. Moreover, they are nothing compared to the risks of a financial job. Everyone laughed. This room in Princeton was filled with students who had already accepted offers at investment banks or who would be applying soon. In 2006, finance was booming with big bonuses and strong growth prospects. Derivatives opened up whole new worlds for trading and speculation. Operations research quants donned their glasses in pride. They were respected. So everyone laughed. He said, "No, really. They can fire you any time. They don't care about you. The market can turn the other way in a heartbeat. You have no job security. Your firm can go bankrupt." To the students at the time, this all seemed ludicrous. They all envied these corporate finance jobs, nevermind that many would lose their finance jobs less than 2 years later. He inspired. He didn't have charm so much as hurricane-force energy. He was insightful and learned. He talked about his great times. He talked about his learning moments. And so he inspired me to see it. I had to see it. What is so special about the Silicon Valley, the San Francisco Bay Area? How can it actually be that great? What exactly gives the air such power to breath life into world-changing tech empires? I knew what I had to do, but Fall Break was just two days away. How would I fly there without paying outrageous fees? Where would I stay? What would I do there? How would I meet the minds behind these great startups? I was a sophomore from Florida. I had no network in California. I searched online for cheap tickets, no luck--that is until I noticed an ad for Hotwire. If you have yet to try this site, Hotwire buys leftover seats in bulk, and then sells them to users blind such that they don't know exactly which flight on which airline at what time until they buy. I snagged a very cheap ticket for 3 days later. Now, where would I stay? I knew exactly three people from my high school in the bay area, 2 at Berkeley, and 1 at Stanford. I sent them all an email and hoped they would get back to me in time. I could always get a hotel somewhere. Finally, how could I reach the top startups in Silicon Valley and find entrepreneurs who could meet with me on such short notice? I didn’t know any CEO's. How do I hack Silicon Valley itself? TechCrunch always covers the hottest new funded startups. Every day, they publish dozens of new articles on the latest technology. I should just pick a few of the best and email them. But how do I choose the best? What if they don't get back to me? Will I waste a trip? I noticed half of all of the articles listed the location of each company. Some in California, some not. So I enumerated every neighborhood in the bay area: Redwood City, Palo Alto, Berkeley, San Francisco, Menlo Park, etc. I wrote a program to crawl all of the Techcrunch archives to find all of the articles about companies in one of these cities. I then parse out the name and URL automatically as well. I looked through the list of companies and I picked the most interesting. Some invented a new technology, and others just came out of a new incubator called YCombinator. These days, you can do this easily yourself with Crunchbase, a useful database of every startup in existence. I wrote another script to send an email to every single one: jobs@azureus.com, jobs@youos.com, and so on. In each email, I wrote: I am a student who will be graduating soon, and I would be very interested in learning more about your startup since I saw it in Techcrunch and I think your Company is very innovative. I'm from Princeton and I'd be interested in potentially working for your company. I am visiting California next week, can we please meet? I sent out dozens of emails, and then I waited. Not everyone replied, but many did. I flew in, finished my homework on the plane, and crashed with my friends (all three through through the week). I met with many CEOs. In startup land the companies are all very small. Everyone in the company has to wear many different hats. Therefore, when you send an email to jobs@startup.com, the CEO reads it. Few people realize that you can easily get direct access to startup CEOs. One company I reached out to was YouOS. YouOS was in the first class of YCombinator. They are incredibly good hackers. We just talked over pizza and they joked about how they've written and rewritten servers from scratch so many times that they can do it in 5 minutes while sleeping. YouOS did not work out, but the founders continued innovating. A couple of them made and then sold Project Wedding. Another went on to create thesixtyone.com and Aweditorium, two of the most innovative music apps in the world. Walking around Palo Alto, I saw several startups on each block. If you can imagine another planet where the Internet is turned into physical locations with storefronts, with Facebook next to Dropbox next to Shopkick, then you have a pretty good idea of what Silicon Valley looks like. You see zetok, jlingo, and any conceivable combination of letters plastered everywhere. I noticed a small blue frog in one corner, it looked familiar. I tried the door and walked upstairs. The offices were in fact the offices of Azureus, the Bittorrent app that made torrents popular. I went up to the exhausted man walking hurriedly by the front desk, and I began with: hi. I'm Joseph Perla. I am a student looking for a job. I am visiting just for a week, can I talk to you for just a few minutes? He was taken aback at first, a little flustered. He said, yes, sure, but not today, I'm a little stressed because I'm signing papers. We’re raising 4 million dollars right now. Can you come tomorrow? Absolutely. The next day, I spent 3 hours talking to the CEO one-on-one about Azureus, raising money, silicon valley, bittorrent, technology, France (he's French), and the french technology industry. I ended up meeting with half a dozen other startup founders. I toured the golden gate bridge and many parts of the bay area, Berkeley, and Stanford. The Valley is very friendly, and everyone does everything they can to help you because, at some point, someone definitely went out of their way to help them succeed. I started building a network from nothing. I directly used the connections I made on my spontaneous trip to start my next company, Labmeeting. David Tisch, of Techstars NYC, made a great point recently. Startups are very difficult. The odds are against you. Your competitors are twofold. On the one hand you compete with the biggest companies in the world. Even more difficult, you compete with inertia and ignorance and apathy. Everyone in the startup industry knows how hard it is, so we all do what we can to help each other to beat the odds. That's the only way it works at all. That's how we succeed against all odds. Silicon Valley is one big mega-commune of startup capitalists. Make the most of what you have (friends in new places), trust in people, and find out what the ethos of Silicon Valley is really like. I know scores of startups who would love to have smart students, especially students looking for jobs, visit their offices and see what they have built. I can point you in the right direction. CEO's love to tell their stories more than you like to listen to them! Let me know if you plan to make your own adventure, and please tell me about your trip when you get back.
Peter Thiel: Lessons on Innovation and Entrepreneurship
Peter Thiel gave a talk at Princeton where he touched on technology, the future, and education. Here are some notes paraphrasing his comments at the talk today. Startups need to have a big vision. You have to have a big vision to hire the 20th person for your startup. Hiring the first few people is easy because they are basically founders, and hiring the 1000th engineer is easy with a salary. You can't motivate the 20th employee with money. Was it fun to work at PayPal? The mood went from scary to fun several times a day at PayPal. Peter took out a hundred dollar bill. He took one out at PayPal presentations all the time. He held it up. Money is worthless but powerful, clearly. It shuts people up in the room, gets attention. But it is poorly understood: network effects? Influence? There has been significant deceleration in rate of innovation outside of IT/Telecom in last 4 decades. Food/transportation/energy have clearly not improved since 1980. Biomedicine has modest progress: pharmaceuticals has not had a breakthrough in the last 20 years. Pharma is firing scientists. Big companies stay innovative as long as founder is CEO, many examples. Google will be more innovative now that Larry Page is back. Peter is concerned about having the most talented people push harder. They can coast on the many-year game that is school. Go to the next level of school. The best and smartest coast by unchallenged. Big companies are either a commodity or a monopoly. You're not supposed to say "monopoly", you're supposed to say "positive network effects" or something else. Buffet says "moat". But they're really more similar than different: look at Google. We need to make it so that entrepreneurs are not glorified episodically and generally derided. It should be a valid path to take at any time and respected.
What to do in Budapest
Hungary is known for its Turkish baths. The Ottoman Turks conquered the area at one point in Hungary's history. The baths are very authentic and fun. Szechenyi baths are the most well-known. Szechenyi baths are great, but they are a huge tourist attraction. If you like to live more like a local, the Margit Island baths habitate almost entirely locals, at least on the weekend. The people selling food there speak only Hungarian, because they never see any tourists. Margit Island is the big island on the danube between Buda and Pest. These baths are only outdoors, (they don't have any fancy indoor baths), but they do have a water slide and a wave pool! It's very fun, and I recommend you visit; they have the same hot, warm, and cold baths as does Szechenyi. Hungarian is very different from almost any other language, so it would be an interesting learning experience (as well as practical when visiting the Margit baths) to learn at least a few phrases like greetings and how to order food and drink. The national liquor there is called palinka. My favorite is cherry but they have various fruit palinkas there such as pear and peach. You'll probably end up doing this anyway, but walking by the Danube at night (or even day), and seeing the many gorgeous bridges lit up is an unforgettable setting. The Opera House, and actually most architecture there, is beautiful as well. I recommend the ruin pubs. They are friendly and relaxed with an interesting decor. I lived by Instant (pronounced IN-shtant), which is a cool one. A big, popular one is Szimpla (pronounced SEEM-pluh) nearby. Szimpla has one seating area with a bathtub chair. I really love Corwin Teto (the rooftop club at Corwin mall in the summer). It's big and open-air and friendly, and they have theme nights like Reggae Wednesday. I had a lot of fun trying out goulash almost every day. Some places have excellent gyulas, but many have mediocre. If you have just one good experience of the spicy, meaty dish, then the whole trip is worthwhile. Hungarians also love their pastries, cottage cheese -based deserts, paprika (mmm, paprika crackers!), and sweet wines. Try them out at the local supermarket.
Write bug-free javascript with Pebbles
Github: https://github.com/jperla/pebbles
We actively seek contributors!
Goals of Pebbles
- so easy that designers and non-programmers use it to write complicated AJAX!
- 0 lines of javascript
- complicated ajax websites
- 0 lines of javascript
- no bugs
- 0 lines of javascript
- very fast speed and optimality.
- backwards compatibility with clients who have javascript off (this was more important 4 years ago when I first made this)
- Memrise loves it!
Plus, you don't even have to write one line of javascript!
The basic idea is that almost every complicated AJAX interaction can be reduced to a handful of fundamental actions which can be composed (remind you of UNIX?). So, all you have to do with this library is add few lines of HTML to elements of a page to describe the Pebbles response that happens when someone clicks that element. Maybe you submit a form, maybe you fetch some content and update part of the page.
Most current websites write and rewrite slightly different versions of these same basic patterns in javascript. This separates the HTML which has information about AJAX interactions and the Javascript which has other information. But you want it all in one place!
Pebbles uses the jQuery.live function. Very heavy pages with tens of thousands of elements take 0 time to load, since almost no javascript is executed.
Javascript can be tricky to write even for an experience programmer. Moreover, a lot of this stuff is repeated, and it shouldn't be. Pebbles brings more of a descriptive style programming (a la Haskell, Prolog) to the web in the simplest of ways.
FAQ
Couldn't you just write javascript functions that you call that do the same thing?
You might but then you introduce the opportunity of syntax and other programming errors, thus not achieving 0 bugs. You would also have to figure out how to make it fast yourself. In practice, this library is so straightforward to use that once you define a complicated action, which only takes a few seconds, you can move it around and it just always works.
Moreover, it's easier to auto-generate correct readable html (e.g. from Django templates). Many of your pages won't need *any* javascript even if highly dynamic. All the custom logic is in one place rather than spread over the html and the javascript. Basically, writing javascript is harder than what amounts to a DSL in HTML.
I need more complicated action-handlers than just these 3, can you please make them?
The code is open source and on Github on jperla/pebbles. Feel free to add your own enhancements. Be careful because you want to keep your app simple, and, in my experience, these 3 actions comprise the vast majority of user ajax paradigms. With a little thinking you can probably do what you want using either "form-submit" or "replace" with the right response html.
Technical Documentation
Pebbles accepts spinner url (to an animated gif of a spinner for waits).
Pebbles sets up a live listener on divs with classes of type "actionable".
Classes of type actionable contain a hidden div which has class "kwargs".
.actionable .kwargs { display: none; }
kwargs div contains a number of <input> html elements, each with a name and value. The name is the key name, the value is the value for that key. In this way, in HTML, we specify a dictionary of keyword arguments to the actionable.
Here are some self-explanatory examples:
It fails loudly if misconfigured. It's hard to write buggy code and not notice in quick testing. It is easy to do everything right and it is easy for you to write a complex ajax website with no extra javascript code.
Full arguments are below:
===========================
Arguments:
type: replace, open-close, submit-form
replace replaces the target with the url
open-close will toggle hide/display the target,
which also may dynamically lazily load content from an url
submit-form submits a form via ajax which is a child of the actionable,
or may be specified in form argument;
the response of the ajax replaces target
url: url string of remote page contents
target: CSS3 selector of element on page to update
target-type: absolute, parent, sibling, closest, or child-of
Absolute just executes the target selector in jQuery.
Parent executes target selector on jQuery.parents().
Sibling the same on siblings.
Closest looks at children and children of children and so on.
child-of looks at target's children
closest: selector used in combination with target-type:child-of to get target's children
form: selector used in combination with type:submit-form to find the form
If you use the open-close type, then the actionable can have two child divs with classes "when-open" and "when-closed". Fill when-open with what the actionable looks like when the target is toggled open (for example, a minus sign), and fill when-closed with what the it looks like when the target is toggled closed (for example, a plus sign).
How to launch in a month, scale to a million users
These are case studies. I will talk about my last two startups where I used a lot of techniques to build them quickly and scale them up. Here I explore different techniques I used to architect them to scale which are quite simple, but someone who is not familiar with building systems may be interested in learning how to build his or her own scalable site. This is based on the outline of a paper by Lampson with more modern web-based examples: http://research.microsoft.com/en-us/um/people/blampson/33-Hints/WebPage.html Labmeeting was a search engine for biomedical literature and a social network for scientists. http://www.crunchbase.com/company/labmeeting. The same principles in Lampson can be applied to any large system such as Google or http://www.turntable.fm. FunctionalityKeep it simple.We built API's before making the website at Labmeeting. That means that the design of data access, security, and data flow happens long before the first interfaces are created. Simplicity in a small interface is key, with well-defined and single-purpose functions coming from each module and submodule of the API. The whole front-end interface uses exclusively less than 30 methods in 5 modules available in the API. Get it right.From day one, we built automated tests into Labmeeting to catch any conceivable and subtle bugs that we may introduce during development. In advance, we knew that it would be a complex, dynamic site with hard to reproduce state. This made it all the more important that each simple method in the API performed exactly as it needed to both in the edge cases and in the normal case. We had individual function tests, module level tests, and full integration tests that automatically started a full chatserver and tested real requests. The tests were run on every commit and no bugs were allowed to persist before writing new code. Don't hide powerLabmeeting was a very dynamic website using a lot of AJAX to speed up page requests and minimize initial page download size. You could click on a fragment of an abstract, or a button that said Full Text, which then made a request to the server and replaced information on the page with the response. A lot of javascript is repetitive, and can be very buggy. We implemented a library that could create complicated AJAX interactions by writing 0 javascript, instead just adding a few extra HTML tags to code. The library virtually eliminated bugs and increased speed on the site by eliminating javascript execution time and centralizing code. Despite just requiring HTML tags, the library allows for maximum flexibility by the user to submit full CSS3 jQuery selectors as arguments if desired. Despite normalizing an interface, it does not hide the power of jQuery. Memrise.com now uses this library enthusiastically. You can see the docs and use this library yourself at the Pebbles introduction. Use procedure arguments to provide flexibility in an interfaceWe created a system for filtering through news articles. The system has many basic parameters that can be passed that are very simple, but the parameters are simply procedures. Therefore, if someone had a special complicated need, they could write their own function that returned a boolean value of whether to filter the news and pass that through the interface. Leave it to the clientThe interface at Labmeeting was very simple, and we expect the client to perform complicated manipulations of the many elements of the interface and keep track of all those states. This allowed the backend to be developed very quickly, although it meant that frontends, like an iPad or Android app, take a little longer to develop. ContinuityKeep basic interfaces stable. Keep a place to stand if you do have to change interfaces. The API of Labmeeting and Stickybits is versioned. They can thus offer full compatibility with previous functionality, but enhancements and changes can be made in newer versions. Making implementations workPlan to throw one away.Many of the routines in the initial prototypes were written very quickly and with an eye to throwing them out once in full production mode. For example, the first version of the PDF search feature pulled in the whole user's collection and did a search in memory. A fully optimized version would be a little more complicated, but many routines were designed that way with an eye to throwing the inner part of the function out and rewriting once the bottlenecks are identified. Keep secrets of the implementationWe built Labmeeting up from separate silo'd modules that, while decreasing performance a bit, allowed them to operate independently and with maximum flexibility to respond to changes in requirements in the interface. For example, the PDF manager knew nothing about how users were stored or queried. The User api could store users in memory, on disk, in Postgres, or halfway across the world. Lab groups only knew that it could call the same API external methods used to look up a user or set of users. Use a good idea again instead of generalizing itAt Labmeeting, we had to extract author names from PDFs. We realized that we could do decently well at extracting the names using machine learning techniques, but never perfectly. However, by indexing a gazette, a complete database of every possible PDF, then we could simply make some guesses (possibly using machine learning) and then just look up those guesses in the gazette to see if there is a match. It becomes a problem of efficient enumeration. We didn't generalize it, and used the idea again in a slightly different context. Each PDF has a scientific abstract with various complicated terms from biology and physics. We wanted to identify those important terms to allow further exploration. Again, some indicators could point us in the right direction, but we did not get everything. So, we crawled Wikipedia to compile a gazette of biological terms, then merely used those terms in the abstracts that appear in the gazette modulo very frequent words like DNA. This was highly accurate again. We linked these extracted entities to Wikipedia to provide further information for the curious. Handle all the casesHandle normal and worst cases separately as a ruleAt Labmeeting, we analyzed PDFs to extract the title, publication date, and other information. The special case of a PDF which is encrypted and unparseable and no text can be extracted went straight to a separate method. The special case could possibly be handled by a more general-purpose algorithm for text extraction that happens to special case to a right answer, but it is more straightforwardly handled separately. Anyone reading the code could see it plainly, rather than having to think through the special case in more complicated parsing code. SpeedSplit resources in a fixed way if in doubtAt Labmeeting, we put the database index on a separate machine from the Solr search index. We had millions of search queries coming into the search system, and we didn't want those queries to slow down the db, and thus normal operation of the site. Writes take much longer than reads, and are more important for logged in users. External users of the site using the search engine just hit the index, performing exclusively reads on the index. This allowed us to scale up the search index independently from the database. Use static analysis if you canAt Labmeeting, before every commit, I had a version of PyFlakes run on all of my new code. PyFlakes is a static analysis tool for Python that finds common errors that can be detected before run-time. For example, PyFlakes can find improper number of arguments to a function call and references to variable names that are not in scope (like typos). Static analysis finds a lot of bugs that might appear in production only rarely in edge cases. It is most useful in a language like Python that is dynamic and thus doesn't have a lot of the normal safety features available to a statically typed language. Cache answers to expensive computationsObvious we did this all of the time at Labmeeting. For example, we performed a document similarity search to find "Related Papers" when we showed one individual paper to recommend other papers a scientist may want to read. The vector computation and search for this is quite expensive so we cache the results for a month. Another example: we had to open up a PDF file which has a research publication, perform text extraction, and then do an information extraction step from the text to analyze the title, authors, publication date and other information. This is a difficult problem to do and involves searching a gazette of 30 million documents and querying the PubMed database at least once. Once this process was completed for one step we saved it to the paper metadata so that we would not have to calculate it again for that PDF each time. The flip-side of caching is that for quickly changing data then one needs to be careful about cache invalidation. When in doubt, use brute forceWe wanted to get the first version of Labmeeting finished very quickly. There are many ways to optimize a system to improve performance, but they come at the cost of decreasing modularity, making more assumptions, and, most directly costly, developer time. The first implementations of the pdf search algorithm used brute force linear search by pulling the name of every scientific paper and then searching each one for the substring. This takes a few minutes to write and does not require a complicated separate hosted index. Moreover, for the small number of papers used during testing, it ends up being much faster than doing a network query to a search index! Compute in background when possibleAfter a user uploads a PDF to Labmeeting, a process must go through the PDF, analyze it and normalize it, perhaps convert it to a standard format, extract the metadata, and deduplicate it. This process can take a while, so we avoid this process from blocking the web server by pushing it to a queue. When the queue completes, it sends a message back to the user, which adds the PDF to the person's collection.
Google Creates Humanoid Robot, Programs Itself
by Joseph Perla. Associated Press. May 13, 2011.
MOUNTAIN VIEW, Calif. — Anyone enjoying talks at Google's recent I/O Conference at Moscone West in San Francisco may have glimpsed some engineers wearing curiously thick belts or backpacks. Harder to notice was that the person carrying those items was not actually a person.
 (Computer hardware in the inside of one of the seven autonomous electronic engineers.)
The robots are a project of Google, which has been working in secret but in plain view on robot engineers that can program themselves, using artificial-intelligence software that can reason about programming and mimic the decisions made by a human engineer.
With a technician nearby with root access to monitor the robot talk, seven test engineers have given over 1,000 tech talks without human intervention and written more than 140,000 lines of code with only occasional human debugging. One even programmed itself to learn product management, a task that requires creative and analytical thinking. The only accident, engineers said, was when one robot engineer released a product that was far too technical for human engineers and users at Google I/O last year.
Autonomous electronic programmers are years from mass production, but technologists who have long dreamed of them believe that they can transform society as profoundly as the Internet has.
Robot employees fix bugs faster than humans, have infinite memory and do not get distracted, sleepy or intoxicated, the engineers argue. They speak in terms of products shipped and bugs avoided — more than 37,000 bug patches were released by software development shops in the United States in 2009. The engineers say the technology could double the capacity of the Internet by re-engineering every line of code in legacy routers. Because the robot engineers would eventually require less office space and energy than a human, they would reduce Google’s carbon footprint. But of course, to be truly better, the robots must be far more reliable than, say, today’s personal computers, which crash on occasion and are frequently infected.
The Google research program using artificial intelligence to revolutionize programming is proof that the company’s ambitions reach beyond the search engine business. The program is also a departure from the mainstream of innovation in Silicon Valley, which has veered toward social networks and Hollywood-style digital media.
During a half-hour talk beginning Moscone West, a convention center in the heart of San Francisco last Monday, a robot engineer equipped with a variety of sensors and following a Powerpoint projected onto the screen nimbly discussed the finer details of unsupervised machine learning to several thousand developers from the heart of Silicon Valley. Little did the attendees know that the code he was projecting and editing was his own.

(A robot engineer developed and outfitted by Google, with advanced backup on belt, lecturing on the new Chromebook at the Google I/O conference in San Francisco, Calif.)
Later that day, the robot engineer announced the new Chromebook computer at the Google conference on Tuesday. He developed and programmed the software on his own. “We’re terribly proud of Sundar, the most successful of our electronic colleagues,” said a Google engineer. Sundar, as they call it, taught himself product management and has risen through the famously meritocratic ranks of Google’s hierarchy to the level of Vice-President.
The autonomous developer can be programmed for different personalities — from cautious, in which it is more likely to write more code to avoid bugs and security breaches, to aggressive, where it is more likely to quickly write brief code and use expletives in documentation.
Christopher Urmson, a Carnegie Mellon University robotics scientist, was pair programming with a robot engineer but not typing. To gain control, he has to do one of three things: hit a red button near his right hand, move the mouse, or press a key. He did so twice, once when a robot almost removed colorful themes from Gmail and again when another human engineer was launching a new feature simultaneously. But the robot developer seemed likely to have prevented the accidents itself.
When he returned to automated "plugged in" mode, the robot slouched and made a grim face meant to evoke going into a deep meditative zone and Dr. Urmson was able to take his hands off the keyboard and gesticulate when talking to a colleague. He said the engineers did attract attention, but people seem to think they are just the some dorky young engineers that Google just hired out of MIT.
The project is the brainchild of Sebastian Thrun, the 44-year-old director of the Stanford Artificial Intelligence Laboratory, the co-inventor of the Street View mapping service, and director of Google’s autonomous car project.
In 2005, he led a team of Stanford students and faculty members in designing the Stanley robot car, winning the second Grand Challenge of the Defense Advanced Research Projects Agency, a $2 million Pentagon prize for driving autonomously over 132 miles in the desert. Last year, he announced the Google driverless car project which has recorded thousands of miles of driving on hlghways from San Francisco to Los Angeles. Google is currently lobbying Nevada to be the first state to allow autonomous vehicles legally.
Besides the team of 15 engineers working on the current project, Google created seven robot engineers, each working as employees on the team to program themselves. Google is using six hundred Intel and one AMD processor in the project.
The Google researchers said the company did not yet have a clear plan to create a business from the experiments. Dr. Thrun is known as a passionate promoter of the potential to use robotics to make software more secure and lower the nation’s energy costs. It is a commitment shared by Larry Page, Google’s co-founder, according to several people familiar with the project.
Google first publicly experimented with human-less engineers at the Google I/O conference in 2010. Lars Rasmussen, another engineer at Google, worked with Thrun to create the robot engineer they named Jens which covertly played Lars Rasmussen’s brother. Jens presented a talk on stage to launch Google Wave with Lars Rasmussen supervising as his human operator. They notified authorities beforehand.
 (Lars Rasmussen and Jens launching Google Wave last year)
Google Wave was conceived, developed, programmed, and launched entirely by Jens. Recently, however, Google Wave was deemed too technically complex and cancelled, one of the many failed projects created by robot engineers in the past year. The self-programming engineer initiative is an example of Google’s willingness to gamble on technology that may not pay off for years, Dr. Thrun said. Even the most optimistic predictions put the deployment of the technology more than eighteen years away. "The engineering quality is currently at Microsoft-level, but not Google-level, quality."
Late last year, Lars Rasmussen left Google for Facebook. Sources close to Google say that Lars attempted to assert his legal right to his robot brother Jens. “Despite flaws, he is such an invaluable colleague,” Lars remarked.
“The technology is ahead of the law in many areas,” said Bernard Liu, senior staff counsel for the California Human Rights Center. “If you look at the legal code, there are scores of laws pertaining to the rights of individuals, and they all presume to have a human being operating under contract.”
The Google researchers said they had carefully examined California’s legal regulations and determined that because the electronic engineers were wholly created at Google, the experimental employees are Google’s property. Mr. Liu agreed.
Scientists and engineers have been designing robots since the mid-1960s, but crucial innovation happened in 2005 when Thrun and colleagues achieved successes with their autonomous vehicles in the DARPA Grand Challenge. Peter Norvig, Director of Research at Google and Artificial Intelligence expert, and colleagues quickly translated their success in the complex task of driving into their own field of programming computers.
The original codename of the project was Android, the fictional human-like robot of Philip K. Dick stories, but that was scrapped with the increasing popularity of the Android mobile operating system also developed by Google. Since changing the name to Project Watson and starting collaboration with IBM, the technology has been steadily improving as the robot engineers work alongside Thrun’s human team to improve themselves.

(Smarter Than You Think: Guided by Computers and Sensors, 3 robot Google employees)
Advances have been so encouraging that Dr. Thrun sounds like an evangelist when he speaks of robot engineers. There is their potential to reduce energy use by eliminating the Google chefs and cafeterias, given the reduced need for amenities, and to ultimately build a smaller Googleplex.
There is even the farther-off prospect of employees that do not need any upper management. That would allow the robot engineers to manage themselves, so that they can get more work done. Fewer employees would then be needed, reducing the need for office space, which consumes valuable land.
And, of course, the robots could save engineers from themselves. "Can we program twice as much while playing video games at work, without the guilt?" Dr. Thrun said in a recent talk. "Yes, we can. Now, if only Droid apps would write themselves."
Facebook is a Ponzi Scheme
Now that you know what a Ponzi scheme is, I will tell you how and why Facebook is like a Ponzi Scheme. The argument is similar to how Paul Graham describes that Yahoo was a ponzi scheme in 1998.
Facebook posts huge revenues. In fact, recent reports are that Facebook is very profitable. This boosts both their respect in the world and their valuation. However, these returns, while real, are unsustainable. They exist and are sustained in the same manner that Ponzi schemes are. Facebook is a Ponzi Scheme.
Have you ever bought a Facebook ad? I have. I have talked to many, many people who have. We have spent hundreds, many have spent thousands or even more, experimenting with Facebook ads. They are worthless. Nobody ever looks at them, and nobody ever clicks on them. I just talked to someone who was trying to promote a book. He found it cost him over $100 in ads to sell one book. Moreover, as you increase your ad spending, people get used to the ads and just ignore them. So, your already low click-through rate plummets even further.
People go to Facebook to interact with their friends. It is fundamentally different from the ad platform that is Google. People go to Google to find something they need, possibly ready to buy, which a good percentage of the time can in fact be solved by someone's ad. Facebook ads, on the other hand, annoy users. They yield no real value, and thus no profits.
But, then, how is Facebook so profitable? Are they lying? No. They are growing. More and more people sign up to Facebook, and more and more businesses hear about how many people are on Facebook. It seems like a huge opportunity. TV shows and award-winning movies are made about Facebook.
Because of Facebook's presumed success, many small, medium, and large businesses individually and in turn experiment with Facebook ads. They spend hundreds or thousands or more on Facebook ads. At the end of the first run, they see bad ROIs. They tweak the ads and spend more money and try again. Nothing. So they stop, understanding that Facebook ads are worthless. Almost everyone I've talked to who has actually bought Facebook ads knows this. But, not everyone has bought Facebook ads yet. There are still more and more new businesses finding out about Facebook ads. As they grow, even more businesses give their money to experiment in destined failure.
Eventually, though, and this might take a long time, but it is finite, everyone will have tried Facebook ads and know that they are useless. Eventually, after 10 million businesses have invested $1000 each, and Facebook has earned $10 billion in revenue in total, then they will have run out of new customers and their revenue will dry up. A useless product is never sustainable. I wish I could short Facebook.
Now, it is possible that some extremely niche businesses have found limited utility from ads (for example, BustedTees and social games may be the lucky few). It has been shown, however, that some of the biggest advertisers are huge, outright scams and others have deceptive practices at best. Also, Mark Zuckerberg might have a fit of brilliance and then announce a revolutionary ad platform that somehow actually works on social networks. My guess is not. They haven't yet. What is clear from everyone I know who has advertised on Facebook is that it was a waste of money. Facebook promises big returns on ad spending, but delivers nothing. Yet, their value and growth continues because they can use that money to grow their user-base more and assert profitability (in this sense it's not quite entirely a ponzi scheme, but there is no closer idea). It's possible that they do not even realize that they are like a Ponzi scheme.
That's right, they may not even realize that their ad platform is completely useless because they always get new clients signing up and giving up their offering to the god of web 2.0 hype. They may be blind, as I used to be. They may be truly surprised when the supply of suckers runs dry.
More likely, in the end, they will get teenagers to pay a monthly fee to host all of their party photos. Of course, then the next VC-funded Facebook (just as MySpace killed Friendster, and Facebook killed MySpace, so will NextFB kill Facebook) will offer the same services and be free and take over the "market." The cycle repeats itself.
Make news, don't read news
I used to read the news all of the time. It seems so productive. It seems great because you are learning something you don't know about, very often (though not always since sometimes you seek out that which confirms your biases). It seemed most useful for conversations. Whenever I meet someone, I can have a conversation about the latest thing that we both read about. We have a common base to talk about something that we both know little about, so we are on equal footing. Also, we can talk about this interesting piece of news instead of the weather. There are a few problems with this, though. Very often, the conversation just involves us repeating the details to the other person, who already read it and thus knows exactly the same details. We listen carefully, or at least pretend to, because that's what we're told to do, and then we nod and say, yea, and this to prove that we are intelligent and heard about the news already. But this is dumb. It would be much better to have it explained to you, actually, fresh. I had this experience recently. I had been working so hard on various projects, that I literally could not waste any time learning about things happening around me. Weeks later I found out about this oil spill somewhere. Movies came out, had big runs, and then went on DVD before I had heard about them. I had a conversation with someone the other day where he mentioned a piece of news, and I said I hadn't heard it. He looked at me dumbfounded. How could I not have seen this? How? I was busy getting work done and learning. The funniest part is that he probably, not consciously, but somewhere in his mind it seemed as though I was not quite that smart. I could not keep up and converse on the latest topics. In fact, I could not, but topical fluency only correlates with intelligence, it does not define intelligence. Moreover, reading the latest news outside of your industry, for most professionals, is a time-killing activity that only signals intelligence. It is possible for someone to signal intelligence and trick someone into thinking that you know something without knowing anything actually useful. One day, I saw that a friend of mine's friend was very into classical rock. He had vinyls upon vinyls hanging on his wall. I realized that I knew nothing about classic rock, or music in general. Classical rock would be a good place for me to start learning music. So I read some Wikipedia articles, and I found a torrent with the "top 500" classic rock songs of all time. It started with Stairway to Heaven, moved on to Freebird, the Beatles, etc. I downloaded and listened to it from the top of the charts. I listened over and over, looked at the songs, the artists. In a few hours, I knew the top songs and artists and I could even recognize and sing along to some of them. The next time I met my friend's friend, I mentioned some of these songs, and we talked a bit about them, maybe argued about whether Freebird or Stairway to Heaven is better. Anyway, years later, he mentioned some classic rock I had never heard of. He was surprised I hadn't heard of it. He thought I was really into classic rock and listened to it and followed it closely. I did not. I just learned a tiny tidbit, enough to signal intelligence in the music. I confessed that I knew next to nothing, not that I was trying to mislead at all. News helps you signal intelligence in this way, falsely. It's much better to make the headlines, learn something deeply and create something. Make the news, don't read it. Unfortunately, I still read the news all of the time. It is really hard to stop. I'm not sure why.
How to drop out of college and start a funded Social Network
I will tell you how drop out and start a social network that grows into, ironically, the leader in the college admissions space. I will tell you how to start a social network for scientists whose lead investor is Peter Thiel (who also funded Facebook and started PayPal). Finally, I will tell you about how to help launch the hottest new rival to Facebook, also funded by Peter Thiel and SoftBank, the Google of Japan, and move on to work on Stickybits, to revolutionize how people interact with everyday consumer products.
Step 1: Read Paul Graham's essays.
The story starts my freshman year at Princeton. I had read all of Paul Graham's essays, which are not only thoughtful and information-rich, but also inspiring. Paul's essays described his own experience starting ViaWeb, which he eventually sold to Yahoo! for tens of millions. It is now called Yahoo! Store, one of the few examples of successful '90's bubble companies. He talks about every step of the process, a process which seems very unique and peculiar, and yet surprisingly all startups experience basically the same sets of problems, setbacks, successes, disagreements, and emotions.
In fact, in general, read good books. Blog posts are useful and timely, but books have much denser concentrations of information and they are more insightful. The best blog posts on the web are often just slivers of individual chapters of an existing good book. Blogs give you tiny tidbits of information, one interesting aspect of a complicated story, but a good book gives you that plus the other side and the whole picture, the future and the past, all at a deeper level. A well-written book will not waste words. Those hundreds of pages are worthwhile. Read Founders at Work, by Jessica Livingston, also at YCombinator and also a brilliant entrepreneur and interviewer. The book's stories are inspiring: James Hong's amazing viral growth of HotOrNot will make you want to do the same and become an overnight millionaire.
These writings are inspiring. They inspired me. I started to itch to start something, anything. I started to build things and talk to more people about these interests.
Step 2: Be friendly.
Through a friend and my work, I met Mick Hagen and Jeremy Johnson in the spring semester. If you are lucky enough to meet them, Jeremy and Mick are two of the nicest, most thoughtful, and most ambitious people you will be lucky to meet. We shared a common interest in technology startups. We started talking about what we could do together, drawing on all of our skills.
Some of the best friends you make will be in college: life-long friends. These tight bonds are forged from living very close to each other, possibly in the same room, every day for years. In the real world of apartments and houses, a friendly visit can easily take a half hour commute each way and is centered around a big event. In college, you walk down the hall and just hang out. Moreover, in your classes, you learn both the quality of your friend's effort and how well you work together. A mutual trust is formed over these months and years that are hard to form in the real world. In college, you will find your cofounder, whether they be friends or friends of friends.
Jeremy was interested, as he still is, in the college markets. What can we do to help improve college admissions, the student bodies at the colleges, and the college experience? His plan was more ambitious, but I proposed a simpler one: let students form a social network with ties to college admissions officers. Let students display their scores, interests, and activities online, and let admissions officers at Princeton and Harvard search for them. Charge per student found. Would this work? I reasoned that the College Board already does the same thing with PSAT scores, so I called them (abbreviated transcript):
Step 3: Test your assumptions.
Me: Hello, is this the PSAT office? My name is... um... Mark Westerner at the Marbur College.
CB: Which college?
Me: Um... (*will they look it up?*) Marbur College, a small liberal arts college in New Jersey.
CB: Marbur, can I help you Mr. Westerner?
Me: We are interested in purchasing some student PSAT scores and mailing address information.
CB: Yes, we do that here.
Me: How much would that cost?
CB: Let me see, you can buy 1000 names and addresses for $280.
Me: Thank you. Goodb—<I quickly hang up>
Gold mine. We would sell student information to colleges, completely willingly and enthusiastically on the student's part. Colleges already pay lots of money for very similar but incomplete, noisy data. We could sell the same information over and over again. Colleges get to target and recruit in a way that they have never been able to before. Everyone wins. This would be our primary business model, and in fact still is used today at Zinch.
Step 4: Use university resources to get feedback and advice.
With a business model in place, we went to all of the professors we knew who might be able to help. We talked to Ed Zschau who helped us write a business plan. We talked to the dean of admissions. She said she would love something like this. She told us a story where the school musical director told her that we needed an oboe player, since all of the oboe players were graduating seniors. This endangered the diversity of the school, and the annual Mozart concert. She looked and recruited and found nobody. On the last day, Princeton happened to receive 3 applications from oboe players with excellent academic records, and they all got in. She got lucky, but she would have much preferred an electronic way to target individual students to recruit and encourage to apply.
Armed with a business model, a plan, and this story, we entered an undergraduate business plan competition. We won 2nd place, and, more importantly, we received valuable feedback from the experienced venture capitalist judges. We tweaked the presentation, and then entered the Princeton alumni business plan competition. You have to understand that the alumni business plan competition is open to all Princeton alumni. This includes seasoned financial professionals and Harvard MBAs. We won first place to a raucous applause.
Step 5: Ask for forgiveness, not permission.
Now, we needed to reach out to more admissions officers to learn more about what, exactly, they wanted, and how to sell it to them. How could we do this? There just happened to be a conference on college admissions in June at Harvard with all of the top admissions officers at Harvard, Yale, Stanford, Duke, and others attending. This would be a perfect place to make connections.
Jeremy: Hello, we are students interested in learning more about college admissions.
Harvard: Hello.
Jeremy: Is it possible for us to attend this conference with a free or reduced price?
Harvard: No.
Jeremy: We want to make a product to make admissions better. We won't take up anybody's time.
Harvard: No.
Jeremy: But, really, please we have no intention of...
Harvard: No.
Jeremy: (to us) Let's go anyway and crash it.
So we drove up together to the conference. We figured that we would probably not be allowed in, but we might get a little information and trade business cards. When we got there, we saw that the conference was just in a hotel lobby. We walked up, put on name tags, and started mingling. Note that most of us were freshmen, so we barely looked post-pubescent much less like admissions officers.
Step 6: Do your research.
We sat at the back of a panel discussion with the admissions officers at Harvard and UPenn. They would literally say to everyone, to us, "It is just really hard to find good students which are the right fit for our colleges. We would love to able to find a student with these exact interests and academic record, pick them out of this area of the country, and just recruit her." Everyone we talked to loved us. Mind you, if asked, we would always tell them the truth that we are Princeton students passionate about and interested in learning more about college admissions. We never ate any of their food or interrupted any classes. We merely observed and met our exact target clients who basically begged us to make Zinch for them.
One piece of research we did not do was where to stay that night. We figured we would be kicked out, so we hadn't planned on anything. We tried calling people who we knew in the area, but nobody answered their phones. We asked friends, friends of friends, people our friends met on the Subway. We were a poor startup with barely the money for the gas. We sat in Qdoba waiting for a call. Looking out the window, we saw a Sports Authority. "That's it! We'll buy a tent, set up camp at some park somewhere overnight, and then return it tomorrow." We were desperate. So we went in, started figuring out the measurements. We went over to the register, credit card in hand. Then, an aunt's friend called us back: we could stay at her house. Too bad, would have made for a good story.
The next day at the conference, we met even more people, and they loved us. Suddenly, this woman walked up to me with a very stern face. She organized the conference, and had told us not to come in the first place. She kicked us out, but not before we already had the contacts and market research we needed. We drove home happy. There are a lot more unbelievable stories from the formation of this company, but they will have to wait for the memoirs.
Step 6: Don't drop out of school.
For most students, this advice is correct: you should not drop out. It only makes sense to give you this advice, all responsible adults will. There are a special few students, though, who, at exactly the right point in their lives, will understand that this advice does not apply to them. There will be no shadow of a doubt that school would just be too boring and unmotivating. When the time comes, those students know who they are.
I had shadows of doubts. Jeremy, Mick, and I disagreed a bit about direction. I decided to stay in school and stop working on the company, which was the right decision for me at the time. Mick and Jeremy continued on a different path from me. As an epilogue, Mick is now in California with a terrifically growing company, Zinch, which is so big that it is now expanding to students in China. Jeremy co-founded and now runs 2tor, which is leading the online college education space. Many people come to me with ideas for allowing students to take classes online. They ignore what has come before, and they do not aim high enough. Jeremy and John Katzman (founder of Princeton Review) put real, leading universities online, like USC, so that top students around the world can take classes entirely online and receive a full diploma equivalent to someone who spent time on campus. You will be lucky to get to know these guys.
Step 7: Integrate into your local community of entrepreneurs, or, lacking that, build it.
Back from my startup adventure, I wanted to evangelize the gospel of Paul Graham. Unfortunately, the Entrepreneurship Club was defunct. Instead, financial firms were hiring in full force, and almost no students knew anything about starting a business. I decided to resurrect it, and start it anew. I grew it from 0 members to hundreds, and made sure that the new leaders in every year learned how to run the club and teach the following year's posterity. It continues itself now in a virtuous cycle. It has grown every year, and in fact, now, the Entrepreneurship Club transfers more tens of thousands of dollars through its account than any other organization on campus. The first year that we bought back the TigerLaunch business plan competition, we ignited the career of another successful drop-out Princeton entrepreneur: Seth Priebatsch of SCVNGR. The network of people at Princeton now involved in startups is growing, and we have helped each other succeed in innumerable ways.
Step 8: Talk to other students from your school who have taken time off.
The club, one day, invited someone to give a talk, James Currier, who started Tickle.com which sold to Monster.com for an incredible amount of money. James stood before me. His eyes were shot open. They had a purple glaze that lit them afire, still bleeding from the red-eye flight he took from California. James had taken time off of Princeton to start his first company, which failed, but he doesn't regret it at all and learned so much. His hair burst out atop his skinny head. Gaunt and fearless, he embraced the air as he swung his arms widely to make his point: "Silicon Valley is absolutely the place to start a company", he said. "That is where all technology happens. That's where Google started, that's where Yahoo, Intel, Oracle, and so many other technology companies started. Some of the smartest people in the world lived there at Stanford, Berkeley, and PARC. It is a magical forever-sunny wonderland where dreams come true and it rains investments and acquisitions." (not exactly what he said...)
He was inspiring. He didn't have a smarmy kind of charm so much as sheer hurricane-force energy. He was insightful and learned. He talked about his great times. He talked about his toughest times. And so he inspired me to do it. I had to see it. What is so special about the Bay Area? How can it actually be that great? What exactly gives the air such power to breath life into world-changing tech empires?
Step 9: Pick a startup hub like Silicon Valley.
It was a school break the following week, so I bought a ticket for that weekend. I bought an incredibly cheap ticket on Hotwire and asked my high school friends in California schools if I could crash on their couches. I also emailed every single company on TechCrunch which stated that its company is in any city in Silicon Valley, San Francisco, or Berkeley to ask for an interview. It was tight scheduling.
If you haven't been to the Bay Area, then you don't understand how it is possible that literally almost everyone is involved in startups. I go to the basketball courts to play some pickup. After a sweaty game, each one in turn introduces their crazy new web2, hardware, or biotech startup to you, each one the founder or CEO. Multiple lunches and talks happen every day, with free food and drinks, you cannot possibly go to all of them or even meet everyone. And everyone wants to help you. I walked down University Ave and saw Facebook, I talked with the CEO of Azureus for 2 hours one-on-one, to the CEO of StyleHive and so many others.
The fact is, these hubs do not crowd you out. They have an overwhelming amount of resources to help you both in early stages and in later stages. Be friendly, learn what you need to know, and everyone there will do everything they can to help you be successful. If you stay in your hometown, as Jeremy, Mick and I almost did in New Jersey, we would have certainly failed. Now, Mick is in San Fransicso, and Jeremy is in New York, enmeshing themselves in the startup scenes and reaping the benefits. If you stay in your home town, understand that you do so not to maximize the success of your startup, but for some other reason, like comfort. Startups are risky, not comfortable. Get a job at Microsoft for comfort. I was done with comfort, I wanted to start a startup.
Step 10: Ask a dean about how to take a leave of absence, and how long you can take one.
Just grab or email your nearest dean, who will point you in the right direction. Princeton has a very lenient leave policy. You can take 3 years off without a problem. You do so by filling out a 1-page form, and you can do this all in a day. You can leave as late as the day before classes, or even after classes start (although you have to pay some tuition). To get back in a year or 3 later, you send an email. Financial aid is unaffected. Every dean you talk to will be very supportive of your decision; they will not question you. This is an excellent policy that encourages students to figure out what they want to do without pressure. Certainly, they would prefer a student to learn in a different way for a year rather than drown in school or do something worse.
Other schools have less lenient policies. Yale only allows a 1-semester leave, which limits the potential for student startups at that school. Their entrepreneurship club would do well to lobby the administration to relax the policy.
Step 11: Reach out to your friends and brainstorm.
I contacted some friends I had met on my trip to California, asking them if they knew of any other people interested in a new startup. I talked to Mark Kaganovich and Jeremy England, and we talked about making a social network and practical tools for managing research for scientists. Mark and Jeremy went to Harvard and are hard-core scientists. Mark is friends with Mark Zuckerberg, and was the 6th person on Facebook. If you get a chance to meet them, you will be blown away by their brilliance. They think analytically and carefully. I only met them from a friend of a friend, but we quickly got along well and we are very good friends and trust each other about everything.
So we started Labmeeting, led by an investment from Peter Thiel, who met the Labmeeting team randomly at one of the many events at Stanford. He saw the quality and depth of thinking of the team, and made his trademark quick decision. These kinds of lucky coincidences happen all of the time in the Bay Area. Now, thousands of scientists love and use Labmeeting to manage their labs and do research. We were the first, and we have the largest number of users from Stanford and Harvard than any other imitation network.
Step 12: Help other entrepreneurs.
In the mean time with Labmeeting, I was helping another young entrepreneur start up his own company, Josh Weinstein. He refused to drop out, but I did help him get GoodCrush off the ground and launched. Since that launch, GoodCrush has renamed and has now been funded by several notable people and venture firms (including Thiel of Facebook). It will rival Facebook at its own game: the college market with CollegeOnly.
One key to Josh's success is public relations. When launching GoodCrush, we were given the contact information of someone at the Huffington Post who could write about GoodCrush. We called them the day before Valentine's day, the big launch, but we mis-dialed:
Josh : Hello, is this the Huffington Post?
Chris: No, you must have the wrong number.
Josh : Oh, I apologize... <almost hangs up>
By the way, who is this?
Chris: Chris, I write at MediaBistro.
Josh : <excited> I'm Josh, we are launching GoodCrush.
It's a new dating wesite for college students
Chris: Is this a new startup? Tell me more...
An hour later, Chris Ariens posted a story on MediaBistro, all from mis-dialing and taking advantage of opportunity. Serendipity is the essence of startup success.
Through the Entrepreneurship Club, I've advised and helped set up half a dozen different companies. They may or may not do well, but the students will certainly learn a huge amount of work. In just a few years, we have seen a tremendous amount of new interesting startups coming out of Princeton, far more than I thought could happen in such a short time. For example, art.sy will transform the way that high-end art is sold. I encourage you to research more and help them out if you can.
Step 13: Let others help you.
Josh introduced me to Billy Chasen at Stickybits. Stickybits is an iPhone app that lets you scan barcodes, and then attach images, video, or text to the barcodes. It's like a virtual bulletin board, so that people can have conversations around products. We have exciting new ideas for how to transform the way you interact with consumer brands, but I can't talk about those yet. We are funded by none other than Mitch Kapor, Chris Sacca, First Round, and Polaris Ventures. My limited experience and skills and the people along the way have helped me do well here. The amount I'm learning from other team members is tremendous. We are the leaders in the social barcode scanning space.
Conclusion
Peter Thiel just launched a new program that will give you money to drop out and start a startup. Startup business is on the rise, the economy is improving. Facebook and other companies are enabling newer business models. More people are on the Internet than ever. This is really the perfect time to start a company, consider doing it now, but don't drop out of school. Meet people, make friends, brainstorm, build a community, help others. You will know when to leave and do startups.
The Face that Launched a Thousand Startups
The Facebook Movie will launch a thousand new websites. The Facebook Movie will be beyond epic. It is written by Aaron Sorkin, an incredible screenwriter who also wrote the West Wing, Zuckerberg's favorite TV show. It is directed by David Fincher who directed Se7en, Zodiac, and Fight Club. Trent Reznor of Nine Inch Nails writes the music. Early reviews love the acting brilliance. It is a story that everyone knows, down to the ending. Yet, early critics praise it for its brilliant cuts and editing. The dialogue is fantastic, as can be expected from someone who wrote the careful prose that defined the West Wing.
This movie will blow out the box office. It will blow out the box office not because Facebook has 500 million users, but because it is actually good. Only 1/3 of US adult population uses Facebook, so a big proportion of people who could watch it will not be Facebook users. It has to be good, and given the people involved, it clearly is. The trailers are dark and moody. If the website and trailers are any indication, the movie will bleed drama while simultaneously aspire to the grandest visions. The movie trailer inspires a dream of creating an empire from a dorm room. Ironically, the movie will be the Wall Street of our times, but for startups instead of finance.
And therein lies its power. Millions of young people will be inspired: college age, out of college, and kids. They will see what is possible from a kid in a small room. They will want to learn how to do the same thing, to learn to hack, to build a website. Thy will create companies emboldened by inspiration and luck. The movie presents a gleaming vision of success and power. The movie, in a brilliantly dramatic way, will inspire thousands to follow the same path to achieve just a fraction of the wealth. Being a computer genius will be cool again.
Measure the numbers of applications to incubator like YCombinator and TechStars. Measure over time the hits to startup-related forums like Hacker News. I guarantee a large influx over the coming months.
How to drop out of college and start a venture-backed Social Network
A quick google search reveals that there are no good guides online that tell you how to drop out of college. So, this will be a first. There are many opinions about whether you should or should not, but none which really tell you how.
For example, Jason Baptiste just wrote an excellent blog post about why you should stay in college. He is right in many ways, but you should also look at the other side in detail and how well that can turn out.
I will tell you how drop out and start a social network that grows into, ironically, the leader in the college admissions space. I will tell you how to start a social network for scientists whose lead investor is Peter Thiel (who also funded Facebook and started PayPal). Finally, I will tell you about how to help launch the hottest new rival to Facebook, also funded by Peter Thiel and SoftBank, the Google of Japan, and move on to work on Stickybits, to revolutionize how people interact with everyday consumer products.
You can read about these stories on the new article page.
Travel Naked
I like to travel light. Anybody who has traveled significantly understands the importance of staying lean. A heavy bag, or series of bags, can ruin the experience of hopping from city to city, which can color the whole trip. Practically, it can cost extra money to move extra bags on a flight or drop off the bags at a bag holding service. Waiting for a checked bag can add more than an hour to your commute time at some airports in certain seasons. Every time I traveled to Miami airport, I waited for at least half an hour and once 2 hours for my checked bag to circle around the carousel. Some people think that they travel light, but they do not. One checked in bag is not light. Checked bags are the bane of the traveler. You do not want to wait for your bag to come out a turnstile. It is boring and tedious and you never want to do it. One carry-on is much closer to the ideal. My friend the other day went to Hungary. He decided to travel light, and just bring one duffel bag. He bought some clothes, and other essentials. But if you are running around a city for a whole day, say on a 12-hour layover in Milan, rolling a bag around can start to tire you out. You can check it in, which I did in Zurich, but that delayed my 10-hour layover by over an hour. I would have much preferred to travel with little than to bring even one small bag. My friend took a small amount, but he could have taken less. I took one small backpack to Hungary. It contained my MacBoook Air laptop, which fits in a manila envelope, an Amazon Kindle, a legal pad, my passport and money, my 3oz green travel towel, my Vibram five-finger shoes for running, my sweat pants for sleeping, and black shorts for running. I realize that I could have brought even less. I did not need my travel towel, since anywhere with an actual bath or shower will also have some kind of towel since nobody expects anyone to travel with towels. My apartment had a maid who provided towels. Hotels provide towels. Even hostels have them available. I hurt my toe, so I could not wear my Vibram running shoes. I wanted to run, so I just took a run around Budapest with my sandals, and it was fine, and in some ways better. I learned that I don't necessarily need my Vibrams either. Budapest clubs are not so haughty as to disallow sandals. Europe is littered with H&M stores, which have quality fashion at absurdly low prices, so i shopped for clothes there instead of packing clothes. I recently started to use the Kindle app on my iPhone 4 on my 35-minute walks to work. Of course, the large-screen Kindle DX is a hugely better experience. But, the iPhone has the advantage that it is always in my pocket, always. It's also faster to turn the pages and scroll through books. The new version includes the Oxford English Dictionary, so I can look up words, highlight, and take notes much more quickly than on the Kindle. I love my Kindle DX, but it is unnecessary for travel. Although I have to hold the smaller font closer to my face, the Kindle app on the iPhone 4 delivers an acceptable experience. The legal pad, sweat pants, and shorts I could honestly buy anywhere in the world. They would not be as high quality, perhaps it would be white paper instead of legal paper, maybe some random shorts instead of high-tech Lululemon gear, but they would work for a few weeks of travel. In fact, if not for my work heavily involving computers, I would not need a laptop either. The iPhone would serve me fine for checking email and reading news. Relieving myself of this, I would need to take none of these things to Hungary. I could travel naked, with clothes of course but with nothing else really. No bags, no trinkets, nothing to hold me down.
Vibrams? Just Run in Sandals
I took a run in Palo Alto the other day, around Stanford. You see, Stanford has this large park area called "The Dish." Everyone from Stanford knows about it, as it is a popular hang out spot for the day (at night, mountain lions roam). The Dish lies about 1 mile from the main campus. It is a large, hilly area, from which its name is derived: Stanford locates a (few) large satellite dishes on the tops of these hills, hundreds of feet up, pointed at the sky. Stanford is nice enough, however, to also maintain a running path there and allow the community as a whole to use it. Anyway, I was running through the park in my Vibram five-finger shoes. The Vibrams help keep me my feet strong and fit. They are also small and light, which makes them great for travel. I was busily enjoying them, when this guy came up behind me. He said, "Nice Shoes." "Thanks." I was tired, so I did not immediately know what to say next. Then I looked down at his shoes, and he was running on the trail with sandals. I was astonished. Sandals easily fall off, so they require a certain continuous focus and muscle tension to keep them on. I asked him about it, and he shrugged it off as nothing. He wanted some Vibrams, but he was able to pull these off in a pinch. He would be running barefoot, but the soles of his feet aren't toughened up enough for that, he said. "Wow," I muttered. This guy is intense. I tried to keep up with him for a 3rd loop around, but I was dehydrated and exhausted and I could not make it all the way up the second climb. I walked home. This thought lingered, but I kept my Vibrams. But this guy helped me notice that my Vibrams were not entirely necessary. I do love them, and they make walking barefoot, flat great. But I may not need them. As you know, I am religiously careful about owning stuff, and I am constantly evaluating the few things that I own or consider owning within my stuff minimization framework. I thought that Vibrams would help me stay fit and lean, minimizing a beer belly, while themselves being light and small enough to throw into a bag without taking up much room as shoes would. They do, actually. Yet, if I can run with sandals, then I don't need them. I did run in sandals in Hungary in this past trip. I could not use my Vibrams because I had a huge gash on my toe and I lost a toenail. It was painful to touch my toes, yet I could still run in my sandals with only a slight change in my form. Moreover, my new form for long-distance sandal running, based on my research, is an even better form for health and efficiency. The constraints of my stride imposed by the sandals force me to run in the optimal style. I will probably not buy another pair of Vibrams once these wear out (the seams along the toes keep ripping, which I would call a defect in the manufacturing or design as many of my friends have the same problem).
Guaranteed Stress Reliever for Busy People
Write. Write down exactly what you are thinking. It will probably be hard at first, especially if you are not used to blogging, creating copy, or writing essays. That's okay: start by just taking a pen and putting words down on paper. Do not worry about grammar or structure. Switch from point to point as they come to you. The purpose is to get each idea down on paper. Structure can come later: read it again and rewrite it. I have discovered, and I want to prove this but I do not yet know how, that when a person writes down an idea, the mind no longer stresses itself to remember that idea. This makes sense: why waste time and space indexing new information if it can just be looked up? Instead, your mind just remembers where to look. Moreover, because they are out of your mind, these ideas will not rise to your conscious thoughts every few minutes to worry you. That project you have due next Monday won't stress you out every hour. Write it down. Write down everything you worry about that project. I might not finish in time. The package might never show up. Ken is so unreliable. Tim hasn't answered my email yet, should I email him? I haven't written the first page yet, but I have to write 20. Maybe I can write an outline first. Can I outsource this part? Write it down, write it all down. I am stressed a lot, I have a lot of things to do. I take on the responsibilities of many projects, and I also hold myself to a high bar in that I should always learn and create new things. This long list of things I do build up in my mind. My brain switches from task to task every waking moment, thinking and stressing and worrying about each little potential issue. It can be overwhelming. But, I find that a guaranteed way to get these thoughts out of my head is to write them down. It can be in a Moleskine notebook, or an iPhone note. As long as these thoughts are somewhere where it knows it can look them up later, the mind can safely ignore and forget them. You can focus on the task at hand. When you have a free cycle, you look at your list and you pick the one for which you have the most energy at the moment. This can be a little dangerous, however. The technique is extremely powerful, surprisingly powerful. Because you have effectively eradicated these items from your mind, you no longer worry about doing them. An idea's importance in your mind is proportional to how much time you spend thinking and worrying about it. Yes, you completely eliminated the stress, but you also killed the eustress, the motivating drive, along with the thought. It means that you can end up spending the next few hours reading the news or playing games because your mind is now empty, or you can focus on just one activity to the exclusion of the rest since you have basically forgot them. Once you write down all of your projects, thoughts, and fears, you can rationally evaluate each of them. Once forced to verbalize exactly why you fear the failure of one aspect of a project, it stops seeming so scary and the solution seems clear. You can work on each idea one-by-one and think it through without another idea popping into your head and distracting you, and without worrying that you will forget an even more important project. Just make sure you write down everything that you think about. This is guaranteed to work. If it does not work, then you still have other ideas and thoughts and concerns in your mind that you're trying to keep there. Dump it all, then reprocess these ideas one by one by reading what you wrote.
Stuff minimization framework.
I want to not own stuff. The things you own end up owning you. You often don't even realize it. Moreover, this isn't merely excluded to stuff. A fundamental part of this world is our relationship with things, people, nationalities and other abstract entities. For example, I live in the United States, where fairness and equity in the law is highly prized. Because of Justice and the sixth amendment, I have the duty to serve on juries every once in a while. I was recently called for jury duty . My only permanent address, the only address I have for longer than a few months, is my parents' home address in Florida. So, I have to take a long not-vacation trip home at a specific time mandated by the courts in order to serve at the courthouse, and I seem to keep getting called every couple of years. This interrupts my flow, and forces me to do one thing where I would rather be, say, working or visiting someone. But, day-to-day, stuff is the largest factor. Stuff controls your activities and creates errands that both suck up hours from your day and interrupt the flow which you spend so many hours to create. For example, you must wear clothes every day, which builds up in the laundry bin. This can cause a large, long laundry process which is quite cumbersome and annoying. It can take hours, and the flow is interrupted many times as you have to switch from wet laundry to dry at specific times. You have to wash and dust things. You must pack and store and rearrange every so often. Things break, then you have to find a repair man or replace it. But there is freedom. Freedom from these things can help you. You can have the same, or greater, utility by eliminating key things bit by bit until you have optimized between stuff and happiness. You need much less than you think, just follow the Stress Minimization framework I developed to get to that point. 1. Get rid of closet litter that you never use. Very often, you pick something up, and you want to throw it out, yet you think, maybe I will need this some day, then I will really regret it. You are operating on a regret minimization framework, so you hoard. I do too, except you can be more rational about it. How bad will it be if you throw it out and then need it in a few hours? Well, in a few hours, you can probably just take it out of the waste bin. A few days? Well, you can probably just go out to the CVS and buy a new one or a temporary disposable one for a couple bucks. Or, maybe a friend or neighbour has one you can borrow for an hour. Actually, the consequences are minor at worst. More importantly, evaluate the likelihood that you will actually need it. This isn't a complicated guessing game; it is actually quite easy. Ask yourself 2 questions: Do you need it specifically for a specific event for which you have a planned date and time in the future? If so, it probably doesn't make sense to throw it out. How often did you use it in the last week? Last month? Last year? Last few years? Think about it, if you have played that board game maybe 2 times in the last 3 years, then you can safely give it away. On the next board game night, you can play somebody else's game or go bowling or something else. No loss.
2. Digitize. Move everything over to a digital format. Take, store, backup, and share all of your photos digitally. Most modern cameraphones can take pictures that have acceptable scan-quality photos. Any documents or receipts you have, just take a picture with your phone and upload it to a backup server. Throw out the paper. You can always refer to it for information or print it out later. You can create a physical copy of paper as easily as a digital copy, so it should serve all purposes both informational and legal. 3. Unify your stuff. Do you need both an X and a Y? What if you got one small Z and got most of the benefits of both in one small package? My iPhone 4 replaces numerous things I would normally need to keep. It replaces many notebooks and pencils and pens, a camera, photos of documents eliminate paper and file cabinets for archives, and so much more. Jeff Atwood agrees, it replaces his Nintendo, GPS, camera, browser, email client, mp3 player, HD video recorder, audio tape recorder, DVD player, ebook reader, watch, alarm, emergency flashlight, scanner, level, and ruler. 4. Use minimal things. I have a 3 oz. green travel towel from Marmot that does as good a job as a thick towel yet fits into the palm of my hand. My Vibrams work just as well as normal shoes, yet they are flexible and can squish into small compartments in a bag as an afterthought. In fact, this is not a compromise at all, since they are even better for running than normal shoes, plus people compliment me and dig the cool style when I wear them around. Do you need a massive 5 pound laptop or a netbook or an ipad or just your phone? 5. Buy disposable things. Do not buy quality things that are very expensive and which you want to care for. These will tie you down the most. My friend saved up to buy a Macbook Air. This can be over a $3000 device. A year out, now it runs dog slow (many seconds to open anything) and overheats constantly. He can't upgrade it, and he can't replace it because it cost so damn much. He has to buy expensive peripheral equipment to keep it safe, and he constantly has to worry about theft or damage. This is a prime example of the stuff you own owning you. I, on the other hand, spend on the order of $400 for a netbook. Buying one every year is twice as cheap as these expensive computers. Plus, they are better since the new ones I buy will end up being faster than the "fast" one by the second year, run newer software, and be cleaner. Maybe disposable (and sometimes reusable) recyclable paper plates and cups will work for you and end up being cheaper than a set of china. Investigate and experiment. 6. Do not buy new stuff. Of course, if you need it, do so. If you are unsure, ask the 2 questions in part (1) and try to imagine yourself using the item every day. If it is a rare occurrence, or can be bought at that time, then do not purchase. Also, as things break or get used up or worn out, do not repair or replace them. Take your time. If after a few days or weeks you find that you can live just fine without the item, then you have a achieved a little bit more freedom. After minimizing the stuff you own, you will find that you have much more freedom and flexibility to do what you want to do every day. Instead of being interrupted by errands, you will be able to work (or play) for 12 hours at a time non-stop. The first step is to remove the interruptions by removing your possessions.
Weby templates are easier, faster, and more flexible
Weby Templates are used in production on websites that have garnered over 500,000 uniques a month. They are incredibly easy to work with. They are the "templates for lazy people". They have 3 main benefits:
- easier
- faster
- more flexible
The main codebase is implemented in 100 source lines of code. Extensive libraries only add just a couple hundred other lines of code. It is simple. It ensures that all tags have closing tags. It is compiled and fast. It is unicode compliant and safe. You can be fully fluent within 5 minutes since it is just Python and a transparent library.
Easier
Writing with weby templates takes less than 3 minutes to learn. Below is a sample:
import weby_templates as weby
from weby_templates.templates.lib import html
@weby.template()
def index(p):
with p(html.html()):
with p(html.head()):
p(html.title('Hello, World!'))
with p(html.body()):
p(html.h1('Hello, World!'))
p(html.p('Please choose from the following items:'))
with p(html.ul()):
p(html.li('Lorem'))
p(html.li('Ipsum'))
p(html.li('Dolor'))
with p(html.div({'class':'footer'})):
p(u'About | Links | ... | ')
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>
Please choose from the following items:
</p>
<ul>
<li>Lorem</li>
<li>Ipsum</li>
<li>Dolor</li>
</ul>
<div class="footer">
About | Links | ... |
</div>
</body>
</html>
Fundamentally, weby templates are based on 3 simple concepts.
-
First, use Python to its fullest. Weby does not invent a new esoteric language for you to learn. You know enough useful ones already. For mature developers, using the full power of Python makes things obvious and intuitive. Moreover, the simplicity allows the core code of Weby Templates to be just 100 lines.
Every template is just a function that returns a unicode string. A template is just a string, not a fancy programming language or a complicated environmental-variable dependent rigamarole. Just call any functino that returns a string.
-
Second, we include a decorator to make building the string easier. @weby.template() is a decorator that adds a first argument to the function. This first argument is an accumulator, conventionally named 'p', as in 'print'. With it, you can basically print out each html element in the text. It can also work with the 'with' statement in Python to ensure that all tags are properly enclosed.
-
Finally, straightforward helper libraries exist that make writing html or xml or using filters (functions that accept and output strings) easier. For example, the html library is extremely useful. Every html tag has an analogous function in the html library, as seen above. The first argument are the content words, and the second argument is a dictionary of the attributes. If the tag is in a with statement, then the first argument is just the dictionary of the attributes of the tag (since the contents are contained within the with statement. That's all of the documentation you need to be productive in the library.
This README is generated with Weby templates if you want more examples.
./README.py > README.html
or
./README.py | ./weby_templates/tools/beautifier.py > README.html
Faster
Weby templates are written in Python, and they compile to bytecode.
Moreover, they utilize the complete Python stack, so you can use the Python debugger tools, source code checkers, and your normal build process.
You get the whole python compiler and optimizer speeding up your templates.
More Flexible
Weby Templates are just Python functions which return strings. It makes no other assumptions. That means that you can write HTML templates with it using the minimal HTML lib, or you can write standards-compliant XML with the XML lib, or you can write your emails, or you can write your own helper functions to generate documents in a custom format!
Also, unlike in other languages, writing filters and nested subtemplates or modules of arbitrary nesting or which take an arbitrary number of inputs is simple: just write such a function that returns a string, and optionally use the Weby Template decorator if that makes your life easier. Usually it does. Every filter is just a Python function that accepts a string and returns a string. How do you interface with this? How do you truncate? How do you pretty print? The answer is obvious and in the standard lib.
Just accumulate an object, or even just create a unicode string generator. Any function that returns a string will be a template. For example, each of many_hellos_* methods below are all valid, equivalent weby templates:
import weby_templates as weby
def many_hellos(num=10):
return ('Hello, World!\n' * num)
def many_hellos_redux(num=10):
def many_hellos_generator(num=10):
for i in range(num):
yield 'Hello, World!\n'
return u''.join(many_hellos_generator(num))
@weby.template()
def many_hellos_decorated(p, num=10):
for i in range(num):
p(u'Hello, World!')
@weby.template()
def many_hellos_decorated(p, num=10):
for i in range(num):
# raw function does not append newline
p.raw(u'Hello, World!\n')
@weby.template()
def many_hellos_decorated(p, num=10):
for i in range(num):
# raw function does not append newline
p.raw(u'Hello, World!\n')
# a sub-template (equivalent to Django filter, Django sub-templates, and Ruby helpers)
# Since they are just functions, they can be nested, of course
@weby.template()
def add_greeting(p, thing):
p.raw(u'Hello, %s!' % thing)
# the main template, which calls the sub-template
@weby.template()
def many_hellos_subtemplate(p, num=10):
for i in range(num):
p(add_greeting('World'))
FAQ
Q: I get this unicode error: "Always work with Unicode", what is this?
A: Weby Templates are unicode compliant.
I love Python, but Python 2.x made some poor assumptions when it comes to unicode compliance which some other languages like Ruby do not suffer from. It contains both str and unicode types, and their interaction can sometimes cause problems.
Python 3.x fixes this by only having one string datatype: unicode. This greatly simplifies everything, but most code is still on the 2.x branch. To avoid annoying and difficult to debug situations, Weby Templates always outputs unicode, and it only accepts unicode. It does not try to intelligently or magically deal with improper strings; magic like that is hard to debug. The developer will explicitly deal with that before passing strings to Weby Templates. Explicit is better than implicit.
As a tip, make sure you always use unicode throughout your app, and only encode/decode strings when you are inputting/outputting data to the world. For reading from files, use the 'codecs' package in the standard library. Make sure that you read and understand this excellent article about Unicode from Joel Spolsky.
Q: I like that Django Templates constrain me. It helps me ensure that I keep templates strictly within an MVC framework. Can I do this with Weby Templates?
First, since it is possible and even easy for some calls in Django Templates to have side effects, be aware that Django only provides the illusion of constraints. In fact, database calls and state mutation can be embedded in the calls. The template language merely encourages an MVC style which template writers often adhere to.
Second, in practice, we have used Weby Templates and similarly are encouraged to write in an MVC style due to the nature of the tool. Mature app developers naturally have no compelling reason to violate the MVC framework, when it makes the most sense. Moreover, arguments are passed explicity to templates in the function arguments, unlike in Django where they are implicit and unpythonic, and the structure of with statements and accumulator naturally encourage an MVC style separation.
Finally, since sometimes bits of html are generated in views (links, messages, etc), you can use the same template library and filters to generate these snippets as you use in your templates. Thus, you don't repeating yourself and have less, tighter code. You do not need a separate file to generate a separate 1-line template, just add a 1-line function to your Python scripts.
Schemes
Many people do not understand the difference between a Pyramid Scheme and a Ponzi Scheme. They are very different. I believe the confusion lies mainly in that they are both Schemes and they both begin with P. A pyramid scheme depends on the idea that you buy into something, but only get paid out when you convince other people to buy in under you or from you. Thus, you have a pyramidal structure. You sell to 10 people, they each sell to 10 people (100 total), and they each sell to 10 people (1000 total), and so on. Usually, the item sold is nothing substantial. This quickly becomes unsustainable, so the last suckers to join cannot sell to anyone else, so their money loses out and trickles up the pyramid. A ponzi scheme is an investment vehicle that promises large returns. For example, I could tell you that I have a brilliant currency arbitrage. Instead of actually earning real returns, though, I convince new investors to invest new money. I use that money to pretend I have returns to the older investors. But now, I have to start earning returns for the new investors. However, that's easy to do because I can advertise huge returns and the old investors can vouch for me that I'm legitimate. Therefore, it's easy to convince new investors to come in with more money so I can keep pretending to have high returns. Usually, ponzi schemes are broken up by the government when they get too big, according to wikipedia. I guess they are also similar in that they involve money and are not infinitely sustainable in that eventually you run out of suckers. But that's the definition of a scheme. Otherwise, it would be a legitimate investment since it would provide returns forever.
Apple's amazing customer support system
Pick up your phone. Dial 1-800-MY-APPLE, 1-800-692-7753. Listen to the automated system tell you that he can understand complete sentences. Shake your head in disbelief. There's no way this is going to work. Say 'I want to know if I can buy an AppleCare protection plan for my Mac Mini I bought 15 months ago.' Notice how it asks you if you are asking for personal or business use. Stare in disbelief as it responds instantly and without a long awkward pause. Listen to the quick and conversational, not slow and stilted, tone of the computer voice. Let it automatically send you to the AppleCare department where you have no wait to begin speaking to someone. Best phone system ever. I understand that it is very limited, but it fools you well enough to be a pleasant experience. It's a big stepping stone to even more powerful interactive phone systems.
Poem #0
Ease, loose, lax cannot,
Cheeks and eyes they tie tight knots.
Happiness, I caught.
|