php-general Digest 6 Jun 2006 04:36:10 -0000 Issue 4169

Topics (messages 237411 through 237440):

Re: i have a problem inserting blob data larger than 1 mb
        237411 by: Adam Zey

Re: Delete
        237412 by: Richard Lynch
        237413 by: Richard Lynch
        237415 by: Chris Boget
        237417 by: Richard Lynch
        237418 by: Richard Lynch

Re: When is "z" != "z" ?
        237414 by: tedd
        237416 by: Adam Zey
        237420 by: Robert Cummings
        237425 by: tg-php.gryffyndevelopment.com
        237429 by: Martin Alterisio
        237430 by: Larry Garfield
        237431 by: tedd
        237432 by: Rasmus Lerdorf
        237433 by: Robert Cummings
        237434 by: tedd
        237435 by: Martin Alterisio
        237436 by: Robert Cummings
        237437 by: Larry Garfield
        237438 by: Martin Alterisio

Re: .htaccess - change index.php to index.abc
        237419 by: Richard Lynch

Re: Retrieve output from HTML or PHP file
        237421 by: Richard Lynch

Re: If value is odd or not
        237422 by: Richard Lynch
        237424 by: Adam Zey

Re: PHP/MySQL question
        237423 by: Wolf

Re: PHP/Mysql: Making binary field available for download - extra browser 
window ?
        237426 by: Richard Lynch

Re: Extended Ascii Characters
        237427 by: Richard Lynch

Session variables on Windows
        237428 by: Tom

String Manipulation
        237439 by: Rodrigo de Oliveira Costa
        237440 by: Chris

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
sunaram patir wrote:
hi list,
  i am facing a problem inserting binary data into a blob field.this is my
/etc/my.cnf file.
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
connect_timeout=60

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


please help me. and this is what i get after running the comand mysql --help

.......................
.......................
.......................
Possible variables for option --set-variable (-O) are:
connect_timeout       current value: 0
max_allowed_packet    current value: 16777216
net_buffer_length     current value: 16384
select_limit          current value: 1000
max_join_size         current value: 1000000


i guess there is some problem with connect_timeout.


Blobs have a max size like every other variable. Have you tried mediumblob and longblob yet? They both have more capacity. I suggest you refer to the MySQL manual.

Regards, Adam Zey.

--- End Message ---
--- Begin Message ---
On Sat, June 3, 2006 8:40 pm, George Babichev wrote:
> Hello everyone! I wrote a blog application, but now for the admin
> panel, i
> am trying to add a feature to delete blog posts. It would show the
> title of
> the post next to it, and have a delete link which would delete it. How
> would
> I do this? I mean if I have multiple blog entry's, how would I delete
> them
> without using php my admin?

The blog entries should all have a unique ID, such as an
auto_increment, and you would embed that in the delete form:

<form><input type="submit" name="delete[<?php echo $blog_entry_id?>]"
value="Delete!" /></form>

In the processing page:
<?php
  if (isset($_POST['delete'])){
    list($blog_entry_id) = each($_POST['delete']);
    $blog_entry_id = (int) $blog_entry_id; //sanitization
  }
?>


-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Sun, June 4, 2006 3:11 am, Rabin Vincent wrote:
> You may find it easier to generate links of the form
> delete.php?id=1, etc. Then you won't have to use a seperate
> form for each link. The id will be available in delete.php
> in $_GET. The same sanity checking applies in this case too.

Gah!

That violates the HTTP spec for GET versus POST, to start with.

Note that the solution I presented only needs ONE form tag, as the ID
is embedded into the KEY of the name of the submit button.

Might seem funky at first, but it works very well, and is one of the
reasons I love PHP.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Sun, June 4, 2006 3:11 am, Rabin Vincent wrote:
You may find it easier to generate links of the form
delete.php?id=1, etc. Then you won't have to use a seperate
form for each link. The id will be available in delete.php
in $_GET. The same sanity checking applies in this case too.
Gah!
That violates the HTTP spec for GET versus POST, to start with.

How so?

thnx,
Chris

--- End Message ---
--- Begin Message ---
On Mon, June 5, 2006 12:41 am, Rabin Vincent wrote:

> I don't see how POST is better/more secure for a delete action.

If you don't see how it's better, then READ THE HTTP SPECS!!!

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Mon, June 5, 2006 11:52 am, Chris Boget wrote:
>> On Sun, June 4, 2006 3:11 am, Rabin Vincent wrote:
>>> You may find it easier to generate links of the form
>>> delete.php?id=1, etc. Then you won't have to use a seperate
>>> form for each link. The id will be available in delete.php
>>> in $_GET. The same sanity checking applies in this case too.
>> Gah!
>> That violates the HTTP spec for GET versus POST, to start with.
>
> How so?

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
-TG:

Thanks for your explanation and time.

Normally, I don't alpha++ anything -- not to criticize others, but to me it 
doesn't make much sense to add a number to a character.  But considering the 
php language is so string aware, as compared to other languages, I just tried 
it on a lark just to see what would happen.

Okay, so I found out it's limitations and quirks.

But, you must admit that it is confusing to have a loop that goes from "a" to 
"z" and considers "aa" but not "aaa".

Now, if the loop just went from a to z, then I would think that would be 
logical. But I fail to see the logic behind considering "aa" but not "aaa" in 
the evaluation. But then again, I'm not that informed.

Enough said.

tedd



At 12:21 PM -0400 6/5/06, <[EMAIL PROTECTED]> wrote:
>I know this discussion doesn't need to continue any further..hah.. but I think 
>the biggest confusion people are having is that they're looking at two things 
>and assuming that PHP operates the same on both and these two things serve 
>different purposes.
>
>1. Incrementing strings: Best example giving was "File1"++ == "File2" or 
>"FileA"++ == "FileB".  In that case, wouldn't you want it to go from FileZ to 
>FileAA?  Makes sense right?
>
>2. Comparing "greatness" of strings:  Rasmus mentioned this earlier, but I 
>wante to illustrate it a little more because I think it was overlooked.  If 
>you have a list of names, for instance, and you alphabetize them, you'd get 
>something like this:
>
>Bob
>Brendan
>Burt
>Frank
>Fred
>
>Just become a name is longer doesn't mean it comes after the rest of the names 
>in the list.  So in that vane, anything starting in "A" will never be > 
>something starting with a "Z".  a < z  aa < z  aaa < z because:
>
>a
>aa
>aaa
>z
>
>When using interation and a for loop and " <= z" it gets to "y" and it's true, 
>gets to "z" and it's still true, then increments to "az" and yup.. still < 
>"z".  As mentioned, it's not until you get to something starting in "z" with 
>something after it that you're > "z".
>
>So hopefully that makes a little more sense.
>
>-TG
>
>
>
>= = = Original message = = =
>
>tedd wrote:
>> At 1:09 PM -0700 6/4/06, Rasmus Lerdorf wrote:
>>>> I agree with [1] and [2], but [3] is where we part company. You see, if 
>>>> you are right, then "aaa" would also be less than "z", but that doesn't 
>>>> appear so.
>>> Of course it is.
>>>
>>> php -r 'echo "aaa" < "z";'
>>> 1
>>
>> You missed the point, why does --
>>
>> for ($i="a"; $i<="z"; $i++)
>>  
>>   echo($i);
>>   
>>
>> -- not continue past "aaa"? Clearly, if "aaa" is less than "z" then why does 
>> the loop stop at "yz"?
>
>I thought I explained that a few times.  The sequence is:
>
>a b c ... x y z aa ab ac ... yx yy yz za zb zc ... zy zx zz aaa aab
>
>Your loop stops at yz and doesn't get anywhere near aaa because za > z
>
>-Rasmus
>
>
>___________________________________________________________
>Sent by ePrompter, the premier email notification software.
>Free download at http://www.ePrompter.com.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
tedd wrote:
-TG:

Thanks for your explanation and time.

Normally, I don't alpha++ anything -- not to criticize others, but to me it 
doesn't make much sense to add a number to a character.  But considering the 
php language is so string aware, as compared to other languages, I just tried 
it on a lark just to see what would happen.

Okay, so I found out it's limitations and quirks.

But, you must admit that it is confusing to have a loop that goes from "a" to "z" and considers 
"aa" but not "aaa".

Now, if the loop just went from a to z, then I would think that would be logical. But I fail to see 
the logic behind considering "aa" but not "aaa" in the evaluation. But then 
again, I'm not that informed.

Enough said.

tedd



At 12:21 PM -0400 6/5/06, <[EMAIL PROTECTED]> wrote:
I know this discussion doesn't need to continue any further..hah.. but I think 
the biggest confusion people are having is that they're looking at two things 
and assuming that PHP operates the same on both and these two things serve 
different purposes.

1. Incrementing strings: Best example giving was "File1"++ == "File2" or "FileA"++ == 
"FileB".  In that case, wouldn't you want it to go from FileZ to FileAA?  Makes sense right?

2. Comparing "greatness" of strings:  Rasmus mentioned this earlier, but I 
wante to illustrate it a little more because I think it was overlooked.  If you have a 
list of names, for instance, and you alphabetize them, you'd get something like this:

Bob
Brendan
Burt
Frank
Fred

Just become a name is longer doesn't mean it comes after the rest of the names in the list.  So in that vane, 
anything starting in "A" will never be > something starting with a "Z".  a < z  aa 
< z  aaa < z because:

a
aa
aaa
z

When using interation and a for loop and " <= z" it gets to "y" and it's true, gets to "z" and it's still true, then 
increments to "az" and yup.. still < "z".  As mentioned, it's not until you get to something starting in "z" with something 
after it that you're > "z".

So hopefully that makes a little more sense.

-TG



= = = Original message = = =

tedd wrote:
At 1:09 PM -0700 6/4/06, Rasmus Lerdorf wrote:
I agree with [1] and [2], but [3] is where we part company. You see, if you are right, then 
"aaa" would also be less than "z", but that doesn't appear so.
Of course it is.

php -r 'echo "aaa" < "z";'
1
You missed the point, why does --

for ($i="a"; $i<="z"; $i++)
echo($i);
-- not continue past "aaa"? Clearly, if "aaa" is less than "z" then why does the loop 
stop at "yz"?
I thought I explained that a few times.  The sequence is:

a b c ... x y z aa ab ac ... yx yy yz za zb zc ... zy zx zz aaa aab

Your loop stops at yz and doesn't get anywhere near aaa because za > z

-Rasmus


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



As mentioned before, discussion aside, you can do what you want with range and a foreach:

foreach (range('a', 'z') as $char)
{
   echo $char;
}

--- End Message ---
--- Begin Message ---
On Mon, 2006-06-05 at 12:49, tedd wrote:
> -TG:
> 
> Thanks for your explanation and time.
> 
> Normally, I don't alpha++ anything -- not to criticize others, but to me it 
> doesn't make much sense to add a number to a character.  But considering the 
> php language is so string aware, as compared to other languages, I just tried 
> it on a lark just to see what would happen.
> 
> Okay, so I found out it's limitations and quirks.
> 
> But, you must admit that it is confusing to have a loop that goes from "a" to 
> "z" and considers "aa" but not "aaa".
> 
> Now, if the loop just went from a to z, then I would think that would be 
> logical. But I fail to see the logic behind considering "aa" but not "aaa" in 
> the evaluation. But then again, I'm not that informed.
> 
> Enough said.

NOOOOO! More must be said!!

a   <= z
b   <= z
c   <= z
...
y   <= z
z   <= z
aa  <= z
ab  <= z
ac  <= z
...
az  <= z
ba  <= z
bb  <= z
bc  <= z
...
cz  <= z
...
dz  <= z
...
...
...
yx  <= z
yy  <= z
yz  <= z
za   > z

SOOOOOOOOOOOOOOOOooooooooooo, the comparisons stop before we get to aaa
and so aaa is never reached. za is the last comparison to occur at which
point the test fails and the loop stops.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
This is just one of those cases where the designers had to make a judgement 
call on how things were going to operate.  It makes sense if you look at the 
two things separately (incrementing vs string 'greatness' evaluation) and makes 
sense that how they chose to implement the functions are two valid choices 
among many ways that it could have been handled.

>From a developers point of view it becomes "it is what it is".  Now 
>understanding the nature of the beast we must accept that this is just how PHP 
>works.  It's not wrong, it's just strange when it comes to z++ combined with a 
>for loop.  Probably an unforeseen disconnect when designing PHP but the most 
>important thing is understanding HOW it works (more so than 'why' it was 
>designed that way) and coding accordingly.

There are many other ways to accomplish an A-Z sequence so as long as what's 
been discussed is understood as "just how PHP is", and that it's logical for 
certain purposes, then we can choose one of the other choices for solving the 
problem.


-TG

= = = Original message = = =

-TG:

Thanks for your explanation and time.

Normally, I don't alpha++ anything -- not to criticize others, but to me it 
doesn't make much sense to add a number to a character.  But considering the 
php language is so string aware, as compared to other languages, I just tried 
it on a lark just to see what would happen.

Okay, so I found out it's limitations and quirks.

But, you must admit that it is confusing to have a loop that goes from "a" to 
"z" and considers "aa" but not "aaa".

Now, if the loop just went from a to z, then I would think that would be 
logical. But I fail to see the logic behind considering "aa" but not "aaa" in 
the evaluation. But then again, I'm not that informed.

Enough said.

tedd



___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
2006/6/5, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

This is just one of those cases where the designers had to make a
judgement call on how things were going to operate.  It makes sense if you
look at the two things separately (incrementing vs string 'greatness'
evaluation) and makes sense that how they chose to implement the functions
are two valid choices among many ways that it could have been handled.


How does it make sense? I don't understand your argument, can you explain it
a little bit more?

From a developers point of view it becomes "it is what it is".  Now
understanding the nature of the beast we must accept that this is just how
PHP works.  It's not wrong, it's just strange when it comes to z++ combined
with a for loop.  Probably an unforeseen disconnect when designing PHP but
the most important thing is understanding HOW it works (more so than 'why'
it was designed that way) and coding accordingly.


I agree, this is what we have and what we asked for, we wanted to use
strings on a math context and these things are bound to happen. But still
saying that something is right/wrong/not right/not wrong in CS is a bold
statement. On a certain context something may seem right but when the
context changes it turns out to be wrong, for example suppose we have a
programming language that handles strings the way PHP does, and it
implements templates or generics (the term you prefer the most). The
template/generic should have to be aware of strings when using math
operators, because they don't behave the way a math literal would.

There are many other ways to accomplish an A-Z sequence so as long as what's
been discussed is understood as "just how PHP is", and that it's logical for
certain purposes, then we can choose one of the other choices for solving
the problem.


I don't think it's only about us as developers using PHP, but us as
community giving back something to the community. This might be a small
issue but what would be the whole point of being an open-source community if
we can't at least discuss about it? "It just the way things are" is not an
argument, it's an excuse.

-TG



--- End Message ---
--- Begin Message ---
On Monday 05 June 2006 14:56, Martin Alterisio wrote:
> 2006/6/5, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> > This is just one of those cases where the designers had to make a
> > judgement call on how things were going to operate.  It makes sense if
> > you look at the two things separately (incrementing vs string 'greatness'
> > evaluation) and makes sense that how they chose to implement the
> > functions are two valid choices among many ways that it could have been
> > handled.
>
> How does it make sense? I don't understand your argument, can you explain
> it a little bit more?

See Robert Cummings' post.  < and > are being interpreted in this case for 
alphabetical order.  Read "<" as "alphabetically before", and <= 
as "alphabetically before or string-equal to".

Is a alphabetically before or string-equal to z?  TRUE.
Is b alphabetically before or string-equal to z?  TRUE.
...
Is z alphabetically before or string-equal to z?  TRUE. (string-equal)
Is aa alphabetically before or string-equal to z?  TRUE. (a < z 
alphabetically, the second character is never checked).
Is ab alphabetically before or string-equal to z?  TRUE.
...
Is yz alphabetically before or string-equal to z?  TRUE.
Is za alphabetically before or string-equal to z?  FALSE.  (a alphabetically 
after NULL character.  Bob is alphabetically before Bobby for the same 
reason.)

See how the comparison works?  It's a purely alphabetic comparison.

As for the increment, it actually would never have occurred to me to ++ a 
string before this thread, honestly. :-)  However, what it appears to be 
doing (and I'm sure Rasmus will correct me if I'm wrong) is using a "string 
base" instead of a numeric base.  Thus a++ = b, b++=c, etc.  z++ "rolls over" 
to the next "digit" (which because it's a string goes to the right rather 
than the left), and resets.  So just as 9++ rolls over to 10, z rolls over to 
aa.

Does that make more sense?

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
At 1:10 PM -0400 6/5/06, Robert Cummings wrote:
>NOOOOO! More must be said!!
>
>a   <= z
>b   <= z
>c   <= z
>-snip-
>yx  <= z
>yy  <= z
>yz  <= z
>za   > z
>
>SOOOOOOOOOOOOOOOOooooooooooo, the comparisons stop before we get to aaa
>and so aaa is never reached. za is the last comparison to occur at which
>point the test fails and the loop stops.
>
>Cheers,
>Rob.


Rob:

Okay, I tried to get out of it, but I guess more must be said.

I do understand why the loop stops -- I totally understand the mechanics. After 
all this, how could I not? Besides, it's really not that difficult, is it? So, 
what might you guess I'm really talking about?

You see, what is failing to be understood here is what I'm addressing, which is 
basic set theory. One of the basic foundations for mathematics

If I have a set that is defined as all elements > "whatever" and < "something 
else", then you can address the set. You can ask questions about the set, such 
as what's the population of the set -- besides itself, does the set have any 
subsets, and such -- get the idea?

Now, if you have a set [A] where all elements within are defined as ("a" or 
greater) and (less than "z") -- then, believe or not, that set is infinite -- 
as is the set for everything > "z".

If you choose, which is the case here, to consider only a subset of [A], then 
that's fine -- but understand that when you say the sequence is --

a b c ... x y z aa ab ac ... yx yy yz za zb zc ... zy zx zz aaa aab

-- it's not!

But rather, the actual sequence is:

a b c ... x y z aa ab ac ... yx yy yz aaa aab aac... <infinite> z

You simply have chosen to arbitrarily end the sequence at "yz". That's the 
reason why "aaa" is less than "z" but not included in the "php-loop" set of 
(for i=a to z).

You can't say that "a" and "aaa" are members of a set identified as < "z" and 
then step through all the members of that population (an infinite group) and 
not include "aaa" -- UNLESS -- you arbitrarily determine an end point for a 
much smaller sub-set.

Now, unless, there is something that I don't see, which certainly could be the 
case, then php designers could have just as easily ended the loop at "z" and 
dispensed with this quirk all together.

Besides, what's the point of having 676 character between a and z? Is there 
one? I think the "accepted" number would be closer to 26, don't you think? It 
just seems more like common sense to me -- doesn't it to you?

But this is the way it is and I except that -- but as Dirty Harry once said "A 
man's got to know his limitations" -- this not only applies to men and 
programmers, but also for languages as well.

For example, the Unicode issue was raised during this discussion -- if php 
doesn't consider the numeric relationship of characters, then I see a big 
problem waiting in the wings. Because if we're having these types of 
discussions with just considering 00-7F characters, then I can only guess at 
what's going to happen when we start considering 000000-FFFFFF code-points.

Now, was that enough said?  :-)

Cheers.

tedd

-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
tedd wrote:
For example, the Unicode issue was raised during this discussion -- if php 
doesn't consider the numeric relationship of characters, then I see a big 
problem waiting in the wings. Because if we're having these types of 
discussions with just considering 00-7F characters, then I can only guess at 
what's going to happen when we start considering 000000-FFFFFF code-points.

Now, was that enough said?  :-)

I don't think you really understand this. < and > are collation operators when they operate on strings. They have absolutely nothing to do with the numeric values of the characters. It just so happens that in English iso-8859-1 there is a 1:1 relationship between the numeric values and the collation order, but you can think of that as dumb luck.

To better understand this, I suggest you start reading here:

  http://icu.sourceforge.net/userguide/Collate_Intro.html

Note one of the points on that page. That in Lithuanian 'y' falls between 'i' and 'k'. So even without going into Unicode and just using low-ascii, you have these issues.

Now, until we get to PHP 6, we don't have decent Unicode support and we don't have LOCALE-aware operators. You will have to manually use strcoll() to get them, but that is going to change and you will have the ICU collation algorithms available and for Unicode strings it will be automatic. You can still have binary-strings if you don't want locale-aware collation, of course.

-Rasmus

--- End Message ---
--- Begin Message ---
On Mon, 2006-06-05 at 21:35, tedd wrote:
> At 1:10 PM -0400 6/5/06, Robert Cummings wrote:
> >NOOOOO! More must be said!!
> >
> >a   <= z
> >b   <= z
> >c   <= z
> >-snip-
> >yx  <= z
> >yy  <= z
> >yz  <= z
> >za   > z
> >
> >SOOOOOOOOOOOOOOOOooooooooooo, the comparisons stop before we get to aaa
> >and so aaa is never reached. za is the last comparison to occur at which
> >point the test fails and the loop stops.
> >
> >Cheers,
> >Rob.
> 
> 
> Rob:
> 
> Okay, I tried to get out of it, but I guess more must be said.
> 
> I do understand why the loop stops -- I totally understand the mechanics. 
> After all this, how could I not? Besides, it's really not that difficult, is 
> it? So, what might you guess I'm really talking about?
> 
> You see, what is failing to be understood here is what I'm addressing, which 
> is basic set theory. One of the basic foundations for mathematics
> 
> If I have a set that is defined as all elements > "whatever" and < "something 
> else", then you can address the set. You can ask questions about the set, 
> such as what's the population of the set -- besides itself, does the set have 
> any subsets, and such -- get the idea?
> 
> Now, if you have a set [A] where all elements within are defined as ("a" or 
> greater) and (less than "z") -- then, believe or not, that set is infinite -- 
> as is the set for everything > "z".
> 
> If you choose, which is the case here, to consider only a subset of [A], then 
> that's fine -- but understand that when you say the sequence is --
> 
> a b c ... x y z aa ab ac ... yx yy yz za zb zc ... zy zx zz aaa aab
> 
> -- it's not!
> 
> But rather, the actual sequence is:
> 
> a b c ... x y z aa ab ac ... yx yy yz aaa aab aac... <infinite> z
> 
> You simply have chosen to arbitrarily end the sequence at "yz". That's the 
> reason why "aaa" is less than "z" but not included in the "php-loop" set of 
> (for i=a to z).
> 
> You can't say that "a" and "aaa" are members of a set identified as < "z" and 
> then step through all the members of that population (an infinite group) and 
> not include "aaa" -- UNLESS -- you arbitrarily determine an end point for a 
> much smaller sub-set.
> 
> Now, unless, there is something that I don't see, which certainly could be 
> the case, then php designers could have just as easily ended the loop at "z" 
> and dispensed with this quirk all together.
> 
> Besides, what's the point of having 676 character between a and z? Is there 
> one? I think the "accepted" number would be closer to 26, don't you think? It 
> just seems more like common sense to me -- doesn't it to you?
> 
> But this is the way it is and I except that -- but as Dirty Harry once said 
> "A man's got to know his limitations" -- this not only applies to men and 
> programmers, but also for languages as well.
> 
> For example, the Unicode issue was raised during this discussion -- if php 
> doesn't consider the numeric relationship of characters, then I see a big 
> problem waiting in the wings. Because if we're having these types of 
> discussions with just considering 00-7F characters, then I can only guess at 
> what's going to happen when we start considering 000000-FFFFFF code-points.
> 
> Now, was that enough said?  :-)

ABSOLUTELY NOT! *bahahahahah*

You gotta stop smoking the ganja Tedd, it's slowing your synapses.

No there are not 676 character combinations less than z. There are an
infinite number. a, aa, aaa, aaaa, aaaaa, aaaaa, ... ab, aab, aaab,
aaaab, ..., <INFINITE>. You are incrementing, this follows rules of
incrementation and so incrementing +1 at a time as defined for strings
in PHP causes you to only see 676 of the combinations less than z. It's
like having 1.0 and incrementing it .5 each time, and saying WTF, why
are there only 19 entries less than or equal to 10? There aren't, there
are an infinite number of values between 1.0 and 10 but we the rule sof
incrementation in this case skip past them.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
At 8:18 PM -0500 6/5/06, Larry Garfield wrote:
>See how the comparison works?  It's a purely alphabetic comparison.
>
>As for the increment, it actually would never have occurred to me to ++ a
>string before this thread, honestly. :-)  However, what it appears to be
>doing (and I'm sure Rasmus will correct me if I'm wrong) is using a "string
>base" instead of a numeric base.  Thus a++ = b, b++=c, etc.  z++ "rolls over"
>to the next "digit" (which because it's a string goes to the right rather
>than the left), and resets.  So just as 9++ rolls over to 10, z rolls over to
>aa.
>
>Does that make more sense?

Maybe to you, but not me.

In my book, you can't add a positive value to z and produce something that is 
less than z.

For example, "aa" is not greater than "z" -- is it?

Besides, what "value" are we adding? There is no incremental "character" in 
strings and adding two characters doesn't evaluate to anything.

In my last post I showed an "actual sequence" which is debatable. It could be 
interpreted that the infinite set starts at "a, aa, aaa,... " and never reaches 
"b". Oddly enough, this could be viewed in all sorts of ways. It's probably 
best if we don't look at characters as numbers.

tedd
-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
2006/6/5, Larry Garfield <[EMAIL PROTECTED]>:

On Monday 05 June 2006 14:56, Martin Alterisio wrote:
> 2006/6/5, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> > This is just one of those cases where the designers had to make a
> > judgement call on how things were going to operate.  It makes sense if
> > you look at the two things separately (incrementing vs string
'greatness'
> > evaluation) and makes sense that how they chose to implement the
> > functions are two valid choices among many ways that it could have
been
> > handled.
>
> How does it make sense? I don't understand your argument, can you
explain
> it a little bit more?

See Robert Cummings' post.  < and > are being interpreted in this case for
alphabetical order.  Read "<" as "alphabetically before", and <=
as "alphabetically before or string-equal to".

Is a alphabetically before or string-equal to z?  TRUE.
Is b alphabetically before or string-equal to z?  TRUE.
...
Is z alphabetically before or string-equal to z?  TRUE. (string-equal)
Is aa alphabetically before or string-equal to z?  TRUE. (a < z
alphabetically, the second character is never checked).
Is ab alphabetically before or string-equal to z?  TRUE.
...
Is yz alphabetically before or string-equal to z?  TRUE.
Is za alphabetically before or string-equal to z?  FALSE.  (a
alphabetically
after NULL character.  Bob is alphabetically before Bobby for the same
reason.)

See how the comparison works?  It's a purely alphabetic comparison.

As for the increment, it actually would never have occurred to me to ++ a
string before this thread, honestly. :-)  However, what it appears to be
doing (and I'm sure Rasmus will correct me if I'm wrong) is using a
"string
base" instead of a numeric base.  Thus a++ = b, b++=c, etc.  z++ "rolls
over"
to the next "digit" (which because it's a string goes to the right rather
than the left), and resets.  So just as 9++ rolls over to 10, z rolls over
to
aa.

Does that make more sense?


You misunderstood me, I completely understand how the operators function,
but you're saying it makes sense the way their functionality is assigned,
what I want to know is the reasons you have that support those affirmations.
I completely understand that string comparison is done alphabetically, but
how does having the functionality for the ++ operator create a sequence that
are inconsistent with the comparison operator, makes sense?

--- End Message ---
--- Begin Message ---
On Mon, 2006-06-05 at 22:00, tedd wrote:
> At 8:18 PM -0500 6/5/06, Larry Garfield wrote:
> >See how the comparison works?  It's a purely alphabetic comparison.
> >
> >As for the increment, it actually would never have occurred to me to ++ a
> >string before this thread, honestly. :-)  However, what it appears to be
> >doing (and I'm sure Rasmus will correct me if I'm wrong) is using a "string
> >base" instead of a numeric base.  Thus a++ = b, b++=c, etc.  z++ "rolls over"
> >to the next "digit" (which because it's a string goes to the right rather
> >than the left), and resets.  So just as 9++ rolls over to 10, z rolls over to
> >aa.
> >
> >Does that make more sense?
> 
> Maybe to you, but not me.
> 
> In my book, you can't add a positive value to z and produce something that is 
> less than z.
> 
> For example, "aa" is not greater than "z" -- is it?

If I remember my abstract algebra correctly, the modulus operator forms
a set for any given value right operand. Interestingly then taking the
set of x%10 we find that adding 1 to x when x is 9 is indeed less than
9.

I'm sure I could summarize this better if I could remember my abstract
algebra and spaces *lol*. I remember vaguely proving spaces and stuff
based on various properties.

Either way the above exmaple gives a simple case where your assertion
also fails, and this is in the world of general mathematics.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Monday 05 June 2006 21:12, Martin Alterisio wrote:

> > As for the increment, it actually would never have occurred to me to ++ a
> > string before this thread, honestly. :-)  However, what it appears to be
> > doing (and I'm sure Rasmus will correct me if I'm wrong) is using a
> > "string
> > base" instead of a numeric base.  Thus a++ = b, b++=c, etc.  z++ "rolls
> > over"
> > to the next "digit" (which because it's a string goes to the right rather
> > than the left), and resets.  So just as 9++ rolls over to 10, z rolls
> > over to
> > aa.
> >
> > Does that make more sense?
>
> You misunderstood me, I completely understand how the operators function,
> but you're saying it makes sense the way their functionality is assigned,
> what I want to know is the reasons you have that support those
> affirmations. I completely understand that string comparison is done
> alphabetically, but how does having the functionality for the ++ operator
> create a sequence that are inconsistent with the comparison operator, makes
> sense?

Because defining ++ and < and > in such a way as to make them "behave like 
numbers" would have made them not work for alphabetizing.  A string is a 
string, and comparison of strings is alphabetic (for some definition of 
alphabet).  It's more useful to deal with strings as strings than to make 
them quack like numbers.

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
2006/6/6, Larry Garfield <[EMAIL PROTECTED]>:

On Monday 05 June 2006 21:12, Martin Alterisio wrote:

> > As for the increment, it actually would never have occurred to me to
++ a
> > string before this thread, honestly. :-)  However, what it appears to
be
> > doing (and I'm sure Rasmus will correct me if I'm wrong) is using a
> > "string
> > base" instead of a numeric base.  Thus a++ = b, b++=c, etc.  z++
"rolls
> > over"
> > to the next "digit" (which because it's a string goes to the right
rather
> > than the left), and resets.  So just as 9++ rolls over to 10, z rolls
> > over to
> > aa.
> >
> > Does that make more sense?
>
> You misunderstood me, I completely understand how the operators
function,
> but you're saying it makes sense the way their functionality is
assigned,
> what I want to know is the reasons you have that support those
> affirmations. I completely understand that string comparison is done
> alphabetically, but how does having the functionality for the ++
operator
> create a sequence that are inconsistent with the comparison operator,
makes
> sense?

Because defining ++ and < and > in such a way as to make them "behave like
numbers" would have made them not work for alphabetizing.  A string is a
string, and comparison of strings is alphabetic (for some definition of
alphabet).  It's more useful to deal with strings as strings than to make
them quack like numbers.


Then, if it's not a math operation, why use a math operator for such
functionality? In which way is the ++ operator that generates a string
sequence, useful enough to justify the formal inconsistency between the math
operators? I still don't see the advantages of having the ++ recognize the
string as a sequence, and generate the next item in the sequence. I believe
those decisions should be left to the coder, because he knows what the
string really represents and which kind of sequence is being used.

--- End Message ---
--- Begin Message ---
On Sat, June 3, 2006 6:47 pm, Labunski wrote:
> What should I change in .htaccess, so that visitors will see index.abc
> instead of index.php.
> I just wanna hide file's extension.

Assuming you use PHP as Module and not CGI:

<Files index.abc>
  ForceType application/x-httpd-php
</Files>

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Fri, June 2, 2006 12:27 pm, Rodrigo de Oliveira Costa wrote:
> Can I do the below to an URL, like retrieving the output of a site and
> store it on a variable?

<?php echo file_get_contents('http://php.net/'); ?>

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Fri, June 2, 2006 8:32 am, Jonas Rosling wrote:
> is there any easy why to check if a value is odd or not?

