Articles

Installing, Configuring, and Using the XHP PHP Extension by Facebook

Authored by Calvin Freitas on February 10th, 2010

Facebook announced the release of XHP yesterday. It is an extension for PHP which provides enhancements to the PHP language syntax and gives the language some convenient capabilities.

In this post I will provide you links to the essential sources of information about XHP, show some XHP sample code, and discuss the installation process for XHP on Ubuntu with Apache and PHP5.

The Essential Information
Download XHP at GitHub
How XHP Works
Building XHP
Configuring XHP

Example XHP Sample Code (View Code in Action):

<?php
require_once('/home/cal/facebook-xhp-290b185/php-lib/init.php');
$name  = 'Calvin Freitas';
$title = "{$name} loves XHP!";
$url   = 'http://calvinf.com/';

$permalink = 'http://wp.me/pcoLC-4e';

#create a <head> element
$head =
  <head>
   <title>{$title}</title>
  </head>;

#create a div
$div =
  <div id="header">
    <h1>{$title}</h1>
  </div>;

$body =
  <body>
    {$div}
    <div>
      <p>My name is {$name} and you should go visit <a href={$url}>my website</a> now.</p>
      <p>Read my <a href={$permalink}>guide to installing XHP on Ubuntu</a>. It includes the source code for this page. Comments and corrections are welcome.</p>
    </div>
  </body>;

echo
<html>
  {$head}
  {$body}
</html>;
?>

A few syntax notes
XHP forces you to properly nest tags — make sure you close them properly or it won’t compile and it will throw errors. Because XHP auto-escapes, when you’re creating a link (such as in an a element), you don’t need to put quotes around it.

<a href={$permalink}>guide to installing XHP on Ubuntu</a>

Installing XHP on Ubuntu
Server: Ubuntu 9.10 running on a slice at the Rackspace Cloud.
Web server: Apache 2
Apache installation guide (Slicehost article, but generally applicable)

Below I will go into more detail about the installation process.
Read the rest of this entry »

Sam Javanrouh: city on ice

Authored by Calvin Freitas on December 23rd, 2009

Sam Javanrouh is my favorite photographer at present. He takes incredible photographs and also does the occasional video. The video below, Toronto on Ice, is one such example.

Visit his website [daily dose of imagery] here.

WordPress 2.9 Released

Authored by Calvin Freitas on December 19th, 2009

WordPress 2.9 has been released and is available for download. The most important new features are a new “trash” system for deleting posts or comments, a built-in image editor, batch plugin updating, and easier video embedding.

On a related note, Elitwee MyTwitter 3.0.3 is compatible with WordPress 2.9 and is a great way to include your tweets as a widget on your WordPress blog.

PHP 5 Library for Posterous API

Authored by Calvin Freitas on December 9th, 2009

I have written a PHP 5 library for the Posterous API. It uses the curl extension to query the Posterous API, retrieves the XML, and returns the XML as a SimpleXMLElement.

Read more information about my Posterous API library for PHP 5 or clone the code on GitHub.

Elitwee MyTwitter 3 Plugin for Wordpress Released

Authored by Calvin Freitas on December 3rd, 2009

The Elitwee MyTwitter 3 Plugin for WordPress has been released and is available for download now from the WordPress Plugins Directory.

Description: Elitwee MyTwitter is a simple tweet widget and status updater for WordPress.

What’s New?: This new version allows you to easily add one-or-more Twitter widgets to any widget-enabled WordPress theme. You can also post updates to Twitter directly from the plugin’s Settings page. It is compatible with WordPress 2.8 and higher.

Download
View Screenshots
View Additional Information

Updated Design

Authored by Calvin Freitas on November 16th, 2009

I’ve updated the custom theme for my website! Look at it now.

I spent today finishing the code for the custom WordPress theme I use to power the layout and design of the site. Many thanks to Jason Oxrieder for doing the graphic design work behind the new look!

The new design is just one example of the custom WordPress development I am able to do. I provide WordPress consulting and can answer questions about topics related to customization, themes, plugins, settings, system administration, and more.

Technology, Faith, and Human Shortcomings – Billy Graham at TED

Authored by Calvin Freitas on October 31st, 2009

Rev. Billy Graham gave a talk at the TED conference in 1998 regarding Technology, Faith, and Human Shortcomings.  I’ve embedded it below or you can download the MP3 or video at the TED page.

What It’s Like

Authored by Calvin Freitas on October 26th, 2009

Paul Graham has an excellent essay entitled “What Startups are Really Like.”  Read it here.

I found myself surprised at how often I agreed with the words of PG or the entrepreneurs he quoted within.  My experience working at Athleon has taught me many of the lessons he mentions within his essay.  Particularly, the lesson that entrepreneurs work on a different time-flow than the rest of the world, and the emotional roller coaster a startup can be.

Over the course of the past year, I have loved working with Brent, Ryan, Jason, and Dan on Athleon and I am incredibly proud of the product and how far it has come in a year.  With this  small team of 5 (now 4), we have launched All Team Apparel, the Game Film beta, an updated version of Playbooks, and rewritten large components of the back-end code (running on Debian Linux, Apache 2, MySQL, and Perl with some features written in Flex/AS3) to prepare the site to scale for future growth.

Nobody says startup life is easy.  The past year has not been, but I wouldn’t do things differently.  The lessons I’ve learned have been valuable, hard-earned, and worth it.