RE: [PHP] Re: PHP cuts download process prematurely

2008-02-25 Thread Andrés Robinet
> -Original Message-
> From: Shawn McKenzie [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 25, 2008 11:19 PM
> To: php-general@lists.php.net
> Subject: [PHP] Re: PHP cuts download process prematurely
> 
> Manuel Barros Reyes wrote:
> > I am building a report application that generates some text files for
> > download and when the download starts it stops prematurely.
> >
> > The file sizes are currently in the order of the mega bytes and when I
> > try the script that generates and sends the file in a test server the
> > process goes smoothly no matter the size of the file but as soon as I
> > move the script to the production server dowloads cut at 300kb aprox.
> > My current workarround is to gzip the files and that is giving me some
> > extra time but the files are growing and sooner or later my
> > workarround will become useless.
> >
> > I guess the download is stoped by some timeout and not because of the
> > amount of kb downloaded because the size varies slightly. If that
> > timeout exists it should be of apox. 5-10 seconds.
> >
> > I use this function to perform the upload $contenido is the content of
> > the file and to that variable I assign the big chunk of output from
> > the report, $nombre_archivo is the optional name for the file. I can
> > paste more code but I think the problem is here.
> >
> >  > function enviarArchivo($contenido, $nombre_archivo = "") {
> >
> >
> >
> > if($nombre_archivo == "") {
> >
> > $nombre_archivo = date("dmyHi").".csv";
> >
> > }
> >
> >
> >
> > header("Content-Type: application/octet-stream");
> >
> > header("Content-Disposition: attachment; filename=$nombre_archivo");
> >
> > header("Content-Length: ".strlen($contenido));
> >
> > echo $contenido;
> >
> > }
> >
> > ?>
> >
> > Thanks in advance
> > Manuel
> 
> What does your error log say when this happens?
> 
> -Shawn

Though this is not likely to solve the problem, try adding the following two
lines at the beginning of the script (even before you query the database and do
all your logic)

ignore_user_abort(true);
set_time_limit(0);

If this solves the problem you should read this http://ar2.php.net/info and this
http://ar2.php.net/manual/es/function.ignore-user-abort.php carefully and then
choose more rational settings. PHP has a default execution time of 30s.

However, this is not likely to solve the problem as execution time should not be
affected by streaming and we are assuming the user/browser is not aborting the
connection. On the other hand you could support download resuming (it involves
some tricky headers and if you are willing to dig deeper into this read the
manual notes at http://ar.php.net/manual/es/function.header.php). But this won't
solve your problem... at least for IE as it doesn't support resuming :(.

You need the log files to know exactly what the problem is. And, even if you are
not solving this issue using compression as a workaround, you may also want to
add at the beginning of the script:

ob_start("ob_gzhandler")

Or... you can use "zlib.output_compression" INI setting in an .htaccess file or
in php.ini.

Compressed files will require more server processing but will download way
faster. ob_gzhandler and zlib compression are transparent to the end user, so
they will think they've got the uncompressed file, no need to gzip the files
programmatically.

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



RE: [PHP] When to use design patterns?

2008-02-25 Thread Wolf
It depends on the size and scope of your project.  For the most part, you 
should know what you have coded before and when encountering something new, the 
previous work should help in doing the new work.

Hth

Wolf

-Original Message-
From: skylark <[EMAIL PROTECTED]>
Sent: Saturday, February 23, 2008 5:16 AM
To: PHP General List 
Subject: [PHP] When to use design patterns?

Hi all,

Design patterns are really hot today.
And I am really interested when and how often they are used.

It is said that 99% of the projects don't need them.

Any opinion appreciated.

Regards,
Shelley

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

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



[PHP] Re: PHP cuts download process prematurely

2008-02-25 Thread Shawn McKenzie
Manuel Barros Reyes wrote:
> I am building a report application that generates some text files for
> download and when the download starts it stops prematurely.
> 
> The file sizes are currently in the order of the mega bytes and when I
> try the script that generates and sends the file in a test server the
> process goes smoothly no matter the size of the file but as soon as I
> move the script to the production server dowloads cut at 300kb aprox.
> My current workarround is to gzip the files and that is giving me some
> extra time but the files are growing and sooner or later my
> workarround will become useless.
> 
> I guess the download is stoped by some timeout and not because of the
> amount of kb downloaded because the size varies slightly. If that
> timeout exists it should be of apox. 5-10 seconds.
> 
> I use this function to perform the upload $contenido is the content of
> the file and to that variable I assign the big chunk of output from
> the report, $nombre_archivo is the optional name for the file. I can
> paste more code but I think the problem is here.
> 
>  function enviarArchivo($contenido, $nombre_archivo = "") {
> 
>   
> 
>   if($nombre_archivo == "") {
> 
>   $nombre_archivo = date("dmyHi").".csv";
> 
>   }
> 
> 
> 
>   header("Content-Type: application/octet-stream");
> 
>   header("Content-Disposition: attachment; filename=$nombre_archivo");
> 
>   header("Content-Length: ".strlen($contenido));
> 
>   echo $contenido;
> 
> }
> 
> ?>
> 
> Thanks in advance
> Manuel

What does your error log say when this happens?

-Shawn

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



[PHP] PHP cuts download process prematurely

2008-02-25 Thread Manuel Barros Reyes
I am building a report application that generates some text files for
download and when the download starts it stops prematurely.

The file sizes are currently in the order of the mega bytes and when I
try the script that generates and sends the file in a test server the
process goes smoothly no matter the size of the file but as soon as I
move the script to the production server dowloads cut at 300kb aprox.
My current workarround is to gzip the files and that is giving me some
extra time but the files are growing and sooner or later my
workarround will become useless.

I guess the download is stoped by some timeout and not because of the
amount of kb downloaded because the size varies slightly. If that
timeout exists it should be of apox. 5-10 seconds.

I use this function to perform the upload $contenido is the content of
the file and to that variable I assign the big chunk of output from
the report, $nombre_archivo is the optional name for the file. I can
paste more code but I think the problem is here.



Thanks in advance
Manuel

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



Re: [PHP] Mysql vs. Mysqli crash handling

2008-02-25 Thread Larry Garfield
On Monday 25 February 2008, Daniel Brown wrote:
> On Mon, Feb 25, 2008 at 3:07 PM, Larry Garfield <[EMAIL PROTECTED]> 
wrote:
> >  Hi folks.  I've an odd issue.
>
> Only fair.  You're an odd bird, and we're an odd bunch.  ;-P
>
> >  If I connect to a MySQL DB using ext/mysql, and for whatever reason the
> > process dies (uncaught exception, fatal error, etc.) the connection is
> > garbage collected and closed.  If, however, I use ext/mysqli, the
> > connection remains open forever and just eats up resources, eventually
> > resulting in hitting the connection limit.  Same app, same database, same
> > server.
>
> What version of PHP and MySQL (client extension and server) are you
> using?

Yeah, I should have mentioned that...

PHP 5.1.6, MySQL 5.0.48 (client and server I think; I'm not the sysadmin).

> What do your mysqli_query() command and SQL query string look like?

I'll have to ask our sysadmin for the test scripts he ran.  (We're running the 
site on Drupal, which can handle either, but has a lot of DB abstraction 
involved.  He tested it sans-Drupal, but I am not sure what his scripts 
were.)

> >  Any idea why mysqli behaves that way, and how to make it clean up
> > properly?  (Yes I should of course try to avoid fatals in the first
> > place, but when they do happen I don't want them to bring the whole
> > server to its knees.)
>
> I may not be able to help you, since I've only recently started
> switching myself over to mysqli (I know, as always I'm late to adopt),
> but with more information, maybe someone like Richard Lynch can come
> in and work a miracle.

Hi Rich! :-)

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

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

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



RE: [PHP] Deleting all rows in a database every 24 hours?

2008-02-25 Thread Daevid Vincent
Or make a 'truncate.sql' file with the tables in it to truncate:

TRUNCATE TABLE foo;
TRUNCATE TABLE bar;

Then in the crontab "mysql mydatabase < truncate.sql" 

No PHP needed.

> -Original Message-
> From: Daniel Brown [mailto:[EMAIL PROTECTED] 
> Sent: Friday, February 22, 2008 6:59 AM
> To: Zoran Bogdanov
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Deleting all rows in a database every 24 hours?
> 
> On Fri, Feb 22, 2008 at 1:28 AM, Zoran Bogdanov 
> <[EMAIL PROTECTED]> wrote:
> > The title says it all, how do I perform an action every 24 hours?
> 
> Another question better answered on Google.
> 
> PHP Script:
>  $sql = "TRUNCATE TABLE `tablename`";
> mysql_query($sql);
> ?>
> 
> Crontab Entry:
> 40 3 * * * `which php` /path/to/your/script.php
> 
> That will run every morning at 3:40a server time with the
> path-preferred PHP.  If you're on Windows, look up Scheduled Tasks.
> 
> -- 
> 
> 
> Daniel P. Brown
> Senior Unix Geek
> 
> 
> -- 
> 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] RE: temprorary error

2008-02-25 Thread tedd

At 5:49 PM -0500 2/25/08, Matty Sarro wrote:
So, if God begat Rasmus, and Rasmus begat PHP... that means PHP is 
like a gift from God right? Kinda like the Transformers? And 
microwave burritos?


I'm glad that someone get's it. :-)

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] Re: When to use design patterns?

2008-02-25 Thread tedd

At 9:58 PM + 2/25/08, Stut wrote:




Not disagreeing with you, but just to be clear Joomla is a fork of Mambo.

-Stut



Oh, I thought everyone was talking about dances and all along it's 
been silverware.


Damn, I'm never going to get this design pattern thing.  :-)

Cheers,

tedd

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

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread tedd

At 4:27 PM -0500 2/25/08, Jason Pruim wrote:

On Feb 25, 2008, at 4:18 PM, tedd wrote:
I do everything from basic design to back-end stuff and everything 
in between -- all with the newest buzz-words applied (i.e., 
graceful degradation, unobtrusive code, accessible, functional, 
secure, and it validates).
Can you do web 2.0? Because it just HAS to be web 2.0... anything 
else is s last version :)


No, I'm already doing Web 3.0.

In this biz, you have to stay ahead of the game.

Cheers,

tedd

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

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



Re: [PHP] session id

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 5:51 PM, Łukasz Wojciechowski
<[EMAIL PROTECTED]> wrote:
> Hi, I'm using SWFUpload JavaScript for my upload in my logged part of
>  website. I'm passing session_id in every post request from flash
>  object. In my script I set forwarded id with
>  session_id($_POST['passed_id']) but I got logout on that request (it's
>  redirecting me to login page) and I'm also logged out in my browser
>  (not flash). Then I need to relog. Everything is working fine when I'm
>  not touching session_id() id setting. Any clues?

Try this instead:



As always, BE SURE TO SANITIZE YOUR CODE!

-- 


Daniel P. Brown
Senior Unix Geek



RE: [PHP] RE: temprorary error

