Archives for November 2009

Here’s a simple and short tutorial on how to retrieve Twitter trends. We will be using PHP and Twitter’s API to retrieve the latest trends. You can publish the trends on your website, blog or any application you are working on. So, let’s get started.

Twitter has made trends available to anyone via API calls. The url of the API is: http://search.twitter.com/trends.json. Trends is also available in XML, but we will use JSON in this example.

To retrieve the string of data, we will use a PHP command called file_get_contents. We will suppress errors by placing an @ sign in front of file_get_contents. We will assign the string to a variable called $contents. So this is what we have so far.

Next, we will check if we have the correct response from the http_header. We will check for the code “200”, meaning we have a valid response. We will use the PHP command called strpos to find the needle in the haystack. The needle in this case is “200.” We will look for it starting at position “0.” The format is going to be like this.

Ok, so we now have a JSON string assigned to the variable named $contents. We just need to decode it using the PHP command called “json_decode” and assign it to the $json array variable. Next, we will run a foreach contruct to echo each trend name.

The latest decision by the Ubuntu development team to exclude Gimp in future releases of Ubuntu was a bit of a head scratcher. I wondered why Gimp had to be taken out of future releases of Ubuntu.

Gimp is a powerful program for editing graphics that we all love. It offers everyone an alternative tool to Adobe’s Photoshop. It’s rich in features and capabilities. Although it not quite up to par with Photoshop, it certainly can hold its own.

Ubuntu developers explained the reasoning behind the removal. They said Gimp was too complicated, too intimidating to casual users. Too complicated? And Linux is not? Gimp developers seem to agree about leaving it out.

So, with no Gimp in Ubuntu’s future, users are encouraged to use F-Spot, a mono application I might add. And that may not even stick. Developers are already talking about replacing F-Spot with Shotwell or Gthumb.

The good news is it’s easy to install Gimp. It will probably be the first application I will install after installing Ubuntu. That’s if I’m still using Ubuntu.

If you have installed a LAMP server either on your Linux desktop or server, you are bound to run into this problem. The default PHP installation placed a 2MB limit on file uploads. I ran into this problem when I tried to import a XML file that was bigger than 2MB into a WordPress install. So, to increase the upload limit, I edited the PHP configuration file called PHP.INI.

In Ubuntu, the default location for PHP.INI is in the /etc/php5/apache2 directory. So, let’s open up the Terminal and edit the PHP.INI file:

$ sudovi/etc/php5/apache2/php.ini

$ sudo vi /etc/php5/apache2/php.ini

Look for this entry in the file.

upload_max_filesize = 2M

upload_max_filesize = 2M

Increase the limit to 10MB or to any value you prefer.

upload_max_filesize = 10M

upload_max_filesize = 10M

Save file and exit.

Next, you will need to restart the Apache server for your changes to take effect. From the Terminal type this command to restart your Apache web server: