[PHP] Re: [BULK] RE: [PHP] Re: [BULK] [PHP] Redirecting to a parent page

2007-06-13 Thread clive

Yamil Ortega wrote:

Ok, but what happens if I change server and there is no more apache2
directory?

Do I have to change all the headers in my 37 web pages?



do this:

// in a config file, or header file
$sitename = "http:/localhost/apache2/"; eader file

// whereever it is needed
header("Location: $sitename/file3.php");

You may also want to look at the object buffer and perhaps clear that 
before doing a redirect.


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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:
> On Tue, June 12, 2007 11:39 pm, Paul Scott wrote:
> It's a blog.
> 
> People type things.
> 

Not quite anymore...

I have added our set of filters to the output now, so that you can add
in bbcode tags as well as a number of other things, like youtube videos,
google maps, google videos timelines, mindmaps (freemind), personal data
etc etc.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] SimpleXMLElement->xpath() on php 5.1 - weird blocking problem

2007-06-13 Thread David CHANIAL
Hi (sorry for my bad english),

It's descibed at 
http://fr3.php.net/manual/en/function.simplexml-element-xpath.php that 
SimpleXMLElement->xpath() is avaiable on php-5.2.0 at least.

But, in fact, on one of my box with php-5.1.6-pl11-gentoo, libxml2-2.6.27, 
libxslt-1.1.17 xpath() is running...

But, and that it's my problem. On another box, with the SAME versions, xpath 
is rejected as an unexisting function...

Please help me.

Best regards,
-- 
David

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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 23:41 -0400, Guillaume Theoret wrote:
> On 6/13/07, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> >
> > 
> >
> > I actually use this little optimizing trick as an interview question for
> > new hires. You'd be amazed at how many people don't think of this, as
> > obvious as it seems to me...

Yep, for small sets of id to name mappings where the set won't likely
change much I do the exact same thing. No need for a DB hit for
something like that.

> That's a neat trick, I'll try to keep it in mind. In our current setup
> we'd do something like:
> 
> [pseudo]
> 
> while($row)
> $employee = find::($row['employee_id']); // Return an Employee object
> echo $employee->getType()->getName();
> 
> So here, when we created an employee object, it did a db hit and
> looked in the employees table. The type attribute for employee was
> just a ProxyType object (with an id that was stored as type_id in the
> employees table). When I tried to access the name the ProxyType did a
> db hit and replaced itself with a Type object that had all the columns
> of the types table as its attributes. If we needed to later access
> some other attribute of the employee's type, no db hit would be made
> since it's now loaded.
> 
> In this case, if you're looping over all employees and outputting
> their type names you'd be doing nearly twice as many db hits with my
> method. Thanks for the tip.

When I'm avoiding JOIN and I need related data I usually do something
like the following:

 $offset,
'limit'   => $limit,
);

$posts = $postFactory->getMatches( $criteria );

$userIds = array();
foreach( array_keys( $posts ) as $postId )
{
$userId = $posts[$postId]->userId();
$userIds[$userId] = $userId;
}

$criteria = array
(
'userId' => $userIds,
);

$users = $userFactory->getMatches( $criteria );

?>

The getMatches() method when it encounters an array for the 'userId'
criteria entry will use an IN clause for the array of user IDs given. So
it takes two queries -- one to get the topics, one to get the user
information.

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.  |
`'

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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Guillaume Theoret

On 6/13/07, Daevid Vincent <[EMAIL PROTECTED]> wrote:

I'll throw in my suggestion here as to how I implement this.

Generally I evaluate how big are the tables and what do I intend to do
with them.

Sorting is usually a "problem". Using the PHP multi_sort seems
cumbersome and never seems to be as simple as letting the DB do it.

I too use LEFT JOINs frequently.

If I have to join more than say 4 or 5 tables, I start to break it up.

My favorite little trick is to load a PHP array with smaller tables.

[Pseudocoded:]

$employeeType = array( "SELECT id, name FROM employee_type_table" );

And I might do this for several tables.

(you can also store these in a $_SESSION if you're using these
key/values frequently on different pages)

Then this can effectively eliminate one whole join (per), as most tables
key off of ID's (duh).

Then do my real SELECT/JOIN query, and during my while/$row loop I just
substitute the array value back in like this



I actually use this little optimizing trick as an interview question for
new hires. You'd be amazed at how many people don't think of this, as
obvious as it seems to me...


That's a neat trick, I'll try to keep it in mind. In our current setup
we'd do something like:

[pseudo]

while($row)
$employee = find::($row['employee_id']); // Return an Employee object
echo $employee->getType()->getName();

So here, when we created an employee object, it did a db hit and
looked in the employees table. The type attribute for employee was
just a ProxyType object (with an id that was stored as type_id in the
employees table). When I tried to access the name the ProxyType did a
db hit and replaced itself with a Type object that had all the columns
of the types table as its attributes. If we needed to later access
some other attribute of the employee's type, no db hit would be made
since it's now loaded.

In this case, if you're looping over all employees and outputting
their type names you'd be doing nearly twice as many db hits with my
method. Thanks for the tip.



D.Vin

--
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] Reformatting the URI on return to the browser

2007-06-13 Thread Robert Cummings
On Thu, 2007-06-14 at 12:17 +0900, Dave M G wrote:
> PHP,
> 
> I've implemented "friendly urls" in my PHP scripts, so that people can 
> type in things like:
> http://website.com/Cats And Dogs
> ... and they'll be taken to the right page.
> 
> However, when they get to the page, the url will read:
> http://website.com/Cats%20And%20Dogs
> 
> Not so pretty.
> 
> I've noticed that Wikipedia will alter the URI to become more readable, 
> by replacing the spaces with underscores, like so:
> http://wikipedia.org/wiki/Cats_And_Dogs
> 
> I'd like to be able to do that with my system, but I can't quite figure 
> out where in the process of getting a URI request and returning a page 
> that the URI will get set.
> 
> Can anyone help me with figuring out at what point I can gain control 
> over the URI sent back, as Wikipedia does?

If you're on a linux box you can use:

wget -S "http://en.wikipedia.org/wiki/scripting language"

... to see an example of what Wikipedia does.

But to expound... :) Wikipedia issues a 301 (permanently moved) response
header (don't tell Richard Lynch ;) thus redirecting your browser to the
underscore version.

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.  |
`'

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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Guillaume Theoret

On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Wed, June 13, 2007 12:31 pm, Guillaume Theoret wrote:
> Thanks for the response.
>
> On 6/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>> On Wed, 2007-06-13 at 10:36 -0400, Guillaume Theoret wrote:
>> > Hi everyone,
>> >
>> > Can anyone recommend any good books/resources for php and mysql
>> > performance management? I'm more interested in the software
>> > development side (as opposed to server configuration) of things.
>> I'm
>> > looking for anything that would be good to know when working on
>> > websites that get millions of hits a day.
>> >
>> > Also, if anyone knows of any resources/discussions that illustrate
>> the
>> > relative performance of joins vs multiple selects I'd love to
>> check it
>> > out.
>>
>> JOIN will almost always be faster by virtue of the query being
>> optimized
>> and doing the work within a single request.
>
> Really? I thought the way it worked was that when you joined 2 tables
> it needed to create every row combination applicable and then apply
> the where clause. In large tables wouldn't this be slower? It's these
> kinds of optimizations and when the kick in, etc that I don't know
> much about.

Conceptually, JOIN builds that monster table.

If the DB engine can figure out how to constrain one table or another
BEFORE that JOIN to give a much smaller record set, and if they have
mathematical proof that the end result is the same, then they will
optimize and go with the smaller set when possible.

That's a (very) good thing.


Yes, very good indeed. I don't envy the people that write the
algorithms to figure that stuff out. I do still remember my relational
algebra but wouldn't know how to go about implementing that as
efficiently as possible!



> In our application we wrote an abstraction layer with lazy loading.
> (eg: If a User has a Profile the db users table has a profile_id and
> we create a ProxyProfile that only has an id and will look up its
> other attributes in the db if ever needed and then replace its
> reference by a full Profile object.) Because of this, so far the
> entire app only has 1 join because the other select(s) will only be
> done if and when they're needed. I'm certain this is faster in the
> average case but I wanted to know which is generally faster in case I
> later profile the code and see that in some cases the dependent item
> is pretty much always loaded.

You really should write the code the most straight-forward way you
can, and then optimize after identifying bottle-necks.

Anything else is just optimization-masturbation.


We wrote this specifically to keep things conceptually simple. It's
much easier to write an ORM layer and then use nothing but objects
without worrying about the db in the application layer. The result of
writing the ORM layer the way we did was that joins pretty much
vanished (because of the lazy loading). I was just curious as to how
good this actually was. It also makes it much easier to profile and
make changes if necessary too.



> The db will be under heavy load (once we deploy) but we don't yet
> intend on distributing the database. We did however plan for it since
> in the scenario I described above we just need to create a different
> db connection for a different table. We could theoretically have as
> many different db servers as tables (except for that one join of 2
> tables).

This is the scary part.

You really ought to set up a QA server with simulated heavy load for
real life testing, rather than waiting until you deploy to experience
heavy load.


It's not as scary as it sounds. What I'm working on is pretty much a
re-write of our current system (with many new features) and it runs
off a single db server. We do expect the load to increase over time
though (we currently get around 500 to 700 000 hits a day I think) so
it's good to plan for growth.



--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




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



[PHP] Reformatting the URI on return to the browser

2007-06-13 Thread Dave M G

PHP,

I've implemented "friendly urls" in my PHP scripts, so that people can 
type in things like:

http://website.com/Cats And Dogs
... and they'll be taken to the right page.

However, when they get to the page, the url will read:
http://website.com/Cats%20And%20Dogs

Not so pretty.

I've noticed that Wikipedia will alter the URI to become more readable, 
by replacing the spaces with underscores, like so:

http://wikipedia.org/wiki/Cats_And_Dogs

I'd like to be able to do that with my system, but I can't quite figure 
out where in the process of getting a URI request and returning a page 
that the URI will get set.


Can anyone help me with figuring out at what point I can gain control 
over the URI sent back, as Wikipedia does?


Thanks for any advice.

--
Dave M G
Ubuntu Feisty 7.04
Kernel 2.6.20-15-386

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



Re: Re[2]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Robert Cummings
On Thu, 2007-06-14 at 00:33 +0100, Richard Davey wrote:
> Hi Richard,
> 
> Wednesday, June 13, 2007, 6:44:55 PM, you wrote:
> 
> >> if ($allow_fraction)
> 
> > //Should we warn you that $allow_fraction is not actually defined?...
> 
> Should I warn you that to save everyone's sanity I only posted what was
> needed from the code? ;) $allow_fraction came from a function
> parameter. I'd type hint it to boolean if PHP allowed, but alas ...
> 
> > $flags |= FILTER_FLAG_ALLOW_FRACTION;
> 
> Yup, Robert showed this already in this thread. Nice short-cut, wasn't
> aware it worked with that operator. That's definitely my "learnt
> something new" for today. I wonder what else it works for? (besides
> the obvious += -=)

http://ca3.php.net/manual/en/language.operators.php

