<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Improved Thread Simulation Class for PHP</title>
	<atom:link href="http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/</link>
	<description>A blog about web development, software business, and WordPress</description>
	<lastBuildDate>Wed, 08 Feb 2012 21:10:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Rick</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-161204</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Fri, 07 Jan 2011 01:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-161204</guid>
		<description>Great Function; Thanks So Much For Sharing This!  I Ran Into A Problem With Trying To Pass A Multidimensional Array To &#039;create_thread&#039;.  Using &#039;call_user_func&#039; Instead of &#039;var_export&#039; And &#039;eval&#039; Fixed It.

ARRAY:
$user_array = array(array(&quot;first_name&quot; =&gt; &quot;Rick&quot;, &quot;last_name&quot; = &quot;Smith&quot;), &quot;id&quot; =&gt; 1);

CALL:
$manager-&gt;create_thread(&#039;ping&#039;, $user_array);

ARRAY AFTER BEING PASSED TO FUNCTION USING var_export &amp; eval
Array
(
    [0] =&gt; Array
        (
            [first_name] =&gt; Rick
            [last_name] =&gt; Smith
        )
)

ARRAY AFTER BEING PASSED TO FUNCTION USING call_user_func
Array
(
    [0] =&gt; Array
        (
            [first_name] =&gt; Rick
            [last_name] =&gt; Smith
        )

    [id] =&gt; 1
)

I Just Made The Following Change To The &#039;thread.php&#039;:

//eval($code);
$return = call_user_func($_POST[&#039;f&#039;], $_POST[&#039;a&#039;]);</description>
		<content:encoded><![CDATA[<p>Great Function; Thanks So Much For Sharing This!  I Ran Into A Problem With Trying To Pass A Multidimensional Array To &#8216;create_thread&#8217;.  Using &#8216;call_user_func&#8217; Instead of &#8216;var_export&#8217; And &#8216;eval&#8217; Fixed It.</p>
<p>ARRAY:<br />
$user_array = array(array(&#8220;first_name&#8221; =&gt; &#8220;Rick&#8221;, &#8220;last_name&#8221; = &#8220;Smith&#8221;), &#8220;id&#8221; =&gt; 1);</p>
<p>CALL:<br />
$manager-&gt;create_thread(&#8216;ping&#8217;, $user_array);</p>
<p>ARRAY AFTER BEING PASSED TO FUNCTION USING var_export &amp; eval<br />
Array<br />
(<br />
    [0] =&gt; Array<br />
        (<br />
            [first_name] =&gt; Rick<br />
            [last_name] =&gt; Smith<br />
        )<br />
)</p>
<p>ARRAY AFTER BEING PASSED TO FUNCTION USING call_user_func<br />
Array<br />
(<br />
    [0] =&gt; Array<br />
        (<br />
            [first_name] =&gt; Rick<br />
            [last_name] =&gt; Smith<br />
        )</p>
<p>    [id] =&gt; 1<br />
)</p>
<p>I Just Made The Following Change To The &#8216;thread.php&#8217;:</p>
<p>//eval($code);<br />
$return = call_user_func($_POST['f'], $_POST['a']);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: White Shadow</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-84410</link>
		<dc:creator>White Shadow</dc:creator>
		<pubDate>Thu, 02 Sep 2010 12:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-84410</guid>
		<description>If you like, you can post your patch here and I&#039;ll add it to the script.</description>
		<content:encoded><![CDATA[<p>If you like, you can post your patch here and I&#8217;ll add it to the script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-84352</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Thu, 02 Sep 2010 09:17:53 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-84352</guid>
		<description>Followup: This has been VERY useful, now I can run parallel search queries in my Store system (4 million products) and reduced search time by a factor of 3.

But the script had to be patched... specifically the preg_match for [RESPONSE][/RESPONSE] breaks frequently on serialized data. I think it breaks on serialized Arrays because it does work perfectly on String data. Or maybe its because my Arrays contain all sorts of &quot;special&quot; characters e.g. singlequotes, doublequotes and non-ascii characters.

I copied the encoded string to a test file tested the preg_match on the file. I also tested with different opening/closing tags... and its confirmed that preg_match indeed DOES break. Its a PHP bug, not something todo with this script.

I have now replaced the preg_match with code which uses strpos() and substr() and it work perfectly now.</description>
		<content:encoded><![CDATA[<p>Followup: This has been VERY useful, now I can run parallel search queries in my Store system (4 million products) and reduced search time by a factor of 3.</p>
<p>But the script had to be patched&#8230; specifically the preg_match for [RESPONSE][/RESPONSE] breaks frequently on serialized data. I think it breaks on serialized Arrays because it does work perfectly on String data. Or maybe its because my Arrays contain all sorts of &#8220;special&#8221; characters e.g. singlequotes, doublequotes and non-ascii characters.</p>
<p>I copied the encoded string to a test file tested the preg_match on the file. I also tested with different opening/closing tags&#8230; and its confirmed that preg_match indeed DOES break. Its a PHP bug, not something todo with this script.</p>
<p>I have now replaced the preg_match with code which uses strpos() and substr() and it work perfectly now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-82985</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Mon, 30 Aug 2010 10:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-82985</guid>
		<description>Doesn&#039;t require domain to be specified....requires a minor change in create_thread() and works with any host, local or domain

function create_thread($func, $arguments=null, $id=null)
  $host = $_SERVER [&#039;SERVER_NAME&#039;];
  $port = 80;
.....


Though it works, I didn&#039;t really understand the mechanism... I mean why doesn&#039;t create_thread() create new threads when the script is sent a Post request and end up in a recursive never-ending loop</description>
		<content:encoded><![CDATA[<p>Doesn&#8217;t require domain to be specified&#8230;.requires a minor change in create_thread() and works with any host, local or domain</p>
<p>function create_thread($func, $arguments=null, $id=null)<br />
  $host = $_SERVER ['SERVER_NAME'];<br />
  $port = 80;<br />
&#8230;..</p>
<p>Though it works, I didn&#8217;t really understand the mechanism&#8230; I mean why doesn&#8217;t create_thread() create new threads when the script is sent a Post request and end up in a recursive never-ending loop</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: White Shadow</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-31341</link>
		<dc:creator>White Shadow</dc:creator>
		<pubDate>Wed, 02 Sep 2009 09:14:31 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-31341</guid>
		<description>Looks like the script incorrectly determines the current URL. Take a look at the constructor of the Thread class + the Thread-&gt;start() method and see if anything looks wrong to you. Also, you might need to explicitly specify the domain name when creating a thread.</description>
		<content:encoded><![CDATA[<p>Looks like the script incorrectly determines the current URL. Take a look at the constructor of the Thread class + the Thread->start() method and see if anything looks wrong to you. Also, you might need to explicitly specify the domain name when creating a thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-31337</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Tue, 01 Sep 2009 18:53:17 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-31337</guid>
		<description>I have this working fine on my workstation using XAMPP but when I publish to my production Apache server I get the following

Decoding error! The response was : HTTP/1.1 404 Not Found Date: Tue, 01 Sep 2009 18:47:57 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.5 Accept-Ranges: bytes Connection: close Transfer-Encoding: chunked Content-Type: text/html 1 1 95
16 404 Not Found

43 The server can not find the requested page:

    9 localhost 17 /multithread.php (port 41 80) 

Please forward this error screen to 21 localhost&#039;s WebMaster.</description>
		<content:encoded><![CDATA[<p>I have this working fine on my workstation using XAMPP but when I publish to my production Apache server I get the following</p>
<p>Decoding error! The response was : HTTP/1.1 404 Not Found Date: Tue, 01 Sep 2009 18:47:57 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.5 Accept-Ranges: bytes Connection: close Transfer-Encoding: chunked Content-Type: text/html 1 1 95<br />
16 404 Not Found</p>
<p>43 The server can not find the requested page:</p>
<p>    9 localhost 17 /multithread.php (port 41 80) </p>
<p>Please forward this error screen to 21 localhost&#8217;s WebMaster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lightweight and multiplatform PHP Multithreading Engine &#124; Anton Vedeshin</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-30727</link>
		<dc:creator>Lightweight and multiplatform PHP Multithreading Engine &#124; Anton Vedeshin</dc:creator>
		<pubDate>Fri, 03 Jul 2009 11:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-30727</guid>
		<description>[...] http://www.phpclasses.org/browse/package/3953.html [14] Improved Thread Simulation Class for PHP http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/    Author: Anton Vedeshin Categories: Articles Tags: Distributed Computing, PHP        Comments (0) [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.phpclasses.org/browse/package/3953.html" rel="nofollow">http://www.phpclasses.org/browse/package/3953.html</a> [14] Improved Thread Simulation Class for PHP <a href="http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/" rel="nofollow">http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/</a>    Author: Anton Vedeshin Categories: Articles Tags: Distributed Computing, PHP        Comments (0) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnitunes</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-19646</link>
		<dc:creator>johnitunes</dc:creator>
		<pubDate>Sat, 07 Mar 2009 08:12:33 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-19646</guid>
		<description>Yo!
How are you doing?
I am new at w-shadow.com and thought I would say HI
I hope I can become a contributing member!
Oh yeah... because the economy is so corrupt right now.. I cant afford music.. lol
Anyone know where I can get &lt;a href=&quot;http://www.slideshare.net/killnolimit/free-itunes-codes-free-itunes-code-free-itunes-gift-cards&quot; rel=&quot;nofollow&quot;&gt;free itunes gift cards&lt;/a&gt; online?
Sorry if this is in wrong section admin.. wasnt sure of the right place. 

Thank You!!</description>
		<content:encoded><![CDATA[<p>Yo!<br />
How are you doing?<br />
I am new at w-shadow.com and thought I would say HI<br />
I hope I can become a contributing member!<br />
Oh yeah&#8230; because the economy is so corrupt right now.. I cant afford music.. lol<br />
Anyone know where I can get <a href="http://www.slideshare.net/killnolimit/free-itunes-codes-free-itunes-code-free-itunes-gift-cards" rel="nofollow">free itunes gift cards</a> online?<br />
Sorry if this is in wrong section admin.. wasnt sure of the right place. </p>
<p>Thank You!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: White Shadow</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-15714</link>
		<dc:creator>White Shadow</dc:creator>
		<pubDate>Fri, 13 Feb 2009 10:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-15714</guid>
		<description>Okay, I fixed some of those bugs.</description>
		<content:encoded><![CDATA[<p>Okay, I fixed some of those bugs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NikoRoberts</title>
		<link>http://w-shadow.com/blog/2008/05/24/improved-thread-simulation-class-for-php/comment-page-1/#comment-15679</link>
		<dc:creator>NikoRoberts</dc:creator>
		<pubDate>Fri, 13 Feb 2009 05:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=187#comment-15679</guid>
		<description>You have to replace &quot;localhost&quot; in the create_thread function to get rid of the decoding error (Line 287)

Also the &quot;emtpy&quot; should be &quot;empty&quot; on line 40

Hope this help anyone in the future.

Other than that it is great code.

Thanks!</description>
		<content:encoded><![CDATA[<p>You have to replace &#8220;localhost&#8221; in the create_thread function to get rid of the decoding error (Line 287)</p>
<p>Also the &#8220;emtpy&#8221; should be &#8220;empty&#8221; on line 40</p>
<p>Hope this help anyone in the future.</p>
<p>Other than that it is great code.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

