php-general Digest 19 Feb 2006 09:39:34 -0000 Issue 3972
Topics (messages 230700 through 230714):
Distribution of records
230700 by: Alan Milnes
regular pattern to match åäö
230701 by: Patrick
230703 by: Manuel Lemos
230708 by: Rafael
regular pattern to match swedish characters
230702 by: Patrick
Re: regular pattern to match XXX
230704 by: Satyam
Re: Retrieve the Http Host from the Http Header
230705 by: Cristian MARIN
Re: "isset" or "array_key_exists"?
230706 by: Robert Cummings
Re: Recursive permissions
230707 by: tedd
230713 by: Kim Christensen
ignore this test
230709 by: 2dogs
Handling of lengthy server operation in php
230710 by: Adrian
230711 by: Manuel Lemos
PHP/LDAP Authentication
230712 by: Golden Butler
230714 by: Kim Christensen
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:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Hi Guys,
I'm looking for some help in buiding up the right queries / code for
this. I have a database that tracks all the plays of my Football Team.
Here are the relevant Fields:-
Formation
OCall
DCall
OYards
Key
The key is an amalgam of the first 3 fields so a typical record might
look like this:-
Formation - I
OCall - RT
DCall - BZ
OYards - 5
Key - IRTBZ
What I want to do is to produce report that looks like this:-
Form
OCall
DCall
OYards - Median
OYards - Mean
OYards < 0
OYards 0 - 4
OYards 5+
So in other words for every combination of Formation, OCall and DCall I
want to report how many times it occured, what the Median and Mean
values were and what the distribution of plays was.
I reckon I'm going to have to create an array and then loop over the
array pulling out the relevant information but are there any special
techniques I should consider?
Thanks
Alan
--- End Message ---
--- Begin Message ---
im trying to get my regular pattern to allow åäöÅÄÖ but it refuses to,
i have something like this:
[^a-zA-ZåäöÅÄÖ0-9-_ ]
But this dosent seem to work, anyone got any ideas?
--- End Message ---
--- Begin Message ---
Hello,
on 02/18/2006 07:42 PM Patrick said the following:
> im trying to get my regular pattern to allow åäöÅÄÖ but it refuses to,
> i have something like this:
>
> [^a-zA-ZåäöÅÄÖ0-9-_ ]
>
> But this dosent seem to work, anyone got any ideas?
It seems your message is in Windows-1252 encoding. Make sure you are not
using an encoding in your PHP source code editor that is different from
the encoding of your input data.
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
Just a couple of questions/points to make all clear:
a) are you aware that the "^" at the beggining inverts its meaning?
b) if you want to allow (or "not fail with") "-", put it as the fist
(or last?) character of the class, since it is used to define
ranges, and this avoids misinterpreting its meaning
c) what regex family functions are you using and what would be the
complete expression?
Patrick wrote:
im trying to get my regular pattern to allow åäöÅÄÖ but it refuses to,
i have something like this:
[^a-zA-ZåäöÅÄÖ0-9-_ ]
But this dosent seem to work, anyone got any ideas?
--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
[EMAIL PROTECTED]
http://www.innox.com.mx
--- End Message ---
--- Begin Message ---
im trying to get my regular pattern to allow åäöÅÄÖ but it refuses to,
i have something like this:
[^a-zA-ZåäöÅÄÖ0-9-_ ]
But this dosent seem to work, anyone got any ideas?
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Patrick" <[EMAIL PROTECTED]>
im trying to get my regular pattern to allow åäöÅÄÖ but it refuses to,
i have something like this:
[^a-zA-ZåäöÅÄÖ0-9-_ ]
But this dosent seem to work, anyone got any ideas?
Just an idea, try putting a backslash before the non-ASCII characters,
perhaps that will force the function to take them literally instead of
making who knows what assumption about them. And let me know if it works
because we use diacritical marks in Spanish, who know when I might need it.
Satyam
--- End Message ---
--- Begin Message ---
To know what exactly URL was asked use this:
'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING']
However when a rewritten URL was used with mod_rewrite Apache module my
code above will simply show you the transformed URL. The real requested
URL in this situation is located into a different location:
$_SERVER['REDIRECT_URL']
Regards,
Cristian MARIN
-------------------------------------
Developer Designer Division
[EMAIL PROTECTED]
http://www.interaktonline.com/
Ministério Público wrote:
I need a way to retrieve the URL typed by anyone visiting the website, so
that I can rerout them to the apropriate folder, does anyone know how to do
this?
I got a message saying that I should use the phpinfo and use the variables
that are given as response, but the problem is that the variable that is
usefull is the HTTP HEADER HOST and I dont know how to retrieve it. I thank
anyone who can help.
Rodrigo
--- End Message ---
--- Begin Message ---
On Sat, 2006-02-18 at 12:39, Rafael wrote:
> Actually, it doesn't have much sense that it creates a variable (or
> index), though it had sense why wouldn't be so easily detected, so I
> printed the array after the loops and there's no new keys. I think that
> if that was the case, it was definitely a bug that has been corrected
> (PHP 4.4.0)
> *Note: I guess that's because isset() is not a function, but a keyword
>
> That was very ilustrative Rob, thanks for the info (it's the kind of
> thing I shouldn't forget)
>
> Satyam wrote:
> [···]
> >> isset is a keyword in PHP
> >> array_key_exists() is a function.
> >>
> >> Keywords are much faster than functions due tot he overhead functions
> >> occur for setting up the stack.
> >>
> >> If you don't care about null values, use isset(). If you do, use
> >> array_key_exists().
> >>
> >> The reason isset() doesn't return true for null entries has been
> >> described in the past. The official stance was that null is not a value.
> >>
> [···]
> >
> > Accessing a non-existing element, doesn't create it? Thus, using isset
> > to evaluate whether an element exists creates it, though with a null
> > value. If you make a first pass on the array with isset, a second pass
> > with array_key_exists would give true for all of them though isset would
> > give the same results as in the first pass. I think this happened to me
> > once when I went through an array with isset or isempty or some such to
> > make some calculations and then on the second pass, when I printed it, I
> > got lots of empty cells that were created empty in the first pass.
For the curious:
<?php
function myempty( &$value )
{
if( empty( $value ) )
{
return true;
}
return false;
}
$foo = array( 1 => 1 );
if( isset( $foo[2] ) )
{
echo 'WTF! :)';
}
print_r( $foo );
if( !empty( $foo[2] ) )
{
echo 'WTF! :)';
}
print_r( $foo );
if( !myempty( $foo[2] ) )
{
echo 'WTF! :)';
}
print_r( $foo );
?>
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 2/18/06, tedd <[EMAIL PROTECTED]> wrote:
Hi gang:
Question: I know you can set a directory to have certain permissions,
but how do you set the permissions to be recursive? In other words,
for example, if you set the directory to be 755, then everything
placed within that directory will also be 755.
http://php.net/manual/en/function.umask.php
--
Kim Christensen
Kim:
Thanks, but are you sure about that?
That looks like a function that simply takes the old permission
settings and stores them until you're finished setting new
permissions to a file/directory and then you can safely restore the
old permissions to what they were.
What I'm looking for is how to set the permissions for a directory
such that all files in it will have the same permissions.
I use GoLive and in their file "FTP access" settings they have a
recursive checkbox. If the checkbox is not checked, then whatever
permission setting I give to a directory is just to the directory.
However, if it the recursive checkbox is checked, then all files
placed in the directory will have the directory's permissions.
Perhaps this is something limited to GoLive and not an option in
setting chmod's via php's built-in functions.
I am aware of how to change the contents of a directory to a specific
chmod using a recursive php routine, but I was looking for a simpler
way.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com/
--- End Message ---
--- Begin Message ---
On 2/19/06, tedd <[EMAIL PROTECTED]> wrote:
> Perhaps this is something limited to GoLive and not an option in
> setting chmod's via php's built-in functions.
This is clearly depending on the host OS/ftp daemon and what
permission is set on the upload folder. What GoLive! probably does
with that checkbox is setting permissions through chmod on the ftp
"automagically" after each file has been uploaded.
Do you have shell access to the particular host?
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
just testing my news connection
--- End Message ---
--- Begin Message ---
Hi everybody,
I have been trying to find a solution to this issue on other newsgroups but
haven't had any luck so far.
My config: Apache 2.0.54, PHP 5.1.2 on Win XP (or 2003).
Here is the outline of my application:
The user submits a form to the server, which is then processed by a php
script. This script calls exec to start a Win32 console which passes some
information to a Windows process, and then returns, thus allowing the php
script to continue. In the meantime, the service keeps working. When it's
done, it creates a file to signal that new data is available. The php script
sees this file, picks up the data and sends it to the user.
Everytbing works if all this happens synchronously, meaning the php script
waits for the windows service to finish before doing anything else. But this
means that the user doesn't see any feedback as to the status of the
operation (and it can be quite lenghty), and it can't cancel it either. So
in order to increase useability, I need the server needs to be able to
perform some concurrent tasks:
1. monitor the status of the Windows service processing
2. provide user feedback about its status
3. listen for user commands, such as cancel, or back, in order to cancel the
current processing
I tried various ideas, using header( ... ) to start other scripts etc, but
so far nothing worked - things always happen synchronously (start
processing, wait for it to finish, show result) which is not what a user
would expect. Also, I would prefer to do everything on the server instead of
using js for example in the browser.
Any help would be really appreciated.
Thanks,
Adrian
--- End Message ---
--- Begin Message ---
Hello,
on 02/19/2006 02:00 AM Adrian said the following:
> I tried various ideas, using header( ... ) to start other scripts etc, but
> so far nothing worked - things always happen synchronously (start
> processing, wait for it to finish, show result) which is not what a user
> would expect. Also, I would prefer to do everything on the server instead of
> using js for example in the browser.
What you can do is something usually known as job queuing. It consists
of having a queue, which can be a file on the disk or a database table.
To queue a job, you just add a new record to that job table. Then have a
background process handle it ASAP, and update its status as it
progresses. When the job is marked as done, the requester can delete its
record, while the background task proceeds to the next enqueued job.
Here you may read more about this concept of queueing:
http://www.meta-language.net/metabase-faq.html#performance
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
I'm currently running OpenLDAP with some users populated in the
database. I would like to use PHP to create a web page where my ldap
users can enter their username and password credentials to log into our
intranet. Can someone point me to some expample scripts, articles, or
sites. Thanks.
- Delamatrix
--- End Message ---
--- Begin Message ---
On 2/19/06, Golden Butler <[EMAIL PROTECTED]> wrote:
> I'm currently running OpenLDAP with some users populated in the
> database. I would like to use PHP to create a web page where my ldap
> users can enter their username and password credentials to log into our
> intranet. Can someone point me to some expample scripts, articles, or
> sites. Thanks.
http://php.net/ldap
As always, read the docs and check the user comments. You won't need
any more examples :-)
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---