There's quite a few.

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.  |
`'

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



Re[2]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi Richard,

Wednesday, June 13, 2007, 6:44:55 PM, you wrote:

>> if ($allow_fraction)

> //Should we warn you that $allow_fraction is not actually defined?...

Should I warn you that to save everyone's sanity I only posted what was
needed from the code? ;) $allow_fraction came from a function
parameter. I'd type hint it to boolean if PHP allowed, but alas ...

> $flags |= FILTER_FLAG_ALLOW_FRACTION;

Yup, Robert showed this already in this thread. Nice short-cut, wasn't
aware it worked with that operator. That's definitely my "learnt
something new" for today. I wonder what else it works for? (besides
the obvious += -=)

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

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



Re: [PHP] create file permission problem

2007-06-13 Thread tedd

At 1:37 PM -0400 6/13/07, Daniel Brown wrote:

On 6/13/07, tedd <[EMAIL PROTECTED]> wrote:

Hi Gang:

I'm sure this is obvious to most, but not to me.

I working on a virtual host.

If I want to save data in a file, I can ftpconnect(); change the
permissions of an existing file from 0755 to 0777; write to the file;
and change the permissions of the file back to 0755 -- no problem.

However, if a file is not there, then I can create one. However, the
permissions of the file will be automagically set to 0600 and as
such, I can't change them via ftpconnect(). In other words, I can't
FTP in to my site and change the permissions of a file I created. I
can delete the file, but that's all.

How do you guys create a file and set its permissions working on a
virtual host via php?

-snip-


   Two quick questions

   Is the PHP script running ftpconnect() using a valid FTP account
with privileges to own/share a file on the system?

   How are you creating the file on the FTP server?

--
Daniel P. Brown



Daniel:

1. I'm not sure -- from within a script, I ftpconnect() with user and 
password and can change permissions of directories with no problems 
-- can I do that without a valid FTP account?


2. From within a script, I change the permission of the parent 
directory and open a file. If it's there, then I can read from or 
write to it. If it's not there, then the operation ( fopen( $folder . 
$filename, "w" )) creates the file and I can write to it then read 
from it.


I have now figured out how to get the created file to 644 permission 
and that's sufficient. I'm still not able to get permissions to 755, 
but really don't need to, just wondering how.


Thanks,

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] PHP list as a blog

2007-06-13 Thread Philip Thompson

On Jun 13, 2007, at 1:15 PM, Richard Lynch wrote:


On Wed, June 13, 2007 12:21 am, Crayon Shin Chan wrote:

On Wednesday 13 June 2007 12:39, Paul Scott wrote:


Our interns and students specifically. They are all dead scared of
joining mailing lists in general, and find that using a web based
prettier interface is much easier and friendlier.


Not to mention slower, clumsier and more bandwidth hungry than a
mailing list. It's time you did them a favour and show them that  
mailing lists

are nothing to be afraid of.


Do students and interns still have quotas on their email accounts?...


Yes. It does depend on the university though. For our students, the  
default is only 50 megs - they may request more. However, these text- 
only emails don't really take up that much space.




Cuz I *DO* remember the days when the email quotas a University would
have prohibited subscribing to PHP mailing list...


This is not currently the case.



Surely in this day and age, the quotas aren't *that* restrictive...


True.


~Philip

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



RE: [PHP] Calendar

2007-06-13 Thread Daevid Vincent
> -Original Message-
> From: Richard Lynch [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, June 13, 2007 12:05 PM
>
> On Wed, June 13, 2007 12:50 pm, Clint Tredway wrote:
> > Is there a decent free calendar? I just need to show a few 
> events on a
> > calendar.
> 
> Having looked at a LOT of web calendars (for touring musicians) I can
> say with certainty that if you only have a FEW events, a month-like
> layout with boxes for every day looks really silly/ugly when there's
> only one or two events in it...
> 
> A simple listing, in order, nicely formatted, will serve much better.

Here's one I wrote and use:
http://www.rollinballzcrew.com/nextparty.phtml

I even implemented iCal compatible events. :)

If interested, I could send you the page,etc.

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



RE: [PHP] php / mysql performance resources

2007-06-13 Thread Daevid Vincent
I'll throw in my suggestion here as to how I implement this.

Generally I evaluate how big are the tables and what do I intend to do
with them. 

Sorting is usually a "problem". Using the PHP multi_sort seems
cumbersome and never seems to be as simple as letting the DB do it.

I too use LEFT JOINs frequently.

If I have to join more than say 4 or 5 tables, I start to break it up.

My favorite little trick is to load a PHP array with smaller tables.

[Pseudocoded:]

$employeeType = array( "SELECT id, name FROM employee_type_table" );

And I might do this for several tables.

(you can also store these in a $_SESSION if you're using these
key/values frequently on different pages)

Then this can effectively eliminate one whole join (per), as most tables
key off of ID's (duh).

Then do my real SELECT/JOIN query, and during my while/$row loop I just
substitute the array value back in like this



I actually use this little optimizing trick as an interview question for
new hires. You'd be amazed at how many people don't think of this, as
obvious as it seems to me...

D.Vin

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



Re: [PHP] Reoccurring task manager

2007-06-13 Thread Richard Heyes

Jason Pruim wrote:

> Okay, so I have been searching and trying all day for something so 
simple... All I want is the ability to pick a task that my business  has 
to do such as Emptying the trash... And do this with it:

>
> Task: Empty Trash
> Description: Empty Trash every monday morning
> When Garbage is empty click check box.
> Task comes up again on Monday Morning from now until we close the 
business.
> If task is not completed in the day assigned, then task comes up the 
 next day in the morning until complete.

>
> Is there something like this out there? I don't need a full blown 
project management software system, but web accessible and php based 
would be wonderful...



Sounds like an ideal job for cron if you're using *NIX. Try "man 5 crontab".

--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] GD Library and outputing image

2007-06-13 Thread Daniel Brown

On 6/13/07, Stephen <[EMAIL PROTECTED]> wrote:



Ross <[EMAIL PROTECTED]> wrote:Never really used the GD much before very 
straightforward but how do I
output the image on a page. This is fine on a php page on its own but what
about one where the headers are already sent?

  Save the image as file, first.

  The href src= etc



   If space isn't an issue, that's an alternative answer

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] GD Library and outputing image

2007-06-13 Thread Stephen


Ross <[EMAIL PROTECTED]> wrote:Never really used the GD much before very 
straightforward but how do I 
output the image on a page. This is fine on a php page on its own but what 
about one where the headers are already sent?
   
  Save the image as file, first.
   
  The href src= etc


Re: [PHP] GD Library and outputing image

2007-06-13 Thread Daniel Brown

On 6/13/07, Ross <[EMAIL PROTECTED]> wrote:

Never really used the GD much before very straightforward but how do I
output the image on a page. This is  fine on a php page on its own but what
about one where the headers are already sent?


I take it I can do something like  this . Anyone got a better method?




$image = imagecreatefromjpeg($img_url);
if ($image === false) { die ('Unable to open image'); }

// Get original width and height
echo $width = imagesx($image);
echo $height = imagesy($image);

// New width and height
$new_width = 200;
$new_height = 150;

// Resample
$image_resized = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width,
$new_height, $width, $height);

// Display resized image
header('Content-type: image/jpeg');
imagejpeg($image_resized);
die();

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




   Aside from perhaps changing die(); to exit;, though not necessary,
I'd say that it looks like you're right on track.  Until you find a
better way to have HTML display an image than through , I
think it's good to go.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



[PHP] GD Library and outputing image

2007-06-13 Thread Ross
Never really used the GD much before very straightforward but how do I 
output the image on a page. This is  fine on a php page on its own but what 
about one where the headers are already sent?


I take it I can do something like  this . Anyone got a better method?




$image = imagecreatefromjpeg($img_url);
if ($image === false) { die ('Unable to open image'); }

// Get original width and height
echo $width = imagesx($image);
echo $height = imagesy($image);

// New width and height
$new_width = 200;
$new_height = 150;

// Resample
$image_resized = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, 
$new_height, $width, $height);

// Display resized image
header('Content-type: image/jpeg');
imagejpeg($image_resized);
die();

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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 14:36 -0500, Richard Lynch wrote:
> On Wed, June 13, 2007 2:08 pm, Robert Cummings wrote:
> > On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:
> > I strongly disagree with your argument for the use of using require
> > logic instead of a redirect.
> >
> >> PHP responds over dog-slow Internet with 301 Redirect to login.php.
> >> Browser interprets 301 Redirect, hopefully correctly.
> >
> > This is incorrect, PHP sends a 302 status code. From the online docs:
> 
> You're right, of course, as a 301 would be a permanent redirect, and
> PHP doesn't "know" if you moved your content permanently or
> temporarily, so 302 (temporary) is the safe answer...

Or it's the statistically safe bet since it's more likely your content
didn't move and that you're just doing a temporary redirect.

> > "The second special case is the "Location:" header. Not
> >  only does it send this header back to the browser, but
> >  it also returns a REDIRECT (302) status code to the
> >  browser unless some 3xx status code has already been set."
> 
> You're still sending the response to the browser, then the browser has
> to interpret it, then the browser has to request the new URL, chewing
> up another HTTP connection resource, and bogging down your server,
> before PHP can be invoked a second time, to do an include
> 'login.php'...
> 
> Or you could just include 'login.php' in the first place, and SKIP ALL
> THAT CRAP.

The extra request is not a good excuse for breaking the semantic linking
of the web. I didn't request login.php, I requested leatherAndLace.php
and so I want leather and lace or you better tell me I'm on the wrong
page. It's like walking into a bar, requesting a pint of Guinness and
the bartender say, sorry I haven't checked your ID, but to save myself a
trip I'll just give you a Shirley Temple... you sould be fine with that
right? HELL NO!! I want my Guinness! :)

> >>From Wikipedia we learn:
> >
> > "302 Found
> >  This is the most popular redirect code, but also an
> >  example of industrial practice contradicting the standard.
> >  HTTP/1.0 specification (RFC 1945) required the client to
> >  perform a temporary redirect (the original describing
> >  phrase was "Moved Temporarily"), but popular browsers
> >  implemented it as a 303 See Other. Therefore, HTTP/1.1
> >  added status codes 303 and 307 to disambiguate between
> >  the two behaviors. However, majority of Web applications
> >  and frameworks still use the 302 status code as if it
> >  were the 303.
> 
> IE is the one that chose to mis-interpret a POST with a 302 response
> with an incomplete URI as a 303.

303 didn't exist in HTTP/1.0, you have to do something. 302 was a close
enough match in HTTP/1.0 and HTTP/1.1 that it became the industry
standard regardless of what Microsoft did.

> *HOW* MS managed to code that badly is beyond my ken, but there it is.
> 
> I alluded to this in my blog.
> 
> > As such 302 is the best method IMHO since it is industry practiced and
> > supported back to HTTP/1.0.
> 
> I don't really care which 30x code you use -- You're STILL bouncing
> the user like a white ferret [*] instead of just doing the 'include'
> you're going to need to do in the end.

I'm bouncing them around because I'm the incorrect source for the
information they a requesting. There is a proper chain of command to be
followed. First they must log in. If a user just registered on my
website via http://foo.fee.com/register.php and they complete the
registration and I just go ahead and include news.php how is that
semantically valid? No, I redirect them to news.php so they can bookmark
it if it happens to interest them.

> > I strongly disagree with this since it breaks the request/content
> > linking. For instance if I request:
> >
> > http://l33t.pr0n.xxx/leatherAndLace.php
> >
> > And you serve up a login page then I'm sure as hell not getting what I
> > expected. If something else should happen beyond a login request then
> > it's possible and VERY likely that search engines, if they can access
> > the content, will index the WRONG content with the URL. As such it
> > breaks the link/content relationship and is a bad idea.
> 
> If you're silly enough to hard-code the response "now" of a dynamic
> page as if it were the one and only response ever, then you've got
> much bigger problems than a silly login form...

If you're short-sighted enough to serve up mismatched content with the
actual request then you deserve the soup of Bookmarked links that point
to incorrect pages that your users create.

> > Additionally, if there are multiple branches based on some internally
> > measured variable, then it is possible that parameters should be
> > passed
> > to the page as would normally be done via the URL. Stuffing them into
> > $_GET yourself is abusive of the semantic definition of $_GET.
> > Additionally, users bookmarking your page will not get the same
> > content
> 

Re: [PHP] Reoccurring task manager

2007-06-13 Thread Daniel Brown

[MySQL]
   L> Table: `tasks`
   L> Columns: `id` (auto_increment), `task_name`, `completed`,
`day_of_week`

[PHP]
   L> File: viewall.php


   L> File: update.php


   L> File: cronjob.php


[cron]
40 03 * * * /path/to/cronjob.php >> /dev/null 2>&1


NOTE: This was entirely typed directly into the mail client, and NONE
of it was tested, so it probably has tons of bugs.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 20:37 +0100, Stut wrote:
> Robert Cummings wrote:
> > On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:
> >> PHP responds over dog-slow Internet with 301 Redirect to login.php.
> >> Browser interprets 301 Redirect, hopefully correctly.
> > 
> > This is incorrect, PHP sends a 302 status code. From the online docs:
> > 
> > "The second special case is the "Location:" header. Not
> >  only does it send this header back to the browser, but
> >  it also returns a REDIRECT (302) status code to the
> >  browser unless some 3xx status code has already been set."
> 
> Indeed, this is correct.
> 
> >>From Wikipedia we learn:
> > 
> > "302 Found
> >  This is the most popular redirect code, but also an
> >  example of industrial practice contradicting the standard.
> >  HTTP/1.0 specification (RFC 1945) required the client to
> >  perform a temporary redirect (the original describing
> >  phrase was "Moved Temporarily"), but popular browsers
> >  implemented it as a 303 See Other. Therefore, HTTP/1.1
> >  added status codes 303 and 307 to disambiguate between
> >  the two behaviors. However, majority of Web applications
> >  and frameworks still use the 302 status code as if it
> >  were the 303.
> > 
> >  303 See Other (since HTTP/1.1)
> >  The response to the request can be found under another URI
> >  using a GET method."
> > 
> > As such 302 is the best method IMHO since it is industry practiced and
> > supported back to HTTP/1.0.
> 
> Not entirely. 301 and 302 responses are both equally valid but mean 
> subtly different things.
> 
> A 302 is a temporary redirect. Essentially it tells the client to load a 
> different resource but nothing more than that.
> 
> A 301 is a permanent redirect. This tells the client to load a different 
> resource, and that any time that original URL is requested it will be 
> redirected. Essentially this means bookmarks and indexes should be 
> modified to point to the new URL.

Yep, I understand that, but the usage example Richard mentioned is
primarily where developers redirect to an alternate location given that
they didn't set the response code themself and relied on PHP's default.

> >> Maybe you should consider just doing this instead:
> >>
> >> if( !logged_in() )
> >> {
> >> require 'login.php';
> >> exit;
> >> }
> > 
> > I strongly disagree with this since it breaks the request/content
> > linking. For instance if I request:
> > 
> > http://l33t.pr0n.xxx/leatherAndLace.php
> > 
> > And you serve up a login page then I'm sure as hell not getting what I
> > expected. If something else should happen beyond a login request then
> > it's possible and VERY likely that search engines, if they can access
> > the content, will index the WRONG content with the URL. As such it
> > breaks the link/content relationship and is a bad idea.
> 
> Completely agree with this, but there are lots of reasons to include 
> files rather than bouncing off the client with a new URL, login 
> requirements is just one example where a redirect would be preferred.

IMHO an include is preferrable if the content being displayed makes
sense in the context of the URL requested.

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.  |
`'

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



Re: [PHP] sending mail from localhost

2007-06-13 Thread Daniel Brown

On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

Intent inschment.


   Sorry I didn't get this message sooner, but Gmail's spam filter
blocked the message for apparently using "fake filler text" or
something.  Luckily, however, it didn't interrupt my daily flow of
"w4ys 2 rnake rny P3N|$ b1gger!"

   I need that.  Maybe then I can finally pee standing up.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



[PHP] Reoccurring task manager

2007-06-13 Thread Jason Pruim
Okay, so I have been searching and trying all day for something so  
simple... All I want is the ability to pick a task that my business  
has to do such as Emptying the trash... And do this with it:


Task: Empty Trash
Description: Empty Trash every monday morning
When Garbage is empty click check box.
Task comes up again on Monday Morning from now until we close the  
business.
If task is not completed in the day assigned, then task comes up the  
next day in the morning until complete.


Is there something like this out there? I don't need a full blown  
project management software system, but web accessible and php based  
would be wonderful...


Thanks!

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



