Saturday, November 13, 2010

Boxee first impressions and cutting the cord

[UPDATE]: after playing around more with it, I realized that there really isn't an easy way to pull down the shows I want, and since Vudu is broken, there is no way to get new movies either. I still like it, and will choose it over TW Cable, but the way it is now, it is not for everyone.

Its finally here! My Boxee box came in the mail yesterday - good job Amazon, only took 2 days! - and I got to set it up and play with it.

I heard about Boxee and their plans to release an actual hardware device for a while, but was skeptical, since being a programmer, I can build one from parts from Newegg and put Linux on it. Then, I went to the Boxee box NYC launch party, and I was sold. These guys did exactly that - got some hardware parts and slapped Linux on it - only they got very nice hardware parts and they actually wrote a great piece of software to sit on top.

First of all, it really is smaller than you think. It also has a nice, dense feel to it. It looks like some Dali-esque melting cube, so my TV counter just got slightly more awesome and avant-garde.

The hardware itself is very impressive. Everything I played from the internet or from my media server did not lag at all.

The box has 2 USB ports, 1 HDMI, 1 GB Ethernet, WiFi, S/PDIF sound output and regular RC sound output. There is also an SD/MMC slot on a side. There is much more about the hardware here.

My reason behind getting Boxee is to "cut the cord" - get rid of Time Warner cable which has been gouging almost $200/mo (1 Boxee box) from us for 4 shows and occasional movie that we watch.

With that in mind, here are some thoughts as well as some pros and cons and how they compare to their monopoly-operated counterparts:

The Remote.
The remote overall is very good. It has a good feel to it, the buttons offer just the right amount of resistance when pressed, and its significantly smaller than our TW remote - which is impressive considering how much more you can do with Boxee than with our cable box.

Pro: Fully RF Remote. No matter where I point it, it always works! TW remote sucks. And we keep loosing the battery covers. (Boxee uses a CR2032 battery which slides inside)

Con: Fully RF Remote. Half of the time I have no idea which way I'm pointing it, so I keep hitting Pause button instead of Menu and vice versa.

Big Con: Remote has no volume control! -- I am slightly stupid, so I didn't realize that you can press the Up/Down main nav buttons during watching to control sound. RTFM eh.

Con: The QWERTY keyboard is on one side, and the menu and pause buttons are on the other side, so often when I typed I would hit menu or pause. Not really a big deal, but can be a little annoying.

The Software.
The software is very responsive, there is never any lag, except for when something needs to be pre-buffered from the net, and TW Cable cannot even compare in features.
The best feature in my opinion is apps - there is everything from YouTube to Pandora to YouPorn (you can enable/disable adult content and put a lock on it)

Huge Pro: When I added my media server network share, Boxee catalogued the videos and presented me with a list of DVD covers, ratings, and movie info! That is truly awesome.

Pro: The RSS Reader app has MiroGuide in it - Miro was my previous choice for cord-cutting.

Pro: Compared to TW Cable, the Boxee software FLIES! TW Cable is always slow, and often our TV screen will just go blank and say "Please Wait...". Please give me my money back, jerks.

Pro: Supports multiple Boxee accounts, with their own Facebook/Twitter linked accounts.

Interesting Pro: You can point box's syslog to another location.

Huge Con: Vudu did not work. It says "coming soon" and yet at the launch party I've see it work. I did the software update and that did not help.

Huge Con: There is no easy way to watch the 4 shows which I pay so much money for - Weeds, Dexter, True Blood and Boardwalk Empire. Presumably you can find them online and play them through the Boxee browser, but I wasn't able to find an easy way to just search and play. Also, Netflix and Hulu should be coming soon, so hopefully this will become easier.

Huge Con: There is a movie list, but most things are either obscure or some sort of student shorts. This of course can be great, because you can find things you never knew existed, but I do need my blockbuster fix here and there too.

Con: Cannot tell if something I'm about to watch is in HD or not. For some reason, most TV shows I tried weren't.

Con: The box asked me if I want to get suggestions from Facebook/Twitter, I said yes, but as always, suggestions are hard - all i saw were suggestions by my Boxee friends - not some sort of AI-driven, natural language processing, social network scraping uber-suggestion bot. I guess may be in the next version..

The Box.
The design is absolutely awesome. That said, it could really use a clock on it, especially if since I'm going to be throwing out my cable box which is the only way I can tell how long I've wasted on watching TV.

Con: No clock!

The content available mostly sucks. If you just want TV shows, without Vudu, Netflix and Hulu you're kind of screwed for the moment. However, for me - cord-cutting FTW! I don't mind going the extra step to find the content I like, and I do enjoy all the indie content from around the web. Boxee isn't perfect (yet), but its still better - and cheaper - than TW cable, if you have my viewing habits.

Tuesday, November 9, 2010