2008-02-25 Thread Warren Vail
That sound like the lineage to me. (Don't you hear the voices?)

Warren Vail

> -Original Message-
> From: Matty Sarro [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 25, 2008 2:50 PM
> To: Wolf
> Cc: tedd; php-general@lists.php.net
> Subject: Re: [PHP] RE: temprorary error
> 
> So, if God begat Rasmus, and Rasmus begat PHP... that means PHP is like a
> gift from God right? Kinda like the Transformers? And microwave burritos?
> 
> On Mon, Feb 25, 2008 at 3:09 PM, Wolf <[EMAIL PROTECTED]> wrote:
> 
> >
> >  tedd <[EMAIL PROTECTED]> wrote:
> > > At 11:18 AM -0500 2/25/08, Daniel Brown wrote:
> > > > I didn't think Quakers could use computers.  Or electricity.
> > > >
> > > >--
> > > >
> > >
> > >
> > > No, that's the Amish.
> > >
> > > Quakers are the one's who make cereal.
> > >
> > Except for Joseph who run the underground power cable through the field
> > one day and has the computer which hides in the hidden chamber behind
> the
> > roll-top desk that is activated via a hidden release/tumbler system.
> >
> > There are definitely days when the power being missing are fun though...
> > ;)
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

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



[PHP] session id

2008-02-25 Thread Łukasz Wojciechowski
Hi, I'm using SWFUpload JavaScript for my upload in my logged part of
website. I'm passing session_id in every post request from flash
object. In my script I set forwarded id with
session_id($_POST['passed_id']) but I got logout on that request (it's
redirecting me to login page) and I'm also logged out in my browser
(not flash). Then I need to relog. Everything is working fine when I'm
not touching session_id() id setting. Any clues?

-- 
Łukasz Wojciechowski


Re: [PHP] RE: temprorary error

2008-02-25 Thread Matty Sarro
So, if God begat Rasmus, and Rasmus begat PHP... that means PHP is like a
gift from God right? Kinda like the Transformers? And microwave burritos?

On Mon, Feb 25, 2008 at 3:09 PM, Wolf <[EMAIL PROTECTED]> wrote:

>
>  tedd <[EMAIL PROTECTED]> wrote:
> > At 11:18 AM -0500 2/25/08, Daniel Brown wrote:
> > > I didn't think Quakers could use computers.  Or electricity.
> > >
> > >--
> > >
> >
> >
> > No, that's the Amish.
> >
> > Quakers are the one's who make cereal.
> >
> Except for Joseph who run the underground power cable through the field
> one day and has the computer which hides in the hidden chamber behind the
> roll-top desk that is activated via a hidden release/tumbler system.
>
> There are definitely days when the power being missing are fun though...
> ;)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Robert Cummings
On Mon, 2008-02-25 at 16:35 -0500, Matty Sarro wrote:
> Dangit, I can only do web1.9.5 :(
> I guess I've been deprecated...

Loozers... I come from the year 3129 and we do DWeb 80.3 on the
Hyperweb!

We can link to the past... we found Zelda!



*groan :)*

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] Re: When to use design patterns?

2008-02-25 Thread Stut

Greg Donald wrote:

On 2/25/08, Michael McGlothlin <[EMAIL PROTECTED]> wrote:

 I've been fighting with stupid Joomla lately because it throws
 Javascript errors making it unusable.


The un-usability began for me when I became aware of the 250+
published exploits under it's current "Joomla" name:

http://search.securityfocus.com/swsearch?query=joomla&metaname=alldoc

And the 280+ exploits when it was called "Mambo":

http://search.securityfocus.com/swsearch?query=mambo&metaname=alldoc


Not disagreeing with you, but just to be clear Joomla is a fork of 
Mambo, not a rename.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Greg Donald
On 2/25/08, Michael McGlothlin <[EMAIL PROTECTED]> wrote:
>  I've been fighting with stupid Joomla lately because it throws
>  Javascript errors making it unusable.

The un-usability began for me when I became aware of the 250+
published exploits under it's current "Joomla" name:

http://search.securityfocus.com/swsearch?query=joomla&metaname=alldoc

And the 280+ exploits when it was called "Mambo":

http://search.securityfocus.com/swsearch?query=mambo&metaname=alldoc


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Matty Sarro
Dangit, I can only do web1.9.5 :(
I guess I've been deprecated...

On Mon, Feb 25, 2008 at 4:27 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:

>
> On Feb 25, 2008, at 4:18 PM, tedd wrote:
>
> > At 9:51 AM -0500 2/25/08, Eric Butera wrote:
> >> To each their own I guess.  Just out of curiosity, are you primarily
> >> writing entire web applications or one off scripts?
> >
> > If a client can describe it, that's what I do.
> >
> > As compared to some of the others of this list, I'm just a script-
> > kiddy. But, I do have the ability to make just about anything work
> > AND look good! So we all have our place.
> >
> > I do everything from basic design to back-end stuff and everything
> > in between -- all with the newest buzz-words applied (i.e., graceful
> > degradation, unobtrusive code, accessible, functional, secure, and
> > it validates).
> Can you do web 2.0? Because it just HAS to be web 2.0... anything else
> is s last version :)
>
>
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424-9337
> www.raoset.com
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Michael McGlothlin


Can you do web 2.0? Because it just HAS to be web 2.0... anything else 
is s last version :)
Yuck - I hate overuse of 'web 2.0' stuff. Don't add features that don't 
benefit your users and if you must do fancy stuff then please make sure 
your site still works for users without Javascript, Flash, Java, etc. 
I've been fighting with stupid Joomla lately because it throws 
Javascript errors making it unusable.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Jason Pruim


On Feb 25, 2008, at 4:18 PM, tedd wrote:


At 9:51 AM -0500 2/25/08, Eric Butera wrote:

To each their own I guess.  Just out of curiosity, are you primarily
writing entire web applications or one off scripts?


If a client can describe it, that's what I do.

As compared to some of the others of this list, I'm just a script- 
kiddy. But, I do have the ability to make just about anything work  
AND look good! So we all have our place.


I do everything from basic design to back-end stuff and everything  
in between -- all with the newest buzz-words applied (i.e., graceful  
degradation, unobtrusive code, accessible, functional, secure, and  
it validates).
Can you do web 2.0? Because it just HAS to be web 2.0... anything else  
is s last version :)





--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread tedd

At 9:51 AM -0500 2/25/08, Eric Butera wrote:

To each their own I guess.  Just out of curiosity, are you primarily
writing entire web applications or one off scripts?


If a client can describe it, that's what I do.

As compared to some of the others of this list, I'm just a 
script-kiddy. But, I do have the ability to make just about anything 
work AND look good! So we all have our place.


I do everything from basic design to back-end stuff and everything in 
between -- all with the newest buzz-words applied (i.e., graceful 
degradation, unobtrusive code, accessible, functional, secure, and it 
validates).


My clients seem pleased, I love the work, and I get paid.

I program 10 to 14 hours per day and 6 to 7 days per week. So even 
someone as limited as me, will learn something from that work load.


I would like to think I'm an agile programmer. But the truth is, I 
survive in constantly changing technology.


Does that answer your question?

Cheers,

tedd

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

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



Re: [PHP] Mysql vs. Mysqli crash handling

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 3:07 PM, Larry Garfield <[EMAIL PROTECTED]> wrote:
>
>  Hi folks.  I've an odd issue.

Only fair.  You're an odd bird, and we're an odd bunch.  ;-P

>  If I connect to a MySQL DB using ext/mysql, and for whatever reason the 
> process dies (uncaught exception, fatal error, etc.) the connection is 
> garbage collected and closed.  If, however, I use ext/mysqli, the connection 
> remains open forever and just eats up resources, eventually resulting in 
> hitting the connection limit.  Same app, same database, same server.

What version of PHP and MySQL (client extension and server) are you using?

What do your mysqli_query() command and SQL query string look like?

