White boards and Goof Off

Posted by Jeff Tue, 03 Jun 2008 15:23:00 GMT

Ok - what I’m talking about is not goofing off on the white boards. Whether you do that or not is definitely not my business.

But I will tell you that if you’ve ever had problems cleaning white boards. Like, say, when your dry erase markings don’t come off…you should try some Goof Off.

The stuff seems harmless except for the fact that you can probably get high off from it (has this industrial smell to it). The smell goes away after a while, though.

We’ve been having trouble cleaning our white boards for a while. Water doesn’t really work, neither has board cleaners. So Linus tried Goof Off.

Boy - you can practically use our boards as mirrors now. Spanking clean!

As a bonus for you reading this, here’s a couple of pics of Linus wiping the boards down. The girls in the office came over to check our our boards - though I couldn’t figure out if they were actually checking out the boards or Linus’ ass. You be the judge.

no comments

Russell Peters is HILARIOUS!

Posted by James Fri, 30 May 2008 18:40:00 GMT

Last night I went to Cobb’s Comedy Club in San Francisco’s North Beach to see my favorite comedian Russell Peters perform. This was my first time at Cobb’s, it was a lot bigger than I imagined. Since I got there late, I had to settle for a seat at a table way in the back.

Russell Peters did not disappoint. I was also surprised that it was all new material, all of it stuff I haven’t seen or heard before. The man is a comic genius. Most of his material consists of ethnic jokes, and he makes fun of everyone. Chinese, Indian, Jews, Latinos, and Blacks: no one is safe, not even white people. But he did say some stuff that also made me pause and think. One such example is when he said, “I’ve always told people that I’m Indian. It’s really easy to define ourselves ethnically, but no one knows what they are culturely… I look Indian, but I never realized how not Indian I am until I went to India.” For the most part however, I was ROTFLMAO.

The audience was mostly Indian and Asians with a smattering of other ethnic groups thrown in. I found it really funny because we really responded well to the self deprecating ethnic jokes. There were two warm up acts for Russell Peters and it was a study in contrast. The first, a Filipino guy was hilarious and set the atmospheres. But the second, a white guy, told mostly really hardcore sexual jokes. That totally didn’t hook with the crowd. Most people were like “huh?” which was funnier than the jokes. I felt sorry for the guy.

But… then Russell Peters set everything right. He’s still here for the rest of the weekend. So if you’re lucky, you can still scalp some tickets (they’re officially sold out). In case you don’t, here’s a sample of his old material:

Posted in ,  | no comments

Brunch at the Top of the Mark

Posted by Jeff Wed, 28 May 2008 04:00:00 GMT

If you’ve been to San Francisco, you’d know that we have a great many awesome restaurants. Well if you know that, then it must not be a surprise to you that there are great brunch spots. I live on the border of Russian HIll and the Marina District - there’s quite a few places near my house.

Rex Cafe - with awesome ‘chicken and waffles’ combinations, The Crepe House on Polk and Washington, and of course Polker’s Gourmet burgers.

But - we dared to try something outside of our common neighborhoods this weekend: brunch at The Top of the Mark. Mark Hopkins is a hotel in SF, it’s situated nicely on top of a hill (I think it’s Russian Hill). Website - normally we’d go there at nights to enjoy a couple of drinks while surrounded by SF city views on the 19th floor.

Brunch was a totally different story. Waking up at about noon - the weather was so nice outside that we thought being high in the air would give an extraordinary view of the city. We were right.

The brunch is located at the top of the building, and I’ve never seen such a view in all of San Francisco - gorgeous bay views with sail boats roaming around as well as unobstructed views into Twin Peaks and Noe Valley.

The food? Well they had everything from Omletes to Prime Rib to Crab Claws (don’t know what they do with the rest of the crab). Our group was there for more than 2 hours - the unlimited amounts of champaign helped to get us to eat a lot more also. And we were deeply satisfied when all done - and we were barely able to walk.