Re: [PHP] sending mail from localhost

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 2:07 pm, Daniel Brown wrote:
> As for the SPAM filter stuff, all of the rest makes sense, but the
> Reply-to: header actually goes against the original spirit and
> intention of the design.  Refer to RFC 822 Part 4 Section 1 --- the
> reply-to header is intended for use as an "authenticated address."
> It's not really considered "authenticated" if you put the information
> in manually, right?  Or am I experiencing one of those contagious
> Brain Fart [tm] moments?

Intent inschment.

The spam filters just go with what works, mostly, and they've noticed
that lazy spammers don't have Reply-to: and most decent mail clients
used by Real People do, and they take a point off for it.

And we could go on at length about broken email clients that do or
don't handle From: without Reply-to: correctly, but the long and the
sort of it is, I'd advise folks to add the Reply-to: even if it's the
same as From: if you want your mail to get through and the email
clients to "work right" when they go to reply to it...

That's just been MY experience.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Daniel Brown

On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:



On Wed, June 13, 2007 12:20 am, Paul Scott wrote:
>
> On Tue, 2007-06-12 at 16:02 -0500, Richard Lynch wrote:
>> > OK, downed it. Will figure out a regular expression to strip out
>> the
>> > email addresses when I have had some coffee in  the morning
>
> I have added a regex to strip out the mail addresses and replace them
> with a message saying that they have been removed. I will put this
> list
> back on now for a test period if that is OK?
>
> Thanks all for the feedback, I really appreciate it!

Wonderful!

It is much appreciated.

Now if we can just get the gname (gmane?) folks to do the same...

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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




   Think they ever check their own archives to see what's being said
about them?

   Taking sidebar for a moment, I wonder how many places don't
sanitize the text from emails piped through their scripts.  How much
do you want to bet that, by sending text to a mailing list, you could
arbitrarily execute code on some of the lesser archiving sites?

   Maybe we should dedicate a thread to that instead of YACAPTCHA discussion.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Stut

Robert Cummings wrote:

On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:

PHP responds over dog-slow Internet with 301 Redirect to login.php.
Browser interprets 301 Redirect, hopefully correctly.


This is incorrect, PHP sends a 302 status code. From the online docs:

"The second special case is the "Location:" header. Not
 only does it send this header back to the browser, but
 it also returns a REDIRECT (302) status code to the
 browser unless some 3xx status code has already been set."


Indeed, this is correct.


From Wikipedia we learn:


"302 Found
 This is the most popular redirect code, but also an
 example of industrial practice contradicting the standard.
 HTTP/1.0 specification (RFC 1945) required the client to
 perform a temporary redirect (the original describing
 phrase was "Moved Temporarily"), but popular browsers
 implemented it as a 303 See Other. Therefore, HTTP/1.1
 added status codes 303 and 307 to disambiguate between
 the two behaviors. However, majority of Web applications
 and frameworks still use the 302 status code as if it
 were the 303.

 303 See Other (since HTTP/1.1)
 The response to the request can be found under another URI
 using a GET method."

As such 302 is the best method IMHO since it is industry practiced and
supported back to HTTP/1.0.


Not entirely. 301 and 302 responses are both equally valid but mean 
subtly different things.


A 302 is a temporary redirect. Essentially it tells the client to load a 
different resource but nothing more than that.


A 301 is a permanent redirect. This tells the client to load a different 
resource, and that any time that original URL is requested it will be 
redirected. Essentially this means bookmarks and indexes should be 
modified to point to the new URL.



Maybe you should consider just doing this instead:

if( !logged_in() )
{
require 'login.php';
exit;
}


I strongly disagree with this since it breaks the request/content
linking. For instance if I request:

http://l33t.pr0n.xxx/leatherAndLace.php

And you serve up a login page then I'm sure as hell not getting what I
expected. If something else should happen beyond a login request then
it's possible and VERY likely that search engines, if they can access
the content, will index the WRONG content with the URL. As such it
breaks the link/content relationship and is a bad idea.


Completely agree with this, but there are lots of reasons to include 
files rather than bouncing off the client with a new URL, login 
requirements is just one example where a redirect would be preferred.


-Stut

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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 2:08 pm, Robert Cummings wrote:
> On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:
> I strongly disagree with your argument for the use of using require
> logic instead of a redirect.
>
>> PHP responds over dog-slow Internet with 301 Redirect to login.php.
>> Browser interprets 301 Redirect, hopefully correctly.
>
> This is incorrect, PHP sends a 302 status code. From the online docs:

You're right, of course, as a 301 would be a permanent redirect, and
PHP doesn't "know" if you moved your content permanently or
temporarily, so 302 (temporary) is the safe answer...

> "The second special case is the "Location:" header. Not
>  only does it send this header back to the browser, but
>  it also returns a REDIRECT (302) status code to the
>  browser unless some 3xx status code has already been set."

You're still sending the response to the browser, then the browser has
to interpret it, then the browser has to request the new URL, chewing
up another HTTP connection resource, and bogging down your server,
before PHP can be invoked a second time, to do an include
'login.php'...

Or you could just include 'login.php' in the first place, and SKIP ALL
THAT CRAP.

>>From Wikipedia we learn:
>
> "302 Found
>  This is the most popular redirect code, but also an
>  example of industrial practice contradicting the standard.
>  HTTP/1.0 specification (RFC 1945) required the client to
>  perform a temporary redirect (the original describing
>  phrase was "Moved Temporarily"), but popular browsers
>  implemented it as a 303 See Other. Therefore, HTTP/1.1
>  added status codes 303 and 307 to disambiguate between
>  the two behaviors. However, majority of Web applications
>  and frameworks still use the 302 status code as if it
>  were the 303.

IE is the one that chose to mis-interpret a POST with a 302 response
with an incomplete URI as a 303.

*HOW* MS managed to code that badly is beyond my ken, but there it is.

I alluded to this in my blog.

> As such 302 is the best method IMHO since it is industry practiced and
> supported back to HTTP/1.0.

I don't really care which 30x code you use -- You're STILL bouncing
the user like a white ferret [*] instead of just doing the 'include'
you're going to need to do in the end.

> I strongly disagree with this since it breaks the request/content
> linking. For instance if I request:
>
> http://l33t.pr0n.xxx/leatherAndLace.php
>
> And you serve up a login page then I'm sure as hell not getting what I
> expected. If something else should happen beyond a login request then
> it's possible and VERY likely that search engines, if they can access
> the content, will index the WRONG content with the URL. As such it
> breaks the link/content relationship and is a bad idea.

If you're silly enough to hard-code the response "now" of a dynamic
page as if it were the one and only response ever, then you've got
much bigger problems than a silly login form...

> Additionally, if there are multiple branches based on some internally
> measured variable, then it is possible that parameters should be
> passed
> to the page as would normally be done via the URL. Stuffing them into
> $_GET yourself is abusive of the semantic definition of $_GET.
> Additionally, users bookmarking your page will not get the same
> content
> next time round if it is dependent on such $_GET variables.

I have NO IDEA what heck you are talking about with stuffing values
into $_GET variables, unless, of course, you refer to people who do:

header("Location: example.com?foo=$_GET[foo]");

and expect it to work...

Whereas I'm suggesting that you already HAVE your $_GET data, and you
already KNOW what content to server up for *THIS* request, and you
should just serve up the content you're supposed to serve up and be
done with it.

PS
I also usually serve up a nice full page with a login form in the
middle rather than just the login form, so, really, the search engine
is only going to get exactly what I wanted it to get in the first
place.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] create file permission problem

2007-06-13 Thread Daniel Brown

On Wed, June 13, 2007 12:13 pm, tedd wrote:
> If I want to save data in a file, I can ftpconnect(); change the
> permissions of an existing file from 0755 to 0777; write to the file;
> and change the permissions of the file back to 0755 -- no problem.


On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

When your script creates the file, it creates it as itself, and not as
'you', which means that 'you' probably can't change it.


   Rich,

   If he's doing it with ftpconnect();, it's a matter of the login
information supplied for the socket connection via the function, not
who the script is running as.  However, on a slightly different note,
you can (once again, referring to my post from the archives) `chmod
6755 scriptname.php` where scriptname.php is the name of the file
creating the file, if on the same (*nix-like) server as the files
being created.  If the server is set up properly, then chmod'ing it
like that sets the first permission bit to execute the script as the
user and group (with inherent permissions), as opposed to running as
`nobody`, `apache`, `httpd`, `daemon`, or *gulp!* `root`.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 15:11 -0400, Daniel Brown wrote:
> On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
> 
> > Oh, we'll fill that sucker up pretty fast... :-)
> 
> Yeah, more or less with our off-topic useless Wednesday banter
> alone.  I don't think I'd ever read this list if I had to get it in
> digest form, but a searchable blog maybe, if I'm looking for one
> of Robert Cummings' famous English lessons.

:D


