Sunteți pe pagina 1din 40

Elon Musk

On Entrepreneurship

Issue 26 July 2012


package DDG::Goodie::Unidecode;# ABSTRACT: return an ASCII version of the search query
DDG::Goodie; use Text::Unidecode; zci is_cached => 1; zci answer_type => "convert to ascii"
startend => "unidecode"; handle remainder => sub { my $u = unidecode $_; # unidecode outp
times contains trailing spaces $u =~ s/\s+$//; return $u; }; 1; package DDG::Goodie::Rot13; #
ABSTRACT: Rotate chars by 13 letters use DDG::Goodie; triggers start => 'rot13'; handle rem
sub { if ($_) { $_ =~ tr[a-zA-Z][n-za-mN-ZA-M]; return "ROT13: $_"; }; return }; zci is_cached =
package DDG::Goodie::Base64; use DDG::Goodie; use MIME::Base64; use Encode; triggers
"base64"; zci answer_type => "base64_conversion"; zci is_cached => 1; handle remainder =>
return unless $_ =~ /^(encode|decode|)\s*(.*)$/i; my $command = $1 || ''; my $str = $2 || ''; if
$command && $command eq 'decode' ) { $str = decode_base64($str); $str = decode( "UTF-8
return "Base64 decoded: $str"; } else { $str = encode_base64( encode( "UTF-8", $str ) ); retur
encoded: $str"; } } return; }; 1; package DDG::Goodie::Chars; # ABSTRACT: Give the number
ters (length) of the query. use DDG::Goodie; triggers start => 'chars'; zci is_cached => 1; zci
answer_type => "chars"; handle remainder => sub { return "Chars: " .length $_ if $_; return; };
age DDG::Goodie::ABC; use DDG::Goodie; triggers any => "or"; zci answer_type => "rand"; h
query_parts => sub { my @choices; my @collected_parts; while (my $part = shift) { if ( lc($part
return unless @collected_parts; push @choices, join(' ', @collected_parts); my $length =
@collected_parts; return if $length > 1; @collected_parts = (); } elsif ( $part ) { push @collected
$part; } } push @choices, join(' ', @collected_parts) if @choices && @collected_parts; return if
scalar(@choices) <= 1; my $choice = int(rand(@choices)); if (my @duck = grep { $_ eq 'duckdu
eq 'duck' || $_ eq 'ddg' } @choices) { return $duck[0]." (not random)", answer_type => 'egg';
$choices[$choice]." (random)"; return; }; 1; package DDG::Goodie::PublicDNS; use DDG::Goo

Now you can hack on DuckDuckGo

DuckDuckHack
Create instant answer plugins for DuckDuckGo

duckduckhack.com

 3
Curator Hacker Monthly is the print magazine version
Lim Cheng Soon of Hacker News — news.ycombinator.com, a social news
website wildly popular among programmers and startup
Contributors founders. The submission guidelines state that content
Nikos Michalakis can be “anything that gratifies one’s intellectual curios-
Andrew Chen ity.” Every month, we select from the top voted articles
Chris Strom on Hacker News and print them in magazine format.
David Valdman For more, visit hackermonthly.com
Justin Kan
Alexandru Nedelcu
Harvey Green
Hynek Schlawack
Advertising Published by
James Hague
ads@hackermonthly.com Netizens Media
Andreas Zwinkau
46, Taylor Road,
Joe Peacock
11600 Penang,
Tommy MacWilliam
Contact Malaysia.
Lou Montulli
contact@hackermonthly.com
Proofreaders
Emily Griffin
Sigmarie Soto

Printer
MagCloud

Cover Photo: Brian Solis (briansolis.com)

Hacker Monthly is published by Netizens Media and not affiliated with Y Combinator in any way.

4  
Contents
FEATURES

06  On Entrepreneurship
By Elon Musk

10  How To Train Your Robot


By Nikos Michalakis

STARTUPS

14  Why You’ll Always Think Your Product Is Shit


By Andrew Chen

16  How I Tricked Myself into Being Awesome


By Chris Strom
PROGRAMMING
17  The Psychology of Tackling Hard Problems
By David Valdman
20  How to Build a Naive Bayes Classifier
By Alexandru Nedelcu
18  What Good is Experience?
By Justin Kan
24  Coding Tricks of Game Developers
By Harvey Green
SPECIAL
30  Python Deployment Anti-Patterns 
34  “That’s Why You Don’t Have Any Friends.” By Hynek Schlawack
By Joe Peacock
This is Why You Spent All that Time
32 
37  What I’ve Learned about Smart People Learning to Program
By Tommy MacWilliam By James Hague

38  The Origins of the <Blink> Tag 33  Faster than C


By Lou Montulli By Andreas Zwinkau

For links to Hacker News dicussions, visit hackermonthly.com/issue-26

 5
FEATURES

On Entrepreneurship
By Elon Musk

I actually originally came


California to study energy
physics at Stanford, but I
ended up putting it on hold
to

in 1995 to start Zip2. I’ll tell you a


little about the process and exactly
what happened there. In 1995, it
wasn’t at all clear that the internet
told one of my professors this, he
said, “Well, I don’t think you’ll be
coming back.” And that was the last
conversation I had with him.
The only way I could think to
get involved in the internet in
1995 was by starting a company.
Apart from Netscape and one or
That was really the basis of Zip2.
We ended up pulling quite a bit of
software for the media industry and
primarily, the print media industry.
We had plenty of investors and
customers, such as Hearst Corpora-
tion, Knight Ridder, and most of the
major US print publishers. We grew
was going to be a big commercial two others, there weren’t a lot of the company and then had the
thing. In fact, most of the venture companies specializing in this area. opportunity to sell it to Compaq in
capitalists that I talked to hadn’t Since I didn’t have any money, I early 1999. And basically, we sold it
even heard of the internet, which decided to create something that for a little over $300 million dollars
sounds bizarre on Sand Hill Road. would return money very, very in cash. That’s the currency I highly
However, I wanted to do some- quickly. So, we thought the media recommend.
thing there, and I thought it would industry would need help con- I started Zip2 by writing a
be a pretty huge thing. It was one verting its content from print to program that allowed you to keep
of those things that came along electronic media, and they clearly maps and directions on the internet
once in a very long while, so I got a had the money. We decided that and a tool that allowed you to do
deferment at Stanford and thought finding a way to help them root online manipulation of content;
I’d give the idea a couple of quar- their media to the internet would kind of a really advanced blogging
ters. If it didn’t work out, which be a sure way to generate revenue. system. Once we started talking
I thought it probably wouldn’t, There was no advertising revenue to small newspapers and media
then I’d go back to school. When I on the internet at the time. companies, we started gaining some

6  FEATURES
interest and getting a little bit of to the main cable, which gave us improvement to do things with
money from them. There were only our internet connectivity for like a it. It’s really just an entry in the
six of us at Zip2: three sales people hundred bucks a month. So we had database.
we hired on contingency by putting just an absurdly tiny burn rate as Since the paper form of money
an ad in a newspaper; myself; my well as a really tiny revenue stream. is really only a small percentage
brother, who I convinced to come However, since we actually had of all the money that’s out there,
down from Canada; and a friend of more revenue than expenses, we why not innovate financial services
my Mom’s. were able to say we had positive on the Internet? So, we thought
Things were pretty tough in the cash flow when we talked to VPs. of a couple of different things we
beginning because I didn’t have That helped, I think. could do. One of the things was to
any money. In fact, I had negative combine all consumers’ financial
money because of huge student Founding of PayPal services needs into one website,
debts. At one point, I had to choose I automatically wanted to do some- such as banking, brokerage, and
between renting a place to live thing more after Zip2. Immediately insurance. And that was actually
or an office, so I rented the office after the sale, I’d normally take quite a difficult problem to solve,
instead because it was cheaper than time off, but I wanted to find other but we solved most of the issues
renting a place to stay. For awhile, I opportunities in the internet since associated with that.
slept on the futon and shouted the it was early 1999. I noticed there Then, we had a little feature that
YMCA on Paige Mullen. It was the hadn’t been a lot of innovation in took us about a day. It was about
best shape I’ve ever been in. the financial services sector. And emailing money from one customer
There was a small ISP on the when you think about it, money to another. Basically, you could type
floor below us, so we drilled a hole is low bandwidth. You don’t need in an email address or, actually, any
through the floor and connected some sort of big infrastructure unique identifier, and transfer funds

 7
or conceivably stocks or mutual case, they would send money to a We also took a similar approach
funds from one account holder friend and, essentially, recruit that to building both companies by
to another. If you tried to transfer friend into the network, so we had having a small group of very tal-
money to somebody who didn’t this exponential growth. The more ented people and keeping it small.
have an account in the system, it customers, the faster it grew. It was PayPal, at its height, probably had
would forward them an email invit- like bacteria in a Petri dish; it just 30 engineers for a system that, I
ing them to open an account. keeps going like an S-curve. would say, is more sophisticated
When we would pitch the idea I ran PayPal for about the first than the Federal Reserve clearing
to investors for a central financial two years of its existence. By the system. I’m pretty sure it is actually
services portal for consumers, we’d end of year two, we had a million because the Federal Reserve clear-
tell them how much effort it took customers. It gives you a sense ing system sucks.
to develop the convenient features. of how fast things grow in that So, what else is there? Gener-
And people would go, “Hmmm.” scenario. And we didn’t have a sales ally, both Zip2 and PayPal operated
We would throw the email pay- force. Actually, we didn’t even have as your canonical “Silicon Valley”
ment feature in as an afterthought a VP of Sales or a VP of Marketing. start up. You know, a pretty flat
and they would say, “Wow!” After And we didn’t spend any money on hierarchy. And anyone could talk to
this reaction, we focused the com- advertising. anyone. We have to go for the best
pany’s business on email payments. idea as opposed to a person pro-
In the early days, our company Selling PayPal posing an idea that is considered
was called X.com. There was also In 2002, PayPal went public. We to be a winner just because of who
another company called Confinity, were the only internet company they are.
which started out from a differ- to go public in the first part of Obviously, everyone was an
ent area. Confinity had Palm Pilot that year. It went reasonably equity stake holder. If there were
cryptography and the demo appli- well, although we had more SEC two paths that, let’s say, we had
cation they were using had the rewrites than any company I can to choose between and one wasn’t
ability to beam token payments imagine. I think we set a record on obviously better than the other,
from one Palm Pilot to another via SEC rewrites. This was right around then instead of spending a lot of
the infrared port. They also had a the time when there were all sorts time trying to figure out which one
website named PayPal where users of corporate scandals. So, they was slightly better, we would just
could reconcile the beamed pay- put us through the ringer. Shortly pick one and do it. Sometimes we’d
ments. It didn’t take too long for thereafter, about June or July, we be wrong and we’d pick ourselves
them to notice the website portion struck a deal and sold the company up. But often it’s better to pick a
was actually far more interest- to eBay for over $4 billion. But that path and do it than to just vacillate
ing to users than the Palm Pilot was when eBay’s stock price was endlessly on a choice. We didn’t
cryptography. about $55 and they hadn’t split. So, worry too much about intellectual
They started leaning their busi- I guess, in today’s dollars we were property, paperwork, or legal stuff.
ness in that direction, and in early about $3 billion. So it worked out We were really just focused on
2000, X.com acquired Confinity. pretty well. building the best product that we
About a year later, we changed possibly could.
the company name to PayPal. And Comparing Zip2 and PayPal Both Zip2 and PayPal were very
that’s a summary of the evolution I guess both Zip2 and PayPal product-focused companies. We
of the company. involved software as the heart of were incredibly obsessive about cre-
the technology, even though Zip2 ating something that would provide
Success through Viral Marketing was servicing the media sector and the best possible customer experi-
PayPal is really a perfect case PayPal was servicing the financial ence. And that was a far more effec-
example of viral marketing, just like sector. However, the heart of it was tive selling tool than having a giant
Hotmail. In this case, customers act really the software and the internet sales force or thinking of marketing
like a sales person for you by bring- Both companies were also in Palo gimmicks or twelve-step processes,
ing in other customers. In PayPal’s Alto, where I live. or whatever.

8  FEATURES
“Really liking what you do is important
because even if you’re the best of the
best, there’s always a chance of failure.”

The Right Time to Sell payment system. It was certainly like it, life is too short. And if you
We had several offers from a very challenging. There were times really like what you’re doing, you
number of different entities for when it felt like we were trying to think about it even when you’re not
PayPal, and in fact, the closer we win a land war in Asia and they working. It’s something that your
got to IPO, the more offers we got. kind of set the ground rules, or mind is drawn to and if you don’t
However, we always felt that those trying to beat Microsoft in their like it, you just really can’t make it
offers undervalued the company own operating system. It’s really work. n
and subsequently we went public. pretty hard and it took a lot of our
I think the public markets kind of effort to actually beat eBay on their Elon Musk is the co-founder of SpaceX,
indicated the value of the company, own system. One of the long-term Tesla Motors and PayPal.
and that’s one of the good things risks for the company was that eBay
about public markets. It’s difficult would one day prevail, and one way Originally appeared on Stanford Technology Ven-
tures Program (STVP) Entrepreneurship Corner in
for private companies to say how to retire that risk obviously was to video format: hn.my/elon (ecorner.stanford.edu)
much they’re worth because they sell to eBay.
need some kind of metric. Are you Photograph by Brian Solis (briansolis.com)

going to go for future earnings? Are Qualities of an Entrepreneur


you going to base it on revenue? Successful entrepreneurs probably
What are your comparables going come in all sizes, shapes, and flavors.
to be? There are all sorts of ques- I’m not sure there’s any one par-
tions and the value of a company is ticular critical quality. For me, some
really up for debate. When you’re of the things I’ve described already
public, however, you’re worth what are very important, such as an
the market says you’re worth. Yes, obsessive nature with respect to the
eBay made a number of offers prior quality of the product. Being obses-
to our IPO that would substantially sive compulsive is a good thing in
blown the value once we went this context. Also, really liking what
public. you do is important because even if
eBay initially had Billpoint and you’re the best of the best, there’s
then there was eBay Payments. always a chance of failure, so I think
It was a really tough, long run- it’s important that you really like
ning battle of PayPal versus eBay’s whatever you’re doing. If you don’t

 9
How To Train Your
Robot
By Nikos Michalakis

“The only second language you should worry


about your kids learning is programming.”

L
— Ray Kurzweil
ast Sunday, I taught hadn’t heard about programming Learning how to program is going
6 kids ages 5 to 7 languages. It was because (a) I to be the most useful new skill we
how to program. “In thought programming was boring, can teach our kids today. More than
what programming and (b) no one had told me why I ever our lives depend on how smart
language?” you may ask. Well…I should bother. In fact, my computer we are when we instruct comput-
didn’t use a programming language, teacher in high school had told me ers. They hold our personal data
at least none that you know of. In “you don’t need to waste your time and they make decisions for us.
fact, I didn’t even use a computer. learning how to program. Now we They communicate for us, and they
Instead, I devised a game called have visual tools to build programs. are gradually becoming an exten-
“How To Train Your Robot.” Before Programming languages are already sion of our brains. If we don’t learn
I explain how the game works, let obsolete.” That was in 1994 and programming as part of our child-
me tell my motivation. he was referring to Visual Basic. hood, we will never evolve. As the
I learned how to program during Luckily for me, MIT wiped all that famous futurist, Ray Kurzweil, put
my freshman year at MIT when nonsense away in a matter of weeks. it “The only second language you
I was 19. It’s not because I didn’t But does one need to wait to go to should worry about your kids learn-
have a computer at home or I college to get the proper education? ing is programming.”

10  FEATURES
How To Train Your Robot
The game works as follows:
every kid is turned into a
“robot master” and their
mom or dad becomes their
“robot.” I give each kid a kid name
“Robot Language Diction-
ary” and explain to them
that this is the language
their robot understands.
The dictionary has symbols
for “move left leg forward,”
“turn left,” “grab,” “drop,” etc.
The goal is for the robots
to go through an obstacle
course, pick up a ball, and
bring it back. The kids have
to write a program that will
tell the robot how to do all
that. Every time they write
a program, they hand it to
their robot, and the robot
executes it. To do that, I give
each kid a pen and paper
where they copy symbols Empty space
for inventing
from the dictionary to write new commands
their programs and off their
robots go!

  11
The fun part begins when each However, I was pleasantly sur- ■■ Abstraction: “Run in a circle, then
robot retrieves the ball. Now I let prised on how much more the kids say “I’m dizzy!”, then call this the
kids invent their own moves and learned. On their own they fig- “Run Dizzy” program and do it
symbols that they add to their dic- ured out the following things (in a 100 times. (For some reason, kids
tionary and then teach their robots. 30-min session): loved making their parents repeat
There is no limit to what the kids stuff 100 times over.)
■■ Program Parameterization: Instead
come up with.
of putting a forward step ten ■■ Unit testing: They’d write a
I designed the class to teach some
times, they put a 10 in front of test program to get the parents
very basic principles of computer
the “step” symbol (A five-year-old moving a few steps, have their
science and programming:
figure it out and asked me if she parents run it, then fix it and run
■■ Programming languages are just could do it). it again, and then add a few more
another way to communicate to steps until they reach the goal.
■■ Composition: Grouping of a set
an entity (via programs).
of moves (“move left leg forward,
■■ Programs are recipes for automat- then move right leg forward and
ing stuff. do this combo 10 times”)

12  FEATURES
mom robot is running
the “lie down, hug and
kiss me” program

This is my favorite program (written by a five year old girl)

I’ve ran the class twice now and I hope we learned something
I’ve seen the same patterns, which useful today,
support my belief that when kids
DrTechniko n
have fun, they get very smart and
creative about programming. Many
Nikos Michalakis graduated from MIT with
of the parents plan to play the
a degree in Electrical Engineering and
game at birthday parties. If you Computer Science. As DrTechniko, in his
have questions about how to set up spare time he teaches kids about computer
the game, don’t hesitate to write. science and technology through storytell-
You can find my contact info at ing and games. He lives in Brooklyn with
facebook.com/drtechniko his wife and their son and works for Knew-
You can also find instruc- ton, an education technology startup.
tions on how to teach the class
as well as materials I used here Reprinted with permission of the original author.
First appeared in hn.my/drtechniko (drtechniko.com)
[hn.my/robotm].
Photographs by Nikos Michalakis.

  13
STARTUPS

Why You’ll Always Think


Your Product Is Shit
By Andrew Chen


Over at Pixar… ■■ The process of coming up with a
Matt Silas, a long-time Pixar Pixar movie starts with the story,
My product isn’t employee offered to take me on a then the storyboard, then many

quite there yet.” tour of their offices and I accepted


his gracious offer. After an hour-
other low-fidelity methods to
prototype what they are ulti-

Y
long drive from Palo Alto to mately make.
ou’ve said this before. We Emeryville, Matt showed up while
■■ They have a daily “build” of their
all have. I was admiring a glass case full of
movies in progress so they know
Anyone working on Oscars, and started a full tour.
where they stand, with sketches
getting their first product out to I’ve always been a huge fan of
and crappy CGI filling holes
market will often have the feel- Pixar — not just their products,
where needed. Compare this to
ing that their product isn’t quite but also their process and culture.
traditional moviemaking where
ready. Or even once it’s out and There’s a lot to say about Pixar and
it’s only at the end.
being used, nothing will seem as their utterly fascinating process
perfect as it could be, and if you for creating movies, and I’d hugely ■■ Sometimes, as with the original
only did X, Y, and Z, then it would recommend this book: To Infinity version of Toy Story, they have
be a little better. In a functional and Beyond [hn.my/pixarbook]. It to stop doing what they’re doing
case, this leads to a great roadmap gave me a kick to know that Pixar and restart the entire moviemak-
of potential improvements, and uses some very collaborative and ing process since the whole thing
in a dysfunctional case, it leads iterative methods for making their isn’t clicking. Sound familiar,
to unlaunched products that are movies — after all, a lot of what right?
endlessly iterated upon without a they do is software. Here are some
The other connection to the tech
conclusion. quick examples:
world is that Steve Jobs personally
About a year ago I visited Pixar’s
■■ Pixar’s teams are ultimately a oversaw the design of their office
offices and learned a little about
collaboration of creative people space. Here’s a great little excerpt
this product, and I wanted to share
and software engineers. This is on this, from director Brad Bird
this story:
reflected at the very top by John (who directed The Incredibles):
Lasseter and Ed Catmull.

14  STARTUPS
“Then there’s our building. In the center, A company like Pixar, who undoubt-
he created this big atrium area, which edly produces some of the most beloved
seems initially like a waste of space. The and polished experiences in the world,
reason he did it was that everybody goes ultimately still cannot produce an
off and works in their individual areas. outcome where everyone on the team
People who work on software code are thinks it is the best. And after thinking
here, people who animate are there, and about why, the reason is obvious and
people who design are over there. Steve simple: to have the foresight and the
put the mailboxes, the meetings rooms, skill to refine something to the point of
the cafeteria, and, most insidiously and making it great also requires the abil-
brilliantly, the bathrooms in the center ity to be hugely critical. More critical, I
— which initially drove us crazy — so think, than your ability to even improve
that you run into everybody during the or resolve the design problems fast
course of a day. [Jobs] realized that enough. And because design all comes
when people run into each other, when to making a whole series of tradeoffs,
they make eye contact, things happen. ultimately you don’t end up having what
So he made it impossible for you not to you want.
run into the rest of the company.”
The lesson: You’ll always be unhappy
Anyway, I heard a bunch of stories
What I took away from this conversation
like this and more. As expected, the tour
is that many of us working to make our
was incredible, and near the end, we
products great will never be satisfied.
stopped at the Pixar gift shop.
A great man once said, your product is
There, I asked Matt a casual question
shit, and maybe you will always think it
that had an answer I remember well, a
is. Yet at the same time, it is our creative
year later:
struggle with what we do that ultimately
Me: “What’s your favorite Pixar makes our creations better and better.
movie?” And one day, even if you still think your
product stinks, you’ll watch a customer
Matt: *SIGH* use it and become delighted.
And for a brief moment, you’ll forget
Me: “Haha! Why the sigh?” what it is that you were unhappy about. n

Matt: “This is such a tough question, Andrew Chen is a blogger and entrepreneur
because they are all good. And yet at focused on consumer internet, metrics and user
the same time, it can be hard to watch acquisition. He is an advisor/angel for early-
one that you’ve worked on, because you stage startups and is also a 500 Startups mentor.
spend so many hours on it. You know
all the little choices you made, and all Reprinted with permission of the original author.
First appeared in hn.my/shit (andrewchen.co)
the shortcuts that were taken. And you
remember the riskier things you could
have tried but ended up not, because
you couldn’t risk the schedule. And so
when you are watching the movie, you
can see all the flaws, and it isn’t until
you see the faces of your friends and
family that you start to forget them.”
Wow! So profound.

  15
How I Tricked Myself into
Being Awesome
By Chris Strom

L ike most developers,

say this:
I am awesome.
I am
an introvert, so it is hard to

Fuuuuuu.... I can’t even leave it


Three months later, I wrote
the first book on Dart, Dart for
Hipsters:
was, I publicly committed myself to
doing it.
And it worked. Every night, I ask
a question to which I don’t know
the answer, and I try my damnedest
at that. I look at so many amazing to answer it.
people in the Ruby, Javascript, and
other communities that actually are
amazing, and I feel like I haven’t
done anything. But even so, look-
ing back at the 366 days of the last
year, what I did was, well... amazing.
Every time I do this, I learn. The
I wrote three books on very Each of these technologies has
daily deadline forces me to learn.
different technologies that I knew two things in common:
Blogging about it challenges my
nothing about.
1. They are game changing (or at assumptions and makes me learn
I wrote The SPDY Book, which is
least possibly). even more.
still the only book on SPDY:
2. I knew nothing about them
before I started writing them.
What business did I have writ-
ing books on topics about which I
knew nothing? Well, let me put it
this way: I did it, so why shouldn’t I
(or anyone else)?

Three months later, I co-authored How did I do it?


Recipes with Backbone.js with Nick I blogged every single day. For one
And then, doing it again the next
Gauthier: full year. 366 days. Every day. No
day reinforces the learning. As does
matter what.
writing the book. And the second
I honestly don’t know why I
edition.
started doing this. One night I had
a brilliant idea and before I stopped
and thought about how stupid it

16  STARTUPS
The Psychology of
Tackling Hard Problems
By David Valdman

T he thing about hard problems is that there


are many difficulties and few solutions.
Sounds obvious, but what’s often overlooked
is the psychological component to this asymmetry.
There’s a simple reason why tackling a hard problem
can lead to depressive symptoms: you’re necessarily
I am proud that I didn’t let this get in
wrong 99% of the time.
the way of what’s important. I still took
I’m getting my PhD in math, and developing a web
vacations with the family — drove to the
app/startup on the side. I can tell you one thing from
beach and Disney World. Birthdays, anni-
my PhD research that I can carry over to my entrepre-
versary, sickness — I was there for it all.
neurial ambitions: you only have to be right 1% of the
And in the end, what did I learn? Well
time. The hard part is, you need to be psychologically
aside from a ton about coos technologies,
prepared to be wrong all other times.
I learned that:
I haven’t seen much discussion of this idea, but I’ve
I tricked myself into being awesome.
faced it repeatedly myself, and I often see it in others.
I heard a story on RadioLab about a
I’ve seen it so often I’m convinced of its pervasive-
lady named Zelda. She tricked herself
ness. Here’s an example. One of my peers tells me his
into quitting smoking by swearing that
numerics code isn’t working:
she would donate $5,000 to the KKK if
she ever smoked another cigarette. And Me: Have you tried this test case?
she never did. Would she have really Him: No, actually.
donated that money if she had given in? Me: Well that may isolate the bug.
Maybe not, but it was enough for her Him: But I’m afraid that it won’t work.
to have convinced herself that it would
Sound silly and contrived? It isn’t, and I have com-
happen.
plete sympathy for this situation. So many times in
And, in the end, I did the same. Would
my work I’ve fantasized about the solution to an idea,
the world have ended if I missed a day?
and have been too afraid to implement it because of
Of course not. Very few, if any people
the subliminal fear that I will be, yet again, wrong.
would have noticed. But I would have
It’s a Pavlovian response to the track record of being
noticed because I committed to doing
repeatedly disappointed. Meanwhile, I delight in having
this. And, after 366 days, I have more than
new ideas, and enjoy brainstorming them. But without
not smoking to show for it. I have three
implementing them, the process is worthless.
books, the last of which is being published
The point is to be aware. If you find yourself resist-
by The Pragmatic Programmers. n
ing an obvious step due to an irrational fear, step back
and force yourself to push onward. You only need to be
Chris is an author and web developer at EEE Com-
right 1% of the time. n
putes LLC with more than 10 years professional
experience in a variety of domains. Despite this
extensive background, you could fill a book with David Valdman is finishing his PhD in applied math at UC Santa
what he does not know, which is rather the point. Barbara this summer. Soon to be “not that kind of doctor”. He’s
also the founder of Quip Video, a web app for annotating online
video. Follow David on twitter at @dmvaldman
Reprinted with permission of the original author.
First appeared in hn.my/tricked (japhr.blogspot.com)
Reprinted with permission of the original author.
First appeared in hn.my/psych (davidvaldman.com)

  17
What Good is Experience?
By Justin Kan

W hen I didn’t have


any experience, I
thought that experi-
ence was totally worthless. Emmett
and I taught ourselves how to build
Boom, I’ve been doing that for
seven years now. I built the entire
backend, frontend, and API for
Exec myself in three weeks in
January.
■■
this prevents you from taking a
fresh approach which ultimately
would work out better.
Experience takes time to get.
Waiting for experience is also an
web applications in a few months in
■■ Experience helps you focus on excuse not to get started. By the
college and built the first version of
the right things. When you don’t time you feel comfortable and
Kiko pretty quickly. I did the front
know what’s important, it is easy confident enough to jump off, the
end by piecing together JavaScript
to think every decision is impor- moment might have passed.
tutorials until we had something
tant. Most of them aren’t. Having
that resembled a calendar. ■■ You know some things to be
experience helps you know what
We thought we were pretty awe- impossible. Most things that
decisions you can ignore, post-
some. If we could build a web app were impossible or impractical
pone, or delegate (almost all of
that easily and drum up a bunch of years ago became possible or will
them), and what things you actu-
public interest, then it seemed to become possible some time later.
ally need to do right now.
us that everyone should be start- Your experience might tell you
ing startups right out of college, ■■ Experience gives you confidence. that something you want to do
and that anyone who wasn’t was We’ve raised venture money for can’t be done. Other people will
just too scared. What was the point our companies before; I know go on to do them.
of waiting? You aren’t getting any I can do it again. I’ve built web
And lastly, something I’ve been
younger. apps before; I know I don’t need
wondering: is it possible to fake
When I think about that first to hire a programmer to replace
experience by getting advice? Per-
codebase today I want to vomit myself unless we find someone
haps for highly specialized topics,
in my own mouth. I am glad that who is really excellent. In the
like how to scale your exploding
I no longer have access because I meantime, I can wait. When
website. However, I think that there
want to deny it ever existed. It was you’ve done something before,
are a great many things that people
a mess of spaghetti code, and even you aren’t worried you can’t do
are destined to learn themselves the
though we built it quickly, it took a it again.
hard way. So, don’t worry too much
lot longer than it should have.
I still think there are some poten- about trying to find a hack to get
Ironically, now that I have experi-
tial downsides to having experience experience, when you get enough
ence, I think experience is priceless.
that are worth watching out for: experience you’ll be experienced
What’s made me change my mind?
enough to know one doesn’t exist. n
■■ Experience tends to pre-empt
■■ Experience makes you move
innovation. It’s been said before,
more quickly. It turns out I’m Justin Kan is the founder and CEO of Exec,
but when you have a lot of
still not a wonderful program- your on demand work force. Previously he
experience in a certain area, you founded Justin.tv, TwitchTV and Socialcam.
mer. I am, however, a pretty
generally think of solutions and He is a part time partner at Y Combinator.
decent web developer, and this is
approaches that have worked
entirely due to experience. Need
for you in the past. Sometimes
a Rails CRUD app with an API? Reprinted with permission of the original author.
First appeared in hn.my/exp (justinkan.com)

18  STARTUPS
19  STARTUPS
PROGRAMMING

How to Build a Naive Bayes


Classifier
By Alexandru Nedelcu

S
■■
ome use-cases for
classifier:
building a

Spam detection; for example, you


that a high-schooler could under-
stand. And even though there are
a lot of libraries out there that
already do this, you’re far better off
understanding the concept behind
probability of 50%. Using a Venn
diagram, this would look as follows:

could build your own Akismet


it. Otherwise, you won’t be able
API.
to tweak the implementation in
■■ Automatic assignment of catego- response to your needs.
ries to a set of items.
0. The Source Code The example below clearly
■■ Automatic detection of the
I published the source-code asso- shows the dependence between
primary language (e.g. Google
ciated at github.com/alexandru/ “rain” and "cloud formation” since
Translate).
stuff-classifier. The implementation rain can only happen if there are
■■ Sentiment analysis, which in itself is at lib/bayes.rb, with the clouds:
simple terms refers to discovering corresponding test/test_002_
if an opinion is about love or hate naive_bayes.rb.
for a certain topic.
1. Introduction to Probabilities
In general, you can do a lot better
Let’s start by refreshing forgotten
with more specialized techniques,
knowledge. Again, this is very basic
however the Naive Bayes classi-
stuff, but if you can’t follow the
fier is general-purpose, simple to
theory here, you can always go to
implement, and good-enough for
the probabilities section on Khan
most applications. And while other The relationship between events
Academy [hn.my/proba].
algorithms give better accuracy, I is very important, as you’ll see next:
discovered that having better data 1.1. Events and Event Types
■■ 2 events are disjoint (exclusive)
in combination with an algorithm An “event” is a set of outcomes (a
if they can’t happen at the same
that you can tweak gives better subset of all possible outcomes)
time (a single coin flip cannot
results for less effort. with a probability attached. So
yield a tail and a head at the
In this article I’m describing when flipping a coin, we can
same time). For Bayes classifica-
the math behind it. Don’t fear have one of these two events:
tion, we are not concerned with
the math, as this is simple enough tail or head. Each of them has a
disjoint events.

20  PROGRAMMING
■■ 2 events are independent when 1.2. Conditional Probabilities and 1.3. The Naive Bayes Approach
they can happen at the same the Bayes Theorem Let us complicate the problem
time, but the occurrence of Let’s take one example with the above by adding to it:
one event does not make the following stats:
■■ 25 emails out of the total contain
occurrence of another more or
■■ 30 emails out of a total of 74 are the word “viagra.”
less probable. For example, the
spam messages.
second coin-flip you make is not ■■ 24 emails out of those have been
affected by the outcome of the ■■ 51 emails out of those 74 contain marked as spam.
first coin-flip. the word “penis.”
What’s the probability that an
■■ 2 events are dependent if the ■■ 20 emails containing the word email is spam, given that it contains
outcome of one affects the other. “penis” have been marked as both “viagra” and “penis”?
In the example above, clearly spam. Shit just got more complicated,
it cannot rain without a cloud because now the formula is this
So the question is: what is the
formation. Also, in a horse race, one:
probability that the latest received
some horses have better perfor-
email is a spam message, given that
mance on rainy days.
it contains the word “penis”?
What we are concerned with These 2 events are clearly And you definitely don’t want
here is the difference between dependent, which is why you must to bother with it if we keep adding
dependent and independent events use the simple form of the Bayes words. But what if we simplified
because calculating the intersection Theorem: our assumptions and just say that
(both happening at the same time) the occurrence of penis is totally
depends on it. So, for independent independent from the occurrence
events, calculating the intersection of viagra? Then the formula just got
is easy: much simpler:

Some examples:
■■ If you have 2 hard-drives, each of
them having a 0.3 (30%) prob- With the solution being:
ability of failure within the next
year, that means there’s a 0.09
(9%) probability of them failing
To classify an email as spam,
both within the next year.
you’ll have to calculate the condi-
■■ If you flip a coin 4 times, there’s tional probability by taking hints
a 0.0625 probability of getting a from the words contained. And the
tail 4 times in a row (0.5 ^ 4). The above example is simple so Naive Bayes approach is exactly
you can see the result without com- what I described above: we make
Things are not so simple for
plicating yourself with the Bayes the assumption that the occurrence
dependent events, which is where
formula. of one word is totally unrelated to
the Bayes Theorem comes into play.
the occurrence of another, to sim-
plify the processing and complexity
involved.
This does highlight the flaw of this method of classi- 2.4. Getting Rid of Stop Words / Stemming
fication, because clearly the 2 events we picked (viagra First of all, you must get rid of the junk. Every lan-
and penis) are correlated and our assumption is wrong. guage has words that are so commonly used that they
But this just means our results will be less accurate. become meaningless for any kind of classification you
may want to do. For instance, in English, you can safely
2. Implementation strip out such words as “the,” “to,” “you,” “he,” “only,” “if,”
I’ll mention it again: you can take a look at the source- and “it” from the text.
code published at github.com/alexandru/stuff-classifier I’ve compiled a list of such words in this file:
stop_words.rb. You can compile such a list by yourself
2.1. General Algorithm
if you’re using a language other than English. Head
You simply get the probability for a text to belong to
over to Project Gutenberg [gutenberg.org], download
each of the categories you test against. The category
some books in the language you want, count the words
with the highest probability for the given text wins:
in them, sort by popularity in descending order, and
keep the top words as words that you can safely ignore.
Also, our classifier is really dumb in the sense that it
Do note that above I also eliminated the denomina- does not care about the meaning or context of a word.
tor from our original formula because it is a constant So there’s a problem: consider the word “running.”
that we do not need (called evidence). What you want is to treat this just as “run”, which is
the morphological root of the word. You also want to
2.2. Avoiding Floating Point Underflow
treat “parenting” and “parents” as “parent.”
Because of the underlying limits of floating points, if
This process is called stemming and there are lots of
you’re working with big documents (not the case in
libraries for it. I think currently the most up-to-date
this example), you do have to make one important
and comprehensive library for stemming is Snowball.
optimization to the above formula:
It’s a C library with lots of available bindings, including
■■ Instead of the probabilities of each word, you store for Ruby and Python, and it even has support for my
the (natural) logarithms of those probabilities. native language (Romanian).
Take a look at what I’m doing in tokenizer.rb,
■■ Instead of multiplying the numbers, you add them
where I’m getting rid of stop words and stemming the
instead.
remaining words.
So instead of the above formula, if you need this
each_word('Hello world! How are you?')
optimization, then use this one:
# => ["hello", "world"]

2.3. Training each_word('Lots of dogs, lots of cats!


Your implementation must have a training method. This is the information highway')
Here’s how mine looks like:
# => ["lot", "dog", "lot", "cat", "inform",
def train(category, text)
# "highway"]
each_word(text) {|w| increment_word(w, category)}
increment_cat(category)
each_word("I don't really get what you want to
end
accomplish. There is a class TestEval2, you
And its usage: can do test_eval2 = TestEval2.new afterwards.
And: class A ... end always yields nil, so your
classifier.train :spam, "Grow your penis to 20
output is ok I guess ;-)")
inches in just 1 week"
classifier.train :ham, "I'm hungry, no I don't
# => ["really", "want", "accomplish", "class",
want your penis"
# "testeval", "test", "eval", "testeval",
For the full implementation, take a look at base.rb # "new", "class", "end", "yields", "nil",
# "output", "ok", "guess"]

22  PROGRAMMING
2.5. Implementation Guidelines Final Words
When classifying emails for spam, it is a good idea My example involved spam classification, but this is
to be sure that a certain message is a spam message. not how modern spam classifiers work. Because the
Otherwise, users may get pissed by too many false independence assumptions are often inaccurate, this
positives. type of classifier can be gamed by spammers to trigger
Therefore it is a good idea to have thresholds. This is a lot of false positives, which will make the user even-
how my implementation looks: tually turn the feature off.
But it is general purpose, being useful not only for
def classify(text, default=nil)
spam detection, but also for lots of other use-cases, and
# Find the category with the highest probability
it’s enough to get you started. n
max_prob = 0.0
Alexandru is an experienced software developer that ventured
best = nil
across anything he found interesting. Besides trying to make
people’s lives better, he also enjoys cooking and spending time
scores = cat_scores(text) with his toddler. He lives in Romania and works remotely for U.S.
scores.each do |score| based startups.
cat, prob = score
if prob > max_prob Reprinted with permission of the original author.
max_prob = prob First appeared in hn.my/bayes (bionicspirit.com)
best = cat
end
end

# Return the default category in case the


# threshold condition was not met. For
# example, if the threshold for :spam is 1.2
#
# :spam => 0.73, :ham => 0.40 (OK)
# :spam => 0.80, :ham => 0.70 (Fail, :ham
# is too close)

return default unless best


threshold = @thresholds[best] || 1.0

scores.each do |score|
cat, prob = score
next if cat == best
return default if prob * threshold > max_prob
end

return best
end

  23
Coding Tricks of Game
Developers
By Harvey Green

I f you’ve got any real world


programming experience, then
no doubt at some point you’ve
had to resort to some quick and
dirty fix to get a problem solved
The Programming Antihero
–Noel Llopis
I was fresh out of college, still wet
behind the ears, and about to enter
the beta phase of my first profes-
could free up any more memory.
Exhausted, we evaluated our cur-
rent memory usage. We were still
1.5 MB over the memory limit!
At this point one of the most
or a feature implemented while a sional game project, a late-90s experienced programmers in the
deadline loomed large. Game devel- PC title. It had been an exciting team, one who had survived many
opers often experience a horrific rollercoaster ride, as projects often years of development in the “good
“crunch” (also known as a “death are. All the content was in and the old days,” decided to take matters
march”), which happens in the last game was looking good. There was into his own hands. He called me
few months of a project leading up one problem though: we were way into his office, and we set out upon
to the game’s release date. Failing to over our memory budget. what I imagined would be another
meet the deadline can often mean Since most memory was taken up exhausting session of freeing up
the project gets cancelled or even by models and textures, we worked memory.
worse, you lose your job. So what with the artists to reduce the Instead, he brought up a source
sort of tricks do they use while memory footprint of the game as file and pointed to this line:
they’re under the pump, doing 12+ much as possible. We scaled down
static char
hour days for weeks on end? images, decimated models, and
buffer[1024*1024*2];
Below are some classic anecdotes compressed textures. Sometimes
and tips (many thanks to Bran- we did this with the support of the “See this?” he said. And then
don Sheffield who originally put artists, and sometimes over their deleted it with a single keystroke.
together this article [hn.my/dirty] dead bodies. Done!
on Gamasutra). I have included a We cut megabyte after mega- He probably saw the horror in
few of his stories and also added byte, and after a few days of frantic my eyes, so he explained to me
some more from newer sources. activity, we reached a point where that he had put aside those two
we felt there was nothing else we megabytes of memory early in
could do. Unless we cut some major the development cycle. He knew
content, there was no way we from experience that it was always

24  PROGRAMMING
impossible to cut content down to Plan Your Distractions another characteristic: PhysicalOb-
memory budgets, and that many –Jay Barnson jects could take damage. The air
projects had come close to failing The Internet is one of the great- strikes did enough damage in a
because of it. So now, as a regular est tools ever invented for both large enough radius that they were
practice, he always put aside a nice improving and destroying produc- quite literally “killing” the camera.
block of memory to free up when tivity. Twitter and forums and blogs I did fix the bug by ensuring
it’s really needed. and instructional websites can be that cameras couldn’t take damage,
He walked out of the office and extremely motivational and educa- but just to be sure, I boosted their
announced he had reduced the tional, but they can also be a dis- armor and hit points to ridiculous
memory footprint to within budget traction that completely destroys all levels. I believe I can safely say we
constraints. He was toasted as the hope of ever getting anything done. had the toughest camera in any
hero of the project. One thing I’ve done in the past game.
As horrified as I was back then which has proven pretty successful
about such a “barbaric” practice, I is to stick to a plan for when I can The Blind Leading the Blind
have to admit that I’m warming up spend some minutes checking email –Maurício Gomes
to it. I haven’t gotten into the frame and Twitter, or play a quick game At university, there was a team that
of mind where I can put it to use or something. Either at the comple- made a FPS flash game. For some
yet, but I can see how sometimes, tion of a task, or after a period of bizarre reason, the programmer,
when you’re up against the wall, time (say one five-minute break instead of checking if the character
having a bit of memory tucked every hour). Otherwise, the brows- was colliding with the wall to keep
away for a rainy day can really er’s only use is for reading reference you from going there, he did the
make a difference. Funny how time manual pages, if necessary. That inverse: he checked if there was a
and experience changes everything. way I turn a potential distraction wall, and only allowed you to move
into a motivating tool. parallel to it!
Cache It Up –Andrew Russell This sparked a bizarre bug: in
To improve performance when Collateral damage crossings or T junctions in the level,
you are processing things in a tight –Jim Van Verth you could not actually cross, only
loop, you want to make the data for Don’t know how many remem- turn to the passage on your left or
each iteration as small as possible, ber Force 21, but it was an early right. The deadline was closing, and
and as close together as possible in 3D RTS which used a follow cam they had no idea on how to fix it.
memory. That means the ideal is to observe your current platoon. Then the team writer fixed the
an array or vector of objects (not Towards the end of the project issue; he told the artist to add an
pointers) that contain only the data we had a strange bug where the animation of hands touching the
necessary for the calculation. camera would stop following the walls, and then he added in the
This way, when the CPU fetches platoon — it would just stay where background story that the main
the data for the first iteration of it was while your platoon moved character was blind and needed to
your loop, the next several itera- on and nothing would budge it. The constantly touch the walls to know
tions worth of data will get loaded apparent cause was random because where he was going.
into the cache with it. we couldn’t find a decent repro
There’s not really much you case. Until, finally, one of the testers You Wouldn’t Like Me When I’m
can do with using fewer and faster noticed that it happened more Angry –Nick Waanders
instructions because the CPU is often when an air strike occurred I once worked at THQ studio Relic
as fast as it’s going to get, and the near your vehicles. Using that info I Entertainment on The Outfit,
compiler can’t be improved. Cache was able to track it down. which some may remember as one
coherence is where it’s at. This article Because the camera was using of the earlier games for the Xbox
[hn.my/coherence] contains a good velocity and acceleration and was 360. We started with a PC engine
example of getting cache coherency collidable, I derived it from our (single-threaded), and we had to
for an algorithm that doesn’t simply PhysicalObject class, which had convert it to a complete game on
run through data linearly. those characteristics. It also had a next-gen multi-core console in

  25
about 18 months. About 3 months It’s Not a Bug,It’s a Feature! if(__builtin_expect(entity-
before shipping, we were still run- –Philip Tan >extremely_unlikely_flag, 0)) {
ning at about 5 FPS on the 360. I worked on an RPG in which we // code that is rarely run
Obviously this game needed some were trying to get the NPCs (Non- }
severe optimization. player Characters) to spot when
I’ve seen a 10-20% speedup with
When I did some performance you were in range, walk up to you,
proper use of this.
measurements, it became clear and strike up a conversation with
that as much as the code was slow you by activating the dialog system.
Objective Oriented Programming
and very “PC,” there were also We forgot to add code to distin-
–Anonymous
lots of problems on the content guish NPCs from PCs (Player Char-
Back at a game studio, I think it was
side as well. Some models were acters), so we’d walk into town and
near the end of the project, we had
too detailed, some shaders were all the NPCs would be talking with
an object in one of the levels that
too expensive, and some missions each other. Because all NPC AI
needed to be hidden. We didn’t
simply had too many guys running code used the same dialog template,
want to re-export the level and we
around. they actually got a few sentences
did not use checksum names. So
It’s hard to convince a team of in before the conversations became
right smack in the middle of the
100 people that the programmers nonsensical. And because character
engine code we had something like
can’t simply “fix” the performance dialog was broadcast, you could
the following:
of the engine, and that some of read everything they said if you
the ways people had gotten used were in range. if(level==10 && object==56 )
to working needed to change. We decided to turn that bug into {
People needed to understand that a major feature. HideObject();
the performance of the game was }
everybody’s problem, and I figured Dirty Deeds –Tim Randall
The game shipped with this in.
the best way to do this is with a bit The engine team at Gremlin Inter-
Maybe a year later, an artist
of humor that had a bit of hidden active used to keep a single glove in
using our engine came to us very
truth behind it. their office. When someone asked
frustrated about why an object in
The solution took maybe an why it was there, they were told it
their level was not showing up after
hour. A fellow programmer took was only used when someone was
exporting. The level they had a
4 pictures of my face: one really about to type some really dirty
problem with resolved to level 10. I
happy, one normal, one a bit angry, code. It wasn’t so much a case of
wonder why?
and one where I am pulling my hair not wanting to leave fingerprints
out. I put this image in the corner but rather not wanting to actually
Stack vs. Heap
of the screen, and it was linked to touch the dirtiest fixes!
–Torbjörn Gyllebring
the frame rate. If the game ran at
Stack allocation is much faster than
over 30fps, I was really happy, if it Explicit Conditional Hinting
heap allocation since all it really
ran below 20, I was angry. –ZorbaTHut
does is move the stack pointer.
After this change, the whole FPS A very, very low-level tip, but one
Using memory pools, you can get
issue transformed from, “Ah, the that can come in handy: most com-
comparable performance out of
programmers will fix it.” to, “Hmm, pilers support some form of explicit
heap allocation, but that comes
if I put this model in, Nick is going conditional hinting. GCC has a
with a slight added complexity and
to be angry! I’d better optimize this function called __builtin_expect
its own headaches.
a little first.” People could instantly which lets you inform the compiler
Also, stack vs. heap is not only a
see if a change they made had an what the value of a result prob-
performance consideration; it also
impact on the frame rate, and we ably is. GCC can use that data to
tells you a lot about the expected
ended up shipping the game at optimize conditionals to perform as
lifetime of objects. The stack is
30fps. quickly as possible in the expected
always hot, and the memory you
case, with slightly slower execution
get is much more likely to be in
in the unexpected case.

26  PROGRAMMING
cache than any far heap allocated Remove Unnecessary Branches without doing anything. Since
memory. –tenpn the handler was called multiple
The downside of the stack is that On some platforms and with some times per second, the player never
it is actually a stack. You can’t free a compilers, branches can throw noticed, and the crash was fixed.
chunk of memory used by the stack away your whole pipeline, so even
unless it is on top of it. There’s no insignificant if() blocks can be Meet My Dog, “Patches”
management — you push or pop expensive. –Mick West
things on it. On the other hand, The PowerPC architecture (PS3/ There’s an old joke that goes some-
the heap memory is managed: it x360) offers the floating-point thing like this:
asks the kernel for memory chunks, select instruction, fsel. This can be
Patient: “Doctor, it hurts when I do
maybe splits them, merges them, used in the place of a branch if the
this.”
reuses them, and frees them. The blocks are simple assignments:
stack is really meant for fast and Doctor: “Then stop doing it.”
float result = 0;
short allocations.
if(foo > bar){ result = 2.0f; } Funny, but are these also wise
else { result = 1.0f; } words when applied to fixing bugs?
I’m a Programmer, Not an Artist
Consider the load of pain I found
–Damian Connolly Becomes:
myself in when working on the port
For indie/solo developers who are
float result = fsel(foo-bar, of a 3D third person shooter from
working on an iPhone or Android
2.0f, 1.0f); the PC to the original PlayStation.
game on their own, while you’re
Now, the PS1 has no support for
looking for an artist, you should be When the first parameter is
floating point numbers, so we were
developing your game at the same greater than or equal to 0, the
doing the conversion by basically
time. Use programmer art, stand- second parameter is returned, else
recompiling the PC code and over-
ins, free sprites — anything. Most the third. The price of losing the
loading all floats with fixed point.
of the time, before even thinking branch is that both the if{} and
That actually worked fairly well,
about final assets, I just want some- the else{} block will be executed,
but where it fell apart was during
thing up and running quickly to see so if one is an expensive operation
collision detection.
if it’s fun. Prototype the crap out of or dereferences a NULL pointer,
The level geometry that was
it and find the game. Then, when this optimization is not suitable.
supplied to us worked reasonably
the gameplay’s locked down, you Sometimes your compiler has
well in the PC version of the game,
can start putting in the proper art. already done this work, so check
but when converted to fixed point,
Doing it the other way around leads your assembly first.
all kinds of seams, T-Junctions, and
to lost money, and work that needs
other problems were nudged into
to be redone multiple times, which Hack the Stack –Steve DeFrisco
existence by the microscopic dif-
aside from harming your project, I was one of a few interns at
ferences in values between fixed
sucks your motivation to finish it IMAGIC in 1982-83. We were all
and floats. This problem would
(and if you’re making a game to get doing Intellivision carts. One of the
manifest itself in one case with the
a job, showing that you can finish a programmers had to leave to go
main character touching a particu-
project is a good thing). Another tip back to school, and I was chosen
lar type of door in a particular level
if you’re lacking upfront finance is to fix the random crash bug in his
in a particular location; rather than
to find a freelance game artist who game. It turned out to be a stack
fix the root cause of the problem,
will accept a revenue sharing deal, overflow in the timer interrupt han-
I simply made it so that if he ever
e.g. typically something like 30% of dler. Since the only reason for the
touched the door, then I’d move
game revenue, payable once it gets handler was to update the *display*
him away, and pretend it never hap-
published to the AppStore. of the on-screen timer, I added
pened. Problem solved.
some code to test the depth of the
Looking back I find this code
stack at the beginning of the inter-
quite horrifying. It was patch-
rupt routine. If we were in danger
ing bugs and not fixing them.
of overflowing the stack, return

  27
Unfortunately the real fix would In the afternoon, we make the Then, as quickly as despair swept
have been to go and rework the last build with the last few game- over us, we realized how we could
entire game’s geometry and colli- balancing tweaks, and do one last fix this on time for the gold can-
sion system specifically with the playthrough session when disaster didate release. We opened up the
PS1 fixed point limitations in mind. strikes: the game crashes hard! We text file responsible for the conflict,
The schedule was initially aggres- all run to our workstations, fire up added a space at the end, and saved
sive, and since we always seemed the debugger, and try to figure out it. We looked at each other with
close to finishing, the quick patch what’s going on. It’s not some- huge grins on our faces and said:
option won over against a compre- thing trivial, like an assert, or even “Ship it!”
hensive (but expensive) fix. something moderately hard to track The extra space meant the
But it did not go well. Hundreds down, like a divide by zero. It looks CRC32 checksum of the text file
of patches were needed, and then like memory is garbage in a few was altered and therefore no longer
the patches themselves started places, but the memory reporting conflicted with the other resource.
causing problems, so more patches comes out clean. What’s going on?
were added to turn off the patches One dinner and many hours later, HexEdit to the Rescue
in hyper-specific circumstances. our dreams of getting out on time –Ken Demarest
The bugs kept coming, and I kept shattered, we manage to track it Back on Wing Commander 1 we
beating them back with patches. down to one data file being loaded were getting an exception from our
Eventually I won, but at a cost of in with the wrong data. The wrong EMM386 memory manager when
shipping several months behind data? How’s that possible? Our we exited the game. We’d clear
schedule, and working 14 hour days resource system boiled down every the screen and a single line would
for all of those several months. asset to a 64-bit identifier made out print out, something like “EMM386
That experience soured me of the CRC32 of the full filename Memory manager error. Blah blah
against “the patch.” Now I always and the CRC32 of all the data blah.” We had to ship ASAP. So I
try to dig right down to the root contents. That was also our way of hex edited the error in the memory
cause of a bug, even if a simple, and collapsing identical resource files manager itself to read “Thank you
seemingly safe, patch is available. into a single one in the game. With for playing Wing Commander.”
I want my code to be healthy. If tens of thousands of files, and two
you go to the doctor and tell him years of development, we never had 8-bit Audio Stomper –Toonse
“it hurts when I do this,” then you a conflict. Never. For a launch product of a certain
expect him to find out why it hurts, Until now, that is. console I had a nasty bug report
and to fix that. Your pain and your It turns out that one of the from QA that took 20+ hours to
code’s bugs might be symptoms of innocent tweaks the designers had reproduce. Finally (with 24 hours
something far more serious. The checked in that afternoon made it left to go to hit console launch)
moral: treat your code like you so a text file had the exact same tracked it down to some audio
would want a doctor to treat you; filename and data CRC as another drivers in the firmware that were
fix the cause, not the symptoms. resource file, even though they were erroneously writing 1 random byte
completely different! “somewhere” at random times
Identity Crisis –Noel Llopis Our hearts sank to our feet where the “somewhere” was always
This scene is familiar to all game when we recognized the problem. in executable code space. I finally
developers: It’s the day we’re send- There’s no way we could change figured out that any given run of
ing out the gold candidate for our the resource indexing system in the game that “somewhere” was
Xbox 1 game. The whole team is such a short period of time. Even always the same place, luckily. 1st
playtesting the game all day long, if we pulled an all-nighter, there party said sorry, can’t fix it in time
making sure everything looks good. was no way to know for sure that as we don’t know why it’s being
It’s fun, it’s solid, it’s definitely a go everything would be stable in the caused! So I shipped that game
in our minds. morning. with stub code at the very start of
main that immediately saved off
the 1 byte from the freshly loaded

28  PROGRAMMING
executable in the place I knew it Bit Shifting Magic
would overwrite for that particular –Steven Pigeon
version of the exe. There was then In order to avoid stalls in the proces-
code that would run each frame after sor pipeline due to branching, one
audio had run and restore that byte can often use a branchless equivalent,
back to what it should be just in that is, code transformed to remove
case it had been stomped that frame. the if-then-else’s and therefore jump
Good times! We hit launch. prediction uncertainties. For exam-
To this day I still feel very, very ple, a straightforward implementa-
dirty about this hack, but it was tion of abs( ) in C might be:
needed to achieve the objectives and
inline int abs(int x)
harmed no one.
{
return (x<0) ? -x : x;
Rainy Day Server Pool
}
–Potatolicious
I used to work for a company that Which is simple enough but
had a horrific hardware requisition contains an inline if-then-else. As the
policy. If your team needed a server, argument, x, isn’t all that likely to
it had to go through a lengthy and follow a pattern that the branch pre-
annoying approvals process — and diction unit can detect, this simple
even then, it took months before function becomes potentially costly
Infrastructure would actually provide as the jump will be mispredicted
said servers. quite often.
In other words, when a project How can we remove the if-then-
gets handed down from above to else, then? One solution is to use the
launch in, say, 3 months, there’s no right shift operator (>>) and the bit-
way in hell you can get the servers wise XOR operator (^) as following:
requisitioned, approved, and installed
inline int abs_no_branch(int x)
in that time. It became standard
{
practice for each team to slightly
int m = (x >> (8 *
over-request server capacity with
sizeof(int)-1));
each project and throwing the excess
return ((x ^ m) - m);
hosts into a rainy day pool, immedi-
}
ately available and repurposeable as
required. Where the expression (8 *
New servers will still get requested sizeof(int) - 1) evaluates to 15,
for these projects, but since they took 31, or 63 depending on the size of
so long to approve, odds are they’d integers on the target computer. n
go right into the pool whenever they
actually arrived, which sometimes Harvey Green has spent the past few years
took up to a year. developing in .NET and C# for the Oil & Gas
Of course, it was horrifyingly inef- and related industries. He believes that core
ficient. Just on my team alone I think language skills plus good domain knowl-
we had easily 50 boxes sitting around edge has been the key to most of the proj-
ects he’s worked on.
doing nothing (and powered on to
boot) waiting to pick up the slack of
Reprinted with permission of the original author.
a horrendously broken bureaucracy. First appeared in hn.my/game (dodgycoder.net)

  29
Python Deployment 
Anti-Patterns 
By Hynek Schlawack

D eploying web applica-


tions is hard. No shiny
continuous deployment
talk and no DevOps coolness can
change that. Or to use DevOp
So if I say “application,” I don’t
mean just some Django CRUD
front end. Python lives in all layers
here. And all layers have to be
deployed somehow.
we can get — even if it means
extra work.
We also have to compile our own
Apaches and MySQLs for our cus-
tomer servers (we don’t use any of
Borat’s words: “Is all fun and game Deploying so many diverse them for our own systems, but our
until you are need of put it in pro- applications requires solid and customers demand a solid LAMP-
duction.” There are some mistakes I consistent deployment stan- stack) because we need that fine-
see people making again and again, dards if you don’t want to go grained control. Why should Python
so I’d like to address them here. crazy. The main mantra is to go be an exception? Rolling an own
for simple solutions, not for easy DEB/RPM is a lot less of a nuisance
My background ones. Something that is easy now, than writing code for Python < 2.6.
Before I start preaching, let me tell can become a major PITA down This works both ways. It’s
you a bit about me and what I do in the road. entirely possible that you have
order to give you some perspective some mission-critical web app that
from which I’m writing. Don’t use ancient system isn’t compatible with Python newer
I work for a German web hoster Python versions than 2.4. Are you going to install
and domain registrar. And I’m Every time someone whines about a single server with an ancient OS,
deploying Python-based applica- lack of support for Python 2.4 in just to accommodate? Key infra-
tions all the time. Most parts of recent packages, I hear Kenneth structure must not be dictated by
our infrastructure are built using Reitz saying: third parties.
Python. And those that aren’t, will On the other hand I’m not saying
Python 2.4 is not supported. It
be eventually. that you have to compile Python
came out 8 years ago. That’s older
The sizes range from tiny glue yourself! Oneiric and later have
than YouTube. Upgrade.
to mission-critical APIs. We have Python 2.7 on board — there’s
legacy Pylons [pylonsproject.org], If you’re serious about using absolutely no reason to build it for
new Pyramid, some Django, & Python you should be prepared to yourself. The stress is on “ancient,”
a lot of Twisted apps roll your own RPMs/DEBs. We’re not on “system” in this caption.
[twistedmatrix.com]. And every- even running RHEL 4 on some
thing is seasoned with a hint of of our servers; but we’re a Python
Celery [celeryproject.org]. company, so we use the best thing

30  PROGRAMMING
Use virtual environments default? Do I have to fix all my gunicorn-config.py settings/pro-
Gentlepeople, if you’re deploying applications before upgrading our duction.py
software, always use virtualenv. servers? Or what if I need to deploy user=yourapp
Actually, the same goes for local an app to an older server? Do I directory=/apps/yourapp
development: look into virtualen- have to rewrite it so it runs with
You add the file to /etc/super-
vwrapper which makes handling older packages? I prefer not to.
visor/conf.d/, make a supervi-
them a breeze. So never install I really wish the Linux distribu-
sorctl update and your service is
into your global site packages! The tions wouldn’t ship anything more
up and running. It’s a no-brainer
only exception is the aforemen- than the Python interpreter and
and much easier than juggling rc.d
tioned virtualenv, which in turn virtualenv. Anything else just lever-
scripts. Crash recovery and optional
installs pip in each environment it ages bad behavior.
web interface included.
installs to. The only good they may be doing
Test your software against certain is automatically updating packages
Configuration is not part of
versions of packages, pinpoint with security vulnerabilities that
the application
them using pip freeze and be you may have missed. That said,
Your production configuration
confident that the identical Python I’m convinced that if you deploy
doesn’t belong in the (same)
environment is just a pip install software to the net, you have
source repository. There are
-r requirements.txt away. For the responsibility to monitor them
configuration management tools
the record, I split up my require- yourself anyway. Relying on your
like Puppet [puppetlabs.com]
ment files; more on that in the distribution gives you just a false
or Chef [opscode.com/chef] that
next installment. sense of security; if your customer’s
do exactly that for you — just
Also, use real version pinning data gets hacked, they don’t care
better and more reliably. While
like package==1.3. Don’t do pack- that Ubuntu was to slow to issue a
installing the configuration, Puppet
age>=1.3, it will bite you eventu- security update.
can make sure that the directories
ally, just as it has bitten me and
always have certain permissions.
many others. Don’t run your daemons in
Configuration templates make
a tmux/screen
it perfect for mass deployments.
Never use Python packages It seems to be part of everyone’s
Some service IP changed? Just fix
from your distribution evolution to do it, so be the first
it in Puppet’s repo and deploy the
This one is in fact an extreme ver- one to skip it!
changes. Eventually all services
sion of the previous anti-pattern. Yes, tmux is full of awesome
will catch up. If you want, you can
First of all, there’s no reason to (and way better than screen),
always trigger a run, for example
succumb to a dictate of your distri- but please don’t just ssh on your
using a simple Fabric [fabfile.org]
bution which version of a package host and start the service in a tmux
script.
to use. They don’t know your appli- or screen. You have nothing that
But don’t use Fabric for actual
cation. Maybe you need the latest brings the daemon back up if it
deployments! This is the perfect
version, maybe you need a slightly crashes. You can’t restart it on 10
example of the battle between
older one. servers without ssh’ing on 10 serv-
“simple” and “easy.” At first, it’s
ers, get the screen and Ctrl-C it.
1. If I write and test software, I do it easier to put everything inside of
Granted, it’s easy in the beginning,
against certain packages. Packages the repo and run a Fabric script that
but it doesn’t scale and lacks basic
tend to change APIs, introduce does a git pull and restarts your
features that simple-to-use tools
bugs, etc. daemon. In the long run, you’ll
have to offer.
regret it like many before you did.
2. My software is supposed to run My favorite one is supervisord
Just to stress this point: I love
on any UNIXy platform as long [supervisord.org]. A definition for a
Fabric and couldn’t live without
as the Python it’s written against service looks as simple as:
it. But it’s not the right tool for
is present.
[program:yourapp] orchestrating deployments — that’s
What if the next Ubuntu ships command=/path/to/venv/bin/guni- where Puppet and Chef step in.
with a different SQLAlchemyby corn_django --config deploy/

  31
Look into alternatives to
Apache + mod_wsgi setups This is Why You Spent All that
Time Learning to Program
Many people go for Apache
and mod_wsgi by default,
because everybody has already
heard about Apache.
To me, Apache feels like By James Hague
a big ball of mud, and I find

T
the modular combination
of gunicorn [gunicorn.org] here’s a standard When I sit down to work on
or uwsgi [hn.my/uwsgi] format for local TV a personal project at home, it’s
together with nginx much news broadcasts that’s much simpler.
more pleasing and easier easy to criticize. I don’t have to follow the
to control. There’s an initial shock-value familiar standards of whatever
teaser to keep you watching. kind of app I’m building. I don’t
Enough negativity News stories are read in a dra- have to use an existing application
I don’t claim that I’ve discov- matic, sensationalist fashion by as a model. I can disregard history.
ered the sorcerer’s stone. How- attractive people who fill most of I can develop solutions without
ever, I’ve developed a system the screen. There’s an inset image people saying “That’s not how it’s
for us that proved solid and over the shoulder of the reader. supposed to work!”
simple in the long run. Periodically there’s a cutaway to That freedom is huge. There
The trick is to build a a reporter in the field; it’s often are so many issues in the world
debian package (but it can be followed-up with side-by-side that people complain about, and
done using RPMs just as well) images of the newscaster and there’s little chance of fixing the
with the application and the reporter while the former asks system in a significant way. Even
whole virtualenv inside. The a few token questions to latter. something as simple as reworking
configuration goes into Puppet, There’s pretend banter between the local news is out of reach. But
and Puppet also takes care that newscasters after a feel-good story. if you’re writing an iOS game, an
the respective servers always You get the idea. Now what if I HTML 5 web app, a utility that
have the latest version of wanted to change this entrenched automates work so you can focus
the DEB. structure? on the creative fun stuff, then
The advantage is that such a I could get a degree in journal- you don’t have to fall back on the
DEB is totally self-contained, ism and try to get a job at the existing, comfortable solutions
doesn’t require having to build local TV station. I’d be the new that developers before you chose
tools and libraries on the target guy with no experience, so it’s simply because they, too, were
servers, and, paired with solid not likely I could just step-in and trapped by the patterns of the
Puppet configuration, it makes make sweeping reforms. All the solutions that came before them.
consistent deployments over a other people there have been You can fix things. You can
wide range of hosts easy, fast, doing this for years or decades, make new and amazing things.
and reliable. But you have to do and they’ve got established Don’t take that ability lightly. n
your homework first. n routines. I can’t make dozens of
people change their schedules James Hague has been Design Director
Hynek is a wine-loving software and habits because I think I’m for Red Faction: Guerrilla, editor of “Hal-
engineer from Berlin/Germany, cre- so smart. To be perfectly fair, a cyon Days: Interviews with Classic Com-
ating robust systems for a living at drastic reworking of the news puter and Video Game Programmers,”
Variomedia and hacking FOSS for would result in people who had co-founder of an indie game studio, and
fame at home. He occasionally blogs no issues with old presentation a published photographer. He started his
at hynek.me and regularly tweets as blog “Programming in the 21st Century,”
getting annoyed and switching
@hynek in 2007.
to one of the other channels that
Reprinted with permission of the original author. does things the old way. Reprinted with permission of the original author.
First appeared in hn.my/pydev (hynek.me) First appeared in hn.my/spent (dadgum.com)

32  PROGRAMMING
Programmers underestimate the dif-

Faster than C
ficulty to write correct macros like
they underestimate the difficulty to
write correct concurrent programs.
A language designer should think
about meta programming. Some-
By Andreas Zwinkau thing Turing-complete like C++
templates, seems to be beneficial

J
for performance.
udging the performance This mechanism helps in some
Runtime Optimization
of programming languages, cases, but not in our example.
At runtime there is dynamic
usually C is called the leader, Fortran semantics say that func-
information which is not available
though Fortran is often faster. New tion arguments never alias and there
to a static compiler. Any specific
programming languages commonly is an array type, where in C arrays
example could be duplicated by
use C as their reference, and they are pointers. This is why Fortran
a C program, but usually it is not
are really proud to be only so is often faster than C. This is why
feasible. The trick of profile-guided
much slower than C. Few language numerical libraries are still written
optimizations solves only a small
designer try to beat C. in Fortran. However, it comes at the
part of the problem.
What does it take for a language cost of pointer arithmetic.
What becomes especially easy at
to be faster than C? A language which wants to
runtime is whole-world optimiza-
be faster than C should provide
tion. While this is possible statically,
Better Aliasing Information semantics where aliasing can be
the C semantics (compilation units)
Aliasing describes the fact that two better analyzed by the compiler.
and the mandatory preprocessor
references might point to the same
make it difficult for the compiler.
memory location. For example, con- Push Computation to
Even Python can beat C by inlining
sider the canonical memory copy Compile-Time
across file borders.
(not memcpy from stdlib.h!): Doing things at compile time
Of course, there are downsides
reduces the run time. Of course, C
void* memcopy(void* dst, const to using a JIT and especially in
compilers do this for trivial cases
void* src, size_t count) { systems and embedded program-
like 1+2, where the addition is
while (count--) *dst++ = ming it is not appropriate. So there
already handled at compile time.
*src++; might be examples where Java, C#,
However, languages with nice
return dst; or others beat C, but they do not
meta-programming support enable
} threaten C’s niche.
the programmer to do similar
Depending on the target architec- application specific optimizations. A
Conclusion
ture, a compiler might perform a lot simple example, we could optimize
Aliasing information is the only one
of optimizations with this code. For fib(20) to 6765, without the compiler
where I am certain about speed
example, on a modern x86 with the knowing about Fibonacci numbers.
improvements, because it is impossi-
SSE instruction MOVDQU, it could For a real example, the Eigen
ble to reach Fortran-speed in C. The
copy 16 Byte blocks instead of 4 C++ library for linear algebra uses
other ideas are more about making
Byte (sizeof(void*)). Unfortu- C++ templates to avoid copies and
it easier to write faster programs. n
nately, no. Due to aliasing, dst could be lazy about computations. Of
for example be src+1. In this case, course, Lisp is the grandfather of this
Andreas Zwinkau is a doctoral researcher at
the result must be the first word technique with its macro system.
the IPD Snelting since 2010. He is working
*src repeated count times at dst. For example, there is a nice anecdote on the libFirm compiler within the InvasIC
The compiler is not allowed to use [hn.my/jsobel] about a student using project. However, this is only true, while he
MOVDQU due to the semantics of C. Scheme for an assignment. Basically, is not occupied with managing and teach-
In C99 the restrict keyword the programmer can modify the ing students at the KIT, Germany’s finest
was added, which we could use abstract syntax tree during compila- university for computer science.
here to encode that src and dst are tion. The trade-off with such meta Reprinted with permission of the original author.
different from all other references. programming features is complexity. First appeared in hn.my/fasterc (beza1e1.tuxen.de)

  33
SPECIAL

“That’s Why You Don’t Have


Any Friends.”
By Joe Peacock

Y esterday, I was at the


gym. I was working out,
as I am usually doing
while I’m at the gym. And as it
happens over the years spent going
“Only the part that likes real
sports,” I replied. “And maple syrup.”
“I still don’t get why you don’t
like college football,” another asked.
“You’re in Georgia. SEC is bigger
gym are hot; warnings are issued
by the more experienced about the
dangers of dating people from your
gym or your job (short version: it
doesn’t matter how hot the guy or
to the same gym, relationships form than NFL here.” girl is, it’s stupid. Unless marriage is
and people get to know each other, “What can I say?” I asked. “South- assured, don’t do it.)
and groups form and jokes are erners like their little league sports. One of the guys asked Bradley
shared and camaraderie takes place. I prefer watching pros.” if he had a girlfriend. If there were
And it was the same this day. And so it goes, about the same dirt on the gym floor, he’d have
I was talking with a group of way every Saturday. The topics been kicking it.
folks who are regularly in during change — what cars are best, what “Nah, no girlfriend,” he replied.
the afternoons on Saturdays. sports are better than other sports, “Young strapping lad like you?
Among them was a 14-year-old boy what teams are better than other Nonsense,” I said, knowing full well
named Bradley (not his real name). teams, what shows are better than that not only did he not have a
He’s a great kid. He’s been coming other shows (but never politics or girlfriend, he’d have absolutely no
to the gym with his parents for the religion — something you learn clue what to do with one if he did
past two or so years. While his par- really fast in a gym is to never bring because I was him once. But as a
ents walk around the track upstairs, up the two topics most likely to grown up looking out for a younger
he spends his time learning how to incite violence in a building filled kid, you have to act like it’s com-
lift weights with us big guys. When with metal bars and heavy plates). pletely ridiculous that girls don’t
he first started, he was wiry and Someone has a divergent inter- flock to him. It’s the right thing to
awkward. He’s still pretty awkward; est, everyone else jumps on it, and do.
being a teenager and all. But us laughs are had. And invariably, the “I asked a girl out to the spring
big guys set him on a good path to topic turns to girls. dance,” he said. He then said some-
maintain a healthy level of fitness. Husbands laugh about the young thing that hit me hard. “She called
We were cutting up and laughing. singles and their stories about me lame and said, ‘That is why you
The guys made fun of me for liking weekend endeavors. Singles laugh don’t have any friends. Because
hockey. “That’s a Canadian sport, at the guys stuck at home with you’re weird.’”
isn’t it?” one asked. “What are you, their ball and chain. Whispers are
part Canadian?” shared about which girls in the

34  SPECIAL
The words rang in my head. And now, 17 years later, life is He nodded. "Okay,” he said.
Those exact words — I remem- fantastic. I belong to a studio full “This isn’t just conversation, this
bered hearing them. A lot. He of amazing people who were all is important,” I said. “You listening?”
didn’t explain why she thought weird, just like me. I get to meet He nodded again. “I’m listening,”
he was weird. He didn’t have to. I freaks from across the nation who he replied with a look that con-
knew the feeling very, very well. all love anime and comics, just like vinced me that he was.
“Come on now,” one of the guys me. I get to talk to people who read I took a deep breath. “Right now,
said. “Don’t let her get to you.” my weird stories about my weird you’re in high school in a small
“No, she’s right,” he said. “I don’t life and relate to it because, just like suburban town,” I started.
have any friends. Not at school, me, they’re weird. He nodded.
anyway.” His face got really sad. “I There are thousands — no, “Everyone you know looks
really am weird.” hundreds of thousands — of us. the same and acts the same,” I
I was weird, back before I realized All weird. All strange. All over, explained. "They may dress differ-
I wasn’t. And it resulted in some everywhere. ently from each other or belong
extremely lonely times in my young We all went to school and hated to different crowds, but they’re all
life. My entire elementary and everyone because they didn’t the same. Hipsters, brainiacs, jocks,
junior high school tenure was spent understand us. We dealt with the so-called “geeks” — they’re all so
with no friends. In tenth grade, I bullying and the isolation and the caught up with not being left out

“There
found my tiny group of four friends. feeling that we were the weird that they’re changing who they are
to fit in with whoever it is that will
accept them.

are hundreds of “When you show up and you’re


not like that, it scares them,” I

thousands of us. continued. "They don’t know what


to do with you, because they have

All weird. All strange. no idea what it’s like to think for
themselves. So they try to make

All over, everywhere.”


YOU feel like the loser, because
there are more of them doing what
they’re doing than there are of
you. In such a small group of small
I dated the wrong girl (they’re all ones. You want to know what’s
minds, the nail that sticks up gets
wrong, until you find the right one). weird? Spending hundreds of dol-
hammered down.
The four of us fractured into two lars on clothes and shoes and purses
“To them, you are weird,” I said.
groups of two — Mike and I split that everyone else thinks are cool.
“But weird is good. No, screw
off from Walter and Rod. Spending hours of your life doing
that — weird is great! Being weird
Then one day, Mike got tired of things that everyone else is doing
to someone just proves that you
my bullshit and said those words to because it’s cool. Liking the bands
are being you, which is the most
me. “That’s why you don’t have any that everyone else likes because
important thing you can ever be.
friends,” he said at very high volume. you’re a loser if you don’t.
There’s nothing wrong with you.
He deserved to say it — I’d just told You want to know what’s weird?
There’s something wrong with
him to go fuck himself when he Hiding who you are just to have the
them. They can’t understand what
tried to explain why my girlfriend company of people you don’t even
it’s like to be themselves, much less
at the time was screwing someone like. That’s weird.
what it’s like to be you.”
behind my back. I called him every I looked him straight in the
He smiled a little. “You really
name in the book, so he bailed and eye. My normally grinning mouth
think that?” he asked.
joined up with Walter and Jay while turned stern. With as serious a tone
I laughed. “Dude, look at me!” I
I spent the last few weeks of high as I could muster, I said “Listen to
said. “I’m 300 pounds of ex-football
school career. Even the furry had me, okay? What I’m about to say is
player covered in cartoon and
more friends than I did. something I want you to take in and
comic book tattoos, who builds
think about and really hold on to.”

  35
websites and tours the world talk- when I looked at them, they both
ing to people about his anime cel nodded and smiled.
collection. Trust me, I know all So I put the cap on the whole
about being weird.” thing. “And I know your parents are
He shrugged and said, “It just right there, but I’m going to say it
sucks, you know?” anyway: Fuck. Them.”
“Oh, I know,” I said with a smile. I kept my eyes on him, but could
"And here’s the little bit of bad see just behind him that his mom
news — It’s gonna suck for a little reacted a little to my vulgarity. His
while longer. But one day, you’ll get dad placed his hand on her shoul-
out of school and go somewhere der and just let it be.
besides the small town you’re in The guys in the group all nodded
and you’re going to discover that and agreed with me and began talk-
there are groups of people just like ing to him about their perspectives
you — not that they do what you on the situation (which, in previous
do or act how you act, but that they conversations over the years, I knew
refused to change who they are to be similar to mine). His parents
to fit in, and that makes them just came up to me and thanked me for
like you. And when you find them, talking to him.
you’re finally going to feel at home. “He just thinks the world of you
“It might be college, or it might guys,” his mom said. “He talks about
be visiting another city. Hell, it coming here all the time to work
might even be on the internet. But out with you.”
at some point you’re going to find “He really needed to hear that,”
them. And it’s going to be great.” his dad said. “We try to tell him that
He smiled. “That would be awe- high school is just that way, but you
some,” he said. know how it is...”
“It WILL be awesome!” I replied. “No teenager wants to listen to
“But until then, it’s going to be his parents,” I said. “Hell, I’m an
lonely and frustrating. You’re going adult and I still don’t.”
to do stupid things thinking it’s They both laughed.
going to impress them or change “He’s a great kid,” I said. “He’s
their opinion of you, and it won’t, going to be just fine in a few years.”
and you’re going to get sad. Just “Well, thank you,” the dad said.
know that it does end. It ends the “It means a lot.”
day you realize that you never “Hey,” I said with a shrug, “That’s
wanted to be them in the first place what we’re here for. We’re his
because they are losers. They lost friends.” n
the battle to be themselves. You’re
the winner.” When he's not teaching the Internet how
I paused for a second, because to fist-fight, why being weird is awesome
it had just occurred to me that, at or how to self-publish your own books,
some point during my little moti- Joe Peacock tours the world, showing his
vational speech, his parents had extensive "Akira" art collection. He has 13
cats and loves you.
walked up and were waiting a short
distance behind him. I presumed it
was to give him enough space to let Reprinted with permission of the original author.
First appeared in hn.my/friends (joethepeacock.blogspot.com)
the conversation be his own, but I
knew they had heard me because

36  SPECIAL
What I’ve Learned about
Smart People
By Tommy MacWilliam

G oing to Harvard means


I have the amazing
opportunity to be
around a lot of smart people. Now,
when I say “smart people,” I don’t
noticed one overarching theme
among smart people: they ask
questions. When someone explains
something new to me, I usually
just nod my head like I know
the professor’s question was genu-
ine and that the answer was of great
importance.
Based on the research and find-
ings of so many of the students and
mean that guy who always wins what they’re talking about. If I professors here, it’s clear that this
trivia night. I mean blazingly intel- don’t understand something, I just trend is no accident. Not only do
ligent individuals who are regarded Google it later. After all, I don’t smart people ask questions when
as the pre-eminent scholars in their want this person to think I’m a they don’t understand something,
field. It’s pretty amazing to pass by moron. Smart people are different. but they also ask questions when
Turing Award winners and leading If they don’t understand some- the world thinks it understands
political science scholars grabbing a thing, or even if they think they something. Smart people chal-
sandwich. understand something, they ask lenge the very limit of human
Before I go anywhere, let me questions. I distinctly remember, as understanding, and they push the
make one thing clear: I am not one an immature and perhaps arrogant envelope of what’s possible farther
of these smart people. This is per- freshman, a guest lecturer in one than many people would argue
haps the biggest lesson I’ve learned of my classes. After explaining it’s meant to be pushed. Smart
after 3 years here. There is an abso- what I thought was a straightfor- people don’t take claims at face
lutely incredible amount of smart ward concept, the guest lecturer value, and smart people don’t rest
people in the world, and I can name asked if anyone had any questions. until they find an explanation
a whole bunch of students and Looking around the room, every they’re comfortable accepting and
professors alike who I know for a student simply nodded, indicating understanding.
fact I will never ever be as smart everything was clear. A question, Smart people challenge every-
as, no matter how hard I try. But however, came from a tenured pro- thing. (You know who taught me
honestly, that’s okay — I don’t need fessor who had undoubtedly been that? A smart person.)
to be (and perhaps that’s a story for exposed to the material before. Maybe someday, people will call
another day). What that does mean, At the time, I thought nothing of me a smart person. For now, I’m
though, is that I would be doing a it and perhaps even thought that going to keep asking them ques-
disservice to the ever-so-generous I was smarter than the professor tions. n
Financial Aid Office if I didn’t learn because I understood a concept he/
from them. I don’t mean learning in she didn’t. Now, I am confident that Tommy is a Computer Science major at
a lecture hall, but I refer to a more this professor did not ask the ques- Harvard University known for his affinity
personal sense of learning. What is tion just to make the guest lecturer for JavaScript. With a passion for promot-
it that separates a “smart” person feel better, to start a discussion, or ing innovation, Tommy loves teaching CS
from me? How do they conduct anything else. The intonation of courses and empowering students to build
themselves? What drives them? the question and the intensity with killer apps. He also loves cupcakes.
I can of course make no authori- which the professor listened to the
Reprinted with permission of the original author.
tative claims here, but I have response definitively suggested that First appeared in hn.my/smart (tommymacwilliam.com)

37  SPECIAL
I am widely credited as the
inventor of the <blink> tag. For
those of you who are rela-
tively new to the Web, the <blink>
tag is an HTML command that
to display many of the HTML
extensions that we were propos-
ing. I also pointed out that the only
text style that Lynx could exploit
given its environment was blinking
the arcane knowledge of blink-
ing leaked into the real world and
suddenly everything was blinking.
“Look here,” “buy this,” “check this
out” — all blinking. Large advertise-
causes text to blink, and many, text. We had a pretty good laugh ments blinking in all their glory. It
many people find its behavior to at the thought of blinking text and was a lot like Las Vegas, except it
be extremely annoying. I won’t talked about blinking this and that was on my screen, with no way of
deny the invention, but there is a and how absurd the whole thing turning it off.
bit more to the story than is widely would be. The evening progressed In the end, much was said —
known. pretty normally from there, with a most of it in the form of flaming

The Origins of the <Blink> Tag


By Lou Montulli

Back in 1994, I was a founding fair amount more drinking and me posts to various discussion boards,
engineer at Netscape, and prior meeting the girl who would later and the <blink> tag will probably
to that I had written the Lynx become my first wife. be remembered as the most hated
browser, which predated all of the Saturday morning rolled around of all HTML tags. I would like to
other popular browsers at that and I headed into the office only publicly state that at no time did I
time. Lynx had been and still is to find what else but blinking text. actually write code or even seri-
a text-only browser and is com- It was on the screen blinking in all ously advocate the <blink> tag. It
monly used in a console window on its glory and in the browser. How is true that I put forth the initial
UNIX machines. At Netscape we could this be, you might ask? It inspiration, but it really was merely
were building software that used a turns out that one of the engineers a thought experiment. I am not
graphical user interface and could liked my idea so much that he left going to name any names of the
express vastly more text styles the bar sometime past midnight, people who coded the dastardly
and layouts as well as images and returned to the office, and imple- deed. If they wish to step forward,
other media. We spent a lot of mented the blink tag overnight. He they will need to do it themselves.
time thinking about the future of was still there in the morning and In the end, the thing that I am truly
the web and new technologies that quite proud of it. sad about is that Lynx never did
would enable new classes of docu- At the time there were 3 ver- get to blink. I am also sad to report
ments, applications, and uses. A few sions of the browser that ran on that the St James Infirmary burned
examples were HTML tables, SSL UNIX, Windows, and Mac operat- to the ground in 1997. It was a
for secure communications, plugins ing systems. For a short 12 hours great place to hang out and will be
for extensions, and JavaScript to the blinking was constrained only to missed.
enable dynamic HTML. the UNIX version, but it didn’t take
<blink> on,
Sometime in late summer I took long for the blinking to spread to
:lou n
a break with some of the other Windows and then Mac. I remem-
engineers and went to a local bar ber thinking that this would be a
Lou Montulli is a programmer who is well
on Castro Street in Mountain View. pretty harmless Easter egg; that
known for his work in producing web
The bar was the St. James Infirmary no one would really use it, but I browsers. He co-authored a text web
and it had a 30 ft Wonder Woman was very wrong. When we released browser called Lynx and programmed the
statue, among other interesting Netscape Navigator 1.0 we did not networking code for the first versions of
things. At some point in the eve- document the blink functionality the Netscape web browser. He is currently
ning I mentioned that it was sad in any way, and for a while all was working on a new Enterprise class cloud
that Lynx was not going to be able quiet. Then somewhere, somehow storage service at a company named Zetta.
Reprinted with permission of the original author. First appeared in hn.my/blink (montulli.org)

38  SPECIAL

S-ar putea să vă placă și