Categories
Python

Python port to the Alphabet Class

I have a pretty bad habit of porting codes from one language to another. PHP and Python both are my favorites. But sometimes I feel that I enjoy coding more in Python than PHP. It’s just because I am a lazy guy who hates using text editors to complete a script entirely before executing the program. I like interactive shells. Now that I have set up interactive shell for PHP as well, I write little throw away programs in both PHP and Python. But it still happens that the Python interactive interpreter is loads better than the PHP one. I have to type “echo” every time I want some input from the PHP shell, where as I have to type the name of an element (variable, object, list, tuple or whatever) and python displays it on the shell. So it becomes easier to experiment and debug.

Back to the topic, I was thinking of porting the alphabet class I wrote in PHP to Python. And finally I got some time today morning and finished it.

How to use ?

Source Code

Categories
PHP

A Handy alphabet class :)

Another funny class with no serious use. This is a class I wrote to determine the numerical positions of letters in the English alphabet.

How to use ?

As you can see, using the getNum() method, you can feed a letter and get the serial number or numerical position of that letter. Again in the same way, use the getChar() method to input a number and get the character/letter in that position.

I use it very often while breaking alphabet related codes.

Source Codes:

Categories
PHP

Decoding Google’s Tweet With PHP

This is something for fun — nothing serious. It just happened that Google just sent a mysterious Tweet around 2 hours ago from now with an image with of the Google home page featuring an UFO. The UFO was seen pulling an O out of the google logo. But what the heck does that tweet mean ?

1.12.12 25.15.21.18 15 1.18.5 2.5.12.15.14.7 20.15 21.19 was the tweet.

Well, it’s nothing tough. Every number separated by a dot or space corresponds to the alphabet. So, I wrote a PHP script to decode this mysterious tweet and finally found the meaning:

So, it meant ” all your o are belong to us ” 😉
Sounds a bit odd ? Or wrong in grammar ? yeah, still, that’s the message. It is confirmed on the twitpic image.

And here’s the source code —

It was quite a bit of fun decoding the message with PHP. Well, I do agree that there was no need to use PHP here. But why do the hard work from memory when you have automation tools at your hand 😉 ?