<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ask Your Question &#187; PHP</title>
	<atom:link href="http://askbahar.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://askbahar.com</link>
	<description>Lets Talk</description>
	<lastBuildDate>Thu, 29 Sep 2011 05:48:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to add scheduled task to run php scripts in Windows</title>
		<link>http://askbahar.com/2011/04/22/add-scheduled-task-to-run-php-scripts-in-windows/</link>
		<comments>http://askbahar.com/2011/04/22/add-scheduled-task-to-run-php-scripts-in-windows/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 07:20:24 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[scheduled task]]></category>
		<category><![CDATA[schtasks]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=124</guid>
		<description><![CDATA[<p>Few days ago, for one of our PHP / MySQL project, we were needed to run two php scripts at every minute. We usually develop/deploy our projects in LAMP environment, where we use <a href="http://adminschoice.com/crontab-quick-reference">crontab</a> for our scheduled tasks. But our client have wanted us to run the system in Windows. So we have chosen  [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago, for one of our PHP / MySQL project, we were needed to run two php scripts at every minute. We usually develop/deploy our projects in LAMP environment, where we use <strong><a href="http://adminschoice.com/crontab-quick-reference">crontab</a></strong> for our scheduled tasks. But our client have wanted us to run the system in Windows. So we have chosen  <strong><a href="http://www.apachefriends.org/en/xampp-windows.html">XAMPP</a></strong>. To run our two php scripts every 1 &amp; 2 minute, we thought of developing a simple tool for windows which would run at background and execute those two php scripts. Fortunately we have found about <strong><a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true">schtasks</a></strong>, a native scheduler in Windows to run scheduled task smoothly in command prompt.<br />
<span id="more-124"></span><br />
I will not describe our actual situation, rather I will demonstrate with 2 simple php scripts.</p>
<p>1. Create a directory in your <strong>htdocs</strong> folder inside XAMPP installation directory. In my case, it was <em>C:\xampplite\htdocs\test</em></p>
<p>2. Create two php scripts, <em>test1.php</em> and <em>test2.php</em> inside test directory using the following respective code.<br />
[php]&lt;?php<br />
//test1.php<br />
//creates, appends current time in a file called dump1.txt<br />
date_default_timezone_set(&#8216;Asia/Dacca&#8217;);<br />
$time = date(&#8216;Y-m-d H:i:s&#8217;);<br />
$file = &quot;C:/xampplite/htdocs/test/dump1.txt&quot;;<br />
file_put_contents($file,&quot;job1 run on: $time\r\n&quot;, FILE_APPEND);<br />
?&gt;[/php]<br />
[php]&lt;?php<br />
//test2.php<br />
//creates, appends current time in a file called dump2.txt<br />
date_default_timezone_set(&#8216;Asia/Dacca&#8217;);<br />
$time = date(&#8216;Y-m-d H:i:s&#8217;);<br />
$file = &quot;C:/xampplite/htdocs/test/dump2.txt&quot;;<br />
file_put_contents($file,&quot;job2 run on: $time\r\n&quot;, FILE_APPEND);<br />
?&gt;[/php]</p>
<p>3. create a batch file <em>php_service_creator.bat</em> with the following code.<br />
[vb]<br />
SCHTASKS /Create /RU SYSTEM /SC MINUTE /MO 1 /TN &quot;test_sch_task1&quot; /TR &quot;C:\xampplite\php\php-win.exe -f C:\xampplite\htdocs\test\test1.php&quot;<br />
SCHTASKS /Create /RU SYSTEM /SC MINUTE /MO 5 /TN &quot;test_sch_task2&quot; /TR &quot;C:\xampplite\php\php-win.exe -f C:\xampplite\htdocs\test\test2.php&quot;<br />
[/vb]</p>
<blockquote><p>
1. <em>test_sch_task1</em> task will run on every minute.<br />
2. <em>test_sch_task2</em> task will run on every fifth minute.
</p></blockquote>
<p>to understand the used (and other possible) parameters, please visit <a href="http://www.robvanderwoude.com/schtasks.php">this link</a></p>
<p>4. Run just created <em>php_service_creator.bat</em>. Please note that you have to run this from an account with administrative privileges. </p>
<p>5. After about 20 minutes, check <em>C:/xampplite/htdocs/test/dump1.txt</em> &#038; <em>C:/xampplite/htdocs/test/dump2.txt</em> files for output.</p>
<p>6. To check/view all the added scheduled tasks, type <em>schtasks</em> in command prompt.</p>
<p>7. To delete any scheduled task, type <em>schtasks /Delete /TN TASK_NAME_FOR_DELETE</em> in command prompt.</p>
<p>I hope it helps some people like me.</p>
<p>Comments, suggestions are appreciated <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2011/04/22/add-scheduled-task-to-run-php-scripts-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is the difference between the variables of Python and other language</title>
		<link>http://askbahar.com/2010/10/25/difference-between-variables-of-python-and-other-language/</link>
		<comments>http://askbahar.com/2010/10/25/difference-between-variables-of-python-and-other-language/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 14:31:11 +0000</pubDate>
		<dc:creator>Habib Ullah Bahar</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[identifier]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://askbahar.com/?p=104</guid>
		<description><![CDATA[<p>If you are from C/C++/Java and started learning Python, this should be an interesting topic for you.</p> <p>In languages like C, C++, Java, PHP etc a variable is a memory location where its value is saved. When you copy a variable into another variable, both of them still in existence and you can use both [...]]]></description>
			<content:encoded><![CDATA[<p>If you are from C/C++/Java and started learning Python, this should be an interesting topic for you.</p>
<p>In languages like C, C++, Java, PHP etc a variable is a memory location where its value is saved. When you copy a variable into another variable, both of them still in existence and you can use both of them.</p>
<p>But in Python, its different. As a matter of fact Python don&#8217;t have any variables, it has &#8216;name&#8217; or &#8216;identifier&#8217; attached to an object (everything in Python is an object).</p>
<p>Let me clear this using an example:</p>
<p><span id="more-104"></span></p>
<blockquote><p>In other language:</p>
<p>int a_variable = 1; //Here a_variable has a value of 1.</p>
<p>a_variable = 2; //Now a_variable has an updated value of 2.</p>
<p>int another_variable = a_variable; //Now another_variable is a new variable with a value of 2.</p>
<p>int sum = a_variable + another_variable; //you can still use both of the variables.</p>
<p>In Python:</p>
<p>a_variable = 1  #Here integer object 1 (see, everything is an object) has a name tag (or identifier) &#8216;a_variable&#8217;</p>
<p>a_variable = 2 #Now a_variable name tag is now attached to integer object 2. Old integer object 1 can&#8217;t be accessed via a_variable anymore.</p>
<p>another_variable = a_variable #Now both another_variable and a_variable name tag is attached to integer object 2.</p></blockquote>
<p>Though we still call them variables in Python, but you see, they behave differently (almost like the pointers in C).</p>
<p>I hope it helps. Let me know your comments <img src='http://askbahar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askbahar.com/2010/10/25/difference-between-variables-of-python-and-other-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