>  Any idea why mysqli behaves that way, and how to make it clean up properly?  
> (Yes I should of course try to avoid fatals in the first place, but when they 
> do happen I don't want them to bring the whole server to its knees.)

I may not be able to help you, since I've only recently started
switching myself over to mysqli (I know, as always I'm late to adopt),
but with more information, maybe someone like Richard Lynch can come
in and work a miracle.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 3:51 PM, Tamer Higazi <[EMAIL PROTECTED]> wrote:
> Hey Daniel!

Hey, Tamer!

>  Thanks for your feedback.

My pleasure.  However, please keep all replies on-list as the
discussion continues, because this also helps people who are
attempting to find the information on the web locate it in the
archives.

>  Yes, meanwhile I figuered out (how lazy I am) that PHP is published through 
> it's own license.

Yes, sir.  And don't worry I'm lazy as well.  Just ask Pierre
Joye on the Internals list (re: Gmail quoting)!  ;-P

>  Well, then you made me secure with your words. I was thinking allmost to
>  switch to Python (which is really a great language)
>
>  I think in future I make my comparisons between PHP5 and Python and make
>  a performance test. Would hardly interist me.
>
>  But shitt Python is really great.

Python is a good language.  I like it a lot for command line
programming, but it's not as prolific and well-accepted as PHP is when
considering a web language.

>  But I am that hardcoded PHP, that I am not able to easy switch to any
>  other language. Specially, that PHP in Version 5 gives me that OOP
>  Aspects and full freedom I want.

Yes, PHP5 went from being a crap-tastic piece of frustration when
it was a release candidate to being one of the absolute best
web-usable languages and versions (discounting CGI access, for those
of you lawyers out there!) to exist to date, in my opinion.  There's
tremendous extensibility with very little overhead, and virtually zero
financial layout.

>  But take your fingers away from Ruby. How can somebody come to the
>  ultimatively stupid idea to create for every small thing an object.

No joke like VB.NET.  I can't see the sense in having to
define something in three lines (Ruby) when I can just use a built-in
construct to do the same in one line (PHP).

>  God thanks that I am able to write static methods, attributes in PHP5.
>
>  > SPL in PHP5 is great. Boah

Yeah.  In English, we'd say "boo-yaa!"  ;-P

>  Hope it stay open source for alll and ever all times.

With your help and that of others continuing the spirit of the
project, it will.  Just make sure that, after you've taken enough from
the PHP community (and the open source community as a whole) to get
yourself going, you give back to help others learn as well.  That's
how the heart beats in open source.

>  with kind regards from Cairo

And a great big "HELLO, WORLD!" to Egypt from Scranton,
Pennsylvania (United States).  :-D

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread tedd

At 10:31 AM -0500 2/25/08, Matty Sarro wrote:

Also maybe look at Head First Design Patterns if you are interested in
ever understanding them.



Okay -- thanks for the recommendation -- I just bought it.

Cheers,

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

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



Re: [PHP] RE: temprorary error

2008-02-25 Thread Wolf

 tedd <[EMAIL PROTECTED]> wrote: 
> At 11:18 AM -0500 2/25/08, Daniel Brown wrote:
> > I didn't think Quakers could use computers.  Or electricity.
> >
> >--
> >
> 
> 
> No, that's the Amish.
> 
> Quakers are the one's who make cereal.
> 
Except for Joseph who run the underground power cable through the field one day 
and has the computer which hides in the hidden chamber behind the roll-top desk 
that is activated via a hidden release/tumbler system.

There are definitely days when the power being missing are fun though... ;)

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



[PHP] Mysql vs. Mysqli crash handling

2008-02-25 Thread Larry Garfield

Hi folks.  I've an odd issue.  

If I connect to a MySQL DB using ext/mysql, and for whatever reason the process 
dies (uncaught exception, fatal error, etc.) the connection is garbage 
collected and closed.  If, however, I use ext/mysqli, the connection remains 
open forever and just eats up resources, eventually resulting in hitting the 
connection limit.  Same app, same database, same server.

Any idea why mysqli behaves that way, and how to make it clean up properly?  
(Yes I should of course try to avoid fatals in the first place, but when they 
do happen I don't want them to bring the whole server to its knees.)

--Larry Garfield

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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Dan Joseph
On Mon, Feb 25, 2008 at 2:09 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:

> if($_SERVER['SERVER_PORT'] != '443') {
>$url = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] :
> $_SERVER['SERVER_NAME'];
>header("Location:
> https://".$url.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']);
>exit;
>}
> ?>
>
>

An alternative to this if you don't know the port would be to check
$_ENV["HTTPS"] for "off":

if ($_ENV["HTTPS"] == "off")  ... [insert the rest of Daniel's code here]


-- 
-Dan Joseph

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."


Re: [PHP] RE: temprorary error

2008-02-25 Thread tedd

At 11:18 AM -0500 2/25/08, Daniel Brown wrote:

I didn't think Quakers could use computers.  Or electricity.

--




No, that's the Amish.

Quakers are the one's who make cereal.

Cheers,

tedd

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

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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Stephen Johnson
OK.. I was referring to the lack of if checking on your post.. But I  should
have assumed that you did it that way.

As long as your validating whether you are secure before you try and go
secure is what I was getting at.

Also, I agree on odd usage of port numbers, most of my stuff runs on
standard ports, so I have never had any issues on that front.
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Wolf <[EMAIL PROTECTED]>
> Date: Mon, 25 Feb 2008 14:26:12 -0500
> To: Stephen Johnson <[EMAIL PROTECTED]>
> Cc: Rick Pasotto <[EMAIL PROTECTED]>, 
> Subject: Re: [PHP] checking for and enforcing https
> 
> Nope, it works like a charm for me, but I have it in an IF statement checking
> to see if the requestor is https or not to begin with.
> 
> I actually have it called as a function that passes in the rest of the path of
> the file that is being requested, which is called within an included page,
> which is included via a function call in a page that is automagically
> pre-pended to every page on the site.
> 
> And it works like a charm no matter where you are trying to hit it or how many
> sites/links you move in an out of.
> 
> Wolf

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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Stut

On 25 Feb 2008, at 18:40, Rick Pasotto wrote:
What is the best or recomended proceedure for making sure that a  
page is

accessed only via a secure connection?


What web server are you using? In my experience this is best done  
there rather than in PHP.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: AMP installer

2008-02-25 Thread Ryan A
Hey!

Just a thank you to all who replied to this thread, I will be taking your 
suggestion and installing xampp, will post back if I hit any walls.

Thanks again!

Cheers!
R



  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Wolf

 Stephen Johnson <[EMAIL PROTECTED]> wrote: 
> > Or you can cheat...
> > 
> >  $url = $_SERVER['SERVER_NAME'];
> >  header( 'Location:https://'.$url.'');
> > 
> > 
> 
> I think that would cause an infinite loop of redirection...
> 
> This would be better
> 
>  
> $curPort = $_SERVER['SERVER_PORT'];
> $pageTo = $_SERVER['REQUEST_URI'];
> 
> if($curPort == "80") {
>// go secure
>header("location:https://www.domain.com$pageTo";);
>exit;
> }
> ?> 
> 
> 
Also realize, your code ONLY works if people use the standard ports...

With the way I have it check ($SERVER variables), then you eliminate that and 
no matter what ports the server runs on, you get the correct switching you need.

Wolf

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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Wolf
Nope, it works like a charm for me, but I have it in an IF statement checking 
to see if the requestor is https or not to begin with.

I actually have it called as a function that passes in the rest of the path of 
the file that is being requested, which is called within an included page, 
which is included via a function call in a page that is automagically 
pre-pended to every page on the site.

And it works like a charm no matter where you are trying to hit it or how many 
sites/links you move in an out of.

Wolf

 Stephen Johnson <[EMAIL PROTECTED]> wrote: 
> > Or you can cheat...
> > 
> >  $url = $_SERVER['SERVER_NAME'];
> >  header( 'Location:https://'.$url.'');
> > 
> > 
> 
> I think that would cause an infinite loop of redirection...
> 
> This would be better
> 
>  
> $curPort = $_SERVER['SERVER_PORT'];
> $pageTo = $_SERVER['REQUEST_URI'];
> 
> if($curPort == "80") {
>// go secure
>header("location:https://www.domain.com$pageTo";);
>exit;
> }
> ?> 
> 
> 
> --
> Stephen Johnson c | eh
> The Lone Coder
> 
> http://www.thelonecoder.com
> continuing the struggle against bad code
> 
> http://www.fortheloveofgeeks.com
> I¹m a geek and I¹m OK!
> --
> 
> 
> 
> 
> > From: Wolf <[EMAIL PROTECTED]>
> > Date: Mon, 25 Feb 2008 13:55:41 -0500
> > To: Rick Pasotto <[EMAIL PROTECTED]>
> > Cc: 
> > Subject: Re: [PHP] checking for and enforcing https
> > 
> > 
> >  Rick Pasotto <[EMAIL PROTECTED]> wrote:
> >> What is the best or recomended proceedure for making sure that a page is
> >> accessed only via a secure connection?
> >> 
> > 
> > Make the server only send over 443 instead of 80...
> > 
> > But if you don't have the ability to change .htaccess or httpd.conf then you
> > can use the $SERVER variables and make them work that way...
> > 
> 
> > Wolf
> > 
> > -- 
> > 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] checking for and enforcing https

2008-02-25 Thread Stephen Johnson
> Or you can cheat...
> 
>  $url = $_SERVER['SERVER_NAME'];
>  header( 'Location:https://'.$url.'');
> 
> 

I think that would cause an infinite loop of redirection...

This would be better

https://www.domain.com$pageTo";);
   exit;
}
?> 


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Wolf <[EMAIL PROTECTED]>
> Date: Mon, 25 Feb 2008 13:55:41 -0500
> To: Rick Pasotto <[EMAIL PROTECTED]>
> Cc: 
> Subject: Re: [PHP] checking for and enforcing https
> 
> 
>  Rick Pasotto <[EMAIL PROTECTED]> wrote:
>> What is the best or recomended proceedure for making sure that a page is
>> accessed only via a secure connection?
>> 
> 
> Make the server only send over 443 instead of 80...
> 
> But if you don't have the ability to change .htaccess or httpd.conf then you
> can use the $SERVER variables and make them work that way...
> 

> Wolf
> 
> -- 
> 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] checking for and enforcing https

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 1:40 PM, Rick Pasotto <[EMAIL PROTECTED]> wrote:
> What is the best or recomended proceedure for making sure that a page is
>  accessed only via a secure connection?

Provided you're running SSL on the standard HTTPS port of 443,
include this at the very top of every file, before any output or
session information is sent.  The best option would be to include it
in a file in a switched index.php or similar design.

https://".$url.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']);
exit;
}
?>


-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Jason Pruim


On Feb 25, 2008, at 1:59 PM, Daniel Brown wrote:

On Mon, Feb 25, 2008 at 1:45 PM, Jason Pruim <[EMAIL PROTECTED]>  
wrote:

Does that mean we can also subscribe to [EMAIL PROTECTED]
? I've always like the idea of being an outlaw... But the closet I
ever came to that was a speeding ticket when I was 16! :P


   Don't worry, J.  With everything that's wrong with that message,
you're already a Grammar Fugitive in our eyes.  ;-P


Think that's bad... You should see my source code!

$var= Sup_CAL- 
la_FRg=listic_x_b_al_a_doshes($VeRyImPoRtAnT_VaRiAbLe_NaMe_HeRe)


:)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 1:44 PM, Andrés Robinet <[EMAIL PROTECTED]> wrote:
>  Oh dear, I think I can't help it! I'll need a good lawyer in order to avoid 
> life
>  imprisonment!
>  But... in order to have a fair court on this trial, only people capable of
>  quickly repeating "tres tristes tigres comen trigo en un trigal" in Spanish
>  should be part of the jury. :)

Conjeturo que es una buena cosa que entonces hablo español.

Por lo menos un poco.  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 1:45 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>  Does that mean we can also subscribe to [EMAIL PROTECTED]
>  ? I've always like the idea of being an outlaw... But the closet I
>  ever came to that was a speeding ticket when I was 16! :P

Don't worry, J.  With everything that's wrong with that message,
you're already a Grammar Fugitive in our eyes.  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Wolf

 Rick Pasotto <[EMAIL PROTECTED]> wrote: 
> What is the best or recomended proceedure for making sure that a page is
> accessed only via a secure connection?
> 

Make the server only send over 443 instead of 80...

But if you don't have the ability to change .htaccess or httpd.conf then you 
can use the $SERVER variables and make them work that way...

Or you can cheat...

 $url = $_SERVER['SERVER_NAME'];
 header( 'Location:https://'.$url.'');


Wolf

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



[PHP] Re: checking for and enforcing https

2008-02-25 Thread Shawn McKenzie
Rick Pasotto wrote:
> What is the best or recomended proceedure for making sure that a page is
> accessed only via a secure connection?
> 
Best is subjective, however I check in $_SERVER['SERVER_PROTOCOL'], also
https will appear in some other $_SERVER vars.

-Shawn

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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Per Jessen
Rick Pasotto wrote:

> What is the best or recomended proceedure for making sure that a page
> is accessed only via a secure connection?

The guaranteed way is not serving it over an insecure connection.


/Per Jessen, Zürich

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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Jason Pruim


On Feb 25, 2008, at 1:24 PM, Daniel Brown wrote:

On Mon, Feb 25, 2008 at 1:23 PM, Daniel Brown <[EMAIL PROTECTED]>  
wrote:

On Mon, Feb 25, 2008 at 12:53 PM, Andrés Robinet
<[EMAIL PROTECTED]> wrote:
Thanks for pointing out the *who* instead of *that* :), since I  
didn't realized

it until now.


   That's "realize", Andrés.  ;-P



   Oh, and by the way

   Thank you for subscribing to [EMAIL PROTECTED]


Does that mean we can also subscribe to [EMAIL PROTECTED] 
? I've always like the idea of being an outlaw... But the closet I  
ever came to that was a speeding ticket when I was 16! :P




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



RE: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Andrés Robinet
> -Original Message-
> From: Daniel Brown [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 25, 2008 1:24 PM
> To: Andrés Robinet
> Cc: tedd; php-general@lists.php.net
> Subject: Re: [PHP] Question about PHP Licence and it's future!
> 
> On Mon, Feb 25, 2008 at 1:23 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> > On Mon, Feb 25, 2008 at 12:53 PM, Andrés Robinet
> >  <[EMAIL PROTECTED]> wrote:
> >  >  Thanks for pointing out the *who* instead of *that* :), since I
> didn't realized
> >  >  it until now.
> >
> > That's "realize", Andrés.  ;-P
> 
> 
> Oh, and by the way
> 
> Thank you for subscribing to [EMAIL PROTECTED]
> 
> Heh.
> 
> --
> 
> 
> Daniel P. Brown
> Senior Unix Geek
> 

Oh dear, I think I can't help it! I'll need a good lawyer in order to avoid life
imprisonment!
But... in order to have a fair court on this trial, only people capable of
quickly repeating "tres tristes tigres comen trigo en un trigal" in Spanish
should be part of the jury. :)

Regards,

Rob(inet)

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



[PHP] checking for and enforcing https

2008-02-25 Thread Rick Pasotto
What is the best or recomended proceedure for making sure that a page is
accessed only via a secure connection?

-- 
"The secret of being miserable is to have the leisure to bother about whether
 you are happy or not.  The cure is occupation." -- George Bernard Shaw
Rick Pasotto[EMAIL PROTECTED]http://www.niof.net

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



Re: [PHP] URL modification

2008-02-25 Thread Richard Heyes

I think this is a highly underused built-in
feature.


Agreed. I started to use it on my blog instead of a query string and 
pages reported by Google went up.


--
Richard Heyes
http://www.phpguru.org
Free PHP and Javascript code

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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Robert Cummings

