jump to navigation

FizzBuzz :D February 27, 2007

Posted by sdpurtill in Python.
add a comment

In a recent blog post on Coding Horror entitled Why Can’t Programmers… Program?, they talked about the fact that the majority of so-called programmers are useless when it comes to solving problems. Apparently they give people 10-15 minutes in an interview to solve this simple problem.

After a fair bit of trial and error I’ve discovered that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call “FizzBuzz Questions” named after a game children often play (or are made to play) in schools in the UK. An example of a Fizz-Buzz question is the following:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes. Want to know something scary? The majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

I suppose I could have written it in Ruby, ActionScript, PHP, ColdFusion, and JavaScript. But I just learned Python, so I figured I might as well do it in that.

for i in range(1,101):
  if i%3 == 0:
    if i%5 == 0: print 'FizzBuzz'
    else: print 'Fizz'
  elif i%5 == 0: print 'Buzz'
  else: print str(i)

Count it. 6 lines. Took 5 minutes. Gotta love Python. I don’t know why I’m bragging, that was a joke.


My view on Writing February 27, 2007

Posted by sdpurtill in Blogging, Quotes.
1 comment so far

I came across this quote today:

Anybody can say you canโ€™t write. Let no one say you donโ€™t.

This really sums up what I think about writing and blogging for myself. It’s kind of funny, I have been thinking about a post to write about my view on writing in these last few weeks; this said it all in one sentence.

I know I can’t write — I am terrible at it. I have always been an analytical/math kind of guy, but I know that I need to be able to write if I want to have a great job when I get older (i.e., CEO). This is the #1 reason why I have blog, it forces me to write (writing for school just doesn’t help me anymore). And I have found that the more I wrote, the faster I can write. I get better ideas, am able to organize my thoughts much faster, and it just gets easier and easier. The same has been true with me and reading.

I also created a new desktop background, and there are these two quotes on it:

Keep Fighting – Keep Running – Keep the Faith


An inventor is a man who asks “Why?” of the universe and lets nothing stand between the answer and his mind (Ayn Rand)

Ok back to my never ending to-do list ๐Ÿ™‚

The Future of Education February 27, 2007

Posted by sdpurtill in Education.

High Tech High, a charter school in Silicon Valley, is closing. I found out about this thanks to Scoble (ROBERT SCOBLE KNOWS EVERYTHING! — Starter For 10, great movie :D). I wrote a little comment on that post, and I think I should just copy and paste it here:

This sounds a lot like the charter school I attend in Vacaville, about 45 minutes away from SF. I am an 18 year old Senior at Buckingham Charter Magnet High School (www.bcmhs.org). We too are a small (less than 400, including staff) school, and we are currently located in the middle of a shopping plaza (kind of weird to explain to people). We too are underfunded. We too have a teacher, student, and parent body of people that are grateful to be attending such a great school. There is nothing more motivating to students than a teacher that *loves* to teach. This is rare, but it seems like they are a commodity at Charter schools.

The public school system has been a *complete* failure, and in the future, all of these schools will be moving towards the small, community-oriented charter system. There is going to be a privatization of education in the near future. The educational problem that we face in America is much like the Social Security problem: large Public Schools have been a disaster, and charter schools are the only way we have been able to fix this problem.

I believe Buckingham is in itโ€™s 5th or 6th year as a school (I am a senior), and we have quickly climbed to the #2 school in our district as far as performance. There is obviously something unique about this type of education; when you put academia back to the forefront of school, you will see a major change in student performance.

Just logically think about it: public schools have major gang, drug and alcohol problems (which is obviously different depending on where you live). When you come to a charter school with 360 kids and a waiting list of 200 students, there is a huge culture change. Suddenly gangs can be carefully watched; teachers begin to know their students personally; counselors care about getting their students into college. I love Charter schools.

One thing I do miss is the sports and school pride/history that goes along with going to a large public school. But who cares? Iโ€™ve gotten a much better education at Buckingham than I would have at any other school in my district, I am convinced of this. With that being said, I *still* think the education system has failed to fully prepare me for a University (Stanford/Santa Clara/Pt Loma) like I think it should have. The only way to get around that is: Private schooling.

Uniforms may not be so bad after all?

DHH is a great leader February 26, 2007

Posted by sdpurtill in Ayn Rand, Rails, Technology.

If you don’t know who David Heinemeier Hansson is then stop reading this post right now. He’s the mastermind behind Rails, the most popular Web 2.0 framework in the world. I came across this picture whiel reading some blogs tonight: http://www.flickr.com/photos/planetargon/127984254/

This slide was for all of the people that wanted to add certain features to Rails that he didn’t want. This also was a message to all the people that didn’t agree with Rapid Development, Web 2.0, and, in a broader sense, the future. This is what makes David a great leader. I have a cousin that likes to say “better to be hated for who you are than loved for who you’re not”, and DHH understands this.

A great leader is a person that can stand alone and say “f*** you” to all the people that don’t agree with him. I don’t think you have to use an explicitive, but it definitely helps convey a powerful message to everyone. Here is a quote from, you guessed it, Ayn Rand

ย Men have been taught that it is a virtue to agree with others. But the creator is the man who disagrees. Men have been taught that it is a virtue to swim with the current. But the creator is the man who goes against the current. Men have been taught that it is a virtue to stand together. But the creator is the man who stands alone.

