Re: [PHP] [OT] who can stop such mails [was] 永兴代 理有限公司
Can list admin stop such spam mails? Is there any provision to ban such users? 杨先生 wrote: 您好! 广东永兴代理有限公司:拥有多年工商财税代理经验,为企业谋取最大的经济利益。 [snip] -- Sameer N. Ingole Blog: http://weblogic.noroot.org/ --- Better to light one candle than to curse the darkness. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [OT] who can stop such mails [was] 永兴代 理有限公司
Sameer N Ingole wrote: Can list admin stop such spam mails? Is there any provision to ban such users? list admin? php-generals? didn't you know this is an entropic/runaway-train type list? :-) (there are people with admin rights to the list - but nobody actively doing anything, mostly because they are too busy with their dayjobs, lives, etc - even if someone was very active in liswt management I doubt they could stop the tide of such spam completely) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Digitizing Service
Dear Friend, We are a professional digitizing company ,we have many years experience in this area,if you need digitizing service .please email me -We can provide many formats ,dst ,wilcom(emb),cnd,exp,dsb,,xxx,dat,dsz and so on. -Turnaround Time: 24 hrs.If it's urgent, the logo can be done in just a few hours - all with the same flat rate. -Price : $3.00/1000 stitches -Payment: Paypal We would like you to use our service ,we confident that you will like our service and excellent digitizing quality.if you need ,please email me . Best Regards Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] InterScan MSS has deleted a message
This notification has been sent to inform you that a message has been deleted by InterScan MSS.---BeginMessage--- *** A virus (HTML_Netsky.P) was detected in the file (no filename). Action taken = remove A virus (WORM_NETSKY.P) was detected in the file (message.scr). Action taken = remove ***-*** ---BeginMessage--- ---End Message--- ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SPANISH E-MAIL RESULT
On Tue, 2006-05-09 at 06:11 -0400, SPANISH SWEEPSTAKE LOTTERY wrote: SPANISH SWEEPSTAKE LOTTERY OK this is getting crazy. Is it Spam the list day today? Did I miss the memo in the flurry of spam mails? Looks like it time to tighten up the ol spam traps again... --Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] belligerence colander
Re: [PHP] Configuring the error suppression
IG wrote: John Meyer wrote: Is there anyway to make PHP normally suppress errors, but a piece of code that would show errors on a particular page? Sorry forgot to mention how you show errors on a particular page- you would use- ini_set('display_errors', '1'); But are you sure you want to do this? Showing errors to your users is NOT a good idea as it can open your server up to all kinds of security issues. Why not use the log parser idea that I said in my last mail? I didn't get that last e-mail, and I'm on a design web server, not an actual production server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cookie style saving without cookies
I have a realty site where people want to be able to save properties but don't want to enter a username/password, etc. My first thought is just to save the info to a cookie but am not sure if this is the best way. If cookies aren't allowed, they will loose this functionality. I had thought about grabbing their ip and just writing it to the db but the ip isn't necessarily static. Is there a better way to do this? Thanks!
RE: [PHP] cookie style saving without cookies
[snip] I have a realty site where people want to be able to save properties but don't want to enter a username/password, etc. My first thought is just to save the info to a cookie but am not sure if this is the best way. If cookies aren't allowed, they will loose this functionality. I had thought about grabbing their ip and just writing it to the db but the ip isn't necessarily static. Is there a better way to do this? [/snip] Ask them if they want to save their search data. If they click yes tell them cookies must be enabled. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 代理合作
Chrome wrote: Strange the spam email came to me from [EMAIL PROTECTED] Virtua is my host Anyone else? Dan It came thru with an incomplete sender envelope, and most mail servers will append it's own domain to that (hint: good way to configure your mail server to catch this; don't allow mis-formed senders) -- 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
[PHP] Re: the VtAGaRA
web site probably know, must be underground before dawn, or they go back to the stuff of the mountains they are made of, and never move again. That is what had happened to Bert and Tom and William. Excellent! said Gandalf, as he stepped from behind a tree, and helped Bilbo to climb down out of a thorn-bush. Then Bilbo understood. It was the wizards voice that had kept the trolls bickering and quarrelling, until the light came and made an end of them. The next thing was to untie the sacks and let out the dwarves. They were nearly suffocated, and very annoyed: they had not at all enjoyed lying there listening to the trolls making plans for roasting them and squashing them and mincing them. They had to hear Bilbos account of what had happened to him twice over, before they were satisfied. Silly time to go practising pinching and pocket-picking, said
Re: [PHP] cookie style saving without cookies
At 8:42 AM -0400 5/9/06, blackwater dev wrote: I have a realty site where people want to be able to save properties but don't want to enter a username/password, etc. My first thought is just to save the info to a cookie but am not sure if this is the best way. If cookies aren't allowed, they will loose this functionality. I had thought about grabbing their ip and just writing it to the db but the ip isn't necessarily static. Is there a better way to do this? Thanks! You don't have to ask them for anything nor permission to do anything. What you provide is public and what they provide via their visit is public. That's not to say that anything they enter should be made public, but it is to say that by a user visiting your site, does provide you with non-specific information that they share with every site they visit. So, in that manner the web works both ways in sharing information. I use cookies all the time and if a use wants to have functionality with one of my sites, then cookies should be turned on, if not, then they deal with my sites not remembering them. I don't ever ask, or tell, the user to do anything -- I simply provide opportunity. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] To capture Http Headers
Hi ALL I have a sample cgi-script #!/usr/bin/perl use CGI; $cgi = new CGI; for $key ( $cgi-param() ) { $input{$key} = $cgi-param($key); } print qq{Content-type: text/html htmlheadscript type=text/javascript src=/domain.js/script/headbody }; print qq{script type=text/javascriptaddHeader()/script}; print qq{table border=2 width=60% align=center cellspacing=1 cellpadding=2}; print qq{trthKey/ththValue/th}; foreach $key (sort (keys %ENV)) { print trtd$key/td, td$ENV{$key}/td, /tr; } print qq{/table}; print qq{script type=text/javascriptaddFooter()/script}; print qq{/body/html}; Can any one please help me in converting this to a php script Which would be of great help Thanks in Advance Kaushal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To capture Http Headers
Kaushal Shriyan wrote: Hi ALL I have a sample cgi-script snip perl Can any one please help me in converting this to a php script Which would be of great help Try it yourself. If you have problems check the manual (http://php.net/docs), STFW (http://www.google.com/) and if you can't find an answer email this list again with a detailed description of your problem and sample code where appropriate. We Ar' No' He' To Do Yo' Jo' Fo' Yo'! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] x-platform encryption libs?
I am getting weird results with blowfish being different across platforms. mcrypt requires me to recompile the windows binary are there any other solutions out there for x-platform encrypt/decrypt? tx! /dc -- ___ David DC Collier [EMAIL PROTECTED] skype: callto://d3ntaku http://www.pikkle.com +81 (0)80 6521 9559 http://charajam.com 【★キャラ♪ジャム★】 人気キャラとJ-POP最新ヒット曲を自分で組み合わせて 待受Flashや着Flashを作っちゃおう! ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To capture Http Headers
Kaushal Shriyan wrote: Hi ALL I have a sample cgi-script #!/usr/bin/perl use CGI; $cgi = new CGI; for $key ( $cgi-param() ) { $input{$key} = $cgi-param($key); } check out the superglobals $_POST, $_GET and $_REQUEST: ?php var_dump($_POST, $_GET, $_REQUEST); ? print qq{Content-type: text/html this header is outputted automatically. htmlheadscript type=text/javascript src=/domain.js/script/headbody }; ?php echo ' html head script type=text/javascript src=/domain.js/script /head body'; ? print qq{script type=text/javascriptaddHeader()/script}; print qq{table border=2 width=60% align=center cellspacing=1 cellpadding=2}; print qq{trthKey/ththValue/th}; foreach $key (sort (keys %ENV)) { print trtd$key/td, td$ENV{$key}/td, /tr; } echo ul; ksort($_GET); foreach ($_GET as $key = $val) { echo li{$key}: {$val}/li; } echo /ul; print qq{/table}; print qq{script type=text/javascriptaddFooter()/script}; print qq{/body/html}; Can any one please help me in converting this to a php script that should be enough help for anyone who can read/write perl ;-P Which would be of great help Thanks in Advance Kaushal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SPANISH E-MAIL RESULT
Paul Scott schrieb: On Tue, 2006-05-09 at 06:11 -0400, SPANISH SWEEPSTAKE LOTTERY wrote: SPANISH SWEEPSTAKE LOTTERY OK this is getting crazy. Is it Spam the list day today? Did I miss the memo in the flurry of spam mails? Looks like it time to tighten up the ol spam traps again... --Paul Looks like someone found a leak in that mailinglist. Looks really like spam day today -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser displays blank page, while request still being handled
I know I used to have an issue with some of that type of stuff, but I also went in and did an output buffering at the beginning of the script, ran everything, then output the buffer. That helped me to clear it up. One of the pieces might be outputting something you just aren't seeing yet... All of the generated HTML is put into a string-variable. At the end of the publish-procedure this variable is put into $_REQUEST ($_REQUEST[result] = $result;). In the next screen (i.e. the page that gets loaded after the publish-request), $_REQUEST[result] is read and displayed: ?php $result = $_REQUEST[result]; ? ?=$result? And this doesn't seem to work. According to the log files, everything happens like it should, even the page containing that code is loaded correctly, but doesn't show anything (because by the time this page is loaded, the browser already got a response...) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser displays blank page, while request still being handled
Do you have short open tags allowed in this server setting? why not just do ?php print $_REQUEST[result]; ? Rolf Wouters wrote: I know I used to have an issue with some of that type of stuff, but I also went in and did an output buffering at the beginning of the script, ran everything, then output the buffer. That helped me to clear it up. One of the pieces might be outputting something you just aren't seeing yet... All of the generated HTML is put into a string-variable. At the end of the publish-procedure this variable is put into $_REQUEST ($_REQUEST[result] = $result;). In the next screen (i.e. the page that gets loaded after the publish-request), $_REQUEST[result] is read and displayed: ?php $result = $_REQUEST[result]; ? ?=$result? And this doesn't seem to work. According to the log files, everything happens like it should, even the page containing that code is loaded correctly, but doesn't show anything (because by the time this page is loaded, the browser already got a response...) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser displays blank page, while request still being handled
Do you have short open tags allowed in this server setting? why not just do ?php print $_REQUEST[result]; ? Yes, short open tags are allowed on this server. As mentioned before, all instances of this app are running on the same server, using the same configuration etc. Differences between the problem app and the other apps are the number of files (and megabytes) and number of db-records, which are both a lot more than in the other apps. Tried to use your idea, but it doesn't solve the problem... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser displays blank page, while request still being handled
The script behind the request does the following: - delete some files - copy files from dir A to dir B - read some data from a database and generates some XML-files (i.e. a basic publish procedure) The problem isn't the script itself, nor the server. I know this, because the same code is being used on the same server for other instances of this application. Take this view-point, to keep your sanity: The script is buggy, always has been buggy, but is only now exhibiting noticable behaviour of the bug. Which is painful, but better than the Voodoo of a script that is fine except sometimes it's not. The script has most definetly always been buggy. The only reason why we weren't seeing this behaviour before, is because none of our other customers which are using this app have as many pictures as the problem-customer... Which is really frustrating, because I can't tell him Hey, you should use less photos in your website (wish I could, though :-p) The only difference between the problem-app and the other apps is that the problem app has: A) a lot more files needing to be copied (number of files and size) B) a lot more (stale) records in the DB Do stale files correspond to the files getting deleted?... If not, this is coming out of left field and you're not telling us enough :-) There are files on the server, which don't have a corresponding record in the DB, and there are records in the DB, which don't have a corresponding file on the server. However, after manually synchronising the 2 (files and records), the problem still occurs, so that isn't it :-( Another strange thing is, that when I try to view the source code of the blank page, my browser asks me if I want to send the request again :-( Check the expiration headers -- If the browser thinks it's out of date, then it will reload to View Source, in some browsers. Also, if the script terminated and Apache sent a non-200 return code, then the browser knows it never got the real page, and may be trying to help you by getting the true page when you do View Source I think switching browsers may actually help this somewhat, as they behave differently in these boundary conditions. I took your advice and installed the firefox plug-in. Only header-info I got from my blank page is Status: ok - 200, nothing else (maybe I should mention again, that at this moment, the script is still running...). In the rare cases that the publish procedure does return the correct result-page, the headers look quite different (i.e. a lot more information than just the status) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser displays blank page, while request still being handled
I don't think it's a timeout issue on the server-side, because I've already tried setting MAX_EXECUTION_TIME and MAX_INPUT_TIME to extremly high values, and got the same result (i.e. the blank page). By setting them to extremly low values I was able to verify the app/script/server 's behaviour when it did timeout, and that produced the expected warning-message for MAX_EXECUTION_TIME exceeded. It probably isn't timeout on the server-side. But your BROWSER has a hard-coded limit on how long it's willing to wait for a slow server. You cannot do anything about it. If your script is taking THAT long to run, you have to do some operations asynchronously -- which is just as well, as no user wants to sit there with their browser open waiting for stuff to happen. Copy has to wait until it's finished before telling you the results. If it's copying a 20M file, that takes a while.. If you're copying multiple 20M files, then hey.. there's you're problem. How many and how big are the files in this case? We're talking about multiple copy operations. The first one copies 230 files (approx. 40mb) and the second one copies about 2200 files (195mb). Most files are under 400kb a piece. The request shouldn't generate any output untill it is completely finished. In between different operations, all message are stored in a string-variable. At the end of the publish-request, another request (show_result) is called, and the result-string is placed into $_REQUEST, like this: $_REQUEST[result] = $result; Take my previous paragraphs above and make them much more assertive and remove all traces of doubt. :-) Your script is taking WAY too long for a web-environment. Don't do that. :-) You might be better off running a script to run through cron every 5 minutes or so and doing it all for you.. then getting it to email you the results. Running the script through cron wouldn't be a good idea. The app we're talking about is a kind of Content Management System for photographers, so the publish-request should only be called when the user has finished his modifications to the site and is ready to publish them to his website. You're going to have to adjust your thinking... The user should be allowed to stack up the things they want done, and GO AWAY and do something useful while you muck with all those files. Later, much later, at the user's convenience, they should be able to view what got done, and make a go / no-go decision on publishing -- or possibly just be notified that their decision from earlier has finally been implemented. Because there ain't no way a professional photographer wants to sit there glued to the screen while you muck about with thousands of files. They've got photo shoots to do, calls to make, proofs to review, files to organize, and lives to live. I couldn't agree more. Be he already CAN stack up the things he wants to do. He uploads his pics, reorganizes them a litte, maybe even delete some of them or add captions... whatever he wants. Then, when he is finished and wants his results to go online, he hits the publish button, the old site is deleted, the new files are copied, some XML is generated, et voila... his new website is online in under a minute (even when he has +250mb of files to copy). Only problem is... Right now, he can't see that the publishing is finished, because after 20-40 secs or so (yes, I've been timing this :-s), his browser displays a blank (white) page... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] tired of referencing static variables/constants with 'self ::'
Does anyone know if it's possible to reference class constants or static variables without having to use 'self::' all the time? class A { const MY_CONSTANT = true; public function test() { echo self :: MY_CONSTANT; // works echo MY_CONSTANT; // doesn't work } } I don't think it is possible, but why not? Can zend/php make it work? Seems it could since this works: define('MY_CONSTANT', true); class A { public function test() { echo MY_CONSTANT; // works } } It's just annoying my how much boiler-plate I have to write all the time. Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Browser displays blank page, while request still being handled
General update... We've finally isolated the real problem (or so we hope :-s) which is copying the files from dir A to dir B. After commenting out pieces of code in the script, it became clear that the blank page only appeared when the copy operations were performed. That's why I've started testing with a very, very basic script: ?php if ($dh = opendir(/var/www/web4/html/extdoc/)) { print(COPY STARTbr /); while (false !== ($file = readdir($dh))){ if (is_dir(/var/www/web4/html/extdoc/.$file)) continue; if ($file != . $file != ..) { if(!copy(/var/www/web4/html/extdoc/.$file,/var/www/web4/html/publish/extdoc/.$file)) { print(ERROR!!!br /); } } } closedir($dh); print(COPY FINISHEDbr /); } ? So, what are the results?! Just take a look at this screenshot: http://www.xi-quadrat.de/rolf/pics/headers.jpg What are you looking at? Repeated calls to the same piece of php-script. If you look at the column labeled Content type, you see that there are 2 results: text/html and application/x-unknown-content-type (the ones that are crossed-out should be ignored). The latter are the ones that only gave me a blank page as result. The text/html responses are the correct ones. In the bottom-right part of the screenshot, you'll see that the header info received for those incorrect responses was all but complete, altough it shows a status of OK - 200. I've also tried using @copy, but this didn't seem to help either. I still can't figure out why I'm becoming that stupid blank page... Anywho... I hope this helps other people help me :-s Greetz Rolf Wouters -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Browser displays blank page, while request still being handled
On 5/9/06, Rolf Wouters [EMAIL PROTECTED] wrote: General update... We've finally isolated the real problem (or so we hope :-s) which is copying the files from dir A to dir B. After commenting out pieces of code in the script, it became clear that the blank page only appeared when the copy operations were performed. That's why I've started testing with a very, very basic script: ?php if ($dh = opendir(/var/www/web4/html/extdoc/)) { print(COPY STARTbr /); while (false !== ($file = readdir($dh))){ if (is_dir(/var/www/web4/html/extdoc/.$file)) continue; if ($file != . $file != ..) { if(!copy(/var/www/web4/html/extdoc/.$file,/var/www/web4/html/publish/extdoc/.$file)) { print(ERROR!!!br /); } } } closedir($dh); print(COPY FINISHEDbr /); } ? So, what are the results?! Just take a look at this screenshot: http://www.xi-quadrat.de/rolf/pics/headers.jpg What are you looking at? Repeated calls to the same piece of php-script. If you look at the column labeled Content type, you see that there are 2 results: text/html and application/x-unknown-content-type (the ones that are crossed-out should be ignored). The latter are the ones that only gave me a blank page as result. The text/html responses are the correct ones. In the bottom-right part of the screenshot, you'll see that the header info received for those incorrect responses was all but complete, altough it shows a status of OK - 200. I've also tried using @copy, but this didn't seem to help either. I still can't figure out why I'm becoming that stupid blank page... Anywho... I hope this helps other people help me :-s Greetz Rolf Wouters -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Have you tried tailing the error log on the server to see if it throws any error messages that might be clues? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Browser displays blank page, while request still being handled
Have you tried tailing the error log on the server to see if it throws any error messages that might be clues? Yes, I have (although I only have limited access to the server) and nothing of interest shows up :-( I've also changed my code so PHP shows me all errors etc. but nothing shows up... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 代理合作
snip It came thru with an incomplete sender envelope, and most mail servers will append it's own domain to that (hint: good way to configure your mail server to catch this; don't allow mis-formed senders) /snip Thanks John that clears up a lot... I'm going to put your advice into action Cheers Dan -- http://chrome.me.uk __ NOD32 1.1527 (20060509) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Status report on mailing list?
Spam has suddenly swamped the PHP mailing lists. (Some of you may have better filters than I and not noticed it.) Apparently the list had been moved to a new server and it hasn't been configured properly yet. I fear many will unsubscribe and the list will lose much of its utility if it's not fixed soon. Does anyone have any info on what happened and when it will be fixed? --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Record ID not being recognized
While I am by no strech of the imagination a ColdFusion expert, I have built a couple of dozen CF sites over the past 5 years. Am currently working on my first PHP site and am running into a problem with the simplest little thing. An index page is returning a list of active category names. Each name is a link to a thumbnails page. The photos on the thumbnails page are links to a display page which displays the enlarged photo and additional text. My problem is in getting the thumbnails page to only display the images associated with the category name selected on the index page. Either the thumbnail page displays ALL images or it displays none. Below is the query on the thumbnail page, which is currently returning no records. If I replace '$recordcatID' with the specific name of a category, the correct records are returned. Likewise, if I remove the WHERE statement, all records are returned. So obviously something is wrong with the sql statement. But I can't help but feel that I'm missing something in the PHP syntax. ?php require_once('../Connections/connTrail.php'); ? ?php mysql_select_db($database_connTrail, $connTrail); $query_GetThumbs = SELECT Photos.Photos_ImagePath, Photos.Photos_Title, Photos.ID, Photos.Photo_Category, Photos_Category.Category_Name, Photos_Category.catID FROM Photos, Photos_Category WHERE Photos_Category.catID = '$recordcatID' AND Photos_Category.Category_Name = Photos.Photo_Category; $GetThumbs = mysql_query($query_GetThumbs, $connTrail) or die (mysql_error()); $row_GetThumbs = mysql_fetch_assoc($GetThumbs); $totalRows_GetThumbs = mysql_num_rows($GetThumbs); ? The link from the index page to the thumbnails page is carrying the catID number forward, as seen in the resulting URL (thumbs.php? ID=17), yet the query isn't accepting it. table Photos_Category contains the category names. table Photos contains the photos and other relevant information. Any ideas where I'm going wrong? david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Status report on mailing list?
On May 9, 2006, at 2:05 PM, John Hicks wrote: Spam has suddenly swamped the PHP mailing lists. (Some of you may have better filters than I and not noticed it.) Apparently the list had been moved to a new server and it hasn't been configured properly yet. I fear many will unsubscribe and the list will lose much of its utility if it's not fixed soon. Does anyone have any info on what happened and when it will be fixed? --J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I've noticed the same on the MySQL general list too, although not quite as bad as the php lists. Was wondering if there's a new spam script going around or something. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Status report on mailing list?
John Hicks wrote: Spam has suddenly swamped the PHP mailing lists. (Some of you may have better filters than I and not noticed it.) Apparently the list had been moved to a new server and it hasn't been configured properly yet. I fear many will unsubscribe and the list will lose much of its utility if it's not fixed soon. Does anyone have any info on what happened and when it will be fixed? The lists have not been moved to a new server. The spam filtering mechanism just had an issue yesterday and was fixed a couple of hours ago. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Record ID not being recognized
Cheat... EasyPHPAlbum can be configured to do some of what you are looking to do, probably more with a bit of tweaking to the text files for the photos.. http://www.mywebmymail.com/ Other then that, based off your code you are Not getting the ID from the URL when you pass it through. Good job passing, but you are missing the hand-off. $recordcatID = $_GET[ID]; //place before the query Wolf David Doonan wrote: While I am by no strech of the imagination a ColdFusion expert, I have built a couple of dozen CF sites over the past 5 years. Am currently working on my first PHP site and am running into a problem with the simplest little thing. An index page is returning a list of active category names. Each name is a link to a thumbnails page. The photos on the thumbnails page are links to a display page which displays the enlarged photo and additional text. My problem is in getting the thumbnails page to only display the images associated with the category name selected on the index page. Either the thumbnail page displays ALL images or it displays none. Below is the query on the thumbnail page, which is currently returning no records. If I replace '$recordcatID' with the specific name of a category, the correct records are returned. Likewise, if I remove the WHERE statement, all records are returned. So obviously something is wrong with the sql statement. But I can't help but feel that I'm missing something in the PHP syntax. ?php require_once('../Connections/connTrail.php'); ? ?php mysql_select_db($database_connTrail, $connTrail); $query_GetThumbs = SELECT Photos.Photos_ImagePath, Photos.Photos_Title, Photos.ID, Photos.Photo_Category, Photos_Category.Category_Name, Photos_Category.catID FROM Photos, Photos_Category WHERE Photos_Category.catID = '$recordcatID' AND Photos_Category.Category_Name = Photos.Photo_Category; $GetThumbs = mysql_query($query_GetThumbs, $connTrail) or die(mysql_error()); $row_GetThumbs = mysql_fetch_assoc($GetThumbs); $totalRows_GetThumbs = mysql_num_rows($GetThumbs); ? The link from the index page to the thumbnails page is carrying the catID number forward, as seen in the resulting URL (thumbs.php?ID=17), yet the query isn't accepting it. table Photos_Category contains the category names. table Photos contains the photos and other relevant information. Any ideas where I'm going wrong? david --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] Record ID not being recognized
On 5/9/06, David Doonan [EMAIL PROTECTED] wrote: While I am by no strech of the imagination a ColdFusion expert, I have built a couple of dozen CF sites over the past 5 years. Am currently working on my first PHP site and am running into a problem with the simplest little thing. An index page is returning a list of active category names. Each name is a link to a thumbnails page. The photos on the thumbnails page are links to a display page which displays the enlarged photo and additional text. My problem is in getting the thumbnails page to only display the images associated with the category name selected on the index page. Either the thumbnail page displays ALL images or it displays none. Below is the query on the thumbnail page, which is currently returning no records. If I replace '$recordcatID' with the specific name of a category, the correct records are returned. Likewise, if I remove the WHERE statement, all records are returned. So obviously something is wrong with the sql statement. But I can't help but feel that I'm missing something in the PHP syntax. ?php require_once('../Connections/connTrail.php'); ? ?php mysql_select_db($database_connTrail, $connTrail); $query_GetThumbs = SELECT Photos.Photos_ImagePath, Photos.Photos_Title, Photos.ID, Photos.Photo_Category, Photos_Category.Category_Name, Photos_Category.catID FROM Photos, Photos_Category WHERE Photos_Category.catID = '$recordcatID' AND Photos_Category.Category_Name = Photos.Photo_Category; $GetThumbs = mysql_query($query_GetThumbs, $connTrail) or die (mysql_error()); $row_GetThumbs = mysql_fetch_assoc($GetThumbs); $totalRows_GetThumbs = mysql_num_rows($GetThumbs); ? The link from the index page to the thumbnails page is carrying the catID number forward, as seen in the resulting URL (thumbs.php? ID=17), yet the query isn't accepting it. table Photos_Category contains the category names. table Photos contains the photos and other relevant information. Any ideas where I'm going wrong? david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php SELECT Photos.Photos_ImagePath, Photos.Photos_Title, Photos.ID, Photos.Photo_Category, Photos_Category.Category_Name, Photos_Category.catID FROM Photos, Photos_Category WHERE Photos_Category.catID = '$recordcatID' AND Photos_Category.Category_Name = Photos.Photo_Category Did you mean to join Photos_Category.Category_Name to Photos.Photo_Category? It looks like you mean Photos_Category.catID = Photos.Photo_Category. You might want to read about mysql_real_escape_string (http://us2.php.net/mysql_real_escape_string) because you have a sql injection vulnerablilty on $recordcatID I'm betting. Maybe not if you're doing something up above where you extract $_GETs to variables. If you aren't using $_GET anywhere, then you need to use those since register_globals is depricated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Record ID not being recognized
On May 9, 2006, at 3:27 PM, Wolf wrote: $recordcatID = $_GET[ID]; //place before the query Grazi! da
Re: [PHP] Re: Browser displays blank page, while request still being handled
On 5/9/06, Rolf Wouters [EMAIL PROTECTED] wrote: Have you tried tailing the error log on the server to see if it throws any error messages that might be clues? Yes, I have (although I only have limited access to the server) and nothing of interest shows up :-( I've also changed my code so PHP shows me all errors etc. but nothing shows up... So in your php script you had error_reporting(E_ALL); and you saw nothing whatsoever pretaining to your scripts output in the error log? Are you sure error logging is on in php.ini (log_errors = On) and you were looking at the right file? Have you tried putting these in your script: ignore_user_abort(true); set_time_limit(0); If you add ignore_user_abort maybe try putting a mail() call at the end of the function to see if it finishes. Are there any or die statements that are blank? Sorry if any of this has been said, it's just where I would start. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert from jpg to gif ... change dpi...
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Actually I don't believe this is exactly right from playing around with Photoshop you can see that you change an image's resolution under Image - Image Size and if you turn off Resample Image, it will retain the same pixel dimensions. GIF's are limited to 72dpi (or ppi if you prefer.. pixel per inch) which matches what is typically displayable or desirable for web content. But when you go to print that webpage, you really see the lack of quality in that GIF image. If you use a JPG and set it for around 300 dpi/ppi, it prints out a LOT nicer. So there's a real easy answer to this question... yes, you can change DPI on the fly when converting JPG - GIF... the downside is that you're converting to 72dpi whether you like it or not because that's the GIF standard. If somebody has more or better information on this, I'd love to hear it but this is how it is as far as I know and have experienced. Well, still a learner on the PHP front but as far as images are concerned, just a bit more knowledgeable. First off, DPI is not a function within an image, it is a function of output and is governed by a combination of the programme doing the output and the device it is being output to. So, to make things clearer, let's take an actual example. We have an image - we'll call it 'image_A' of size (in pixels) of 3000 x 2000. If you want to output that image to a printer (which has a resolution of 300lpi) you will get an image size of 3000/300 x 2000/300 = 10 x 6.67 inches. But the image is still 3000 x 2000 pixels. If you want to output it to a printer with 600lpi resolution then it will print an image size of 3000/600 x 2000/600 = 5 x 3.33 inches and still, the real image size is 3000 x 2000 pixels. However, if we look at it from the viewpoint of the application (rather than the printer), we can see a slightly different perspective on the same data: If we already know that the resolution of the output device (in this case a printer) is 300lpi and we know that we want the printed image to measure 10 x 6.67 inches then we can set the dpi within the application (Photoshop or whatever, that, when it comes to print the image, we want it to tell the printer to print the image at a resolution of 300lpi. If we know that we want to print the image at a size of 5 x 3.33 inches (on that same 300lpi printer) then the application will know that the output resolution to produce that image size *should* be 600lpi. However, the printer is only 300lpi so what takes place is called interpolation where 2 pixels within the application is are output as 1 pixel to the printer. However, monitors typically don't have anywhere near that resolution (typically they are around 72 - 96 dpi) so that same 3000 x 2000 pixel image is now going to a different output device (the monitor) at 96 dpi, so the image size now output on-screen is 3000/96 x 2000/96 = 31.25 x 20.83 inches - which is way bigger than any current monitor (although you could, perhaps, use multiple displays), so, in order for the image to display at a reasonable size on screen, we need to reduce the image SIZE to take account of the SCREEN dpi (96dpi). This means that for the image to display at a size of 300 x 200 pixels on a screen (of resolution 96 dpi) we need to make the image SIZE: 300 x 200 pixels. However, if we want to display the image at a size on screen of, say, 6 inches x 4 inches, then we need to do the calculation for the required image size: (6 x 96) x (4 x 96) = 576 x 384 pixels. The screen resolution likewise is a function of the number of pixels (of the screen) and the size (in inches) of the screen: screen width: 1024 pixels - 13.2 inches; then dpi = 1024/13.2 = 77.5dpi screen width: 1280 pixels - 13.2 inches; then dpi = 1280/13.2 = 96 dpi etc. So, in conclusion, the DPI of an image is an OUTPUT function - it is not inherent to the actual image. However, you may see DPI data stored within the metadata of a file, where it has been stored by the application used to edit it, because the application has stored information you have given it to communicate with (usually) the printer. It serves no other purpose. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tired of referencing static variables/constants with 'self ::'
On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote: Does anyone know if it's possible to reference class constants or static variables without having to use 'self::' all the time? No, and the answer is actually in your example. Copy-and-paste all of your example code into one file, and just change the second class A to B so that there isn't a class conflict. Then create an instance of A, and B, and call both test() methods. You'll get the following result: 111 Why? The reason is SCOPE. A::test() echos twice, the first for the class constant MY_CONSTANT, and the second echo's the *global* MY_CONSTANT. Then B::test() echos the *global* MY_CONSTANT again. As wonderful as PHP is, it can't read your mind. So if you're looking for a constant or variable, PHP needs to know where to look. If you don't specify self::', PHP will look in the global scope, as it did in your code example. If you want it to look within your classes, you need to *tell* it so. And is self:: really a lot of boiler-plate? Really?? John W class A { const MY_CONSTANT = true; public function test() { echo self :: MY_CONSTANT; // works echo MY_CONSTANT; // doesn't work } } I don't think it is possible, but why not? Can zend/php make it work? Seems it could since this works: define('MY_CONSTANT', true); class A { public function test() { echo MY_CONSTANT; // works } } It's just annoying my how much boiler-plate I have to write all the time. Dante -- 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] Re: Browser displays blank page, while request still being handled
At 8:25 PM +0100 5/9/06, Rolf Wouters wrote: Have you tried tailing the error log on the server to see if it throws any error messages that might be clues? Yes, I have (although I only have limited access to the server) and nothing of interest shows up :-( I've also changed my code so PHP shows me all errors etc. but nothing shows up... I recently had a project where I used one web page to call a php script and the php script failed leaving me with a blank page. There was no error reporting to the parent page, because the error was in the child. So, I ran the child directly and the errors appeared. Perhaps, this might help. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert from jpg to gif ... change dpi...
[EMAIL PROTECTED] said: If somebody has more or better information on this, I'd love to hear it but this is how it is as far as I know and have experienced. Porpoise [EMAIL PROTECTED] answered: First off, DPI is not a function within an image, it is a function of output and is governed by a combination of the programme doing the output and the device it is being output to. -snip- (useful stuff) So, in conclusion, the DPI of an image is an OUTPUT function - it is not inherent to the actual image. However, you may see DPI data stored within the metadata of a file, where it has been stored by the application used to edit it, because the application has stored information you have given it to communicate with (usually) the printer. It serves no other purpose. Thanks for your explanation. Anyone who agrees with me, must be very intelligent. :-) tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating EPS files with PHP
Is it possible to create EPS or TIFF files with a image libraries like GD or ImageMagik? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating EPS files with PHP
[snip] Is it possible to create EPS or TIFF files with a image libraries like GD or ImageMagik? [/snip] You Googled, right? http://www.mcs.vuw.ac.nz/technical/software/PHP/ref.image.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating EPS files with PHP
I did, that link didn't seem to actually talk about the ability to create new TIFF images and didn't mention EPS at all, did I miss something on that page? Thanks, Mark -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 09, 2006 2:14 PM To: Mark Steudel; php-general@lists.php.net Subject: RE: [PHP] Creating EPS files with PHP [snip] Is it possible to create EPS or TIFF files with a image libraries like GD or ImageMagik? [/snip] You Googled, right? http://www.mcs.vuw.ac.nz/technical/software/PHP/ref.image.html -- 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] Creating EPS files with PHP
[snip] I did, that link didn't seem to actually talk about the ability to create new TIFF images and didn't mention EPS at all, did I miss something on that page? [/snip] It talks about all the things you can do with the image library. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tired of referencing static variables/constants with 'self ::'
John Wells wrote: On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote: Does anyone know if it's possible to reference class constants or static variables without having to use 'self::' all the time? No, ... Why? The reason is SCOPE. As wonderful as PHP is, it can't read your mind. So if you're looking for a constant or variable, PHP needs to know where to look. If you don't specify self::', PHP will look in the global scope, as it did in your code example. If you want it to look within your classes, you need to *tell* it so. As an OOP programmer, I would expect the scope search to be as follows: 1. LOCAL: current method 2. THIS: current instance ($this) 3. SELF: current class parent classes, in order of inheritance 4. GLOBAL: globals I really hate globals because it defeats my style of encapsulation. If the search for my constant follows the search I've listed above, self would never be necessary unless you wanted to pinpoint 3 directly. Under this same line of thinking, though, '$this-' really shouldn't be be necessary either unless you wanted to clarify local vs this for same-named variables. And is self:: really a lot of boiler-plate? Really?? YES. $x = ($y == self :: MY_CONSTANT || $y == self :: MY_CONSTANT2); vs $x = ($y == MY_CONSTANT || $y == MY_CONSTANT2); My philosophy is that the more code which is written, the greater the probability of bugs. Writing less code means less to read and less to read means easier to comprehend. From what I can tell, PHP only uses 1) LOCAL and 4) GLOBAL scope unless you specifically use $this or self, but I just don't think those should be necessary. Other than that's just the way it is, why IS it necessary to use $this and self? Dante class A { const MY_CONSTANT = true; public function test() { echo self :: MY_CONSTANT; // works echo MY_CONSTANT; // doesn't work } } I don't think it is possible, but why not? Can zend/php make it work? Seems it could since this works: define('MY_CONSTANT', true); class A { public function test() { echo MY_CONSTANT; // works } } It's just annoying my how much boiler-plate I have to write all the time. Dante -- 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] tired of referencing static variables/constants with 'self ::'
D. Dante Lorenso wrote: As an OOP programmer, I would expect the scope search to be as follows: 1. LOCAL: current method 2. THIS: current instance ($this) 3. SELF: current class parent classes, in order of inheritance 4. GLOBAL: globals Actually, 2 and 3 are really the same but only vary whether the class member was referenced via an object or statically, and this SHOULD already be known to PHP based on the class declaration. So, forcing a programmer to constantly embed the 'this is a static reference (self::)' or 'this is not a static reference ($this-)' prepended to each variable is definitely boiler-plate, redundant, and not necessary. Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert from jpg to gif ... change dpi...
tedd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [EMAIL PROTECTED] said: Thanks for your explanation. Anyone who agrees with me, must be very intelligent. :-) IyamIyam. ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] throttle output streamed from a file?
All, I have a file which I want to stream from PHP: readfile($file_name); However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in PHP before the file contents are completely output resulting in 2M or 8M truncation of output. I have seen code posted to the readfile user comments which hints at trying a userspace 'readfile_chunked' function to break the file into smaller parts, but this is still not entirely what I want: http://us2.php.net/manual/en/function.readfile.php My specific case is this. I have a queue of very large files that I'd like to output in series. I want to do something equivalent to this: readfile($big_file1); // 20 MB readfile($big_file2); // 20 MB readfile($big_file3); // 20 MB readfile($big_file4); // 20 MB but I really don't want to start writing $big_file2 until $big_file1 has been written and I don't want PHP to consume 20 MB at a time either. Ideally I'd like to have an output buffer size of NN bytes and only let PHP fill that buffer until the client has read enough of the bytes to warrant another refill. That way, I might only consume about 1MB sliding window of output. To do this, I would think I need a function in PHP which will output a buffered stream with blocking enabled. Can anybody point me in the right direction? Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] throttle output streamed from a file?
D. Dante Lorenso wrote: All, I have a file which I want to stream from PHP: it's not that relevant, but, I don't thinking streaming is the correct term. your merely dumping a files' content to std output. readfile($file_name); the trick you need to employ involves opening the file and reading/dumping it in suitably sized chunks. However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in PHP before the file contents are completely output resulting in 2M or 8M truncation of output. I have seen code posted to the readfile user comments which hints at trying a userspace 'readfile_chunked' function to break the file into smaller parts, but this is still not entirely what I want: http://us2.php.net/manual/en/function.readfile.php My specific case is this. I have a queue of very large files that I'd like to output in series. I want to do something equivalent to this: readfile($big_file1); // 20 MB readfile($big_file2); // 20 MB readfile($big_file3); // 20 MB readfile($big_file4); // 20 MB doing that would mean the client ends up with garbage - I think - because the client justs see one big stream of data with no way of knowing that it constitutes multiple files. using something like exec() to call the systems tar gzip commands on the files in question and then dumping out the resulting 'tarball' in chunks as described above would be a way to achieve this. but I really don't want to start writing $big_file2 until $big_file1 has been written and I don't want PHP to consume 20 MB at a time either. Ideally I'd like to have an output buffer size of NN bytes and only let PHP fill that buffer until the client has read enough of the bytes to warrant another refill. That way, I might only consume about 1MB sliding window of output. To do this, I would think I need a function in PHP which will output a buffered stream with blocking enabled. Can anybody point me in the right direction? http://php.net/streams - only I doubt that this would give you what you want given that the client is a webbrowser and the connection is not directly under the control of php (it's the webservers responsibility). this is conjecture - I'm still breaking my head on streams concepts on a regular basis! Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To capture Http Headers
Kaushal Shriyan wrote: On 5/9/06, Jochem Maas [EMAIL PROTECTED] wrote: Thanks Jochem Maas Thanks a Lot so it would look like below if i put in test.php ?php var_dump($_POST, $_GET, $_REQUEST); ? echo ul; ksort($_GET); foreach ($_GET as $key = $val) { echo li{$key}: {$val}/li; } echo /ul; yes if you put that in test.php that is what it would look like - why don't you try it??? (hint everything after '?' will be shown in the browser as is rather than being parsed by php because php only parses stuff it finds between '?php' and '?') have you actually read any at php.net? (e.g. http://nl2.php.net/manual/en/tutorial.php) Please advice advise not advice. verb not noun. 'advise' is what I *do* when I give you some hints about how to achieve what your trying to. an example of 'advice' would be 'RTFM please'. Thanks in Advance Kaushal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tired of referencing static variables/constants with 'self ::'
D. Dante Lorenso wrote: John Wells wrote: On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote: Does anyone know if it's possible to reference class constants or static variables without having to use 'self::' all the time? No, ... Why? The reason is SCOPE. implicit scope sucks - it means you have check where the var/cnst/whatever is actually coming from when reading the code (and if there is a scope chain to follow then it is not always clear). - this goes against the php KISS philosphy - as long as you are writing php you will be specifying scope explicitly. I suggest reading up on why the 'with' syntax in javascript is considered evil(tm) by most people. As wonderful as PHP is, it can't read your mind. So if you're looking for a constant or variable, PHP needs to know where to look. If you don't specify self::', PHP will look in the global scope, as it did in your code example. If you want it to look within your classes, you need to *tell* it so. As an OOP programmer, I would expect the scope search to be as follows: 1. LOCAL: current method 2. THIS: current instance ($this) 3. SELF: current class parent classes, in order of inheritance 4. GLOBAL: globals I really hate globals because it defeats my style of encapsulation. If the search for my constant follows the search I've listed above, self would never be necessary unless you wanted to pinpoint 3 directly. Under this same line of thinking, though, '$this-' really shouldn't be be necessary either unless you wanted to clarify local vs this for same-named variables. And is self:: really a lot of boiler-plate? Really?? YES. $x = ($y == self :: MY_CONSTANT || $y == self :: MY_CONSTANT2); I hate the spaces around the '::' whynot self::MY_CONSTANT? vs $x = ($y == MY_CONSTANT || $y == MY_CONSTANT2); My philosophy is that the more code which is written, the greater the probability of bugs. Writing less code means less to read and less to read means easier to comprehend. that is such an oversimplication is almost laughable - comprenhesibility is not at all directly bound to the number of characters used to write something. if you have ever read up on how reading/comprehension works in the human brain you should know that - 'self::' is 'read' as a single 'token' once the brain is acustomed to recognizing it. From what I can tell, PHP only uses 1) LOCAL and 4) GLOBAL scope unless you specifically use $this or self, but I just don't think those should be necessary. Other than that's just the way it is, why IS it necessary to use $this and self? it's a consciencious design decision - and a very good one at that. (as apposed to say not making 'self' bound at runtime from the very beginning of php5's inception [or atleast offering a sibling token to 'self' that is bound at runtime] - but don't get me started on that!) Dante ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Status report on mailing list?
Rasmus Lerdorf wrote: John Hicks wrote: Spam has suddenly swamped the PHP mailing lists. (Some of you may have better filters than I and not noticed it.) Apparently the list had been moved to a new server and it hasn't been configured properly yet. I fear many will unsubscribe and the list will lose much of its utility if it's not fixed soon. Does anyone have any info on what happened and when it will be fixed? The lists have not been moved to a new server. The spam filtering mechanism just had an issue yesterday and was fixed a couple of hours ago. I think I can speak for every regular when I say 'many thanks for the fix!'. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Status report on mailing list?
Jochem Maas wrote: Rasmus Lerdorf wrote: John Hicks wrote: Spam has suddenly swamped the PHP mailing lists. (Some of you may have better filters than I and not noticed it.) Apparently the list had been moved to a new server and it hasn't been configured properly yet. I fear many will unsubscribe and the list will lose much of its utility if it's not fixed soon. Does anyone have any info on what happened and when it will be fixed? The lists have not been moved to a new server. The spam filtering mechanism just had an issue yesterday and was fixed a couple of hours ago. I think I can speak for every regular when I say 'many thanks for the fix!'. -Rasmus here here! -- life is a game... so have fun. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] throttle output streamed from a file?
On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote: All, I have a file which I want to stream from PHP: readfile($file_name); However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in PHP before the file contents are completely output resulting in 2M or 8M truncation of output. I have seen code posted to the readfile user comments which hints at trying a userspace 'readfile_chunked' function to break the file into smaller parts, but this is still not entirely what I want: http://us2.php.net/manual/en/function.readfile.php My specific case is this. I have a queue of very large files that I'd like to output in series. I want to do something equivalent to this: readfile($big_file1); // 20 MB readfile($big_file2); // 20 MB readfile($big_file3); // 20 MB readfile($big_file4); // 20 MB but I really don't want to start writing $big_file2 until $big_file1 has been written and I don't want PHP to consume 20 MB at a time either. Ideally I'd like to have an output buffer size of NN bytes and only let PHP fill that buffer until the client has read enough of the bytes to warrant another refill. That way, I might only consume about 1MB sliding window of output. To do this, I would think I need a function in PHP which will output a buffered stream with blocking enabled. Can anybody point me in the right direction? Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm probably way off base on what you're trying to do, but maybe this will help: http://us2.php.net/manual/en/function.fseek.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] throttle output streamed from a file?
D. Dante Lorenso wrote: All, I have a file which I want to stream from PHP: readfile($file_name); However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in PHP before the file contents are completely output resulting in 2M or 8M truncation of output. I have seen code posted to the readfile user comments which hints at trying a userspace 'readfile_chunked' function to break the file into smaller parts, but this is still not entirely what I want: http://us2.php.net/manual/en/function.readfile.php My specific case is this. I have a queue of very large files that I'd like to output in series. I want to do something equivalent to this: readfile($big_file1); // 20 MB readfile($big_file2); // 20 MB readfile($big_file3); // 20 MB readfile($big_file4); // 20 MB but I really don't want to start writing $big_file2 until $big_file1 has been written and I don't want PHP to consume 20 MB at a time either. Ideally I'd like to have an output buffer size of NN bytes and only let PHP fill that buffer until the client has read enough of the bytes to warrant another refill. That way, I might only consume about 1MB sliding window of output. To do this, I would think I need a function in PHP which will output a buffered stream with blocking enabled. Can anybody point me in the right direction? readfile works by reading in the whole file at once - if you don't want it to do that, you can't use readfile. You don't need anything complicated, or am I misunderstanding the question which is more likely.. $size = 1048576; // 1Meg. $fp = fopen($big_file1, 'rb'); while(!feof($fp)) { $data = fgets($fp, $size); echo $data; } fclose($fp); http://www.php.net/manual/en/function.fgets.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
Re: [PHP] throttle output streamed from a file?
Jochem Maas wrote: D. Dante Lorenso wrote: All, I have a file which I want to stream from PHP: it's not that relevant, but, I don't thinking streaming is the correct term. your merely dumping a files' content to std output. readfile($file_name); the trick you need to employ involves opening the file and reading/dumping it in suitably sized chunks. However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in PHP before the file contents are completely output resulting in 2M or 8M truncation of output. I have seen code posted to the readfile user comments which hints at trying a userspace 'readfile_chunked' function to break the file into smaller parts, but this is still not entirely what I want: http://us2.php.net/manual/en/function.readfile.php My specific case is this. I have a queue of very large files that I'd like to output in series. I want to do something equivalent to this: readfile($big_file1); // 20 MB readfile($big_file2); // 20 MB readfile($big_file3); // 20 MB readfile($big_file4); // 20 MB doing that would mean the client ends up with garbage - I think - because the client justs see one big stream of data with no way of knowing that it constitutes multiple files. No need to worry about that problem. The data I am streaming will be properly consumed by the client ;-) using something like exec() to call the systems tar gzip commands on the files in question and then dumping out the resulting 'tarball' in chunks as described above would be a way to achieve this. Chunking the output is not the problem either. I know how to fread(...) and fseek(...). I can 'chunk-split' the output into smaller bytes, but that's also not the problem. The problem is that if the printing of bytes does not block during output, then the server (Apache/PHP) will shove as much data as it can into the output buffer as fast as PHP will execute. If the client is only downloading at a slow rate, then we'll end up with a backlog of bytes written by PHP but not yet consumed by the client. Assuming we have a file as large as 10 Gigabytes, that can't all fit into RAM, so where does the data go? but I really don't want to start writing $big_file2 until $big_file1 has been written and I don't want PHP to consume 20 MB at a time either. Ideally I'd like to have an output buffer size of NN bytes and only let PHP fill that buffer until the client has read enough of the bytes to warrant another refill. That way, I might only consume about 1MB sliding window of output. To do this, I would think I need a function in PHP which will output a buffered stream with blocking enabled. Can anybody point me in the right direction? http://php.net/streams - only I doubt that this would give you what you want given that the client is a webbrowser and the connection is not directly under the control of php (it's the webservers responsibility). this is conjecture - I'm still breaking my head on streams concepts on a regular basis! I think I understand quite a bit of the streams stuff, but I'm trying to figure out how to control the output buffering and how to dump a large number of bytes (absolutely huge!) to a client who may be very slow. Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] throttle output streamed from a file?
Eric Butera wrote: On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote: To do this, I would think I need a function in PHP which will output a buffered stream with blocking enabled. Can anybody point me in the right direction? I'm probably way off base on what you're trying to do, but maybe this will help: http://us2.php.net/manual/en/function.fseek.php Not exactly. fseek() jumps into a specific point in a file. I don't have that problem. I need to control how FAST php outputs it's data. Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] throttle output streamed from a file?
Chris wrote: readfile works by reading in the whole file at once - if you don't want it to do that, you can't use readfile. You don't need anything complicated, or am I misunderstanding the question which is more likely.. $size = 1048576; // 1Meg. $fp = fopen($big_file1, 'rb'); while(!feof($fp)) { $data = fgets($fp, $size); echo $data; } fclose($fp); http://www.php.net/manual/en/function.fgets.php Will 'echo' block until the client has consumed the whole $size amount of data? If not, how fast will your while loop execute? If file_size($big_file1) exceeds 1 TB, does your server end up sucking up all available memory? Or does PHP crash after hitting a memory limit? Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] throttle output streamed from a file?
On Tue, May 9, 2006 11:11 pm, D. Dante Lorenso wrote: Will 'echo' block until the client has consumed the whole $size amount of data? If not, how fast will your while loop execute? If file_size($big_file1) exceeds 1 TB, does your server end up sucking up all available memory? Or does PHP crash after hitting a memory limit? I can't be 100% certain, but I'm pretty sure the buffering from client and Apache and PHP for a simple fopen/fead;echo loop is going to resolve your problems, and take care of blocking. You're basically confusing blocking which all the streams do by default unless you turn it OFF on purpose, with RAM limitation of trying to suck in a 2G file They're not the same problem at all. So, the short answer is: Yes, almost-for-sure, echo will block enough that your won't run out of RAM. You can control the chunk-size in your fread call, basically, to get whatever RAM/performance ratio you like. I think 2048 is recommended as it matches in internal OS buffers. -- 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] Record ID not being recognized
On Tue, May 9, 2006 2:15 pm, David Doonan wrote: But I can't help but feel that I'm missing something in the PHP syntax. ?php require_once('../Connections/connTrail.php'); ? ?php mysql_select_db($database_connTrail, $connTrail); $query_GetThumbs = SELECT Photos.Photos_ImagePath, Photos.Photos_Title, Photos.ID, Photos.Photo_Category, Photos_Category.Category_Name, Photos_Category.catID FROM Photos, Photos_Category WHERE Photos_Category.catID = '$recordcatID' AND Photos_Category.Category_Name = Photos.Photo_Category; //this will explain why you get no records echo $query_GetThumbs, hr /\n; $GetThumbs = mysql_query($query_GetThumbs, $connTrail) or die (mysql_error()); Any ideas where I'm going wrong? Dollars to donuts says you are reading an old tutorial from before the default for register_globals changed from on to off The correct solution is NOT to turn register_globals back on !!! Use something like this at the top of your script: ?php $_CLEAN['recordcatID'] = (int) $_GET['recordcatID']; ? . . . Then do: $query_GetThumbs = ... = $_CLEAN[recordcatID] ...; Homework: Read the http://php.net/ page about register_globals Read this whole site: http://phpsec.org/ If you had already read these, you wouldn't be here. If you haven't read these, you are writing horribly insecure code, and you might as well put your web server out in the alley for somebody to take -- You've already done that in a virtual sense. -- 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] tired of referencing static variables/constants with 'self ::'
On Tue, May 9, 2006 12:42 pm, D. Dante Lorenso wrote: Does anyone know if it's possible to reference class constants or static variables without having to use 'self::' all the time? class A { const MY_CONSTANT = true; public function test() { echo self :: MY_CONSTANT; // works echo MY_CONSTANT; // doesn't work } } I don't think it is possible, but why not? Can zend/php make it work? Seems it could since this works: define('MY_CONSTANT', true); class A { public function test() { echo MY_CONSTANT; // works } } It's just annoying my how much boiler-plate I have to write all the time. #1. You might do: define('MY_CONSTANT', true); class A { const MY_CONSTANT = MY_CONSTANT; } Then you can sort of have the best of both worlds... Though in a hack sort of way. :-^ #2. If it's that boiler-plate, maybe your class design is flawed... I mean, the whole point of all this OOP stuff is re-factoring out the commonalities of code to get a high level of code re-use. If you're writing something so boiler-plate that it drives you crazy, maybe you need to step back and look at the whole thing sideways and see if your obvious class hierarchy isn't really the best hierarchy to have chosen. -- 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] tired of referencing static variables/constants with 'self ::'
On Tue, May 9, 2006 4:48 pm, D. Dante Lorenso wrote: If the search for my constant follows the search I've listed above, self would never be necessary unless you wanted to pinpoint 3 directly. Under this same line of thinking, though, '$this-' really shouldn't be be necessary either unless you wanted to clarify local vs this for same-named variables. Languages that let you get away without specifying $this- and self:: do exist... But, in my experience, after a certain level of complexity is achieved, you end up getting very confused very fast about where $foo is coming from... And it turns into a real nightmare when you inherit somebody else's code: 100,000 lines of code here echo $foo; 100,000 lines of code here You really have no idea where $foo came from, do you? :-) So I personally PREFER that one has to make it clear where the variables are coming from. -- 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] Browser displays blank page, while request still being handled
On Tue, May 9, 2006 12:14 pm, Rolf Wouters wrote: The script behind the request does the following: Also, if the script terminated and Apache sent a non-200 return code, then the browser knows it never got the real page, and may be trying to help you by getting the true page when you do View Source I think switching browsers may actually help this somewhat, as they behave differently in these boundary conditions. I took your advice and installed the firefox plug-in. Only header-info I got from my blank page is Status: ok - 200, nothing else (maybe I should mention again, that at this moment, the script is still running...). In the rare cases that the publish procedure does return the correct result-page, the headers look quite different (i.e. a lot more information than just the status) So, here is what happens. #1. Browser asks for URL #2. PHP starts spitting out *SOME* content (maybe even just a blank line) #3. Browser gets Status: ok - 200 #4. PHP script is really really really slow #5. Browser gets tired of waiting for more output, and gives up on PHP #6. PHP keeps going and going and going and... There is no mystery, here, really. It's a bit odd that no other headers come out, but it's possible, depending on the code... Your application is still not designed for a web environment when large numbers of images are involved, really. You're gonna have to bite the bullet (as suggested before) and make the dog-slow image-processing bits be asynchronous with the page generation, by having: the script queues up the stuff to be done, and the script spits out a super-fast page saying We'll have your photos ready shortly -- You will be notified when they are ready some kind of cron job works on the queue regularly when the queue for client X is empty, or a whole batch is done, or whatever, they get an email, and can do whatever needs doing next in human time. By the time you do all that, the whole problem will go away. You could even do it ONLY when the number * size of the files exceeds X if you want. So only the one client will be affected by (and exercising) the code with the cron job. -- 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] tired of referencing static variables/constants with 'self ::'
Jochem Maas wrote: D. Dante Lorenso wrote: $x = ($y == self :: MY_CONSTANT || $y == self :: MY_CONSTANT2); I hate the spaces around the '::' whynot self::MY_CONSTANT? Stupid PHP Eclipse code beautifier ;-) It's what I use to beautify and since it always does that, I've been forced to accept it as a style rule. $x = ($y == MY_CONSTANT || $y == MY_CONSTANT2); My philosophy is that the more code which is written, the greater the probability of bugs. Writing less code means less to read and less to read means easier to comprehend. vs that is such an oversimplication is almost laughable - comprenhesibility is not at all directly bound to the number of characters used to write something. My ability to identify specific tokens is blurred by the introduction of more tokens which amount to nothing more than boiler-plate. if you have ever read up on how reading/comprehension works in the human brain you should know that - 'self::' is 'read' as a single 'token' once the brain is acustomed to recognizing it. Problem is that I should never have to SEE that token at all: 0 tokens 1 token From what I can tell, PHP only uses 1) LOCAL and 4) GLOBAL scope unless you specifically use $this or self, but I just don't think those should be necessary. Other than that's just the way it is, why IS it necessary to use $this and self? it's a consciencious design decision - and a very good one at that. It's not good if it's redundant. Look: class A { public static $x = dante; public static function y() { } } didn't I JUST say that $x and y() are static? Why do I have to say it every single time I use it: self :: $x; self :: y(); I already TOLD you it was static and heaven forbid that I change my mind later: class A { public $x = dante; public function y() { } } crap, now all my other code is broken and needs to be rewritten as an instance dereferencer: $this-x; $this-y(); Can't I just use $x and the code knows what I am talking about since I've already TOLD it? 'self ::' and '$this-' should only be necessary to clarify confusion, but should be FORCED when no confusion exists. (as apposed to say not making 'self' bound at runtime from the very beginning of php5's inception [or atleast offering a sibling token to 'self' that is bound at runtime] - but don't get me started on that!) Oh I hear you about the need for late static binding. We can both not get started on that one ;-) Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Browser displays blank page, while request still being handled
On Tue, May 9, 2006 1:59 pm, Rolf Wouters wrote: What are you looking at? Repeated calls to the same piece of php-script. If you look at the column labeled Content type, you see that there are 2 results: text/html and application/x-unknown-content-type (the ones that are crossed-out should be ignored). The latter are the ones that only gave me a blank page as result. The text/html responses are the correct ones. Did the application/x-unknown-content-type scripts take longer to complete? How long? Run your script from wget and see if you actually are getting Content-type: application/x-unknown-content-type from the server, or if that's just the browser's interpretative dance around a missing Content-type: (grrr!) One hack you might consider, for IE browser: Changing your script to copyme.htm will, in some cases, convince IE that it really *IS* an HTML file. See, MS IE doesn't actually believe in Content-type: header, because they assume web-developers are idiots, and don't send the right header. So MS IE looks at the URL and the data and guesses at the content type (and the Charset). For reasons known only to Bill Gates, however, MS IE *does* believe META tags about content-type and charset, because, apparently, web Designers *DO* know what they are doing and those META tags are always right. [sheesh!] -- 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] To capture Http Headers
Wild Guess: ?php var_dump($_REQUEST); var_dump($_ENV); ? You're on your own for adding in the HTML and Javascript crap. On Tue, May 9, 2006 9:36 am, Kaushal Shriyan wrote: Hi ALL I have a sample cgi-script #!/usr/bin/perl use CGI; $cgi = new CGI; for $key ( $cgi-param() ) { $input{$key} = $cgi-param($key); } print qq{Content-type: text/html htmlheadscript type=text/javascript src=/domain.js/script/headbody }; print qq{script type=text/javascriptaddHeader()/script}; print qq{table border=2 width=60% align=center cellspacing=1 cellpadding=2}; print qq{trthKey/ththValue/th}; foreach $key (sort (keys %ENV)) { print trtd$key/td, td$ENV{$key}/td, /tr; } print qq{/table}; print qq{script type=text/javascriptaddFooter()/script}; print qq{/body/html}; Can any one please help me in converting this to a php script Which would be of great help Thanks in Advance Kaushal -- 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] throttle output streamed from a file?
Richard Lynch wrote: On Tue, May 9, 2006 11:11 pm, D. Dante Lorenso wrote: will 'echo' block until the client has consumed the whole $size amount of data? If not, how fast will your while loop execute? If file_size($big_file1) exceeds 1 TB, does your server end up sucking up all available memory? Or does PHP crash after hitting a memory limit? I can't be 100% certain, but I'm pretty sure the buffering from client and Apache and PHP for a simple fopen/fead;echo loop is going to resolve your problems, and take care of blocking. Yes, almost-for-sure, echo will block enough that your won't run out of RAM. I have written some test code, and yes it appears that the 'print' statement WILL block if the output buffer is already filled. See this sample code below: ?php define('BUFFER_SIZE', 1); //-- function client_reader() { // connect back to ourself $myurl = http://.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].?server=1; $reader = fopen($myurl, r); // read data indefinitely but at a slow speed $count = 0; while (true) { print #; error_log(read start #.$count++); $buffer = fread($reader, BUFFER_SIZE); sleep(2); } // all done fclose($reader); } //-- function server_writer() { // build a buffer to write $buffer = str_repeat(#, BUFFER_SIZE); // write our buffer over and over as fast as our client will let us $count = 0; while (true) { error_log(write start #.$count++); print $buffer; } } //-- if (isset($_GET[server])) { server_writer(); } else { client_reader(); } //-- ? If you load this, the client code connect back to itself and as you can see, the writer writes as fast as it is allowed, but the reader will sleep between reads to ensure that the server writer is much faster than the client reader. And the following code showed up in my server logs: -- 8 8 -- write start #0 write start #1 write start #2 write start #3 write start #4 write start #5 write start #6 read start #0 write start #7 write start #8 write start #9 write start #10 write start #11 write start #12 write start #13 write start #14 write start #15 write start #16 write start #17 write start #18 write start #19 read start #1 read start #2 read start #3 read start #4 write start #20 write start #21 write start #22 write start #23 write start #24 read start #5 read start #6 read start #7 write start #25 write start #26 write start #27 write start #28 write start #29 read start #8 read start #9 read start #10 read start #11 read start #12 read start #13 read start #14 read start #15 read start #16 write start #30 write start #31 write start #32 write start #33 write start #34 read start #17 read start #18 read start #19 read start #20 write start #35 write start #36 write start #37 write start #38 write start #39 read start #21 read start #22 read start #23 read start #24 read start #25 read start #26 read start #27 ... -- 8 -- Ok, so, from the looks of it, the server writer seems to block on print when 2MB have filled the output buffer. 2MB is a good number, so I guess I don't need to do anything and everything magically works the way I would expect. But ... if I wanted to set the output buffer smaller than 2M, like say just 1M or 512K, how would I go about that? Is there a runtime ini_set() value? Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() question
On Mon, May 8, 2006 1:42 pm, PHP wrote: Normally I would, except that file does a lot of work, and it was too much to have on the same server. That is why I was including it remotely. Unless the remote server is HUMUNGOUS compared to the original server, or it just has nothing else to do but run this one script, methinks you aren't fixing anything useful... Which is evidenced by the fact that it's timing out. Maybe you need to try a different tack. -- 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] throttle output streamed from a file?
On Wed, May 10, 2006 12:15 am, D. Dante Lorenso wrote: Ok, so, from the looks of it, the server writer seems to block on print when 2MB have filled the output buffer. 2MB is a good number, so I guess I don't need to do anything and everything magically works the way I would expect. But ... if I wanted to set the output buffer smaller than 2M, like say just 1M or 512K, how would I go about that? Is there a runtime ini_set() value? You'd have to read the latest php.ini to rule it out, but I don't think it's an ini_set() value. You *COULD* sort of hack it with some sleep() calls on the server and some rule-of-thumb measuring of some real-world clients... At that point, though, targetting it as buffer size is really a mis-nomer and it's really more of a poor man's renice If any of this is running from CLI, you may want to read man nice -- 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] tired of referencing static variables/constants with 'self ::'
Richard Lynch wrote: On Tue, May 9, 2006 4:48 pm, D. Dante Lorenso wrote: If the search for my constant follows the search I've listed above, self would never be necessary unless you wanted to pinpoint 3 directly. Under this same line of thinking, though, '$this-' really shouldn't be be necessary either unless you wanted to clarify local vs this for same-named variables. Languages that let you get away without specifying $this- and self:: do exist... But, in my experience, after a certain level of complexity is achieved, you end up getting very confused very fast about where $foo is coming from... And it turns into a real nightmare when you inherit somebody else's code: 100,000 lines of code here echo $foo; 100,000 lines of code here You really have no idea where $foo came from, do you? :-) So I personally PREFER that one has to make it clear where the variables are coming from. Yeah, I guess I kinda agree with you about that. '$this-' and 'self ::' are nice so that a programmer 'reader' doesn't have to trace scope, but it's more work on the programmer 'writer'. In most cases, the programmer writer SHOULD go the extra step because the writer can write the code easier than the reader can read and figure out the code. So, in that regard it is nice to 'require' the notation. I never use 'define()' in my code, however, because I think it's as dirty as 'global' and globals are bad in my world. So, as a style rule, I usually only use all uppercase variable names when defining static or constant properties of an object: public static $MY_STATIC = array(); const MY_CONST = true; and therefore, in my code, if you ever find an all uppercase variable, it's probably scoped to the class. Hence, dropping 'self ::' as a requirement when I reference class-level constants is not a scary idea for me. The other argument is that by defining the language to FORCE '$this-' and 'self ::', we do just that, we FORCE the use. Not everyone has a problem with reading code and tracing scope. Programmers should WANT to write code which is clear and easy to understand, but that style shouldn't be forced upon them, especially when the language CAN do without it. Seems this topic could become a religious debate. But, unlike curly up 'funcname() {' or curly down 'funcname()\n{' debates, there is not choice a currently. I'm sure there are fans of it both ways, can't we offer it both ways? Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tired of referencing static variables/constants with 'self ::'
Richard Lynch wrote: On Tue, May 9, 2006 12:42 pm, D. Dante Lorenso wrote:#1. You might do: define('MY_CONSTANT', true); class A { const MY_CONSTANT = MY_CONSTANT; } Then you can sort of have the best of both worlds... Though in a hack sort of way. :-^ Hehe, nice. No thanks ;-) Keep yer stinkin' 'define()' away from me ;-) #2. If it's that boiler-plate, maybe your class design is flawed... I mean, the whole point of all this OOP stuff is re-factoring out the commonalities of code to get a high level of code re-use. If you're writing something so boiler-plate that it drives you crazy, maybe you need to step back and look at the whole thing sideways and see if your obvious class hierarchy isn't really the best hierarchy to have chosen. I'm using a 'singleton' pattern and this annoys me: class A { private static $MY1, $MY2, $MY3, $MY4, $MY5; public function __construct() { if (!self :: $MY1) { self :: $MY1 = self :: init_thing1(); self :: $MY2 = self :: init_thing2(); self :: $MY3 = self :: init_thing3(); self :: $MY4 = self :: init_thing4(); self :: $MY5 = self :: init_thing5(); } } ... } Why couldn't I have just written: class A { private static $MY1, $MY2, $MY3, $MY4, $MY5; public function __construct() { if (!$MY1) { $MY1 = init_thing1(); $MY2 = init_thing2(); $MY3 = init_thing3(); $MY4 = init_thing4(); $MY5 = init_thing5(); } } ... } I mean, I was forced to write 'self ::' like 11 times in that constructor. THAT is annoying. I realize I am probably just venting since it's unlikely I can get anything changed/done on this list. I'm just hoping some internals developer might see my rants and think it might be something which needs to be addressed within the language. I can't be alone in my dislikes, can I? Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php