On Mon, 2008-02-25 at 13:24 -0500, Daniel Brown wrote:
> On Mon, Feb 25, 2008 at 1:23 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> > On Mon, Feb 25, 2008 at 12:53 PM, Andrés Robinet
> >  <[EMAIL PROTECTED]> wrote:
> >  >  Thanks for pointing out the *who* instead of *that* :), since I didn't 
> > realized
> >  >  it until now.
> >
> > That's "realize", Andrés.  ;-P
> 
> 
> Oh, and by the way
> 
> Thank you for subscribing to [EMAIL PROTECTED]

*scuttles away to subscribe*

-- 
..
| 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] Question about PHP Licence and it's future!

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 1:23 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Mon, Feb 25, 2008 at 12:53 PM, Andrés Robinet
>  <[EMAIL PROTECTED]> wrote:
>  >  Thanks for pointing out the *who* instead of *that* :), since I didn't 
> realized
>  >  it until now.
>
> That's "realize", Andrés.  ;-P


Oh, and by the way

Thank you for subscribing to [EMAIL PROTECTED]

Heh.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 12:53 PM, Andrés Robinet
<[EMAIL PROTECTED]> wrote:
>  Thanks for pointing out the *who* instead of *that* :), since I didn't 
> realized
>  it until now.

That's "realize", Andrés.  ;-P

Rob, Robber, Robot, Robin-Laid-An-Egg

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: Plant Extracts and Our Factory

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 12:38 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
>  It is... (S)PAM (P)HP (A)d (M)ail

Damn those recursive acronyms.

-- 


Daniel P. Brown
Senior Unix Geek


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



RE: [PHP] Re: When to use design patterns?

2008-02-25 Thread Jay Blanchard
[snip]
Design patterns are used to solve common problems to in OOP programming.
[/snip]

It is just not limited to OOP, design patterns are used to solve common
programming problems regardless of methodology. They have come into
vogue with OOP and have been leveraged heavily in that case. Design
patterns are everywhere.

Do you need to use them? Only if the case implies it.

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



Re: [PHP] All Survey leading to PHP

2008-02-25 Thread Daniel Brown
On Sun, Feb 24, 2008 at 8:35 AM, tedd <[EMAIL PROTECTED]> wrote:
>  Now, that doesn't mean that you can't patent your idea -- and that's
>  the best protection I know.

That is, until I finish development of the CodeCondom[TM].

Just cover the electric plugs to every computer of every developer
who may ever come into contact with your code with a piece of thick,
resilient rubber, effectively disabling power to the unit.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Flash menu

2008-02-25 Thread Daniel Brown
On Sat, Feb 23, 2008 at 3:46 AM, Alain Roger <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  i have a problem with my animated web flash menu (+images+sounds).
>  basically my menu in embedded into flash, and each time that i click on menu
>  link, my flash is playing from start as it is integrated into each PHP
>  pages.
>  I know that this is not the topic of this forum, but i would like to know
>  how you cope with such issue from PHP point of view ?

Flash uses ActionScript, which is just a slightly-modified (and
Flash-centric) version of JavaScript.  I'd suggest checking into using
your Flash GUI as an AJAX frontend, reading the PHP returns from the
server through a socket read in Flash.

Now as to how to do that...?  I haven't a bloody clue!  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] More than one values returned?

2008-02-25 Thread Daniel Brown
On Sat, Feb 23, 2008 at 6:21 AM, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
>  On Fri, 2008-02-22 at 18:13 -0500, tedd wrote:
>  > At 5:27 PM -0500 2/22/08, Robert Cummings wrote:
>  > >On Fri, 2008-02-22 at 17:04 -0500, Nathan Nobbe wrote:
>  > >  > and btw; your narratives are are just damned hilarious rob ;)
>  > >
>  > >Take that Ted... I'm quitting my day job!! :)
>  > >
>  > >Cheers,
>  > >Rob.
>  >
>  > Robb:  <-- note the addition of an extra 'b' for my loss of a 'd'
>  >
>  > He said your narratives, not your jokes. ;)
>  >
>  > Besides, if you gave up programming and took up comedy, both
>  > professions would suffer.
>  >
>  > How's that for a backhanded compliment?  :-)
>
>  Thanks for the... I mean ouch, I mean thanks for the compli... no ouch,
>  bah, you and your double speak.

Tedd's message was the last email I saw before I left for the
weekend.  And perhaps it was through my visualization from his words
(physically backhanding Rob while whispering sweet nothings in his
ear), but I cracked up by which I mean I literally laughed out
loud.  And still today, it makes me chuckle.

-- 


Daniel P. Brown
Senior Unix Geek


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



[PHP] Password protected ZIP file

2008-02-25 Thread Petrus Bastos
Hey folks,

I just wanna say thanks for whole help you've had give to me. I did
solve my problem with clues you give to me. Now, I have a server exclusively
to my project and I enabled the system command and zip command works fine.

Thanks again,
Petrus Bastos.


Re: [PHP] Ignoring user cancel

2008-02-25 Thread Daniel Brown
On Fri, Feb 22, 2008 at 9:19 PM, K T Ligesh <[EMAIL PROTECTED]> wrote:
>
>   Hello,
>
>   I have a php process running on lighty that should continue even if the 
> user presses cancel in his browser. The default behavior is that the 
> web-server will kill the cgi process on user cancellation. Is there some way 
> I can prevent the user cancel from interfering with the php process. Can I 
> ignore the web-server's kill in php or is this a configuration that should be 
> handled at the web-server?

Check out these two functions:
ignore_user_abort():
http://php.net/manual/en/function.connection-aborted.php
connection_aborted():
http://php.net/manual/en/function.connection-aborted.php

The latter of which can help with logging if you want to see when
the user killed the connection.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Daniel Brown
On Sat, Feb 23, 2008 at 11:50 PM, Tamer Higazi <[EMAIL PROTECTED]> wrote:
> Hi!

Hi!!!

>  I have asked myself a question.

And what answer did you get?

> After I saw, that SAP will no more
>  release future Versions of their open source Database MaxDB under the
>  GPL License, I have asked myself either if this could happen with PHP.

The quick answer would be: no, nay, never.

>  Who owns PHP? Is it Zend Technologies or the PHP Group itself? "Who" is
>  the PHP Group and what makes the PHP Group?

The beauty of open source: we all own it.  Through permission
granted by the PHP license, you can do almost anything you want with
the PHP source.  Including what's called "forking": which, like a fork
in the road, means to take the project in a slightly different
direction.

>  Who guaranties that future Versions of PHP stays open source and are
>  being released under the Terms of the General Public Licenses?

PHP was never GPL'd code.  Check the license there are some
pretty big differences.  To answer your question, though, we all, as a
community, ensure that PHP remains open source, in one form or
another.

>  Can future Versions from one day to the other no more being released
>  under the GPL, only under a closed source license? Let us say, PHP would
>  be distributed for several architectures only in binary forms and the
>  PECL modules stay open source.

Once again, it's not GPL, but I know what you're inferring.
There's nothing to stop Zend or anyone else in the world from offering
a "closed source" PHP, but you can bet your boxers (preferably clean
and unworn) that it won't receive the same accolades or acceptance by
the masses as the free and open source option.  It may be
better-accepted by high-spending commercial interests, but it won't
exist on such a high majority of servers worldwide as it does now.

>  These questions are for me very importand according to an commercial
>  product which will be planed, designed, written and sold commercially.
>
>  We are pendling between Ruby, Python and PHP5. Only the point "written"
>  is unclear.

For all intents and purposes, I implore you: fear not; for PHP is,
was, and ever shall be!

The project isn't going anywhere any time in the foreseeable
future, Tamer.  PHP as an open source language is indefinite.

And on another note, if you're worried about a version you already
have installed becoming commercialized, don't.  It's virtually
impossible.

-- 


Daniel P. Brown
Senior Unix Geek


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



RE: [PHP] Question about PHP Licence and it's future!

2008-02-25 Thread Andrés Robinet
> -Original Message-
> From: tedd [mailto:[EMAIL PROTECTED]
> Sent: Sunday, February 24, 2008 9:09 AM
> To: php-general@lists.php.net
> Subject: RE: [PHP] Question about PHP Licence and it's future!
> 
> >Rob (Other Rob that is actually called Andrés)
> 
> Yeah, that confused me too. Especially when I saw you arguing with
> yourself.
> 
> Also, the phrase:
> 
> "Rob (Other Rob that is actually called Andrés)"
> 
> would read better as:
> 
> "Rob (Other Rob who is actually called Andrés)"
> 
> Why don't you use the name Andrés ? That's much better than "Rob" anyway.
> ;-)
> 
> Cheers,
> 
> tedd
> 
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

*gringos* started calling me Rob long ago. It's shorter, it's easier to
pronounce and it's a short form for my last name (Robinet). So I just adopted it
for simplicity. However it turns out to be a mess sometimes since they've called
me *Robert*, *Robbie* and whatever you can imagine that starts with Rob (lol).

Humility aside, Andrés is the best name ever! :). But my opinion might be just a
bit biased (*bias* is such a fashion these days :))

Also, It's likely that you will find spelling and grammar issues all over in my
writing, since I'm a Spanish speaker by birth and I still live in Argentina.
Thanks for pointing out the *who* instead of *that* :), since I didn't realized
it until now.

Cheers,

Rob(inet)

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



Re: [PHP] Storing user ID in a cookie security precautions

2008-02-25 Thread Nathan Nobbe
On Mon, Feb 25, 2008 at 12:43 PM, Robert Cummings <[EMAIL PROTECTED]>
wrote:

> On Mon, 2008-02-25 at 12:28 -0500, Steve Finkelstein wrote:
> > Hi folks,
> >
> > I just completed my first reading of Advanced PHP Programming by
> > George Schlossnagle and was very impressed and thankful for the wealth
> > of information with examples provided by George.
> >
> > With that said, there is a chapter dedicated to Authentication using
> > client-side cookies and encrypting a user id amongst other meta data
> > using mcrypt.
> >
> > My question to the community is -- I'd like to try something similar
> > to this approach for an application I'm working on. Although I'm a bit
> > concerned as in the event of XSS or something of that nature, what if
> > a userid a compromised and manipulated? Is it unlikely with George's
> > encryption algorithms?
> >
> > I figured it would be redundant to store the user ID in a $_SESSION as
> > well as I need a variable to pop the user id into for my queries.
> >
> > Anyhow, the class is certainly a welcome addition as far as I'm
> > concerned.. but at the same time I'm paranoid someone figuring out the
> > encryption on a cookie, manipulating it with an arbitrary user id, and
> > then being able to have complete authorization to another users data.
> >
> > Thank you for your $.02!
>
> I would never store the user ID in the cookie. The session ID itself is
> sufficient to find the user ID. Why open up more avenues for attack?


you should see code igniter; they want to dump all the session data in a
cookie; absolute madness :O

-nathan


Re: [PHP] Storing user ID in a cookie security precautions

2008-02-25 Thread Robert Cummings
On Mon, 2008-02-25 at 12:28 -0500, Steve Finkelstein wrote:
> Hi folks,
> 
> I just completed my first reading of Advanced PHP Programming by
> George Schlossnagle and was very impressed and thankful for the wealth
> of information with examples provided by George.
> 
> With that said, there is a chapter dedicated to Authentication using
> client-side cookies and encrypting a user id amongst other meta data
> using mcrypt.
> 
> My question to the community is -- I'd like to try something similar
> to this approach for an application I'm working on. Although I'm a bit
> concerned as in the event of XSS or something of that nature, what if
> a userid a compromised and manipulated? Is it unlikely with George's
> encryption algorithms?
> 
> I figured it would be redundant to store the user ID in a $_SESSION as
> well as I need a variable to pop the user id into for my queries.
> 
> Anyhow, the class is certainly a welcome addition as far as I'm
> concerned.. but at the same time I'm paranoid someone figuring out the
> encryption on a cookie, manipulating it with an arbitrary user id, and
> then being able to have complete authorization to another users data.
> 
> Thank you for your $.02!