DHH embodies this “creator” persona, and I love him for that. I hope one day to follow suit…

Ayn Rand is too important to ignore February 22, 2007

Posted by sdpurtill in Ayn Rand.

I don’t agree with a lot of the teachings of Objectivism since I believe in God, but I think Ayn Rand’s works should be read by every student in high school. I am going to quote Nathaneal Branden (one of her early followers) from this video.

In 1991, the Library of Congress in cooperation with the Book of the Month club did a national survey of readers, of which the purpose was to determine which books had had the biggest life changing impact on American lives. And the NYT printed the results, which were these:

#1 – The Bible
#2 – Atlas Shrugged
#5 – The Fountainhead

So here are two books of the top 10 that most had an impact on changing American lives were written by Ayn Rand.

Two of her books in the TOP 10 most life changing books, and yet you will never once hear of any Ayn Rand books in school (unless you have friends that read her stuff). She’s too extreme though, I don’t agree with all her stuff. I may write a post about it one day, but I am going to re-read Atlas Shrugged before I do.

Alpine Meadows today February 20, 2007

Posted by sdpurtill in Skiing.
1 comment so far

Terrible snow. Great day. Gallery on Facebook.

Google! February 16, 2007

Posted by sdpurtill in Google.
add a comment

Dreams do come true…

I went to Google today and ate lunch. It was fun. On the way out, we saw Tim O’Reilly in the lobby — I have about 20 O’Reilly books to the right of me right now ๐Ÿ™‚

I took a couple pictures and put them on Facebook (easier than Flickr).

Check out more pictures

[Baseball] First Game of the (Pre) Season February 14, 2007

Posted by sdpurtill in Giants.
1 comment so far

I have officially gotten my first ticket to see the Giants this year!

Athletics at Giants
Friday, 3/30/07
at 7:15PM PST

Chris, Dan, James and I are all going… I can’t wait!!!

Giants games on Friday nights are officially the best way to party without doing anything illegal ๐Ÿ˜‰

SF Giants Header Images for Regulus Theme February 14, 2007

Posted by sdpurtill in Blogging, Giants.
1 comment so far

I just made a few header images for the Regulus Theme… If you’re a Giants fan, feel free to use any of them.


Baker Beach:

My View on Software and the Google PC February 14, 2007

Posted by sdpurtill in Business, Google, Technology.

There are a few things that nobody will change my mind on. And how I see software is one of them. When I say software, I am talking about desktop software and online “software” (web applications).

  1. All software should be free
    • In some situations this is not possible for big companies like Sun, Microsoft, and Oracle to sustain their profitibility if this rule was standard. The only thing I have to say to companies with these models: the Future is coming, and it’s not going to be nice to you.
  2. I believe in open systems, especially when the user is generating the content. Data is data, and shouldn’t be bound by any program, operating system, or website.
    • When there is private information that is stored, that data should be handled diferrently. SSN and Credit Card #’s are not included in my definition of free data — it is too easy for someone to hack that and do something malicious.
  3. Business models should look like this:
    • Advertisements
    • Advertisements
    • Advertisements
    • ๐Ÿ˜‰
  4. Security, security, security. This is an engineer’s #1 responsibility, everything else in an application falls below that as far as importance.
  5. In education, ALL SOFTWARE SHOULD BE FREE. No questions asked.

Those is one more thing that I have been thinking a lot about lately… Here is my prediction:

In the future, nobody is going to need to have hard drives inside their laptops/desktops. Everyone is going to have access to their own computer using Remote Desktop. Google is going to be the first company to test this out, since they are probably in the best position to try something like this. This is what computing will look like:

First off, nobody will have or need a Microsoft operating system. All the operating system on “home” computers will simply be modems that handle speeds of 100mbps, or whatever speed you want. So you will turn on your computer, and about 5 seconds after startup you will sign into your Google PC. You can access your Google PC from anywhere in the world; the only thing you will need is an internet connection, and in 15 years [insert time prediction], the entire world will be one big wireless network. Once you’ve signed into Google PC, it will load up your personal desktop. It will look exactly like your current computer does, except that it will be running on the Google OS (which will just be the current OS on their servers, but customized for useability and mass adoption). On the Google OS, you can do everything you currently do on Windows XP or a Mac (or even Linux). You can install new applications, and everything is, YOU GUESSED IT, 100% free and supported by advertisers. Speaking of great free applications, the MS Office killer, OpenOffice.org, is amazing. I already am highly recommending this application suite to everyone after using it for 3 days.

Why is this going to happen ? Because it needs to happen if everyone is going to be able to have a computer in their hands. With this new way of life, “desktop” computers, and “laptops” (all they would be is modems with a graphics card and a display) would be dirt cheap so that everyone could afford one. This, IMO, is the only way that Bill Gate’s dream of getting a PC to every person in the world, will be achieved. It’s the most cost effective way, and it makes the most sense once we have the infrastructure to support it (i.e., faster connections). And who wins out of all of this ?

Google and the Customer.

Sidenote: I’m going to Google on Thursday! I’m so excited, I would have never dreamt that this would happen a year ago… Ah, nothing as rewarding as the benefits of hard work ๐Ÿ˜‰