Re: [PHP] Lookimg for a script....
On Tue, Jul 15, 2008 at 7:34 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote: > Can anyone point me to a (free) script that will ask for a person's email > address and username, and then look up the password that's in a plain text > file? http://www.google.com/search?q=flat-file+php+user+management -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Downloading a file
I am having trouble getting a file to download to work in Internet Explorer. The site works fine in FireFox. The page retrieves the contents of a file from a database and outputs the following Where $data['filename'] is the name of the file as stored in the database and $data['file'] is the contents of the file. The script used to download the file is called view.php. As I mentioned, this works great in FireFox but with Internet Explorer, I get the following error: Internet Explorer cannot download view.php from www.yourdomain.com. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. Any help would be greatly appreciated. Robbert
Re: [PHP] Changing PHP.ini
By visiting php.info in a web browser I have confirmed the location of my php.ini file as /usr/local/php5/lib/php.ini. I open that file and edit the line: ; - display_errors = Off and change it to display_errors = On I then retstart Appache and visit php.info which still reports display_errors = Off. What else can I do? Should be simple: create a script with the following code: Then open that script in your browser. The generated output does also provide information about the path of the loaded php.ini. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: [Fwd: Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??]]
OK. Once again, a problem I thought was abstruse and formidable turns out to be ridiculously simple and embarrassingly obvious (once you realize what it is - image not in web server directory!!!) But I didn't know until this happened that the browser sends a follow-up request to the web server for the images it finds specified on the page. This is a very useful piece of knowledge!! It made it obvious that I was looking for the problem in all the wrong places! Sorry for the false alarm. Next time I'll try to have a real problem everyone can sink their teeth into!! --- Begin Message --- Sorry, I'm back again with this same problem! Apparently the only reason it looked like it was solved an hour ago was because the src="xx"> statement I tried reading out of the database was pointing to an image already on the page! When the statement points to an image NOT already on the page, it doesn't work. I thought the size of the image might be the problem, but no matter how small I make the image, it doesn't work. Again, any insight into what might be the problem here would be MUCH appreciated. Is it necessary for an statement to be in the code of the script writing the page for the image to be correctly inserted onto the page? I believe that's the question. It looks like when the statement is pulled from a database and copied onto the webpage, some kind of php or HTML parser doesn't get a chance to parse it, resolve it, and go retrieve the image to put it on the page!!! I hope I'm wrong about this, but at this point I don't have any other plausible theory!! --- Begin Message --- Yes, here's the code that is retrieving "news items" from the database and printing them on the page (I do some other stuff with the text before, and after, I print it, for example, find the sentences, so I can print complete sentences, and not just pieces of sentences). As I say, occasionally these news items contain some HTML, e.g., the src="xxx"> statement. All of the text is being correctly retrieved from the database and written to the page, including the src="xxx"> statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. $result = mysql_query("SELECT * FROM newsitem ORDER BY newsitem_date DESC"); if (mysql_num_rows($result) > 0) { $i = 1; while (($row = mysql_fetch_assoc($result)) && ($i < 6)) { ?> = $row['title']; echo $title; echo " by "; ?> $row['author']; echo " of "; echo $row['newsservice']; ?> echo ""; $url_string = " (read more of this article)"; echo $url_string; $blog_result = mysql_query("SELECT * FROM blog where discussion = \"$title\""); if (mysql_num_rows($blog_result) > 0) $not = ""; else $not = " not"; echo ""; echo "This news item does$not have a blog discussion "; echo " "; if (mysql_num_rows($blog_result) > 0) echo "Read this item's blog "; else echo "Start a discussion on this item "; $i++; ?> Stut wrote: On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Code please, we're not mind readers! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test
test -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DB search and case sensitive comparison
> Now what I need to do is to ensure that the lookup_string is in the > useragent string and the CASE is the same: IE: Mozilla and not MOZILLA or > mozilla etc... Make the database do the work if possible. mysql> select * from a where a like '%MOZILLA%'; +-+ | a | +-+ | Mozilla | | MOZILLA | +-+ 2 rows in set (0.00 sec) mysql> select * from a where a like BINARY '%MOZILLA%'; +-+ | a | +-+ | MOZILLA | +-+ 1 row in set (0.00 sec) -- 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] Lookimg for a script....
Can anyone point me to a (free) script that will ask for a person's email address and username, and then look up the password that's in a plain text file? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??]
Sorry, I'm back again with this same problem! Apparently the only reason it looked like it was solved an hour ago was because the src="xx"> statement I tried reading out of the database was pointing to an image already on the page! When the statement points to an image NOT already on the page, it doesn't work. I thought the size of the image might be the problem, but no matter how small I make the image, it doesn't work. Again, any insight into what might be the problem here would be MUCH appreciated. Is it necessary for an statement to be in the code of the script writing the page for the image to be correctly inserted onto the page? I believe that's the question. It looks like when the statement is pulled from a database and copied onto the webpage, some kind of php or HTML parser doesn't get a chance to parse it, resolve it, and go retrieve the image to put it on the page!!! I hope I'm wrong about this, but at this point I don't have any other plausible theory!! --- Begin Message --- Yes, here's the code that is retrieving "news items" from the database and printing them on the page (I do some other stuff with the text before, and after, I print it, for example, find the sentences, so I can print complete sentences, and not just pieces of sentences). As I say, occasionally these news items contain some HTML, e.g., the src="xxx"> statement. All of the text is being correctly retrieved from the database and written to the page, including the src="xxx"> statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. $result = mysql_query("SELECT * FROM newsitem ORDER BY newsitem_date DESC"); if (mysql_num_rows($result) > 0) { $i = 1; while (($row = mysql_fetch_assoc($result)) && ($i < 6)) { ?> = $row['title']; echo $title; echo " by "; ?> $row['author']; echo " of "; echo $row['newsservice']; ?> echo ""; $url_string = " (read more of this article)"; echo $url_string; $blog_result = mysql_query("SELECT * FROM blog where discussion = \"$title\""); if (mysql_num_rows($blog_result) > 0) $not = ""; else $not = " not"; echo ""; echo "This news item does$not have a blog discussion "; echo " "; if (mysql_num_rows($blog_result) > 0) echo "Read this item's blog "; else echo "Start a discussion on this item "; $i++; ?> Stut wrote: On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Code please, we're not mind readers! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Changing PHP.ini
what os are you using? if you're on linux, type: find / -name "php.ini" do you see multiple copies of the php.ini file? if you're on windows, use the search function to see if you have multiple copies of php.ini. if you really want to do a quick check to see if you're modifying the right php.ini, just go ahead and rename it to something else, and then restart apache, and check your results.. -Original Message- From: Adam Gerson [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 3:36 PM To: php-general@lists.php.net Subject: [PHP] Changing PHP.ini By visiting php.info in a web browser I have confirmed the location of my php.ini file as /usr/local/php5/lib/php.ini. I open that file and edit the line: ; - display_errors = Off and change it to display_errors = On I then retstart Appache and visit php.info which still reports display_errors = Off. What else can I do? Thanks, Adam -- 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
[PHP] Changing PHP.ini
By visiting php.info in a web browser I have confirmed the location of my php.ini file as /usr/local/php5/lib/php.ini. I open that file and edit the line: ; - display_errors = Off and change it to display_errors = On I then retstart Appache and visit php.info which still reports display_errors = Off. What else can I do? Thanks, Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "Warning:Cannot modify header information -" Error
On Tue, Jul 15, 2008 at 11:51 AM, Tiji varghese <[EMAIL PROTECTED]> wrote: > Hi All ! > I am having some problem with the code below. Everytime I run it it gives me > the following error: > Warning: Cannot modify header information - headers already sent > by (output started at > C:\xampp\htdocs\practice.com\displayUserData.php:7) in > C:\xampp\htdocs\practice.com\displayUserData.php on line 12 This message means that something was sent before line 12. In your case, the HTML. All things that have to do with headers must be before ANYTHING is sent to the browser. If you need to have the HTML before a setcookie(), header(), or another header-based PHP action, check into ob_start() and the other output-buffering functions PHP has available. -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
It would be helpful if you could clarify the error you are getting, but could be something involving quotes, stripslashes() and addslashes(); On Jul 15, 2008, at 2:36 PM, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Thanks for any help you can give me. Rod Clay -- 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] is there a problem with php script pulling HTML out of database as it writes the page??
> -Original Message- > From: Rod Clay [mailto:[EMAIL PROTECTED] > Sent: 15 July 2008 22:36 > To: php-general@lists.php.net > Subject: [PHP] is there a problem with php script pulling HTML out of > database as it writes the page?? > > Hello. Again, I'm fairly new to php so please forgive me if my > question > is a very simple or obvious one. > > I've just tried testing for the first time some php code that is > pulling > text out of a database to print it on the webpage. Some of this text > includes HTML, specifically in this case an > statement. Much to my surprise, this is not working. Is there a > problem with pulling HTML out of a database like this as the page is > being written? > > There's no problem of course if my php code is writing the HTML to the > page - in this case, the statement works fine and > the > image is displayed. Why is it a problem when my php script pulls the > HTML code out of a database and writes it to the page from there?? > > It would appear that when my php script writes HTML to the page a > process of some kind is executed to, in this case, get the image and > put > it on the page. Apparently this same process is NOT executed if the > HTML is retrieved from a database and simply written to the page from > there. Is this correct? And, if it is, can anyone suggest a > workaround, another way to get done what I'm trying to do here? > > Thanks for any help you can give me. > > Rod Clay Have you got a code snippet?? Alex No virus found in this outgoing message. Scanned by AVG Free 8.0 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.4.11/1553 - Release Date: 15/07/2008 05:48 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
It's (was) not printing anything. Here's the doctype statement: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> HOWEVER, thanks for all of the responses so far, but please accept my apologies because evidently this is NOT a php question after all - I just tried another, much, much smaller photo and that is printing, so it would appear that it is a much more mundane problem, actually an HTML problem!!! Again, please accept my apologies for this false alarm, but I had tested and tested and tested this and was stumped an hour ago! Thought it was a different kind of problem. Mea culpa! :-[ dg wrote: On Jul 15, 2008, at 3:06 PM, Rod Clay wrote: All of the text is being correctly retrieved from the database and written to the page, including the statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. What exactly is it printing? What is the doctype? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
On Jul 15, 2008, at 3:06 PM, Rod Clay wrote: All of the text is being correctly retrieved from the database and written to the page, including the statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. What exactly is it printing? What is the doctype? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
Yes, here's the code that is retrieving "news items" from the database and printing them on the page (I do some other stuff with the text before, and after, I print it, for example, find the sentences, so I can print complete sentences, and not just pieces of sentences). As I say, occasionally these news items contain some HTML, e.g., the src="xxx"> statement. All of the text is being correctly retrieved from the database and written to the page, including the src="xxx"> statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. $result = mysql_query("SELECT * FROM newsitem ORDER BY newsitem_date DESC"); if (mysql_num_rows($result) > 0) { $i = 1; while (($row = mysql_fetch_assoc($result)) && ($i < 6)) { ?> = $row['title']; echo $title; echo " by "; ?> $row['author']; echo " of "; echo $row['newsservice']; ?> echo ""; $url_string = " (read more of this article)"; echo $url_string; $blog_result = mysql_query("SELECT * FROM blog where discussion = \"$title\""); if (mysql_num_rows($blog_result) > 0) $not = ""; else $not = " not"; echo ""; echo "This news item does$not have a blog discussion "; echo " "; if (mysql_num_rows($blog_result) > 0) echo "Read this item's blog "; else echo "Start a discussion on this item "; $i++; ?> Stut wrote: On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Code please, we're not mind readers! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Code please, we're not mind readers! -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is there a problem with php script pulling HTML out of database as it writes the page??
Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Thanks for any help you can give me. Rod Clay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice on a radar chart
What do you want to implement as a radar chart? Nothing in particular. Just a generic radar chart for representing data. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice on a radar chart
At 8:26 PM +0100 7/15/08, Richard Heyes wrote: If you are willing to use googles chart api .. http://code.google.com/apis/chart/#radar Nope. It's not something I need to implement, mmore a personal (albeit with this lists help) project. -- Richard Heyes Richard: What do you want to implement as a radar chart? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
At 8:21 PM +0200 7/15/08, Jochem Maas wrote: Robert Cummings schreef: On Tue, 2008-07-15 at 12:37 -0400, tedd wrote: At 12:31 PM -0400 7/15/08, Robert Cummings wrote: Umm... here it is to unlimited precision: 14 Cheers, Rob. Yeah and here's Like or not, that's all there is to it. Weird... you're client bastar-dized my beautiful pi symbol. no it's the worst round error ever. how exactly do you go from 3.1 to .25 :-P Well, someone's client took infinity and turned it into an integral. tdd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice on a radar chart
If you are willing to use googles chart api .. http://code.google.com/apis/chart/#radar Nope. It's not something I need to implement, mmore a personal (albeit with this lists help) project. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] case and accent - insensitive regular expression?
On Tue, Jul 15, 2008 at 2:07 PM, Yeti <[EMAIL PROTECTED]> wrote: > The original problem was > > User X submits a character string A. > > A PHP scripts uses A to search for it's occurences in a DB, ignoring special > characters. > > The result of ze search is a list of character strings M-LIST with matches. > > This list gets outputted to the user X, but before that all the matching > strings should be replaced with ''..'' > > If i clearly got the OP then he is using MySQL to perform the search. > > I guess he is doing it with MATCH. So MySQL already found the match and in > PHP it has to be done again ... > > eg. > > The table has 2 entries, string1 and string2 .. > > string1 = 'Thís ís an éxámplè stríng wíth áccénts.' > > string2 = 'This is an example string without accents.' > > Now the user searches for "ample": > > search = 'ample' > > Both string have matches due to accent-insensitivity (AI). Now the result is > outputted with highlighting .. > > Thís ís an éxámplè stríng wíth áccénts. > > This is an example string without > accents. Correct. > So since MySQL already did the job, why not get the occurances from it? > > I'm not an MySQL expert, but I know google and found something called string > functions. Especially a "locate" function got my interest. > > http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_locate > > Now shouldnt it be possible to create a query that searches the db for > matches and additionally uses the string function? > > I have no idea, but maybe some MySQL-expert out there has ... > > Yeti > There are definitely possibilities there. Personally, I tend to be biased against using the database to format output for presentation, so I'd rather not push the task off there. Still, I know lots of developers do not share this bias, so I'll address a couple other issues I see with this approach: 1) If the search word appears multiple times, LOCATE() will only find it once. I'd probably use REPLACE() instead. This leads to the next problem: 2) I'm not sure if the OP wants this or not, but if he wants to highlight each of multiple search terms the way many sites do, he would have to split the terms and build a SQL phrase that like this (there are probably other approaches available in MySQL to do the same thing): -- search phrase 'quaint french cafe' SELECT REPLACE(REPLACE(REPLACE(`my_column`, 'quaint', 'quaint'), 'french', 'french'), 'cafe', 'cafe') FROM ... In this case, he should get all instances of each word highlighted, but the accented characters would again be replaced with a particular style. (Not to mention the size and complexity of the query being passed from PHP to the database or the potential size of the result being passed from the database to PHP since it now could have lots of formatting text embedded in it.) Andrew
RE: [PHP] Math Weirdness
[snip] Ask Jay, he's the skimming master! >:) [/snip] Bow down before mebut not too far lest ye be skimmed as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
On Tue, 2008-07-15 at 20:21 +0200, Jochem Maas wrote: > Robert Cummings schreef: > > On Tue, 2008-07-15 at 12:37 -0400, tedd wrote: > >> At 12:31 PM -0400 7/15/08, Robert Cummings wrote: > >>> Umm... here it is to unlimited precision: ¼ > >>> > >>> Cheers, > >>> Rob. > >> Yeah and here's ƒ > >> > >> Like or not, that's all there is to it. > > > > Weird... you're client bastar-dized my beautiful pi symbol. > > no it's the worst round error ever. how exactly do you go > from 3.1 to .25 :-P Ask Jay, he's the skimming master! >:) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
On Tue, 2008-07-15 at 20:17 +0200, Jochem Maas wrote: > Robin Vickery schreef: > > 2008/7/15 tedd <[EMAIL PROTECTED]>: > >> I said: > >> > >> "Round-off errors normally don't enter into things unless your doing > >> multiplication and division operations." > >> > >> And that is not "Bull" -- it's true. You can add and subtract all the > >> floating point numbers (the one's we are talking about here) you want > >> without any rounding errors whatsoever. > > > > $ php -r 'echo 0.7 - 0.2 == 0.5 ? "true\n" : "false\n";' > > false > > > > The operation you do isn't important. You just can't represent certain > > numbers exactly in binary, just as you can't represent 1/3 exactly in > > decimal. They have to be rounded internally. > > which makes php casting so much fun: > > $ php -r 'echo (string)(0.7 - 0.2) == 0.5 ? "true\n" : "false\n";' > true Just make a simple function... Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
Robert Cummings schreef: On Tue, 2008-07-15 at 12:37 -0400, tedd wrote: At 12:31 PM -0400 7/15/08, Robert Cummings wrote: Umm... here it is to unlimited precision: ¼ Cheers, Rob. Yeah and here's ƒ Like or not, that's all there is to it. Weird... you're client bastar-dized my beautiful pi symbol. no it's the worst round error ever. how exactly do you go from 3.1 to .25 :-P Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
Robin Vickery schreef: 2008/7/15 tedd <[EMAIL PROTECTED]>: I said: "Round-off errors normally don't enter into things unless your doing multiplication and division operations." And that is not "Bull" -- it's true. You can add and subtract all the floating point numbers (the one's we are talking about here) you want without any rounding errors whatsoever. $ php -r 'echo 0.7 - 0.2 == 0.5 ? "true\n" : "false\n";' false The operation you do isn't important. You just can't represent certain numbers exactly in binary, just as you can't represent 1/3 exactly in decimal. They have to be rounded internally. which makes php casting so much fun: $ php -r 'echo (string)(0.7 - 0.2) == 0.5 ? "true\n" : "false\n";' true -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness - Can it be done with integers alone??
tedd schreef: At 4:45 PM -0400 7/14/08, Daniel Brown wrote: That's as far OT as I'm going, but it's worth noting how regulation doesn't do shit if it's not enforced. The only thing that's regulated AND enforced is what you owe the government. actually your under no obligation to declare any income tax in your country, look into it Don't get me started. :-) Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] case and accent - insensitive regular expression?
The original problem was User X submits a character string A. A PHP scripts uses A to search for it's occurences in a DB, ignoring special characters. The result of ze search is a list of character strings M-LIST with matches. This list gets outputted to the user X, but before that all the matching strings should be replaced with ''..'' If i clearly got the OP then he is using MySQL to perform the search. I guess he is doing it with MATCH. So MySQL already found the match and in PHP it has to be done again ... eg. The table has 2 entries, string1 and string2 .. string1 = 'Thís ís an éxámplè stríng wíth áccénts.' string2 = 'This is an example string without accents.' Now the user searches for "ample": search = '*ample*' Both string have matches due to accent-insensitivity (AI). Now the result is outputted with highlighting .. *Thís ís an éx**ámplè** stríng wíth áccénts.* *This is an ex**ample** string without accents.* So since MySQL already did the job, why not get the occurances from it? I'm not an MySQL expert, but I know google and found something called string functions. Especially a "locate" function got my interest. http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_locate Now shouldnt it be possible to create a query that searches the db for matches and additionally uses the string function? I have no idea, but maybe some MySQL-expert out there has ... Yeti On Tue, Jul 15, 2008 at 7:17 PM, Andrew Ballard <[EMAIL PROTECTED]> wrote: > On Tue, Jul 15, 2008 at 12:30 PM, tedd <[EMAIL PROTECTED]> wrote: > > At 10:15 AM -0400 7/15/08, Andrew Ballard wrote: > >> > >> On TueWell, OK, I can think of one optimization. This takes advantage of > >> the > >> fact that preg_replace can accept arrays as parameters. In a couple > >> very quick tests this version is roughly 30% faster than my previous > >> version: > > > > -snip- > > > > Hey, when you finally get finished with that function, please let me know > I > > would like to copy it. :-) > > > > Cheers, > > > > tedd > > All yours. I figure I'm done with it. (At least until I actually need > to use it for something and then I have to test it for real. :-) ) > > Andrew > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] Removeing duplicates inside for/foreach loop.
Niccolo Machiavelli wrote: I'm firly certain array unique won't can't handle dimensional arrays. This is what I have for code it almost works $order_data = array(); while ($row = $db->fetchRow($result)) { $order_data[] = '' . $row['order_payment_first_name'] . ' ' . $row['order_payment_last_name'] . ''; } $db->freeresult($result); since you are getting your information from a db, use SELECT DISTINCT order_number, This will ensure that only unique order_numbers are returned sort($order_data); if ($count = count($order_data)) { for ($i = 2; $i < $count; $i++) { if ($order_data[$i]['order_number'] == $order_data[$i-1]['order_number']) { unset($order_data[$i-1]); } if (count($order_data) > 0) { $order_list = implode(', ', $order_data); } else { $order_list = ''; } } } -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 12:12 PM To: php-general@lists.php.net Subject: Re: [PHP] Removeing duplicates inside for/foreach loop. At 11:50 AM -0500 7/15/08, Niccolo Machiavelli wrote: $array = array( -snip- My question is I want to remove duplicate order numbers in other words ditch *one* of the Mike Smith rows there's a duplicate order number there. And I need to do it in either a for/foreach loop. Somehow there's got to be a simple way to check and only output non duplicate order numbers while I'm looping thru the data. Any help would be greatly appreciated. Niccolo: Check out: array_unique http://www.php.net/array_unique Cheers, tedd -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote: > At 12:31 PM -0400 7/15/08, Robert Cummings wrote: > > > >Umm... here it is to unlimited precision: ¼ > > > >Cheers, > >Rob. > > Yeah and here's ƒ > > Like or not, that's all there is to it. Weird... you're client bastar-dized my beautiful pi symbol. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removeing duplicates inside for/foreach loop.
On Tue, Jul 15, 2008 at 12:50 PM, Niccolo Machiavelli <[EMAIL PROTECTED]> wrote: > $array = array( > > 1 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" > => "Mike", "order_payment_last_name" => "Smith"), > > 2 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" > => "Mike", "order_payment_last_name" => "Smith"), > > 3 => array("order_number" => "45Y3453245T23T5", "order_payment_first_name" > => "Steve", "order_payment_last_name" => "Jobs"), > > 4 => array("order_number" => "34RTB345T45T456", "order_payment_first_name" > => "Frank", "order_payment_last_name" => "Capra"), > > 5 => array("order_number" => "567U457645645Y6", "order_payment_first_name" > => "John", "order_payment_last_name" => "Doe"), > > 6 => array("order_number" => "7698234T456M963", "order_payment_first_name" > => "Bill", "order_payment_last_name" => "Williams")); > > > > echo(''); > > print_r($array); > > echo(''); > > > > My question is I want to remove duplicate order numbers in other words ditch > *one* of the Mike Smith rows there's a duplicate order number there. > > And I need to do it in either a for/foreach loop. Somehow there's got to be > a simple way to check and only output non duplicate order numbers while I'm > looping thru the data. Any help would be greatly appreciated. > > > > > > Thanks > > [EMAIL PROTECTED] > > Would it be possible to leave them out in your original query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Removeing duplicates inside for/foreach loop.
I'm firly certain array unique won't can't handle dimensional arrays. This is what I have for code it almost works $order_data = array(); while ($row = $db->fetchRow($result)) { $order_data[] = '' . $row['order_payment_first_name'] . ' ' . $row['order_payment_last_name'] . ''; } $db->freeresult($result); sort($order_data); if ($count = count($order_data)) { for ($i = 2; $i < $count; $i++) { if ($order_data[$i]['order_number'] == $order_data[$i-1]['order_number']) { unset($order_data[$i-1]); } if (count($order_data) > 0) { $order_list = implode(', ', $order_data); } else { $order_list = ''; } } } -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 12:12 PM To: php-general@lists.php.net Subject: Re: [PHP] Removeing duplicates inside for/foreach loop. At 11:50 AM -0500 7/15/08, Niccolo Machiavelli wrote: >$array = array( -snip- >My question is I want to remove duplicate order numbers in other words ditch >*one* of the Mike Smith rows there's a duplicate order number there. > >And I need to do it in either a for/foreach loop. Somehow there's got to be >a simple way to check and only output non duplicate order numbers while I'm >looping thru the data. Any help would be greatly appreciated. Niccolo: Check out: array_unique http://www.php.net/array_unique Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- 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] case and accent - insensitive regular expression?
On Tue, Jul 15, 2008 at 12:30 PM, tedd <[EMAIL PROTECTED]> wrote: > At 10:15 AM -0400 7/15/08, Andrew Ballard wrote: >> >> On TueWell, OK, I can think of one optimization. This takes advantage of >> the >> fact that preg_replace can accept arrays as parameters. In a couple >> very quick tests this version is roughly 30% faster than my previous >> version: > > -snip- > > Hey, when you finally get finished with that function, please let me know I > would like to copy it. :-) > > Cheers, > > tedd All yours. I figure I'm done with it. (At least until I actually need to use it for something and then I have to test it for real. :-) ) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Removeing duplicates inside for/foreach loop.
Niccolo Machiavelli wrote: $array = array( 1 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" => "Mike", "order_payment_last_name" => "Smith"), 2 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" => "Mike", "order_payment_last_name" => "Smith"), 3 => array("order_number" => "45Y3453245T23T5", "order_payment_first_name" => "Steve", "order_payment_last_name" => "Jobs"), 4 => array("order_number" => "34RTB345T45T456", "order_payment_first_name" => "Frank", "order_payment_last_name" => "Capra"), 5 => array("order_number" => "567U457645645Y6", "order_payment_first_name" => "John", "order_payment_last_name" => "Doe"), 6 => array("order_number" => "7698234T456M963", "order_payment_first_name" => "Bill", "order_payment_last_name" => "Williams")); echo(''); print_r($array); echo(''); My question is I want to remove duplicate order numbers in other words ditch *one* of the Mike Smith rows there's a duplicate order number there. And I need to do it in either a for/foreach loop. Somehow there's got to be a simple way to check and only output non duplicate order numbers while I'm looping thru the data. Any help would be greatly appreciated. Thanks [EMAIL PROTECTED] foreach ($array as $k => $v) { $result[$v['order_number']] = $v; } //then use $result -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removeing duplicates inside for/foreach loop.
At 11:50 AM -0500 7/15/08, Niccolo Machiavelli wrote: $array = array( -snip- My question is I want to remove duplicate order numbers in other words ditch *one* of the Mike Smith rows there's a duplicate order number there. And I need to do it in either a for/foreach loop. Somehow there's got to be a simple way to check and only output non duplicate order numbers while I'm looping thru the data. Any help would be greatly appreciated. Niccolo: Check out: array_unique http://www.php.net/array_unique Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] Removeing duplicates inside for/foreach loop.]
Niccolo Machiavelli wrote: $array = array( 1 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" => "Mike", "order_payment_last_name" => "Smith"), 2 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" => "Mike", "order_payment_last_name" => "Smith"), 3 => array("order_number" => "45Y3453245T23T5", "order_payment_first_name" => "Steve", "order_payment_last_name" => "Jobs"), 4 => array("order_number" => "34RTB345T45T456", "order_payment_first_name" => "Frank", "order_payment_last_name" => "Capra"), 5 => array("order_number" => "567U457645645Y6", "order_payment_first_name" => "John", "order_payment_last_name" => "Doe"), 6 => array("order_number" => "7698234T456M963", "order_payment_first_name" => "Bill", "order_payment_last_name" => "Williams")); echo(''); print_r($array); echo(''); My question is I want to remove duplicate order numbers in other words ditch *one* of the Mike Smith rows there's a duplicate order number there. And I need to do it in either a for/foreach loop. Somehow there's got to be a simple way to check and only output non duplicate order numbers while I'm looping thru the data. Any help would be greatly appreciated. It looks like the array is sorted. In pseudo code for i = 2 to n if x[1].order = x[i-1].order then unlink x[i-1] Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login without cookies enabled help
>Yes, again, STFW before posting here. > >Google "PHPSESSID". > Call to undefined function Google(); > > -- > > > :) -- Thiago Henrique Pojda
[PHP] Removeing duplicates inside for/foreach loop.
$array = array( 1 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" => "Mike", "order_payment_last_name" => "Smith"), 2 => array("order_number" => "10DA0DDEDAF97DB", "order_payment_first_name" => "Mike", "order_payment_last_name" => "Smith"), 3 => array("order_number" => "45Y3453245T23T5", "order_payment_first_name" => "Steve", "order_payment_last_name" => "Jobs"), 4 => array("order_number" => "34RTB345T45T456", "order_payment_first_name" => "Frank", "order_payment_last_name" => "Capra"), 5 => array("order_number" => "567U457645645Y6", "order_payment_first_name" => "John", "order_payment_last_name" => "Doe"), 6 => array("order_number" => "7698234T456M963", "order_payment_first_name" => "Bill", "order_payment_last_name" => "Williams")); echo(''); print_r($array); echo(''); My question is I want to remove duplicate order numbers in other words ditch *one* of the Mike Smith rows there's a duplicate order number there. And I need to do it in either a for/foreach loop. Somehow there's got to be a simple way to check and only output non duplicate order numbers while I'm looping thru the data. Any help would be greatly appreciated. Thanks [EMAIL PROTECTED]
RE: [PHP] Math Weirdness
At 12:31 PM -0400 7/15/08, Robert Cummings wrote: Umm... here it is to unlimited precision: ¼ Cheers, Rob. Yeah and here's Like or not, that's all there is to it. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
> Nope, I have set mine to 755, and it does not seem to be giving me any > errors. This is the safer way to do it, right? > > Alice Alice, At this point, you need to re-install the OS or prepare to get your machine completely hacked and trashed. With your permissions that badly screwed up, it is only a matter of time before someone finds it and has their own ghost server. First, go pick up a System Admin book for Redhat Second, READ IT, Especially the parts on permissions and changing users Third, Re-install the OS Fourth, read the CLI vs. HTTP differences on programming languages you are using. Obviously Perl and PHP are going to give you the same errors when using the HTTP and will operate differently from the CLI unless running as the same user. This might even help your schooling. Hopefully your classroom exercises are further along then these basic principles, but if not I have severe doubts in anyone graduating with an MIS from Indiana University. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
> > From: Robert Cummings [EMAIL PROTECTED] > Sent: Tuesday, July 15, 2008 12:16 PM > To: Wei, Alice J. > Cc: Peter Ford; php-general@lists.php.net > Subject: RE: [PHP] mkdir permission errors > > On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > > This portion is to answer Rob's question: > > > > [EMAIL PROTECTED] var]# ls -la > > total 92 > > drwxrwxrwx 22 root root 4096 2008-06-24 08:34 . > > drwxr-xr-x 21 root root 4096 2008-07-14 08:17 .. > > drwxrwxrwx 2 root root 4096 2008-06-24 08:25 account > > drwxrwxrwx 13 root root 4096 2008-07-14 16:07 cache > > drwxrwxrwx 2 root root 4096 2008-02-19 20:47 cvs > > drwxrwxrwx 3 root root 4096 2008-06-24 08:25 db > > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 empty > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 games > > drwxrwxrwx 2 root root 4096 2008-05-01 22:45 gdm > > drwxrwxrwx 35 root root 4096 2008-07-14 16:07 lib > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 local > > drwxrwxrwx 5 root root 4096 2008-07-15 04:10 lock > > drwxrwxrwx 17 root root 4096 2008-07-15 04:10 log > > lrwxrwxrwx 1 root root 10 2008-06-24 08:24 mail -> spool/mail > > drwxrwxrwx 6 root root 4096 2008-06-24 08:26 named > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 nis > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 opt > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 preserve > > drwxrwxrwx 27 root root 4096 2008-07-14 16:12 run > > drwxrwxrwx 13 root root 4096 2008-06-24 08:35 spool > > drwxrwxrwx 2 root root 4096 2008-07-14 16:10 tmp > > drwxrwxrwx 8 root root 4096 2008-07-14 16:07 www > > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 yp > > Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H > > Umm, you've made your entire system world readable/writeable? That's not > good. And the ownership of www is root, not apache. Change directory to > www and do ls -al again. Maybe your html directory is ok for ownerships. > > > And does your PHP script have the correct path? > > > > This is the latest error I got: > > > > Warning: mkdir() [function.mkdir]: Permission denied in > > /var/www/html/file_linux.php on line 15 > > Cannot create directory > > The error indicates what script is generating the error. Not the path to > the directory you want to create. Maybe echo the name of the directory > you are trying to create when you get a failure for mkdir(). > > Nope, I have set mine to 755, and it does not seem to be giving me any > errors. This is the safer way to do it, right? 755 are better permissions in general than 777, but to what does "mine" refer in the above context? I meant the permission settings have been set to 755 and no longer 777. My mail client? All I can think of is when I am reading others posts and try to answer what they are asking for, which makes it seem like there is a lag. Alice Cheers, Rob. Ps. what's wrong with your mail client? It doesn't quote content to which you reply making it difficult to see where the previous person's post ends and your response begins. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
On Tue, 2008-07-15 at 12:26 -0400, tedd wrote: > At 4:52 PM +0100 7/15/08, Ford, Mike wrote: > >On 15 July 2008 14:33, tedd advised: > > > Mike: > >> > >> No reason to be rude. > >> > >> I said: > >> > >> "Round-off errors normally don't enter into things unless your doing > >> multiplication and division operations." > >> > >> And that is not "Bull" -- it's true. You can add and subtract all the > >> floating point numbers (the one's we are talking about here) you want > >> without any rounding errors whatsoever. > > > >Sorry, I do apologise if I came over too strongly -- there was no > >intention to offend. > > > >However, you really can't dismiss the effects of round-off errors on > >addition and subtraction as lightly as that. It's simply not true that > >approximations only occur at the point of doing multiplication and > >division -- there *are* approximations involved in addition and > >subtraction, and it is necessary to be aware that this is the case -- as > >Jay proved, 0.1+0.2 is hardly ever exactly 0.3. In this sort of case, it > >may well be that an appropriate degree of suspicion is simply to round > >to 2 decimal places at every stage, or compare the absolute difference > >to .001, but nonetheless one has to *know* that this is necessary. > > > >Ummm -- sorry, better , now!!! > > No problem about the rudeness -- email is a terrible form of > communication. Sometimes we don't realize how we are being perceived. > > I know full well about what you speak and why there are problems > dealing with numbers. > > My only point here was that the OP was talking about his > balance-sheet not balancing at the end of the day. > > I said that if all he was doing was adding and subtracting, then he > wouldn't have any problems -- those operations are not subject to the > rounding errors that division and multiplication induce. And > experience has shown me that my claim is true. I can add and subtract > dollars and cents all day without an error whatsoever. > > Now, if you get into more complicated math, such as > multiplication/division then of course rounding errors come into play > much more noticeably. It is true that not every number can be > represented in binary because of the limits of the processor. Take > for example pi, no computer in the world has capabilities to > represent that number in it's totality (i.e., unlimited precision). Umm... here it is to unlimited precision: π Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] case and accent - insensitive regular expression?
At 10:15 AM -0400 7/15/08, Andrew Ballard wrote: On TueWell, OK, I can think of one optimization. This takes advantage of the fact that preg_replace can accept arrays as parameters. In a couple very quick tests this version is roughly 30% faster than my previous version: -snip- Hey, when you finally get finished with that function, please let me know I would like to copy it. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Tue, 2008-07-15 at 12:19 -0400, Wei, Alice J. wrote: > > From: Robert Cummings [EMAIL PROTECTED] > Sent: Tuesday, July 15, 2008 12:16 PM > To: Wei, Alice J. > Cc: Peter Ford; php-general@lists.php.net > Subject: RE: [PHP] mkdir permission errors > > On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > > This portion is to answer Rob's question: > > > > [EMAIL PROTECTED] var]# ls -la > > total 92 > > drwxrwxrwx 22 root root 4096 2008-06-24 08:34 . > > drwxr-xr-x 21 root root 4096 2008-07-14 08:17 .. > > drwxrwxrwx 2 root root 4096 2008-06-24 08:25 account > > drwxrwxrwx 13 root root 4096 2008-07-14 16:07 cache > > drwxrwxrwx 2 root root 4096 2008-02-19 20:47 cvs > > drwxrwxrwx 3 root root 4096 2008-06-24 08:25 db > > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 empty > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 games > > drwxrwxrwx 2 root root 4096 2008-05-01 22:45 gdm > > drwxrwxrwx 35 root root 4096 2008-07-14 16:07 lib > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 local > > drwxrwxrwx 5 root root 4096 2008-07-15 04:10 lock > > drwxrwxrwx 17 root root 4096 2008-07-15 04:10 log > > lrwxrwxrwx 1 root root 10 2008-06-24 08:24 mail -> spool/mail > > drwxrwxrwx 6 root root 4096 2008-06-24 08:26 named > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 nis > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 opt > > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 preserve > > drwxrwxrwx 27 root root 4096 2008-07-14 16:12 run > > drwxrwxrwx 13 root root 4096 2008-06-24 08:35 spool > > drwxrwxrwx 2 root root 4096 2008-07-14 16:10 tmp > > drwxrwxrwx 8 root root 4096 2008-07-14 16:07 www > > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 yp > > Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H > > Umm, you've made your entire system world readable/writeable? That's not > good. And the ownership of www is root, not apache. Change directory to > www and do ls -al again. Maybe your html directory is ok for ownerships. > > > And does your PHP script have the correct path? > > > > This is the latest error I got: > > > > Warning: mkdir() [function.mkdir]: Permission denied in > > /var/www/html/file_linux.php on line 15 > > Cannot create directory > > The error indicates what script is generating the error. Not the path to > the directory you want to create. Maybe echo the name of the directory > you are trying to create when you get a failure for mkdir(). > > Nope, I have set mine to 755, and it does not seem to be giving me any > errors. This is the safer way to do it, right? 755 are better permissions in general than 777, but to what does "mine" refer in the above context? Cheers, Rob. Ps. what's wrong with your mail client? It doesn't quote content to which you reply making it difficult to see where the previous person's post ends and your response begins. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
At 4:52 PM +0100 7/15/08, Ford, Mike wrote: On 15 July 2008 14:33, tedd advised: > Mike: No reason to be rude. I said: "Round-off errors normally don't enter into things unless your doing multiplication and division operations." And that is not "Bull" -- it's true. You can add and subtract all the floating point numbers (the one's we are talking about here) you want without any rounding errors whatsoever. Sorry, I do apologise if I came over too strongly -- there was no intention to offend. However, you really can't dismiss the effects of round-off errors on addition and subtraction as lightly as that. It's simply not true that approximations only occur at the point of doing multiplication and division -- there *are* approximations involved in addition and subtraction, and it is necessary to be aware that this is the case -- as Jay proved, 0.1+0.2 is hardly ever exactly 0.3. In this sort of case, it may well be that an appropriate degree of suspicion is simply to round to 2 decimal places at every stage, or compare the absolute difference to .001, but nonetheless one has to *know* that this is necessary. Ummm -- sorry, better , now!!! No problem about the rudeness -- email is a terrible form of communication. Sometimes we don't realize how we are being perceived. I know full well about what you speak and why there are problems dealing with numbers. My only point here was that the OP was talking about his balance-sheet not balancing at the end of the day. I said that if all he was doing was adding and subtracting, then he wouldn't have any problems -- those operations are not subject to the rounding errors that division and multiplication induce. And experience has shown me that my claim is true. I can add and subtract dollars and cents all day without an error whatsoever. Now, if you get into more complicated math, such as multiplication/division then of course rounding errors come into play much more noticeably. It is true that not every number can be represented in binary because of the limits of the processor. Take for example pi, no computer in the world has capabilities to represent that number in it's totality (i.e., unlimited precision). However, if one defines the precision, then that's a different matter. As with the OP's problem, the precision he was dealing with was simply 0.00 and addition and subtraction operations don't come into play at the precision level (i.e., 0.10 + 0.20 will equal 0.30 no matter how many times you add it). In addition, the algorithm that used to round the number also comes into play. For example php always round down and that introduces bias, as proved here: http://webbytedd.com/bbb/rounding/ So, all in all, I agree with your statements, but I just don't think you fully appreciated what I was trying to communicate to the OP. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
[snip] So what you're saying is that you've been skimming for a while and the fruits of your mislabour are adding up? [/snip] Not as far as you know. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
From: Robert Cummings [EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 12:16 PM To: Wei, Alice J. Cc: Peter Ford; php-general@lists.php.net Subject: RE: [PHP] mkdir permission errors On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > This portion is to answer Rob's question: > > [EMAIL PROTECTED] var]# ls -la > total 92 > drwxrwxrwx 22 root root 4096 2008-06-24 08:34 . > drwxr-xr-x 21 root root 4096 2008-07-14 08:17 .. > drwxrwxrwx 2 root root 4096 2008-06-24 08:25 account > drwxrwxrwx 13 root root 4096 2008-07-14 16:07 cache > drwxrwxrwx 2 root root 4096 2008-02-19 20:47 cvs > drwxrwxrwx 3 root root 4096 2008-06-24 08:25 db > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 empty > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 games > drwxrwxrwx 2 root root 4096 2008-05-01 22:45 gdm > drwxrwxrwx 35 root root 4096 2008-07-14 16:07 lib > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 local > drwxrwxrwx 5 root root 4096 2008-07-15 04:10 lock > drwxrwxrwx 17 root root 4096 2008-07-15 04:10 log > lrwxrwxrwx 1 root root 10 2008-06-24 08:24 mail -> spool/mail > drwxrwxrwx 6 root root 4096 2008-06-24 08:26 named > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 nis > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 opt > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 preserve > drwxrwxrwx 27 root root 4096 2008-07-14 16:12 run > drwxrwxrwx 13 root root 4096 2008-06-24 08:35 spool > drwxrwxrwx 2 root root 4096 2008-07-14 16:10 tmp > drwxrwxrwx 8 root root 4096 2008-07-14 16:07 www > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 yp Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H Umm, you've made your entire system world readable/writeable? That's not good. And the ownership of www is root, not apache. Change directory to www and do ls -al again. Maybe your html directory is ok for ownerships. > And does your PHP script have the correct path? > > This is the latest error I got: > > Warning: mkdir() [function.mkdir]: Permission denied in > /var/www/html/file_linux.php on line 15 > Cannot create directory The error indicates what script is generating the error. Not the path to the directory you want to create. Maybe echo the name of the directory you are trying to create when you get a failure for mkdir(). Nope, I have set mine to 755, and it does not seem to be giving me any errors. This is the safer way to do it, right? Alice Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
On Tue, 2008-07-15 at 10:16 -0500, Jay Blanchard wrote: > [snip] > for most of what the majority of php/script apps deal with, it's > probably > safe to assume that addition/subtraction will be safe, but i can think > of > numerous examples where this isn't true... > [/snip] > > As demonstrated by the example I provided, just checking the difference > (or lack thereof) between two floats brought the issue to light. > > I think that this falls into the same category that cleaning input data > does in the fact that it should always be done. While there is a joke > about "skimming" the diffs it just demonstrates that the mathematical > constructs we use based on a digital platform leaves room for > error...and the errors add up really quickly because the platforms are > so darn much quicker than we are. So what you're saying is that you've been skimming for a while and the fruits of your mislabour are adding up? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
On Tue, 2008-07-15 at 08:16 -0400, Wei, Alice J. wrote: > This portion is to answer Rob's question: > > [EMAIL PROTECTED] var]# ls -la > total 92 > drwxrwxrwx 22 root root 4096 2008-06-24 08:34 . > drwxr-xr-x 21 root root 4096 2008-07-14 08:17 .. > drwxrwxrwx 2 root root 4096 2008-06-24 08:25 account > drwxrwxrwx 13 root root 4096 2008-07-14 16:07 cache > drwxrwxrwx 2 root root 4096 2008-02-19 20:47 cvs > drwxrwxrwx 3 root root 4096 2008-06-24 08:25 db > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 empty > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 games > drwxrwxrwx 2 root root 4096 2008-05-01 22:45 gdm > drwxrwxrwx 35 root root 4096 2008-07-14 16:07 lib > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 local > drwxrwxrwx 5 root root 4096 2008-07-15 04:10 lock > drwxrwxrwx 17 root root 4096 2008-07-15 04:10 log > lrwxrwxrwx 1 root root 10 2008-06-24 08:24 mail -> spool/mail > drwxrwxrwx 6 root root 4096 2008-06-24 08:26 named > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 nis > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 opt > drwxrwxrwx 2 root root 4096 2008-04-07 17:44 preserve > drwxrwxrwx 27 root root 4096 2008-07-14 16:12 run > drwxrwxrwx 13 root root 4096 2008-06-24 08:35 spool > drwxrwxrwx 2 root root 4096 2008-07-14 16:10 tmp > drwxrwxrwx 8 root root 4096 2008-07-14 16:07 www > drwxrwxrwx 3 root root 4096 2008-06-24 08:29 yp Umm... all your base are bel^H^H^H^H^H^H^H^H^H^H^H^H Umm, you've made your entire system world readable/writeable? That's not good. And the ownership of www is root, not apache. Change directory to www and do ls -al again. Maybe your html directory is ok for ownerships. > And does your PHP script have the correct path? > > This is the latest error I got: > > Warning: mkdir() [function.mkdir]: Permission denied in > /var/www/html/file_linux.php on line 15 > Cannot create directory The error indicates what script is generating the error. Not the path to the directory you want to create. Maybe echo the name of the directory you are trying to create when you get a failure for mkdir(). Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
On Tue, 2008-07-15 at 09:06 +0100, Peter Ford wrote: > Wei, Alice J. wrote: > > Hi, Rob: > > > > I forgot to mention that I have been using yum install. > > I have reinstalled the entire thing, put back all the packages, and then > > I went to /var and did a chmod -R 777 var, and then did a > > > >[EMAIL PROTECTED] var]# chown -R apache:apache . > > > > Interestingly, I do not see anything different, and I still get this error > > that says my permission is denied. Here is my > > > > [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' > > root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 > > /usr/sbin/httpd > > apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 > > /usr/sbin/httpd > > root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E > > apache|httpd > > > > Obviously, my last one has already changed the owner to apache > > already.Nevertheless, I am still denied even when I am now logged in as > > root. Is this anything with firewalls? > > > > Hang on a minute: you're original message said the error was: > > Warning: chmod() [function.chmod]: Permission denied in > /usr/local/apache/htdocs/file_linux.php on line 27 > > But you say you've re-installed, and done "chmod -R 777 var" and "chown -R > apache:apache ." in /var As Scooby would say... "Ruh, Roh!". Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
On Tue, 2008-07-15 at 11:32 +0100, Ford, Mike wrote: > On 14 July 2008 21:44, Jay Blanchard advised: > > > [snip] > > So does that mean your problem is solved? > > [/snip] > > > > It would appear so. I just need to remember to check for absolute > values > > when working with floats. > > Yeah, that's Computer Science 101 stuff. (Well, it was when I did my > degree 30+ years ago, so it's probably nearer primary school level by > now ;) You didn't get the alumni memo did you? Supposedly they teach less now than 30 years ago ;) Well... less theory I've heard. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
On 15 July 2008 16:07, bruce advised: > anyone remember the intel debacle in the 1990's.. when they > ate a couple > hundred million when they had a math err in one of their coprocessors! Oh, yes! And then, back in the day, there was the DEC arithmetic processor which hung if you happened to divide the most negative possible integer by zero (instead of returning a divide-by-zero error as it did for any other dividend!). Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "Warning:Cannot modify header information -" Error
On Tue, Jul 15, 2008 at 11:51 AM, Tiji varghese <[EMAIL PROTECTED]> wrote: > Hi All ! > I am having some problem with the code below. Everytime I run it it gives > me the following error: > Warning: Cannot modify header information - headers already sent > by (output started at > C:\xampp\htdocs\practice.com\displayUserData.php:7) in C:\xampp\htdocs\ > practice.com\displayUserData.php on line 12 > > The source code of the page is as follows: > > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > new document > > > $boldText = $_POST["boldText"]; > $userComments = stripslashes($_POST['userComments']); > if(isset($_POST["saveInfo"])) > { > setcookie("userData",$userComments,time()+60*60*24*30); > } > if(isset($_POST['boldText'])) > { > echo ""; > } > echo ""; > echo $userComments; > echo ""; > if (isset($_POST["boldText"])) > { > echo ""; > } > ?> > > > If I comment the setcookie() part, it works fine.. I looked up for some > online help n most of them say I might have a whitespace near the line > number mentioned in the warning message. But I don't find any.. Please help > ! > > > > Did you know? You can CHAT without downloading messenger. Go to > http://in.messenger.yahoo.com/webmessengerpromo.php/ The setcookie line needs to come before you output anything. Move your html output at the top past it, and you should be good. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. "Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life."
[PHP] "Warning:Cannot modify header information -" Error
Hi All ! I am having some problem with the code below. Everytime I run it it gives me the following error: Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\practice.com\displayUserData.php:7) in C:\xampp\htdocs\practice.com\displayUserData.php on line 12 The source code of the page is as follows: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> new document "; } echo ""; echo $userComments; echo ""; if (isset($_POST["boldText"])) { echo ""; } ?> If I comment the setcookie() part, it works fine.. I looked up for some online help n most of them say I might have a whitespace near the line number mentioned in the warning message. But I don't find any.. Please help ! Did you know? You can CHAT without downloading messenger. Go to http://in.messenger.yahoo.com/webmessengerpromo.php/
RE: [PHP] Math Weirdness
On 15 July 2008 14:33, tedd advised: > At 11:24 AM +0100 7/15/08, Ford, Mike wrote: >> On 14 July 2008 20:47, tedd advised: >> >> > Round-off errors normally don't enter into things unless your doing >> > multiplication and division operations. At that point, > what you get >>> back from the operation is an approximation and not the actual >>> number. >> >> Bull! Nearly all computer floating point numbers are approximations >> because of being held in binary rather than decimal. Any number with a >> (decimal) fractional part that doesn't end with the digit 5 is >> necessarily an approximation, and that's only half the story. So as soon >> as you involve numbers like 0.1 or 0.2, you've already got minor >> inaccuracies which will propagate through any kind of arithmetic -- it's >> just worse with multiplication or division because these tend to result >> in inaccuracy in more significant digits! >> >> Bottom line: a floating point value should *always* be treated with an >> appropriate degree of suspicion. >> >> Cheers! >> >> Mike > > Mike: > > No reason to be rude. > > I said: > > "Round-off errors normally don't enter into things unless your doing > multiplication and division operations." > > And that is not "Bull" -- it's true. You can add and subtract all the > floating point numbers (the one's we are talking about here) you want > without any rounding errors whatsoever. Sorry, I do apologise if I came over too strongly -- there was no intention to offend. However, you really can't dismiss the effects of round-off errors on addition and subtraction as lightly as that. It's simply not true that approximations only occur at the point of doing multiplication and division -- there *are* approximations involved in addition and subtraction, and it is necessary to be aware that this is the case -- as Jay proved, 0.1+0.2 is hardly ever exactly 0.3. In this sort of case, it may well be that an appropriate degree of suspicion is simply to round to 2 decimal places at every stage, or compare the absolute difference to .001, but nonetheless one has to *know* that this is necessary. Ummm -- sorry, better , now!!! Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
On Tue, Jul 15, 2008 at 11:16 AM, Jay Blanchard <[EMAIL PROTECTED]> wrote: > > the errors add up really quickly because the platforms are > so darn much quicker than we are. All I need to prove you wrong is an abacus and an old man with Parkinson's. ;-P -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
[snip] for most of what the majority of php/script apps deal with, it's probably safe to assume that addition/subtraction will be safe, but i can think of numerous examples where this isn't true... [/snip] As demonstrated by the example I provided, just checking the difference (or lack thereof) between two floats brought the issue to light. I think that this falls into the same category that cleaning input data does in the fact that it should always be done. While there is a joke about "skimming" the diffs it just demonstrates that the mathematical constructs we use based on a digital platform leaves room for error...and the errors add up really quickly because the platforms are so darn much quicker than we are. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
hi.. in all seriousness, when you talk about mathmetical operations, you need to really clearly define what the parameters of the conversation are. are you just restricting the conversation to ints, or floats as well.. you should also restrict the range of the number you're discussing. for most of what the majority of php/script apps deal with, it's probably safe to assume that addition/subtraction will be safe, but i can think of numerous examples where this isn't true... the internal representation of a number/value is really complex when you get into the guts of the cpu/fpu... and it can be hairy as hell to get it right, depending on what you're doing... that said, the vast majority of php will never think about this, and the world will still keep spinning!! anyone remember the intel debacle in the 1990's.. when they ate a couple hundred million when they had a math err in one of their coprocessors! peace.. -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 6:33 AM To: php php Subject: RE: [PHP] Math Weirdness At 11:24 AM +0100 7/15/08, Ford, Mike wrote: >On 14 July 2008 20:47, tedd advised: > > > Round-off errors normally don't enter into things unless your doing > > multiplication and division operations. At that point, what you get >> back from the operation is an approximation and not the actual >> number. > >Bull! Nearly all computer floating point numbers are approximations >because of being held in binary rather than decimal. Any number with a >(decimal) fractional part that doesn't end with the digit 5 is >necessarily an approximation, and that's only half the story. So as soon >as you involve numbers like 0.1 or 0.2, you've already got minor >inaccuracies which will propagate through any kind of arithmetic -- it's >just worse with multiplication or division because these tend to result >in inaccuracy in more significant digits! > >Bottom line: a floating point value should *always* be treated with an >appropriate degree of suspicion. > >Cheers! > >Mike Mike: No reason to be rude. I said: "Round-off errors normally don't enter into things unless your doing multiplication and division operations." And that is not "Bull" -- it's true. You can add and subtract all the floating point numbers (the one's we are talking about here) you want without any rounding errors whatsoever. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- 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
[PHP] Re: DB search and case sensitive comparison
Angelo Zanetti wrote: Hi all, I have a question and I can't seem to get around the problem or finding a total solution. I have a DB with a list of entries, one of the tables has fields and one of the fields is called the lookup_string field. This field is used to checkup values when users enter the site (explained below). So basically what happens is that the user will enter the site and I will get their user agent from the $_SERVER variable. What I want to do is to find out which entries in the DB are present in the useragent string. Eg: lookup_string (in db): "Mozilla" useragent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15' So what I did was I used the locate function in my mysql query which gives me the correct result set. Now what I need to do is to ensure that the lookup_string is in the useragent string and the CASE is the same: IE: Mozilla and not MOZILLA or mozilla etc... I am using the following If (however it fails because its part of the useragent string and not the whole complete string therefore providing a mismatch). if(strcmp($userAgent, $lookup_string)==0){ //matches } Else { //doesn't match } Which way could I accomplish searching for the lookup_string in the useragent and that it's the correct case? Thanks in advance. Angelo strpos(), ereg() or preg_match() should work, take your pick. strpos() most likely faster for this simple match. if (strpos($userAgent, $lookup_string) !== false) { //matches } else { //no matchy matchy } -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
Daniel Brown <[EMAIL PROTECTED]> wrote: > On Tue, Jul 15, 2008 at 7:05 AM, Wei, Alice J. <[EMAIL PROTECTED]> wrote: > > > > Do I really have to reinstall the entire Fedora? > > You may be a prime candidate for Windows. Well, you *could* load Fedora on another machine, fully update it, and then go into / and do an ls -alF. THEN, on the machine that you have completely messed up the permissions on, you would go to / and do an ls -alF Then traverse the directory structures simultaneously on both machines and make sure the one you messed up matches the pristine installed one. Once you have done that, you should be OK. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
On Tue, Jul 15, 2008 at 7:05 AM, Wei, Alice J. <[EMAIL PROTECTED]> wrote: > > Do I really have to reinstall the entire Fedora? You may be a prime candidate for Windows. -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login without cookies enabled help
On Tue, Jul 15, 2008 at 10:15 AM, Shelley <[EMAIL PROTECTED]> wrote: > Well, as I said the cookies are disabled at the clients. > > Anybody any opinions? Yes, again, STFW before posting here. Google "PHPSESSID". -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login without cookies enabled help
Well, as I said the cookies are disabled at the clients. Anybody any opinions? On Tue, Jul 15, 2008 at 7:23 PM, Thijs Lensselink <[EMAIL PROTECTED]> wrote: > Quoting Shelley <[EMAIL PROTECTED]>: > > Hi all, >> >> What is your way to organize user login without Client Cookies being >> disabled? >> >> Sample code will be appreciated. >> >> Waiting for your reply... >> >> -- >> Regards, >> Shelley >> >> > You can use sessions to store data on the server instead of the client. > > http://nl2.php.net/manual/en/ref.session.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, Shelley
Re: [PHP] Freelance PHP development in India
Hello Denis, normally Mr. Manuel Lemos would send this message, but, here is the hint: you can search for professionals at the following link: http://www.phpclasses.org/professionals/ I've take a look and in India had 333 PHP professionals! Regards, Thiago Melo de Paula On Mon, Jul 14, 2008 at 4:12 PM, tedd wrote: > At 12:20 PM +0800 7/14/08, Denis L. Menezes wrote: > >> Dear friends. >> >> I am looking for freelance web developers in India. >> >> Can contact me? >> >> Thanks >> Denis >> > > Good luck. > > tedd > >
[PHP] DB search and case sensitive comparison
Hi all, I have a question and I can't seem to get around the problem or finding a total solution. I have a DB with a list of entries, one of the tables has fields and one of the fields is called the lookup_string field. This field is used to checkup values when users enter the site (explained below). So basically what happens is that the user will enter the site and I will get their user agent from the $_SERVER variable. What I want to do is to find out which entries in the DB are present in the useragent string. Eg: lookup_string (in db): "Mozilla" useragent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15' So what I did was I used the locate function in my mysql query which gives me the correct result set. Now what I need to do is to ensure that the lookup_string is in the useragent string and the CASE is the same: IE: Mozilla and not MOZILLA or mozilla etc... I am using the following If (however it fails because its part of the useragent string and not the whole complete string therefore providing a mismatch). if(strcmp($userAgent, $lookup_string)==0){ //matches } Else { //doesn't match } Which way could I accomplish searching for the lookup_string in the useragent and that it's the correct case? Thanks in advance. Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Byte range support
Hello all, How can I make my php apps aware of byte range HTTP request ? I have a script that output data to user if she's granted to do so. But as of today, if download fails, she must restart the download from the beginning because my server (my php script) doesn't support "range byte requests" (actually, this is what curl and wget claims!) -- Manuel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness
2008/7/15 tedd <[EMAIL PROTECTED]>: > > I said: > > "Round-off errors normally don't enter into things unless your doing > multiplication and division operations." > > And that is not "Bull" -- it's true. You can add and subtract all the > floating point numbers (the one's we are talking about here) you want > without any rounding errors whatsoever. $ php -r 'echo 0.7 - 0.2 == 0.5 ? "true\n" : "false\n";' false The operation you do isn't important. You just can't represent certain numbers exactly in binary, just as you can't represent 1/3 exactly in decimal. They have to be rounded internally. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Math Weirdness
At 11:24 AM +0100 7/15/08, Ford, Mike wrote: On 14 July 2008 20:47, tedd advised: > Round-off errors normally don't enter into things unless your doing > multiplication and division operations. At that point, what you get back from the operation is an approximation and not the actual number. Bull! Nearly all computer floating point numbers are approximations because of being held in binary rather than decimal. Any number with a (decimal) fractional part that doesn't end with the digit 5 is necessarily an approximation, and that's only half the story. So as soon as you involve numbers like 0.1 or 0.2, you've already got minor inaccuracies which will propagate through any kind of arithmetic -- it's just worse with multiplication or division because these tend to result in inaccuracy in more significant digits! Bottom line: a floating point value should *always* be treated with an appropriate degree of suspicion. Cheers! Mike Mike: No reason to be rude. I said: "Round-off errors normally don't enter into things unless your doing multiplication and division operations." And that is not "Bull" -- it's true. You can add and subtract all the floating point numbers (the one's we are talking about here) you want without any rounding errors whatsoever. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
Wei, Alice J. wrote: From: Peter Ford [EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 7:28 AM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: -Original Message- From: Peter Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 4:06 AM To: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: Hi, Rob: I forgot to mention that I have been using yum install. I have reinstalled the entire thing, put back all the packages, and then I went to /var and did a chmod -R 777 var, and then did a [EMAIL PROTECTED] var]# chown -R apache:apache . Interestingly, I do not see anything different, and I still get this error that says my permission is denied. Here is my [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 /usr/sbin/httpd apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E apache|httpd Obviously, my last one has already changed the owner to apache already.Nevertheless, I am still denied even when I am now logged in as root. Is this anything with firewalls? Hang on a minute: you're original message said the error was: Warning: chmod() [function.chmod]: Permission denied in /usr/local/apache/htdocs/file_linux.php on line 27 But you say you've re-installed, and done "chmod -R 777 var" and "chown -R apache:apache ." in /var A few things there: When you are changing permissions and ownerships on such a large scale, you should always use absolute paths to be sure you are doing the right thing - like "chmod -R 777 /var" and "chown -R apache:apache /var" Next, changing permission and ownership recursively on something like /var is likely to wreck your system in weird and wonderful ways, and is pretty difficult to undo - you might be looking at a total OS reinstall here (once you've solved your Apache problems) Finally, the error message refers to a file in /usr/local/apache/htdocs, but you then are changing permissions in /var - where is your web root?! It looks like your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web files are actually in /var/something... I forgot to mention that I use Fedora on a Linux machine. I used yum install apache and yum install php to install my packages. Therefore, I don't have a /usr/local/apache/htdocs folder. The web root is now /var/www/html, which originally I do have /usr/local/apache/htdocs that I configured during previous installations. This is not there anymore after my reinstallations since yesterday. Do I really have to reinstall the entire Fedora? I hate to say that my scripts worked fine BEFORE yesterday until the power went out and nothing went right after I have restarted the entire system. Alice You don't *have* to reinstall Fedora (yet) - that was just a warning that changing ownership and permissions on /var might cause some problems later... So the question is, does the error message say that it cannot change permissions on /usr/local/apache/htdocs/file_linux.php or /var/www/html/file_linux.php ? And does your PHP script have the correct path? The original problem may just have been that the /usr/local file system was mounted read-only after the power outage (perhaps due to some disk corruption caused by the failure?). Since then you have reinstalled apache, but possibly not in the place your PHP script expects it to be. That would be my first thing to check... This sounds really dumb, but it turned out that I have some inconsistencies going on in my httpd.conf file. Now I have changed both groups to daemon, and changed to owners as Rob suggested. Now it is finally working fine. Would I still need to change everything back to 0755? Or, should I ask, what is the appropriate permission I should be using here? Alice At least that explains why the problem arose from a power failure: you had some new settings in the configuration which needed an apache restart to make them happen, and when the server rebooted, apache picked up the new settings... The problem is that if you did "chmod -R 777 /var", you changed every file /var and ALL of its subdirectories to have 777 permissions, and there's not an
RE: [PHP] Math Weirdness
[snip] > It would appear so. I just need to remember to check for absolute values > when working with floats. Yeah, that's Computer Science 101 stuff. (Well, it was when I did my degree 30+ years ago, so it's probably nearer primary school level by now ;) [/snip] This is what happens when you spend a lot of time managing projects and then have a need to step in and write some quick little application. The rust has frozen all of the things you should remember to do! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
From: Peter Ford [EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 7:28 AM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: > > -Original Message- > From: Peter Ford [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 15, 2008 4:06 AM > To: php-general@lists.php.net > Subject: Re: [PHP] mkdir permission errors > > Wei, Alice J. wrote: >> Hi, Rob: >> >> I forgot to mention that I have been using yum install. >> I have reinstalled the entire thing, put back all the packages, and then I >> went to /var and did a chmod -R 777 var, and then did a >> >>[EMAIL PROTECTED] var]# chown -R apache:apache . >> >> Interestingly, I do not see anything different, and I still get this error >> that says my permission is denied. Here is my >> >> [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' >> root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 >> /usr/sbin/httpd >> apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E >> apache|httpd >> >> Obviously, my last one has already changed the owner to apache >> already.Nevertheless, I am still denied even when I am now logged in as >> root. Is this anything with firewalls? >> > > Hang on a minute: you're original message said the error was: > > Warning: chmod() [function.chmod]: Permission denied in > /usr/local/apache/htdocs/file_linux.php on line 27 > > But you say you've re-installed, and done "chmod -R 777 var" and "chown -R > apache:apache ." in /var > > A few things there: > When you are changing permissions and ownerships on such a large scale, you > should always use absolute paths to be sure you are doing the right thing - > like > "chmod -R 777 /var" and "chown -R apache:apache /var" > > Next, changing permission and ownership recursively on something like /var is > likely to wreck your system in weird and wonderful ways, and is pretty > difficult > to undo - you might be looking at a total OS reinstall here (once you've > solved > your Apache problems) > > Finally, the error message refers to a file in /usr/local/apache/htdocs, but > you > then are changing permissions in /var - where is your web root?! It looks like > your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web > files are actually in /var/something... > > I forgot to mention that I use Fedora on a Linux machine. I used yum install > apache and yum install php to install my packages. Therefore, I don't have a > /usr/local/apache/htdocs folder. The web root is now /var/www/html, which > originally I do have /usr/local/apache/htdocs that I configured during > previous installations. This is not there anymore after my reinstallations > since yesterday. > > Do I really have to reinstall the entire Fedora? I hate to say that my > scripts worked fine BEFORE yesterday until the power went out and nothing > went right after I have restarted the entire system. > > Alice > You don't *have* to reinstall Fedora (yet) - that was just a warning that changing ownership and permissions on /var might cause some problems later... So the question is, does the error message say that it cannot change permissions on /usr/local/apache/htdocs/file_linux.php or /var/www/html/file_linux.php ? And does your PHP script have the correct path? The original problem may just have been that the /usr/local file system was mounted read-only after the power outage (perhaps due to some disk corruption caused by the failure?). Since then you have reinstalled apache, but possibly not in the place your PHP script expects it to be. That would be my first thing to check... This sounds really dumb, but it turned out that I have some inconsistencies going on in my httpd.conf file. Now I have changed both groups to daemon, and changed to owners as Rob suggested. Now it is finally working fine. Would I still need to change everything back to 0755? Or, should I ask, what is the appropriate permission I should be using here? Alice -- Peter Ford, Developer phone: 01580 89 fax: 01580 893399 Justcroft International Ltd. www.justcroft.com Justcroft House, High Street, Staplehurst, Kent TN12 0AH
Re: [PHP] mkdir permission errors
Wei, Alice J. wrote: From: Peter Ford [EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 7:28 AM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: -Original Message- From: Peter Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 4:06 AM To: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: Hi, Rob: I forgot to mention that I have been using yum install. I have reinstalled the entire thing, put back all the packages, and then I went to /var and did a chmod -R 777 var, and then did a [EMAIL PROTECTED] var]# chown -R apache:apache . Interestingly, I do not see anything different, and I still get this error that says my permission is denied. Here is my [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 /usr/sbin/httpd apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E apache|httpd Obviously, my last one has already changed the owner to apache already.Nevertheless, I am still denied even when I am now logged in as root. Is this anything with firewalls? Hang on a minute: you're original message said the error was: Warning: chmod() [function.chmod]: Permission denied in /usr/local/apache/htdocs/file_linux.php on line 27 But you say you've re-installed, and done "chmod -R 777 var" and "chown -R apache:apache ." in /var A few things there: When you are changing permissions and ownerships on such a large scale, you should always use absolute paths to be sure you are doing the right thing - like "chmod -R 777 /var" and "chown -R apache:apache /var" Next, changing permission and ownership recursively on something like /var is likely to wreck your system in weird and wonderful ways, and is pretty difficult to undo - you might be looking at a total OS reinstall here (once you've solved your Apache problems) Finally, the error message refers to a file in /usr/local/apache/htdocs, but you then are changing permissions in /var - where is your web root?! It looks like your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web files are actually in /var/something... I forgot to mention that I use Fedora on a Linux machine. I used yum install apache and yum install php to install my packages. Therefore, I don't have a /usr/local/apache/htdocs folder. The web root is now /var/www/html, which originally I do have /usr/local/apache/htdocs that I configured during previous installations. This is not there anymore after my reinstallations since yesterday. Do I really have to reinstall the entire Fedora? I hate to say that my scripts worked fine BEFORE yesterday until the power went out and nothing went right after I have restarted the entire system. Alice You don't *have* to reinstall Fedora (yet) - that was just a warning that changing ownership and permissions on /var might cause some problems later... So the question is, does the error message say that it cannot change permissions on /usr/local/apache/htdocs/file_linux.php or /var/www/html/file_linux.php ? This portion is to answer Rob's question: [EMAIL PROTECTED] var]# ls -la total 92 drwxrwxrwx 22 root root 4096 2008-06-24 08:34 . drwxr-xr-x 21 root root 4096 2008-07-14 08:17 .. drwxrwxrwx 2 root root 4096 2008-06-24 08:25 account drwxrwxrwx 13 root root 4096 2008-07-14 16:07 cache drwxrwxrwx 2 root root 4096 2008-02-19 20:47 cvs drwxrwxrwx 3 root root 4096 2008-06-24 08:25 db drwxrwxrwx 3 root root 4096 2008-06-24 08:29 empty drwxrwxrwx 2 root root 4096 2008-04-07 17:44 games drwxrwxrwx 2 root root 4096 2008-05-01 22:45 gdm drwxrwxrwx 35 root root 4096 2008-07-14 16:07 lib drwxrwxrwx 2 root root 4096 2008-04-07 17:44 local drwxrwxrwx 5 root root 4096 2008-07-15 04:10 lock drwxrwxrwx 17 root root 4096 2008-07-15 04:10 log lrwxrwxrwx 1 root root 10 2008-06-24 08:24 mail -> spool/mail drwxrwxrwx 6 root root 4096 2008-06-24 08:26 named drwxrwxrwx 2 root root 4096 2008-04-07 17:44 nis drwxrwxrwx 2 root root 4096 2008-04-07 17:44 opt drwxrwxrwx 2 root root 4096 2008-04-07 17:44 preserve drwxrwxrwx 27 root root 4096 2008-07-14 16:12 run drwxrwxrwx 13 root root 4096 2008-06-24 08:35 spool drwxrwxrwx 2 root root 4096 2008-07-14 16:10 tmp drwxrwx
RE: [PHP] mkdir permission errors
From: Peter Ford [EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 7:28 AM To: Wei, Alice J. Cc: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: > > -Original Message- > From: Peter Ford [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 15, 2008 4:06 AM > To: php-general@lists.php.net > Subject: Re: [PHP] mkdir permission errors > > Wei, Alice J. wrote: >> Hi, Rob: >> >> I forgot to mention that I have been using yum install. >> I have reinstalled the entire thing, put back all the packages, and then I >> went to /var and did a chmod -R 777 var, and then did a >> >>[EMAIL PROTECTED] var]# chown -R apache:apache . >> >> Interestingly, I do not see anything different, and I still get this error >> that says my permission is denied. Here is my >> >> [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' >> root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 >> /usr/sbin/httpd >> apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 >> /usr/sbin/httpd >> root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E >> apache|httpd >> >> Obviously, my last one has already changed the owner to apache >> already.Nevertheless, I am still denied even when I am now logged in as >> root. Is this anything with firewalls? >> > > Hang on a minute: you're original message said the error was: > > Warning: chmod() [function.chmod]: Permission denied in > /usr/local/apache/htdocs/file_linux.php on line 27 > > But you say you've re-installed, and done "chmod -R 777 var" and "chown -R > apache:apache ." in /var > > A few things there: > When you are changing permissions and ownerships on such a large scale, you > should always use absolute paths to be sure you are doing the right thing - > like > "chmod -R 777 /var" and "chown -R apache:apache /var" > > Next, changing permission and ownership recursively on something like /var is > likely to wreck your system in weird and wonderful ways, and is pretty > difficult > to undo - you might be looking at a total OS reinstall here (once you've > solved > your Apache problems) > > Finally, the error message refers to a file in /usr/local/apache/htdocs, but > you > then are changing permissions in /var - where is your web root?! It looks like > your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web > files are actually in /var/something... > > I forgot to mention that I use Fedora on a Linux machine. I used yum install > apache and yum install php to install my packages. Therefore, I don't have a > /usr/local/apache/htdocs folder. The web root is now /var/www/html, which > originally I do have /usr/local/apache/htdocs that I configured during > previous installations. This is not there anymore after my reinstallations > since yesterday. > > Do I really have to reinstall the entire Fedora? I hate to say that my > scripts worked fine BEFORE yesterday until the power went out and nothing > went right after I have restarted the entire system. > > Alice > You don't *have* to reinstall Fedora (yet) - that was just a warning that changing ownership and permissions on /var might cause some problems later... So the question is, does the error message say that it cannot change permissions on /usr/local/apache/htdocs/file_linux.php or /var/www/html/file_linux.php ? This portion is to answer Rob's question: [EMAIL PROTECTED] var]# ls -la total 92 drwxrwxrwx 22 root root 4096 2008-06-24 08:34 . drwxr-xr-x 21 root root 4096 2008-07-14 08:17 .. drwxrwxrwx 2 root root 4096 2008-06-24 08:25 account drwxrwxrwx 13 root root 4096 2008-07-14 16:07 cache drwxrwxrwx 2 root root 4096 2008-02-19 20:47 cvs drwxrwxrwx 3 root root 4096 2008-06-24 08:25 db drwxrwxrwx 3 root root 4096 2008-06-24 08:29 empty drwxrwxrwx 2 root root 4096 2008-04-07 17:44 games drwxrwxrwx 2 root root 4096 2008-05-01 22:45 gdm drwxrwxrwx 35 root root 4096 2008-07-14 16:07 lib drwxrwxrwx 2 root root 4096 2008-04-07 17:44 local drwxrwxrwx 5 root root 4096 2008-07-15 04:10 lock drwxrwxrwx 17 root root 4096 2008-07-15 04:10 log lrwxrwxrwx 1 root root 10 2008-06-24 08:24 mail -> spool/mail drwxrwxrwx 6 root root 4096 2008-06-24 08:26 named drwxrwxrwx 2 root root 4096 2008-04-07 17:44 nis drwxrwxrwx 2 root root 4096 2008-04-07 17:44 opt drwxrwxrwx 2 root root 4096 2008-
Re: [PHP] Login without cookies enabled help
[quote] On Tue , Thijs Lensselink [EMAIL PROTECTED] sent: Quoting Shelley <[EMAIL PROTECTED]>: > Hi all, > > What is your way to organize user login without Client Cookies being > disabled? > > Sample code will be appreciated. > > Waiting for your reply... > > -- > Regards, > Shelley > You can use sessions to store data on the server instead of the client. http://nl2.php.net/manual/en/ref.session.php [/quote] Just be careful as sessions default to using cookies. Otherwise, pass the session id with the query string of links!! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir permission errors
Wei, Alice J. wrote: -Original Message- From: Peter Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 4:06 AM To: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: Hi, Rob: I forgot to mention that I have been using yum install. I have reinstalled the entire thing, put back all the packages, and then I went to /var and did a chmod -R 777 var, and then did a [EMAIL PROTECTED] var]# chown -R apache:apache . Interestingly, I do not see anything different, and I still get this error that says my permission is denied. Here is my [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 /usr/sbin/httpd apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E apache|httpd Obviously, my last one has already changed the owner to apache already.Nevertheless, I am still denied even when I am now logged in as root. Is this anything with firewalls? Hang on a minute: you're original message said the error was: Warning: chmod() [function.chmod]: Permission denied in /usr/local/apache/htdocs/file_linux.php on line 27 But you say you've re-installed, and done "chmod -R 777 var" and "chown -R apache:apache ." in /var A few things there: When you are changing permissions and ownerships on such a large scale, you should always use absolute paths to be sure you are doing the right thing - like "chmod -R 777 /var" and "chown -R apache:apache /var" Next, changing permission and ownership recursively on something like /var is likely to wreck your system in weird and wonderful ways, and is pretty difficult to undo - you might be looking at a total OS reinstall here (once you've solved your Apache problems) Finally, the error message refers to a file in /usr/local/apache/htdocs, but you then are changing permissions in /var - where is your web root?! It looks like your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web files are actually in /var/something... I forgot to mention that I use Fedora on a Linux machine. I used yum install apache and yum install php to install my packages. Therefore, I don't have a /usr/local/apache/htdocs folder. The web root is now /var/www/html, which originally I do have /usr/local/apache/htdocs that I configured during previous installations. This is not there anymore after my reinstallations since yesterday. Do I really have to reinstall the entire Fedora? I hate to say that my scripts worked fine BEFORE yesterday until the power went out and nothing went right after I have restarted the entire system. Alice You don't *have* to reinstall Fedora (yet) - that was just a warning that changing ownership and permissions on /var might cause some problems later... So the question is, does the error message say that it cannot change permissions on /usr/local/apache/htdocs/file_linux.php or /var/www/html/file_linux.php ? And does your PHP script have the correct path? The original problem may just have been that the /usr/local file system was mounted read-only after the power outage (perhaps due to some disk corruption caused by the failure?). Since then you have reinstalled apache, but possibly not in the place your PHP script expects it to be. That would be my first thing to check... -- Peter Ford, Developer phone: 01580 89 fax: 01580 893399 Justcroft International Ltd. www.justcroft.com Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom Registered in England and Wales: 2297906 Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login without cookies enabled help
Quoting Shelley <[EMAIL PROTECTED]>: Hi all, What is your way to organize user login without Client Cookies being disabled? Sample code will be appreciated. Waiting for your reply... -- Regards, Shelley You can use sessions to store data on the server instead of the client. http://nl2.php.net/manual/en/ref.session.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mkdir permission errors
-Original Message- From: Peter Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 4:06 AM To: php-general@lists.php.net Subject: Re: [PHP] mkdir permission errors Wei, Alice J. wrote: > Hi, Rob: > > I forgot to mention that I have been using yum install. > I have reinstalled the entire thing, put back all the packages, and then I > went to /var and did a chmod -R 777 var, and then did a > >[EMAIL PROTECTED] var]# chown -R apache:apache . > > Interestingly, I do not see anything different, and I still get this error > that says my permission is denied. Here is my > > [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' > root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 > /usr/sbin/httpd > apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 > /usr/sbin/httpd > apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 > /usr/sbin/httpd > apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 > /usr/sbin/httpd > apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 > /usr/sbin/httpd > apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 > /usr/sbin/httpd > root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E > apache|httpd > > Obviously, my last one has already changed the owner to apache > already.Nevertheless, I am still denied even when I am now logged in as root. > Is this anything with firewalls? > Hang on a minute: you're original message said the error was: Warning: chmod() [function.chmod]: Permission denied in /usr/local/apache/htdocs/file_linux.php on line 27 But you say you've re-installed, and done "chmod -R 777 var" and "chown -R apache:apache ." in /var A few things there: When you are changing permissions and ownerships on such a large scale, you should always use absolute paths to be sure you are doing the right thing - like "chmod -R 777 /var" and "chown -R apache:apache /var" Next, changing permission and ownership recursively on something like /var is likely to wreck your system in weird and wonderful ways, and is pretty difficult to undo - you might be looking at a total OS reinstall here (once you've solved your Apache problems) Finally, the error message refers to a file in /usr/local/apache/htdocs, but you then are changing permissions in /var - where is your web root?! It looks like your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web files are actually in /var/something... I forgot to mention that I use Fedora on a Linux machine. I used yum install apache and yum install php to install my packages. Therefore, I don't have a /usr/local/apache/htdocs folder. The web root is now /var/www/html, which originally I do have /usr/local/apache/htdocs that I configured during previous installations. This is not there anymore after my reinstallations since yesterday. Do I really have to reinstall the entire Fedora? I hate to say that my scripts worked fine BEFORE yesterday until the power went out and nothing went right after I have restarted the entire system. Alice -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- 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] Math Weirdness
On 14 July 2008 21:44, Jay Blanchard advised: > [snip] > So does that mean your problem is solved? > [/snip] > > It would appear so. I just need to remember to check for absolute values > when working with floats. Yeah, that's Computer Science 101 stuff. (Well, it was when I did my degree 30+ years ago, so it's probably nearer primary school level by now ;) Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Login without cookies enabled help
Sorry, should be "with Client Cookies being disabled" :) On Tue, Jul 15, 2008 at 6:24 PM, Shelley <[EMAIL PROTECTED]> wrote: > Hi all, > > What is your way to organize user login without Client Cookies being > disabled? > > Sample code will be appreciated. > > Waiting for your reply... > > -- > Regards, > Shelley > -- Regards, Shelley
RE: [PHP] Math Weirdness
On 14 July 2008 20:47, tedd advised: > Round-off errors normally don't enter into things unless your doing > multiplication and division operations. At that point, what you get > back from the operation is an approximation and not the actual > number. Bull! Nearly all computer floating point numbers are approximations because of being held in binary rather than decimal. Any number with a (decimal) fractional part that doesn't end with the digit 5 is necessarily an approximation, and that's only half the story. So as soon as you involve numbers like 0.1 or 0.2, you've already got minor inaccuracies which will propagate through any kind of arithmetic -- it's just worse with multiplication or division because these tend to result in inaccuracy in more significant digits! Bottom line: a floating point value should *always* be treated with an appropriate degree of suspicion. Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Login without cookies enabled help
Hi all, What is your way to organize user login without Client Cookies being disabled? Sample code will be appreciated. Waiting for your reply... -- Regards, Shelley
Re: [PHP] Advice on a radar chart
If you are willing to use googles chart api .. http://code.google.com/apis/chart/#radar Yeti On Tue, Jul 15, 2008 at 11:35 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: > Hey, > > Can anyone suggest an efficient method for plotting the marks on a radar > chart? I have the background done ( > http://www.phpguru.org/downloads/HTML5_radar/ - FF required), but that not > exactly difficult. > > Cheers. > > -- > Richard Heyes > > Employ me: > http://www.phpguru.org/cv > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] Advice on a radar chart
Hey, Can anyone suggest an efficient method for plotting the marks on a radar chart? I have the background done (http://www.phpguru.org/downloads/HTML5_radar/ - FF required), but that not exactly difficult. Cheers. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Math Weirdness - Can it be done with integers alone??
There's an algorithm known as banker's rounding that I thought all US banks used. I'm on blackberry right now so I don't have a pointer, but essentially you round to the nearest even cent. 1.5 goes to 2, as does 2.5. Waynn On 7/15/08, tedd <[EMAIL PROTECTED]> wrote: > At 4:15 PM -0400 7/14/08, Robert Cummings wrote: >> >> >>Nope, banks can't round like that when calculating your daily >>interest :) >> >>Cheers, >>Rob. > > I do know that when it comes to interest you pay them, they round up. > When it comes to interest they pay you, they round down -- and why > not? A decision has to be made -- you can't pay someone less than a > penny. > > Cheers, > > tedd > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > > -- > 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] mkdir permission errors
Wei, Alice J. wrote: Hi, Rob: I forgot to mention that I have been using yum install. I have reinstalled the entire thing, put back all the packages, and then I went to /var and did a chmod -R 777 var, and then did a [EMAIL PROTECTED] var]# chown -R apache:apache . Interestingly, I do not see anything different, and I still get this error that says my permission is denied. Here is my [EMAIL PROTECTED] var]# ps awxu | grep -E 'apache|httpd' root 31547 0.0 0.3 21268 6584 ?Ss 16:12 0:00 /usr/sbin/httpd apache 31549 0.0 0.2 21400 5572 ?S16:12 0:00 /usr/sbin/httpd apache 31550 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31551 0.0 0.2 21400 4908 ?S16:12 0:00 /usr/sbin/httpd apache 31552 0.0 0.2 21400 4896 ?S16:12 0:00 /usr/sbin/httpd apache 31553 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31554 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31555 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd apache 31556 0.0 0.2 21268 4860 ?S16:12 0:00 /usr/sbin/httpd root 31708 0.0 0.0 4120 728 pts/1R+ 16:30 0:00 grep -E apache|httpd Obviously, my last one has already changed the owner to apache already.Nevertheless, I am still denied even when I am now logged in as root. Is this anything with firewalls? Hang on a minute: you're original message said the error was: Warning: chmod() [function.chmod]: Permission denied in /usr/local/apache/htdocs/file_linux.php on line 27 But you say you've re-installed, and done "chmod -R 777 var" and "chown -R apache:apache ." in /var A few things there: When you are changing permissions and ownerships on such a large scale, you should always use absolute paths to be sure you are doing the right thing - like "chmod -R 777 /var" and "chown -R apache:apache /var" Next, changing permission and ownership recursively on something like /var is likely to wreck your system in weird and wonderful ways, and is pretty difficult to undo - you might be looking at a total OS reinstall here (once you've solved your Apache problems) Finally, the error message refers to a file in /usr/local/apache/htdocs, but you then are changing permissions in /var - where is your web root?! It looks like your PHP code has the /usr/local/apache/htdocs path hard-coded, when your web files are actually in /var/something... -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php