-- 
..
| 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.  |
`'

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



Re: [PHP] IF with multiple values for a variable

2007-06-13 Thread Stut

Dan Shirah wrote:

if ($type == 'T','D','L' {
   $get_id.=" payment_request WHERE id = '$payment_id'";
   }


if (in_array($type, array('T', 'D', 'L')))
{
...
}

-Stut

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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Richard Lynch


On Wed, June 13, 2007 5:11 am, Paul Scott wrote:
>
> On Wed, 2007-06-13 at 12:08 +0200, Zoltán Németh wrote:
>> is this the link:
>> http://196.21.45.50/fsiu/chisimba_framework/app/index.php?module=blog&action=allblogs
>> ?
>> (this was in your original post)
>>
>
> No, sorry, I have just updated the DNS. Try http://fsiu.uwc.ac.za/
> now.

Or just strip everything off the URL except for the IP address like I
did :-)

Actually, I tried each directory up the hierarchy in succession, as is
normal for a bad URL to get to something that might be what you want.

Or at least interesting, even if it's not what you want.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Richard Lynch


On Wed, June 13, 2007 12:20 am, Paul Scott wrote:
>
> On Tue, 2007-06-12 at 16:02 -0500, Richard Lynch wrote:
>> > OK, downed it. Will figure out a regular expression to strip out
>> the
>> > email addresses when I have had some coffee in  the morning
>
> I have added a regex to strip out the mail addresses and replace them
> with a message saying that they have been removed. I will put this
> list
> back on now for a test period if that is OK?
>
> Thanks all for the feedback, I really appreciate it!

Wonderful!

It is much appreciated.

Now if we can just get the gname (gmane?) folks to do the same...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 10:19 am, Robert Cummings wrote:
> On Wed, 2007-06-13 at 17:16 +0200, Zoltán Németh wrote:
>> 2007. 06. 13, szerda keltezéssel 10.52-kor Daniel Brown ezt írta:
>> > On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
>> >
>> > Jason:  Tell them to stop raising the price of the damned
>> stamps!
>> > Offer to take a pay cut and take one for the team I'll buy you
>> a
>> > beer.
>> >
>> > Zoltán:  Trade with me.  I've been here for less than two
>> hours
>> > and I'm ready to go home.  I'll buy you a beer.
>>
>> hmm sorry I prefer to go now and buy myself a beer since working
>> hours
>> is over now for me :D
>
> I work from home... the beer is in the fridge :)

I don't work from home, but the fridge under my desk has beer in it. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:15 -0500, Richard Lynch wrote:
> Do students and interns still have quotas on their email accounts?...
> 

Students get 100MB, interns and staff too. That is storage space on the
IMAP server though, if you POP it off (like I do) you can get over 1GB
of mail a month (like I do) :)

> Cuz I *DO* remember the days when the email quotas a University would
> have prohibited subscribing to PHP mailing list...
> 

Pegasus mail rocked. *still* one of the best mail clients I ever used.

> Surely in this day and age, the quotas aren't *that* restrictive...

No, not really, but the point here is that most of the students and
interns that we hire to code on our framework have little to no
experience switching on a PC, never mind producing decent PHP. Mailing
lists, for some obscure reason, are their nemesis, so the easier I can
make it for them to communicate and get over the initial barriers to
FOSS development, the better.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] create file permission problem

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 12:13 pm, tedd wrote:
> I'm sure this is obvious to most, but not to me.
>
> I working on a virtual host.
>
> If I want to save data in a file, I can ftpconnect(); change the
> permissions of an existing file from 0755 to 0777; write to the file;
> and change the permissions of the file back to 0755 -- no problem.
>
> However, if a file is not there, then I can create one. However, the
> permissions of the file will be automagically set to 0600 and as
> such, I can't change them via ftpconnect(). In other words, I can't
> FTP in to my site and change the permissions of a file I created. I
> can delete the file, but that's all.
>
> How do you guys create a file and set its permissions working on a
> virtual host via php?

When your script creates the file, it creates it as itself, and not as
'you', which means that 'you' probably can't change it.

Fortunately, your php script owns the file, and it CAN change it.

In particular, before your script creates the file, it can use
http://php.net/umask to define what permissions the file should have,
or, after it's created, it can change the permissions with
http://php.net/chmod

> PS: If I remember correctly, it was pretty easy in perl. Just try to
> open/write a file and if it wasn't there, it created one for you.
> But, it's been years since I did any perl stuff -- could be wrong.

If Perl is running as 'you' then you'd have an easier time...

But if Perl was, say, mod_perl and running as the Apache user, you'd
be in the exact same boat as you are now.

PHP vs Perl is pretty irrelevant.

It's about who created the file with which permissions, and who's
trying to access it.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 12:31 pm, Guillaume Theoret wrote:
> Thanks for the response.
>
> On 6/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>> On Wed, 2007-06-13 at 10:36 -0400, Guillaume Theoret wrote:
>> > Hi everyone,
>> >
>> > Can anyone recommend any good books/resources for php and mysql
>> > performance management? I'm more interested in the software
>> > development side (as opposed to server configuration) of things.
>> I'm
>> > looking for anything that would be good to know when working on
>> > websites that get millions of hits a day.
>> >
>> > Also, if anyone knows of any resources/discussions that illustrate
>> the
>> > relative performance of joins vs multiple selects I'd love to
>> check it
>> > out.
>>
>> JOIN will almost always be faster by virtue of the query being
>> optimized
>> and doing the work within a single request.
>
> Really? I thought the way it worked was that when you joined 2 tables
> it needed to create every row combination applicable and then apply
> the where clause. In large tables wouldn't this be slower? It's these
> kinds of optimizations and when the kick in, etc that I don't know
> much about.

Conceptually, JOIN builds that monster table.

If the DB engine can figure out how to constrain one table or another
BEFORE that JOIN to give a much smaller record set, and if they have
mathematical proof that the end result is the same, then they will
optimize and go with the smaller set when possible.

That's a (very) good thing.

> In our application we wrote an abstraction layer with lazy loading.
> (eg: If a User has a Profile the db users table has a profile_id and
> we create a ProxyProfile that only has an id and will look up its
> other attributes in the db if ever needed and then replace its
> reference by a full Profile object.) Because of this, so far the
> entire app only has 1 join because the other select(s) will only be
> done if and when they're needed. I'm certain this is faster in the
> average case but I wanted to know which is generally faster in case I
> later profile the code and see that in some cases the dependent item
> is pretty much always loaded.

You really should write the code the most straight-forward way you
can, and then optimize after identifying bottle-necks.

Anything else is just optimization-masturbation.

> The db will be under heavy load (once we deploy) but we don't yet
> intend on distributing the database. We did however plan for it since
> in the scenario I described above we just need to create a different
> db connection for a different table. We could theoretically have as
> many different db servers as tables (except for that one join of 2
> tables).

This is the scary part.

You really ought to set up a QA server with simulated heavy load for
real life testing, rather than waiting until you deploy to experience
heavy load.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Daniel Brown

On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:


Oh, we'll fill that sucker up pretty fast... :-)


   Yeah, more or less with our off-topic useless Wednesday banter
alone.  I don't think I'd ever read this list if I had to get it in
digest form, but a searchable blog maybe, if I'm looking for one
of Robert Cummings' famous English lessons.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:16 -0500, Richard Lynch wrote:
> Oh, we'll fill that sucker up pretty fast... :-)
> 
Thats what I am counting on!

I have been on this list a while, and a couple flamewars should do the
trick :)

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

RE: [PHP] PHP list as a blog

2007-06-13 Thread Paul Scott

On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:

> I am currently averaging 2 posts per year, roughly, including today's
> rant about header("Location:"):

I was asked to write a blog, I am no blogger myself, thought it was a
cool challenge to make a good one, so I took it on. Personally, I think
that the blogosphere is a mix of exhibitionists and voyeurs... 

No offence intended, just a personal opinion. I think I need some sleep.

--Paul


All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] IF with multiple values for a variable

2007-06-13 Thread Richard Lynch


On Wed, June 13, 2007 12:35 pm, Dan Shirah wrote:
> Okay, I know this has got to be easy but it's not working any way I
> try it.
>
> When a record is selected it opens up a new page.  My query will
> display the
> specific results based on the type of record selected.  There can be
> multiple values in each if.  However I am having a brain fart in my if
> statement assigning the multiple values.
>
> Here is my if statement:
>
>  if ($type == 'T','D','L' {

//this will work:
if ($type == 'T' || $type == 'D' || $type == 'L'){

> $get_id.=" payment_request WHERE id = '$payment_id'";
> }

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 13:13 -0500, Richard Lynch wrote:
>
> I am currently averaging 2 posts per year, roughly, including today's
> rant about header("Location:"):
> 
> http://richardlynchblogspot.com

I strongly disagree with your argument for the use of using require
logic instead of a redirect.

> PHP responds over dog-slow Internet with 301 Redirect to login.php.
> Browser interprets 301 Redirect, hopefully correctly.

This is incorrect, PHP sends a 302 status code. From the online docs:

"The second special case is the "Location:" header. Not
 only does it send this header back to the browser, but
 it also returns a REDIRECT (302) status code to the
 browser unless some 3xx status code has already been set."

>From Wikipedia we learn:

"302 Found
 This is the most popular redirect code, but also an
 example of industrial practice contradicting the standard.
 HTTP/1.0 specification (RFC 1945) required the client to
 perform a temporary redirect (the original describing
 phrase was "Moved Temporarily"), but popular browsers
 implemented it as a 303 See Other. Therefore, HTTP/1.1
 added status codes 303 and 307 to disambiguate between
 the two behaviors. However, majority of Web applications
 and frameworks still use the 302 status code as if it
 were the 303.

 303 See Other (since HTTP/1.1)
 The response to the request can be found under another URI
 using a GET method."

As such 302 is the best method IMHO since it is industry practiced and
supported back to HTTP/1.0.

> Maybe you should consider just doing this instead:
>
> if( !logged_in() )
> {
> require 'login.php';
> exit;
> }

I strongly disagree with this since it breaks the request/content
linking. For instance if I request:

http://l33t.pr0n.xxx/leatherAndLace.php

And you serve up a login page then I'm sure as hell not getting what I
expected. If something else should happen beyond a login request then
it's possible and VERY likely that search engines, if they can access
the content, will index the WRONG content with the URL. As such it
breaks the link/content relationship and is a bad idea.

Additionally, if there are multiple branches based on some internally
measured variable, then it is possible that parameters should be passed
to the page as would normally be done via the URL. Stuffing them into
$_GET yourself is abusive of the semantic definition of $_GET.
Additionally, users bookmarking your page will not get the same content
next time round if it is dependent on such $_GET variables.

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.  |
`'

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



Re: [PHP] sending mail from localhost

2007-06-13 Thread Daniel Brown

On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Wed, June 13, 2007 1:09 pm, Daniel Brown wrote:
> Is that a fact, Richard?  It was always my understanding that the
> raw connection to the SMTP server initiated by the PHP mail()
> functions and Sendmail required the \r\n separator for every field
> other than SUBJECT (included in the DATA part of the message body).

I don't think PHP just spits out your mail() bits to SMTP raw and
un-filtered.

It assembles the headers (and Subject), de-constructs the $to and
$from to give FROM: and RCPT TO: (or whatever it is) valid email
(only) addresses without the name parts and so on.

But I don't use SMTP, only sendmail, so maybe PHP does *not* do all
that on the SMTP version...

It for sure does it in the sendmail version, at least according to
Rasmus Lerforf about a decade ago on this list, when *I* posted a
similar question. :-)

> And it's my opinion, of course, but any SPAM filter that would
> require a reply-to header is done in bad form.  It should certainly
> require X-Mailer, but what good is a spoof-able reply-to header if the
> from header is already in place, real or unreal?

It doesn't require it, but you lose points for not having it, same as
you lose points for HTML Enhanced (cough, cough) email, and you lose
points for X-Mailer of known spam-tools, and you lose points for
having an email-only From: without something that looks like a name,
and you lose points for having various w0rds in your email and...

Having a Reply-to: to not lose that one point could be a tipping point
to get your message out of some recipients' spam box and into their
Inbox.

Any spammer could, with effort, make their spam look less like spam.

Some even go to extreme lengths to do so. :-)

But if you don't believe me, do feel free to spend less time trying it
on your server with email to yourself than it took either of us to
post here. :-)

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




   No, the rest of the stuff you said I believe (or even know as
fact) to be true, so it's all good the mail() function operations
were the only thing I wasn't certain about.  I guess when in doubt,
refer to the source if I get a chance this week, I may do just
that.

   As for the SPAM filter stuff, all of the rest makes sense, but the
Reply-to: header actually goes against the original spirit and
intention of the design.  Refer to RFC 822 Part 4 Section 1 --- the
reply-to header is intended for use as an "authenticated address."
It's not really considered "authenticated" if you put the information
in manually, right?  Or am I experiencing one of those contagious
Brain Fart [tm] moments?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Calendar

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 12:50 pm, Clint Tredway wrote:
> Is there a decent free calendar? I just need to show a few events on a
> calendar.

Having looked at a LOT of web calendars (for touring musicians) I can
say with certainty that if you only have a FEW events, a month-like
layout with boxes for every day looks really silly/ugly when there's
only one or two events in it...

A simple listing, in order, nicely formatted, will serve much better.

Oh, and here's the source I've been using for one web calendar for
over a decade:
http://uncommonground.com/events.phps

It's got some stuff you don't need, and is a one-off script rather
than a fancy full packaged widget to handle every possible calendar
output known to mankind, but you might be able to use it.

YMMV

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] sending mail from localhost

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 1:09 pm, Daniel Brown wrote:
> Is that a fact, Richard?  It was always my understanding that the
> raw connection to the SMTP server initiated by the PHP mail()
> functions and Sendmail required the \r\n separator for every field
> other than SUBJECT (included in the DATA part of the message body).

I don't think PHP just spits out your mail() bits to SMTP raw and
un-filtered.

It assembles the headers (and Subject), de-constructs the $to and
$from to give FROM: and RCPT TO: (or whatever it is) valid email
(only) addresses without the name parts and so on.

But I don't use SMTP, only sendmail, so maybe PHP does *not* do all
that on the SMTP version...

It for sure does it in the sendmail version, at least according to
Rasmus Lerforf about a decade ago on this list, when *I* posted a
similar question. :-)

> And it's my opinion, of course, but any SPAM filter that would
> require a reply-to header is done in bad form.  It should certainly
> require X-Mailer, but what good is a spoof-able reply-to header if the
> from header is already in place, real or unreal?

It doesn't require it, but you lose points for not having it, same as
you lose points for HTML Enhanced (cough, cough) email, and you lose
points for X-Mailer of known spam-tools, and you lose points for
having an email-only From: without something that looks like a name,
and you lose points for having various w0rds in your email and...

Having a Reply-to: to not lose that one point could be a tipping point
to get your message out of some recipients' spam box and into their
Inbox.

Any spammer could, with effort, make their spam look less like spam.

Some even go to extreme lengths to do so. :-)

But if you don't believe me, do feel free to spend less time trying it
on your server with email to yourself than it took either of us to
post here. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Looking for help with forms/variables and an array!

2007-06-13 Thread Richard Lynch
On Tue, June 12, 2007 6:37 pm, BSumrall wrote:
> Is there much support for it?

Support for what?

> I didn't seem to find much support on ajax.

Ajax has a few zillion uesrs/zealots/developers.

I dunno how you missed them all, but they are out there.

And Ajax doesn't really care if your XML response comes from PHP,
Perl, ASP, or trained chipmunks.

PHP has tools to spit out XML.
PHP 5 even has *nice* tools to spit out XML.
(PHP 4 has three (3) not-so-nice tools to spit out XML)

> And I think this is the win all, kill all.
> PhP seems now and has been granddaddy of Linux file handlers just next
> to
> Perl or Python.

Errr. Okay.

Perl would be granddaddy, PHP would be daddy, and Python is a mere
babe in the woods.

PHP is in its prime, probably, with the largest use-base, I think.

At least for now.

> For those whom do not touch Microsoft for anything other than play
> movies
> but survive on business systems. How well does it flip switches, move
> files,
> and changes permissions on Fedora, CentOS, and OpenBSD?

PHP works better on Fedora, CentOS, and BSD than on Windows...

I probably wouldn't even use MS to watch my movies, if the dang BFE
driver in FreeBSD didn't kernel panic with the DMA bus on my laptop
network card and over 1 G ram...
[that's WAY too much information, I know]

I don't think I actually understood your post, however.

Get some sleep and ask again. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Going from simple to super CAPTCHA

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 3:36 am, Robin Vickery wrote:
> On 12/06/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> On Tue, June 12, 2007 9:33 am, Tijnema wrote:
>> > I meant reverse order :P
>>
>> That would be pretty broken.
>>
>> There's no guarantee that browsers will present the inputs in any
>> order at all, even though they all seem (so far) to follow the
>> convention of presenting them in the order they appear in the form.
>>
>> If, however, one browser decides tomorrow to use the "tab" order
>> instead, and your code breaks because of that, it's your fault, not
>> the browser's.
>
> The HTML spec says that form elements should be presented in the order
> they appear in the document. If the browser doesn't conform to spec,
> it's not his fault.
>
> From the HTML 4.01 Specification:
>
> "The control names/values are listed in the order they appear in the
> document. The name is separated from the value by `=' and name/value
> pairs are separated from each other by `&'."

Cool!

I wonder if that came about as a result of HTML 3.x "issues"... :-)

Might be where I remembered the ordering issue from.

I guess it's okay to require HTML 4.01 or higher now, eh?...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Going from simple to super CAPTCHA

2007-06-13 Thread Richard Lynch
On Tue, June 12, 2007 10:12 pm, Jake McHenry wrote:
> Has anyone tried cracking/hacking what Microsoft has done with the
> animal
> pictures?

MS is using petfinder.com or whatever it is, as their source to know
what is a "cat" and a "dog"

So all you have to do is trick petfinder.com into giving you all the
"cat" and "dog" pictures, and store those (or their MD5).

You then can get the MS image, look it up in your db, and you've
cracked their system.

This does not seem like it would be terribly difficult, even with the
number of cats/dogs on the site.

> have the answer? Other than the completely blind, anyone can tell what
> a cat
> is, and they could even take it further by added a bark or meow or
> something

I've seen an awful lot of bad pictures (or even live animals) where
telling if it was a cat or a dog was pretty hard at first...

> similar. Can a computer tell the difference between a bark and a meow?
> Each
> animal has its unique vocal tones and cry signature... just as a human
> (who's not impersonating, which as long as its not a picture of the
> mocking
> bird...), does this help at all? Instead of relying on our own
> known
> dictionary and numbers Everyone knows about animals.. My 0.02

Given Microsoft's track record, would you really want to rely on them
for ANYTHING involving Security?

[Correct answer: No]

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Calendar