This is actually the first time I’ve been to a buffet in the city - well worth every penny!

no comments

Monitoring with God

Posted by Linus Mon, 26 May 2008 18:06:00 GMT

This week I discovered a great (though very poorly named) program called God. It is a ruby monitoring gem that, as the author describes, “is like monit, only awesome”. It actually is pretty awesome because it makes monitoring scripts SO much easier to write versus monit. Plus it’s all in ruby so we can use all the regular ruby shortcuts without learning how to do them in monit.

The only drawback however is that God doesn’t not support monitoring. If you read the message boards and the blogs out there you can see that this is a feature that many have requested. However since the purpose of God is to simply start/stop/restart processes, the author of the gem has neglated to build in this feature.

I however have a work around to this problem. What you do is make a transition condition that monitors when the process is up and transitions it to a restart. The KEY here is to make sure that your restart command does nothing. For me I just have it sleep 0 which is close to a noop. See the code snippet below:

God.watch do |w|

 w.name = “FOO”
 w.interval = 5.minutes
 w.start = “sudo /usr/bin/ruby FOO”
 w.stop = “sleep 0” # stop command - HACK
 w.restart = “sleep 0” # restart command - HACK
 w.pid_file = “/tmp/FOO.pid”

 w.start_grace = 5.minutes
 w.restart_grace = 5.minutes

 w.start_if do |start|
   start.condition(:process_running) do |c|
    c.running = false
   end
 end

# Hack: GOD doesn’t currently do monitoring. Therefore we need to run a
# restart command that doesn’t do anything. The w.restart_grace variable
# is the time in between checks, since after it does this transition, it
# will requery the state of the rails app
#
 w.transition(:up, :restart) do |on|
   on.condition(:memory_usage) do |c|
    c.above = 1.megabytes
   end
 end

Posted in  | 1 comment

Bay to Breakers

Posted by Jeff Wed, 21 May 2008 01:39:00 GMT

Have you ever been to a Bay to Breakers? This is the first year that I’ve gone, and I’ll for sure be there next year.

For those B2B Virgins out there - the closest thing that bears any resemblence is a gigantuous frat party - on the streets - for what seems to be the entire population of San Francisco.

If you plan to go next year, there is quite the check list before you go.

Parts of it that I’d give mad credits to:
A) Be in a large group
B) Have a cool theme (ours’ was Team Zissou)
C) Bring lots of beer - we brought kegs in shopping carts
D) Get there early –> it’s MADNESS!

The ‘race’ - this word is definitely not accurate at all … almost everyone is walking or crawling or napping along the way when they are not doing keg stands.

Surely, you’ve heard of people completely naked and running through the streets. Let me assure you that is certainly true. There’s also tons of people on the side of the streets squirting liquids of who-knows-what into the crowd.

So I didn’t actually finish the race - and neither did most of the crowd. I ended up at some park, ran out of booze, and split from the rest of the Zissous to mark the end of a great party.


no comments

Think Weekend

Posted by Jeff Tue, 13 May 2008 18:08:00 GMT

Just got back from my Think Weekend. It was fantastic!

What is a Think Weekend? Every 6 months, I reflect on what has happened in the past half year, set goals for the next couple of decades, and reshuffle short-term priorities to align with long term goals. This is something that was originally recommended to me by my graduate advisor David Patterson. Here’s rationale behind it: In normal everyday life, we have to make day-to-day decisions such as ‘Should I go work out?’, ‘Should I go to the movies with friends?’, ‘When am I going to leave work today’. It’s very easy to get lost in the woods and loose sight of the bigger picture. Although true in school and big-company environments, it’s even easier to forget and loose sight of the mission as no one governs CLZ in starting companies to changing the world.

Think Weekends remind me of these goals and reinforces them.

As an interesting side note - a friend of mine recently pointed out that BIll Gates is someone else who also shares this ritual. Based on the WSJ, it seems that Gates does this for a whole week and reads everything about Microsoft. Needless to say, mine is much less formal.

Here’s a peek into what I did over the weekend:

I booked a quiet and cozy room in Santa Cruz where I spent most of my weekend organizing thoughts on my Mac, in the morning and afternoon, I would pick out certain topics and go to my favorite view point at the Sea and Sands Inn.

It’s gorgeous:

Agenda for the weekend looks like:

Friday Night:

-Read over notes from the last Think Weekend
-Come up with core topics to think through

Saturday/Sunday

-Reach conclusions or action items on core topics

Sunday

-Write down notes from the weekend

What are the long term goals?

1) Start a Public company by 2018
2) Save 1 million lives and reduce global CO2 emissions by 20% by 2023

After every Think Weekend, I always come back much more motivated and focused on long term goals. I would highly recommend it to everyone.

no comments

Stored Procedures in MySQL

Posted by James Mon, 12 May 2008 22:44:00 GMT

A few days ago I wrote my first MySQL stored procedure.

For one of our applications, we had to make a big database schema change. As a part of this process, we needed to populate a new table with some existing data. However, there needs to be a bit of custom logic because the underlying data representation changed.

The algorithm for this operation is O(kn), where n is the number of rows in the original table and k is a small constant due to the way the data is stored in the original table. The unfortunate fact is that the original table has 3.5 million rows. So, I chose to do everything in a stored procedure.

Writing a stored procedure in MySQL is easy enough. However, the available tools suck. It took me forever to figure out that I have to change the delimiter from ‘;’ to something like ‘$$’ for everything to work. There is no debugger and no print statements. If you write something really complicated, it’s almost impossible to debug.

But the performance of stored procedures is amazing! I calculated that if I didn’t use a stored procedure it would take about 8 hours. When we ran the stored procedure, the whole thing finished in 15 minutes. It peaked at more than 13,000 queries per second! What’s more amazing, was that the application was still live and serving requests normally during the data migration.

mysql query graph

Well, needless to say, I’ve become a fan of stored procedures, even though it was a pain to edit and debug.

Posted in  | Tags  | 1 comment

Making Custom Strikethroughs with Trac

Posted by Linus Mon, 12 May 2008 19:41:00 GMT

I am going to make another technical post this week. We are using Trac as a way track bugs in our applications. It is extremely popular which as a result makes it a pain to find information on Google (trust me, try searching and you will get hundreds of irrelevant results).

The other day I spent a considerable amount of time trying to customize the reports to the way I want them. One problem was how to create a strikethrough for bugs that were closed. Several people have asked for this on various forums but no one had a solution. I decided to write my own.

My solution was to create a new style in the stylesheet and its corresponding tag. Though I could have overridden the existing styles but I like to keep this as OEM as possible.

In /htdocs/trac.css Add the lines:

table.listing tbody tr.even_strike td {
  background-color: #fcfcfc;
  text-decoration: line-through;
}
table.listing tbody tr.odd_strike td {
  background-color: #f7f7f7;
  text-decoration: line-through;
}

In /template/report.cs add the lines:

<?cs if row.__strikethrough__ ?>
         <?cs if idx % #2 ?>
           <?cs set row_class=$rstem+'even_strike' ?>
         <?cs else ?>
           <?cs set row_class=$rstem+'odd_strike' ?>
         <?cs /if ?>
       <?cs /if ?>

Finally in our customer report:

