Here is the simple example of for loop in python Code: //This line is important,This is where you declare how many times the loop should be executed in range,To execute the loop ten times you declare range(1,10):
for x in range(1,10):
print x Output: In the above loop x is the variable… and then range can be replaced by array so you do want to specify the length of the array when you are going to use array values in the for loop 123456789
Today I found out a site where we can play a Virtual stock Market Game according to real market prices
http://moneybhai.moneycontrol.com
Just Sign up for that and start trading and also they will give prizes periodically according to their net worth…
It’s truly amazing , I am going keep myself engaged by this daily and also for any newbies who are wishing to earn by stockmarket this provides a good opportunity for them to learn about the basics of stockmarket….( I am not a newbie though)
Add this code at the end of your index.php in Proxy
This code was made my friend so I claim no rights to it…
$b1=preg_match(”/http:\/\/www\.\youtube\.com\/watch\?\v\=/i”,$_url,$c);
if($b1>0)
{
$_url1=preg_replace(”/&(.*)/i”,” “,$_url);
function get_youtube_flv ($url3)
{
$data = @file_get_contents(”http://www.youtube.com/watch?v=” . $url3);
@preg_match(”#fullscreenUrl = \’([^\’]+)\’#i”, $data, $matches);
parse_str($matches[1], $params);
return “http://www.youtube.com/get_video?video_id=” . $params[’video_id’] . “&t=” . $params[’t'];
}$video_url=$_url1;
$video_url1=preg_match(”/=(.*)/i”,$video_url,$video);
$video1=$video[1];
$ur1=preg_match(”/=(.*)/i”,$video1,$url2);
$url3=$video1;
//echo $url3;
//echo”<BR>”;
$id1=get_youtube_flv($url3);
$url1=base64_encode($id1);
//echo $url1;
//echo”<BR>”;
$url2=”http://67.228.3.79/index.php?q=”.$url1;
//echo $url2;
//echo”<BR>”;//For image
$image=”http://i.ytimg.com/vi/”.$url3.”/default.jpg”;
$image1=base64_encode($image);$content= “<embed type=’application/x-shockwave-flash’ src=’player.swf’ style=” id=’ply’ name=’ply’ bgcolor=’#FFFFFF’ quality=’high’ allowfullscreen=’true’ allowscriptaccess=’always’ flashvars=’height=395&width=480&file=http://www.proxy.com/index.php?q=$url1.flv&image=http://www.proxy.com/index.php?q=$image1&&backcolor=0×000000&frontcolor=0xCCCCCC&lightcolor=0×996600&searchbar=false&type=flv’ width=’480′ height=’395′>”;
$_response_body = preg_replace(’#<div id=”watch-noplayer-div”>(.*?)</div>#smi’,$content,$_response_body);
//$_response_body = preg_replace(’#<div id=”watch-this-vid”>(.*?)</div>#smi’, ‘<div id=”playerDiv”></div>’ . $content, $_response_body);
echo $_response_body;
}else
{
echo $_response_body;
}
Also you should replace http://www.proxy.com with your proxy site and you should download
JW FLV media player and should extract all the files to the folder where your index.php exists..
After installing active state python just go to
Start->Programs->Active state Active Python 2.5 ->Interactive Shell or Python Win Editor…
You can choose Python Win Editor which is of GUI mode..
A Window will open in front of you a command prompt “>>> ”
After just enter print “My First Python Program”
and then press enter button on Keyboard your result will displayed in the next line on python editor
This is one of the simplest programs in Python and it is one of the fastest Languages. in terms of speed.
Also we can run these on any Server provided Python is installed in it….
Python is a wonderful language such that once you learn it you will say it as the best one as it’s faster than many other applications..
So how to try python
Here is the link that will give you step by step description how to install python your PC and also how to install it on local server
http://www.richarddooling.com/index.php/2006/03/14/python-on-xp-7-minutes-to-hello-world/
and this link will tel you
how to configure a httpd file for Cgi-bin to run python scripts on your local server
All of you would have visited a IP address lookup site to know the ip address of your competitor site or anyother site.Here is another simple way to find out IP address of a website using your command prompt which is one of the easiest one
Just go to your command prompt
If you do n’t know how to go to your command prompt
Click on start->run->Type cmd and Click on ok button…
and enter cd.. to be at c:\>
After that enter nslookup followed by the domain name (www.site.com) for which you need to find the IP Address.
This is a cool tip and it’s also very useful
I downloaded firefox 3 today and when compared to firefox 2 it’s somewhat better than the latter in all aspects,but the problem is most of the toolbars are not working .For example Take Google .their Google toolbar is not compatible with firefox 3,So most of the userswho downloaded would not have used Google toolbar so they may be losing atleast a million in search revenue as Google toolbar generates a lot of revenue for them in searches and same can be said about others.
Other than compatibility no others issues are there…
Here is a simple code in php that will split a string…
<?php
$str = “Hello Friend”;
$arr1 = str_split($str);
$arr2 = str_split($str, 3);
print_r($arr1);
print_r($arr2);
?>
The above example will output:
Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => F [7] => r [8] => i [9] => e [10] => n [11] => d ) Array ( [0] => Hel [1] => lo [2] => Fri [3] => end )
I searched php.net for array search function but I did n’t find any so I thought about writing my own function for it
Here is a preview of the function:
Suppose if there is an array of names -John,Charles,Richard,Richard and Bill.
You want to find how many times Richard is in the array and in which array placethe name”Richard” is…(Richard is displayed 2 times in the array and it is 2,3)
Here is the array function which will help you to find these attributes
<?
function arraysearch($search,$array)
{
$cc=count($array);
for($i=0;$i<$cc;$i++)
{
$d1=$array[$i];
if($d1==$search)
{
$array1=($d1.",".$array1);
$array2=($i.",".$array2);
}
}
echo"<pre>";
/*echo $array1;
echo"<BR>";
echo $array2;
echo"<BR>";
*/
$array1=explode(",",$array1);
$c1=count($array1);
//print_r($array1);
unset($array1[$c1-1]);
$array2=explode(",",$array2);
//print_r($array2);
$c2=count($array2);
unset($array2[$c2-1]);
$c2=count($array2);
//echo $c1;
if(!search)
{
}
else
{
echo "No of $search is $c2";
}
//return($array1);
echo"<BR>";
$array2=implode(",",$array2);
return($array2);
}
$q = stripslashes ($HTTP_GET_VARS['q']);
$c = stripslashes ($HTTP_GET_VARS['c']);
$c=explode(",",$c);
$a1= arraysearch($q,$c);
//print_r($a1);
echo"</pre>";
?>
To find the string length in php
just use
<?
$a=”shanmugam”;
$b=strlen($a);
echo $b; //will display length of the string
?>
Output:
9