ASDen
Members-
Posts
18 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
ASDen's Achievements
Newbie (1/5)
0
Reputation
-
Hello This idea is based on giving an easily extendable BBCode Parser not just with smiles or simple BBCodes but also with Complex ones ( nested , custom PHP handling function ) In PHPClasses : http://www.phpclasses.org/browse/package/4829.html Documentation , Details & Example : http://harrrrpo.googlepages.com/bbengine --- Features and main points in brief :- 1)It depends on saving tags info in a DB for easy Extendability (as it provides out-of-code dynamic of adding , removing and deleting ) 2)Provides Processing Priority for each tag allowing for writting tags that depends on each others with no code modifications 3)The Class Provides Parsing/UnParsing in 4 types Direct Words : Directly replace words with others like ( {} =>Smile photo (html <img>) ) Direct Tags : Replace Html Tags with BBCode directly (text replace) like ( {b}ASD{/b} => <strong>ASD</strong> ) Indirect Non Recursive : Mainpulate content in BBCode with user defined function both for Parsing & UnParsing (Stored in DB) Content and Arguments of BB tag is supplied to the function here BBCode tags can't be Nested like ( {url=http://google.com}Google{/url} => {a href="http://google.com"}Google{/a} ) Indirect Recursive : The Same Indirect manner with the added ability of Parsing Nested tags like ( {size=20}Big {size=40}Bigger{/size}Word{/size} => <span style="font-size: 20px;">Big<span style="font-size:40px;">Big Label</span>Word</span> ) ( ofcource { here denotes [ but written like that not to be recognized by forum Parser ) 4)It also comes with some pre-made BBCodes as an SQL dump to provide most famous BBCodes ---- want to hear from you what you think about idea , implementation and any possible enhancements
-
Adding Multi-Threading to PHP (Purely New Idea Try it)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
Sorry missed up SF Download link it's: http://sourceforge.net/project/showfiles.php?group_id=203377&package_id=242365&release_id=617030 -
Adding Multi-Threading to PHP (Purely New Idea Try it)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
Hello everybody it's been around 9 months since the last update to class and finally i got time to it PHPThreader 1.6 Released you can get it from sf here : http://sourceforge.net/project/showfile ... _id=203377 or from phpclasses here : http://www.phpclasses.org/browse/package/4082.html --- The new version has the following features :- 1)Full Online Documentation of class here : http://ajphpth.sourceforge.net [An offline version is provided in sf] 2)new Communication Class : Shared Memory (shmop required ) 3)new Thread Calling Class : CliThread (using shell calls) 4)new Abstract Mutex Class which can be used from user defined Communication Clases . 5)new automatic System of thread watching 6) a simple loader to overcome path issues 7)new methods like Join() --- hope to hear from you about it Thanks -
PHPThreader 1.1 (Added ITC and Synchronization)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
Well after long time no hear i just want to say that the Class has been nominated for innovation competition at PHPClasses.org http://www.phpclasses.org/browse/package/4082.html There u will find modifications & Improvements i added -
PHPThreader 1.1 (Added ITC and Synchronization)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
Solved What? Where is your Feedback/Trails/Critiquing .......... Waiting -
PHPThreader 1.1 (Added ITC and Synchronization)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
You will find the classes now in SF fully commented ( hope you like it ) Awaiting for your Comments -
PHPThreader 1.1 (Added ITC and Synchronization)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
Well what sspoke is a simple efficient way of describing it and is exactly what i mean it makes use of given resources instead of wasting them -
PHPThreader 1.1 (Added ITC and Synchronization)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
(sorry for splitting but some un detected problem limiting post length ) 3. making real usage of the server processor 4. benefiting real threading abilities in Apache 2/IIS ? -
PHPThreader 1.1 (Added ITC and Synchronization)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
if you read the doc you can see you 1. can build really interactive interfaces 2. make full usage of your connection (download managers/multiple RSS readers) -
PHPThreader 1.1 (Added ITC and Synchronization)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
May be you didn't notice this thread:- http://www.phpfreaks.com/forums/index.php?topic=155604.0 -
Hey Guys , I released a second version of my Threading Class ;D i added(Inter Thread Communication) and data access Synchronization notice: the features above were added using a text file ,some string parsing and permissions for the Synchronization of data delivery . You can Get It here http://sourceforge.net/project/showfiles.php?group_id=203377 waiting For Your reviews and critique (Please Interact with me don't just take a quick look and GO).Thanks in advance
-
Adding Multi-Threading to PHP (Purely New Idea Try it)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
BUMP > -
Adding Multi-Threading to PHP (Purely New Idea Try it)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
UP this is not testing this is ignorance. But if downloading is that hard here is the code AjT.php <?php /*Author :ASDen(Mohmed Yousef) Email :harrrrpo@gmail.com Email me for any help or just encourage me and tell me it does work ! the Js class which implements Ajax*/ echo" <script language=\"JavaScript\"> var i=0; function Threader(url,num,parameters) { this.request = new XMLHttpRequest(); this.request.open(\"POST\", url, true); this.request.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\"); this.request.setRequestHeader(\"Content-length\", parameters.length); this.request.setRequestHeader(\"Connection\", \"close\"); this.params=parameters; this.Tnum=num; this.request.onreadystatechange=ChangeBag; this.begin=Starton; i=i+1; } function Starton() {this.request.send(this.params);} 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 == 4 && t[x].Tnum!=-1) {var r2=new XMLHttpRequest(); r2.open(\"GET\", \"Bag.php?num=\"+t[x].Tnum, true); r2.send(null); t[x].Tnum=-1;} } } var t=new Array(); </script> "; ?> Threader.php <?php /*Author :ASDen(Mohmed Yousef) Email :harrrrpo@gmail.com Email me for any help or just encourage me and tell me it does work ! The PHP Class implementing the Js Class */ require("AjT.php"); class Thread { var $pos; var $statevar; function __construct($url,$params) { $this->statevar=0; static $num=-1; $num++; $this->pos=$num; //new instance of the Js class echo "<script language=\"javascript\">"; echo "t[$num]=new Threader(\"$url\",$num,\"$params\");"; echo "</script>"; } function Go() { // fire on echo "<script language=\"javascript\">"; echo "t[$this->pos].begin();"; echo "</script>"; flush(); } function State() { if($this->statevar==0){$this->statevar=file_exists($this->pos);} if(file_exists($this->pos)==1){unlink($this->pos); } return $this->statevar ; // return file_exists($this->pos); } function alert($t) { //just a small alerting in php irrelevant but i like it echo "<script language=\"javascript\">"; echo "alert($t);"; echo "</script>"; flush(); } } ?> Bag.php <form name="asd" action="Bag.php" method="GET"> <input type="text" name="num"> </form> <?php /*Author :ASDen(Mohmed Yousef) Email :harrrrpo@gmail.com Email me for any help or just encourage me and tell me it does work ! here is invoked when a thread has finished and we creat a file to show this */ $f=fopen($_GET["num"],'wb'); ?> the PDM example PDM.php <?php /*Author :ASDen(Mohmed Yousef) Email :harrrrpo@gmail.com Email me for any help or just encourage me and tell me it does work ! Example 2 main script (a download manager)*/ require("Threader.php"); ini_set('max_input_time','0'); ini_set('max_execution_time','0'); ini_set('max_input_time','0'); //the file to be downloaded url $url="http://belnet.dl.sourceforge.net/sourceforge/sevenzip/7z442.exe"; //number of connections $num=5; $ss=remote_file_size($url); $part=floor($ss/$num); echo "<html><body><form name=\"asd\">"; for($i=0;$i<$num;$i++) { echo "Part$i <input type=\"text\" name=\"a$i\"><br>"; } echo "</form></body>";flush(); $i=0; for($i=0;$i<$num-1;$i++) { //initialize threads $e[$i]=new Thread("PartDownloader.php","Fname=$url&FFname=asd$i.asd&Range=".($i*$part)."-".(($i+1)*$part-1)); $e[$i]->Go(); } $e[$num-1]=new Thread("PartDownloader.php","Fname=$url&FFname=asd$i.asd&Range=".(($num-1)*$part)."-".(1*$ss)); $e[$num-1]->Go(); //monitor the status of downloading while (all($e,$num)) { sleep(0.5); echo "<script language=\"javascript\">"; for($i=0;$i<$num;$i++) { echo "document.asd.a$i.value="."\"".(round(remote_file_size("http://localhost/asd$i.asd")/$part*100,2))."%\";"; } echo "</script>"; flush(); } $ww=fopen("asd.exe","wb"); fclose($ww); $ww=fopen("asd.exe",'a'); for($i=0;$i<$num;$i++) { $wh=fopen("asd$i.asd",'r'); fwrite($ww,fread($wh,filesize("asd$i.asd"))); fclose($wh); unlink("asd$i.asd"); } function all($e,$num) { for($i=0;$i<$num;$i++) {if($e[$i]->State()==0){return 1;}} return 0; } //a big function but yet very helpfull to get file size as filesize function doesnot work properly function remote_file_size ($url) { $head = ""; $url_p = parse_url($url); $host = $url_p["host"]; $path = $url_p["path"]; $fp = fsockopen($host, 80, $errno, $errstr, 20); if(!$fp) { return false; } else { fputs($fp, "HEAD ".$url." HTTP/1.1\r\n"); fputs($fp, "HOST: dummy\r\n"); fputs($fp, "Connection: close\r\n\r\n"); $headers = ""; while (!feof($fp)) { $headers .= fgets ($fp, 128); } } fclose ($fp); $return = false; $arr_headers = explode("\n", $headers); foreach($arr_headers as $header) { $s = "Content-Length: "; if(substr(strtolower ($header), 0, strlen($s)) == strtolower($s)) { $return = substr($header, strlen($s)); break; } } return $return; } ?> PartDownloader.php <html> <head> <title>Personal INFO</title> </head> <body> <form method="post" action="<?php echo $PHP_SELF;?>"> URL:<input type="text" name="Fname"> name:<input type="text" name="FFname"> Range:<input type="text" name="Range"> <input type="submit" value="Down&Mail" name="submit"> </form> <?php /*Author :ASDen(Mohmed Yousef) Email :harrrrpo@gmail.com Email me for any help or just encourage me and tell me it does work ! Example 2 thread more complicated downloads of parts */ $url=trim($_POST["Fname"]); $range=$_POST["Range"]; $wh = fopen($url, 'wb'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_RANGE,$range); $file_target=$_POST["FFname"]; $wh = fopen($file_target, 'wb'); curl_setopt($ch, CURLOPT_FILE, $wh); $dataq = curl_exec($ch); curl_close ($ch); fclose($wh); ?> </body> </html> Hh it's ur JOB now I'm waiting -
Adding Multi-Threading to PHP (Purely New Idea Try it)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
Thanks alot for your concern Ok this is a point i will add it i think u will like trying the second example it is a PDM(Php Download Manager) which has the abillity to open a number of connections at the same time and display a simple progress of each connection i was thinking of an RSS reader example that graps them from multiple resources at the same time which saves time and makes the best use of the internet connection . But i didn't find good examples for reading RSS feads using PHP ??? -
Adding Multi-Threading to PHP (Purely New Idea Try it)
ASDen replied to ASDen's topic in Beta Test Your Stuff!
May Because it's tar try using 7-zip