Here's an excellent presentation from Natalie Downe which she gave at BarCampLondon08 which I sadly had to miss.
I love the way she's thinking about really how to structure her CSS - its something some of us do, but not all of us, and not enough.
CSS Systems
is exploring all the cool places he's going to visit in NZ on Google Earth. Its like being here. But more rubbish.
My preso to the BBC's Semantic Web interest group
Installing the Facebook Open Platform
Facebook is cool. It's a little past its best now (it may be seen as 2007's YoYo) but the technology underneath it is proven, scalable and solves many of the problems any site wanting to introduce some 'magic social dust' contains.
Now, Facebook have released their Facebook Open Platform. This looks interesting. Not sure what I can do with it yet, but its a nice thing to start messing around with - particularly the FBML and FBJS implementations - FBML especially as it's a lovely thing which we can use for all kinds of simple site layout things.
It wasn't totally easy getting it up and running, but here's my method which you're welcome to follow if you'd like.
Background
I'm running Apache on CentOS with PHP 5.1.6 already installed and working with Apache. In this tutorial, I'll assume you have:- Apache 2+
- PHP 5+ working with Apache
- CentOS
- FTP/sFTP access to your server
- command line access with sudo permissions where needed (for restarting Apache and editing
httpd.conf
for example) - MySQL 5+ working with PHP
Getting Started
- Grab the code from Facebook: http://developer.facebook.com/fbopen/
- Unzip
- FTP to your server and create a folder in your webroot like 'fbop'. This will be where your instace of the platform lives i.e
http://www.example.com/fbop/
- Upload the contents of the 'html' folder in the unzipped fb-open-platform folder into your new 'fbop' folder on your web server. If you now go to
http://www.example.com/fbop/fbopentest/fbml.php
you'll see a ton of errors. That's okay, we'll fix them in a bit. - Now, choose where you want your facebook open platform libraries to live. Sensibly, this will be away from your webroot, but with all your other php libraries. I've chosen /var/www/fblib/lib. Go ahead and create this folder and upload the contents 'lib' folder from your unzipped fb-open-platform folder.
- /var/www/fblib/lib/
- api/
- common.php
- core/
- display/
- .....
- /var/www/html/fbop/
- api/
- canvas.php
- common/
- fbml/
- fbopentest/
- js/
http://www.example.com/fbop/fbopentest/fbml.php
Configuring Apache
Facebook have been a bit wierd and rather than telling PHP where to look for includes like most apps, they've set a custom Apache variable which PHP then uses to find some files. This isn't easy info to find out by Googling, but its very simple to implement.- Open your
httpd.conf
file. - At the bottom, or near your other non-standard config changes, add the line...
SetEnv PHP_ROOT "/var/www/fblib"
- This sets a new variable constant in Apache called 'PHP_ROOT'. From within PHP this is now accessible using the
$_SERVER["PHP_ROOT"]
variable. The lack of this variable being present was that cause of all those errors we've been seeing. - Restart Apache. For me on CentOS, this means running
$sudo /sbin/service httpd restart
- You should now be able to test if this has worked by creating a new PHP file, and adding (inside you php braces, this line...
print_r($_SERVER);
. Opening that in a browser will list all the server variables available to PHP. Magically, one of them should be PHP_ROOT with the value you specified earlier. This is good.
http://www.example.com/fbop/fbopentest/fbml.php
will give us no errors! Sadly it won't do much else.Configuring the database
Just like Facebook itself, running apps on the Platform requires the Platform to keep a list of all the applications running on it. In the Open Platform, this is held in a MySQL database. Helpfully, they provide you with enough data to get you started, you just have to load it into MySQL.- Connect to MySQL using your favourite client - I'll use phpMyAdmin
- Create a user which which we'll give to the Platform so it can access the database
- In the SQL Tab, copy and paste the contents of the file
/fbopen_data_dump where fb-open-platform is the archive you downloaded and unzipped from Facebook - Run the Query
Now we have to configure the Platform to talk to the database.
- On your web server, edit a file in the fb open platform lib directory - in our example, I mean this file:
/var/www/fblib/lib/core/init.php
- Change
$DB_USERNAME
to match the user you created. In my case it was 'fbopenplatform' - Change
$DB_IP
to match IP address of your database server. In most cases, this will just be 'localhost' - Change
$DB_PASSWORD
to match the user's password you created earlier. I'm not going to tell you what mine was ;-) - Save the file.
Hold up. You with me?
Before we go any further, lets test that the basics of the facebook open platform are up and running. In a browser, go to your http://www.example.com/fbop/fbopentest/
folder. You should see a nice list of test file we can use. At present, the most interesting one is http://www.example.com/fbop/fbopentest/fbml.php
. You'll see that it loads, and you can see all the code if you view source, but its not parsing it into HTML from FBML. That's because we haven't installed the FBML parsing libraries yet!This is a little more tricky for the novice as we're not messing about with PHP anymore - but proper unix and C++ stuff, but lets have a go. I would however, ensure you have a backup of your server or virtual machine. If this screws up, it has the capacity to ruin your install of a number of other things as Sean B discovered.
Installing the FBML Parser
Back soon to finish this off.
How to Quit Twitteriffic
Twitterific rocks. Its simple, cool, and once you have Growl installed, its not as annoying. Still, sometimes it goes wrong and you need to quit it. This isn't obviously apparent as applications which sit in the menubar don't show up in the Force Quit menu (which you get by pressing Apple+Alt+Esc).
Normally you can quit Twitterific using the Quit Twitterific command in the 'spanner' or 'wrench' menu - i.e. Settings.
But, when Twitterific crashes, or any other app for that matter, you need the Activity Monitor. For those of us who are new to Mac OS X and come from Windows, thats the same as the Task Manager you can get by pressing Ctrl+Alt+Delete. In a Mac, its a standalone app. Search for it in Spotlight: "Activity Monitor".
There, you can find all the services running, including Twitterific, and close it there.
More on Grids
The more I read about this subject, the more interesting it becomes. Try this presentation by Khol Vlnh at SXSW Interactive last year. Well, that's why we use grids.
Then try Mark Boulton's post about Blueprint. Not sure I agree with all of this tho (as per my previous post).
And then theres this.... http://webpatterns.org/. Its not there yet, but looks very cool.