Learning by helping

Woops, almost forgot to post tonight - it's 7AM who can blame me? Thanks to the wonders of the iPhone WordPress app I can write this short and sweet blurb as I drift asleep in the comfort of my bed.

Today I was reminded of a very valuable life lesson - you get just as much out of helping someone as they get by being helped. I'm sure there are plenty of studies or philosophers out there that can point to how or why being a teacher actually helps you learn a subject better but here's a little anecdote from my life earlier today (er yesterday).

I got a tweet two nights ago saying the site wasn't working for them. I stayed in touch trying to figure out what was wrong. Unfortunately I had to leave the situation to get a precious 3 hrs of sleep before an exam I had to take. But after I woke up I continued to work on this persons case (@thesraid whose twitter handle is escaping me right now).

I looked, couldn't find his name on the database, then looked and couldn't find his oauth id. He told me maybe it was because his name had an apostrophe in it. I thought I had taken care of that problem with my mysql_escape_string calls but I looked at where the problem could lie.

Turns out there was one function (which believe it or not was the crucial function of registering a user) that did not call this. So I added it (also apologies to everyone else that suffered because of my mistake) and thought nice done. Good to go.

Wrong. More problems. Now his page wasn't loading. Looked through the source, and realized he was making it into the database now but when getting his named called to the page it broke the JavaScript because of his apostrophe again. So I called addSlashes and things worked like a charm. After things got fixed he thanked me and told me about how one time an envelope was addressed to him (John O Undefined Character String vs John O'Riordan insert funny name here later when I can remember).

Basically, I could have spent some previous hours preparing for either of my Midterms or sleeping but I knew it would be valuable to help out a user with a mistake I made. Turned out I learned something and got another user successfully registered!

I am a firm believer in help out as much as you can and you wont be disappointed. Glad I won't have to flip flop on that anytime soon.

WhereMyFriends.Be up and running! Finally, I can sleep

Let's make this post quick, since I would like to get some real sleep... WhereMyFriends.Be is finally up and running for good (at least so it seems...)!!!! Thanks VERY VERY VERY much to a Paul from Rackspace who helped me figure it out after several support staff members over the past 72 hours have just thrown me in several directions. Paul, you're a boss. Fortunate for me, he had just finished creating data structures for a very similar purpose dealing with the Facebook API and had a lot to offer. Basically he told me:
  • Facebook/MySQL likes short bursty queries over long ones
  • Ints are greater than strings
The latter really saved the day. The biggest change he helped me make was changing the oauth ids to bigints rather than the current text in SQL and also indexing this. This made everything load at SUCH a faster speed. 100X better than originally, and at least 1000X better than the slow crappy times! K maybe exaggerating a bit. But yeah. I believe this is our solution to keeping up a stable site for thousands of concurrent users. I will wake up in about 14 hours (longer if I'm lucky) and hope to see things going just as smoothly as I left them.

Blood, sweat, and tears - Mashable certainly tested our resolve

[caption id="attachment_101" align="aligncenter" width="745" caption="source: my heart and soul"] [/caption] Boy was it a rough couple night... but a great one which I will remember forever. Feb 24 12:15AM - On my way to start doing my homework. As soon as I sit down in the study room, Dan Shipper calls me "We're on Mashable!" I'm stunned, don't know what to say and he tells me to come back to the dorms so we can work. I run over as fast as I can. 12:30AM - I'm back in the quad done dancing around in glee with Dan. We realize, we need to get cracking. Our servers at GoDaddy are getting hit hard. We thought it would handle it, but clearly the virtual dedicatd server was not enough. Dan called up Rackspace, got a Cloud Site squared away, and we began to migrate. 1:00AM - We decide it's worth it to take down the page rather than letting it load poorly for people. So we put up a landing page, and let the migration begin. We finally got a hold of Ajay (where the hell was he?). Ajay helps us wit PR. 1:30AM ish - Our cloud site was up and running! Dan and I were so happy! This was one of our emotional highs. Everything was working smoothly, we were getting hit with traffic at unimaginable loads, but we were handling. We though smooth sailing. So we just thought we could spruce things up a bit, fix a bug here and there, calm down the fire of people that had seen the site down and go to bed. We were wrong. 1:30AM - 4:30AM - Happily responding to tweets, facebook comments, Mashable comments while watching our traffic and user base grow. Through th night we saw user benchmarks hit 1K, then 2K, then 3K, 4K, and by the end of the night (er early morning) we see 5K! Also, Dan and I are busy fixing bugs and making features more robust for users. 5:30AM - Ajay heads to bed. As soon as this happens, Dan and I sort of realize, something is wrong. Things are slowing down significantly for loading the profile page. We expect that it must be something to do with our database because the code was basically unchanged through the night and traffic was consistently high so that was not the big difference. The only thing we could think of was something going on with more and more data being logged into our database. I mean, this was good, but it also hurt our speed - so we though. 6:30AM - We continue to look through our code to see if there are any MySQL calls that are just looping or something extremely inefficient. We catch a couple small things but don't see anything that could really make that much of a difference. We see some calls taking as long as 30s from the webpage, when earlier that evening it took only 2-3s...what is going ON??? 7:00AM - We decide to try logging the times it takes to go through each function that was called to see if it really was our SQL database. 8:00AM - Call Rackspace again, finally they discover it is not a CPU or RAM deficiency from our Cloud Site server but is instead long queues to our database because our site is data-call heavy. We continue to look through our scripts because they claim there is nothing we can do but to wait and let the queues clear out. 9:00AM - We have to head to class and so we need to make a choice: keep WhereMyFriends.Be up, or take a down. We had to choose whether we wanted to leave a sub-par, slow product up that would probably still pick up traffic, or take it down and possibly close off this window of opportunity for virality from Mashable. We eventually chose to take it down. To me, the choice was simple because you never release a product you know not to be the highest of quality. We didn't need artificial growth/hits, but instead wanted to make sure people knew we only produce great stuff. So we ended up using MailChimp to put up a nice apology letter, with a chance for them to sign up and see the product when it was up and running again. Then I had to start the day...In between classes and such I was running around checking to make sure our landing page didn't crash (I figured it wouldn't but...who knows sometimes) and seeing what I could do to make the SQL queries faster. I immediately got some great advice, thought of how to implement it, and started doing some of the coding while sitting around waiting for class to begin. I also made sure to help cool the fire online with all the hits going to our site, but nowhere to go from there.  Then at about 12PM Dan tells me we got on CNN! We were down at the time but it was still exciting! But now there were more angry/confused comments to respond to and quel. After finishing some homework that was due the next morning, I met up with Dan again to start coding. I was introduced to a new method of parsing the friends. Before we were sending off 20 friends at a time to get back 20 (or however many revealed their location) locations. I would figure out if those friends were in our database or not, then I would send them on different paths there. In my new implementation, after getting some advice, I parsed the friend list immediately into what-is-in-our-sql-tables, and what-do-I-need-from-FB. That made a big difference in terms of time, and along with other tweeks we thought our code was solid. We were just waiting on Rackspace to migrate us over from Cloud Sites to more powerful and scalable, Cloud Servers. After we did that, migrated over, things seemed to work fine. Mind you it was around 4AM at this point. We had run into several issues along the way, such as DNS mis-pointing, private/public IP misdirecting, SQL fails, and every other migrating issue you can think of. Surprisingly though, the new untested code that parsed the friends data in a different way and sent them on unique tracks worked with almost no hiccups! I was pretty proud. At 5:30AM, we figured everything was pretty much in the clear. We did more cleaning up, some more bug testing and phew. Up and running. Sleep. Wake up, things are good. Go to class, get out of class. Boom. Down again. I had a meeting to go to, and Dan said he was taking care of it so I trusted him to get it fixed. Rackspace told us, there really wasn't much they could do, so we put up the landing page again. FAIL. Jeeze I was mad... So now for the past several hours, Dan and I have been implementing memcache and seeing what else we can do to make things more robust and lightweight. I think we're pretty much done, and just have a few small things we need to tweak. But we should be ready to release tonight. By the way, Dan is in NYC tonight at a concert so if sh** hits the wall...I'm all alone. This project has probably taken up literally half of my life this week. But it's been worth it. Through all the good, and bad, and worse, and better, and best, and etc etc, I've learned a lot and know a lot about what to look out for and do next time I strike gold again (which hopefully is very soon).

