Categories
Python

Simple Console Clock for Windows with Python

The code is self explanatory:

Python 3 Source Code:

It displays a clock on Windows Command Prompt and updates it every second. It mainly demonstrates the Timer object of threading library.

Categories
PHP

PHP-GTK: App to update Twitter

People who have been in touch for a while might have noticed how much twitter addict I have suddenly become. Today, I wrote a php-gtk program to update my twitter status. I developed it using php-gtk2 and cURL.

I was having a lot of troubles developing it. I was using “thread safe” php while GTK is “nts (non thread safe)”. I managed a non thread safe php5 but problems raised with the cURL library. The required dependencies for cURL and mysql were not available with that package. I had to copy those specific files from another package. Again, I was getting confused as the app failed to load cURL repeatedly though I had it enabled in php.ini. Later I found out that when I copied the dependencies, I have also copied a “php-cli.ini” which was substituting the default php.ini since php was running in the CLI mode.

Finally it’s done. I am still a beginner at php-gtk. I didn’t write the program from scratch. I copy-pasted some codes from my other projects and php-gtk manual. But this program is going to be a good source of inspiration for me. I really like php-gtk. I am gonna dig a bit deeper whenever I get some time to spare.

Download: http://masnun.googlecode.com/files/twitter_php_gtk.php

Categories
Python

Python tool to expand short URLs

In one of my last posts, I posted a code snippet which demonstrated how to use php to expand short URLs to their original long form. Here’s the Python version I coded a few minutes ago.

Python 3:

These codes are for Python 3. The tool was developed for CLI use.