SELECT
  id AS ticket, 
  summary,
  priority,
  (CASE status WHEN 'closed' THEN 'true' ELSE '' END) AS __strikethrough__,
  (CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS owner,
  datetime(changetime, 'unixepoch') AS Closed, description AS _description,
  reporter AS _reporter
FROM
 ticket t
LEFT JOIN
 enum p ON p.name = t.priority AND p.type = 'priority'
ORDER BY owner, priority, status

If you do this right, you should be able to see something like below:

Posted in  | Tags , , , , , ,  | no comments

How to do fast SQL Deletes

Posted by Linus Thu, 08 May 2008 16:35:00 GMT

This week, I’ll change it up and make a technical post. We ran into this problem when we tried to delete 20 million rows without bringing down our live site. A simple ‘delete from FOO where id < 20000000’ would have taken too long because the database would have to go through those rows, recreate the indices, and do all the internal SQL cleanup. Given these problems we had to do it a better way. The general idea is to:

  1. create a temp table
  2. insert the rows we want into the temp table
  3. recreate the indices
  4. switch over the tables.

The actual SQL statements is:


CREATE TABLE foo_temp (
  `id` int(11) NOT NULL auto_increment,
  `my_data` text NOT NULL,
);

INSERT INTO foo_temp (SELECT * FROM foo WHERE id > 20000000);

CREATE INDEX `foo_index` ON foo_temp(`my_data`);

DROP TABLE foo;

RENAME TABLE foo_temp TO foo;

Posted in  | no comments

Apple and Mr. Market

Posted by Jeff Tue, 06 May 2008 20:48:00 GMT

It was more than 50 years ago (1949) that Benjamin Graham published the Intelligent Investor.

I am happy to report that - as far as I can see, despite the invention of TVs, the Internet, and real-time trading, Human nature in the Market has not changed at all in 50 years and people are just as emotional and impulsive as they were in 1949. Oh - and Efficient Market Theory? - needless to say, I’m not a fan.

What Graham said: Imagine that “one of your partners, named Mr. Market, is very obliging indeed. Every day he tells you that he thinks your interest is worth and furthermore offers either to buy you out or to sell you an additional interest on that basis. Sometimes his idea of value appears plausible and justified by business developments and prospects as you know them. Often, on the other hand, Mr. Market lets his enthusiasm or his fears run away with him, and the value he proposes seems to you a little short of silly.” (Intelligent Investor p.204)

Irrational pricing of stocks? Let’s talk about Apple (Disclaimer: I own Apple). Near the end of last year, hype of the iPhone and iPod Nano launches led to an Apple ROCKET. We saw the stock go up from $122 (Aug 17, 2007) to $198 (Dec 31, 2007) in just 4 months. This was based on great sales combined with expectations that Apple will come up with a 3G iPhone and maybe snazzier Macs in MacWorld in January.

And then what happened? 1) NO 3G iPhone, and 2) the country is going to be in a recession is going to affect sales. Stock TANKs to $119 (Feb 22, 2008)

OK - so let’s take a look at these items a little closer. The issue of the ‘3G iPhone’ - it is clear to me that there is no doubt that Apple is going to come out with a second generation iPhone with 3G technology and probably GPS also. This will probably happen in June or December 08. Is Apple going to loose their competitive edge because they didn’t come out with it in ‘07? Have you played with the iPhone? That thing is an innovation freak of nature: I think it’s going to take companies at least 18 months to come up with a comparable product, the iPhone is just way ahead of its time. What about earnings? Sure, earnings will be lower than if Apple came out with the 3G iPhone, but that will only be temporary, until they get the 3G version made.

Now let’s take a look at talks of a recession. Last time I checked people who buy Apple products are well-off individuals who are buying electronic gadgets. My argument is that most people who are considering buying Apple products are not going to be impacted very much. Even if there is going to be some slipping of sales, a 40% reduction to stock price is still very much uncalled for.

I bought at 160 and kept buying as the stock tanked in January and February. Being a long term investor, I’m looking at at least a 2-3 year hold for Apple. They have the most innovative hardware personal electronics on the planet and arguably the most innovative operating system as well.

Who knows if there will be more growth to the stock price of Apple, but I’m certain that the company will continue to innovate in the decades to come.

Enjoy the Ride.

Posted in  | no comments

Older posts: 1 2 3 4