2007-06-13 Thread Jim Moseby
>
> I did that and either they are not free or suck... dont appreciate the
comment
>
> 
> On 6/13/07, Jim Moseby <[EMAIL PROTECTED]> wrote:
> > >
> > > Is there a decent free calendar? I just need to show a few events on a
> > > calendar.
> >
> > You could try your bank.  They usually have free calendars, coffee mugs,
> > pencils, etc.  ;-)
> >
> > Seriously though, type 'php calendar' into google and see what happens.

1) Please don't top-post.
2) Please include the list in  your replies.
3) Please search dictionary.com for 'humor', and learn to recognize it.
hint: A winkie ';-)' is a clue!

You will likely get a more useful response from the list members if you
include enough information.  For instance, what do you mean by 'decent'?
(One man's 'decent' is another man's 'sucks') What do you mean by
'calendar'?  Do you mean a full-blown scheduling system, or do you just want
to display a one month calendar?  Do you need a database back end, or will
the content be static?  What is the problem you are trying to solve?  etc...

Just trying to help.

JM

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



Re: [PHP] IF with multiple values for a variable

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 13:57 -0400, [EMAIL PROTECTED] wrote:
> double pipes constitutes an "OR" operation.   You can use the keyword OR as 
> well.   Also, && and AND are the same as well.
> 
> http://us.php.net/manual/en/language.operators.logical.php

They aren't exactly the same. Make sure and read the order of precedence
note. The following, for example, are not equivalent:



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.  |
`'

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 12:29 am, Paul Scott wrote:
> This was done as well to give my blog code a bit of a test drive as
> well, I had no idea how it would perform with lots of posts too, so I
> will also be able to optimize queries etc as the posts fill up.

Oh, we'll fill that sucker up pretty fast... :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] PHP list as a blog

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 12:21 am, Crayon Shin Chan wrote:
> On Wednesday 13 June 2007 12:39, Paul Scott wrote:
>
>> Our interns and students specifically. They are all dead scared of
>> joining mailing lists in general, and find that using a web based
>> prettier interface is much easier and friendlier.
>
> Not to mention slower, clumsier and more bandwidth hungry than a
> mailing
> list. It's time you did them a favour and show them that mailing lists
> are nothing to be afraid of.

Do students and interns still have quotas on their email accounts?...

Cuz I *DO* remember the days when the email quotas a University would
have prohibited subscribing to PHP mailing list...

Surely in this day and age, the quotas aren't *that* restrictive...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] PHP list as a blog

2007-06-13 Thread Richard Lynch
On Tue, June 12, 2007 11:39 pm, Paul Scott wrote:
> BTW, could I get your opinions on the blog software itself? This is
> running a CVS checkout of the Chisimba framework with the blog module
> installed.

It's a blog.

People type things.

They show up, more or less in some kind of order.

...

I don't think I'm the right guy to evaluate it, as I blog so rarely...

I am currently averaging 2 posts per year, roughly, including today's
rant about header("Location:"):

http://richardlynchblogspot.com

:-)

PS Regular readers of this list need not visit -- You've heard it all
before from me here.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?


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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Daniel Brown

On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Wed, June 13, 2007 10:07 am, Jochem Maas wrote:
> I thought beer was free ;-P
>
> joke aside I never did get the 'free as in beer' argument, has nobody
> in
> the FOSS movement ever heard of a brewery cartel?

http://en.wikipedia.org/wiki/Free_as_in_beer

I get all my beer for free.

Well, not really free.

Ya build a website for a bar, and take your pay in beer.

S.  Don't tell the IRS!

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




   If I were to do that for the bars in this area, northeast
Pennsylvania residents would swear we were under prohibition again as
each bar in turn went out of business.  Coincidentally, I will need to
put an addition on my house this fall to accommodate the growth of my
liver.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



RE: [PHP] Calendar

2007-06-13 Thread Jim Moseby
> 
> Is there a decent free calendar? I just need to show a few events on a
> calendar.

You could try your bank.  They usually have free calendars, coffee mugs,
pencils, etc.  ;-)

Seriously though, type 'php calendar' into google and see what happens.

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



Re: [PHP] sending mail from localhost

2007-06-13 Thread Daniel Brown

On 6/13/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Wed, June 13, 2007 8:51 am, Daniel Brown wrote:
> $from = "[EMAIL PROTECTED]";
> //$reply_to = "[EMAIL PROTECTED]"; // Same address, so not needed.

Some spam filters and some email clients will behave rather badly if
you don't have Reply-to: as well.

Use it.

> $headers .= "X-Mailer: PHP".phpversion()."\r\n"; // Headers ALWAYS
> need \r\n

The last header does not NEED \r\n because PHP is going to trim that
off and put \r\n\r\n between headers and body anyway.

But it's good practice to put it in there so that when you add yet
another header, you don't mistakenly leave it out where it is needed.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




   Is that a fact, Richard?  It was always my understanding that the
raw connection to the SMTP server initiated by the PHP mail()
functions and Sendmail required the \r\n separator for every field
other than SUBJECT (included in the DATA part of the message body).

   And it's my opinion, of course, but any SPAM filter that would
require a reply-to header is done in bad form.  It should certainly
require X-Mailer, but what good is a spoof-able reply-to header if the
from header is already in place, real or unreal?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 10:07 am, Jochem Maas wrote:
> I thought beer was free ;-P
>
> joke aside I never did get the 'free as in beer' argument, has nobody
> in
> the FOSS movement ever heard of a brewery cartel?

http://en.wikipedia.org/wiki/Free_as_in_beer

I get all my beer for free.

Well, not really free.

Ya build a website for a bar, and take your pay in beer.

S.  Don't tell the IRS!

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Re: create file permission problem

2007-06-13 Thread Al
Doesn't ftp_chmod() work immediately after creating your file, while the 
resource is still open?


Check the permissions for the directory.

Check the file and dir permissions with your ftp utility [e.g., WinSCP].  Or, 
write a simple script that echoes them.


It really should work, I do it frequently.

tedd wrote:

Hi Gang:

I'm sure this is obvious to most, but not to me.

I working on a virtual host.

If I want to save data in a file, I can ftpconnect(); change the 
permissions of an existing file from 0755 to 0777; write to the file; 
and change the permissions of the file back to 0755 -- no problem.


However, if a file is not there, then I can create one. However, the 
permissions of the file will be automagically set to 0600 and as such, I 
can't change them via ftpconnect(). In other words, I can't FTP in to my 
site and change the permissions of a file I created. I can delete the 
file, but that's all.


How do you guys create a file and set its permissions working on a 
virtual host via php?


Cheers,

tedd

PS: If I remember correctly, it was pretty easy in perl. Just try to 
open/write a file and if it wasn't there, it created one for you. But, 
it's been years since I did any perl stuff -- could be wrong.




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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 9:52 am, Daniel Brown wrote:
> Jason:  Tell them to stop raising the price of the damned stamps!
> Offer to take a pay cut and take one for the team I'll buy you a
> beer.

Or, better yet, raise it as high as they want, but STOP DELIVERING THE
JUNK MAIL so you can actually handle the volume and get me my REAL
mail, instead of leaving it scattered all over the friggin' city in
somebody else's mailbox!

[Sorry, Jason]

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 9:13 am, Daniel Brown wrote:
> Jay, are you also looking for the PLUS+4 ZIP code information?  Is it
> possible that the USPS (if you're looking for US addresses) has a free
> or low-cost API?

Last I checked, USPS was anything but low-cost.

Plus, they only work for US, afaik, and it is the WORLD wide web... :-)

PS

As a Chicago resident I'm a bit biased against the USPS. :-v
Chicago USPS is very consistent.
Consistenly worst in the nation.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] sending mail from localhost

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 8:51 am, Daniel Brown wrote:
> $from = "[EMAIL PROTECTED]";
> //$reply_to = "[EMAIL PROTECTED]"; // Same address, so not needed.

Some spam filters and some email clients will behave rather badly if
you don't have Reply-to: as well.

Use it.

> $headers .= "X-Mailer: PHP".phpversion()."\r\n"; // Headers ALWAYS
> need \r\n

The last header does not NEED \r\n because PHP is going to trim that
off and put \r\n\r\n between headers and body anyway.

But it's good practice to put it in there so that when you add yet
another header, you don't mistakenly leave it out where it is needed.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] IF with multiple values for a variable

2007-06-13 Thread tg-php
double pipes constitutes an "OR" operation.   You can use the keyword OR as 
well.   Also, && and AND are the same as well.

http://us.php.net/manual/en/language.operators.logical.php

-TG

= = = Original message = = =

Excellent!  Double pipes to seperate possible multiple variable values.


Thanks Daniel!


On 6/13/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On 6/13/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> > Okay, I know this has got to be easy but it's not working any way I try
> it.
> >
> > When a record is selected it opens up a new page.  My query will display
> the
> > specific results based on the type of record selected.  There can be
> > multiple values in each if.  However I am having a brain fart in my if
> > statement assigning the multiple values.
> >
> > Here is my if statement:
> >
> >  if ($type == 'T','D','L' 
> > $get_id.=" payment_request WHERE id = '$payment_id'";
> > 
> >
> > However this does not return ant results.
> > I've tried  if ($type = array('T','D','L'), if ($type ==
> array('T','D','L'),
> > if ($type == 'T,D,L'), if ($type == 'T' or 'D' or 'L'
> >
> > I also looked in the PHP manual for examples of if's and didn't find any
> > help.
> >
> > I can get it to work if I create a seperate if statement for each type
> > condition but i would prefer to not duplicate my code just to add a
> seperate
> > $type
> >
>
>Dan,
>
>Are you trying to do this?
>
> if ($type == 'T' || $type == 'D' || $type == 'L') 
>$get_id.=" payment_request WHERE id = '$payment_id'";
>
> ?>
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>


___
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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 12:39 -0500, Richard Lynch wrote:
> On Wed, June 13, 2007 10:17 am, Robert Cummings wrote:
> > On Wed, 2007-06-13 at 10:36 -0400, Guillaume Theoret wrote:
> >> Hi everyone,
> >>
> >> Can anyone recommend any good books/resources for php and mysql
> >> performance management? I'm more interested in the software
> >> development side (as opposed to server configuration) of things. I'm
> >> looking for anything that would be good to know when working on
> >> websites that get millions of hits a day.
> >>
> >> Also, if anyone knows of any resources/discussions that illustrate
> >> the
> >> relative performance of joins vs multiple selects I'd love to check
> >> it
> >> out.
> >
> > JOIN will almost always be faster by virtue of the query being
> > optimized
> > and doing the work within a single request.
> 
> In my limited experience, under shared server with seriously
> constrained resources, the exact opposite is true...
> 
> Oh, sure, for a SMALL table and an easy JOIN on straight-forward
> indexed fields, the JOIN is faster.
> 
> But every time I've ended up with a large table and a JOIN that was
> anything remotely interesting (read: complex and un-indexable) the
> server just gets swamped.
>
> And often, a simple straight-forward select to get a handful of rows
> followed by another query, or even one query per result row, was MUCH
> faster.
> 
> It's entirely possible that I just don't know SQL well enough to get
> the schema and indexing right, but I try to index the "obvious" fields
> that will be used in the join.

Maybe your query is poorly formed. Generally speaking anything that you
need to search upon should be indexed provided it has a high enough
cardinality. As such a query will usually be optimized to retrieve data
using the indexed fields. If the fields aren't indexed then even a
second query to retrieve the complimentary data set will still be
required to do an exhaustive search without the benefit of indexing. 

> This also may not even be applicable to a site that scales up with the
> kinds of resources you'd throw at that.

Hence the reason I mentioned that using multiple selects is more
horizontally scalable :)

> But I'd certainly recommend writing small simple crude test code with
> a dedicated testing server and simulated real life load conditions
> rather than just "guessing" at what might be fastest.
> 
> An hour's testing could save you weeks/months of development in this
> case.

For certain, if you expect such a large load it's in your interest to
determine what will be the most resource and cost effective approach.

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.  |
`'

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 7:45 am, Jay Blanchard wrote:
> I am doing some searching and researching but I also know that this
> world famous group may have some insight and resources that I can
> benefit from.
>
> I am looking for an address validation database and API to use with
> our
> retail applications (does not have to be free). I would prefer to be
> able to buy data according to postal code. I will likely use AJAX to
> take an address that is input into the system and find a similar or
> better address and then offer the user the opportunity to use the
> returned address or the one that they put into the system. You have
> all
> seen this in operation if you use maps.google.com when it does not
> flat
> out recognize the address.
>
> Is anyone aware of anything like this that they can point me to?
>
> Thanks very much in advance.

Both maps.google.com and Yahoo! Maps allow you do use their internal
address lookup functionality, just like they do it, and it returns a
suggested address as well as how "sure" they are of the result (sort
of) by the answer being graded at levesl like "country" "state" "city"
etc.

Naturally, they both use different coding schemes, and you have to be
careful about what you use as input.

But if you're looking to mimic the functionality of Google maps, you
should use Google maps API to mimic the functionality of Google maps.
:-)

Google Maps is "free" under certain conditions, and costs $10K/year
under other conditions.

Yahoo! Maps hasn't announced pricing yet (afaik) and reserves the
right to slap advertisements into a map, as I recall. (Or maybe it was
Google that reserved the right to advertise?)

At any rate, between the two of them, you should be able to get this
done for "free" for the forseeable future.

PS If Google and/or Yahoo! don't get the address right, I'd be pretty
surprised if any other software does it any better Though I guess
there are geo-spatial mailing lists that could advise you better on
that part.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] IF with multiple values for a variable

2007-06-13 Thread tg-php
Could try something like this:

$types = array('T', 'D', 'L');

if (in_array($type, $types)) {
  // do something
}

But that's going to just check to see if $type is one of the valid types you're 
looking for.

You might try something like switch.

switch ($type) {
  case 'T':
// Output 'T' record type
break;
  case 'D':
// Output 'D' record type
break;
  case 'L':
// Output 'L' record type
break;
  default:
break;
}


"switch" works really well when you have multiple "if" scenarios and don't want 
to keep doing a ton of if.. elseif... elseif...elseif...  for simple 
comparisons.


You can even use it for more complicated comparisons:


switch (true) {
  case $type == 'T':
break;
  case $type == 'D' and $flavor <> 'grape':
break;
  default;
break;
}

the "default" section is what's processed if no critera are met.

Also, if you want to use the same criteria for multiple conditions, or slight 
variations, you can do that by removing 'break' codes:


switch ($type) {
  case 'T':
  case 'D':
// Do something if $type is either T or D
break;
  case 'L':
// Do something L specific
  case 'R':
// Do something if $type is L or R (passes through from L condition because 
break was removed)
break;
  default:
break;
}


More reading here:

http://us.php.net/switch

Hope that helps.

-TG

= = = Original message = = =

Okay, I know this has got to be easy but it's not working any way I try it.

When a record is selected it opens up a new page.  My query will display the
specific results based on the type of record selected.  There can be
multiple values in each if.  However I am having a brain fart in my if
statement assigning the multiple values.

Here is my if statement:

 if ($type == 'T','D','L' 
$get_id.=" payment_request WHERE id = '$payment_id'";


However this does not return ant results.
I've tried  if ($type = array('T','D','L'), if ($type == array('T','D','L'),
if ($type == 'T,D,L'), if ($type == 'T' or 'D' or 'L'

I also looked in the PHP manual for examples of if's and didn't find any
help.

I can get it to work if I create a seperate if statement for each type
condition but i would prefer to not duplicate my code just to add a seperate
$type


___
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



[PHP] Calendar

2007-06-13 Thread Clint Tredway

Is there a decent free calendar? I just need to show a few events on a
calendar.

--
I am not a diabetic, I have diabetes
my blog - http://grumpee.instantspot.com/blog

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



Re: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 8:13 am, Richard Davey wrote:
> Hi all,
>
> Can anyone think of a more elegant way of achieving the following?
>
>  $flags = array();

$flags = 0;

>
> if ($allow_fraction)

//Should we warn you that $allow_fraction is not actually defined?...
//You don't have register_globals on, do you?

> {
> $flags[] = FILTER_FLAG_ALLOW_FRACTION;

$flags |= FILTER_FLAG_ALLOW_FRACTION;

> if (count($flags) > 0)

if ($flags > 0){

> {
> $c = '$c = ' . implode('|', $flags) . ';';
> eval($c);
> $filter['flags'] = $c;

$filter = $flags; // :-)

> }
> ?>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 13:31 -0400, Guillaume Theoret wrote:
> Thanks for the response.
> 
> On 6/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > On Wed, 2007-06-13 at 10:36 -0400, Guillaume Theoret wrote:
> > > Hi everyone,
> > >
> > > Can anyone recommend any good books/resources for php and mysql
> > > performance management? I'm more interested in the software
> > > development side (as opposed to server configuration) of things. I'm
> > > looking for anything that would be good to know when working on
> > > websites that get millions of hits a day.
> > >
> > > Also, if anyone knows of any resources/discussions that illustrate the
> > > relative performance of joins vs multiple selects I'd love to check it
> > > out.
> >
> > JOIN will almost always be faster by virtue of the query being optimized
> > and doing the work within a single request.
> 
> Really? I thought the way it worked was that when you joined 2 tables
> it needed to create every row combination applicable and then apply
> the where clause. In large tables wouldn't this be slower? It's these
> kinds of optimizations and when the kick in, etc that I don't know
> much about.

That depends on the kind of join done. Generally speaking if you use the
proper type of join for your needs then the DB should be faster at
joining. For instance most of my joins are LEFT joins.

> In our application we wrote an abstraction layer with lazy loading.
> (eg: If a User has a Profile the db users table has a profile_id and
> we create a ProxyProfile that only has an id and will look up its
> other attributes in the db if ever needed and then replace its
> reference by a full Profile object.) Because of this, so far the
> entire app only has 1 join because the other select(s) will only be
> done if and when they're needed. I'm certain this is faster in the
> average case but I wanted to know which is generally faster in case I
> later profile the code and see that in some cases the dependent item
> is pretty much always loaded.

For your example this sounds like the way to go. Needlessly joining data
you don't need is a waste of resources. It's best to join the data only
when you actually need the extra information pulled in from the
additional table(s).

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.  |
`'

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



Re: [PHP] create file permission problem

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 13:13 -0400, tedd wrote:
> Hi Gang:
> 
> I'm sure this is obvious to most, but not to me.
> 
> I working on a virtual host.
> 
> If I want to save data in a file, I can ftpconnect(); change the 
> permissions of an existing file from 0755 to 0777; write to the file; 
> and change the permissions of the file back to 0755 -- no problem.
> 
> However, if a file is not there, then I can create one. However, the 
> permissions of the file will be automagically set to 0600 and as 
> such, I can't change them via ftpconnect(). In other words, I can't 
> FTP in to my site and change the permissions of a file I created. I 
> can delete the file, but that's all.
> 
> How do you guys create a file and set its permissions working on a 
> virtual host via php?

See the following functions:

http://ca.php.net/manual/en/function.umask.php
http://ca.php.net/manual/en/function.chmod.php

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.  |
`'


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



Re: [PHP] IF with multiple values for a variable

2007-06-13 Thread Dan Shirah

Excellent!  Double pipes to seperate possible multiple variable values.


Thanks Daniel!


On 6/13/07, Daniel Brown <[EMAIL PROTECTED]> wrote:


On 6/13/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> Okay, I know this has got to be easy but it's not working any way I try
it.
>
> When a record is selected it opens up a new page.  My query will display
the
> specific results based on the type of record selected.  There can be
> multiple values in each if.  However I am having a brain fart in my if
> statement assigning the multiple values.
>
> Here is my if statement:
>
>  if ($type == 'T','D','L' {
> $get_id.=" payment_request WHERE id = '$payment_id'";
> }
>
> However this does not return ant results.
> I've tried  if ($type = array('T','D','L'), if ($type ==
array('T','D','L'),
> if ($type == 'T,D,L'), if ($type == 'T' or 'D' or 'L'
>
> I also looked in the PHP manual for examples of if's and didn't find any
> help.
>
> I can get it to work if I create a seperate if statement for each type
> condition but i would prefer to not duplicate my code just to add a
seperate
> $type
>

   Dan,

   Are you trying to do this?



--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



Re: [PHP] Persistent MySQL Connection

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 8:53 am, PHP Mailing List wrote:
> I currently running my php as cgi as it is more controllable in shared
> hosting, the drawback is I cannot use mysql persistent connection so
> mysql_pconnect() function is not an option. Is there any mysql
> connection pool product for php running as cgi ?

The MySQL list could probably recommend several MySQL connection
pooling software packages, with PHP/cgi being largely irrelevant to
the question...

It's incredibly unlikely that your shared hosting server will actually
install any of them, mind you...

Persistent connections is probably not the road you should be on in
the first place.

How long are your connections taking?

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] IF with multiple values for a variable

2007-06-13 Thread Daniel Brown

On 6/13/07, Dan Shirah <[EMAIL PROTECTED]> wrote:

Okay, I know this has got to be easy but it's not working any way I try it.

When a record is selected it opens up a new page.  My query will display the
specific results based on the type of record selected.  There can be
multiple values in each if.  However I am having a brain fart in my if
statement assigning the multiple values.

Here is my if statement:

 if ($type == 'T','D','L' {
$get_id.=" payment_request WHERE id = '$payment_id'";
}

However this does not return ant results.
I've tried  if ($type = array('T','D','L'), if ($type == array('T','D','L'),
if ($type == 'T,D,L'), if ($type == 'T' or 'D' or 'L'

I also looked in the PHP manual for examples of if's and didn't find any
help.

I can get it to work if I create a seperate if statement for each type
condition but i would prefer to not duplicate my code just to add a seperate
$type



   Dan,

   Are you trying to do this?



--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 10:17 am, Robert Cummings wrote:
> On Wed, 2007-06-13 at 10:36 -0400, Guillaume Theoret wrote:
>> Hi everyone,
>>
>> Can anyone recommend any good books/resources for php and mysql
>> performance management? I'm more interested in the software
>> development side (as opposed to server configuration) of things. I'm
>> looking for anything that would be good to know when working on
>> websites that get millions of hits a day.
>>
>> Also, if anyone knows of any resources/discussions that illustrate
>> the
>> relative performance of joins vs multiple selects I'd love to check
>> it
>> out.
>
> JOIN will almost always be faster by virtue of the query being
> optimized
> and doing the work within a single request.

In my limited experience, under shared server with seriously
constrained resources, the exact opposite is true...

Oh, sure, for a SMALL table and an easy JOIN on straight-forward
indexed fields, the JOIN is faster.

But every time I've ended up with a large table and a JOIN that was
anything remotely interesting (read: complex and un-indexable) the
server just gets swamped.

And often, a simple straight-forward select to get a handful of rows
followed by another query, or even one query per result row, was MUCH
faster.

It's entirely possible that I just don't know SQL well enough to get
the schema and indexing right, but I try to index the "obvious" fields
that will be used in the join.

This also may not even be applicable to a site that scales up with the
kinds of resources you'd throw at that.

But I'd certainly recommend writing small simple crude test code with
a dedicated testing server and simulated real life load conditions
rather than just "guessing" at what might be fastest.

An hour's testing could save you weeks/months of development in this
case.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] create file permission problem

2007-06-13 Thread Daniel Brown

On 6/13/07, tedd <[EMAIL PROTECTED]> wrote:

Hi Gang:

I'm sure this is obvious to most, but not to me.

I working on a virtual host.

If I want to save data in a file, I can ftpconnect(); change the
permissions of an existing file from 0755 to 0777; write to the file;
and change the permissions of the file back to 0755 -- no problem.

However, if a file is not there, then I can create one. However, the
permissions of the file will be automagically set to 0600 and as
such, I can't change them via ftpconnect(). In other words, I can't
FTP in to my site and change the permissions of a file I created. I
can delete the file, but that's all.

How do you guys create a file and set its permissions working on a
virtual host via php?

Cheers,

tedd

PS: If I remember correctly, it was pretty easy in perl. Just try to
open/write a file and if it wasn't there, it created one for you.
But, it's been years since I did any perl stuff -- could be wrong.

--
---
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




   Two quick questions

   Is the PHP script running ftpconnect() using a valid FTP account
with privileges to own/share a file on the system?

   How are you creating the file on the FTP server?

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



RE: Re[6]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Ford, Mike


> From: Richard Davey [mailto:[EMAIL PROTECTED]
> Sent: Wed 13/06/2007 15:19
> To: PHP List
> 
> > Hi Robert,
> 
> Wednesday, June 13, 2007, 3:15:39 PM, you wrote:
> 
> > It's terribly verbose and inefficient...
> 
> >  
> > $filter['flags'] = 0;
> 
> > if( $allow_fraction )
> > {
> > $filter['flags'] |= FILTER_FLAG_ALLOW_FRACTION;
> > }
> 
> > if( $allow_thousand )
> > {
> > $filter['flags'] |= FILTER_FLAG_ALLOW_THOUSAND;
> > }
> 
> > if( $allow_scientific )
> > {
> > $filter['flags'] |= FILTER_FLAG_ALLOW_SCIENTIFIC;
> > }
> 
> ?>>
> 
> I don't think it's *terribly* verbose, as it has good sentence structure
> to it, but your version is certainly more efficient, hence I've
> swapped to that. Any other takers? ;)

Well, I don't know about more efficient but I'd be terribly tempted to express 
it like this:

  $filter['flags'] = $allow_fraction   ? FILTER_FLAG_ALLOW_FRACTION : 0
   | $allow_thousand   ? FILTER_FLAG_ALLOW_THOUSAND : 0
   | $allow_scientific ? FILTER_FLAG_ALLOW_SCIENTIFIC : 0;

Whether you think this is more readable and/or less verbose probably depends on 
personal taste! ;)
 
- 
Mike Ford,  Electronic Information Services Adviser, 
Learning Support Services, Learning & Information Services, 
JG125, James Graham Building, Leeds Metropolitan University, 
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom 
Email: [EMAIL PROTECTED] 
Tel: +44 113 812 4730  Fax:  +44 113 812 3211 



To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


[PHP] IF with multiple values for a variable

2007-06-13 Thread Dan Shirah

Okay, I know this has got to be easy but it's not working any way I try it.

When a record is selected it opens up a new page.  My query will display the
specific results based on the type of record selected.  There can be
multiple values in each if.  However I am having a brain fart in my if
statement assigning the multiple values.

Here is my if statement:

if ($type == 'T','D','L' {
   $get_id.=" payment_request WHERE id = '$payment_id'";
   }

However this does not return ant results.
I've tried  if ($type = array('T','D','L'), if ($type == array('T','D','L'),
if ($type == 'T,D,L'), if ($type == 'T' or 'D' or 'L'

I also looked in the PHP manual for examples of if's and didn't find any
help.

I can get it to work if I create a seperate if statement for each type
condition but i would prefer to not duplicate my code just to add a seperate
$type


Re: [PHP] php / mysql performance resources

2007-06-13 Thread Guillaume Theoret

Thanks for the response.

On 6/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:

On Wed, 2007-06-13 at 10:36 -0400, Guillaume Theoret wrote:
> Hi everyone,
>
> Can anyone recommend any good books/resources for php and mysql
> performance management? I'm more interested in the software
> development side (as opposed to server configuration) of things. I'm
> looking for anything that would be good to know when working on
> websites that get millions of hits a day.
>
> Also, if anyone knows of any resources/discussions that illustrate the
> relative performance of joins vs multiple selects I'd love to check it
> out.

JOIN will almost always be faster by virtue of the query being optimized
and doing the work within a single request.


Really? I thought the way it worked was that when you joined 2 tables
it needed to create every row combination applicable and then apply
the where clause. In large tables wouldn't this be slower? It's these
kinds of optimizations and when the kick in, etc that I don't know
much about.

In our application we wrote an abstraction layer with lazy loading.
(eg: If a User has a Profile the db users table has a profile_id and
we create a ProxyProfile that only has an id and will look up its
other attributes in the db if ever needed and then replace its
reference by a full Profile object.) Because of this, so far the
entire app only has 1 join because the other select(s) will only be
done if and when they're needed. I'm certain this is faster in the
average case but I wanted to know which is generally faster in case I
later profile the code and see that in some cases the dependent item
is pretty much always loaded.



JOIN couples two table together.

JOIN simplifies the data retrieval and code.

MULTIPLE SELECTS allows you to join the data yourself, possibly almost
as fast as the database.

MULTIPLE SELECTS allows the tables to reside in different locations.

MULTIPLE SELECTS can be faster than a JOIN if your database is under
heavy load and you place the tables on different servers allowing the
PHP process to do the joining work. PHP processes scale horizontally
better than database servers.


The db will be under heavy load (once we deploy) but we don't yet
intend on distributing the database. We did however plan for it since
in the scenario I described above we just need to create a different
db connection for a different table. We could theoretically have as
many different db servers as tables (except for that one join of 2
tables).



MULTIPLE SELECTS are usually add complexity to your code.


We dealt with this in our design.. The actual front-end functionality
is all simply object-oriented programming so I can muck around as much
as I want with the ORM layer without affecting any of anyone else's
code. (As long as I don't change the published interface of course!)



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.  |
`'




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



Re: [PHP] Is this code thread safe?

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 10:52 am, Christian Cantrell wrote:
> I'm pretty sure this code is thread safe, but I just want to be 100%
> sure.
> I have a class called ViewHelper with a static function called
> is_signed_in.
>  All it does is check the session for the existence of a particular
> variable, and if it's there, it returns true, otherwise false.
>
> Since the function is static, is there any way this code is not thread
> safe?
>  Is there any way I could be checking someone else's session if the
> requests
> are concurrent?

Well, I'm not sure how your ViewHelper could possibly screw things up,
but the $_SESSION variable is already thread-safe, unless you've
hacked up a custom session handler that isn't thread-safe...  In which
case you've got bigger problems than just this one function. :-v

$_SESSION gets a lock on the session data file at session_start which
is not released until session_*close

So instead off all that OOP stuff, if you just did:
if (isset($_SESSION['is_logged_in'])){
}
and used unset($_SESSION['is_logged_in']) to log somebody out, well,
you'd pretty much have the same functionality in a lot less lines of
code...

But, hey, I'm sure the ViewHelper has a lot of other Added Value, right?

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] create file permission problem

2007-06-13 Thread tedd

Hi Gang:

I'm sure this is obvious to most, but not to me.

I working on a virtual host.

If I want to save data in a file, I can ftpconnect(); change the 
permissions of an existing file from 0755 to 0777; write to the file; 
and change the permissions of the file back to 0755 -- no problem.


However, if a file is not there, then I can create one. However, the 
permissions of the file will be automagically set to 0600 and as 
such, I can't change them via ftpconnect(). In other words, I can't 
FTP in to my site and change the permissions of a file I created. I 
can delete the file, but that's all.


How do you guys create a file and set its permissions working on a 
virtual host via php?


Cheers,

tedd

PS: If I remember correctly, it was pretty easy in perl. Just try to 
open/write a file and if it wasn't there, it created one for you. 
But, it's been years since I did any perl stuff -- could be wrong.


--
---
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] Dom appendChild strips trailing text from within a node

2007-06-13 Thread Eric Wiener
I am trying to modify a node name and it mostly works, except that
appendChild seems to strip the text that FOLLOWS after a subnode.
Leading text and subnodes appear to be retained perfectly, just not text
trailing the subnode. I tried using cloneNode, but that discarded the
children even when I sent "true" as an argument.

 

$html='div1 bold1 italic1underline1 bold2
div2bold3 underline';

 

$dom = new DomDocument;

$dom->loadHTML($html);

 

$nodes = $dom->getElementsByTagName('b');

foreach ($nodes as $oldNode) {

$newNode = $dom->createElement('strong');

foreach($oldNode->childNodes as $thisOldNode) {

if ($thisOldNode->nodeName == '#text') {

$newNode->nodeValue .= $thisOldNode->nodeValue;

} else {

//  appendChild seems to cause the issue  //

$newNode->appendChild($thisOldNode);

}

}

$oldNode->parentNode->replaceChild($newNode, $oldNode);

}

//for debugging:

echo nl2br(htmlentities($html)) . '';

echo nl2br(htmlentities(str_replace(array('', '',
''), '', strstr($dom->saveXML(), '';

 

/*

Should return:

div1 bold1 italic1underline1 bold2
div2bold3 underline

 

Instead returns:

div1 bold1 italic1underline1
div2bold3 underline

*/



Re: [PHP] Redirecting to a parent page

2007-06-13 Thread Richard Lynch
On Wed, June 13, 2007 11:12 pm, Yamil Ortega wrote:
> Lets say that I have the next structure on my web directory
>
> /file1.php
>
> /procces/file2.php
>
> /file3.php
>
> So, when I see the file1.php on the browser I  see the page in this
> route
>
> http://localhost/apache2/file1.php
>
>  I have a button that sends information to the /process/file2.php.
> When the
> process is finished, I have to come back to the parent directory page.
>
> Im using this instruction
>
> header( refresh:'3'; url=./file3.php);

You need a COMPLETE url here, not just relative pathname, almost for
sure.

> But I got the error that in http://localhost/file3.php does not exists
> any
> page
>
> If I use this
>
> header( refresh:'3'; url=file3.php);
>
> I got the error that in http://localchost/procces/file3.php does not
> exists
>
> So, how can I redirect the file2.php to the file3.php in the parent
> directory?

You also should consider just doing:
include('file3.php');
instead of bouncing the user back-and-forth between the server/client
in slow HTTP connnections...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 11:58 -0400, Daniel Brown wrote:
> 
> Oh, and Zoltán and Robert --- just wanted you guys to know that I
> hate you both.
> 
> I miss the days of working from home, too

Drown your sorrows in beer... oh wait!! *teehee* ;)

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.  |
`'

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



Re: [PHP] Is this code thread safe?

2007-06-13 Thread Daniel Brown

On 6/13/07, Christian Cantrell <[EMAIL PROTECTED]> wrote:

I'm pretty sure this code is thread safe, but I just want to be 100% sure.
I have a class called ViewHelper with a static function called is_signed_in.
 All it does is check the session for the existence of a particular
variable, and if it's there, it returns true, otherwise false.

Since the function is static, is there any way this code is not thread safe?
 Is there any way I could be checking someone else's session if the requests
are concurrent?

Thanks,
Christian



   That should be perfectly alright, as each thread should have its own SESSID.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Daniel Brown

On 6/13/07, Daniel Brown <[EMAIL PROTECTED]> wrote:

On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> On Jun 13, 2007, at 11:10 AM, Daniel Brown wrote:
>
> > On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >>
> >> On Jun 13, 2007, at 10:52 AM, Daniel Brown wrote:
> >>
> >> >>
> >> >> Hi Jay,
> >> >>
> >> >> I actually work with the post office on my day job, we do
> >> presorted
> >> >> mailings with them. And I can tell you that the post office
> >> does not
> >> >> sell any addresses to private individuals. For the mailings we do
> >> >> where we need to get a list we have to go to a third party to
> >> get the
> >> >> list.
> >> >>
> >> >> The stuff you're looking at is probably the CASS software, or
> >> maybe
> >> >> Delivery Point Validation. Both of which you run on your current
> >> >> mailing list to make sure you qualify for the cheaper postage
> >> rates.
> >> >> I can also tell you that the CASS software costs about $1,000 a
> >> year
> >> >> for access to match your addresses against the database. :) But I
> >> >> don't think it really does what you are looking for.
> >> >>
> >> >> You may want to look into a third party place like InfoUSA[1]
> >> since
> >> >> they sell the addresses (We use them sometimes in fact) they
> >> may be
> >> >> able to do what you are looking for.
> >> >>
> >> >> [1] http://www.InfoUSA.com
> >> >>
> >> >>
> >> >>
> >> >>
> >> >
> >> >Jason:  Tell them to stop raising the price of the damned
> >> stamps!
> >> > Offer to take a pay cut and take one for the team I'll buy
> >> you a
> >> > beer.
> >> If only it was that easy... :) And actually if you want to send 200
> >> pieces or more I can knock your postage down somewhere around 6.6¢
> >> for the right type of mailing :)
> >>
> >> It's called work share, I do the work, they don't charge as much :)
> >> Now Where's my Beer? :)
> >>
> >>
> >
> >You help me when it comes time to sending out the invitations for
> > my wedding in the spring and you're invited --- open bar with
> > top-shelf stuff!
> >
>
> You get over 200 and we can definitely work something out, as long as
> your pride is okay with doing a presorted mailing (Mine wasn't) I can
> guarantee that all the pieces will get there. And get there quickly
> too. How does an average of about 34.1¢/piece sound as long as you
> stay under an ounce? :)
>
>
>
> > --
> > Daniel P. Brown
> > [office] (570-) 587-7080 Ext. 272
> > [mobile] (570-) 766-8107
> >
>
>

Well, we won't be sending until February or so, at the earliest,
but it sounds good to me.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



   Oh, and Zoltán and Robert --- just wanted you guys to know that I
hate you both.

   I miss the days of working from home, too

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Daniel Brown

On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:


On Jun 13, 2007, at 11:10 AM, Daniel Brown wrote:

> On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
>>
>> On Jun 13, 2007, at 10:52 AM, Daniel Brown wrote:
>>
>> >>
>> >> Hi Jay,
>> >>
>> >> I actually work with the post office on my day job, we do
>> presorted
>> >> mailings with them. And I can tell you that the post office
>> does not
>> >> sell any addresses to private individuals. For the mailings we do
>> >> where we need to get a list we have to go to a third party to
>> get the
>> >> list.
>> >>
>> >> The stuff you're looking at is probably the CASS software, or
>> maybe
>> >> Delivery Point Validation. Both of which you run on your current
>> >> mailing list to make sure you qualify for the cheaper postage
>> rates.
>> >> I can also tell you that the CASS software costs about $1,000 a
>> year
>> >> for access to match your addresses against the database. :) But I
>> >> don't think it really does what you are looking for.
>> >>
>> >> You may want to look into a third party place like InfoUSA[1]
>> since
>> >> they sell the addresses (We use them sometimes in fact) they
>> may be
>> >> able to do what you are looking for.
>> >>
>> >> [1] http://www.InfoUSA.com
>> >>
>> >>
>> >>
>> >>
>> >
>> >Jason:  Tell them to stop raising the price of the damned
>> stamps!
>> > Offer to take a pay cut and take one for the team I'll buy
>> you a
>> > beer.
>> If only it was that easy... :) And actually if you want to send 200
>> pieces or more I can knock your postage down somewhere around 6.6¢
>> for the right type of mailing :)
>>
>> It's called work share, I do the work, they don't charge as much :)
>> Now Where's my Beer? :)
>>
>>
>
>You help me when it comes time to sending out the invitations for
> my wedding in the spring and you're invited --- open bar with
> top-shelf stuff!
>

You get over 200 and we can definitely work something out, as long as
your pride is okay with doing a presorted mailing (Mine wasn't) I can
guarantee that all the pieces will get there. And get there quickly
too. How does an average of about 34.1¢/piece sound as long as you
stay under an ounce? :)



> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>




   Well, we won't be sending until February or so, at the earliest,
but it sounds good to me.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



[PHP] Is this code thread safe?

2007-06-13 Thread Christian Cantrell

I'm pretty sure this code is thread safe, but I just want to be 100% sure.
I have a class called ViewHelper with a static function called is_signed_in.
All it does is check the session for the existence of a particular
variable, and if it's there, it returns true, otherwise false.

Since the function is static, is there any way this code is not thread safe?
Is there any way I could be checking someone else's session if the requests
are concurrent?

Thanks,
Christian


Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Jason Pruim


On Jun 13, 2007, at 11:10 AM, Daniel Brown wrote:


On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:


On Jun 13, 2007, at 10:52 AM, Daniel Brown wrote:

>>
>> Hi Jay,
>>
>> I actually work with the post office on my day job, we do  
presorted
>> mailings with them. And I can tell you that the post office  
does not

>> sell any addresses to private individuals. For the mailings we do
>> where we need to get a list we have to go to a third party to  
get the

>> list.
>>
>> The stuff you're looking at is probably the CASS software, or  
maybe

>> Delivery Point Validation. Both of which you run on your current
>> mailing list to make sure you qualify for the cheaper postage  
rates.
>> I can also tell you that the CASS software costs about $1,000 a  
year

>> for access to match your addresses against the database. :) But I
>> don't think it really does what you are looking for.
>>
>> You may want to look into a third party place like InfoUSA[1]  
since
>> they sell the addresses (We use them sometimes in fact) they  
may be

>> able to do what you are looking for.
>>
>> [1] http://www.InfoUSA.com
>>
>>
>>
>>
>
>Jason:  Tell them to stop raising the price of the damned  
stamps!
> Offer to take a pay cut and take one for the team I'll buy  
you a

> beer.
If only it was that easy... :) And actually if you want to send 200
pieces or more I can knock your postage down somewhere around 6.6¢
for the right type of mailing :)

It's called work share, I do the work, they don't charge as much :)
Now Where's my Beer? :)




   You help me when it comes time to sending out the invitations for
my wedding in the spring and you're invited --- open bar with
top-shelf stuff!



You get over 200 and we can definitely work something out, as long as  
your pride is okay with doing a presorted mailing (Mine wasn't) I can  
guarantee that all the pieces will get there. And get there quickly  
too. How does an average of about 34.1¢/piece sound as long as you  
stay under an ounce? :)





