CLI

Command Line Interface

Writing A Python Script To Send Files To Amazon S3

Amazon Simple Storage Service or Amazon S3 is a storage service with a web API. I use Amazon S3 to store backups of my blog and other sites. I made a simple python script to handle file uploads to S3.

In order to use Amazon S3, first create a bucket using your Amazon AWS account. As the name suggests, bucket is a container. You can create buckets using the AWS management console.

The script we're going to write will take two input parameters

  1. Path to file, local
  2. Target S3 path

A Bit Of XML, RSS And CURL In 7 Lines Of PHP And A Useful Program

Today, I was looking for a quick way to get the current weather information on my computer. There are so many websites out there that offer the information. But I was looking for a program I could permanently install on my computer and launch it whenever I want to lookup the weather information. Oddly, I didn't find any satisfying program. At the same time I was also watching a video about network programming. That inspired me to quickly write a program in PHP to print the current weather information where I live.

I started to look out for a web service that offers information about weather for free. Did I tell you programmableweb.com is a useful website to find web services? If you have subscribed to the Tech Chorus blog you know we've been talking about REST, XML-RPC and web services in general for a while. I landed up on the Yahoo! Weather API web page.

I wrote a program to print the weather information in 7 lines of PHP code. I have published this program on Code Album github repository. You can grab it and use it.

If you want to know how to write similar programs, read on. If you know a bit of PHP and have heard about XML and RSS before you can understand the program and start building upon it.

Taxonomy upgrade extras: 

10 Examples To Inspire You To Use PHP Interactive Shell

Do you want to quickly test some PHP code?

Are you learning PHP?

Are you teaching PHP?

Don't miss out the PHP CLI Interactive mode. You can invoke PHP interactive shell from the terminal

php -a

Example 1: Do you want to see the output of xmlrpc_encode_request()

php > echo xmlrpc_encode_request('myIPAddress', array('username','password'));
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>myIPAddress</methodName>
<params>
 <param>
  <value>
   <string>username</string>
  </value>
Taxonomy upgrade extras: 

Generate Lines Of Code And Comment Statistics Using phploc

You have been writing a lot of PHP code and want to generate statistics about the number of comment and code lines in your application. Maybe you want to generate statistics about some PHP project. You can do it with just one command.

phploc helps you quickly generate numbers about the size of a PHP project.

You can install phploc from the PEAR installer. The PHP PEAR package itself is most likely available from your distribution vendor.

Taxonomy upgrade extras: