php-general Digest 14 Apr 2010 17:20:34 -0000 Issue 6692
Topics (messages 304079 through 304097):
Re: Array differences
304079 by: Rene Veerman
304083 by: Ashley Sheridan
304085 by: Nathan Rixham
304086 by: Rene Veerman
304087 by: Ashley M. Kirchner
304088 by: Ryan Sun
304089 by: Ashley M. Kirchner
304092 by: lala
304093 by: Ashley M. Kirchner
304097 by: tedd
problems with feature '--with-pdo-oci' RPM (spec)
304080 by: Raul da Silva {Sp4wn}
Re: Saving form data into session before leaving a page
304081 by: Lester Caine
304082 by: Ashley Sheridan
Re: would there be an interest in having htmlMicroscope include dygraphs?
304084 by: Nathan Rixham
How to achieve mixed authentication/anonymous access
304090 by: Dirk Thomas / 4wd media
Re: Basic switch statement
304091 by: tedd
304094 by: tedd
304095 by: Robert Cummings
304096 by: tedd
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On Wed, Apr 14, 2010 at 7:01 AM, Ashley M. Kirchner <ash...@pcraft.com> wrote:
> I have the following scenario:
>
>
>
> $array1 = array("12", "34", "56", "78", "90");
>
> $array2 = array("12", "23", "56", "78", "89");
>
>
>
> $result = array_diff($array1, $array2);
>
>
>
> print_r($result);
>
>
>
>
>
> This returns:
>
>
>
> Array
>
> (
>
> [1] => 34
>
> [4] => 90
>
> )
>
>
>
>
>
> However what I really want is a two-way comparison. I want elements that
> don't exist in either to be returned:
>
>
>
> 34 and 90 because they don't exist in $array2, AND 23 and 89 because they
> don't exist in $array1. So, is that a two step process of first doing an
> array_diff($array1, $array2) then reverse it by doing array_diff($array2,
> $array1) and merge/unique the results? Any caveats with that?
>
>
>
> $array1 = array("12", "34", "56", "78", "90");
>
> $array2 = array("12", "23", "56", "78", "89");
>
>
>
> $diff1 = array_diff($array1, $array2);
>
> $diff2 = array_diff($array2, $array1);
>
>
>
> $result = array_unique(array_merge($diff1, $diff2));
>
>
>
> print_r($result);
>
>
>
>
>
> -- A
>
>
ok, adding this to the todo-list for htmlMicroscope... ETA on delivery
of 1.3.0-final: about 2 to 3 months i'm afraid.
Gotta get a new laundromat for my home too and stuff like that :)
--
---------------------------------
Greetings from Rene7705,
I have made some free open source webcomponents designed
and written by me available through:
http://code.google.com/u/rene7705/ , or
http://mediabeez.ws (latest dev versions, currently offline)
Personal info about me is available through http://www.facebook.com/rene7705
---------------------------------
--- End Message ---
--- Begin Message ---
On Tue, 2010-04-13 at 23:01 -0600, Ashley M. Kirchner wrote:
> I have the following scenario:
>
>
>
> $array1 = array("12", "34", "56", "78", "90");
>
> $array2 = array("12", "23", "56", "78", "89");
>
>
>
> $result = array_diff($array1, $array2);
>
>
>
> print_r($result);
>
>
>
>
>
> This returns:
>
>
>
> Array
>
> (
>
> [1] => 34
>
> [4] => 90
>
> )
>
>
>
>
>
> However what I really want is a two-way comparison. I want elements that
> don't exist in either to be returned:
>
>
>
> 34 and 90 because they don't exist in $array2, AND 23 and 89 because they
> don't exist in $array1. So, is that a two step process of first doing an
> array_diff($array1, $array2) then reverse it by doing array_diff($array2,
> $array1) and merge/unique the results? Any caveats with that?
>
>
>
> $array1 = array("12", "34", "56", "78", "90");
>
> $array2 = array("12", "23", "56", "78", "89");
>
>
>
> $diff1 = array_diff($array1, $array2);
>
> $diff2 = array_diff($array2, $array1);
>
>
>
> $result = array_unique(array_merge($diff1, $diff2));
>
>
>
> print_r($result);
>
>
>
>
>
> -- A
>
I don't see any problems with doing it that way. This will only work as
you intended if both arrays have the same number of elements I believe,
otherwise you might end up with a situation where your final array has
duplicates of the same number:
$array1 = $array(1, 2, 3, 4, 5, 6);
$array2 = $aray(1, 3, 2, 5);
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> On Tue, 2010-04-13 at 23:01 -0600, Ashley M. Kirchner wrote:
>>
>> However what I really want is a two-way comparison. I want elements that
>> don't exist in either to be returned:
>>
>
>
> I don't see any problems with doing it that way.
By some freak chance I made an array diff class about 2 weeks ago which
covers what you need. attached :)
usage:
$diff = new ArrayDiff( $old , $new );
$diff->l; // deleted items
$diff->r; // inserted items
$diff->u; // unchanged items
The script is optimised for huge arrays, thus it's slower for small
arrays than the usual array_diff but with large arrays it's quicker.
Regards
Nathan
--- End Message ---
--- Begin Message ---
On Wed, Apr 14, 2010 at 12:03 PM, Nathan Rixham <nrix...@gmail.com> wrote:
> Ashley Sheridan wrote:
>> On Tue, 2010-04-13 at 23:01 -0600, Ashley M. Kirchner wrote:
>>>
>>> However what I really want is a two-way comparison. I want elements that
>>> don't exist in either to be returned:
>>>
>>
>>
>> I don't see any problems with doing it that way.
>
> By some freak chance I made an array diff class about 2 weeks ago which
> covers what you need. attached :)
>
> usage:
>
> $diff = new ArrayDiff( $old , $new );
> $diff->l; // deleted items
> $diff->r; // inserted items
> $diff->u; // unchanged items
>
> The script is optimised for huge arrays, thus it's slower for small
> arrays than the usual array_diff but with large arrays it's quicker.
>
> Regards
>
> Nathan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
nice one :) i'll put it in a work-preperation folder for
htmlMicroscope then, one of these days :)
--
---------------------------------
Greetings from Rene7705,
I have made some free open source webcomponents designed
and written by me available through:
http://code.google.com/u/rene7705/ , or
http://mediabeez.ws (latest dev versions, currently offline)
Personal info about me is available through http://www.facebook.com/rene7705
---------------------------------
--- End Message ---
--- Begin Message ---
On 4/14/2010 2:39 AM, Ashley Sheridan wrote:
On Tue, 2010-04-13 at 23:01 -0600, Ashley M. Kirchner wrote:
$array1 = array("12", "34", "56", "78", "90");
$array2 = array("12", "23", "56", "78", "89");
$diff1 = array_diff($array1, $array2);
$diff2 = array_diff($array2, $array1);
$result = array_unique(array_merge($diff1, $diff2));
print_r($result);
I don't see any problems with doing it that way. This will only work
as you intended if both arrays have the same number of elements I
believe, otherwise you might end up with a situation where your final
array has duplicates of the same number:
$array1 = $array(1, 2, 3, 4, 5, 6);
$array2 = $aray(1, 3, 2, 5);
Wouldn't array_unique() take care of that though? Your example
above returns 4 and 6, which would be correct.
A
--- End Message ---
--- Begin Message ---
Maybe this one works?
array_diff(array_unique($array1 + $array2), array_intersect($array1, $array2))
On Wed, Apr 14, 2010 at 4:39 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> On Tue, 2010-04-13 at 23:01 -0600, Ashley M. Kirchner wrote:
>
>> I have the following scenario:
>>
>>
>>
>> $array1 = array("12", "34", "56", "78", "90");
>>
>> $array2 = array("12", "23", "56", "78", "89");
>>
>>
>>
>> $result = array_diff($array1, $array2);
>>
>>
>>
>> print_r($result);
>>
>>
>>
>>
>>
>> This returns:
>>
>>
>>
>> Array
>>
>> (
>>
>> [1] => 34
>>
>> [4] => 90
>>
>> )
>>
>>
>>
>>
>>
>> However what I really want is a two-way comparison. I want elements that
>> don't exist in either to be returned:
>>
>>
>>
>> 34 and 90 because they don't exist in $array2, AND 23 and 89 because they
>> don't exist in $array1. So, is that a two step process of first doing an
>> array_diff($array1, $array2) then reverse it by doing array_diff($array2,
>> $array1) and merge/unique the results? Any caveats with that?
>>
>>
>>
>> $array1 = array("12", "34", "56", "78", "90");
>>
>> $array2 = array("12", "23", "56", "78", "89");
>>
>>
>>
>> $diff1 = array_diff($array1, $array2);
>>
>> $diff2 = array_diff($array2, $array1);
>>
>>
>>
>> $result = array_unique(array_merge($diff1, $diff2));
>>
>>
>>
>> print_r($result);
>>
>>
>>
>>
>>
>> -- A
>>
>
>
> I don't see any problems with doing it that way. This will only work as
> you intended if both arrays have the same number of elements I believe,
> otherwise you might end up with a situation where your final array has
> duplicates of the same number:
>
> $array1 = $array(1, 2, 3, 4, 5, 6);
> $array2 = $aray(1, 3, 2, 5);
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
--- End Message ---
--- Begin Message ---
No because that only does a one-way comparison. It only tells me what's
missing from $array2. I need it from both arrays. That's why I'm comparing
1 versus 2, then 2 versus 1, and then doing a merge/unique on the result.
$array1 = array(1, 2, 3, 4, 5, 6);
$array2 = array(1, 3, 2, 8, 9);
$result = array_diff(array_unique($array1 + $array2),
array_intersect($array1, $array2));
=> (4, 5, 6)
Versus:
$array1 = array(1, 2, 3, 4, 5, 6);
$array2 = array(1, 3, 2, 8, 9);
$diff1 = array_diff($array1, $array2);
$diff2 = array_diff($array2, $array1);
$result = array_unique(array_merge($diff1, $diff2));
=> (4, 5, 6, 8, 9)
This second $result is what I want. So far I haven't noticed any problems
doing it this way ... yet. I'm sure someone will tell me otherwise.
Ash
> -----Original Message-----
> From: Ryan Sun [mailto:ryansu...@gmail.com]
> Sent: Wednesday, April 14, 2010 8:45 AM
> To: a...@ashleysheridan.co.uk
> Cc: Ashley M. Kirchner; php-gene...@lists.php.net
> Subject: Re: [PHP] Array differences
>
> Maybe this one works?
> array_diff(array_unique($array1 + $array2), array_intersect($array1,
> $array2))
>
> On Wed, Apr 14, 2010 at 4:39 AM, Ashley Sheridan
> <a...@ashleysheridan.co.uk> wrote:
> > On Tue, 2010-04-13 at 23:01 -0600, Ashley M. Kirchner wrote:
> >
> >> I have the following scenario:
> >>
> >>
> >>
> >> $array1 = array("12", "34", "56", "78", "90");
> >>
> >> $array2 = array("12", "23", "56", "78", "89");
> >>
> >>
> >>
> >> $result = array_diff($array1, $array2);
> >>
> >>
> >>
> >> print_r($result);
> >>
> >>
> >>
> >>
> >>
> >> This returns:
> >>
> >>
> >>
> >> Array
> >>
> >> (
> >>
> >> [1] => 34
> >>
> >> [4] => 90
> >>
> >> )
> >>
> >>
> >>
> >>
> >>
> >> However what I really want is a two-way comparison. I want elements
> that
> >> don't exist in either to be returned:
> >>
> >>
> >>
> >> 34 and 90 because they don't exist in $array2, AND 23 and 89 because
> they
> >> don't exist in $array1. So, is that a two step process of first
> doing an
> >> array_diff($array1, $array2) then reverse it by doing
> array_diff($array2,
> >> $array1) and merge/unique the results? Any caveats with that?
> >>
> >>
> >>
> >> $array1 = array("12", "34", "56", "78", "90");
> >>
> >> $array2 = array("12", "23", "56", "78", "89");
> >>
> >>
> >>
> >> $diff1 = array_diff($array1, $array2);
> >>
> >> $diff2 = array_diff($array2, $array1);
> >>
> >>
> >>
> >> $result = array_unique(array_merge($diff1, $diff2));
> >>
> >>
> >>
> >> print_r($result);
> >>
> >>
> >>
> >>
> >>
> >> -- A
> >>
> >
> >
> > I don't see any problems with doing it that way. This will only work
> as
> > you intended if both arrays have the same number of elements I
> believe,
> > otherwise you might end up with a situation where your final array
> has
> > duplicates of the same number:
> >
> > $array1 = $array(1, 2, 3, 4, 5, 6);
> > $array2 = $aray(1, 3, 2, 5);
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
--- End Message ---
--- Begin Message ---
Ashley M. Kirchner wrote:
$array1 = array(1, 2, 3, 4, 5, 6);
$array2 = array(1, 3, 2, 8, 9);
$diff1 = array_diff($array1, $array2);
$diff2 = array_diff($array2, $array1);
$result = array_unique(array_merge($diff1, $diff2));
=> (4, 5, 6, 8, 9)
Hi Ash,
Isn't the array_unique() unnecessary?
Mike
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: lala [mailto:l...@mail.theorb.net]
> Sent: Wednesday, April 14, 2010 10:15 AM
> To: Ashley M. Kirchner
> Cc: php-gene...@lists.php.net
> Subject: Re: [PHP] Array differences
>
> Ashley M. Kirchner wrote:
> >
> > $array1 = array(1, 2, 3, 4, 5, 6);
> > $array2 = array(1, 3, 2, 8, 9);
> > $diff1 = array_diff($array1, $array2);
> > $diff2 = array_diff($array2, $array1);
> > $result = array_unique(array_merge($diff1, $diff2));
> >
> > => (4, 5, 6, 8, 9)
>
> Hi Ash,
>
> Isn't the array_unique() unnecessary?
>
> Mike
Thinking about it, it should be unnecessary, but at the same time I want to
absolutely sure that I get unique values out of the two diffs.
Ash
--- End Message ---
--- Begin Message ---
At 9:37 AM -0600 4/14/10, Ashley M. Kirchner wrote:
No because that only does a one-way comparison. It only tells me what's
missing from $array2. I need it from both arrays. That's why I'm comparing
1 versus 2, then 2 versus 1, and then doing a merge/unique on the result.
-snip-
$array1 = array(1, 2, 3, 4, 5, 6);
$array2 = array(1, 3, 2, 8, 9);
$diff1 = array_diff($array1, $array2);
$diff2 = array_diff($array2, $array1);
$result = array_unique(array_merge($diff1, $diff2));
=> (4, 5, 6, 8, 9)
This second $result is what I want. So far I haven't noticed any problems
doing it this way ... yet. I'm sure someone will tell me otherwise.
Ash
Ash:
Looks good to me. But note the indexes of the result.
You might want to:
$array1 = array(1, 2, 3, 4, 5, 6, 7, 7, 7, 7);
$array2 = array(1, 2, 3, 8, 9);
$diff1 = array_diff($array1, $array2);
$diff2 = array_diff($array2, $array1);
$diff1 = array_unique($diff1);
$diff2 = array_unique($diff2);
$result = array_merge($diff1, $diff2);
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hi,
Good morning for all,
I'd like to understand why when i try to install the package 'php52-pdo-oci'
generated by 'rpmbuild -ba php52.spec' with feature inside of file , doesn't
work and returns the follow error :
# rpm -qpl /usr/src/linux/RPMS/x86_64/php52-pdo-oci-5.2.12-2.fc11.x86_64.rpm
/etc/php.d/pdo_oci.ini
/usr/lib64/php/modules/pdo_oci.so
# rpm --test -ivh
/usr/src/redhat/RPMS/x86_64/php52-pdo-oci-5.2.12-2.fc11.x86_64.rpm
error: Failed dependencies:
libclntsh.so.10.1()(64bit) is needed by
php52-pdo-oci-5.2.12-2.fc11.x86_64
I checked this steps, its ok :
1)
# ls -l /usr/lib/oracle/10.2.0.4/client64/lib/libclntsh.so
lrwxrwxrwx 1 root root 17 2010-04-12 19:38 /usr/lib/oracle/
10.2.0.4/client64/lib/libclntsh.so -> libclntsh.so.10.1
2)
# ldconfig -p | grep libclntsh.so
libclntsh.so.10.1 (libc6,x86-64) => /usr/lib/oracle/
10.2.0.4/client64/lib/libclntsh.so.10.1
libclntsh.so (libc6,x86-64) => /usr/lib/oracle/
10.2.0.4/client64/lib/libclntsh.so
What is wrong ? , thanks for help
Att,
Raul
--- End Message ---
--- Begin Message ---
Nathan Rixham wrote:
Peter Lind wrote:
On 13 April 2010 17:27, Paul M Foster<pa...@quillandmouse.com> wrote:
On Tue, Apr 13, 2010 at 03:20:23PM +0200, Merlin Morgenstern wrote:
Hello everybody,
I have form where users enter data to be saved in a db.
How can I make php save the form data into a session before the user
leaves the page without pressing the submit button? Some members leave
the page and return afterwards wondering where their already entered
data is.
I hate to be a contrarian (not really), but there is a paradigm for
using web forms. If you want the internet to save your data, you have to
press the little button. If you don't, then it won't be saved. Not hard
to figure out, not hard to do. If you have to go do something else while
you're in the middle of a form, open a new tab/window and do it. When
you come back to your original form, the data will still be there (but
again, not *saved* until you hit the little button).
Sorry, I just get cranky with people who won't follow the rules.
There are rules and then there's stupidity based on tradition. The
fact that websites previously threw away whatever work you had done
because you automatically got logged out of your session after half an
hour of typing does not mean you should call this a rule that should
be adhere to. Google figured it out and did so well: backup
automatically and let the user discard manually - not the other way
round that leads to lost work.
Apart from that, I note that the OP has seemingly managed to solve the
problem and all these emails are rather pointless.
Concur, and this is nothing to do with the web; http only constrains
that the data should be POSTed or PUT; not /when/ a save action is
triggered.
Functionality is in the realm of the application, and if the client
application (in this case the web page) determines that information
should be iteratively saved, then that's what it should do.
see google docs, gmail etc for real world examples.
And a few BANK sites could do with considering waring people that they will time
out before you have time to actually write in their message box for on-line
emails which you have to use since they will not accept off-line ones. I had a
complex message FROM them to answer - and save just told me the seesion had
timed out! Bank solution - I should have copied their message to a word
processor, and then copied the answer back later ... perhaps they should add
that with a warning when trying to use their email page ;)
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
--- End Message ---
--- Begin Message ---
On Wed, 2010-04-14 at 06:49 +0100, Lester Caine wrote:
> Nathan Rixham wrote:
> > Peter Lind wrote:
> >> On 13 April 2010 17:27, Paul M Foster<pa...@quillandmouse.com> wrote:
> >>> On Tue, Apr 13, 2010 at 03:20:23PM +0200, Merlin Morgenstern wrote:
> >>>
> >>>> Hello everybody,
> >>>>
> >>>> I have form where users enter data to be saved in a db.
> >>>>
> >>>> How can I make php save the form data into a session before the user
> >>>> leaves the page without pressing the submit button? Some members leave
> >>>> the page and return afterwards wondering where their already entered
> >>>> data is.
> >>> I hate to be a contrarian (not really), but there is a paradigm for
> >>> using web forms. If you want the internet to save your data, you have to
> >>> press the little button. If you don't, then it won't be saved. Not hard
> >>> to figure out, not hard to do. If you have to go do something else while
> >>> you're in the middle of a form, open a new tab/window and do it. When
> >>> you come back to your original form, the data will still be there (but
> >>> again, not *saved* until you hit the little button).
> >>>
> >>> Sorry, I just get cranky with people who won't follow the rules.
> >>
> >> There are rules and then there's stupidity based on tradition. The
> >> fact that websites previously threw away whatever work you had done
> >> because you automatically got logged out of your session after half an
> >> hour of typing does not mean you should call this a rule that should
> >> be adhere to. Google figured it out and did so well: backup
> >> automatically and let the user discard manually - not the other way
> >> round that leads to lost work.
> >>
> >> Apart from that, I note that the OP has seemingly managed to solve the
> >> problem and all these emails are rather pointless.
> >
> > Concur, and this is nothing to do with the web; http only constrains
> > that the data should be POSTed or PUT; not /when/ a save action is
> > triggered.
> >
> > Functionality is in the realm of the application, and if the client
> > application (in this case the web page) determines that information
> > should be iteratively saved, then that's what it should do.
> >
> > see google docs, gmail etc for real world examples.
>
> And a few BANK sites could do with considering waring people that they will
> time
> out before you have time to actually write in their message box for on-line
> emails which you have to use since they will not accept off-line ones. I had
> a
> complex message FROM them to answer - and save just told me the seesion had
> timed out! Bank solution - I should have copied their message to a word
> processor, and then copied the answer back later ... perhaps they should add
> that with a warning when trying to use their email page ;)
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>
Banks are notorious for not knowing about technology. My bank has a
constant popup for Windows software that I 'must install' and has even
asked me before to send my bank details over unencrypted email (my
actual bank and not a phishing scam, as it was in reply to a question
about that darned popup!)
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Rene Veerman wrote:
>
> I would like to include http://www.danvk.org/dygraphs/ into htmlMicroscope.
> Would you think it usefull?
+1
> Yes, i am a bit worried about being seen as the weird psycho on this
> forum. Psychotic i'm not, just sleep-deprived a bit
1: if you you didn't bring personal life in to your mails then you
wouldn't have to worry, the quicker you stop mentioning it the sooner it
will be forgotten
2: most developers, perhaps take the approach of the rest of us and
simply get a bit ratty, make stupid typo's and ask questions about
things you already know (but forgot, because you are tired).
> My reasons for posting "[OFF-TOPIC] telepathy and psychiatery" to this
> list were simple; i was trying to alleviate the fears of other
> telepaths like me, to prevent _them_ from having to go through the
> hell of psychiateric closed wards...
Rene, Telepathic or not, it is of no concern to any body on the list,
just as we do not take it upon ourselves to inform you of the various
physical and mental problems affecting many of us on a daily basis -
some people on this list have *very* serious health problems, and we're
just lucky they are still with us.
In short, this list is a place where we discuss PHP, which is our tool
for work, our hobby, another thing to help drown out the difficulties of
life - embrace the code and let it see you through the hard times, keep
personal life; personal.
If you feel like replying Rene, quickly skip back to the top, notice the
+1 and get on making good use of your time with a good challenge and
some learning to boot.
We're all happy to help you with any (PHP or Code) issues you may have
along the way.
Regards!
--- End Message ---
--- Begin Message ---
Hi,
i have a problem with Authentification.
I currently doubt that it is possible at all.
Perhaps someone can enlighten me how to achive the goal or confirm that it is
not reachable.
The scenario is to achieve a mixed authentication/anonymous access similar as
described for Subversion (see
http://svnbook.red-bean.com/nightly/de/svn-book.html#svn.serverconfig.httpd.authz.perdir.ex-3).
Therefore the ".htaccess" looks something like that:
Order allow,deny
Allow from all
AuthType Basic
AuthName "Realm"
AuthUserFile "/some/path/.htusers"
require valid-user
Satisfy any
Additionally a PHP script is inside the same folder.
When you now browse to the URL of the PHP script, you can access it without any
credentials requested.
At some point the PHP script "decides" that authentification is required (e.g. when
passing a param like "?access-secret=1").
Therefore it sends the following two headers:
WWW-Authenticate: Basic realm="Realm"
HTTP/1.x 401 Unauthorized
Then you are asked to insert your username/password for the basic auth.
But now comes the problem:
How can the PHP script determine if you have provided valid credentials?
The server variables PHP_AUTH_USER and PHP_AUTH_PW are populated independent of
the result of the authentification defined in Apache.
I do explicitly not want to check the credentials in PHP - think of the many
different auth-methods which could be configured with Apache.
Nor can the anonymous and authenticated parts be split in separate folders.
Is this goal even possible or is the only way to not allow anonymous access (but for
replacement a dummy user like "guest" with no password) or implement the auth
in PHP?
Any feedback is highly appreciated.
Thank you
Dirk
--- End Message ---
--- Begin Message ---
At 10:04 PM +0100 4/13/10, Nathan Rixham wrote:
Robert Cummings wrote:
> Nathan Rixham wrote:
> Fail on that last one. -1 is not equivalent to FALSE :B
well that's one job I'm not getting :p
cheers for the picking that one up Rob
And that's the reason why I hate test like that!
The short tricky logic questions that interviewer's use to be clever
are just nonsense.
I'll take someone who can solve a problem over one who can argue
true/false logic tables every time. Not meaning that people who come
natural to that sort of logic solving ability do not make good
programmers (because they can -- like Rob), but rather people who
fail those types of logic questions do NOT also fail to be good
programmers (like me). It's similar to the Tortoise and Hare thing --
it really doesn't make any difference who gets there first for both
can run the distance.
I don't think those types of logic puzzles do much to measure
anything other than people's ability to solve logic puzzles. IMO,
it's interviewers "leap of faith" to think logic puzzles are a good
indicator of programming prowess. To many of us, programming is just
doing over until it works.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 5:06 PM -0400 4/13/10, Robert Cummings wrote:
Nathan Rixham wrote:
well that's one job I'm not getting :p
Well you DID get 66.7%. I've met "coders" that would stare at the
answer and still not understand :D
Cheers,
Rob.
Well.. count me among those staring. I just don't get those type of
things until I see them actually work.
My "logic" works the other way -- when presented with a logic
problem, I come up with a solution that works the way I think and I
always to solve the problem presented. Perhaps my solution isn't as
clever nor as cryptic as others, but it's always easier to read and
understand.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
tedd wrote:
At 5:06 PM -0400 4/13/10, Robert Cummings wrote:
Nathan Rixham wrote:
well that's one job I'm not getting :p
Well you DID get 66.7%. I've met "coders" that would stare at the
answer and still not understand :D
Cheers,
Rob.
Well.. count me among those staring. I just don't get those type of
things until I see them actually work.
My "logic" works the other way -- when presented with a logic
problem, I come up with a solution that works the way I think and I
always to solve the problem presented. Perhaps my solution isn't as
clever nor as cryptic as others, but it's always easier to read and
understand.
Maybe you haven't debugged enough "other people" code in your time as a
developer... there's a certain knack to weeding out logic failures :)
It also helps to use proper indentation and bracing format as
illustrated by all my code examples so that you can more easily see
where problems lie >:D
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
At 12:32 PM -0400 4/14/10, Robert Cummings wrote:
tedd wrote:
My "logic" works the other way -- when presented with a logic
problem, I come up with a solution that works the way I think and I
always to solve the problem presented. Perhaps my solution isn't as
clever nor as cryptic as others, but it's always easier to read and
understand.
Maybe you haven't debugged enough "other people" code in your time
as a developer... there's a certain knack to weeding out logic
failures :)
That could very well be. I don't usually debug other people's code
and seldom have clients want me to do so. I usually have clients who
present a problem and then I solve it -- thus, all original code.
Several yeas ago, I had one client who had considerable prior work
done and I found myself rewriting everything at a cost of many weeks
of my non-billable time. I won't be doing that again.
It also helps to use proper indentation and bracing format as
illustrated by all my code examples so that you can more easily see
where problems lie >:D
Cheers,
Rob.
Ain't that the truth!
We are almost identical in our formatting.
I've found that when I run into someone who has similar ideas as I
have, they are usually very intelligent. :-)
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---