php-general Digest 18 Sep 2006 16:14:53 -0000 Issue 4354
php-general Digest 18 Sep 2006 16:14:53 - Issue 4354 Topics (messages 241876 through 241883): Re: how to get page count when uploading files 241876 by: Chris 241881 by: Kae Verens How to parse raw mail headers and messages? 241877 by: Mathijs 241878 by: Chris how to build env to develop php extension 241879 by: junhui bai 241883 by: Michael B Allen Re: DOMDocument-saveXML() 241880 by: Tom Atkinson [ANN] Code Golf Challenge : 1,000 Digits Of Pi 241882 by: Carl Drinkwater Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Jian Fu wrote: Oh, btw, I use PHP ftp function to upload the file, but there is no information in $_FILES to tell me the total page for Word or PDF file. As Stefan said, there is no way for php to know that number - no matter whether you upload it through a form or through ftp. If you want to find out how to use the ftp functions, look at the manual first - http://www.php.net/ftp If you have any questions after that send them through. -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- Jian Fu wrote: I really need help and after going through the help page, I don't know where I can post my question. When I upload a file (word or pdf), how can I know the page counts of that file immediately? Thank you, Jian http://ie.php.net/manual/en/function.pdf-get-pdi-value.php appears to have the answer for PDFs I don't know the answer for Word documents Kae ---End Message--- ---BeginMessage--- Hello there, Is there a way to parse mail headers from a RAW mail received from sendmail? Like extracting the from, reply-to etc.. etc.. and also the message(s). Also mabye Multipart email's en attachments? Thx in advance. ---End Message--- ---BeginMessage--- Mathijs wrote: Hello there, Is there a way to parse mail headers from a RAW mail received from sendmail? Like extracting the from, reply-to etc.. etc.. and also the message(s). Also mabye Multipart email's en attachments? IMAP can pick up some of this. http://www.php.net/manual/en/function.imap-fetchstructure.php -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- There are a lot of documentation to tell you how to create php extension on unix platform . For example, using tool phpize to create skeleton and son. But I can't find information on how to create php extension on window platform. I installed php on window xp flatform from both source code and binary package, but I can't find the tool phpize on window hosts. So could you please tell me how to create php extension on window platform? Thank you very much. Best regards, -Junhui Bai ---End Message--- ---BeginMessage--- On Mon, 18 Sep 2006 15:53:21 +0800 junhui bai [EMAIL PROTECTED] wrote: There are a lot of documentation to tell you how to create php extension on unix platform . For example, using tool phpize to create skeleton and son. But I can't find information on how to create php extension on window platform. I installed php on window xp flatform from both source code and binary package, but I can't find the tool phpize on window hosts. So could you please tell me how to create php extension on window platform? Thank you very much. I don't have a definitive answer for you but there's not much to the bare skeleton of an extension. Just copy one of the existing ones and start from that. That's what I did (although I didn't use Windows). Mike -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ ---End Message--- ---BeginMessage--- Pass the root node of your tree as a parameter to saveXML() Chris Boget wrote: I looked all through the documentation but was unable to find out if this was possible and, if so, how. When you call -saveXML(), it prints out the XML declaration ?xml version=1.0? alont with the structure of the document. Is there any way to suppress that? I'm trying to print out extra text (in the form of a stylesheet call) and the declaration that -saveXML() prints out is messing everything up. Would it be possible to point to the relevant page in the documentation that discusses how to do this? thnx, Chris ---End Message--- ---BeginMessage--- Hi all, Code Golf's 12th challenge has just been added to the site. It asks you to calculate the first 1,000 digits of Pi - Something I'm sure most of you have thought about, but never done. You can see the challenge at : http://codegolf.com/1000-digits-of-pi For those who haven't heard of codegolf.com, it can be described as allowing you to show off your code-fu by trying to solve coding problems using the least number of keystrokes.
[PHP] How to parse raw mail headers and messages?
Hello there, Is there a way to parse mail headers from a RAW mail received from sendmail? Like extracting the from, reply-to etc.. etc.. and also the message(s). Also mabye Multipart email's en attachments? Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to parse raw mail headers and messages?
Mathijs wrote: Hello there, Is there a way to parse mail headers from a RAW mail received from sendmail? Like extracting the from, reply-to etc.. etc.. and also the message(s). Also mabye Multipart email's en attachments? IMAP can pick up some of this. http://www.php.net/manual/en/function.imap-fetchstructure.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to build env to develop php extension
There are a lot of documentation to tell you how to create php extension on unix platform . For example, using tool phpize to create skeleton and son. But I can't find information on how to create php extension on window platform. I installed php on window xp flatform from both source code and binary package, but I can't find the tool phpize on window hosts. So could you please tell me how to create php extension on window platform? Thank you very much. Best regards, -Junhui Bai -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOMDocument-saveXML()
Pass the root node of your tree as a parameter to saveXML() Chris Boget wrote: I looked all through the documentation but was unable to find out if this was possible and, if so, how. When you call -saveXML(), it prints out the XML declaration ?xml version=1.0? alont with the structure of the document. Is there any way to suppress that? I'm trying to print out extra text (in the form of a stylesheet call) and the declaration that -saveXML() prints out is messing everything up. Would it be possible to point to the relevant page in the documentation that discusses how to do this? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to get page count when uploading files
Jian Fu wrote: I really need help and after going through the help page, I don't know where I can post my question. When I upload a file (word or pdf), how can I know the page counts of that file immediately? Thank you, Jian http://ie.php.net/manual/en/function.pdf-get-pdi-value.php appears to have the answer for PDFs I don't know the answer for Word documents Kae -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [ANN] Code Golf Challenge : 1,000 Digits Of Pi
Hi all, Code Golf's 12th challenge has just been added to the site. It asks you to calculate the first 1,000 digits of Pi - Something I'm sure most of you have thought about, but never done. You can see the challenge at : http://codegolf.com/1000-digits-of-pi For those who haven't heard of codegolf.com, it can be described as allowing you to show off your code-fu by trying to solve coding problems using the least number of keystrokes. The site currently supports Perl, PHP, Python and Ruby with Scheme to (hopefully) follow soon. Your entries are automatically executed and scored - No need to wait for someone to validate your code. Other challenges include implementing the Vigenere Cipher, Prime factors, SHA-256 Hashing as well as the obvious 99 Bottles Of Beer. All of the challenges are competitive but there is still scope to well in them, even if you're new to the site, and perhaps surprisingly, PHP is doing well in a couple of the challenges. I hope some of you will find this interesting, and sorry for disturbing you if not! Have fun, Carl. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to build env to develop php extension
On Mon, 18 Sep 2006 15:53:21 +0800 junhui bai [EMAIL PROTECTED] wrote: There are a lot of documentation to tell you how to create php extension on unix platform . For example, using tool phpize to create skeleton and son. But I can't find information on how to create php extension on window platform. I installed php on window xp flatform from both source code and binary package, but I can't find the tool phpize on window hosts. So could you please tell me how to create php extension on window platform? Thank you very much. I don't have a definitive answer for you but there's not much to the bare skeleton of an extension. Just copy one of the existing ones and start from that. That's what I did (although I didn't use Windows). Mike -- Michael B Allen PHP Active Directory SSO http://www.ioplex.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to build env to develop php extension
On 9/18/06, junhui bai [EMAIL PROTECTED] wrote: There are a lot of documentation to tell you how to create php extension on unix platform . For example, using tool phpize to create skeleton and son. But I can't find information on how to create php extension on window platform. I installed php on window xp flatform from both source code and binary package, but I can't find the tool phpize on window hosts. So could you please tell me how to create php extension on window platform? Thank you very much. Best regards, -Junhui Bai -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Maybe you might get more responses from the PECL mailing list? http://pecl.php.net/support.php
[PHP] Scripts taking too much time
Hi, I'm hoping somebody can give me advice on how I can go about debugging a problem I've been having. The bottom of this email has some of the details of my system. There is an intermittent slowness throughout my site. At seemingly random points in random scripts at random times it just seems to wait. A few of these have been as long as 600 seconds, just sitting there, apparently doing nothing. I've tried tracking down the problem using microtime(), that jsut showed me how (mostly) random it was. The least complex area in which I was able to isolate a problem was a 15 line chunk of HTML, with some ?=MY_CONSTANT? in them. I'd appreciate any advice or suggestions, thanks! Chris ==[Details]=== I've compiled both Apache and PHP, neither are RPMs: Apache 2.0.55 (Compiled with mod_prefork) PHP 5.1.2 (module) CentOS 4.2 (Essentially a repackaged Red Hat Enterprise 4) I'm averaging about 2 requests a second, spiking occasionally to 10 per second, but not very often. At no time is anything on the server maxed out CPU sometimes gets to 20%, memory never hits swap (at least not that I can see), disk activity is minimal (my database is not on the same server). My site has a decent amount of includes, it's probably doing 30-40 includes per request, with an occasional require or two. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts taking too much time
On 9/18/06, Chris [EMAIL PROTECTED] wrote: Hi, I'm hoping somebody can give me advice on how I can go about debugging a problem I've been having. The bottom of this email has some of the details of my system. There is an intermittent slowness throughout my site. At seemingly random points in random scripts at random times it just seems to wait. A few of these have been as long as 600 seconds, just sitting there, apparently doing nothing. I've tried tracking down the problem using microtime(), that jsut showed me how (mostly) random it was. The least complex area in which I was able to isolate a problem was a 15 line chunk of HTML, with some ?=MY_CONSTANT? in them. I'd appreciate any advice or suggestions, thanks! Chris ==[Details]=== I've compiled both Apache and PHP, neither are RPMs: Apache 2.0.55 (Compiled with mod_prefork) PHP 5.1.2 (module) CentOS 4.2 (Essentially a repackaged Red Hat Enterprise 4) I'm averaging about 2 requests a second, spiking occasionally to 10 per second, but not very often. At no time is anything on the server maxed out CPU sometimes gets to 20%, memory never hits swap (at least not that I can see), disk activity is minimal (my database is not on the same server). My site has a decent amount of includes, it's probably doing 30-40 includes per request, with an occasional require or two. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you have a dev site you might consider using Xdebug's profiling features (http://xdebug.org/docs-profiling.php) to see every function call, include, etc to figure out where the bottleneck is happening. This might point you in the right direction in finding out why something is being slow. One cool thing is that you can set Xdebug to automatically generate cachegrind files for each request since your problem seems to be intermittent.
[PHP] Frustrated trying to get help from your site
I am a programmer who is fairly new to PHP, and I had a problem trying to make changes to existing code. I tried to look up any existing documentation on your site, and after an extensive search, I finally found someone who has the same problem. The only problem is that he said something about applying a snapshot that fixed his problem. I think I finally found the place on your site where these snapshots are kept, but I am unable to download the .ZIP file because of security here at our facility. The thing is, I'm not even sure whether I'm on the right page, or whether this will actually fix my problem, or what I'm supposed to do with this snapshot once I get it. You have no documentation (that I can find) about what a snapshot is, or how to download it, or what to do with it. I think I'm going to have to submit a bug report, because I don't know what else to do on your site (even though I've run across several warnings NOT to submit a bug report if a problem has already been reported). Your site is incredibly frustrating and difficult to navigate. Tim Howard Calhoun ISD Dept. of Technology (269) 789-2465 This email is intended only for the use of the addressee(s) named herein. It may contain legally privileged and confidential information. If you are not the intended recipient, or an authorized representative of the intended recipient, you are hereby notified that any review, copying or distribution of this email and its attachments, if any, is strictly prohibited. If you have received this email in error, please immediately notify the sender by return email and delete this email from your system. Thank you.
RE: [PHP] Frustrated trying to get help from your site
[snip] I am a programmer who is fairly new to PHP, and I had a problem trying to make changes to existing code. I tried to look up any existing documentation on your site, and after an extensive search, I finally found someone who has the same problem. The only problem is that he said something about applying a snapshot that fixed his problem. I think I finally found the place on your site where these snapshots are kept, but I am unable to download the .ZIP file because of security here at our facility. The thing is, I'm not even sure whether I'm on the right page, or whether this will actually fix my problem, or what I'm supposed to do with this snapshot once I get it. You have no documentation (that I can find) about what a snapshot is, or how to download it, or what to do with it. I think I'm going to have to submit a bug report, because I don't know what else to do on your site (even though I've run across several warnings NOT to submit a bug report if a problem has already been reported). Your site is incredibly frustrating and difficult to navigate. [/snip] So let me send a rant to other users, in fact a general list of users, because I cannot read. If I could I would know that I subscribed to a list where questions are asked to other users rather than me trying to send an e-mail to the president of PHP (a hat worn proudly). The entire sire is documentation and anywhere from one to five minutes of even the lightest reason would have spelled that out, not to mention that the second link across the top of the page says in very vague terms, 'documentation'. Is this a run on paragraph? I am asking because English is incredibly frustrating and difficult to use. Department of Technology indeed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frustrated trying to get help from your site
On 9/18/06, Howard, Tim [EMAIL PROTECTED] wrote: I am a programmer who is fairly new to PHP, and I had a problem trying to make changes to existing code. I tried to look up any existing documentation on your site, and after an extensive search, I finally found someone who has the same problem. The only problem is that he said something about applying a snapshot that fixed his problem. I think I finally found the place on your site where these snapshots are kept, but I am unable to download the .ZIP file because of security here at our facility. The thing is, I'm not even sure whether I'm on the right page, or whether this will actually fix my problem, or what I'm supposed to do with this snapshot once I get it. You have no documentation (that I can find) about what a snapshot is, or how to download it, or what to do with it. I think I'm going to have to submit a bug report, because I don't know what else to do on your site (even though I've run across several warnings NOT to submit a bug report if a problem has already been reported). Your site is incredibly frustrating and difficult to navigate. Tim Howard Calhoun ISD Dept. of Technology (269) 789-2465 Tim, I don't know if you posted to this mailing list with the issues you've been having, but folks here - IMO - are more than happy to lend a hand when given a chance. David
Re: [PHP] Frustrated trying to get help from your site
Jay Blanchard wrote: So let me send a rant to other users, in fact a general list of users, because I cannot read. If I could I would know that I subscribed to a list where questions are asked to other users rather than me trying to send an e-mail to the president of PHP (a hat worn proudly). The entire sire is documentation and anywhere from one to five minutes of even the lightest reason would have spelled that out, not to mention that the second link across the top of the page says in very vague terms, 'documentation'. Is this a run on paragraph? I am asking because English is incredibly frustrating and difficult to use. Department of Technology indeed. As an aside, I think that the online and offline (downloadable) PHP documentation is probably the clearest, best organized and complete set of documentation for any programming language I've run into online. I honestly think that the PHP coders/documentors deserve a lot of gratitude for the immense effort that must have gone into documenting the immense list of built-in stuff that PHP has. jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] My apologies
I have been duly chastised. I offer my sincere apologies to all of you who were insulted and/or offended by my Frustrated trying to get help from your site email. I have been working with PHP for a few months now, doing only necessary maintenance on existing sites written by someone who is no longer here. I was told that the PHP site has lots of useful information, and I agree completely that it does. I apologize for not being entirely familiar with your site, and also for venting my frustrations using the first email link I found on the site. I am quite used to having to search extensively to find the answers to unusual problems, but I figured the best place to start was in the program documentation on your site. When I find the solution to my problem, I will be sure to add comments to the appropriate page so that you will not have to endure the ranting of frustrated programmers. Tim Howard Calhoun ISD Dept. of Technology (269) 789-2465 This email is intended only for the use of the addressee(s) named herein. It may contain legally privileged and confidential information. If you are not the intended recipient, or an authorized representative of the intended recipient, you are hereby notified that any review, copying or distribution of this email and its attachments, if any, is strictly prohibited. If you have received this email in error, please immediately notify the sender by return email and delete this email from your system. Thank you.
Re: [PHP] My apologies
On Mon, 2006-09-18 at 14:51 -0400, Howard, Tim wrote: I have been duly chastised. I offer my sincere apologies to all of you who were insulted and/or offended by my Frustrated trying to get help from your site email. I have been working with PHP for a few months now, doing only necessary maintenance on existing sites written by someone who is no longer here. I was told that the PHP site has lots of useful information, and I agree completely that it does. I apologize for not being entirely familiar with your site, and also for venting my frustrations using the first email link I found on the site. I am quite used to having to search extensively to find the answers to unusual problems, but I figured the best place to start was in the program documentation on your site. When I find the solution to my problem, I will be sure to add comments to the appropriate page so that you will not have to endure the ranting of frustrated programmers. While we're not here to vent rants upon, we are here to help when we can. Provided you show a minimal degree of having attempted to find the solution for yourself, we are almost always willing to help you with specific problems. Feel free to post you particular issues to the forum and maybe we can help. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts taking too much time
On Mon, September 18, 2006 11:54 am, Chris wrote: I'm hoping somebody can give me advice on how I can go about debugging a problem I've been having. The bottom of this email has some of the details of my system. There is an intermittent slowness throughout my site. At seemingly random points in random scripts at random times it just seems to wait. A few of these have been as long as 600 seconds, just sitting there, apparently doing nothing. I've tried tracking down the problem using microtime(), that jsut showed me how (mostly) random it was. The least complex area in which I was able to isolate a problem was a 15 line chunk of HTML, with some ?=MY_CONSTANT? in them. Are you running any of the cache programs such as APC/Turck/Zend Cache? Or the Zend Optimizer? Try disabling those and re-running the tests, just to be certain it's not the cache acting up. I'd also suggest trying some other tools to monitor the activities -- just in principle, to be certain that the monitors themselves are accurate. I have no particular package in mind -- Just that two heads are better than one when trying to view what's happening at that level of detail. My site has a decent amount of includes, it's probably doing 30-40 includes per request, with an occasional require or two. Just in general, I'd suggest that 30-40 includes per request is a bit excessive... Can none of them be combined? I *believe* the big hit for an include is in the disk seek, not reading and parsing some bits of PHP code. This is not likely to be at all related to your current issue -- just a general observation. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to parse raw mail headers and messages?
On Mon, September 18, 2006 1:48 am, Mathijs wrote: Is there a way to parse mail headers from a RAW mail received from sendmail? There MUST be a way, or none of us could get email... :-) Like extracting the from, reply-to etc.. etc.. and also the message(s). You know the headers are done when you hit a blank line. Finding individual headers is pretty much a case of testing for From: or whatever at the beginning of a line. Also mabye Multipart email's en attachments? Sure. One of the headers will have the separator and then you just explode on that. Due to the vagaries of various MTAs, if you need a GENERAL solution for email that anybody can just use, I'd try to go with something pre-packaged from http://phpclasses.org or PECL or PEAR or... If you are just trying to read your own email from a single server, you could probably hack something just as fast as you could fight through the docs on a pre-packaged version. Also see http://php.net/imap of course, as noted previously. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOMDocument-saveXML()
On Sun, September 17, 2006 3:48 pm, Chris Boget wrote: Would it be possible to point to the relevant page in the documentation that discusses how to do this? If there is nothing builtin to do it, how tricky could it be to strip off the first line after you saved it?... Crude, but effective, Captain -- Spock -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: loadHTML/loadHTMLFile - DOM functions
On Sun, September 17, 2006 9:48 am, Leonidas Safran wrote: I'm far from an international expert, but I believe that if you want ALL browsers to behave (and not just IE) then you want to use HEADERS for your content type and charset, as well as the embedded META tag. IE trusts Web Designers and their META tags. Mozilla trusts Web Servers and their headers. YMMV NAIAV (Not applicable in all versions) Sigh. echo !DOCTYPE HTML PUBLIC \-//W3C//DTD HTML 4.01 Transitional//EN\\n\http://www.w3.org/TR/html4/strict.dtd\;; //echo !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0 Transitional//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\;\n; echo html\n; echo head\n; echo titleTecDax/title\n; echo script src = '../javascript/tecdax.js' type = 'text/javascript'/script\n; echo meta http-equiv = 'content-type' content = 'text/html; charset=UTF-8'\n; echo /head\n; echo body onLoad = 'getAllStocks();showAllStocks();'\n; echo div style = 'display:none;' id = 'tecdax'\n; echo $this-ticker . \n; echo /div\n; echo /body\n; echo /html\n; } } $stocks = new Stocks(); code(2) /* functions for tecdax stocks ticker */ var tecdax = ; function getAllStocks(){ tecdax = document.getElementById(tecdax).innerHTML; } function showAllStocks(){ var stocks = document.getElementsByName(stock); var stock = new Array(); for( i = 0 ; i stocks.length ; i++ ){ stock[i] = new Array(); var tmp_stock = new Array(); tmp_stock[i] = stocks[i].innerHTML; var attributes = tmp_stock[i].split(--sep--); var x = 0; for( j = 0 ; j attributes.length ; j++ ){ var result = attributes[j].match(/\w/gi); if( ! result ){ continue; }else{ //attributes[j].replace(/[Â|±]+/,); stock[i][x] = attributes[j] + ; x++; } } alert(stock[i]); } document.getElementById(tecdax).innerHTML = stock[0] + + stock[1]; document.getElementById(tecdax).style.fontSize = 11px; document.getElementById(tecdax).style.display = inline; } -- Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOMDocument-saveXML()
Would it be possible to point to the relevant page in the documentation that discusses how to do this? If there is nothing builtin to do it, how tricky could it be to strip off the first line after you saved it?... Not tricky at all. Crude, but effective, Captain -- Spock Exactly. I was just hoping for something a bit more elegant. Hopefully using something that was built in to DOMDocument. Oh, well. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frustrated trying to get help from your site
Howard, Tim wrote: snip Your site is incredibly frustrating and difficult to navigate. My site? Hmmm, I always thought it was pretty easy to navigate. I mean, if you're looking for draft beer equipment, all you have to do is click on the draft beer equipment link. I don't know how I can make that easier, but I will give it the old college try. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Odd PHP memory issue
On Sat, September 16, 2006 10:35 am, Matthew H. North wrote: So you are just visiting the nodes, and not doing anything with them? We're appending certain fields to put together a total result. Be very very very careful here... If you throw enough strings around, and append things enough different ways, you may confuse PHP's reference counter enough that it can't be CERTAIN that you are done with a string. Use unset() on any string variable you are done with especially in tight loops. This MAY be fixed in current PHP -- I just know it was once an issue. Great idea -- I just completed a degree in computational physics, which included courses that involved dumping loads of data and graphing them using tools like gnuplot and OpenDx... you'd think I would have thought of this one myself (rolling my eyes). I graphed mine with GD and PHP, personally, when I needed this, but there ya go. Before anybody asks for it, it's a total hack inapplicable to anybody else in any real fashion... I wasn't interested in reusable code for a one-off problem. Did you close down the DB connection and kill the PEAR objects?... PHP's garbage collection has had... issues... in the past. All of my classes that extend DataObject inherit a common destructor that calls the DataObject::free() method, which, supposedly, frees result resources. I'm not sure what you mean by 'kill the PEAR objects', but all references go out of scope or are unset. Forget go out of scope as a solution to memory management. For any external resouces, use xyz_close() on them. For any PHP variables, use unset() This is not C. It's not even Lisp. :-) The definition of scope in PHP is simple This is very very very GOOD for writing simple little scripts when you don't know diddly-squat about programming. It is also, alas, a bit BAD for the compiler when it comes time to categorically state that $x is or isn't out of scope. The PHP Dev Team has made wondrous strides in this area, but if you're triggering PHP saying I dunno... This may or may not be out of scope in a tight loop, you're gonna lose RAM. If you can point to a specific simple instance, where it CAN be proven that something is out of scope and it should be cleaned, that's great for a http://bugs.php.net report... More likely, though, you've hit a point where the answer is indeterminate. I *believe* such instances still exist. I'm not the expert, though, just what I heard the experts say a year ago on this topic. 5) By doing unset($GLOBALS[$varname]) and unset($$varname), where $varname is each key of the $GLOBALS array, I am effectively eliminating all remaining references, and all allocated memory should be reclaimed by the memory manager (except perhaps for memory associated with function and class definitions). No. Dangling pointers and references not correctly cleaned up from a function are left out in limbo. This I find VERY odd. So if I don't unset all references in a function before it exits I lose that memory? There is a potential in some rare and unusual circumstances where the referencing is indeterminate as to whether PHP can just go ahead and free something. Given the indeterminacy (?), PHP has only one viable path. Leave it. Cuz losing RAM beats a segfault every day. :-) Perfect -- this is exactly what I was trying to get at. I wasn't even sure whether I should be totally confident that my assumptions about PHP internals were that solid, and therefore, whether I should _really_ be banging my head too hard on this. Thanks for your detailed response -- you answered my questions and then some. Is there a resource out there that explains PHP internals in detail? Use the source, Luke. :-) There probably are reference books, and some may even be sort of current... Subscribing to PHP Internals, and having up to 90% of a conversation be over your head is certainly intructive. At least, it was for me. :-) These days I almost understand 80% of it, though... At least I think I understand 80% of it. Some days you get the bear. Some days the bear gets you. As before: Cranking you limit to 16M may be the Right Answer, no matter how icky that feels... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get page count when uploading files
On Sat, September 16, 2006 9:44 am, Jian Fu wrote: I really need help and after going through the help page, I don't know where I can post my question. When I upload a file (word or pdf), how can I know the page counts of that file immediately? If you actually mean page count PHP itself doesn't know anything about that. To PHP, it's just a file full of data The PDF PDI will probably solve the PDF question. If it's true, as stated, that Word files are just RTF documents, and you could use an RTF parser to read them, then it's entirely possible that a PHP RTF parser exists out there if you Google for it... You may also just mean file size http://php.net/filesize Page Count in Word might also change based on printer settings -- I don't think you'll get the same number with US versus A4, for example, with most Word documents. Throw in different print margins and other fun things that can be done at the printer driver setup level, and you've got a whole new can of worms. The RTF parser may or may not allow you to specify, but if you *NEED* that page count for something crucial, test thoroughly. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and session issues continued...
On Sat, September 16, 2006 5:24 am, Dave Goodchild wrote: When each form is successfully processed the user is redirected to the next stage using header('Location...'). I call session_write_close before that to ensure the session data is written out before the redirect, but the problem persists. Anyone recognise this issue. It is not IE-specific as it happens to me on Firefox intermittently. I am at my wits end! Thanks in advance for any help! Rant #37 99.9% of the time, people doing this are just re-directing to a page on their own server. You can play with all kinds of weird things for the rest of you career, lose all you hair, and chew a lot of aspirin, while you are WASTING http connections bouncing the client / server connection like a cheap rubber ball (only it's a very EXPENSIVE rubber ball)... *OR* you could wise up and just INCLUDE the file you are currently using header(Location: ) to get to. You might have to re-structure your web application a tiny bit, but it will be a better structure than the mess I usually see with all these re-directs. You'll certainly save on bandwidth/hardware as your connections aren't chewed up by re-directs. And, most importantly, you'll have a solution that just works on all the browsers, as you eliminate the cookie/location conflict. I can pretty much guarantee somebody will post how well re-direct + cookies works for them, and I'm full of it. I don't see how that could be true with extensive browser-testing... Oh well. Choose your poison. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frustrated trying to get help from your site
On Mon, September 18, 2006 12:08 pm, Howard, Tim wrote: I am a programmer who is fairly new to PHP, and I had a problem trying to make changes to existing code. I tried to look up any existing documentation on your site, and after an extensive search, I finally found someone who has the same problem. The only problem is that he said something about applying a snapshot that fixed his problem. I think I finally found the place on your site where these snapshots are kept, but I am unable to download the .ZIP file because of security here at our facility. The thing is, I'm not even sure whether I'm on the right page, or whether this will actually fix my problem, or what I'm supposed to do with this snapshot once I get it. You have no documentation (that I can find) about what a snapshot is, or how to download it, or what to do with it. I think I'm going to have to submit a bug report, because I don't know what else to do on your site (even though I've run across several warnings NOT to submit a bug report if a problem has already been reported). Your site is incredibly frustrating and difficult to navigate. First and foremost, you'd have to tell us which issue you are trying to solve, and what links made you think a snapshot would fix it. Without that, we're guessing from a pool of approximiately 60,000 known issues that you might be trying to solve, and we are unlikely to give good advice. You probably followed a link and ended up on this: http://snaps.php.net/ It's true that there's a lot of links to a lot of stuff to download, and not much explanatory text there... This page, however, is a good starting point for what this CVS / snapshot stuff is all about: http://us2.php.net/anoncvs.php This was the second link in a search from the homepage with snapshot and online documentation in the popup. In brief, to explain a snapshot in layman's terms: Many users compile PHP from source code. Various versions of PHP exist, but they can be widely categorized as: Old unsupported versions. Current Stable/Supported Versions. Snapshots taken at various points in time. CVS current work-in-progress. This is a bit of an over-simplification, but may help you understand snapshot better. So PHP snapshots are an automated process of taking developer's best guess as to what is currently sort of stable, mostly If the reference you cite is old then whatever it is that was in the snapshot is most likely already in current PHP stable -- So getting the snapshot from 60 minutes ago would just be silly. OTOH, if the reference is only a few weeks old, you may indeed be stuck with running bleeding-edge PHP to resolve it, and taking the risks that entails. We could not begin to advise anybody on that without knowing a whole lot more about their overall architecture and stability needs. E.g., An ISP with thousands of customers would almost certainly be ill-advised to run from a snapshot. E.g., A cron job to do one specific task running from a snapshot that resolves one particular issue, installed in a different directory than that running the actual web server or any other command line PHP scripts, makes perfect sense for almost anybody. I think you will find as time goes on that PHP Documentation is second to none, even if you ran into a frustrating dead end in this, your first, particular instance. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frustrated trying to get help from your site
On Mon, September 18, 2006 1:43 pm, Jon Anderson wrote: As an aside, I think that the online and offline (downloadable) PHP documentation is probably the clearest, best organized and complete set of documentation for any programming language I've run into online. Certainly online. I think that Common Lisp, the Language, might give it a run for its money in the offline category. :-) Hell, I even re-read that book for fun one time, and I rarely read textbooks the first time around... I honestly think that the PHP coders/documentors deserve a lot of gratitude for the immense effort that must have gone into documenting the immense list of built-in stuff that PHP has. Let it also be noted that the PHP Community, the people on this very list, are largely responsible for much of the documentation through User Contributed Notes that got promoted to real status, or, for that matter, that exist as a priceless body of work in themselves. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to get page count when uploading files
On Monday 18 September 2006 21:47, Richard Lynch wrote: On Sat, September 16, 2006 9:44 am, Jian Fu wrote: I really need help and after going through the help page, I don't know where I can post my question. When I upload a file (word or pdf), how can I know the page counts of that file immediately? If you actually mean page count PHP itself doesn't know anything about that. To PHP, it's just a file full of data The PDF PDI will probably solve the PDF question. If it's true, as stated, that Word files are just RTF documents, and you could use an RTF parser to read them, then it's entirely possible that a PHP RTF parser exists out there if you Google for it... You may also just mean file size http://php.net/filesize Page Count in Word might also change based on printer settings -- I don't think you'll get the same number with US versus A4, for example, with most Word documents. Throw in different print margins and other fun things that can be done at the printer driver setup level, and you've got a whole new can of worms. Would php at all take precaution of the px size of the letters, if any of the above issues were to be resolved? That would be at document level for starters, and probably should be resolved in the first place? The RTF parser may or may not allow you to specify, but if you *NEED* that page count for something crucial, test thoroughly. -- Like Music? http://l-i-e.com/artists.htm -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: loadHTML/loadHTMLFile - DOM functions [solved]
Hello Rob, Try this line: $this-ticker .= utf8_decode($child_elements-item($j)-textContent); Your original HTML document is ISO-8859-1, so when you want the text I think you want to convert the UTF-8 (Internally DOM document works with UTF-8) to ISO-8859-1. Just using the utf8_decode function here from ext/xml. This elminates those  characters you were getting. Well done! That is it! The img-Tag thing is still a mistery to me, but as I pass them in my javascript part, I don't really care :-) Thank you a lot LS -- Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOMDocument-saveXML()
Perhaps you missed my reply. http://www.php.net/manual/en/function.dom-domdocument-savexml.php The first parameter to DOMDocument-saveXML() is described: Use this parameter to output only a specific node without XML declaration rather than the entire document. If you pass the root node then you get the entire document without the XML declaration. That's both elegant and built-in. Tom. Chris Boget wrote: Would it be possible to point to the relevant page in the documentation that discusses how to do this? If there is nothing builtin to do it, how tricky could it be to strip off the first line after you saved it?... Not tricky at all. Crude, but effective, Captain -- Spock Exactly. I was just hoping for something a bit more elegant. Hopefully using something that was built in to DOMDocument. Oh, well. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] symlink
Can someone explain how and why you would use a symlink in php? R, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reverse of date(w)
I'm looking for something that will convert a the opposite of the date (w) function. In other words, if I have the number 3, I would like it to return Wednesday. Is there such a beast out there besides writing a switch or array or something? -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326
Re: [PHP] DOMDocument-saveXML()
Perhaps you missed my reply. If you pass the root node then you get the entire document without the XML declaration. That's both elegant and built-in. I didn't miss it. But you have to pass in the root DomNode object. The only way to get it is by doing the following: $nodeList = $doc-getElementsByTagname( 'RootTagName' ); echo $doc-saveXML( $nodeList-item( 0 )); So unless your root node has an ID, that seems pretty excessive. Now you have the wasted resources that $nodeList is using. While it is crude, I believe it is both faster and less resource intensive to just do: echo str_replace( '?xml version=1.0?', '', $doc-saveXML()); It would be really nice if you could also specify a string value -- the name of the root node. I do appreciate the time and effort in reply to my post. It forced me to relook at the method and to look into DomNode and DomNodeList. :) thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Reverse of date(w)
[snip] I'm looking for something that will convert a the opposite of the date (w) function. In other words, if I have the number 3, I would like it to return Wednesday. Is there such a beast out there besides writing a switch or array or something? [/snip] Perhaps http://www.php.net/idate -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOMDocument-saveXML()
Chris Boget wrote: Perhaps you missed my reply. If you pass the root node then you get the entire document without the XML declaration. That's both elegant and built-in. In the future there will be an save option to perform this. This was only made possible in recent libxml releases so has not been enabled yet in DOM (although the constant has been defined in ext/libxml). I didn't miss it. But you have to pass in the root DomNode object. The only way to get it is by doing the following: $nodeList = $doc-getElementsByTagname( 'RootTagName' ); echo $doc-saveXML( $nodeList-item( 0 )); echo $doc-saveXML($doc-documentElement); So unless your root node has an ID, that seems pretty excessive. Now you have the wasted resources that $nodeList is using. While it is crude, I believe it is both faster and less resource intensive to just do: echo str_replace( '?xml version=1.0?', '', $doc-saveXML()); Doing that (although it wont work if encoding is also output in xml declaration) also maintains document encoding. Doing the previous will output the document element and its subtree in UTF-8 (of course this is to be expected as you are dropping any possibility of providing an indication of the encoding) It would be really nice if you could also specify a string value -- the name of the root node. Why? documentElement property works just fine and is much more flexible. Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reverse of date(w)
Not really. If it were always today that would work, but in this case, I was thinking of storing a day of the week in a database (3), and then display the info based on that digit. So assuming that the number was in fact 3, then: echo date(D,3); Would return Wed. Is there any function like that? Oh, and it has to run on PHP 4. -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326 On Sep 18, 2006, at 3:18 PM, Jay Blanchard wrote: [snip] I'm looking for something that will convert a the opposite of the date (w) function. In other words, if I have the number 3, I would like it to return Wednesday. Is there such a beast out there besides writing a switch or array or something? [/snip] Perhaps http://www.php.net/idate -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SSL Connection causes data errors.
Hi, I was wondering if anyone has experienced this before. I am connecting to an IIS server over HTTPS using pfsockopen and am getting xml data returned. Now when I open the URL in a browser the XML is returned fine without a problem. However when using PHP part of the XML is all messed up, data is moved around it appears and it messes up the XML. I am getting an error at the end of my request to the server: PHP Warning: fread(): SSL: fatal protocol error in However from what I read that error deals with the closing of the connection. Any help would be very appreciated. Stefan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reverse of date(w)
Kevin Murphy wrote: Not really. If it were always today that would work, but in this case, I was thinking of storing a day of the week in a database (3), and then display the info based on that digit. So assuming that the number was in fact 3, then: echo date(D,3); Would return Wed. Is there any function like that? Oh, and it has to run on PHP 4. Any reason you wouldn't write it yourself? ?php function getDayFromInteger($integer) { $days = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); if (isset($days[$integer])) { return $days[$integer]; } return false; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOMDocument-saveXML()
Why? documentElement property works just fine and is much more flexible. Where can you find a list of properties for the object? I don't see anything like this in the documentation. Doing a search: http://us3.php.net/manual-lookup.php?pattern=DOMDocumentlang=en only returns the methods. Clicking on any one of the methods gives you a list of all the other methods (along with associated objects) in the right hand navigation menu but it doesn't have anything about the properties. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOMDocument-saveXML()
On Mon, 2006-09-18 at 20:33 -0400, Chris Boget wrote: Why? documentElement property works just fine and is much more flexible. Where can you find a list of properties for the object? I don't see anything like this in the documentation. Doing a search: http://us3.php.net/manual-lookup.php?pattern=DOMDocument〈=en only returns the methods. Clicking on any one of the methods gives you a list of all the other methods (along with associated objects) in the right hand navigation menu but it doesn't have anything about the properties. Click on one of th edom methods... when you get to the details page for that method, see the left navigation menu, at the very top is a link to the class details which contains information about the properties: http://us3.php.net/manual/en/ref.dom.php Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOMDocument-saveXML()
Click on one of th edom methods... when you get to the details page for that method, see the left navigation menu, at the very top is a link to the class details which contains information about the properties: http://us3.php.net/manual/en/ref.dom.php Excellent. Thank you very much! :) thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts taking too much time
Richard Lynch wrote: On Mon, September 18, 2006 11:54 am, Chris wrote: I'm hoping somebody can give me advice on how I can go about debugging a problem I've been having. The bottom of this email has some of the details of my system. There is an intermittent slowness throughout my site. At seemingly random points in random scripts at random times it just seems to wait. A few of these have been as long as 600 seconds, just sitting there, apparently doing nothing. I've tried tracking down the problem using microtime(), that jsut showed me how (mostly) random it was. The least complex area in which I was able to isolate a problem was a 15 line chunk of HTML, with some ?=MY_CONSTANT? in them. Are you running any of the cache programs such as APC/Turck/Zend Cache? I was running Zend Platform, and thus, I believe, Zend Cache, I've disabled it for now and I don't think it's the cause of my problem.. Or the Zend Optimizer? So is the optimizer, though I suppose I could try enabling that and see what happens. Try disabling those and re-running the tests, just to be certain it's not the cache acting up. I'd also suggest trying some other tools to monitor the activities -- just in principle, to be certain that the monitors themselves are accurate. I have no particular package in mind -- Just that two heads are better than one when trying to view what's happening at that level of detail. That's part of my problem, I'm nto sure what sort of tools I need to be monitoring what... I just don't know many places my problem *could* be. My site has a decent amount of includes, it's probably doing 30-40 includes per request, with an occasional require or two. Just in general, I'd suggest that 30-40 includes per request is a bit excessive... Can none of them be combined? I do intend to streamline the whole site, but it's not feasible to do it now. I see the includes as being more of a possible trigger than the full cause of my problem. I *believe* the big hit for an include is in the disk seek, not reading and parsing some bits of PHP code. I'm not really great at reading iostat, but to the best of my knowledge the hard drives are hardly even being used This is not likely to be at all related to your current issue -- just a general observation. Thanks for the reply. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts taking too much time
Eric Butera wrote: On 9/18/06, *Chris* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I'm hoping somebody can give me advice on how I can go about debugging a problem I've been having. The bottom of this email has some of the details of my system. There is an intermittent slowness throughout my site. At seemingly random points in random scripts at random times it just seems to wait. A few of these have been as long as 600 seconds, just sitting there, apparently doing nothing. I've tried tracking down the problem using microtime(), that jsut showed me how (mostly) random it was. The least complex area in which I was able to isolate a problem was a 15 line chunk of HTML, with some ?=MY_CONSTANT? in them. I'd appreciate any advice or suggestions, thanks! Chris ==[Details]=== I've compiled both Apache and PHP, neither are RPMs: Apache 2.0.55 (Compiled with mod_prefork) PHP 5.1.2 (module) CentOS 4.2 (Essentially a repackaged Red Hat Enterprise 4) I'm averaging about 2 requests a second, spiking occasionally to 10 per second, but not very often. At no time is anything on the server maxed out CPU sometimes gets to 20%, memory never hits swap (at least not that I can see), disk activity is minimal (my database is not on the same server). My site has a decent amount of includes, it's probably doing 30-40 includes per request, with an occasional require or two. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you have a dev site you might consider using Xdebug's profiling features (http://xdebug.org/docs-profiling.php) to see every function call, include, etc to figure out where the bottleneck is happening. This might point you in the right direction in finding out why something is being slow. One cool thing is that you can set Xdebug to automatically generate cachegrind files for each request since your problem seems to be intermittent. I do have a dev site, and I am having trouble duplicating the problem on it. I'll probably set up XDebug, and/or some more alternatives and see if they tell me anything. Thanks, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts taking too much time
Chris wrote: Hi, I'm hoping somebody can give me advice on how I can go about debugging a problem I've been having. The bottom of this email has some of the details of my system. There is an intermittent slowness throughout my site. At seemingly random points in random scripts at random times it just seems to wait. A few of these have been as long as 600 seconds, just sitting there, apparently doing nothing. I've tried tracking down the problem using microtime(), that jsut showed me how (mostly) random it was. The least complex area in which I was able to isolate a problem was a 15 line chunk of HTML, with some ?=MY_CONSTANT? in them. Are you sure it's the php code? Have you checked your database logs to see if anything is being run that shouldn't be? Using mysql_query/pg_query type functions have to wait for the query to finish before returning, so problems with the db server may show up on your site. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reverse of date(w)
Another way to do it would be to store the unix epoch and then just get the weekday name from that? More overhead than Travis's idea, but just as good and you could possibly use the date/time later on. On 9/18/06, Travis Doherty [EMAIL PROTECTED] wrote: Kevin Murphy wrote: Not really. If it were always today that would work, but in this case, I was thinking of storing a day of the week in a database (3), and then display the info based on that digit. So assuming that the number was in fact 3, then: echo date(D,3); Would return Wed. Is there any function like that? Oh, and it has to run on PHP 4. Any reason you wouldn't write it yourself? ?php function getDayFromInteger($integer) { $days = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); if (isset($days[$integer])) { return $days[$integer]; } return false; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SSL Connection causes data errors.
Hi, I was wondering if anyone has experienced this before. I am connecting to an IIS server over HTTPS using pfsockopen and am getting xml data returned. Now when I open the URL in a browser the XML is returned fine without a problem. However when using PHP part of the XML is all messed up, data is moved around it appears and it messes up the XML. I am getting an error at the end of my request to the server: PHP Warning: fread(): SSL: fatal protocol error in ... However from what I read that error deals with the closing of the connection. Any help would be very appreciated. Stefan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to get page count when uploading files
Thank you all for your quick answers!! Really appreciated! I will work on a solution. Have a nice day! Jian -Original Message- From: Børge Holen [mailto:[EMAIL PROTECTED] Sent: 2006年9月19日 4:19 To: [EMAIL PROTECTED] Cc: php-general@lists.php.net; [EMAIL PROTECTED] Subject: Re: [PHP] how to get page count when uploading files On Monday 18 September 2006 21:47, Richard Lynch wrote: On Sat, September 16, 2006 9:44 am, Jian Fu wrote: I really need help and after going through the help page, I don't know where I can post my question. When I upload a file (word or pdf), how can I know the page counts of that file immediately? If you actually mean page count PHP itself doesn't know anything about that. To PHP, it's just a file full of data The PDF PDI will probably solve the PDF question. If it's true, as stated, that Word files are just RTF documents, and you could use an RTF parser to read them, then it's entirely possible that a PHP RTF parser exists out there if you Google for it... You may also just mean file size http://php.net/filesize Page Count in Word might also change based on printer settings -- I don't think you'll get the same number with US versus A4, for example, with most Word documents. Throw in different print margins and other fun things that can be done at the printer driver setup level, and you've got a whole new can of worms. Would php at all take precaution of the px size of the letters, if any of the above issues were to be resolved? That would be at document level for starters, and probably should be resolved in the first place? The RTF parser may or may not allow you to specify, but if you *NEED* that page count for something crucial, test thoroughly. -- Like Music? http://l-i-e.com/artists.htm -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reverse of date(w)
Chris Ditty wrote: Another way to do it would be to store the unix epoch and then just get the weekday name from that? More overhead than Travis's idea, but just as good and you could possibly use the date/time later on. I use the DATETIME fieldtypes in MySQL, same idea... 100% agreed that keeping that timestamp for later use is a good idea. For Kevin's original question.. Here is the MySQL function to get that short weekday name off of a DATETIME column: Table with datetime column: mysql SELECT id,effectivetime - FROM event - WHERE employee_id ='1001'; +-+-+ | id | effectivetime | +-+-+ | 184 | 2006-09-18 18:50:25 | | 182 | 2006-09-17 23:12:17 | | 178 | 2006-09-12 21:59:44 | +-+-+ 3 rows in set (0.00 sec) Query to get 'weekday': mysql SELECT id,effectivetime,DATE_FORMAT(effectivetime,%a) AS weekday - FROM event - WHERE employee_id = '1001'; +-+-+-+ | id | effectivetime | weekday | +-+-+-+ | 184 | 2006-09-18 18:50:25 | Mon | | 182 | 2006-09-17 23:12:17 | Sun | | 178 | 2006-09-12 21:59:44 | Tue | +-+-+-+ 3 rows in set (0.00 sec) Those DATETIME columns can do some other neat things too: SELECT * FROM events WHERE starttime BETWEEN '2006-09-18' AND '2006-09-28' Gives me a list of events happening in a certain period... SELECT * FROM events WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) starttime Gets you the last 30 days without needing to make those '2006-09-18' style strings in PHP code. http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html They should all work on DATETIME type columns, storing seconds since epoch doesn't quite give you that (you could work it in pretty easily I'm sure, why not use the native column type!) Cheers, Travis On 9/18/06, Travis Doherty [EMAIL PROTECTED] wrote: Kevin Murphy wrote: Not really. If it were always today that would work, but in this case, I was thinking of storing a day of the week in a database (3), and then display the info based on that digit. So assuming that the number was in fact 3, then: echo date(D,3); Would return Wed. Is there any function like that? Oh, and it has to run on PHP 4. Any reason you wouldn't write it yourself? ?php function getDayFromInteger($integer) { $days = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); if (isset($days[$integer])) { return $days[$integer]; } return false; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts taking too much time
Chris wrote: Chris wrote: Hi, I'm hoping somebody can give me advice on how I can go about debugging a problem I've been having. The bottom of this email has some of the details of my system. There is an intermittent slowness throughout my site. At seemingly random points in random scripts at random times it just seems to wait. A few of these have been as long as 600 seconds, just sitting there, apparently doing nothing. I've tried tracking down the problem using microtime(), that jsut showed me how (mostly) random it was. The least complex area in which I was able to isolate a problem was a 15 line chunk of HTML, with some ?=MY_CONSTANT? in them. Are you sure it's the php code? Have you checked your database logs to see if anything is being run that shouldn't be? Using mysql_query/pg_query type functions have to wait for the query to finish before returning, so problems with the db server may show up on your site. I'm don't know if it's my PHP code, but I'm fairly certain it's not my database calls. This time lapse is occurring in places where nothing is being done except outputing values from a constant, or HTML Thanks. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to parse raw mail headers and messages?
Hello, on 09/18/2006 03:48 AM Mathijs said the following: Is there a way to parse mail headers from a RAW mail received from sendmail? Like extracting the from, reply-to etc.. etc.. and also the message(s). Also mabye Multipart email's en attachments? You may want to take a look at this MIME message parser class. It can parse any e-mail message without depending on any PHP extensions. It can also parse very large messages without exhausting the available memory. Optionally, attachments can be saved to separate files. This is essencial to parse messages with attachments . http://www.phpclasses.org/mimeparser -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] symlink
Ross wrote: Can someone explain how and why you would use a symlink in php? For the same reason you use them in a normal unix based environment. For example a symlink from /usr/bin/php to /usr/local/bin/php - they appear to be the same so you can use either. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php