Jump to content

shamuntoha

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by shamuntoha

  1. Many thanks for comments. some sites benchmerk show things slowing down while using lot of things which is not thought more before creating it, where i am doing a open source project for VML, XML, SVG, JS (respecting large hits). http://www.php.lt/benchmark/phpbench.php do we care those staff while doing php?
  2. i did this for my w2k3 working. win: reboot_pc.bat: net user administrator back_to_old_password_on_hack shutdown -r -f -c "Daily or weekly" unix: file /etc/ini.. still trying...
  3. Thanks to all, but i read a article that storing inside class, cause memory or performance issues ? like not all programs need OOP.
  4. index.php global $a; class.php function called_from_index() { & $a = 4; } do you mean from above, i have to use global to change the $a?
  5. Server maintain: In windows 2003, i setup a schedule for weekly: shutdown -r -f -c "Maintain" Q. How i can do this for my Solaris 5 ? Q. How i can put the Windows 2003 batch command to reboot and change back the password of "Administrator" to the password that i assigned, in case of someone hack and changed. Q. How i can put Solaris 5, script to on reboot execute. #passwd rootpassword to myoldpassword #myCppprogram restart #mail central management
  6. Where i can post my questions of Windows 2003, Solaris 5, 8, 10, like batch file and auto schedule scripts.
  7. Question is not so clear. Is your password encrypted ? by using base64 or md5 then you need to decode it. Two way its mostly encode and decode, either by your front page, or from mysql function itself. $password = "helo"; $encrypt_pwd = base64_encode($password); ($password == $encrypt_pww) ! true : false; $decrypt_pwd = base64_decode($password); ($password == $decrypt_pwd) ! true : false;
  8. if you mean to loop: for ($i=0; $i<6; $i++) { switch ($i) { case 5: echo "6 Times looped, call array": echo array[0].array[1].array[2]; break; } } or if u mean. foreach ($array in $key=>$value ) { if ($key == 2 ){ $array_scaned = true; } }
  9. function ..() { global $all_pages; } is global inside function, same like outside functions to define?
  10. shamuntoha

    PHP

    php interview asked few questions. i failed to answer it in 1 minute. does anyone know it? Q.1 what is the x and y value ? x+y = 3 x-y = 4 Q.2 what is the result? {1, 2, 3, 4, 6}
  11. Why to use === ? Why not only use ==?
  12. Thanks, i came to this code, which is much faster. <?php /** * If any errors * - Large file handle * - 100mb to 200mb * - unix grep use, tail etc */ error_reporting(E_ALL); // File total size $fsize = filesize("d:\\log24"); // for ini_set $fsize += 32 * 100 * 1024; // ini_set("memory_limit", $fsize . "M"); // Set memory to use ini_set("memory_limit","90M"); // Start and Download move $send = 0; // Set the chunk $chunk = (2 << 20); // Create large array. $buffer = array(); // File resource $ex = fopen("d:\\log24", "rb"); // Attempts to try $i=0; // Loop to get data as binary safe while($send <= $fsize){ $buffer[$i] = explode('---', fread($ex,$chunk) ); $send += $chunk; $i++; } // Close resource fclose($ex); // Clear send unset ($send); // Output the data foreach($buffer as $key=>$value){ echo $key; } // Clear ram unset($buffer); // Exit exit(0); ?>
  13. What do you mean by this ? can you explain? "split the file yourself"
  14. Did you mean to do following ? 3 different method try. new 2 as following. Handle 1: Notice: Undefined variable: line in D:\xampp\htdocs\jony\index.php on line 6 Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292271 bytes) in D:\xampp\htdocs\jony\index.php on line 6 <?php error_reporting(E_ALL); //ini_set("memory_limit","M"); $file = fopen("d:\\log24", "r"); while ( !feof($file) ) { $line = $line . fgets($file); } $ex = explode('---', $line); echo $ex[0]; exit(0); ?> Handle 2: Notice: Undefined variable: line in D:\xampp\htdocs\jony\index.php on line 10 Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 31457281 bytes) in D:\xampp\htdocs\jony\index.php on line 10 <?php error_reporting(E_ALL); //ini_set("memory_limit","M"); $send = 0; $chunks = (2 << 20); $total = filesize("d:\\log24"); $file = fopen("d:\\log24", "r"); while ( $send < $total ) { $line = $line . fread($file, $chunks); $send += $chunks; } $ex = explode('---', $line); echo $ex[0]; exit(0); ?>
  15. Yes split in parts is also not helping showing the allocation error. Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to allocate 15358622 bytes) in D:\xampp\htdocs\jony\index.php on line 6 <?php error_reporting(E_ALL); ini_set("memory_limit","80M"); $f1 = file_get_contents("d:\\log24"); $total = strlen($f1); $part1 = substr($f1, 0, $total/5 ); //$part 2= substr($f1, $total/2, $total ); $ex = explode("---", $part1); echo $ex[0]; exit(0); ?>
  16. Once i need to open it and split it by '---' to an array item. Output result is less, so its not risk for freezing the browser. But explode is the main requirement for this file. ??? log24 contain: /*/**/*sadfdsf*adsfewe343242342343243324324adfdsfdsfdsfsdfdsfsdfsfsasfsfd --- /*/**/*sa3333333333333333333333333333342342343243324324adfdsfdsfdsfsdfdsfsdfsfsasfsfd --- /*/**/*sadfdsf*adsfewe343242342343243324324adfdsfdsfdsfsdfdsfsdfsfsasfsfd --- /*/**/*sadfdsf*adsfewe343244556566666666666fdsfdsfsdfdsfsdfsfsasfsfd ---
  17. This is the error getting while trying outside phpDesigner 2008. Fatal error: Allowed memory size of 103809024 bytes exhausted (tried to allocate 588 bytes) in D:\xampp\htdocs\jony\index.php on line 8 <?php error_reporting(E_ALL); ini_set("memory_limit","99M"); $f1 = file_get_contents("d:\\log24"); $total = strlen($f1); //$deel1 = substr($f1, 0, $total/2 ); //$deel2 = substr($f1, $total/2, $total ); $ex = explode("---", $f1); echo $ex[0]; exit(0); ?>
  18. Trying to cut a large file in parts and print it , but why its now pringing? i am using phpDesigner 2008. <?php /** * Large file devide in small part * */ //error_reporting(E_ALL); // Take the whole file as string $f1 = file_get_contents("log24"); // Reserve the size as len $total = strlen($f1); // Cut in pieces $part1 = substr($f1, 0, $total/2 ); // $part2 = substr($f1, $total/2, $total); // Part 1 - Array the needs $ex1 = explode("---", $part1); // Part 2 - Array the needs $ex2 = explode("---", $part2); echo $ex1[0]; echo $ex2[0]; exit(0); ?>
  19. [suggested use]: Large file handlers, please use this formula. The chunks method is speed processing of large files much faster then not using it. Output is also possible to speed by using the header contents, but in anyway my handle for 80 to 100mb files are much faster with following codes. <?php /** * Error report if any */ error_reporting(E_ALL); // manualy assign the RAM reserve // ini_set("memory_limit","16M"); /** * File settings * */ $filepath="d:\\log24"; // File size $total = filesize($filepath); // Memory use $blocksize = (2 << 20); //2M chunks // Download $sent = 0; // File pointer $handle = fopen($filepath, "r"); /** * Assign the page with content * header('Content-type: '.$content_type); */ header('Content-Disposition: attachment; filename=log24'); header('Content-length: '.$total); // Now we need to loop through the file and echo out chunks of file data // Processing is faster while($sent < $total){ $buffer = fread($handle, $blocksize); $sent += $blocksize; } // Output is standard // It depends now what exactly i should use $split = explode('---', $buffer); echo $split[3]; exit(0); ?>
  20. How we do this ? one case is solved but another case it is not. Code 1: works because 1024 <?php error_reporting(E_ALL); // This is the virtual FTP drive files. /** * log24 contain lines like this. * file size 73.5mb. * aaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbb --- * aaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccc --- * */ $v_sfilelist="d:\\log24"; // Open the file read only if ($lines = @fopen($v_sfilelist, "r") ){ // Loop the whole file until it end while(!feof($lines) ){ // Take only 100 lines to quick test $buffer = fread($lines, 1024); } // Close the file its done. fclose($lines); } // From the buffer, make array of real needs $split = explode('---', $buffer); // clear the memory unset($buffer); foreach ($split as $line_num => $line) { // print it echo $line . '<br/>'; } ?> Code 2: hang machine <?php error_reporting(E_ALL); // This is the virtual FTP drive files. /** * log24 contain lines like this. * file size 73.5mb. * aaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbb --- * aaaaaaaaaaaaaaaaaaaaaaaa * bbbbbbbbbbbbbbbbbbbbbbbb * cccccccccccccccccccccccc --- * */ $v_sfilelist="d:\\log24"; // Open the file read only if ($lines = @fopen($v_sfilelist, "r") ){ // Loop the whole file until it end while(!feof($lines) ){ // Take only 100 lines to quick test $buffer = fread($lines); } // Close the file its done. fclose($lines); } // From the buffer, make array of real needs $split = explode('---', $buffer); // clear the memory unset($buffer); foreach ($split as $line_num => $line) { // print it echo $line . '<br/>'; } ?> (edited by kenrbnsn to add tags)
  21. this is the solution. instead of using fgets. fread($file_, 1024);
  22. I am using this command and it seems the machine go to freeze and doesnt output anything only keep the page busy. The file i am trying to search and print size is 76.79Mb. log24 file data: 8888888888888 aaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbb --- 2222222222222 aaaaabbbbbbbbbbbbbb aaaaaaaaaaaaacccccc --- <?php // This is the virtual FTP drive files. $v_sfilelist="z:\\usr2\\log\\log24" // Open the file read only if ($lines = @fopen($v_sfilelist, "r") ){ // Loop the whole file until it end while(!feof($lines) ){ // Take only 100 lines to quick test $buffer = $buffer . fgets($lines,100); } // Close the file its done. fclose($lines); } // From the buffer, make array of real needs $split = explode('---', $buffer); // clear the memory unset($buffer); foreach ($split as $line_num => $line) { // print it echo $line; } ?>
  23. Why its not printing? Where could be the wrong? <? $host="localhost"; $solaris = $_SESSION[$host]['one']; // basic parameters $solaris['one']=1; $solaris['two']=2; $solaris['three']=3; $solaris['four']=4; echo $_SESSION['localhost']['one']['three']; ?>
  24. What is PHP MVC ? How to get started with it? Tutorials, etc. Best reg
  25. Thanks a big, Fixed, server issue not code problem. 1) Go to: start > settings > control panel > Administrative Tools > Internet Information Services 2) Expand the " (local computer)" node 3) Right click on your SMTP server > go to "Properties" 4) Click "Access" tab 5) Under Relay Restrictions, click the "Relay" button 6) Click "Add" 7) Select "Single Computer" and enter IP address 127.0.0.1 or public ip Hit OK, OK, OK (until the properties dialog is closed)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.