Quick Coding Python in your mobile phone with T9 Predictive Text

Writing python codes for mobile phones is fun and rewarding experience! You will usually code in your pc, test and debug it on an emulator, then transfer the finished code to your mobile phone. However there are some time that you wish to write a quick code in your phone’s python interactive console, just for testing around.

While writing code with your phone keypad can be -exteremely- distracting, I have a trick that helps you increase your productivity with python in your phone, and hopefully will turn your phone into a mobile python interactive machine!

First, I need you to open Python application in your phone, then select “Interactive console” from the Option screen. Then press “#” button two-times repeatedly. I’m sure that you are all familiar with this symbol on the right-hand corner of your phone. This means that the T9 predictive input is active, a feature that you will use heavily in this trick.

t9 predictive input

Now try to code with with T9 predictive output on, by typing few of the python lines like this

import telephone
import audio
telephone.dial('0176386421')

You might find it hard to type your words with predictive input turned on at first, don’t worry, just imagine your phone keypad as a normal keyboard button, and try typing away.

nokia python interactive console

What about words that do not exist in T9 dictionary?

In that case, you can break the words apart, for example the word “urllib” does not exist in T9 database, you can break the word apart as in “url” and “lib”, just type up to “url“, then press the right-arrow button and continue typing “lib”. With practice, you surely can code as fast as a normal keyboard!

*Screenshot is taken directly from my 6630 phone.

symbian,nokia, pys60

Yahoo! was incorporated today

Yahoo blog mypapit
Today is a historical day as it is the day Yahoo! was incorporated in 1995. The company started by two Stanford graduate David Filo and Jerry Yang as “Jerry’s Guide to the World Wide Web” , but later changed its name to Yet Another Hierarchical Officious Oracle or simply Yahoo.

Early Yahoo servers resided on Jerry and David workstation named Akebono and Konishiki. Since then, Yahoo popularity grew as more people started using the internet. Soon after that, Yahoo had its initial public offering on April 12, 1996, selling 2.6 million shares at $13 each.

As Yahoo’s popularity has increased, so has the range of features it offers, making it a kind of one-stop shop for all the popular activities of the Internet. These now include: Yahoo! Mail, an instant messaging client, Yahoo! Groups) online gaming and chat, various news and information portals, online shopping and auction facilities, blog portal (blo.gs), social bookmarking service (del.icio.us) .

Many of these are based at least in part on previously independent services, which Yahoo has acquired – such as the popular GeoCities free Web-hosting service, Rocketmail, and various competing mailing list providers such as eGroups.

[Source]

12DailyPro is officially a Ponzi Scam

The infamous 12DailyPro autosurf program finally charged with with fraud for running a Ponzi scheme. This means that 12DailyPro website will be shut down permanently after this.

Well, tough luck for the unlucky investors. Please do not support ponzi-like scheme, I guess people should know better about this, HYIP (High Yield Investment Program) and autosurf program is most likely (if not all) a ponzi scheme. So becareful when somebody recommends you to join money-making schemes like this.

From Wikipedia entry,

HYIPs typically are not based in the United States, Europe, or Japan – countries that have strong laws against unregistered investment programs. HYIPs disclose little or no detail about the principals, management, location, or other aspects of whom is getting the money to be invested, and relatively little information (other than asserting that they do various types of trading on various stock and other exchanges) on how their investment programs actually work.

Sounds familiar?

Enuff said, more info at ShaolinTiger blog

hyip,ponzi,scam,autosurf

Sending HTTP POST with php cURL

As promised previously, I’m going to show you how to send HTTP POST request using php cURL extension.

The target form

Let’s say you have a html form like this :

wtf

And this is the source code of the html file :


You can see that the form will submit the query using HTTP POST to “target.php”. Now let’s say you want to write a php script (bot.php) that will automatically send the query bypassing the html form, this is one way to do it (with php libcurl extension)

< ?php
//bot.php
$url = "http://localhost/wtf/target.php";
$ch = curl_init();

// set the target url
curl_setopt($ch, CURLOPT_URL,$url);

// howmany parameter to post
curl_setopt($ch, CURLOPT_POST, 1);

// the parameter 'username' with its value 'johndoe'
curl_setopt($ch, CURLOPT_POSTFIELDS,"username=johndoe");


$result= curl_exec ($ch);
curl_close ($ch); 
print $result;

?>

This script will send a HTTP POST request to “target.php” pretending to be a real person sending the “username” parameter as “john doe”.

However this is not entirely convincing since the server side will automatically know that you are using a http script to send the HTTP POST request by analyzing the browser “user-agent” string. The default script will send “(HTTPRetriever/1.0)” as its user-agent.

With a little add-on, you can spoof the user-agent string inside your script just like this :

< ?php
//
// test HTTP POST submitter, using libcurl
//

// the target url which contains scripts that accepts post request
$url = "http://localhost/wtf/target.php";

// we are spoofing Yahoo Seeker bot >:)
$useragent="YahooSeeker-Testing/v3.9 (compatible; Mozilla 4.0; MSIE 5.5; http://search.yahoo.com/)";

$ch = curl_init();

// set user agent
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);

// set the target url
curl_setopt($ch, CURLOPT_URL,$url);

// howmany parameter to post
curl_setopt($ch, CURLOPT_POST, 1);

// the parameter 'username' with its value 'johndoe'
curl_setopt($ch, CURLOPT_POSTFIELDS,"username=johndoe");


// execute curl,fetch the result and close curl connection
$result= curl_exec ($ch);
curl_close ($ch); 

// display result
print $result;

?>

so when your “bot.php” sends the request, the server logs will record that the query was sent by a “Yahoo Seeker bot” instead of a crudely coded php script.

You can spoof other browser as long as you know their user-agent string, refer to my previous post for a collection of browser user-agent strings.

No PHP cURL support?

In this case, you have a few options

  1. Use a server that support php cURL extension
  2. Compile/Install php cURL extension
  3. Use libcurlemu – php cURL extension written in pure php

Well that should cover the short crash course on how to use php cURL extension.

p/s : Although I won’t tell you how to write one directly, this is the basic of building spam bots and auto-submitter. So use your imagination (and the dark side of the force) to write the rest of the code. *evil*

You can download the source code of this tutorial here : http://mypapit.net/pub/libcurltest.zip

php,curl,webdev,libcurl,bots