RE: [PHP] Abstract Classes?
I don't particularly care for this explanation as it makes abstract classes out to be a mere convention of some kind during the development life-cycle. While I can see this as a potentially convenient byproduct of the fact that an abstract class cannot be directly instantiated, this is NOT the whole story as they do have a much greater purpose: They provide polymorphism and encapsulation to class hierarchies. Certainly you can't instantiate an abstract class, but abstract classes exist so that the implementation details of certain methods can be deferred to their derived classes further down the inheritance hierarchy. Abstract classes can also contain implementations for other non abstract methods. Abstract classes and Interfaces can be used in combination in MANY different patterns and frameworks. I think that I know what you might be getting at here, but it is not true to say it would be a class that shouldn't be instantiated as a 'sanity check' for junior developers. It should be used to define classes that are truly abstract; those where it doesn't necessarily make sense to have a 'physical' manifestation but where it would provide reusable code to its derived classes. An example of an abstract class might be 'Vehicle'. Well that is too vague (abstract) so you wouldn't really instantiate it. Instead you'd define more useable derived 'concrete' classes like Car, Truck, Scooter, Airplane, Bicycle, or Skateboard. Each of these are well defined so it makes sense for these to non-abstract. Each of these derived classes would then override the Vehicle's abstract function start() for example, because each one would do this in a different way. But by defining 'Vehicle' as abstract and defining the abstract function start() in it (because 'Vehicle' itself would not have an implementation for start()), you guarantee that each derived class MUST provide its own unique implementation for that function. Colin -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Sunday, October 23, 2005 11:12 PM To: Alan Lord Cc: 'Jasper Bryant-Greene'; php-general@lists.php.net Subject: RE: [PHP] Abstract Classes? On Sun, October 23, 2005 5:40 am, Alan Lord wrote: > But what benefit is there is having it as an explicitly "abstract" > class? Why can't it just be a "normal" class definition which you > inherit from? It could be just a normal class... But assume you're working on a team with a LOT of programmers, which is where OO really shines. Then assume some of those programmers are... less experienced... than others. They're not supposed to instantiate that one Class, because it doesn't make any sense to do that, and it's bound to cause errors somewhere else down the line. Have an "abstract" class as a formal definition means that if you KNOW it should never get instantiated, you have a Safety Check on it. The compiler can error out if somebody, like our Junior Programmer, tries to instantiate it. If it's just a "normal" class, maybe Junior manages to make things work (God knows how) even while instantiating a Class that was never meant to be instantiated, and that the Expert Programmers would KNOW was wrong. It's just a Sanity Check, basically. So, sure, it COULD be a normal class, if you want to assume nobody will ever make the mistake of instantiating it... Or it could be an abstract class, and if somebody screws up and instantiates it, they'll know right away and fix it before the problem goes any further. Hope that helps. -- Like Music? http://l-i-e.com/artists.htm -- 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] Abstract Classes?
On Sun, October 23, 2005 5:40 am, Alan Lord wrote: > But what benefit is there is having it as an explicitly "abstract" > class? Why can't it just be a "normal" class definition which you > inherit from? It could be just a normal class... But assume you're working on a team with a LOT of programmers, which is where OO really shines. Then assume some of those programmers are... less experienced... than others. They're not supposed to instantiate that one Class, because it doesn't make any sense to do that, and it's bound to cause errors somewhere else down the line. Have an "abstract" class as a formal definition means that if you KNOW it should never get instantiated, you have a Safety Check on it. The compiler can error out if somebody, like our Junior Programmer, tries to instantiate it. If it's just a "normal" class, maybe Junior manages to make things work (God knows how) even while instantiating a Class that was never meant to be instantiated, and that the Expert Programmers would KNOW was wrong. It's just a Sanity Check, basically. So, sure, it COULD be a normal class, if you want to assume nobody will ever make the mistake of instantiating it... Or it could be an abstract class, and if somebody screws up and instantiates it, they'll know right away and fix it before the problem goes any further. Hope that helps. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error reporting php-5.0.4-10.4 on FC4 - RESOLVED!!
It wasn't what I was looking for but I enable it: include_path = ".:/php/includes" This was commented out. After uncommenting it all works as I expected except that my syntax in the class was wrong. Now I can at least start to learn. Thanks Jasper and Derek - you gave me a shove in the right direction. Tnx Bob Jasper Bryant-Greene wrote: On Sun, 2005-10-23 at 23:01 -0400, Bob Hartung wrote: Jasper & Derek phpinfo() says: configuration file path /etc/php.ini PHP Core DirectiveLocal Value Master Value display_errorsOff Off error_logno value no value log errorson on Derek's idea sends nothing to the log but does send to the browser. It seems that /etc/php.ini is not being parsed since it says: error_reporting = E_ALL display_errors = On display_startup_errors = On log_errors = On /etc/php.ini *is* being parsed, it says so right there (above). However, display_errors isn't. Do a search inside /etc/php.ini for display_errors, see if there's more than one declaration for it. Make sure it isn't commented out (sounds silly, but you never know)... Oh, and check the permissions on /etc/php.ini, just in case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error reporting php-5.0.4-10.4 on FC4
On Sun, 2005-10-23 at 23:01 -0400, Bob Hartung wrote: > Jasper & Derek > >phpinfo() says: > configuration file path /etc/php.ini > >PHP Core >DirectiveLocal Value Master Value > > display_errorsOff Off > error_logno value no value > log errorson on > > Derek's idea sends nothing to the log but does send to the browser. > > It seems that /etc/php.ini is not being parsed since it says: > >error_reporting = E_ALL >display_errors = On >display_startup_errors = On >log_errors = On /etc/php.ini *is* being parsed, it says so right there (above). However, display_errors isn't. Do a search inside /etc/php.ini for display_errors, see if there's more than one declaration for it. Make sure it isn't commented out (sounds silly, but you never know)... Oh, and check the permissions on /etc/php.ini, just in case. -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error reporting php-5.0.4-10.4 on FC4
Jasper & Derek phpinfo() says: configuration file path /etc/php.ini PHP Core DirectiveLocal Value Master Value display_errorsOff Off error_logno value no value log errorson on Derek's idea sends nothing to the log but does send to the browser. It seems that /etc/php.ini is not being parsed since it says: error_reporting = E_ALL display_errors = On display_startup_errors = On log_errors = On error_log = /var/log/php_error I'm not sure where to turn at this point, except to get some sleep and attach this problem again tomorrow night when I return home from work. Thanks! Update tomorrow Bob Jasper Bryant-Greene wrote: On Sun, 2005-10-23 at 21:31 -0400, Bob Hartung wrote: Jasper If if make a file containing only I get what I expected. If I make a file containing Your error is here^^ (brackets shouldn't be there) But PHP should tell you that by throwing a Fatal error. What are the values of error_reporting and display_errors that display in the phpinfo() output? By the way, the "" is put there by your browser, not PHP. PHP is actually outputting absolutely nothing in the response-body. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error reporting php-5.0.4-10.4 on FC4
Bob Hartung wrote: Jasper If if make a file containing only I get what I expected. If I make a file containing I get NO output or errors in the browser window. If I select "view source" it returns: Eh? Anyone with any other ideas Tnx Bob Hartung Jasper Bryant-Greene wrote: How about var/log/php_errors'); echo 'a test to write to error log file'; ?> Which should write to your error log file,php_errors, in the existing directory "var/log". The browser should also render "a test to write to error log file". Have you tried changing the log file name to something else? I don't think that php_errors is a key word, but you never know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error reporting php-5.0.4-10.4 on FC4
On Sun, 2005-10-23 at 21:31 -0400, Bob Hartung wrote: > Jasper >If if make a file containing only > phpinfo() ; >?> >I get what I expected. > >If I make a file containing > > phpinfo() ; > > // Now a simple class and a call to the class > class Simple() Your error is here^^ (brackets shouldn't be there) But PHP should tell you that by throwing a Fatal error. What are the values of error_reporting and display_errors that display in the phpinfo() output? By the way, the "" is put there by your browser, not PHP. PHP is actually outputting absolutely nothing in the response-body. -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error reporting php-5.0.4-10.4 on FC4
Jasper If if make a file containing only I get what I expected. If I make a file containing I get NO output or errors in the browser window. If I select "view source" it returns: Eh? Anyone with any other ideas Tnx Bob Hartung Jasper Bryant-Greene wrote: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error reporting php-5.0.4-10.4 on FC4
On Sun, 2005-10-23 at 17:31 -0400, Bob Hartung wrote: > Hi all, >Slowly I'm progressing. >Now how to turn error reporting on for a test apache server. > >I have made the following changes to /etc/php.ini: > >error_reporting = E_ALL >display_errors = On >error_log = /var/log/php_errors > >On errors I still have no in browser display nor is anything written > to the log file. Make a file containing just the following line and view it in your browser: See if the path to php.ini shown in that file is /etc/php.ini. If it isn't, then you're editing the wrong php.ini. Also, make sure you're not overriding those values in a .htaccess file or in a script. What kind of errors are happening that aren't being displayed? For example in an output buffering handler, an error could just cause your script to output nothing. -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] error reporting php-5.0.4-10.4 on FC4
Hi all, Slowly I'm progressing. Now how to turn error reporting on for a test apache server. I have made the following changes to /etc/php.ini: error_reporting = E_ALL display_errors = On error_log = /var/log/php_errors On errors I still have no in browser display nor is anything written to the log file. Any suggestions? TIA Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forcing auto_prepend_file to work regardless of what document was accessed
Richard Lynch wrote: On Sat, October 22, 2005 11:42 pm, Dan Trainor wrote: This would be a great solution, and I'm sure my concern is something that's been discussed many times on this list - I'm worried about the performance hit that the machine would take, if/when parsing a large number of files, in this manner. For small sites, I have no problem adding .html, .htm and friends to PHP's own AddType. But I'm not so sure for larger sites. I'll browse the archive for info and data, and weigh my options. Last benchmarks I saw clocked in at 5 to 10% loss to run all .htm and html files through PHP. That was awhile ago, though. Test on a dev server with apache benchmark (ab) before and after and see. PHP doesn't really *DO* much until it hits ' Richard - Excellent; I'll be looking into that more. Thanks -dant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connect to MySql
On Fri, 2005-10-21 at 12:06 -0700, hassan mahdi wrote: > I have windows XP sevice pack 1 and 2, PHPv5.0.5, Mysql v1. I am working in > web design. I am unable to connect to the mysql server. Althought my php > files running fine and my mysql server is also running fine. MySQL 1? Really? That's a *very* old version, you should really upgrade :) > i) i had changed the php.ini-dist file to php.ini. > > ii)i uncommented the extensions of php_mysql.dll in php.ini file > > iii)i set the > > extensions_dir to extension_dir = "D:\PHP\php-5.0.3\ext\" in php.ini file If you're running PHP 5.0.5 then why is the directory called php-5.0.3? > iv)i had copied the libmysql.dll in windows\system32 and windows\system i > wrote the following code: > > [snip] > > but after all these i am still getting the error Fatal error: Call to > undefined function mysql_connect() in D:\PHP\teknohub\new.php on line 14 > please help me to solve this problem out. Confirm that: a) there exists a file php_mysql.dll in the directory D:\PHP\php-5.0.3 \ext b) the php.ini file that you have been editing matches the one displayed if you create a file containing and view it with your web browser -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Email Validation built-in? RFC
On 10/23/05, Manuel Lemos <[EMAIL PROTECTED]> wrote: > Hello, > > > on 10/22/2005 12:58 AM Richard Lynch said the following: > > Checking MX records is not reliable at all. > > I agree that it is less useful today, but it still help catches many > domain name typos. > > > > ... would it not make sense for there to be a BUILT-IN PHP function of > > a TRUE email syntactic validation? > > I don't see that being much better than passing a good regular > expression to preg_match. 1. Technically you can't write a regular expression that matches *all* valid email addresses as part of the address specification is recursive. ccontent = ctext / quoted-pair / comment comment = "(" *([FWS] ccontent) [FWS] ")" Admittedly 99.99% of people don't even know you *can* comment email addresses so it's not a huge problem... 2. Very few people seem to be capable of recognising a *good* regular expression, let alone writing one. It seems clear that validating an address is a task that many people want to do, but few can do properly. I'd say that's a good reason for making it a built-in function. > > For many years I use this regular expression in popular email validation > and forms generation and validation classes. > > > Rather than accepting only valid characters, it rejects all invalid > characters as specified in the RFC. > > ^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,6}$ > I'm sorry, but this regular expression rejects many perfectly valid ASCII characters. It seems to take into account only dot-atoms, not quoted-strings. It also rejects valid addresses using domain-literals. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A better way to do this
On Sun, 2005-10-23 at 20:23 +0100, Ross wrote: > I want the selct table to retain it's value on submit. The way I have done > it works but is a bit rubbish and was wondering if there is a more efficient > way. I just make the variable equal to "selected" when the form is submitted > > > >Please Select > News > Events > Publications > 'Please select', 'news' => 'News', 'events'=> 'Events', 'publications' => 'Publications' ); print( '' ); foreach( $selectValues as $value => $option ) { print( '' . htmlspecialchars( $option ) . '' ); } print( '' ); ?> If you're using XHTML, replace ' selected' with ' selected="selected"' -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A better way to do this
I want the selct table to retain it's value on submit. The way I have done it works but is a bit rubbish and was wondering if there is a more efficient way. I just make the variable equal to "selected" when the form is submitted >Please Select News Events Publications Thanks, R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connect to MySql
I have windows XP sevice pack 1 and 2, PHPv5.0.5, Mysql v1. I am working in web design. I am unable to connect to the mysql server. Althought my php files running fine and my mysql server is also running fine. i) i had changed the php.ini-dist file to php.ini. ii)i uncommented the extensions of php_mysql.dll in php.ini file iii)i set the extensions_dir to extension_dir = "D:\PHP\php-5.0.3 \ext\" in php.ini file iv)i had copied the libmysql.dll in windows\system32 and windows \system but after all these i am still getting the error Fatal error: Call to undefined function mysql_connect() in D:\PHP\teknohub\new.php on line 14 please help me to solve this problem out. You haven't successfully enabled MySQL support. You can confirm this by running a phpinfo() script. Did you restart Apache after editing the php.ini file? And are you certain you are editing the _right_ php.ini file (the one indicated when you run phpinfo())? Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] connect to MySql
Dear Sir I have windows XP sevice pack 1 and 2, PHPv5.0.5, Mysql v1. I am working in web design. I am unable to connect to the mysql server. Althought my php files running fine and my mysql server is also running fine. i) i had changed the php.ini-dist file to php.ini. ii)i uncommented the extensions of php_mysql.dll in php.ini file iii)i set the extensions_dir to extension_dir = "D:\PHP\php-5.0.3\ext\" in php.ini file iv)i had copied the libmysql.dll in windows\system32 and windows\system i wrote the following code: but after all these i am still getting the error Fatal error: Call to undefined function mysql_connect() in D:\PHP\teknohub\new.php on line 14 please help me to solve this problem out. Dr. Hassan Hassan Al-Mahdi Associate Lecture Of Computer Science Department of Mathematics and Science Faculty of Petroleum and Mining Engineering Suez Canal University, Suez, Egypt Phone: not available now Email: [EMAIL PROTECTED] Website: http://hassan460.tripod.com - Yahoo! FareChase - Search multiple travel sites in one click.
Re: [PHP] Abstract Classes?
Alan Lord wrote: But what benefit is there is having it as an explicitly "abstract" class? Why can't it just be a "normal" class definition which you inherit from? The idea is that a high-level language should prohobit you from doing things that do not make sence. Why they implemented it in PHP? Because it's there in Java, I guess. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Abstract Classes?
Thanks, That's starting to make some sence now! Al > -Original Message- > From: Colin Shreffler [mailto:[EMAIL PROTECTED] > Sent: 23 October 2005 17:03 > To: Alan Lord; 'Jasper Bryant-Greene' > Cc: php-general@lists.php.net > Subject: Re: [PHP] Abstract Classes? > > One reason would be that you might not know the details of a > derived class's implementation details at design time. > > For instance I could have an abstract class such as this: > > Class MyTestClass > { > function doSomething() > { > doSomethingElse(); > } > > abstract function doSomethingElse() ; } > > As you can see I have an abstract function with no details. > I know that when the doSomething() function is called it must > call the doSomethingElse Function, but at the time that I > define MyTestClass I don't know what that is exactly. > > Now say another developer needs to derive a class from > MyTestClass. Because the base class is abstract they must > define an emplementation for the doSomethingElse class such as: > > Class MyDerivedClass extends MyTestClass { > function doSomethingElse() > { > // here the developer must specify the specifics of > what this method does > } > } > > Now in our business logic if we do the following: > > $myClass = new MyDerivedClass(); > $myClass->doSomething(); > > The code will actually execute the doSomethingElse() > implementation that has been defined in MyDerivedClass. > > This can be extremely useful in developing frameworks that > you want other developers to extend on their own and also in > business systems where you might need to maintain a system by > adding new classes/implementations over time. Certain > patterns also make heavy uses of interfaces and abstract classes. > > Perhaps a real-world example would make more sense. Does > this help? If not, let me know and I'll come up with a > similar/real-world example. > > Colin > > On 10/23/05 4:40 AM, "Alan Lord" <[EMAIL PROTECTED]> wrote: > > > Thanks Jasper, > > > > That makes sense. > > > > But what benefit is there is having it as an explicitly "abstract" > > class? Why can't it just be a "normal" class definition which you > > inherit from? > > > > Sorry to be so dense > > > > Al > > > >> -Original Message- > >> From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] > >> Sent: 23 October 2005 09:19 > >> To: Alan Lord > >> Cc: php-general@lists.php.net > >> Subject: Re: [PHP] Abstract Classes? > >> > >> On Sun, 2005-10-23 at 08:54 +0100, Alan Lord wrote: > >>> Hi All, > >>> > >>> I have started reading a couple of books about PHP 5 and > >> whilst most > >>> of it is comprehensible even to me :-), I fail to > >> understand WHY there > >>> is such a thing as an abstract class or method? > >>> > >>> I think I understand what it is: A class that can't itself be > >>> instantiated, only inherited from, or a method that > >> describes itself > >>> only in terms of what properties it accepts but no implementation > >>> detail. > >>> > >>> But could someone explain why I would want to use this? I'm > >> sure it is > >>> very useful but I can't quite see the benefit... > >> > >> Hi Alan > >> > >> Here's an example from an application framework I've been > working on. > >> > >> It has classes to represent the different HTTP response statuses > >> (like > >> 301 Moved Permanently, 304 Not Modified etc.) with required and > >> forbidden headers for each and different characteristics (like no > >> request-body allowed etc). > >> > >> I have an Abstract class called HTTP_Response, from which > >> HTTP_Response_Moved_Permanently, > HTTP_Response_Not_Modified, and many > >> others all inherit. > >> > >> The reason HTTP_Response is abstract is because there's no > such thing > >> as an HTTP_Response on its own. It has to be a specific > type of HTTP > >> Response, that is a 301 Moved Permanently or a 304 Not Modified. > >> > >> Does that help? > >> > >> -- > >> Jasper Bryant-Greene > >> General Manager > >> Album Limited > >> > >> e: [EMAIL PROTECTED] > >> w: http://www.album.co.nz/ > >> p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 > >> a: PO Box 579, Christchurch 8015, New Zealand > >> > >> > > > Thank you, > Colin Shreffler > Principal > 303.349.9010 - cell > [EMAIL PROTECTED] > > Warp 9 Software, LLC. > 6791 Halifax Avenue > Castle Rock, CO 80104 > > Confidentiality Notice: The information in this e-mail may be > confidential and/or privileged. This e-mail is intended to be > reviewed by only the individual or organization named in the > e-mail address. If you are not the intended recipient, you > are hereby notified that any review, dissemination or copying > of this e-mail and attachments, if any, or the information > contained herein, is strictly prohibited. > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Abstract Classes?
One reason would be that you might not know the details of a derived class's implementation details at design time. For instance I could have an abstract class such as this: Class MyTestClass { function doSomething() { doSomethingElse(); } abstract function doSomethingElse() ; } As you can see I have an abstract function with no details. I know that when the doSomething() function is called it must call the doSomethingElse Function, but at the time that I define MyTestClass I don't know what that is exactly. Now say another developer needs to derive a class from MyTestClass. Because the base class is abstract they must define an emplementation for the doSomethingElse class such as: Class MyDerivedClass extends MyTestClass { function doSomethingElse() { // here the developer must specify the specifics of what this method does } } Now in our business logic if we do the following: $myClass = new MyDerivedClass(); $myClass->doSomething(); The code will actually execute the doSomethingElse() implementation that has been defined in MyDerivedClass. This can be extremely useful in developing frameworks that you want other developers to extend on their own and also in business systems where you might need to maintain a system by adding new classes/implementations over time. Certain patterns also make heavy uses of interfaces and abstract classes. Perhaps a real-world example would make more sense. Does this help? If not, let me know and I'll come up with a similar/real-world example. Colin On 10/23/05 4:40 AM, "Alan Lord" <[EMAIL PROTECTED]> wrote: > Thanks Jasper, > > That makes sense. > > But what benefit is there is having it as an explicitly "abstract" > class? Why can't it just be a "normal" class definition which you > inherit from? > > Sorry to be so dense > > Al > >> -Original Message- >> From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] >> Sent: 23 October 2005 09:19 >> To: Alan Lord >> Cc: php-general@lists.php.net >> Subject: Re: [PHP] Abstract Classes? >> >> On Sun, 2005-10-23 at 08:54 +0100, Alan Lord wrote: >>> Hi All, >>> >>> I have started reading a couple of books about PHP 5 and >> whilst most >>> of it is comprehensible even to me :-), I fail to >> understand WHY there >>> is such a thing as an abstract class or method? >>> >>> I think I understand what it is: A class that can't itself be >>> instantiated, only inherited from, or a method that >> describes itself >>> only in terms of what properties it accepts but no implementation >>> detail. >>> >>> But could someone explain why I would want to use this? I'm >> sure it is >>> very useful but I can't quite see the benefit... >> >> Hi Alan >> >> Here's an example from an application framework I've been working on. >> >> It has classes to represent the different HTTP response statuses (like >> 301 Moved Permanently, 304 Not Modified etc.) with required >> and forbidden headers for each and different characteristics >> (like no request-body allowed etc). >> >> I have an Abstract class called HTTP_Response, from which >> HTTP_Response_Moved_Permanently, HTTP_Response_Not_Modified, >> and many others all inherit. >> >> The reason HTTP_Response is abstract is because there's no >> such thing as an HTTP_Response on its own. It has to be a >> specific type of HTTP Response, that is a 301 Moved >> Permanently or a 304 Not Modified. >> >> Does that help? >> >> -- >> Jasper Bryant-Greene >> General Manager >> Album Limited >> >> e: [EMAIL PROTECTED] >> w: http://www.album.co.nz/ >> p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 >> a: PO Box 579, Christchurch 8015, New Zealand >> >> Thank you, Colin Shreffler Principal 303.349.9010 - cell [EMAIL PROTECTED] Warp 9 Software, LLC. 6791 Halifax Avenue Castle Rock, CO 80104 Confidentiality Notice: The information in this e-mail may be confidential and/or privileged. This e-mail is intended to be reviewed by only the individual or organization named in the e-mail address. If you are not the intended recipient, you are hereby notified that any review, dissemination or copying of this e-mail and attachments, if any, or the information contained herein, is strictly prohibited. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ugh, w32 anything is making me want to drink!
Jasper Bryant-Greene wrote: On Fri, 2005-10-21 at 15:43 -0500, Jay Blanchard wrote: [snip] I haven't used Windows for a while, but Start->Search->Files & folders (or something like that) and enter php.ini. Delete all results except the one that you've been editing, and then move the one you've been editing around the following folder until you find the one in which it works: c:\php c:\windows c:\windows\system32 c:\ Horrible, isn't it? [/snip] Horrible indeed. I got no joy from this. It didn't work. When you say didn't work... do you mean you didn't find any other php.ini files? There's one other thing I can think of. It's possible to set things like the location of the php.ini file and also php configuration directives through Apache's configuration. Now I know you're using IIS, but is there a similar thing available through IIS's configuration? (I wouldn't know, I don't practise the dark arts...) You can tell Windows where to find the php.ini file by setting the PHPRC evironment variable. But, if you've already placed *your* php.ini file in the location indicated by phpinfo(), then I'm not sure why it wouldn't be read, unless: 1. From the manual: "*Note: * If you're using NTFS on Windows NT, 2000, XP or 2003, make sure that the user running the web server has read permissions to your php.ini (e.g. make it readable by Everyone)." 2. IIS hadn't been restarted (to re-read the new php.ini). Other than that, not sure. Sorry. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory Leak?
I think the php GC only kicks in at the end of a script some calls to mysql_free_result might help Angelo - Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Saturday, October 22, 2005 11:40 PM Subject: Re: [PHP] Memory Leak? On Sat, October 22, 2005 9:24 pm, [EMAIL PROTECTED] wrote: Sucks that you don't have more control over the incoming data. Just for the record, for when the source of this data reads this thread. I am ECSTATIC to have this data, period. :-) I know we'll work out a viable solution in time, even if replication is not in the cards. -- Like Music? http://l-i-e.com/artists.htm -- 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: Php and Ruby
On 10/23/05, Jacob Friis Saxberg <[EMAIL PROTECTED]> wrote: > > How can I use Ruby with Php? > > I mean Rails. sorry :) http://www.rubyonrails.org/ I have a couple of Rails apps on my own server with other PHP apps running there too. Apache will run mod_fcgi and mod_php at the same time with no problems. -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/
RE: [PHP] Abstract Classes?
Thanks Jasper, That makes sense. But what benefit is there is having it as an explicitly "abstract" class? Why can't it just be a "normal" class definition which you inherit from? Sorry to be so dense Al > -Original Message- > From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] > Sent: 23 October 2005 09:19 > To: Alan Lord > Cc: php-general@lists.php.net > Subject: Re: [PHP] Abstract Classes? > > On Sun, 2005-10-23 at 08:54 +0100, Alan Lord wrote: > > Hi All, > > > > I have started reading a couple of books about PHP 5 and > whilst most > > of it is comprehensible even to me :-), I fail to > understand WHY there > > is such a thing as an abstract class or method? > > > > I think I understand what it is: A class that can't itself be > > instantiated, only inherited from, or a method that > describes itself > > only in terms of what properties it accepts but no implementation > > detail. > > > > But could someone explain why I would want to use this? I'm > sure it is > > very useful but I can't quite see the benefit... > > Hi Alan > > Here's an example from an application framework I've been working on. > > It has classes to represent the different HTTP response statuses (like > 301 Moved Permanently, 304 Not Modified etc.) with required > and forbidden headers for each and different characteristics > (like no request-body allowed etc). > > I have an Abstract class called HTTP_Response, from which > HTTP_Response_Moved_Permanently, HTTP_Response_Not_Modified, > and many others all inherit. > > The reason HTTP_Response is abstract is because there's no > such thing as an HTTP_Response on its own. It has to be a > specific type of HTTP Response, that is a 301 Moved > Permanently or a 304 Not Modified. > > Does that help? > > -- > Jasper Bryant-Greene > General Manager > Album Limited > > e: [EMAIL PROTECTED] > w: http://www.album.co.nz/ > p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 > a: PO Box 579, Christchurch 8015, New Zealand > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Php and Ruby
> How can I use Ruby with Php? I mean Rails. sorry :) > My goal is to have (Independence of Presentation Logic(IoPL)). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php and Ruby
Hi. How can I use Ruby with Php? My goal is to have (Independence of Presentation Logic(IoPL)). Thanks, Jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Abstract Classes?
On Sun, 2005-10-23 at 08:54 +0100, Alan Lord wrote: > Hi All, > > I have started reading a couple of books about PHP 5 and whilst most of > it is comprehensible even to me :-), I fail to understand WHY there is > such a thing as an abstract class or method? > > I think I understand what it is: A class that can't itself be > instantiated, only inherited from, or a method that describes itself > only in terms of what properties it accepts but no implementation > detail. > > But could someone explain why I would want to use this? I'm sure it is > very useful but I can't quite see the benefit... Hi Alan Here's an example from an application framework I've been working on. It has classes to represent the different HTTP response statuses (like 301 Moved Permanently, 304 Not Modified etc.) with required and forbidden headers for each and different characteristics (like no request-body allowed etc). I have an Abstract class called HTTP_Response, from which HTTP_Response_Moved_Permanently, HTTP_Response_Not_Modified, and many others all inherit. The reason HTTP_Response is abstract is because there's no such thing as an HTTP_Response on its own. It has to be a specific type of HTTP Response, that is a 301 Moved Permanently or a 304 Not Modified. Does that help? -- Jasper Bryant-Greene General Manager Album Limited e: [EMAIL PROTECTED] w: http://www.album.co.nz/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Abstract Classes?
Hi All, I have started reading a couple of books about PHP 5 and whilst most of it is comprehensible even to me :-), I fail to understand WHY there is such a thing as an abstract class or method? I think I understand what it is: A class that can't itself be instantiated, only inherited from, or a method that describes itself only in terms of what properties it accepts but no implementation detail. But could someone explain why I would want to use this? I'm sure it is very useful but I can't quite see the benefit... Thanks in advance Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forcing auto_prepend_file to work regardless of what document was accessed
On Sat, October 22, 2005 11:42 pm, Dan Trainor wrote: > This would be a great solution, and I'm sure my concern is something > that's been discussed many times on this list - I'm worried about the > performance hit that the machine would take, if/when parsing a large > number of files, in this manner. > > For small sites, I have no problem adding .html, .htm and friends to > PHP's own AddType. But I'm not so sure for larger sites. > > I'll browse the archive for info and data, and weigh my options. Last benchmarks I saw clocked in at 5 to 10% loss to run all .htm and .html files through PHP. That was awhile ago, though. Test on a dev server with apache benchmark (ab) before and after and see. PHP doesn't really *DO* much until it hits 'http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php