I would never store the user ID in the cookie. The session ID itself is
sufficient to find the user ID. Why open up more avenues for attack?

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] Storing user ID in a cookie security precautions

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 12:28 PM, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
[snip!]
>  My question to the community is -- I'd like to try something similar
>  to this approach for an application I'm working on. Although I'm a bit
>  concerned as in the event of XSS or something of that nature, what if
>  a userid a compromised and manipulated? Is it unlikely with George's
>  encryption algorithms?

While I don't know what George's encryption algorithm may be, keep
in mind the difference between sessions and cookies:

$_SESSION:   Only places a cookie on the end-user's browser with a
32-character alphanumeric hexadecimal key that corresponds with the
session ID held on the server.  The user's information is not stored
in the cookie, and because of the hash of the PHPSESSID sent and
stored in the cookie, it's very unlikely that a wannabe will be able
to forge that.  Someone with real knowledge may be able to do so, but
in that event, if they want the data bad enough, you'll have much more
to worry about than sessions and cookies.  :-\

$_COOKIE: Stores the actual data, encrypted or otherwise, on
the user's computer.  This is where you run into the issues of XSS,
session hijacking, and spoofing more frequently.

>  I figured it would be redundant to store the user ID in a $_SESSION as
>  well as I need a variable to pop the user id into for my queries.

I see no reason why this would be considered redundant.  I
frequently store the UID in a $_SESSION for a variety of reasons,
including just to check isset() to be sure the person still has a
valid session active (among other methods, of course, but that's a
quick way of checking).  And because $_SESSION data is only written to
the server, it's a bit more reliable than $_COOKIE data that is not
nearly as trustworthy.

>  Thank you for your $.02!

No problem.  It's just too bad that overdrew my account.  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: Plant Extracts and Our Factory

2008-02-25 Thread Robert Cummings

On Mon, 2008-02-25 at 11:57 -0500, Matty Sarro wrote:
> This is not spam, obviously there's some sort of UNIXy recursive joke here,
> we just have to find it.
> 
> On Mon, Feb 25, 2008 at 11:40 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> 
> >Amazing some of the brightest minds on the Internet
> > communicate on these lists and yet no one can recognize an obvious
> > SPAM message.  ;-P

It is... (S)PAM (P)HP (A)d (M)ail

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] System errno in PHP

2008-02-25 Thread Daniel Brown
On Sun, Feb 24, 2008 at 10:22 AM, Michal Maras <[EMAIL PROTECTED]> wrote:
> Hi
>
>   Thank you for answer, but I do not understand.
>   How can I use this class Errno after unsuccessful fopen?
>   I want to get the number, for example 13 if there is not enough permissions
>  to open file.
>  It is not problem for me that script will be no portable, it is
>  only for AIX.

fopen() doesn't return that information.  fsockopen() does, but not fopen().

RTFM: http://php.net/manual/en/function.fopen.php

-- 


Daniel P. Brown
Senior Unix Geek


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



[PHP] Storing user ID in a cookie security precautions

2008-02-25 Thread Steve Finkelstein
Hi folks,

I just completed my first reading of Advanced PHP Programming by
George Schlossnagle and was very impressed and thankful for the wealth
of information with examples provided by George.

With that said, there is a chapter dedicated to Authentication using
client-side cookies and encrypting a user id amongst other meta data
using mcrypt.

My question to the community is -- I'd like to try something similar
to this approach for an application I'm working on. Although I'm a bit
concerned as in the event of XSS or something of that nature, what if
a userid a compromised and manipulated? Is it unlikely with George's
encryption algorithms?

I figured it would be redundant to store the user ID in a $_SESSION as
well as I need a variable to pop the user id into for my queries.

Anyhow, the class is certainly a welcome addition as far as I'm
concerned.. but at the same time I'm paranoid someone figuring out the
encryption on a cookie, manipulating it with an arbitrary user id, and
then being able to have complete authorization to another users data.

Thank you for your $.02!

/sf

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



Re: [PHP] Session destruction problem

2008-02-25 Thread Daniel Brown
On Sat, Feb 23, 2008 at 10:49 PM, Adil Drissi <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I made an error i was using
>  unset($_SESSION["sessioname"]) instead of
>  unset($_SESSION). I'm sorry, but anyway, now i want to
>  give another detail. All the time i was testing with
>  opera. After testing in firefox and ie there is no
>  problem with the code i posted.


It sounds to me as though your installation of Opera is not
properly respecting the headers sent by the server to destroy the
session cookies.  Maybe checking Google for `opera cookie retention`
or `opera session problems` would help.  Looks to me as though you're
certainly not the only one to find that Opera doesn't handle cookies
and sessions as well as expected, or as well as Firefox/SeaMonkey and
(*gasp!*) Micro$oft Internet Exploder.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Shopping Carts

2008-02-25 Thread Daniel Brown
On Fri, Feb 22, 2008 at 9:17 PM, Kista Tucker <[EMAIL PROTECTED]> wrote:
> Oh my gosh!
[snip!]

Kista,

The response you got from Tedd is probably the most accurate and
best advice you could get on this subject.

DO NOT, by any means, attempt to write your own cart.  It's
reinventing the wheel, and if you don't have the experience in
PHP/MySQL/security/eCommerce/data retention/inventory tracking/module
development/API controls/SDK development/et cetera, then you run much
more of a risk of losing the client than to suggest a well-developed,
resilient, well-supported, established shopping cart.  For that, I
think Zen Cart is a fine option, regardless of the opinions of others.

And, when all else fails, remember that there is a whole community
of developers out there (and here) who would be more than willing to
help you with your project(s) for a fair price.  If your client wants
quality and reliability, just remember that he or she will get what
they pay for and while the software may be free and open source,
it still requires someone knowledgeable to get it all going in the
right direction.

Stealing from the context of Tedd's message (specifically: "Try
not to be the guru here, but") arises a very well-known quote:

Jack-of-all-trades: Master of none.

If you do design, stick with that.  Otherwise, you're effectively
stating to your client that you don't respect them enough to provide
the best possible service and products, and that any bare minimum will
do.

And with that, I hope you know that I'm by no means attempting to
insult your intelligence, but only offering advice from my own
experience.  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: Plant Extracts and Our Factory

2008-02-25 Thread Jason Pruim

It's probably a Ottendorf cipher

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


On Feb 25, 2008, at 11:57 AM, Matty Sarro wrote:

This is not spam, obviously there's some sort of UNIXy recursive  
joke here,

we just have to find it.

On Mon, Feb 25, 2008 at 11:40 AM, Daniel Brown <[EMAIL PROTECTED]>  
wrote:



  Amazing some of the brightest minds on the Internet
communicate on these lists and yet no one can recognize an  
obvious

SPAM message.  ;-P

--


Daniel P. Brown
Senior Unix Geek


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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



[PHP] Re: insert text with no specific format into database table

2008-02-25 Thread Shawn McKenzie
Shawn McKenzie wrote:
> jeffry s wrote:
>> i have text file and a table created with
>>
>> create table word(
>> id int not null auto_increment primary key,
>> word varchar(50),
>> definition text
>> )
>>
>> the text contain list of words but not really in specific format
>>
>> word, some text definition
>> word, some text definition, some text definition, etc
>>
>>
>> i want to read the file line by line,
>> take the first word before comma (,) and insert into the word column in the
>> database
>> whatever after follow the first comma(,) will be inserted into the
>> definition column in the word table database.
>>
>> i am not sure how to read the file line by line in php.
>> and how to separate the line of  text into two. divided by the 1st comma (,)
>> ..
>> my idea is using the explode(',' $text) function. but this one will separate
>> everything between a comma(,) into an array.
>> i wan't to know if there is another better way to do it..
>>
>>
>> any idea?
>> thank you!
>>
> 
> Read about the file() function and also read about the explode()
> function's limit parameter.
> 
> -Shawn
> 
> 
> if(($lines = file("file.txt"))) {
> foreach($lines as $line) {
> list($word, $definition) = explode($line, ',', 1);
> //insert word and definition SQL stuff here
> }
> }

Maybe I should read up on the limit parameter also :-0

list($word, $definition) = explode($line, ',', 2);

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Nathan Nobbe
On Mon, Feb 25, 2008 at 12:06 PM, Eric Butera <[EMAIL PROTECTED]> wrote:

> I'm not going to even say anything.  :)
>
> Since we're declaring our love for specifics, I really like the
> observer pattern lately for adding a way to add features without
> touching the core.
>


ahh yes, observer is key; i cant believe i forgot it!

-nathan


[PHP] Re: insert text with no specific format into database table

2008-02-25 Thread Shawn McKenzie
jeffry s wrote:
> i have text file and a table created with
> 
> create table word(
> id int not null auto_increment primary key,
> word varchar(50),
> definition text
> )
> 
> the text contain list of words but not really in specific format
> 
> word, some text definition
> word, some text definition, some text definition, etc
> 
> 
> i want to read the file line by line,
> take the first word before comma (,) and insert into the word column in the
> database
> whatever after follow the first comma(,) will be inserted into the
> definition column in the word table database.
> 
> i am not sure how to read the file line by line in php.
> and how to separate the line of  text into two. divided by the 1st comma (,)
> ..
> my idea is using the explode(',' $text) function. but this one will separate
> everything between a comma(,) into an array.
> i wan't to know if there is another better way to do it..
> 
> 
> any idea?
> thank you!
> 

Read about the file() function and also read about the explode()
function's limit parameter.

-Shawn


if(($lines = file("file.txt"))) {
foreach($lines as $line) {
list($word, $definition) = explode($line, ',', 1);
//insert word and definition SQL stuff here
}
}

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Eric Butera
On Mon, Feb 25, 2008 at 11:07 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> On Mon, Feb 25, 2008 at 10:38 AM, Robert Cummings <[EMAIL PROTECTED]>
> wrote:
>
> > My favourite patterns are the following:
> >
> >factory
> >singleton
> >adaptor
>
> i dont know about any favorites at this time but as far as common,
> id say
>
> strategy
> adapter
> template method (often used in conjunction w/ factory)
>
> singleton too (watch out for eric; hes a registry guy ;)) (and this is the
> top
>  3 from my exp list so had to stuff singleton by the wayside :))
>
> the heads first book is key ;)
> and also, you might check out phppatterns.com; though it hasnt been
> updated in a while id consider it somewhat of a classic source on patterns
>  w/ php as the example language.
>
> -nathan
>
>

I'm not going to even say anything.  :)

Since we're declaring our love for specifics, I really like the
observer pattern lately for adding a way to add features without
touching the core.

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



Re: [PHP] Set PHP session expire to 2 months

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 11:54 AM, Manuel Barros Reyes <[EMAIL PROTECTED]> wrote:
>  The question is asked only in the index.php and the answer is stored
>  in $_SESSION["pais"]. If the user tries to enter the site once again
>  and the session variable is still set the question is not asked again
>  as it is supposed to happen. The session data is configured to last
>  for aprox. 2 months and it works in the browsers I've tried it but
>  still I receive reports of users who are constantly being asked for
>  their countries they also told me they don't have cookies blocked.