--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107



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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 17:16 +0200, Zoltán Németh wrote:
> 2007. 06. 13, szerda keltezéssel 10.52-kor Daniel Brown ezt írta:
> > On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> > 
> > Jason:  Tell them to stop raising the price of the damned stamps!
> > Offer to take a pay cut and take one for the team I'll buy you a
> > beer.
> > 
> > Zoltán:  Trade with me.  I've been here for less than two hours
> > and I'm ready to go home.  I'll buy you a beer.
> 
> hmm sorry I prefer to go now and buy myself a beer since working hours
> is over now for me :D

I work from home... the beer is in the fridge :)

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.  |
`'

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



Re: [PHP] php / mysql performance resources

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 10:36 -0400, Guillaume Theoret wrote:
> Hi everyone,
> 
> Can anyone recommend any good books/resources for php and mysql
> performance management? I'm more interested in the software
> development side (as opposed to server configuration) of things. I'm
> looking for anything that would be good to know when working on
> websites that get millions of hits a day.
> 
> Also, if anyone knows of any resources/discussions that illustrate the
> relative performance of joins vs multiple selects I'd love to check it
> out.

JOIN will almost always be faster by virtue of the query being optimized
and doing the work within a single request.

JOIN couples two table together.

JOIN simplifies the data retrieval and code.

MULTIPLE SELECTS allows you to join the data yourself, possibly almost
as fast as the database.

MULTIPLE SELECTS allows the tables to reside in different locations.

MULTIPLE SELECTS can be faster than a JOIN if your database is under
heavy load and you place the tables on different servers allowing the
PHP process to do the joining work. PHP processes scale horizontally
better than database servers.

MULTIPLE SELECTS are usually add complexity to your code.

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.  |
`'

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Zoltán Németh
2007. 06. 13, szerda keltezéssel 10.52-kor Daniel Brown ezt írta:
> On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >
> > On Jun 13, 2007, at 10:19 AM, Jay Blanchard wrote:
> >
> > > [snip]
> > > Someone needs to smack Robert.  He's off on a tangent again.  ;-P
> > > [/snip]
> > >
> > > Nope, that is normal.
> > >
> > > [snip]
> > >  Honestly, me either.  I've built ZIP-code-to-longitude/latitude
> > > points, but nothing with address suggestion.
> > >
> > > Jay, are you also looking for the PLUS+4 ZIP code information?  Is it
> > > possible that the USPS (if you're looking for US addresses) has a free
> > > or low-cost API?
> > > [/snip]
> > >
> > > I am looking at their address matching service now and trying to
> > > determine how much it costs
> >
> > Hi Jay,
> >
> > I actually work with the post office on my day job, we do presorted
> > mailings with them. And I can tell you that the post office does not
> > sell any addresses to private individuals. For the mailings we do
> > where we need to get a list we have to go to a third party to get the
> > list.
> >
> > The stuff you're looking at is probably the CASS software, or maybe
> > Delivery Point Validation. Both of which you run on your current
> > mailing list to make sure you qualify for the cheaper postage rates.
> > I can also tell you that the CASS software costs about $1,000 a year
> > for access to match your addresses against the database. :) But I
> > don't think it really does what you are looking for.
> >
> > You may want to look into a third party place like InfoUSA[1] since
> > they sell the addresses (We use them sometimes in fact) they may be
> > able to do what you are looking for.
> >
> > [1] http://www.InfoUSA.com
> >
> >
> >
> >
> 
> Jason:  Tell them to stop raising the price of the damned stamps!
> Offer to take a pay cut and take one for the team I'll buy you a
> beer.
> 
> Zoltán:  Trade with me.  I've been here for less than two hours
> and I'm ready to go home.  I'll buy you a beer.

hmm sorry I prefer to go now and buy myself a beer since working hours
is over now for me :D

greets
Zoltán Németh

> 
> Robert:  I need to borrow a few bucks so that I can buy Jason and
> Zoltán a beer.
> 
> -- 
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
> 

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



[PHP] Google Talk Integration

2007-06-13 Thread Not�cias PHP
Hi,

In the site http://www.imified.com/api/ it has a API that it makes the 
integration of the GTALK with any programming language.

But I am not obtaining to make script php to send a message for my user in 
google talk. Somebody already used this api?

Hermes Alves
www.argohost.net 

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



Re: Re[8]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 15:59 +0100, Richard Davey wrote:
> Hi Robert,
> 
> Wednesday, June 13, 2007, 3:37:38 PM, you wrote:
> 
> > Personally I hate constants (can't use non-scalar values so why get used
> > ot them... also they're just another point for name collision) so if it
> > were my own code I'd do something more like the following:
> 
> Sure, but the filter extension uses them, which is where they come
> from. They aren't of my own creation, and I cannot assume that the
> values assigned to them won't change in the future, so can't hardcode
> my way around them.

That's an excellent reason to use constants :)

> I don't have anything against side-wide constants myself (no worse
> than an array shoved into $GLOBALS) but PHP seems to be moving more
> and more towards the use of constants within extensions as function
> parameters, PDO being another popular culprit that springs to mind.

Yeah, I consider constants and globals to be very similar. For the most
part I only use globals as site-wide configuration directives and even
then I usually double nest them according to what they modify. It is
quite reasonable that extensions would prefer constants over globals
though since the values as far as they are concerned should be
read-only.

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.  |
`'

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Daniel Brown

On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:


On Jun 13, 2007, at 10:52 AM, Daniel Brown wrote:

>>
>> Hi Jay,
>>
>> I actually work with the post office on my day job, we do presorted
>> mailings with them. And I can tell you that the post office does not
>> sell any addresses to private individuals. For the mailings we do
>> where we need to get a list we have to go to a third party to get the
>> list.
>>
>> The stuff you're looking at is probably the CASS software, or maybe
>> Delivery Point Validation. Both of which you run on your current
>> mailing list to make sure you qualify for the cheaper postage rates.
>> I can also tell you that the CASS software costs about $1,000 a year
>> for access to match your addresses against the database. :) But I
>> don't think it really does what you are looking for.
>>
>> You may want to look into a third party place like InfoUSA[1] since
>> they sell the addresses (We use them sometimes in fact) they may be
>> able to do what you are looking for.
>>
>> [1] http://www.InfoUSA.com
>>
>>
>>
>>
>
>Jason:  Tell them to stop raising the price of the damned stamps!
> Offer to take a pay cut and take one for the team I'll buy you a
> beer.
If only it was that easy... :) And actually if you want to send 200
pieces or more I can knock your postage down somewhere around 6.6¢
for the right type of mailing :)

It's called work share, I do the work, they don't charge as much :)
Now Where's my Beer? :)




   You help me when it comes time to sending out the invitations for
my wedding in the spring and you're invited --- open bar with
top-shelf stuff!

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Jochem Maas
Daniel Brown wrote:
> On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
>>

...

>>
>>
> 
>Jason:  Tell them to stop raising the price of the damned stamps!
> Offer to take a pay cut and take one for the team I'll buy you a
> beer.
> 
>Zoltán:  Trade with me.  I've been here for less than two hours
> and I'm ready to go home.  I'll buy you a beer.
> 
>Robert:  I need to borrow a few bucks so that I can buy Jason and
> Zoltán a beer.
> 

I thought beer was free ;-P

joke aside I never did get the 'free as in beer' argument, has nobody in
the FOSS movement ever heard of a brewery cartel?

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Jason Pruim


On Jun 13, 2007, at 10:52 AM, Daniel Brown wrote:



Hi Jay,

I actually work with the post office on my day job, we do presorted
mailings with them. And I can tell you that the post office does not
sell any addresses to private individuals. For the mailings we do
where we need to get a list we have to go to a third party to get the
list.

The stuff you're looking at is probably the CASS software, or maybe
Delivery Point Validation. Both of which you run on your current
mailing list to make sure you qualify for the cheaper postage rates.
I can also tell you that the CASS software costs about $1,000 a year
for access to match your addresses against the database. :) But I
don't think it really does what you are looking for.

You may want to look into a third party place like InfoUSA[1] since
they sell the addresses (We use them sometimes in fact) they may be
able to do what you are looking for.

[1] http://www.InfoUSA.com






   Jason:  Tell them to stop raising the price of the damned stamps!
Offer to take a pay cut and take one for the team I'll buy you a
beer.
If only it was that easy... :) And actually if you want to send 200  
pieces or more I can knock your postage down somewhere around 6.6¢  
for the right type of mailing :)


It's called work share, I do the work, they don't charge as much :)  
Now Where's my Beer? :)


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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 10:52 -0400, Daniel Brown wrote:
> On 6/13/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> > On Jun 13, 2007, at 10:19 AM, Jay Blanchard wrote:
> >
> > Hi Jay,
> >
> > I actually work with the post office on my day job, we do presorted
> > mailings with them. And I can tell you that the post office does not
> > sell any addresses to private individuals. For the mailings we do
> > where we need to get a list we have to go to a third party to get the
> > list.
> >
> > The stuff you're looking at is probably the CASS software, or maybe
> > Delivery Point Validation. Both of which you run on your current
> > mailing list to make sure you qualify for the cheaper postage rates.
> > I can also tell you that the CASS software costs about $1,000 a year
> > for access to match your addresses against the database. :) But I
> > don't think it really does what you are looking for.
> >
> > You may want to look into a third party place like InfoUSA[1] since
> > they sell the addresses (We use them sometimes in fact) they may be
> > able to do what you are looking for.
> >
> > [1] http://www.InfoUSA.com
> >
>
> Jason:  Tell them to stop raising the price of the damned stamps!
> Offer to take a pay cut and take one for the team I'll buy you a
> beer.
> 
> Zoltán:  Trade with me.  I've been here for less than two hours
> and I'm ready to go home.  I'll buy you a beer.
> 
> Robert:  I need to borrow a few bucks so that I can buy Jason and
> Zoltán a beer.

Sorry Dan, but you still owe me the $20 I lent you last week for an
after beer prossie :/

>:)

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.  |
`'

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



Re: [PHP] Address validation API's for PHP

2007-06-13 Thread Jason Pruim


On Jun 13, 2007, at 10:19 AM, Jay Blanchard wrote:


[snip]
Someone needs to smack Robert.  He's off on a tangent again.  ;-P
[/snip]

Nope, that is normal.

[snip]
 Honestly, me either.  I've built ZIP-code-to-longitude/latitude
points, but nothing with address suggestion.

Jay, are you also looking for the PLUS+4 ZIP code information?  Is it
possible that the USPS (if you're looking for US addresses) has a free
or low-cost API?
[/snip]

I am looking at their address matching service now and trying to
determine how much it costs


Hi Jay,

I actually work with the post office on my day job, we do presorted  
mailings with them. And I can tell you that the post office does not  
sell any addresses to private individuals. For the mailings we do  
where we need to get a list we have to go to a third party to get the  
list.


The stuff you're looking at is probably the CASS software, or maybe  
Delivery Point Validation. Both of which you run on your current  
mailing list to make sure you qualify for the cheaper postage rates.  
I can also tell you that the CASS software costs about $1,000 a year  
for access to match your addresses against the database. :) But I  
don't think it really does what you are looking for.


You may want to look into a third party place like InfoUSA[1] since  
they sell the addresses (We use them sometimes in fact) they may be  
able to do what you are looking for.


[1] http://www.InfoUSA.com

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



RE: [PHP] Address validation API's for PHP

2007-06-13 Thread Zoltán Németh
2007. 06. 13, szerda keltezéssel 10.24-kor Robert Cummings ezt írta:
> On Wed, 2007-06-13 at 09:19 -0500, Jay Blanchard wrote:
> > [snip]
> > Someone needs to smack Robert.  He's off on a tangent again.  ;-P
> > [/snip]
> > 
> > Nope, that is normal.
> 
> Just adding some light morning humour to the list :D
> 
> At least... I hope it was taken as humour :^

by me it was taken as humour which made me feel much better than usually
after a day in work ;)
(okay, not a full day, there are 20 minutes left :D )

greets
Zoltán Németh

> 
> 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.  |
> `'
> 

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



Re: Re[6]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Robert Cummings
On Wed, 2007-06-13 at 15:19 +0100, Richard Davey wrote:
> Hi Robert,
> 
> Wednesday, June 13, 2007, 3:15:39 PM, you wrote:
> 
> > It's terribly verbose and inefficient...
> 
> >  
> > $filter['flags'] = 0;
> 
> > if( $allow_fraction )
> > {
> > $filter['flags'] |= FILTER_FLAG_ALLOW_FRACTION;
> > }
> 
> > if( $allow_thousand )
> > {
> > $filter['flags'] |= FILTER_FLAG_ALLOW_THOUSAND;
> > }
> 
> > if( $allow_scientific )
> > {
> > $filter['flags'] |= FILTER_FLAG_ALLOW_SCIENTIFIC;
> > }
> 
> ?>
> 
> I don't think it's *terribly* verbose, as it has good sentence structure
> to it, but your version is certainly more efficient, hence I've
> swapped to that. Any other takers? ;)

Personally I hate constants (can't use non-scalar values so why get used
ot them... also they're just another point for name collision) so if it
were my own code I'd do something more like the following:

 1 << 0,
'allowThousand'   => 1 << 1,
'allowScientific' => 1 << 2,
);

// then your above code would become:

$filter['flags'] = 0;
foreach( $filterFlags as $name => $bits )
{
if( isset( $$name ) && $$name )
{
$filter['flags'] |= $bits;
}
}

?>

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.  |
`'

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



[PHP] php / mysql performance resources

2007-06-13 Thread Guillaume Theoret

Hi everyone,

Can anyone recommend any good books/resources for php and mysql
performance management? I'm more interested in the software
development side (as opposed to server configuration) of things. I'm
looking for anything that would be good to know when working on
websites that get millions of hits a day.

Also, if anyone knows of any resources/discussions that illustrate the
relative performance of joins vs multiple selects I'd love to check it
out.

Thanks,
Guillaume

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



  1   2   >