Coding on the Facebook Platform.
Posted on June 9th, 2007 in Web |
It is Saturday, May 26th. I am at home, headbanging to Breaking Benjamin, and catching NeighborFi (rare.) I’m just finding the Facebook Applications update. I look through the directory. In all nine pages at the time, I didn’t notice a del.icio.us or Flickr app. I decided that for that day I will work on developing a del.icio.us app for Facebook Platform.
I had no idea where to start. I downloaded the PHP5 client libraries, looked at the documentation, and became confused. This was the first time I was using an API for actuality. This was the real deal, the real stuff. Went to IRC to chat a bit in #randomshapes – but remembered something. /j #facebook.
I saw the topic.
*** topic is Facebook Development Platform: http://developers.facebook.com :: Wiki: http://wiki.f8.facebook.com :: DJTrey's channel stats: http://74.236.248.200:8081/facebook/
<StevenBao> This is the channel that I need!!
I was pointed to the Wiki at some point, where I educated myself on the Facebook Platform; I then went to the golden resource, a lesson by example, a tutorial on coding Facebook Platform Applications. I started reading the example. Didn’t get it at first. Didn’t get it at second. Got it at third. I store session data and usernames in my database. The only thing I really do is push data out to Facebook in the form of FBML. I then asked some stupid questions such as:
<StevenBao> does anyone know how to fix the problem of HTML tag not supported: "html"
And
<StevenBao> How do I display something on the profile page...?
<@OSUKid7> profile.setFBML
Then I remembered that I wasn’t really sure how to use my Facebook app since it was hosted on my local server. I didn’t have a PHP5 server ready, and my host (a friend) was out on vacation and couldn’t upgrade to PHP5 anyway. I decided, for the time being, to port-forward the router and get a no-ip. The only way that I was going to do that, though, was to ‘hack’ into my neighbor’s router and change the port forwarding.
Easy enough. They didn’t care to change the password for the Linksys administration. I went in and port-forwarded Port 80 to my IP on the network. Hope they don’t notice. I haven’t rolled it back yet since it bugged out again later the next day.
I then proceeded to set up a no-ip address and forward that stuff. Sloppy, but it needs to work for the time being. After a few short hours, I declared the beta of the del.icio.us app finished. It displayed the five latest links from a person’s del.icio.us account. It might have been, and should have been, alpha; I ran a slow-as-hell manual “cron” every fifteen minutes to ensure that I held my word that it updated every fifteen minutes, plus any manual updates a user may execute by going to the application page. This “cron” which turned out to update every half hour was probably the source of future, huge problems.
I submitted it to the application directory and waited, and expected a long wait. After a few hours, my del.icio.us app gained about 30 users. It blew my mind. Amazing. Thirty users. (Without sarcasm.) I then proceeded to develop a Flickr application, not intended to be at first extremely intense, but as it caused large amounts of criticism among users I decided to make it more of a developed application than it started out. The first beta required users to retrieve their usernames. I introduced this (read: linkspammed) this to two of my IRC channels, and gained a few users; then, the wireless crashed.
I was under a large amount of stress to get this stuff working. I already had del.icio.us on its own server that Anthony Cole of Fresh Pacific Media was kind enough to donate. However, my Flickr app, which I guess was gaining popularity, was offline because I was offline. I therefore went to a friend’s house as soon as possible and uploaded the Flickr application and its database to the server.
I was then notified on IRC by chips[zof] with the following:
<chips[zof]> StevenBao: well done on getting into the directory!
It was not even day after I submitted it to the applications directory, and amidst all of the others asking to be submitted, such as for Last.fm and other applications, I was submitted with my humble del.icio.us application. Not sure why, but okay! I was overjoyed. I watched the user count grow from 30 to 100.
The next day. I check. 300 users using my del.icio.us app! Amazing. However, I looked at the reviews. Errors. Stuff not showing up. Shit. I spent the next hour debugging and debugging the system. Something then happened, everything was resolved, I ran two crons for good measure.
The problem was that I as using a free DNS subdomain, and the domain was www.facebook.si. I registered sbao.facebook.si and apps.facebook.si. I found both of them deleted from my DNS account. I did an extremely quick fix, registering a .us.to and moving files over. Whew. Little did I know, though, that it wasn’t my last, nor largest crisis.
My Flickr app was criticized thoroughly. As I wanted to get the Flickr app out before anyone else, I opted to not learn how to use SimpleXML and use REST to get a username’s ID. That was my downfall. On Tuesday I was faced with a huge amount of ‘criticism’ (or better said, that it didn’t work), more than I could take, and I then took an hour to rewrite part of the system to function correctly, and then placed quite a number of todo items on my plate.
However, before that, a large crisis arose when I was on a 1.0mbps no-signal WiFi network. The system suddenly stopped working. FBML was working. My server was working. I tested and implemented a new parser for data. No luck. I went back to my previous parser and tried another data source. Worked. I was forced to come to the conclusion that del.icio.us blocked me from accessing their data. This is while I have about 700 users using this app. Not good.
In the little time I had left at the other friends’ house, I quickly hacked together a sort of proxy to access del.icio.us and eventually be banned from it altogether by my other server. I noticed that Joshua, the founder of del.icio.us, friended me on Facebook, and was using my del.icio.us app. Maybe he knew del.icio.us blocked me. Maybe not. However, the truth of the matter was that I hacked together a few lines of PHP that connected to a MySQL database with columns id (serialized), delicioususername, datastream, and requestnum, and every five requests requestnum was set back to zero and the del.icio.us server was asked for the data again. I called this my megacache; I used it once to update my del.icio.us links on Facebook, it worked, I jumped for joy, started to run a cron, but then the wireless disappeared.
I had nothing else to do but to ask another friend over phone to post on the del.icio.us app page that the problem should be fixed as of now.
Next day. TV/Video class. I log in to the other server’s cPanel account, and check my bandwidth. 500 megabytes of bandwidth was used by my application in eight hours alone. Astonishing. I check the number of people that are using my application. 1300 for del.icio.us. 500 for Flickr. Wow. I did a quick SELECT * FROM cachefiles WHERE requestnum > 0. Nothing. I didn’t even store anything into MySQL. Damn.
I then proceeded to finish an email I was writing to the founder of del.icio.us, which was at finishing point somewhat stubborn-sounding (though the negative connotations were not intended) and at nine full paragraphs. Later that afternoon I sent it to him, feeling bad for the founder because my email was so damn demanding-sounding.
Then I updated the Flickr as explained above, then stopped Facebook apps for the day. I had enough for Tuesday, even though only one hour was actual coding.
The next day. The founder of del.icio.us emails me back. He states that he can manually unblock my system from contacting del.icio.us data sources. He also stated that del.icio.us was building an offical Facebook application. That’s what I’ve been waiting for. An official application. I never expected that my del.icio.us app would be permanent; like other 3rd party apps, I anticipated it to be a temporary one. Nor did I expect it to gain such a huge response. I said I’d be happy to cooperate with him.
This was my first time managing a relatively large-scale project, and it was an excellent experience. I don’t really know what my motive is for creating this application, but who knows? That’s not the matter now; it’s not so much the matter of why one created something, but the response ensuing.
2 Responses
Facebookster - We can provide a full range of facebook application strategy, design, development and marketing for your business. Facebookster
<ahref=http://www.facebookster.com”
these trees beech log. we just as proud playing wasn’t at I thought natural reaction else and we