They may not have the cookies blocked, but they may have some kind
of security software or browser settings that are overriding that.
One of the first places to check is to see what OS and browser
combination those whom are experiencing problems are using.  I'd be
willing to bet the OS is Windows (possibly with McAfee, Norton, or a
Microsoft product running), or that they (or someone else in their
household) are cleaning cookies frequently to either (a) keep the
computer "running fast" or (b) hide their tracks with other websites.

-- 


Daniel P. Brown
Senior Unix Geek


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



RES: [PHP] Re: Plant Extracts and Our Factory

2008-02-25 Thread Thiago Pojda
YOu could try reading only the even lines, maybe ther's something... 

-Mensagem original-
De: Matty Sarro [mailto:[EMAIL PROTECTED] 
Enviada em: segunda-feira, 25 de fevereiro de 2008 13:58
Para: Daniel Brown
Cc: Wolf; [EMAIL PROTECTED] php. net; Shawn McKenzie
Assunto: Re: [PHP] Re: Plant Extracts and Our Factory

This is not spam, obviously there's some sort of UNIXy recursive joke here,
we just have to find it.

On Mon, Feb 25, 2008 at 11:40 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:

>Amazing some of the brightest minds on the Internet communicate 
> on these lists and yet no one can recognize an obvious SPAM 
> message.  ;-P
>
> --
> 
>
> Daniel P. Brown
> Senior Unix Geek
> 
>
> --
> 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



RES: [PHP] Set PHP session expire to 2 months

2008-02-25 Thread Thiago Pojda
Perhaps the user doesn't have cookies disabled but often clean them?

Another software could be doing that.

-Mensagem original-
De: Manuel Barros Reyes [mailto:[EMAIL PROTECTED] 
Enviada em: segunda-feira, 25 de fevereiro de 2008 13:55
Para: php-general@lists.php.net
Assunto: [PHP] Set PHP session expire to 2 months

Hi, I'm working on a site that needs that once the user chooses his country
the question should not be asked again (while the user doesn't manually
delete the cookies in his browser).

The question is asked only in the index.php and the answer is stored in
$_SESSION["pais"]. If the user tries to enter the site once again and the
session variable is still set the question is not asked again as it is
supposed to happen. The session data is configured to last for aprox. 2
months and it works in the browsers I've tried it but still I receive
reports of users who are constantly being asked for their countries they
also told me they don't have cookies blocked.

Below I paste the code I am using inside index.php to test if the session is
set:



Can someone see something wrong with this? Inside home.php I do the opposite
if the session var. is not set the redirect to index.php.



Thanks in advance.
Manuel

--
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] PHPTriad and php error

2008-02-25 Thread Daniel Brown
On Sun, Feb 24, 2008 at 1:53 PM, hE <[EMAIL PROTECTED]> wrote:
> hi to all,
>  I set up phptriad on my computer running windows xp. When I tried to
>  test php with the following program I got an error "Parse error: parse
>  error, expecting `','' or `';'' in C:\apache\htdocs\mytest.php on line 10"

This is line 10:

>  echo "This is a PHP line";

Note the quotes you're using instead of any kind of fancy
quotes, just use double quotes (which will allow you to translate
$variables and special characters like \n) or single quotes (which use
the literal form: $variable is not translated, but would echo as
$variable and \n would not echo a newline, but rather the literal \n).

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: Plant Extracts and Our Factory

2008-02-25 Thread Matty Sarro
This is not spam, obviously there's some sort of UNIXy recursive joke here,
we just have to find it.

On Mon, Feb 25, 2008 at 11:40 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:

>Amazing some of the brightest minds on the Internet
> communicate on these lists and yet no one can recognize an obvious
> SPAM message.  ;-P
>
> --
> 
>
> Daniel P. Brown
> Senior Unix Geek
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Set PHP session expire to 2 months

2008-02-25 Thread Manuel Barros Reyes
Hi, I'm working on a site that needs that once the user chooses his
country the question should not be asked again (while the user doesn't
manually delete the cookies in his browser).

The question is asked only in the index.php and the answer is stored
in $_SESSION["pais"]. If the user tries to enter the site once again
and the session variable is still set the question is not asked again
as it is supposed to happen. The session data is configured to last
for aprox. 2 months and it works in the browsers I've tried it but
still I receive reports of users who are constantly being asked for
their countries they also told me they don't have cookies blocked.

Below I paste the code I am using inside index.php to test if the
session is set:



Can someone see something wrong with this? Inside home.php I do the
opposite if the session var. is not set the redirect to index.php.



Thanks in advance.
Manuel

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



Re: [PHP] PHP 24 hour processes?

2008-02-25 Thread Nathan Rixham

Nathan Rixham wrote:

Daniel Brown wrote:
On Mon, Feb 25, 2008 at 1:39 AM, Zoran Bogdanov 
<[EMAIL PROTECTED]> wrote:

Hi,

 How can you perform a timed event in PHP; for example:

 Count 24 hours and then delete all rows in a database...


Once again, I say verily unto you: RTFM and STFW.

Linux/*nix:  cron
Windows:   at

Cron Example:
40 03 * * * `which php` /path/to/php/script.php

PHP:




of negate php all together and use cron to schedule:

mysql -h hostname -u username -ppassword -e "TRUNCATE TABLE `table_name`"


clean forgot, if your on mysql 5.1.6> then you can use the "create 
event" syntax


http://dev.mysql.com/tech-resources/articles/event-feature.html

no need for cron or php and platform independant :)

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



Re: [PHP] URL modification

2008-02-25 Thread Nathan Rixham

Daniel Brown wrote:

On Sat, Feb 23, 2008 at 6:27 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:

 You could also forego the  bit if you're willing to accept URLs
 like this:

 /rental.php/property/23425


I was waiting to see if anyone made mention of that while reading
through the thread.  I think this is a highly underused built-in
feature.  PHP is already, out-of-the-box, ready for
search-engine-friendly URLs.



It may be a good time to throw in this .htaccess which just palms 
eveything [not found] off to php


[.htaccess]
RewriteEngine On
RewriteBase /

DirectoryIndex handle.urls.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /handle.urls.php [L]
[/.htaccess]

I use this for everything nowadays, in terms of security it also allows 
me to keep every script out of the web root; and joy of joys don't need 
to change any rules for static files, as they will always be "found" and 
thus the rules won't apply:


follow?

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



Re: [PHP] mysql test and error

2008-02-25 Thread Daniel Brown
On Sun, Feb 24, 2008 at 5:00 PM, hE <[EMAIL PROTECTED]> wrote:
> The following program gave the error:
>
>   "Parse error: parse error in C:\apache\htdocs\mysqltest.php on line 10"

Look at this part of the code:

$result = mysql_query($sql);
if ($result == 0)
echo 'Error ' . mysql_errno() . ': '. mysql_error() . '';
else
{

The error message gave you the answer.  You don't have the proper
curly brackets for your if/else statements.  Replace the above with
this:

$result = mysql_query($sql);
if ($result == 0) {
echo 'Error ' . mysql_errno() . ': '. mysql_error() . '';
} else {



>
>
>
>  
>  Test MySQL
>  
>  
>  
> $host="localhost";
>  $user="root";
>  $password="";
>  mysql_connect($host,$user,$password);
>  $sql="show status";
>  $result = mysql_query($sql);
>
> if ($result == 0)
>  echo 'Error ' . mysql_errno() . ': '. mysql_error() . '';
>  else
>  {
>  ?>
>  
>  
>  Variable_nameValue
>  
>
>   for ($i = 0; $i < mysql_num_rows($result); $i++) {
>  echo '';
>  $row_array = mysql_fetch_row($result);
>  for ($j = 0; $j < mysql_num_fields($result); $j++)
>  {
>  echo ''. $row_array[$j] . '';
>  }
>  echo '';
>  }
>  ?>
>  
>  
>
>  what is the reason?
>
>
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 


Daniel P. Brown
Senior Unix Geek


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



RE: [PHP] URL modification

2008-02-25 Thread Andrés Robinet
> -Original Message-
> From: Daniel Brown [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 25, 2008 11:37 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; php-general@lists.php.net
> Subject: Re: [PHP] URL modification
> 
> On Sat, Feb 23, 2008 at 6:27 AM, Richard Heyes <[EMAIL PROTECTED]>
> wrote:
> >  You could also forego the  bit if you're willing to accept URLs
> >  like this:
> >
> >  /rental.php/property/23425
> 
> I was waiting to see if anyone made mention of that while reading
> through the thread.  I think this is a highly underused built-in
> feature.  PHP is already, out-of-the-box, ready for
> search-engine-friendly URLs.
> 
> --
> 
> 
> Daniel P. Brown
> Senior Unix Geek
> 

Yeap, PHP rocks! I mentioned it in the first reply, only that it was not
rental.php, but index.php. Many if not all MVC frameworks support this kind of
routing which doesn't require mod_rewrite.

However, I prefer mod_rewrite if it's available, for crawlers it is not the same
/index.php/my-keywrod than /my-keyword alone. But I must admit that there are a
hundred other factors that can have much more weight for generating SEO problems
than having index.php everywhere.

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



Re: [PHP] PHP 24 hour processes?

2008-02-25 Thread Nathan Rixham

Daniel Brown wrote:

On Mon, Feb 25, 2008 at 1:39 AM, Zoran Bogdanov <[EMAIL PROTECTED]> wrote:

Hi,

 How can you perform a timed event in PHP; for example:

 Count 24 hours and then delete all rows in a database...


Once again, I say verily unto you: RTFM and STFW.

Linux/*nix:  cron
Windows:   at

Cron Example:
40 03 * * * `which php` /path/to/php/script.php

PHP:




of negate php all together and use cron to schedule:

mysql -h hostname -u username -ppassword -e "TRUNCATE TABLE `table_name`"

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



Re: [PHP] Re: Plant Extracts and Our Factory

2008-02-25 Thread Daniel Brown
Amazing some of the brightest minds on the Internet
communicate on these lists and yet no one can recognize an obvious
SPAM message.  ;-P

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] URL modification

2008-02-25 Thread Daniel Brown
On Sat, Feb 23, 2008 at 6:27 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:
>  You could also forego the  bit if you're willing to accept URLs
>  like this:
>
>  /rental.php/property/23425

I was waiting to see if anyone made mention of that while reading
through the thread.  I think this is a highly underused built-in
feature.  PHP is already, out-of-the-box, ready for
search-engine-friendly URLs.

-- 


Daniel P. Brown
Senior Unix Geek


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



RE: [PHP] RE: temprorary error

2008-02-25 Thread Andrés Robinet
> -Original Message-
> From: Nathan Rixham [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 25, 2008 11:32 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] RE: temprorary error
> 
> Robert Cummings wrote:
> > On Mon, 2008-02-25 at 11:18 -0500, Daniel Brown wrote:
> >> I didn't think Quakers could use computers.  Or electricity.
> >
> > You're confusing them with Amish.
> >
> > Cheers,
> > Rob.
> 
> and coldfusion developers

And windows users (lol)

> 
> [ps: rob your lucky i keep saving your ass from the dreaded last post]
> 
> --
> 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] RE: temprorary error

2008-02-25 Thread Nathan Rixham

Robert Cummings wrote:

On Mon, 2008-02-25 at 11:18 -0500, Daniel Brown wrote:

I didn't think Quakers could use computers.  Or electricity.


You're confusing them with Amish.

Cheers,
Rob.


and coldfusion developers

[ps: rob your lucky i keep saving your ass from the dreaded last post]

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



Re: [PHP] RE: temprorary error

2008-02-25 Thread Robert Cummings
On Mon, 2008-02-25 at 11:18 -0500, Daniel Brown wrote:
> I didn't think Quakers could use computers.  Or electricity.

You're confusing them with Amish.

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] RE: temprorary error

2008-02-25 Thread Jason Pruim


On Feb 25, 2008, at 11:18 AM, Daniel Brown wrote:


   I didn't think Quakers could use computers.  Or electricity.



That's Amish... Maybe Quakers too... I don't know...


--


Daniel P. Brown
Senior Unix Geek


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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] insert text with no specific format into database table

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 8:35 AM, jeffry s <[EMAIL PROTECTED]> wrote:
> i have text file and a table created with
>
>  create table word(
>  id int not null auto_increment primary key,
>  word varchar(50),
>  definition text
>  )

Look into the PHP function fgetcsv().

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] PHP 24 hour processes?

2008-02-25 Thread Daniel Brown
On Mon, Feb 25, 2008 at 1:39 AM, Zoran Bogdanov <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  How can you perform a timed event in PHP; for example:
>
>  Count 24 hours and then delete all rows in a database...

Once again, I say verily unto you: RTFM and STFW.

Linux/*nix:  cron
Windows:   at

Cron Example:
40 03 * * * `which php` /path/to/php/script.php

PHP:


-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] PHP 24 hour processes?

2008-02-25 Thread Jim Lucas

Bojan Tesanovic wrote:

Windows also have something similar to cron
Schedule accessory  can also be set to execute some php every xxx 
minutes/days  etc


For linux it is much easier ,
create file eg cron.txt that has this content
#===
* 1 * * * /home/user/cleanUpDB.php
#===

save it and than enter in console

crontab cron.txt

this will install cron job that will execute /home/user/cleanUpDB.php
script

every day at 1AM .

One note on executing PHP scripts  by cron ,you may want to include path 
of PHP binary as it may not be in

PATH so
* 1 * * * /library/php5/bin/php /home/user/cleanUpDB.php

where  /library/php5/bin/php is absolute path to yours PHP binary file




On Feb 25, 2008, at 7:46 AM, Paul Scott wrote:



On Mon, 2008-02-25 at 07:39 +0100, Zoran Bogdanov wrote:

How can you perform a timed event in PHP; for example:

Count 24 hours and then delete all rows in a database...



I thought that this question was answered in some detail before...

Anyway, on *NIX based systems use cron.daily or on 'doze, use AT or
command scheduler I think it's called.

Either that or use a long running PHP process with ignore_user_abort()
and a time of 86400 seconds :)

--Paul

All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm

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


Kosovo je Srbija.

Bojan Tesanovic
http://www.classicio.com/
http://www.carster.us/






Be sure that if you install and run this script as root, that you set it so your 
script is only writable by root.  You don't want someone inserting malicious 
code into your script and then just blindly running that code.  :)


--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] RE: temprorary error

2008-02-25 Thread Daniel Brown
I didn't think Quakers could use computers.  Or electricity.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Jim Lucas

tedd wrote:

At 8:50 PM -0600 2/24/08, Larry Garfield wrote:
Design patterns are just that: A formalization of various common 
patterns that
come up over and over in programming.  Ever get the feeling "wow, I 
know I've
written something kinda like this at least three times now?"  That 
means it's

probably a design pattern of some kind.

Studying design patterns helps you recognize a give problem as being 
similar
to another, so the solution is probably similar.  It also can alert 
you to

common pitfalls and common ways around them.


I've read at least a couple of books on the subject and for something 
that's designed to make programming easier, I find it difficult to 
implement.


I'm more like -- "I've written something like this before -- I'm going 
to find my code and alter it" -- type of guy.


I'm sure it's my failing, but I program trees and not forest. From my 
perspective, you plant enough trees, the forest will take care of 
itself. Besides, every forest I've designed ends up a lot different than 
when I started. So I focus on trees -- it's simpler for me.


Not to say that what you are doing is wrong, but we had a guy here in our office 
that was/is a cut/paste master.  If he had a routine that he found that (almost) 
worked.  He would then use that same chunk of code everywhere.


But, if that same bit of code got almost the right answer, he would write a 
"fix" that would "get it right" this time.  Then the next time he used the 
re-written code, he would have to write another "fix".  This went on for two years.


When they brought me in to take over managing his code, I re-wrote the entire 
lib in one weekend.  I have not had to touch the base code since then, and it is 
"right" every time.  It is much lighter and faster.


The moral of my story, you keep adding floors to your sky riser, the foundation 
is not going to support the add structure.


Build yourself a re-enforced foundation, you will never have to worry about how 
many floors you have to put on top of it.





All you will need to do is build yourself a structure that deals with the 
results returned to you by your base code.


The other day I gave an example of how I use code:

Users::GetGroup($somegroup)->update();

And I got this response

It really sucks for debugging though, because what if
GetGroup($somegroup) returns a null or unexpected value?

The idea is, if you wrote the code, then you force it to return to you what you 
want.  In this case, if something went wrong in the GetGroup() static method, 
the I would return my normal object that has the update() method, at the same 
time I would create an exception and catch that upstream.



Probably a little long winded on this one and maybe a little off this topic.

Sorry.



I think it's good to develop a methodology so that you can reuse past 
code, but the "design patterns' I've read about seem too abstract for me.


Cheers,

tedd



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] RE: temprorary error

2008-02-25 Thread Jochem Maas

Robert Cummings schreef:

On Mon, 2008-02-25 at 14:50 +, Nathan Rixham wrote:






ps: I can't believe how long this thread has lasted without anyone 
mentioning that the subject line is misspelled.

I notice it everytime a post arrives, but usually the content is
juicier :)

Cheers,
Rob.

Ps. Someone follow this up, I don't want to be the last post :B



the subject line is misspelt.

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Nathan Nobbe
On Mon, Feb 25, 2008 at 10:38 AM, Robert Cummings <[EMAIL PROTECTED]>
wrote:

> My favourite patterns are the following:
>
>factory
>singleton
>adaptor


i dont know about any favorites at this time but as far as common,
id say

strategy
adapter
template method (often used in conjunction w/ factory)

singleton too (watch out for eric; hes a registry guy ;)) (and this is the
top
3 from my exp list so had to stuff singleton by the wayside :))

the heads first book is key ;)
and also, you might check out phppatterns.com; though it hasnt been
updated in a while id consider it somewhat of a classic source on patterns
w/ php as the example language.

-nathan


Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Robert Cummings
My favourite patterns are the following:

factory
singleton
adaptor

These also happen to be the most common I come across.

Cheers,
Rob.


On Mon, 2008-02-25 at 10:31 -0500, Matty Sarro wrote:
> I agree, that head first book is fantabulous. Very well written and easy to
> read for a techie book. It makes the usage of design patterns incredibly
> easy to understand. But like all things simply understanding the theory
> doesn't always equal being able to practice it... that only comes with using
> them.
> 
> On Mon, Feb 25, 2008 at 9:51 AM, Eric Butera <[EMAIL PROTECTED]> wrote:
> 
> > On Mon, Feb 25, 2008 at 9:20 AM, tedd <[EMAIL PROTECTED]> wrote:
> >  > At 8:50 PM -0600 2/24/08, Larry Garfield wrote:
> > >  >Design patterns are just that: A formalization of various common
> > patterns that
> > >  >come up over and over in programming.  Ever get the feeling "wow, I
> > know I've
> > >  >written something kinda like this at least three times now?"  That
> > means it's
> > >  >probably a design pattern of some kind.
> > >  >
> > >  >Studying design patterns helps you recognize a give problem as being
> > similar
> > >  >to another, so the solution is probably similar.  It also can alert
> > you to
> > >  >common pitfalls and common ways around them.
> > >
> > >  I've read at least a couple of books on the subject and for something
> > >  that's designed to make programming easier, I find it difficult to
> > >  implement.
> > >
> > >  I'm more like -- "I've written something like this before -- I'm
> > >  going to find my code and alter it" -- type of guy.
> > >
> > >  I'm sure it's my failing, but I program trees and not forest. From my
> > >  perspective, you plant enough trees, the forest will take care of
> > >  itself. Besides, every forest I've designed ends up a lot different
> > >  than when I started. So I focus on trees -- it's simpler for me.
> > >
> > >  I think it's good to develop a methodology so that you can reuse past
> > >  code, but the "design patterns' I've read about seem too abstract for
> > >  me.
> > >
> > >
> > >  Cheers,
> > >
> > >  tedd
> > >  --
> > >  ---
> > >  http://sperling.com  http://ancientstones.com  http://earthstones.com
> > >
> > >  --
> > >
> > >
> > > PHP General Mailing List (http://www.php.net/)
> > >  To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> > To each their own I guess.  Just out of curiosity, are you primarily
> > writing entire web applications or one off scripts?
> >
> > I used to say "you don't need all that" but over time I just can't say
> > it much anymore.  It seems easy to just dive in and throw something
> > out the door, but then new features need to be added.  One of my
> > favorite programming books, Design Patterns Explained, says "Change
> > happens! Deal with it."  Using patterns helped me do just that with
> > minimal crying because the underlying architecture could be easily
> > modified.
> >
> > Also maybe look at Head First Design Patterns if you are interested in
> > ever understanding them.  Most of the books I've read say something
> > along the lines of it should be obvious when to use these patterns
> > when you read their book.  This might be true for some/most people but
> > I couldn't get my head wrapped around them till I read Head First.
> > Seeing their examples with the fun writing just made things click for
> > me.
> >
> > After reading that not only could I use them, but I started spotting
> > them in peoples code.  Another benefit of knowing patterns is having a
> > common language for explaining solutions to problems between
> > developers.  Saying I'm using the decorator pattern makes much more
> > sense then saying I'm wrapping this thing with another thing that
> > makes it do something else so I can swap out behaviors because they
> > work together, etc.
> >
> > ...but that is just the world I like to live in. :)
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
-- 
..
| 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] Re: When to use design patterns?

2008-02-25 Thread Matty Sarro
I agree, that head first book is fantabulous. Very well written and easy to
read for a techie book. It makes the usage of design patterns incredibly
easy to understand. But like all things simply understanding the theory
doesn't always equal being able to practice it... that only comes with using
them.

On Mon, Feb 25, 2008 at 9:51 AM, Eric Butera <[EMAIL PROTECTED]> wrote:

> On Mon, Feb 25, 2008 at 9:20 AM, tedd <[EMAIL PROTECTED]> wrote:
>  > At 8:50 PM -0600 2/24/08, Larry Garfield wrote:
> >  >Design patterns are just that: A formalization of various common
> patterns that
> >  >come up over and over in programming.  Ever get the feeling "wow, I
> know I've
> >  >written something kinda like this at least three times now?"  That
> means it's
> >  >probably a design pattern of some kind.
> >  >
> >  >Studying design patterns helps you recognize a give problem as being
> similar
> >  >to another, so the solution is probably similar.  It also can alert
> you to
> >  >common pitfalls and common ways around them.
> >
> >  I've read at least a couple of books on the subject and for something
> >  that's designed to make programming easier, I find it difficult to
> >  implement.
> >
> >  I'm more like -- "I've written something like this before -- I'm
> >  going to find my code and alter it" -- type of guy.
> >
> >  I'm sure it's my failing, but I program trees and not forest. From my
> >  perspective, you plant enough trees, the forest will take care of
> >  itself. Besides, every forest I've designed ends up a lot different
> >  than when I started. So I focus on trees -- it's simpler for me.
> >
> >  I think it's good to develop a methodology so that you can reuse past
> >  code, but the "design patterns' I've read about seem too abstract for
> >  me.
> >
> >
> >  Cheers,
> >
> >  tedd
> >  --
> >  ---
> >  http://sperling.com  http://ancientstones.com  http://earthstones.com
> >
> >  --
> >
> >
> > PHP General Mailing List (http://www.php.net/)
> >  To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> To each their own I guess.  Just out of curiosity, are you primarily
> writing entire web applications or one off scripts?
>
> I used to say "you don't need all that" but over time I just can't say
> it much anymore.  It seems easy to just dive in and throw something
> out the door, but then new features need to be added.  One of my
> favorite programming books, Design Patterns Explained, says "Change
> happens! Deal with it."  Using patterns helped me do just that with
> minimal crying because the underlying architecture could be easily
> modified.
>
> Also maybe look at Head First Design Patterns if you are interested in
> ever understanding them.  Most of the books I've read say something
> along the lines of it should be obvious when to use these patterns
> when you read their book.  This might be true for some/most people but
> I couldn't get my head wrapped around them till I read Head First.
> Seeing their examples with the fun writing just made things click for
> me.
>
> After reading that not only could I use them, but I started spotting
> them in peoples code.  Another benefit of knowing patterns is having a
> common language for explaining solutions to problems between
> developers.  Saying I'm using the decorator pattern makes much more
> sense then saying I'm wrapping this thing with another thing that
> makes it do something else so I can swap out behaviors because they
> work together, etc.
>
> ...but that is just the world I like to live in. :)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Cross-Post: Installing on Palm Treo?

2008-02-25 Thread Daniel Brown
On Sat, Feb 23, 2008 at 4:58 AM, Larry Garfield <[EMAIL PROTECTED]> wrote:
> Um.  Palm OS Garnet (what every remotely modern Treo runs) is completely
>  incapable of running multiple simultaneous processes without hacking the OS
>  beyond recognition.  It is an absolutely horrid concept for a server, if it
>  were even possible to port Apache, MySQL, and PHP to Palm OS (which in no way
>  resembles Unix, Linux, Windows, or anything even remotely Posix).  I don't
>  know if anyone has successfully managed to port Linux to a modern Treo, but
>  even if they had it would be just to prove that they can, not because it
>  would be actually usable.
>
>  Seriously, don't even waste time thinking about making a Palm device into a
>  dev server.  There are some mobile devices you can do that to; this ain't one
>  of them.
>
>  (Disclaimer: I currently own and use a Treo 680, and used to work as an IT
>  journalist reviewing, among other things, Palm handhelds and smartphones.
>  That was a few years ago, but I've not heard anything to suggest that
>  anything has even remotely changed in this regard.  In fact, everything I
>  hear is lamenting that it hasn't. )

Thanks for the insight, Larry.  Much appreciated.

However, as stated, I'm using (yes, I did buy it) the Palm 700wx,
which has Windows Mobile 5.0.  I should've mentioned the operating
system, but I figured those familiar with Palm devices would recognize
the ###p and ###w/###wx letter-endings.  ;-P  (Just kidding I only
realized it myself this morning.  I've had about 0.0001% experience
with Palm before this weekend.)

So perhaps a better question is, has anyone had any luck doing
WAMP on Windows Mobile (specifically v5.0)?

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP] RE: temprorary error

2008-02-25 Thread Robert Cummings

On Mon, 2008-02-25 at 14:50 +, Nathan Rixham wrote:
> Robert Cummings wrote:
> > On Mon, 2008-02-25 at 09:28 -0500, tedd wrote:
> >> At 8:49 AM -0500 2/25/08, Robert Cummings wrote:
> >>> On Mon, 2008-02-25 at 00:56 +, Nathan Rixham wrote:
> >>>
> >>>  > [can you resist?]
> >>>
> >>> No I can't resist. It would be tantamount to agreeing with you. Since I
> >>> disagree with you I feel compelled to answer your direct reference to
> >>> me. There are plenty of threads in which I've participated but for which
> >>> I am not the last say. Obviously you aren't capable of searching
> >>> properly or you have developed a bias against me for whatever reason.
> >>> *shrug*.
> >> A bias doesn't have to be a "bad" thing. I have a bias in that I read 
> >> everything you write -- your opinion has value.
> >>
> >> And I understand the "last word" thing for I experience I myself. But 
> >> age has diminished that tendency and now I pick my windmills more 
> >> carefully.
> > 
> > In retrospect, I think Nathan was kidding around but forgot to add an
> > emoticon :) Sometimes I feel compelled to add a comment, sometimes I
> > feel compelled to get the hell out of a thread. The former just happens
> > more often ;)
> > 
> >> ps: I can't believe how long this thread has lasted without anyone 
> >> mentioning that the subject line is misspelled.
> > 
> > I notice it everytime a post arrives, but usually the content is
> > juicier :)
> > 
> > Cheers,
> > Rob.
> > 
> > Ps. Someone follow this up, I don't want to be the last post :B
> > 
> 
> Jesus you even posted twice more!

I'm not Jesus... I can barely tread water let alone walk on it :)

> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ;)

: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] Re: When to use design patterns?

2008-02-25 Thread Nathan Nobbe
On Mon, Feb 25, 2008 at 9:20 AM, tedd <[EMAIL PROTECTED]> wrote:

> At 8:50 PM -0600 2/24/08, Larry Garfield wrote:
> >Design patterns are just that: A formalization of various common patterns
> that
> >come up over and over in programming.  Ever get the feeling "wow, I know
> I've
> >written something kinda like this at least three times now?"  That means
> it's
> >probably a design pattern of some kind.
> >
> >Studying design patterns helps you recognize a give problem as being
> similar
> >to another, so the solution is probably similar.  It also can alert you
> to
> >common pitfalls and common ways around them.
>
> I've read at least a couple of books on the subject and for something
> that's designed to make programming easier, I find it difficult to
> implement.
>
> I'm more like -- "I've written something like this before -- I'm
> going to find my code and alter it" -- type of guy.
>
> I'm sure it's my failing, but I program trees and not forest. From my
> perspective, you plant enough trees, the forest will take care of
> itself. Besides, every forest I've designed ends up a lot different
> than when I started. So I focus on trees -- it's simpler for me.
>
> I think it's good to develop a methodology so that you can reuse past
> code, but the "design patterns' I've read about seem too abstract for
> me.


some of the design patterns are a bit hard to grasp; and even harder to
determine when one might be appropriate to use.  i think a common
misconception about people who advocate design patterns is that said
people attempt to use them arbitrarily.  while this is undoubtedly true for
some people,  design patterns are like anything else; mastery comes
through practice, and practice can be prone to errors.
that said, design patterns are mainly for adding layers of indirection, to
increase flexibility for an exchange of complexity and often times runtime
performance.
and also, there are patterns that are so trivial im sure weve all used them;
even tedd ;)  for example, adapter, yes this is the famous, put a square peg
in a round hole pattern, but in reality its very simple,

/// NOTE: contrived example for demonstration only

function origFunction($p1, $p2, $p3) {}

function newFunction($p1, $p2) {
  // pass the same thing for $p3 always for the new 'api'
  return origFunction($p1, $p2, true);
}

another thing you will encounter studying patterns is subtle differences.
the non-patterns guys will call newFunction above, a 'wrapper'; and while
it is indeed that, 'wrapper' is a generic term.  patterns have several types
of wrappers, adapter, decorator, proxy (and more im sure), which all have
different intents.  Which brings us to one of the most important aspects of
patterns, a common vocabulary.  this is an incredible tool that fosters
communication and enhanced efficiency.

take it or leave it; i think patterns are worth while.

-nathan


Re: [PHP] RE: temprorary error

2008-02-25 Thread Nathan Rixham

Robert Cummings wrote:

On Mon, 2008-02-25 at 09:28 -0500, tedd wrote:

At 8:49 AM -0500 2/25/08, Robert Cummings wrote:

On Mon, 2008-02-25 at 00:56 +, Nathan Rixham wrote:

 > [can you resist?]

No I can't resist. It would be tantamount to agreeing with you. Since I
disagree with you I feel compelled to answer your direct reference to
me. There are plenty of threads in which I've participated but for which
I am not the last say. Obviously you aren't capable of searching
properly or you have developed a bias against me for whatever reason.
*shrug*.
A bias doesn't have to be a "bad" thing. I have a bias in that I read 
everything you write -- your opinion has value.


And I understand the "last word" thing for I experience I myself. But 
age has diminished that tendency and now I pick my windmills more 
carefully.


In retrospect, I think Nathan was kidding around but forgot to add an
emoticon :) Sometimes I feel compelled to add a comment, sometimes I
feel compelled to get the hell out of a thread. The former just happens
more often ;)

ps: I can't believe how long this thread has lasted without anyone 
mentioning that the subject line is misspelled.


I notice it everytime a post arrives, but usually the content is
juicier :)

Cheers,
Rob.

Ps. Someone follow this up, I don't want to be the last post :B



Jesus you even posted twice more!



































































































































































































































































































































;)

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



Re: [PHP] Re: When to use design patterns?

2008-02-25 Thread Eric Butera
On Mon, Feb 25, 2008 at 9:20 AM, tedd <[EMAIL PROTECTED]> wrote:
> At 8:50 PM -0600 2/24/08, Larry Garfield wrote:
>  >Design patterns are just that: A formalization of various common patterns 
> that
>  >come up over and over in programming.  Ever get the feeling "wow, I know 
> I've
>  >written something kinda like this at least three times now?"  That means 
> it's
>  >probably a design pattern of some kind.
>  >
>  >Studying design patterns helps you recognize a give problem as being similar
>  >to another, so the solution is probably similar.  It also can alert you to
>  >common pitfalls and common ways around them.
>
>  I've read at least a couple of books on the subject and for something
>  that's designed to make programming easier, I find it difficult to
>  implement.
>
>  I'm more like -- "I've written something like this before -- I'm
>  going to find my code and alter it" -- type of guy.
>
>  I'm sure it's my failing, but I program trees and not forest. From my
>  perspective, you plant enough trees, the forest will take care of
>  itself. Besides, every forest I've designed ends up a lot different
>  than when I started. So I focus on trees -- it's simpler for me.
>
>  I think it's good to develop a methodology so that you can reuse past
>  code, but the "design patterns' I've read about seem too abstract for
>  me.
>
>
>  Cheers,
>
>  tedd
>  --
>  ---
>  http://sperling.com  http://ancientstones.com  http://earthstones.com
>
>  --
>
>
> PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>

To each their own I guess.  Just out of curiosity, are you primarily
writing entire web applications or one off scripts?

I used to say "you don't need all that" but over time I just can't say
it much anymore.  It seems easy to just dive in and throw something
out the door, but then new features need to be added.  One of my
favorite programming books, Design Patterns Explained, says "Change
happens! Deal with it."  Using patterns helped me do just that with
minimal crying because the underlying architecture could be easily
modified.

Also maybe look at Head First Design Patterns if you are interested in
ever understanding them.  Most of the books I've read say something
along the lines of it should be obvious when to use these patterns
when you read their book.  This might be true for some/most people but
I couldn't get my head wrapped around them till I read Head First.
Seeing their examples with the fun writing just made things click for
me.

After reading that not only could I use them, but I started spotting
them in peoples code.  Another benefit of knowing patterns is having a
common language for explaining solutions to problems between
developers.  Saying I'm using the decorator pattern makes much more
sense then saying I'm wrapping this thing with another thing that
makes it do something else so I can swap out behaviors because they
work together, etc.

...but that is just the world I like to live in. :)

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



  1   2   >