Blog got on Wall Street Journal (blog) - so cool!

[caption id="attachment_92" align="aligncenter" width="602" caption="source: blogs.wsj.com"] [/caption] My post on the inspiring words of Jack Abraham got mentioned on Wall Street Journal's blog! So cool. It was posted under their "Must Reads" for the week. I would have to agree - for any entrepreneur/aspiring entrepreneur it is a must read. Hopefully this will drive people to the cool new project Where My Friends Be, but if not this is so awesome.... should I go celebrate now or something?

Early Morning Crisis Averted

Alright. Here's basically what happened. We finished the product at around 6:30am. At about 7am I headed to bed. At 7:30am I got a frantic call from Dan telling me that nothing was working. It turned out that somehow Facebook had deleted our app from the Developers thing and we had lost the ability to use the API key and secret. We had to quickly create a new app as fast as possible and rewrite some configuration files on the site to make it all work. It was up and running again by 7:45 and so it was fine. We ended up getting 8 upvotes fr Hacker News and got as high as 20th position on the first page! We also got a couple hits from StumbleUpon and some upvotes on Reedit. Things are going well but not as good as hoped. The issues in the launch, I feel, were a big inhibitor in maintaining first page position on hacker news which would have been golden. Instead bugs caused chaos again. Every time we tighten up security and bug control but there's always something that slips by. So we'll just keep getting better with experience. Or release it at a time when we'll be awake to make changes during crucial moments...

Where My Friends Be??? Late night/early morning success

So... it's finally done! With no more than 3 hours to spare for some sleep. The wakey-wakey, class, practice, and homework! Yay for another long week. Hopefully though it's worth it. Where My Friends Be is a mashup of Google Maps and Facebook where you can see a map of all your friends around the world. This project was a fairly simple concept, no hard coding problems, but we (Dan, Ajay, and myself) think it has some potential. To the little users we've shown so far they've all loved it. Let us know what you think!

Google Maps API Shuts Us Off!

Last  night, I coded up this really cool idea into a very simple and kind of gross looking UI using the Facebook Graph API and Google Maps API (geocoding etc). The idea is you get your Facebook friends and then locate them all on the map, with you as the center to see how cool/wordly you are. Dan and Ajay thought it was cool so we started to work throughout the night to make it faster and sweeter looking. After getting it to load much faster and getting very close to the finish line...we suddenly got hit with a bunch of errors. After spending a good amount of time crying, screaming, etc, we realized Google Maps had an API limit and had to stop for the night. We are gong to wait until the hold is lifted and if it isn't lifted soon, we'll have to use our other servers to route Google API requests.