Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.
Popular code excerpts may be moved to "Code Snippets" by the moderators.
ASDen, whenever somebody tells you that this is not multi-threading, you simply repeat that it is and that this has been stated before. You still have not explained how this is in any way multi-threading. Would you please just admit that what you are doing is not multi-threading or explain to us what detail we're all missing. Many (if not all) of the most knowledgeable members on this forum have explained (some of them several times) to you that this is not multi-threading and that what you are doing could be accomplished better, and less nonsensically with fsockopen. Using javascript for this provides no benefits that I can see. Please explain to me how this will benefit my application in any way.
Also, don't tell me to read the whole thread because I did.
Would you please just admit that what you are doing is not multi-threading or explain to us what detail we're all missing
what I'm doing here is providing Multi-Threading functionality to an environment which doesn't support it of course it's not like Threading in C or Java but to quite an extent it do the job with features:-
1. Performing at the same time
2. communication between threads
3. Providing Synchronization of data delivered in all threads
4. Provided a process object that holds the threads communicating directly with each other
5. Providing a direct communication between user and threads (Threads can give orders Through Js to browser)
Most of these Features were used in the Jsim example (except the process notion added later)
( I slitted the reply look below)
what you are doing could be accomplished better, and less nonsensically with fsockopen
That's not true as for the following reasons :-
1.The Cpu load :- using sockets will result in a high server cpu load (especially for high client number) compared to using this class as the load is shared between the Server and the Client
2.Connectivity to user :- when using the class the threads is connected Directley to the user through a Js function (ChangeBag)
3. Memory Load :-using sockets from the server to it self will make to pay for all the memory cost (it opens the page handles both way connections)
4. Availability :- fsockopen() and sockets in general is banned in a good deal of free hosting services (Good Experienced ones Esp.) and this is due to - as i think - bandwidth bleeding application based on it and the functionality they offer and i really think that nearly it will be banned in all free hosts and a number of low-paid hosting while Ajax case is client dependent which is a good point
Please explain to me how this will benefit my application in any way.
in a numerous number of ways :-
1. Building really interactive interfaces
2. making real usage of the server processor (Focus on this point)
3. making full usage of your connection (download managers/multiple RSS readers) [And this point also]
4. benefiting real threading abilities in Apache 2/IIS
At last really thanks to your Unbiased attitude
function ChangeBag()
{
// all requests go here so it's our bag and here telling bag script if a thread finished
for (var x=0;x<i;x++)
{
if (t[x].request.readyState >= 3 && t[x].Tnum!=-1)
{
eval(t[x].request.responseText); // <--- HERE
//alert(t[x].request.responseText);
//t[x].Tnum=-1;
}
}
}
Error repeated atleast three times before i got to see the `10`...
I won't argue about Multi-threading vs. Multi-Tasking since that of no use... but atleast you can aim towards cross-browser compatibility & exact functioning under all possible circumstances...
Error: syntax error
Source File: http://7zone1.110mb.com/AjT.js
Line: 56, Column: 134
Source Code:
var d = new Date();document.getElementById("M").innerHTML="1";var d = new Date();document.getElementById("M").innerHTML="2";var d = new
<br />
<b>Warning</b>: fwrite(): supplied argument is not a valid stream resource in <b>/www/110mb.com/7/z
/o/n/e/1/_/_/7zone1/htdocs/ThreadComHelper.php</b> on line <b>59</b><br />
<br />
<b>Warning</b>: fclose(): supplied argument is not a valid stream resource in <b>/www/110mb.com/7/z
/o/n/e/1/_/_/7zone1/htdocs/ThreadComHelper.php</b> on line <b>60</b><br />
<br />
<b>Warning</b>: fwrite(): supplied argument is not a valid stream resource in <b>/www/110mb.com/7/z
/o/n/e/1/_/_/7zone1/htdocs/ThreadComHelper.php</b> on line <b>59</b><br />
<br />
<b>Warning</b>: fclose(): supplied argument is not a valid stream resource in <b>/www/110mb.com/7/z
/o/n/e/1/_/_/7zone1/htdocs/ThreadComHelper.php</b> on line <b>60</b><br />
I suspect you just need to make the directory writable, although some error checking would be good.
Error[Line 56]: The data necessary to complete this operation is not yet available.
I tried it in IE7 it said there are errors-like-IE6 but didn't interrupt
atleast you can aim towards cross-browser compatibility & exact functioning under all possible circumstances...
I want to say two things:-
1. cross-browser is only in displaying issues but in case of Performing browser has no effect
2. ALL the problem is FF is the only browser - i tried - that implements Ajax as it should and IE is the most one who volatile it Especially it requires to get the whole page to load in screen which rises Previous errors (ignored in safari/opera)
To Jcart :-
To jeffery & d11wtq :-
The problems are things in code i left as it doesn't affect viewer it just requires what d11wtq said or just a @ just for good looking to FireBug users
To The Ninja Space Goat:-
Did you vanish Or you just wanted to ask ?
---------------------------------------------------------
I have something i want to hear from all of you about
i finished another communication memory that uses Memory not files in a more optimized way for Access , Synchronization , simpler code BUT -as you can guess - it requires something that is not available to all hosts well let's make it a speed-optimized alternative
I use MySql Heap Engine/Table so the problem is MySql is required but it benefits what i said
What do you all think ?
ASDen wrote:ALL the problem is FF is the only browser - i tried - that implements Ajax as it should and IE is the most one who volatile it
Then I am sorry to say, but if you are coding something for public use then you have to do some defensive coding to get around it...
Secondly, IE7 supports XHR object natively...
lastly, word is `violate` instead of `volatile`....