I wasn’t incredibly happy with the movie synopses I was getting from IMDB. They’re generally pretty crappy. I went looking around to see if I could scrape the Netflix synopses, and lo-and-behold, Netflix has an API!
In another open source project I’m working on, I have a need to learn GTK+. So I figured the easy way to learn GTK+ was to start with php-gtk. It’s more-or-less a replica of the gtkmm OO interface, so I set out to update my little movie categorization script with a GTK+ interface. After learning the ropes, I finally have a nice interface that queries Netflix and returns all of their data for display.
This is what I have so far (keep in mind this is all in PHP):

When you click on a movie in the list, it queries netflix and fills out the description pane. So far it’s really simple, but hopefully I can use this to generate something that will categorize movies specifically for a uPNP client. I can’t put any source code out yet since I’m not too sure how the Netflix API deals with publishing an app. Right now, it has my personal developer key hard coded, and I only get 5000 queries per day.
Here’s a video (and of course, you’ll need Firefox 3.5):
eric General movies, PHP, programming
Yahoo’s performance docs and Google’s page speed best practices recommend that both external and inline javascript code is minified. Two popular tools for minifying JavaScript are JSMIN and YUI Compressor.
I needed to have an efficient solution that can minify javascript on the fly. Unfortunately these tools do not work because a process would need to be forked every time minification needed to be performed. In PHP, one possible solution is to use jsmin-php, but again this is a very slow option. jsmin-php is written in PHP code and parsing a JavaScript file in PHP is relatively slow.
So I decided to develop a php extension based on jsmin.c developed by Douglas Crockford. It creates a native PHP function included as a PHP extension (written in C as opposed to PHP). The speed and efficiency improvement over jsmin-php is over 25x!
Try it out!
Get it here
Install instructions (make sure you have development tools installed as well as PHP and its development components):
tar zxf php-jsmin-1.0.tgz
cd php-jsmin-1.0
phpize
sh ./configure
make
make install
(optional) in php.ini add the following line: extensions=jsmin.so
Sample code:
if (!extension_loaded('jsmin')) {
dl('jsmin.so');
}
header('Content-Type: text/javascript');
echo jsmin(file_get_contents('my.js'));
I hope you find it useful.
igor General, PHP jsmin, PHP
I rewrote the online dictionary section of the website to make it a little prettier and easier to use. I came across a WordNet SQL file which allows for much better manipulation of the data. Originally, I had used the WordNet software to export everything and just scrape it into the database (back in ‘98 or so). This SQL import file actually keeps the relations intact from WordNet’s prolog format.
Read more…
eric General PHP