Short PHP script to manage subscription to Facebook Realtime API

Facebook Realtime API allows reacting to changes in a user's profile in near real time.

In a nutshell, every time a user changes their friends list or their feed changes (or a number of other fields), an event is generated and transmitted via HTTP POST to a designated URL, where the change can be acted upon.

To facilitate this communication, you have to be subscribed to the changes, as explained in the API guide. I was playing around with the API last couple of days, so the first thing I wrote was a simple subscription manager in PHP.

Here are some examples:
Subscribe to 'feed':
php facebook_realtime_register.php -i [app_id] -s [app_secret] -c -t [verify_token] -a post -f feed

List active subscriptions:
php facebook_realtime_register.php -i [app_id] -s [app_secret] -a get

"data": [
"object": "user",
"callback_url": "",
"fields": [
"active": true

As it is now, I think the API is lacking. The biggest problem in my opinion is that the actual notification does not contain an ID - so if my friends list changes I cannot be notified with ID's which changed, or if my feed changes I cannot easily get the ID's of new posts.

The other limitation are the actual fields which you can subscribe to - currently, the interesting fields like 'posts', 'photos', 'videos', etc cannot be subscribed to.

Promising, but boring for now!

Saturday, November 6, 2010

Short rant on why you do want to hire top programmers (and pay them well)

Someone asked me recently why should anyone hire great programmers and why good software takes time to build. Here's my answer. 
(Disclaimer: It may sound like I advocate only hiring college grads. I do not. Just good people.) 
Twitter does the simplest thing possible, yet they hire CompSci graduates from Yale and Stanford. But why? All they do is show a 140 character message!
The reason why is because when you start to explore relationships between data - who follows who, how someone's post triggers other posts or new friendship requests - you get into classical computer science problems, which require mathematics to understand and computer science knowledge to be able to solve.
When those problems are small scale, like 10 users, anyone can write that software, because they don't have to respect computer science and  math behind those problems. When those problems are scaled to hundreds of millions of people - or interactions - you need to know graph theory, searching and sorting algorithms, understand control theory, genetic algorithms and operating system design - the list goes on.
Then there is the actual craft of software engineering - patterns, right algorithm choice for specific situations, code reuse, Bugzilla VS Jira. Sometimes mergesort really is the answer, and PHP is a better choice than Erlang. Sometimes not. These decisions can only be made through experience, and cannot really be learned.
Also, every software we use - a database or an operating system on a web server, or a programming language - will always take years to master, and since they always change, you can either keep up and keep your mastery or slide off the edge into obscurity.
You want creativity - people who can push the envelope and even improve existing theories and practices since they face unique challenges.
You want awareness - people who understand a complex system but also understand the reason for the complexity.
You want passion - which isn't just coding on your own beyond 9-5. Its more important to truly enjoy this 9-5 you are putting in for *me* than to just wait so you can get out from the office and go work on your own video game, and have me simply pay for your rent and pizza.
You want top people writing your software because thats what Facebook, Twitter, Google, JP Morgan and NASA do, and those people develop top  products, which change the world.
And when you finally get the right people, you need to understand that no matter what you just put up on that whiteboard for the next release cycle, chances are you will change everything 2 cycles from now. Because realized ideas and resulting data feed each other that same essence of evolution that drives our species forward. 

Thursday, October 28, 2010

Hotlist for Android

@gena01 pointed me to a new Android app called Hotlist.

I will start by saying that Hotlist is awesome. Hotlist is the ultimate event finder, using Facebook, Twitter, Foursquare and Yelp as its data sources. The best - or at least most hyped - feature is the boy-girl ratio for a given place or a given event, so you always know what you're getting yourself into.

That said, the implementation on the Android, at least in this stage, is lacking in My Humble Opinion(tm)

Main Screen
The app starts by asking you to log in to Facebook. Hmm, what about Twitter? Or Yelp? Or Foursquare? I guess the app uses those data sources as something non-personal? OK, let's play along.

I log into Facebook, and am presented with a very clean UI saying "Friends", "Places", "Events", "Alerts" and "Favorites". The default is "Friends" and it shows current events your Facebook friends are attending.

If I click an event on that list, I am taken to a place which lists all 715(??) people currently there (I clicked UCB). Or were there. Or may go there?.. Not sure about this one..

But it does give me a button to see which one of my friends are currently there as well as female/male ratio, the "Place Detail", "Tweets and Reviews", "Directions" and "Check In" buttons.

Tweets and Reviews are a dump of Yelp data about the current venue - I have not seen any actual Tweets yet.

Check In is a generic (wow Foursquare, you made that one generic already : ) UI to check in and notify your friends. I checked in - sorry for lying, but i have no idea where that lie went. No trace of my check in on Foursquare, Facebook, or Yelp. I guess I'll find out as my affair with Hotlist continues.

So far so good. Next, I click on "Places". I get a list of places around my neighborhood, which is your standard mix of bars, restaurants, night clubs and other sinful New York type of places. Clicking on any place brings up the same screen as before, with the ratios, details, check in, etc. Tweets and Reviews is still just Yelp though. Hmm.

Next up, "Events". This one is interesting - I get things like University of Chicago alumni reunion free drinks, some people's birthdays, some plays. No idea how this is pulled - Facebook crawl may be? The event detail screen is just like the place detail screen - much assumptions about the database layout were made in my mind pretty quickly on that one. University of Chicago seems to have male to female distribution very close to real world distribution BTW..

"Alerts" has a field called "Recommendations" - intriguing, but there is nothing there. I would think this would be the most useful - and most daunting to implement - feature to have in an app like this.

If you're still reading this, you win a prize in a form of me talking about what I think is the coolest feature this app has - "Favorites".

Favorites has two buttons - "Add a Venue" and "Add a Friend". They do what they say, and once you add your friends or venues, you can click on them from that list and see all the cool stuff that goes on in lives of people and bars/restaurants. Sadly though - and this is by far the biggest "sadly" of this software - this feature is broken. I "added" about half a dozen venues, and the app told me I did indeed do that, yet none of them showed up in this list. Out of all the people I tried to add to my friends list, only my wife made it. We will never know if this is a statement of support of fidelity or just server errors. Also, my friends list only loaded the first 15 or so people, and some of them loaded with no names.. Those shady weirdos.

There is also a "Search Friends" button in main menu, which seems to be the only way to really add friends to your favorites list, but it also has some problems - it asked me if i wanted to add the friend, and then asked me if it should remove them or keep them - all in a sequence of modal windows I had to interact with.

Clicking on my friend's detail page was fascinating though - many interesting events to attend in a palm of your hand and not on Facebook's mediocre events UI.

So, overall, this is an awesome idea for an app. But if the "Favorites" is flaky, and recommendations cannot be picked up from accessing my profile, and there is no way to tie in my Foursquare, Twitter and Yelp profiles - I would think this app has some bug fixing milestones to go yet.

Get it anyway, ride the wave!

Monday, June 14, 2010

Symfony config server

The other day at work, we implemented gearman for doing certain expensive data updates in the background. The workers are written in PHP and run as daemons, and our app calls them with PHP gearman client's function doBackground()

We also use Symfony, which in turn uses YAML for its configuration information. Our gearman workers need access to a bunch of config variables from symfony app.yml files (we have multiple applications/environments for our app).

It could be done by either using Syck within the PHP workers, or by sourcing Symfony framework and using sfConfig::get() calls. However, this doesn't work very well if gearman servers and workers live on a separate set of machines, and so in my continuing effort to learn more Python I wrote a simple config server.
Its very simple - all it does is daemonize itself and listen on a socket you specify on command line reading app.yml parameters from a symfony path you specify, so in our case each web server runs the config server, and PHP workers connect via TCP workers to read the configs needed.

To get a config value, all you have to do is open a TCP socket to the config server and issue something like:
All data is returned in JSON format.

You can also switch environments and apps by issuing commands like:
By default, the app is frontend and env is prod.

To start:
python -l -p 1025 -s my_symfony _app

[root@hydra ~] # telnet localhost 1025
Connected to localhost.
Escape character is '^]'.
{"secret": "xxx", "apikey": "yyy", "type": "web", "canvasurl": "\/myapp\/", "appid": 1234}

Another way of doing this is of course to pass config parameters to the workers themselves when calling them from clients, but that would be too boring : )

I tested it with Symfony 1.0 and I'm pretty sure it would work with any 1.x release.
If you actually use something so obscure and find bugs in it, let me know or just fork and fix!

Friday, June 11, 2010

Facebook now wants your personal - really personal - data to create apps

So I went to create a facebook app today, and facebook told me that I must verify my phone number or add a credit card. Blow me facebook.

Tuesday, May 11, 2010

Gearman PECL package on Ubuntu Lucid Lynx oops

So I tried installing gearman today on Lucid.

To install it, i used this command:
aptitude install gearman libgearman-dev libgearman-client-async-perl libgearman-client-perl gearman-tools uuid-dev

Afterwards, tried to install the gearman PECL package:
pecl install channel://

And got this error:
/bin/sed: can't read /usr/lib/ No such file or directory
libtool: link: `/usr/lib/' is not a valid libtool archive

After some googling, it turns out that .la files are now gone from many packages, as per this post on debian-devel list. Couldn't really find a good solution for this, so here it is:

Open /usr/lib/ as root, and find a line that says:
dependency_libs=' -L/usr/lib /usr/lib/'

Replace it with:
dependency_libs=' -L/usr/lib -luuid'

Now run the pecl install again and you should be good.

Some more background info:

Hope this saves someone an hour..