$parity = $variable % 2 ? 'even' : 'odd';
echo "$variable is $parity<br />\n";

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Fri, June 2, 2006 8:32 am, Jonas Rosling wrote:
is there any easy why to check if a value is odd or not?

$parity = $variable % 2 ? 'even' : 'odd';
echo "$variable is $parity<br />\n";


Let's make it even more compact and confusing :)

echo "$variable is ".($variable % 2 ?'even':'odd')."<br />\n";

I'm not sure if you can nuke the whitespace in the modulus area or not.

Regards, Adam Zey.

--- End Message ---
--- Begin Message ---
Thanks guys, I knew it was a stupid Q when I sent it, but I had another
one where I encapsulated them in () blow up on me, so I figured if I
asked and it was the same answer then I was on the right track.

And so far all the tests have shown positive.  :)

Wolf


> More of a MySQL question, but easily enough answered;
> 
> Always group the OR with parenthese and the AND individually. Write the
> query and test with MySQL before placing into PHP code;
> 
> SELECT * FROM `table`
> WHERE (`foo` = 'bar' 
>    OR `foo` = 'glorp'
>    OR `sqirk` = 'glorp')
> AND `today` = CURDATE()
> AND `userID` = 'Marvin'
> 

--- End Message ---
--- Begin Message ---
On Fri, June 2, 2006 12:59 am, Matthew Pegg wrote:
> Working on a PHP script at the moment where I want to be able to
> extract a file (PDF file) from a mysql database\

That's bad.  Read the archives.

> and force the popup
> of the File Download dialog, to allow the user to either save or open
> the document (ie. and bypass loading the file using the browser's
> plugin)

<?php
  header("Content-type: application/octet-stream");
  echo $pdf;
?>

Any browser that does't do a download prompt for that is severely broken.

Forget the content-disposition crap.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Thu, June 1, 2006 6:46 pm, Richard Luckhurst wrote:
> Hi All
>
> I am in the process of cleaning up an application that was left half
> finished. I
> am fairly new to PHP so I am seeking the wisdom of the community to
> help with a
> little problem.
>
> In many cases I need to build command strings to be sent to a backend
> system.
> The strings have to contain a couple of non ascii characters.
>
> I have no problem with the following in a script
>
> $RM="\xFF";

$RM = chr(0xFF);

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Does some well-known problem exist with the session variables in Windows 
servers?
Because in a system that I have running on a Windows server, sometimes the 
session variables are null causing errors, then I close the browser and open 
it and in the next intent everything works well... I can't understand why...
The same system in a Linux server runs well always ¿?

Ahead of time, thank you very much,

Tom. 

--- End Message ---
--- Begin Message ---
Hi guys I have the following intention and would really like to know
if tis possible and if its possible how should it be done.

I have a string that is something like this:


"<INPUT TYPE=BUTTON Value='&nbsp;&nbsp;&#171;&nbsp;&nbsp;'
onClick="self.location='/s/979216/22/'"><SELECT title='chapter
navigation' Name=chapter onChange="self.location = '/s/979216/'+
this.options[this.selectedIndex].value + '/';"><option  value=1 >1.
Prologue<option  value=2 >2. First days<option  value=3 >3. Drastic
choice<option  value=4 >4. Sowarocs<option  value=5 >5.
Training<option  value=6 >6. Teneb</select>"


How can I retrieve the Values and assign it to a variable, and next
retrieve the name and assign it to another variable and so on...

I'd like to get something like:
1
1. Prologue
2
2. First days
3
3. Drastic choice
4
4. Sowarocs
5
5. Training
6
6. Teneb

and eacch of these should be in a variable, remembering that the
number of variables is dynamic so it can be only one or 100.

Thanks guys,
Rodrigo

--- End Message ---
--- Begin Message ---
Rodrigo de Oliveira Costa wrote:
Hi guys I have the following intention and would really like to know
if tis possible and if its possible how should it be done.

I have a string that is something like this:


"<INPUT TYPE=BUTTON Value='&nbsp;&nbsp;&#171;&nbsp;&nbsp;'
onClick="self.location='/s/979216/22/'"><SELECT title='chapter
navigation' Name=chapter onChange="self.location = '/s/979216/'+
this.options[this.selectedIndex].value + '/';"><option  value=1 >1.
Prologue<option  value=2 >2. First days<option  value=3 >3. Drastic
choice<option  value=4 >4. Sowarocs<option  value=5 >5.
Training<option  value=6 >6. Teneb</select>"


How can I retrieve the Values and assign it to a variable, and next
retrieve the name and assign it to another variable and so on...

Didn't you ask this a few days ago?

I gave you an answer:

http://marc.theaimsgroup.com/?l=php-general&m=114923129030154&w=2

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---

Reply via email to