[PHP] Re: Opinions / Votes Needed
"Nathan Rixham" wrote in message news:88.0b.41390.8f512...@pb1.pair.com... > Afternoon all, > > I'd love to get some votes from my fellow developers on the following, and > indeed some opinions (especially from those who disagree). > > Recently I've been running in to a lot of frustrations with PHP when > dealing with Classes and Objects. Personally I strongly feel that these > need added in to PHP 6, for multiple reasons. > > I don't think the scope of this discussion covers the syntax of any > implementation, just if it needs implemented or not. > > a: Optional Static Typing > I'm finding an ever increasingly need to be able to staticly type > properties, parameters, return types etc (in classes) I know there is type > hinting but it's just not enough to do what one needs. Additionally > support for staticly typing primatives. Here's an example: If you really *need* to used a staticly typed language then don't use PHP, and don't try to change PHP to match your needs. > b: Object superclass > A base class type which all objects automagically extend, with (if nothing > else) a unique id / hashcode for each object (much like the Java Object > class). Failing this some form of function to get a unique reference > string for any variable. Example Why should each class automaticaly extend a base class? For what purpose? For what benefit? I can achieve what I want without this *feature*, so I don't need it. Why does each object need a unique id/hashcode? I have been using objects for years without this so it is not necessary, and does not provide any additional functionality. Why do you need a unique reference string for each variable? WTF! > c: Method overloading > TBH it's something I could live without, whereas a/b aren't, but it would > be an ideal addition to php? PHP does not need method overloading as is found in other languages as it has optional parameters with defaults. It is also possible to cast each parameter into wahetever type is necessary. It achieves the same result but using a different method. > > Thoughts, Opinions, Votes? would love to hear from you guys on this > > Regards! Absolute rubbish! You have obviously been used to a different language and have recently moved to PHP, but cannot get used to the fact that it *IS* a different language, therefore it has different syntax and achieves similar things in different ways. If your feeble brain can't handle the differences then I suggest you stick with your previous language and LEAVE PHP ALONE! That's just my opinion, of course. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
"Skip Evans" wrote in message news:49723137.2010...@bigskypenguin.com... > Wow, Tony, do you think in the future you could try to express yourself > with just a bit more civility and in a less condescending tone? > > Nathan expressed some thoughts he had, politely, and when out of his way > to come across in a non-critical and non-confrontational manner. > > Tony Marston wrote: >> Absolute rubbish! > > There's just no need to insult other list members like this. Saying that someone's ideas are absolute rubbish is not an insult. Calling him a moron would be, but I did not. > Frankly, it's this kind of treatment that make these lists less productive > than they could be. And you think that his ideas for changing PHP to suit his particular programming style would be productive? I think not. > It intimidates less experienced programmers from asking good questions, What makes you think that he is an inexperienced programmer? What makes you think that these are good questions? He is saying that he doesn't like the way that PHP works and wants it changed to suit his personal needs. > lest they get treated the way Nathan was. And isn't helping out less > experienced coders one of the reasons this list exists? > > And it also makes others less inclined to participate, or drop off the > list entirely. If it stops feeble minded people from filling this forum with useless requests then surely that's a good thing? Personally I'm sick and tired from reading posts such as this which say "I'm used to language X, and my feeble brain cannot cope with the differences, so why can't PHP be changed to behave like language X?" > It's NOT just so we can blast each other and show off our highly dubiously > assumed superiority. > > With all the frustrations we put up with in our daily lives, I would hope > a list like this, especially since we are among colleagues, could be a > place we could at least cautiously expect to be treated with respect. Then the OP should respect PHP for what it is, and not request changes that would make it unusable for 99.999% of the millions of programmers who have already written millions of programs with it. PHP is successful because of the way it works, and changing the way it works, as suggested by the OP, would not make it more successful. On the contrary, I think that it would PHuck it up completely. But that's just my opinion. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > -- > > Skip Evans > Big Sky Penguin, LLC > 503 S Baldwin St, #1 > Madison WI 53703 > 608.250.2720 > http://bigskypenguin.com > > Those of you who believe in > telekinesis, raise my hand. > -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opinions / Votes Needed
"Nathan Rixham" wrote in message news:49723749.4070...@gmail.com... > Tony Marston wrote: >> "Nathan Rixham" wrote in message >>> >>> a: Optional Static Typing >>> I'm finding an ever increasingly need to be able to staticly type >>> properties, parameters, return types etc (in classes) I know there is >>> type hinting but it's just not enough to do what one needs. Additionally >>> support for staticly typing primatives. Here's an example: >> >> If you really *need* to used a staticly typed language then don't use >> PHP, and don't try to change PHP to match your needs. > > why not? php fills 95% of my needs in most instances, I'm as much a valid > user of php as you and php *could* change to fit my needs and others, not > without some appreciated work mind you, but it could (and without > affecting anybody else in this case) ABSOLUTE RUBBISH! You cannot change PHP from being dynamicly typed to staticly typed without affecting 99% of the millions of programs which hav already been written. Personally I love the idea that a function's argument can be either a string or an array (or whatever) as PHP makes it easy to detect what type it is, and I can easily cast it to another type and deal with it as I see fit. This to me is a GREAT ADVANTAGE and NOT a limitation. > it's a simple need: if I can type that my variable can only contain an > int, then I know it's always an int without tonnes of checks to check it > actually contains an int / is getting set with an int throughout the rest > of the app (especially when multiple dev's are working on it). > > additionally this functionality would open the door to the creation of a > lot more apps and frameworks, Not in my (not so humble) opinion. > not least the ability to create decent ORM's. Proper progammers do not need any steeenking ORMs. > Further, it would allow people to contribute proper developers classes > that can be re-used time and time again Your definition of "proper" obviously disagrees with mine. > (for instance a full set of collections [class, hashmap, map, list, set > etc etc]). Once they're made and open source we all benefit, not only that > but they could be made by users instead of the internals team ;) > >>> b: Object superclass >>> A base class type which all objects automagically extend, with (if >>> nothing else) a unique id / hashcode for each object (much like the Java >>> Object class). Failing this some form of function to get a unique >>> reference string for any variable. Example >> >> Why should each class automaticaly extend a base class? For what purpose? >> For what benefit? I can achieve what I want without this *feature*, so I >> don't need it. > > 2 reasons: > 1: it would allow all objects to have this uniqueid/hashcode i need > 2: it would allow one to type hint Object in methods (you currently > can't) - you can method(array $var) but not method(object $var) see: > > class Example { > public function someMethod(object $arg0) { > } > } > > $e = new Example(); > $e->someMethod( (object)'y' ); > ?> > returns: Catchable fatal error: Argument 1 passed to > Example::someMethod() must be an instance of object > >> Why does each object need a unique id/hashcode? I have been using objects >> for years without this so it is not necessary, and does not provide any >> additional functionality. > > for comparison of equality, so you can make indexed arrays quickly using > the hashcode (you know like a hash table) so you can quickly tell the > difference between two instances of the same object with the same values > that are infact different, makes persisting data a 100 times easier... > >> Why do you need a unique reference string for each variable? WTF! > > well because $a = 's'; $b = 's'; both are unique, internally php must hold > a reference of some sort to each variable and where it's stored that is > entirely unique; it would simply be a case of exposing this functionality > /or/ adding functionality based on this. > >>> c: Method overloading >>> TBH it's something I could live without, whereas a/b aren't, but it >>> would be an ideal addition to php? >> >> PHP does not need method overloading as is found in other languages as it >> has optional parameters with defaults. It is also possible to cast each >> parameter into wahetever type is necessary. It achieves the same result >> but using a different method. > > the same functionality can be achieve
Re: [PHP] Re: Opinions / Votes Needed
"Jochem Maas" wrote in message news:4972365b.4060...@iamjochem.com... > Daniel Brown schreef: >> Well, since Nathan asked especially for the opinions of those who >> would disagree with him, I thought all was well >> >> On Sat, Jan 17, 2009 at 13:33, Tony Marston >> wrote: >>> If your feeble brain can't handle the differences >>> then I suggest you stick with your previous language and LEAVE PHP >>> ALONE! >> >> until this line. Can't quite tell if it's a joke or what it >> was. Kinda' killed the validity of the rest of the message. > > I guess it's the old adage: "it's not what you say, it's the way that you > say it" > > It's a pity his brain is wired directly to his arse, as opposed to his > mouth, > because I believe his brain is actually quite sharp I'll take that as a compliment. :) > ... unfortunately it all comes out covered in . I'll take that as an insult. :( -- Tony Marston http://www.tonymarston.net http://www.radicore.org > PS - I must be bored, I've sent more posts in the last ten minutes than I > have > in the last 6 months ;) > >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
"Skip Evans" wrote in message news:49733d18.6080...@bigskypenguin.com... >I will be brief. Tony is a dick. To quote your own words: "There's just no need to insult other list members like this." -- Tony Marston http://www.tonymarston.net http://www.radicore.org > Peace & Love, > Skip > > Tony Marston wrote: >> "Skip Evans" wrote in message >> news:49723137.2010...@bigskypenguin.com... >>> Wow, Tony, do you think in the future you could try to express yourself >>> with just a bit more civility and in a less condescending tone? >>> >>> Nathan expressed some thoughts he had, politely, and when out of his way >>> to come across in a non-critical and non-confrontational manner. >>> >>> Tony Marston wrote: >>>> Absolute rubbish! >>> There's just no need to insult other list members like this. >> >> Saying that someone's ideas are absolute rubbish is not an insult. >> Calling him a moron would be, but I did not. >> >>> Frankly, it's this kind of treatment that make these lists less >>> productive than they could be. >> >> And you think that his ideas for changing PHP to suit his particular >> programming style would be productive? I think not. >> >>> It intimidates less experienced programmers from asking good questions, >> >> What makes you think that he is an inexperienced programmer? What makes >> you think that these are good questions? He is saying that he doesn't >> like the way that PHP works and wants it changed to suit his personal >> needs. >> >>> lest they get treated the way Nathan was. And isn't helping out less >>> experienced coders one of the reasons this list exists? >>> >>> And it also makes others less inclined to participate, or drop off the >>> list entirely. >> >> If it stops feeble minded people from filling this forum with useless >> requests then surely that's a good thing? Personally I'm sick and tired >> from reading posts such as this which say "I'm used to language X, and my >> feeble brain cannot cope with the differences, so why can't PHP be >> changed to behave like language X?" >> >>> It's NOT just so we can blast each other and show off our highly >>> dubiously assumed superiority. >>> >>> With all the frustrations we put up with in our daily lives, I would >>> hope a list like this, especially since we are among colleagues, could >>> be a place we could at least cautiously expect to be treated with >>> respect. >> >> Then the OP should respect PHP for what it is, and not request changes >> that would make it unusable for 99.999% of the millions of programmers >> who have already written millions of programs with it. PHP is successful >> because of the way it works, and changing the way it works, as suggested >> by the OP, would not make it more successful. On the contrary, I think >> that it would PHuck it up completely. >> >> But that's just my opinion. >> > > -- > > Skip Evans > Big Sky Penguin, LLC > 503 S Baldwin St, #1 > Madison WI 53703 > 608.250.2720 > http://bigskypenguin.com > > Those of you who believe in > telekinesis, raise my hand. > -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
"Nathan Rixham" wrote in message news:497354c3.9090...@gmail.com... > Per Jessen wrote: >> Nathan Rixham wrote: >> >>> point is.. >>> Java let's me easily do 70% of what I need to >>> PHP let's me easily do 95% of what I need to >>> >> >> I'm curious - can you list what the 25% are? > > it lacks dynamic typing, the ability to procedural code and its > precompiled not interpreted; all in a hello world in php is 10 seconds, in > java it's nigh on 10 minutes. Hence why php is such a good language > >>> If we could get that 5% added then PHP would be perfect, not only that >>> but me and the rest of the team at work would be able to make our >>> multi-million pound enterprise projects in PHP instead of java; as >>> would so many others (that can't be a bad thing for PHP) >> >> But why? Why not use Java and J2EE and all that good stuff? I'm not >> much of a java fan myself, but you've got to give credit where credit >> is due. > > well I can give two examples: > Three other PHP Developers and myself spent the best part of a year > creating a large multi-site event management system in PHP; the whole > process was deeply frustrating primarily due to the lack of optional > static typing and there in the lack of a solid ORM; with this small > addition the whole process would have been a 6 month process if that, and > a far more pleasurable experience. Really? In 2007 I single-handedly designed and built an ERP system with 130 database tables, 230 relationships and 1000 screens, all with PHP and without an ORM and static typing. This took me 6 months. If you can't equal that then either you are not much of a programmer, or your development style is not as good as you think it is. If other people can write perfectly good applications in PHP without the extra features that you say are indispensible then why can't you? > Currently 7 other Java developers and myself are building a large > multisite transportation management and ticketing system in Java, this is > a 9 month project with a decent sized and very skilled team; because of > the lack of static typing (and thus the lack of development tools and > frameworks/orms for PHP) we've had to go with Java; TBH the static typing > is only needed on the domain model and the api layer, the bulk of the > business logic in between where the majority of the work comes in, would > be a great deal easier using a mix of procedural code and dynamic typing. > I'd argue that again the development time of this project could be halfed > if it was done in PHP AND if in PHP had support for optional static typing > coupled with a good ORM. If you want a good ORM then write one yourself, or is that beyond your capabilities? Personally I wouldn't touch an ORM with a barge pole. I develop applications using the 3 Tier Architecture (no, it's not the same as MVC) with a Data Access layer that I can easily switch between MySQL, PostgreSQL and Oracle. If I can do it then why can't you? > Further the difference between precompilation and interpretation is v > noticable when it comes to rolling applications out, often in development > you want to run a hlaf built or broken application to see what happens and > check if parts x y and z are good + to test your infrastructure; when you > can't compile and do this testing becuase the app isn't bug free or > completed it's rather limiting. Sometimes unit tests just don't cover what > you need. > >>> Additionally, rather sure you'd see a mass influx of people moving to >>> php, and applications created for it - even down to design tools such >>> as reverse and forward engineering between uml and php. >>> >>> ack.. there's a tonne of amazing tools and frameworks for java, and >>> I'm sure that a vast majority of them are possible because of this >>> static typing (from orms to web service frameworks and all in between) >>> - am I so bad for wanting that for php and my fellow devs? >> >> No, you're not so bad :-) The point is - why not just use Java, when you >> really need the features? > > the cases above should show why, fact is (imho) PHP would be a far better > language than java for web based applications in 99% of cases if it had > this optional static typing and the tools that allows. *IF* it did, then > 10 other people and myself wouldn't have wasted a year of there lives on > writing what could be unneeded code; I'm sure I'm not the only one in this > position. If you spend a year writing useless code, then it's your fault, not PH
Re: [PHP] Re: Opinions / Votes Needed
"Nathan Rixham" wrote in message news:497366f5.2030...@gmail.com... > Tony Marston wrote: >> "Skip Evans" wrote in message >> news:49723137.2010...@bigskypenguin.com... >>> Wow, Tony, do you think in the future you could try to express yourself >>> with just a bit more civility and in a less condescending tone? >>> >>> Nathan expressed some thoughts he had, politely, and when out of his way >>> to come across in a non-critical and non-confrontational manner. >>> >>> Tony Marston wrote: >>>> Absolute rubbish! >>> There's just no need to insult other list members like this. >> >> Saying that someone's ideas are absolute rubbish is not an insult. >> Calling him a moron would be, but I did not. > > agreed, tone and meaning are so hard to convey using written words alone. > (you did say I was feeble brained though..) > >>> Frankly, it's this kind of treatment that make these lists less >>> productive than they could be. >> >> And you think that his ideas for changing PHP to suit his particular >> programming style would be productive? I think not. > > you think not; I know they'd raise my productivity in php somewhat and > increase the scope where I can use php. > >>> It intimidates less experienced programmers from asking good questions, >> >> What makes you think that he is an inexperienced programmer? What makes >> you think that these are good questions? He is saying that he doesn't >> like the way that PHP works and wants it changed to suit his personal >> needs. > > inexperienced I am not, perfect I am not. all questions are good > questions, how can things progress when nobody questions? I love the way > currently php works and I'd like (and can see a need in certain > circumstances for) a bit of optional functionality which would increase, > yes my, productivity. I'm sure though if this can increase my productivity > it can increase others as well - I'd like to hear from some of the spl_ > and pdo_ devs on this, not to mention those who currently make orm's for > php such as the one in symphony. > >>> lest they get treated the way Nathan was. And isn't helping out less >>> experienced coders one of the reasons this list exists? >>> >>> And it also makes others less inclined to participate, or drop off the >>> list entirely. >> >> If it stops feeble minded people from filling this forum with useless >> requests then surely that's a good thing? Personally I'm sick and tired >> from reading posts such as this which say "I'm used to language X, and my >> feeble brain cannot cope with the differences, so why can't PHP be >> changed to behave like language X?" > > there you go with the feeble minded again tony.. > a: this wasn't a useless request, it was a request for opinions and votes. Yes, I think that any programmer who wants to change PHP so that it looks and feels more like his current language of choice simply because he cannot cope with the differences is feeble minded. > b: I'm used to PHP, it is my one of my current primary languages and has > been for a long time; I help others with both simple and complex problems > on this list and devote a hell of a lot of my personal time to helping > people use php to do what they want. I am definately an advocate of php, > contribute to open source projects and release packages which many > thousands of people around the world use. I've also used many other > languages and can see advantages and disadvantages to all of them; I'm not > so niave or feeble minded to think that php is perfect the way it is, it's > not - but it's a damn good language. > > c: nothing I'm suggesting would have any effect on you're php the cobol > way approach, I can easily cope with the difference, can you comprehend > that it wouldn't be changing any existing functionality only adding new > *optional* functionality. As others have already pointed out it would simply not be feasible to change PHP so that it can be switched between dynamic typing to static typing at the flick of a switch. PHP is dynamicly typed, so either get used to it or switch to a different language. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > PHP has support for objects and classes, right down to type hinting on > arguments, exceptions, inheritance, reflection the whole lot - to add in > the bits that are missing seems rather logical to me; thats why we've got > the OO features that already exist. &
Re: [PHP] Re: Opinions / Votes Needed
"Nathan Rixham" wrote in message news:49737051.9080...@gmail.com... > Tony Marston wrote: >> "Nathan Rixham" wrote in message >> news:497366f5.2030...@gmail.com... >>> Tony Marston wrote: >>>> "Skip Evans" wrote in message >>>> news:49723137.2010...@bigskypenguin.com... >>>>> Wow, Tony, do you think in the future you could try to express >>>>> yourself with just a bit more civility and in a less condescending >>>>> tone? >>>>> >>>>> Nathan expressed some thoughts he had, politely, and when out of his >>>>> way to come across in a non-critical and non-confrontational manner. >>>>> >>>>> Tony Marston wrote: >>>>>> Absolute rubbish! >>>>> There's just no need to insult other list members like this. >>>> Saying that someone's ideas are absolute rubbish is not an insult. >>>> Calling him a moron would be, but I did not. >>> agreed, tone and meaning are so hard to convey using written words >>> alone. (you did say I was feeble brained though..) >>> >>>>> Frankly, it's this kind of treatment that make these lists less >>>>> productive than they could be. >>>> And you think that his ideas for changing PHP to suit his particular >>>> programming style would be productive? I think not. >>> you think not; I know they'd raise my productivity in php somewhat and >>> increase the scope where I can use php. >>> >>>>> It intimidates less experienced programmers from asking good >>>>> questions, >>>> What makes you think that he is an inexperienced programmer? What makes >>>> you think that these are good questions? He is saying that he doesn't >>>> like the way that PHP works and wants it changed to suit his personal >>>> needs. >>> inexperienced I am not, perfect I am not. all questions are good >>> questions, how can things progress when nobody questions? I love the way >>> currently php works and I'd like (and can see a need in certain >>> circumstances for) a bit of optional functionality which would increase, >>> yes my, productivity. I'm sure though if this can increase my >>> productivity it can increase others as well - I'd like to hear from some >>> of the spl_ and pdo_ devs on this, not to mention those who currently >>> make orm's for php such as the one in symphony. >>> >>>>> lest they get treated the way Nathan was. And isn't helping out less >>>>> experienced coders one of the reasons this list exists? >>>>> >>>>> And it also makes others less inclined to participate, or drop off the >>>>> list entirely. >>>> If it stops feeble minded people from filling this forum with useless >>>> requests then surely that's a good thing? Personally I'm sick and tired >>>> from reading posts such as this which say "I'm used to language X, and >>>> my feeble brain cannot cope with the differences, so why can't PHP be >>>> changed to behave like language X?" >>> there you go with the feeble minded again tony.. >>> a: this wasn't a useless request, it was a request for opinions and >>> votes. >> >> Yes, I think that any programmer who wants to change PHP so that it looks >> and feels more like his current language of choice simply because he >> cannot cope with the differences is feeble minded. > > but tony.. PHP is my current language of choice.. If it is your language of choice the it must be better than the alernatives. So if it is better then why are you saying that it is virually unusable without the "improvements" that you have suggested? >>> b: I'm used to PHP, it is my one of my current primary languages and has >>> been for a long time; I help others with both simple and complex >>> problems on this list and devote a hell of a lot of my personal time to >>> helping people use php to do what they want. I am definately an advocate >>> of php, contribute to open source projects and release packages which >>> many thousands of people around the world use. I've also used many other >>> languages and can see advantages and disadvantages to all of them; I'm >>> not so niave or feeble minded to think that php is perfect the way it >>> is, it's not - but it's a damn good language
Re: [PHP] Re: Opinions / Votes Needed
"Stuart" wrote in message news:a5f019de0901181015g5e2db21fn2782839ab9648...@mail.gmail.com... > 2009/1/18 Tony Marston : >> >> "Nathan Rixham" wrote in message >> news:497366f5.2030...@gmail.com... >>> Tony Marston wrote: >>>> "Skip Evans" wrote in message >>>> news:49723137.2010...@bigskypenguin.com... >>>>> Wow, Tony, do you think in the future you could try to express >>>>> yourself >>>>> with just a bit more civility and in a less condescending tone? >>>>> >>>>> Nathan expressed some thoughts he had, politely, and when out of his >>>>> way >>>>> to come across in a non-critical and non-confrontational manner. >>>>> >>>>> Tony Marston wrote: >>>>>> Absolute rubbish! >>>>> There's just no need to insult other list members like this. >>>> >>>> Saying that someone's ideas are absolute rubbish is not an insult. >>>> Calling him a moron would be, but I did not. >>> >>> agreed, tone and meaning are so hard to convey using written words >>> alone. >>> (you did say I was feeble brained though..) >>> >>>>> Frankly, it's this kind of treatment that make these lists less >>>>> productive than they could be. >>>> >>>> And you think that his ideas for changing PHP to suit his particular >>>> programming style would be productive? I think not. >>> >>> you think not; I know they'd raise my productivity in php somewhat and >>> increase the scope where I can use php. >>> >>>>> It intimidates less experienced programmers from asking good >>>>> questions, >>>> >>>> What makes you think that he is an inexperienced programmer? What makes >>>> you think that these are good questions? He is saying that he doesn't >>>> like the way that PHP works and wants it changed to suit his personal >>>> needs. >>> >>> inexperienced I am not, perfect I am not. all questions are good >>> questions, how can things progress when nobody questions? I love the way >>> currently php works and I'd like (and can see a need in certain >>> circumstances for) a bit of optional functionality which would increase, >>> yes my, productivity. I'm sure though if this can increase my >>> productivity >>> it can increase others as well - I'd like to hear from some of the spl_ >>> and pdo_ devs on this, not to mention those who currently make orm's for >>> php such as the one in symphony. >>> >>>>> lest they get treated the way Nathan was. And isn't helping out less >>>>> experienced coders one of the reasons this list exists? >>>>> >>>>> And it also makes others less inclined to participate, or drop off the >>>>> list entirely. >>>> >>>> If it stops feeble minded people from filling this forum with useless >>>> requests then surely that's a good thing? Personally I'm sick and tired >>>> from reading posts such as this which say "I'm used to language X, and >>>> my >>>> feeble brain cannot cope with the differences, so why can't PHP be >>>> changed to behave like language X?" >>> >>> there you go with the feeble minded again tony.. >>> a: this wasn't a useless request, it was a request for opinions and >>> votes. >> >> Yes, I think that any programmer who wants to change PHP so that it looks >> and feels more like his current language of choice simply because he >> cannot >> cope with the differences is feeble minded. > > And I think any participant on this list who cannot reasonably respond > to perfectly reasonable suggestions In case you have forgotten what this thread is about, the OP gave a list of suggested "improvements" to PHP and asked for opinions. I merely gave my opinion that these "improvements" would be a waste of time as they would add nothing to the language (IMHO, of course). How many in this frum have expressed any support for any of these "improvements"? > without resorting to child-like > name-calling should reconsider their personal brand. Every time I see > you "contribute" to this list you manage to lessen the respect I have > for you as a person nevermind as a developer. > > PHP would not have the OO capabilities it has if develop
Re: [PHP] Re: Opinions / Votes Needed
"Stuart" wrote in message news:a5f019de0901181322i2a4cbfaam4d36eff843f42...@mail.gmail.com... > 2009/1/18 Tony Marston : >> In case you have forgotten what this thread is about, the OP gave a list >> of >> suggested "improvements" to PHP and asked for opinions. I merely gave my >> opinion that these "improvements" would be a waste of time as they would >> add >> nothing to the language (IMHO, of course). How many in this frum have >> expressed any support for any of these "improvements"? > > That's not the point. You attacked the suggester not the suggestions. > That's all I'm trying to point out. There's a way to disagree in a > reasonable manner. Anybody who suggests that PHP be changed from dynamic typing to static typing is feeble minded, one brick short of a full load, one sandwich short of a picnic, off his trolley, talking out of the wrong end of his alimentary canal, etc, etc. In my humble opinion, of course. >> "not be feasible" covers "loss of performance", "loss of BC" and "a whole >> bunch of other issues". If the cost of implementing your "improvements" >> is >> not worth the dubious benefit then why should they considered? > > Without adequate investigation or comment from people who actually > know about this stuff it's impossible to say whether the costs are too > great to make them acceptable against the benefits. > > OO had a massive negative effect on performance, but it still happened > because the benefits greatly outweighed the costs. IMHO all ideas > should be properly considered, regardless of my gut reaction to them. Statuic typing is unworthy of consideration in a language whch has made its bones from being dynamically typed. In my humble opinion, of course. -- Tony Marston http://www.tonymarston.net http://www.radicore.org >>> As far as your "if I can do it why can't you" comment goes, I don't >>> think anything has been said that would imply Nathan is not just as >>> capable of developing complex systems as you think you are. He has >>> expressed a wish for some additional features in PHP because he's used >>> other languages with those features and he likes them. Does this mean >>> he's inexperienced or incapable? No, and it's a shame you can't see >>> past the end of your superiority complex and acknowledge that. >> >> I never said that I am superior, just that the lack of these requested >> features has not stopped me, or many other PHP programmers I would >> imagine, >> from writing large, complex applications with PHP. I have used many >> languages in my 35+ year career, and I am far more productive with PHP >> than >> I have been with all the others. > > People rarely say they're superior, but that opinion often comes > across in the way they interact with others. I don't care how long > your career has been, there's a way to productively deal with other > people. > > Coming back to the OO example, a lot of us got a lot done before that > came along, but that didn't make it any less welcome when it arrived, > and someone had to take the first step and suggest it. Attack people > for making suggestions and you'll quickly lose a valuable source of > ideas. > > I'm done with this now as you're clearly set in your ways and it's not > adding value to the discussion. > > Nathan: I see you've taken this over to the internals list. I wish you > luck with your suggestions. Keep 'em coming. > > -Stuart > > -- > http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
"Nathan Rixham" wrote in message news:4973b738.3010...@gmail.com... > Tony Marston wrote: >> "Stuart" wrote in message >> news:a5f019de0901181322i2a4cbfaam4d36eff843f42...@mail.gmail.com... >>> 2009/1/18 Tony Marston : >>>> In case you have forgotten what this thread is about, the OP gave a >>>> list of >>>> suggested "improvements" to PHP and asked for opinions. I merely gave >>>> my >>>> opinion that these "improvements" would be a waste of time as they >>>> would add >>>> nothing to the language (IMHO, of course). How many in this frum have >>>> expressed any support for any of these "improvements"? >>> That's not the point. You attacked the suggester not the suggestions. >>> That's all I'm trying to point out. There's a way to disagree in a >>> reasonable manner. >> >> Anybody who suggests that PHP be changed from dynamic typing to static >> typing is feeble minded, one brick short of a full load, one sandwich >> short of a picnic, off his trolley, talking out of the wrong end of his >> alimentary canal, etc, etc. In my humble opinion, of course. > > luckily.. nobody suggested that You suggested that. You original post specifically said "static typing" and not "type hinting". There is a BIG difference. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > and the only person who came close was tony himself :D perhaps the phrase > "optional type hinting of variables and class properties" is more > appropriate ;) > >>>> "not be feasible" covers "loss of performance", "loss of BC" and "a >>>> whole >>>> bunch of other issues". If the cost of implementing your "improvements" >>>> is >>>> not worth the dubious benefit then why should they considered? >>> Without adequate investigation or comment from people who actually >>> know about this stuff it's impossible to say whether the costs are too >>> great to make them acceptable against the benefits. >>> >>> OO had a massive negative effect on performance, but it still happened >>> because the benefits greatly outweighed the costs. IMHO all ideas >>> should be properly considered, regardless of my gut reaction to them. >> >> Statuic typing is unworthy of consideration in a language whch has made >> its bones from being dynamically typed. In my humble opinion, of course. >> > > luckily.. nobody suggested that and the only person who came close was > tony himself :D perhaps the phrase "optional type hinting of variables and > class properties" is more appropriate ;) > > ground hog day! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opinions / Votes Needed
""Daniel Brown"" wrote in message news:ab5568160901191010u2d4073aas33789f0c81183...@mail.gmail.com... > On Sun, Jan 18, 2009 at 12:36, Tony Marston > wrote: >> >> Really? In 2007 I single-handedly designed and built an ERP system with >> 130 >> database tables, 230 relationships and 1000 screens, all with PHP and >> without an ORM and static typing. This took me 6 months. If you can't >> equal >> that then either you are not much of a programmer, or your development >> style >> is not as good as you think it is. > >And yet, just a few months ago, you couldn't figure out how to > launch a background process from PHP[1]. Launching a background process is easy (yes, even I can read the manual) but what I wanted to do was launch a background process and leave it running while the launching script continued on to something else. The example in the manual did not work for me, so I asked if there was an alternative solution. >Lesson: Alzheimer's is a bitch. > >> If you want a good ORM then write one yourself, or is that beyond your >> capabilities? >> >> Personally I wouldn't touch an ORM with a barge pole. I develop >> applications >> using the 3 Tier Architecture (no, it's not the same as MVC) with a Data >> Access layer that I can easily switch between MySQL, PostgreSQL and >> Oracle. >> If I can do it then why can't you? > >The pattern I note here is, "I have been the best programmer since > 1977, and the standard of 'Good v. Bad' must be judged by me." Now you're being disingenuous by quoting things which I did not say. I did not say that I have been the *best* programmer since 1977, nor did I say that the standard of Good v. Bad must be judged by me. I was just pointing out that if a simpleton like me can do those things then why can't all these so-called gurus? > In > your section "My career history - disasters I have encountered"[2], > you list three projects that didn't go as expected. That's a great > ratio, considering the level of success you've probably had in > counter. I'd admit at least a dozen projects over the years that > ended in failure or less-than-successfully. The issue I see is that, > in the three examples, your summary of what led to the failure was the > fault of others. That is correct. Every project where I was in charge and never ended in failure. It was only those projects which were controlled by others which goyt screwed up. Two of those were government contracts. >Question: Why hath they forsaken Thee, Lord?!? > >> If you spend a year writing useless code, then it's your fault, not PHPs. >> It's a bad workman who blames his tools. > >For this statement, I completely agree. Please, do not let others know that you agree with me. That might be seen as setting an embarrassing precedent. :) > I'm not entirely sure > where I see blame being placed on the language, but perhaps I've > missed something. What I do see is that PHP is an adaptable language, > intended to be molded, customized, and extended for each individual > scenario. While changing the language in its core and releasing that > as the official package will affect thousands of developers and > countless lines of code, it is irresponsible and counterproductive to > tell someone that they can not garner the opinions of others who would > be interested to join in a project, outside of the core, to effect > those changes; worse still to belittle someone in public. As the > saying goes, "'tis better to keep one's mouth closed and be thought a > fool than to open it and remove all doubt." In writing, this is even > truer. > >Observation: It is a bad workman who blames his tools, but it is a > feeble-minded workman who shits where he eats: one who wastes billions > of processor cycles to insult someone's intelligence in the same forum > in which he announces his own framework. Why is it considerd bad form to insult the intelligence of a feeble minded twat who requests that PHP be changed from a dynamically typed to a statically typed language? He later changed it to type hinting on variables, but the original request was definitely for static typing. > >KEY: > >1: > http://article.gmane.org/gmane.comp.php.general/190836/match= >2: http://www.tonymarston.net/aboutme/disasters.html > > -- > > daniel.br...@parasane.net || danbr...@php.net > http://www.parasane.net/ || http://www.pilotpig.net/ > Unadvertised dedicated server deals, too low to print - email me to find > out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Client/Server Printing
"Paul M Foster" wrote in message news:20090120151606.gu18...@quillandmouse.com... > I'd like a side check on what I'm doing to print on our internal > network. > > We have an internal server/site which uses PHP code I've written to > "run" the business-- invoicing, A/P, inventory, etc. Some things, like > invoices and reports, need to be printed. Now remember, the code is on > the server, and we access it from our client machines on our desks. When > we print, we do so to our local printers, attached to the client > machines. > > So the best way I could think of to making printing work was to generate > PDFs of whatever needs to be printed, dump the PDF on the server, and > provide a link to the PDF on the web page. The user clicks on the > generated PDF, and his/her browser opens up Acrobat or xpdf, and prints > from that application to their local machine. > > Is that a reasonable way to implement this? Any better ideas? I have built an application similar to yours, and I have solved the printing problem by using software from the following two companies: http://www.nicelabel.com and http://www.namtuk.com/autoprintemail.aspx Basically the user runs a web page which generates the required report, in either XML or PDF format (I believe others are available) and sends an email which identifies a particular client printer. At the client end, with any number of PCs and printers, there is a piece of software running which looks for these emails, and when one is received it sends the print to the designated printer. Each report can be tailored to output to any printer, including a specific printer for each user. This means that the user does not see the generated report in his web browser and then have to press the PRINT key and choose the printer before it gets printed. He simply presses a "Generate Report" button, and within a few seconds it is sent to the printer. It's not free, but it's worth the money (IMHO). -- Tony Marston http://www.tonymarston.net http://www.radicore.org > Paul > > -- > Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: process creation
I have achieved this by using curl_exec() to issue another HTTP request on the same server. By setting the timeout to a small number I regain control and can continue with other things while the new process runs to completion. Here is my code: $url = 'HTTP://' .$_SERVER['HTTP_HOST'] .'/newprocess.php'; // launch this script in another server process, but let it run $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 2); $content = curl_exec($ch); if ($content === FALSE) { $curl_errno = curl_errno($ch); if ($curl_errno == 28) { // timeout - ignore } else { $curl_error = curl_error($ch); $errors[] = "CURL error $curl_errno: $curl_error"; } // if } // if curl_close($ch); Hope this helps. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""bruce"" wrote in message news:156301c97d82$b33698d0$0301a...@tmesa.com... >A simple question (or so I thought). > > Does php allow an app to create/start a process/application that can > continue to run on its own, after the initiating program/app terminates? > > It appears that the spawning/forking functions might work, but the child > apps would be in a zombie status, and couldn't be killed by an external > program. > > Basically, I'd like to create a bunch of test apps/processes, and then to > be > able to kill them by a separate process if the apps take too long to run.. > > So.. thoughts/comments would be appreciated! > > thanks > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP webhosting - USA
I have been using www.lypha.com for 5 years without experiencing any of those problems. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""Martin Zvarík"" wrote in message news:ed.1b.55096.ccd2b...@pb1.pair.com... > Hi, > > I currently host my site by Powweb, and I am WANT to change it - can you > guys recommend me something good? > > Powweb's website looks awesome and it's the best marketing I think I had > saw! After a minute it makes you think there is NO better hosting - and > it's a LIE. > > What happened to me? > > - database connection were exceeded, I read many people had problems with > their phorums not working etc., the solution: I put a message to the > visitor that he has to wait (it was not frequent so I didn't care much) > > - my client stopped receiving orders, he called me after a week something > is wrong. I found out that Powweb changed a MySQL settings, which nobody > informed me about - they restricted a JOIN limit max to 3, the mysql_query > SQL thus did not work and orders were not storing for 7 days! > > - the suport is HORRIBLE - they don't give you email, but they have this > ONLINE support, meaning: you wait 10-20 minutes on queue, and then they > talk to you like a robots and usually tell you something you already know. > > - now they automatically changed all my passwords so they can keep me > secure! what's cool is that I cannot change it back to what I have! Hey, > the chance of getting me hit by bus is higher than someone cracking my 15 > letter password with numbers! Thank you powweb for keeping me secure. > > Thanks for reading my story, > now, does someone know a better hosting alternative? > > Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Looking for some PHP OO programming guides
Take a look at http://www.tonymarston.net/php-mysql/databaseobjects.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Michael Kubler" wrote in message news:49918ebf.4070...@gmail.com... > Hi, > I'm just getting into programming in an Object Oriented fashion, and am > looking for some guides, tutorials, hints, tips, etc... > > I only just found out that you remove the $ from variables when calling > them from $this-> > > e.g : > class People > { > private $person = "not set"; >function __construct() >{ > *$person* = "A person"; //This doesn't work (well it creates a > variable $person that only has the scope of the current function from > what I can gather).. > $this->*person* = "A person"; //This works properly > } >function display_list() >{ >echo $person; //This doesn't work > echo $this->person; //This works. >} > } > > $person= new People; > $person->display_list(); > ?> > > > Instead of painstakingly working out most of the other mistakes I'm > likely to make, I'd love to read about other peoples issues they had > with learning OO so I can skip most of the hard stuff, and only make > small mistakes (hopefully). > -- > > Michael Kubler > *G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: paging
Take a look at http://www.tonymarston.net/php-mysql/pagination.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Jim Douglas" wrote in message news:col119-w57b0a24af94fce04673622bb...@phx.gbl... Does anyone have a link to any examples of paging? I have this example up and running, http://www.w3schools.com/php/php_ajax_database.asp I have paging working as below, my problem is when I add a CSS style sheet I now have 4 panes. How can I direct the paging results to the "content" pane? "; while($row = mysql_fetch_array($result)) { if($bgcolor=='#f1f1f1'){$bgcolor='#ff';} else{$bgcolor='#f1f1f1';} echo ""; //echo " " . $row['bar_name'] . ""; echo " "; echo " " . $row['bar_name'] . ""; echo ""; } echo ""; if($nume > $limit ){ // Let us display bottom links if sufficient records are there for paging /// Start the bottom links with Prev and next link with page numbers / echo ""; if our variable $back is equal to 0 or more then only we will display the link to move back if($back >=0) { print "PREV"; } } echo ""; $i=0; $l=1; for($i=0;$i < $nume;$i=$i+$limit){ if($i <> $eu){ //echo " $l "; echo " $l "; } else { echo "$l";} $l=$l+1; } mysql_close($con); _ Windows Live: Keep your life in sync. http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_allup_howitworks_022009 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: paging
"Richard Heyes" wrote in message news:af8726440902101100r4d479ddds189b617f06b88...@mail.gmail.com... >> ... > > Are you the same Tony Marston who was on the Demon Internet webmaster > type mailing list? (I don't remember the actual name). I doubt it. I don't subscribe to any list with either "demon" or "webmaster" in its name, although Demon Internet is my ISP. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > -- > Richard Heyes > > HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: > http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Frameworks Which Have A "Bake" Function?
"Nitsan Bin-Nun" wrote in message news:d47da0100903220852v565771e5r9a3a72184a0a...@mail.gmail.com... > Hi Guys, > > I have been using cakephp for a while as a development framework. > > I'm also thinking for a while to use another framework and leave cakephp > alone (too much babbling.. it takes too much time until you get to the > code > itself..), now I have decided to move on and here comes my question. > > Do you have any suggestions on frameworks which have something similar to > the cakephp's "bake" function? (you create your database tables structure, > run bake.php from ssh and kaboom! you have model/view/controller for each > of > the tables: insert, delete, modify, list data). > > I know it is possibile in ROR but never heard of any other framework or > development library or anything like that in php except cakephp that gives > you this functionallity. > > Thanks in Advance, > Nitsan All this is possible with the Radicore framework, but it is more sophisticated. It requires the following steps: (1) Import your database table structures into the Data Dictionary (see http://www.tonymarston.net/php-mysql/data-dictionary.html and http://www.tonymarston.net/php-mysql/menuguide/appendixn.html) (2) Export each database table to produce the class file for that table. (3) Generate a task by choosing a database table and a Transaction Pattern (see http://www.tonymarston.net/php-mysql/dialog-types.html). The list of transaction patterns which are available is more extensive than the basic list, search, create, read, update and delete. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Frameworks Which Have A "Bake" Function?
"Nitsan Bin-Nun" wrote in message news:d47da0100903220910q7bb66706s6255f0fc89b98...@mail.gmail.com... > Don't forget to attach the message to the list. > > Regarding the frameworks, which of them, for your opinion, will take the > fastest time to learn and get into code? Generally speaking if something is fast to learn it is also the first to run out of steam. If it doesn't have more features than you can learn in five minutes the it doesn't have enough features to do anything useful, or with any degree of flexibility. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > Thanks > > On Sun, Mar 22, 2009 at 5:59 PM, Graham Christensen < > graham.christen...@iamgraham.net> wrote: > >> Look into Doctorine &|| Propel, they both will take a db structure -> >> models. Symfony might be worth looking at, you can tell it to create a >> basic >> view/controller for them as well. >> >> Graham >> >> On Mar 22, 2009, at 11:52 AM, Nitsan Bin-Nun wrote: >> >> Hi Guys, >>> >>> I have been using cakephp for a while as a development framework. >>> >>> I'm also thinking for a while to use another framework and leave cakephp >>> alone (too much babbling.. it takes too much time until you get to the >>> code >>> itself..), now I have decided to move on and here comes my question. >>> >>> Do you have any suggestions on frameworks which have something similar >>> to >>> the cakephp's "bake" function? (you create your database tables >>> structure, >>> run bake.php from ssh and kaboom! you have model/view/controller for >>> each >>> of >>> the tables: insert, delete, modify, list data). >>> >>> I know it is possibile in ROR but never heard of any other framework or >>> development library or anything like that in php except cakephp that >>> gives >>> you this functionallity. >>> >>> Thanks in Advance, >>> Nitsan >>> >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fpdf adding font error
If you want to use UTF-8 fonts with FPDF then switch to TCPDF (www.tcpdf.org) -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Thodoris" wrote in message news:49ccee54.80...@kinetix.gr... > Hello gang, >I know this is not an fpdf mailing list but if anyone has experience on > the matter please help. I am working on a pdf generation part of a project > and I am using fpdf to generate them. > >The content of the pdf needs to be in greek. But I am having > difficulties to get the pdf generated properly. This means that I can't > see the greek in the pdf file that is generated. I have tried to set the > encoding to non-UTF since fpdf doesn't support UTF-8 but the problem still > remains. As a second solution I am trying to add new fonts with the > ISO-8859-7 encoding but it doesn't work as expected. The font is not being > although I am following the fpdf's directions step-by-step. > > > Does anybody know another way to generate pdf files with greek properly or > can help me with the fpdf?? > > Thanks in advance. > > -- > Thodoris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple return statements in a function.
"tedd" wrote in message news:p06240805c6161613a...@[192.168.1.101]... > At 8:12 AM -0400 4/23/09, Peter van der Does wrote: >>I tend to put my return value in a variable and at the end of the >>function I have 1 return statement. >>I have seen others doing returns in the middle of the function. >> >>-snip- >> >>What is your take? And is there any benefit to either method? >> >>Peter van der Does > > Peter: > > It's called "Structured programming" -- one way in and one way out of a > function. > > There are, of course, exceptions where it might help others reviewing your > code to see what's going on, such as returning a null value if the > argument(s) provided are not suitable. But normally the rule is, do not > provide an exit from a function in more than one place. There is no such "rule", it is a matter of personal preference. As a previous poster has already said, if you want to leave a function early and ignore all subsequent processing it is easier to understand if you return immediately rather than have a mechanism to jump over the remaining code to a single return point. In the good old days we used to use the GOTO in COBOL to jump to the exit point, but then people found a way to abuse GOTO in very imaginatve ways. > The "benefit" is easier to read code. I think that an immediate return is easier to read, but what do I know - I've only been programming for 30 years. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > 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] Self-Process php forms or not?
Having a script that is self executing - when it posts back to itself instead of a separate script - has absolutely nothing to do with the separation of business and presentation. It is possible for a single script to use separate components for the presentation, business and data access layers. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""MEM"" wrote in message news:002b01c9c4dd$08569bc0$1903d3...@com... > So, on your opinion, we can call that method, on some circumstances, a > good > practice? > > What about the moto: "let's separate business from presentation?" > > > Thanks once again, > Márcio > -Original Message- > From: Sándor Tamás (HostWare Kft.) [mailto:sandorta...@hostware.hu] > Sent: sexta-feira, 24 de Abril de 2009 13:53 > To: 'PHP-General List' > Subject: Re: [PHP] Self-Process php forms or not? > > I think the main advantage is that if something goes wrong processing > the > datas, you can show the form again without redirecting again. > > And if you have to change the behavior of the page, you have to change > only > one file instead of two. > > SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Self-Process php forms or not?
What you are describing is known as a "self executing" script where the script posts back to itself. In other words it has two passes - the first uses the GET method to build the screen for the user, which may or may not be empty, while the second uses the POST method to send the user's changes back to the server for validation and updating. By dealing with both the GET and POST in a single script it means that you don't have to redirect to a different script if you have to redisplay the data because of invalid use input. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""MEM"" wrote in message news:002301c9c4d9$03515920$09f40b...@com... I'm trying to understand the advantages behind opting by using a Self-Process PHP Form, instead of having a form and then point the action of the form to another .php page. Can anyone point me some resources about this. Why using one instead of another. What are the main advantages? Regards, Márcio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Forms validation and creation- easier solution?
"Daniele Grillenzoni" wrote in message news:16.1e.28112.84ca5...@pb1.pair.com... > On 20/05/2009 9.03, Angelo Zanetti wrote: >> Hi all. >> >> >> >> We have done quite a few projects and we are looking to find better ways >> to >> implementing forms. >> >> >> >> Forms seem to be quite time consuming and repetitive. >> >> >> >> Generally are there any classes or libraries that will assist with: >> >> >> >> 1. Easy creation of forms (fields and layout) >> >> 2. Validation of specific fields within the forms (server side not JS) >> >> 3. Decrease in time required to setup the forms pages >> >> any other comments are welcome. >> >> >> >> Thanks in advance >> >> Angelo >> >> >> Elemental >> http://www.elemental.co.za<http://www.elemental.co.za/> >> >> Dynamic Web and Mobile Solutions >> >> >> >> >> >> > > Personally I created a little Class that handles it. > > First I create an array of associative arrays, every associative array > represents an input of an abstract type (similar to the webforms, meaning > i have stuff like type="telephone"). > > Stuff like > $inputs[]=array( > "name" => "foobar", > "required" => true, > "type" => "string", // text is reserved to textarea > "label" => "Foo Bar", > "error_required" => "you need to provide a Foo Bar value, dummy", > "group" => "main" > ); > etc. > > Then I create an array for groups. > $group["main"] = array( > "type" = "block", // types are either block which means div, set which > means fieldset, paragraph which means or a raw html opening tag. > "parent" = NULL //optional of course, if set to the name of another group, > then the group becomes a child of the referenced group. > ) > > Then I create an associative array of options for the form. > Finally, I call the class constructor with the three arrays as params. > > The class provides me with a few nifty functions: > * toHtml(); > (do I need to explain?) > * toArray(); > Returns the inputs, options, and groups inside a single array, with the > value altered when necessary > * wasSubmitted(); > Does some guesswork to see if the form was submitted, there's a lot of > smart automagicness inside. > * runAutoChecks(); > Runs the checks he can, like the validity of emails in 'type' = 'email' > inputs, pattern validation for input with a set pattern, required inputs, > fills the error array with error messages, sets class[]='error' to wrongly > filled inputs... > * wasValidInput(); > Returns true if none of the autochecks or eventual manual checks returned > an error. > > And it works like this: > [...] > if ($form->wasSubmitted()){ > $form->runAutoChecks(); > /* Additional non-automatable controls */ > // None in this case > if ($form->wasValidInput()){ > // success, do stuff > } else { > // show errors and form again > } > } else { > echo $form->toHtml(); > } > > There are other things I didn't list, like the fact that ever input has > options to specify a wrapper (class and id are associated to the wrapper > if it's defined), the form encoding automatically changes in case of a > file input, etc etc etc... > > The types are abstracted enough that one could easily make a function that > automatically creates the code for a first draft of the forum out of the > db schema of an eventual table. Of course you'd have to provide error > messages, remove unnecessary inputs, adding new ones... Your ideas are similar to mine, but I have a much more advanced implementation which involves the use of a Data Dictionary. After building a database table I import the structure into my data dictionary, then export it to create a database table class and a table structure file. Still using the data dictionary I can then build the family of transactions to maintain that database table. This uses a standard set of page controllers and XSL templates to build the HTML. So within 5 minutes I can run the transactions to list, search, add, enquire, delete and update that database table without having to write a single line of SQL or HTML. In most cases I don't even have to write a single line of PHP. Is your method as fast as that? All this functionality exists within the Radicore framework, so you can download it and try it for yourself. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Re: PHP, OOP and AJAX
wrote in message news:000e0cd6ad1a9f7d3d046af89...@google.com... > Two things: > > 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of > foo/bar.php) > 2. Look at setting up autoloading so you don't need to manually include > anyway. If you're going OOP, autoloading is a must! I totally disagree. I have been doing OOP with PHP for years, and I have never used autoloading. It is just a feature that can be used, misused or abused just like any other. I choose not to use it, and my code does not suffer in the least! -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Re: PHP, OOP and AJAX
"Eddie Drapkin" wrote in message news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com... > Your code might not, but you sure do! Spending all that time writing > require statements = :( If you are too lazy to write "require" statements then you are probably too lazy to write readable, well structured and efficient code. Besides, I don't use "require" statements, I use $dbobject =& singleton::getInstance('classname'); I don't use autoload because *I* want to be in control. I prefer not to rely on automatuic features which may not work as expected. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > On Thu, May 28, 2009 at 9:49 AM, Tony Marston > > wrote: > >> >> wrote in message >> news:000e0cd6ad1a9f7d3d046af89...@google.com... >> > Two things: >> > >> > 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead >> > of >> > foo/bar.php) >> > 2. Look at setting up autoloading so you don't need to manually include >> > anyway. If you're going OOP, autoloading is a must! >> >> I totally disagree. I have been doing OOP with PHP for years, and I have >> never used autoloading. It is just a feature that can be used, misused or >> abused just like any other. I choose not to use it, and my code does not >> suffer in the least! >> >> -- >> Tony Marston >> http://www.tonymarston.net >> http://www.radicore.org >> >> >> >> >> -- >> 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: Re: [PHP] Re: PHP, OOP and AJAX
"Eddie Drapkin" wrote in message news:68de37340905280801m6964d355l2d6d8ef773f3b...@mail.gmail.com... > There's a huge difference between laziness and opting in to use an > incredibly useful (and easy to properly deploy) feature to save myself > time > so that I can spend more time writing that structured and efficient code > of > which you speak. And the problem with what you're saying is that you > still > have to include 'singleton.php' somewhere in order to call its static > methods, I have a single general purpose include file which autmatically includes all other standard files, so I never have to explicity load my singleton class. > and I'd rather just spend 30 minutes writing an autoloader object > and letting it deal with finding any of the classes I use then trying to > keep track of legacy code I didn't write and require'ing them all over the > place. I'd rather not waste 30 minutes of my time writing a feature that I don't need. The difference between using and not using the autoload feature does not have any measurable impact on either my development times, nor the execution of my code, so I choose to not use it. That's my choice, and I'm sticking to it. > The way I look at it, if you spend all your time handling things that you > could automate - and if written properly, will always work as expected > (it's > called unit testing and debugging) - then you have no time to write that > structured and efficient code in order to meet your deadlines! :) Not using autoload does not have any noticeable effect on my deadlines, so I have no incentive to use it. Just because you say that I *should* use it carries no weight at all. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > On Thu, May 28, 2009 at 10:53 AM, Tony Marston < > t...@marston-home.demon.co.uk> wrote: > >> "Eddie Drapkin" wrote in message >> news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com... >> > Your code might not, but you sure do! Spending all that time writing >> > require statements = :( >> >> If you are too lazy to write "require" statements then you are probably >> too >> lazy to write readable, well structured and efficient code. Besides, I >> don't >> use "require" statements, I use >>$dbobject =& singleton::getInstance('classname'); >> >> I don't use autoload because *I* want to be in control. I prefer not to >> rely >> on automatuic features which may not work as expected. >> >> -- >> Tony Marston >> http://www.tonymarston.net >> http://www.radicore.org >> >> > On Thu, May 28, 2009 at 9:49 AM, Tony Marston >> > > >> wrote: >> > >> >> >> >> wrote in message >> >> news:000e0cd6ad1a9f7d3d046af89...@google.com... >> >> > Two things: >> >> > >> >> > 1. Try using the fully qualified path (ie /var/www/foo/bar.php >> >> > instead >> >> > of >> >> > foo/bar.php) >> >> > 2. Look at setting up autoloading so you don't need to manually >> include >> >> > anyway. If you're going OOP, autoloading is a must! >> >> >> >> I totally disagree. I have been doing OOP with PHP for years, and I >> >> have >> >> never used autoloading. It is just a feature that can be used, misused >> or >> >> abused just like any other. I choose not to use it, and my code does >> >> not >> >> suffer in the least! >> >> >> >> -- >> >> Tony Marston >> >> http://www.tonymarston.net >> >> http://www.radicore.org >> >> >> >> >> >> >> >> >> >> -- >> >> 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Web application design considerations - a good reference ?
If you are building a business application with PHP rather than an ordinary website then I suggest that you use a framework instead of trying to reinvent the wheel (and making a hash of it). The Radicore framework was specifically designed for CRUD applications - it uses forms to perform Create/Read/Update/Delete operations on the database - so it would be a better fit than one which was designed for common-or-garden websites. The heart of any database application is the database design. Get this wrong and you are stuffed from the very start. Once you have used the rules of data normalisation to design your database you simply build it, then import the database into the Radicore data dictionary. Then you export each table to produce a class file for that table. Still in the data dictionary you can build end-user transactions by selecting a database table, a transaction pattern, then pressing the 'generate' button. This will generate the scripts and the screen layouts to access the table, and you can run these scripts through the Radicore menu system. All this without having to write a single line of SQL, HTML or even PHP. The only PHP code you need to write is when you want to alter the default behaviour or implement custom business rules. The Radicore framework comes with a built-in Role Based Access Control (RBAC) system, and Audit Logging system and a Workflow system. It was designed using the Three Tier Architecture and MVC design patterns, so makes maximum use of reusable modules. There is an enormous amount of documentation to be found at http://www.radicore.org as well as a tutorial and some sample applications. Try it and see. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""Angus Mann"" wrote in message news:e23929c24916447cbef5c45eac9af...@guspc... > Hi all. > > I'm working on a PHP project for my own personal business use. It will > handle billing and invoices as well as payments and time management, > bookings, appointments and a few more. I may add things like personal > messaging between the various users and a customer login to check on the > progress of their accounts. > > It is a big project and will probably take a year or so to complete in my > spare time. > > I have made a couple of starts but I have no experience in creating such > large applications and I find I often end up with spaghetti code. I've > tried using session variables to keep track of where and what the program > is doing but there are so many permuations and combinations I found myself > writing endless streams of if's, and's and or's just to figure out what > page to display. > > The code is not the probblem for me...it's the flow and organization of > the code. > > Can anybody point me to a good book or tutorial that lays down the > principles and gives some suggestions for integrating the many subroutines > of a large application? I want to make the code readable and logical in > its flow, and avoid repetition of code segments. > > Much appreciated. > Angus > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web application design considerations - a good reference?
w" file is needed for that screen. Something like: > > > > You can build each screen however you want, but it's really just form > work-- a field for name, a field for address, etc. At the bottom, a > submit button. Each form will be driven by a "controller" which sets > everything up for the view file. And it will also process the results > for the view (once the user hits the "submit" button). It will hand off > results to the "model" file, which knows all about the database, so the > model file (class) can vet and store the data properly. In Radicore the screens structure files are generated using default details from the data dictionary, but these can be customised very easily. You don't need to write page controllers as there is already a pre-built page controller for each transaction pattern. You don't need to write any code to perform primary validation (such as checking that required fields are not empty, date fields contain dates, numeric fields contain numbers,etc) as the framework does this for yo automatcally using information exported from the data dictionary. > That's the way I've done this, through two iterations of my > applications. My internal system handles customers, invoices, payables, > statistics, mailing lists, payroll, pricing, a calendar, and several > other areas for my business. Likewise I have written an entire ERP application using nothing but the Radicore framework and the Data Model Resource Book by Len Silverston. I built the PARTY, PRODUCT, ORDER, SHIPMENTS and INVENTORY databases from the shemas in the book, then used the Radicore data dictionary to generate the basic trasactions. All I had to do then was modify the table classes for the business rules, customise a few screens, and I have my working application. It is being used in real life by an online jewelery company, so it's not just an amateur product. > Others will doubtless argue about how I've done this. There are about as > many opinions about how all this should be done as there are developers. How true. How very true. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > I'm just giving you advice on how I've done it. Feel free to ask other > questions. > > Paul > > -- > Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Automated form generation?
"Shawn McKenzie" wrote in message news:4a2d8df0.4040...@mckenzies.net... > Skip Evans wrote: >> Hey guys & gals & all ships at sea, >> >> We've been approached by a central office of a relatively large >> religious denomination that collects data from their member churches in >> the form of an 11 page questionnaire with a diverse set of questions >> ranging from multiple choice, essay type, to financial statements. >> >> It's currently all hand filled out and then hand typed in to a MS Access >> database (shudder...). >> >> They want to webify it so I'm wondering if anyone has any >> recommendations on PHP based form generation tools that would speed up >> the process of form creation and perhaps even the inserts into MySQL. >> >> So far I'm looking at phpFormGenerator here >> >> http://phpformgen.sourceforge.net/ >> >> But it says "beta" which gives me some small pause, and I'm actively >> browsing for others. >> >> Any experience or advice others have here would be greatly appreciated. >> >> Any CMS out there that might have a tool for this that would be quick to >> install and get up and going? Codeigniter have one, any others??? >> >> Much thanks, >> >> Skip > > My first thought was CakePHP. Setup your database and run the cake bake > script and you will get all the forms, create, retrieve, update and > delete, as well as the PHP models and controllers to do it. Then you > just start customizing. You can do the same thing with Radicore (http://www.radicore.org) - build your database, import it into the data dictionary, export it to create the basic List/Search/Create/Read/Update/Delete transactions. All withut writing a single line of HTML, SQL or even PHP. You can customise these scripts to your heart's content As an added bonus you get a Role Based Access Control (RBAC) system, Audit Logging, Workflow, Single or Two Factor Authentication for user logons, PDF forms generation, and a whole host of other goodies. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > -- > Thanks! > -Shawn > http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple login form with cookies
No it isn't. That's just your personal preference. Mine is different. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "PJ" wrote in message news:4a54c0e8.2080...@videotron.ca... > Michael A. Peters wrote: >> Daniel Brown wrote: >>> First, a reminder to several (including some in this thread) that >>> top-posting is against the law here. >>> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple login form with cookies
What rules? I never agreed to abide by any rules before I started posting to this group. My newsreader assumes top posting by default, so I have been top posting for the past 10 years. If you don't like it then it is your problem, not mine. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Daniel Brown" wrote in message news:ab5568160907080916o1cf9b60et395458e575ee0...@mail.gmail.com... > On Wed, Jul 8, 2009 at 12:14, Tony Marston > wrote: >> No it isn't. That's just your personal preference. Mine is different. > >Uhh Tony, if that's in response to me, you're wrong. Please > read the rules before posting what you believe to be fact. ;-P > > -- > > daniel.br...@parasane.net || danbr...@php.net > http://www.parasane.net/ || http://www.pilotpig.net/ > Check out our great hosting and dedicated server deals at > http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple login form with cookies
I do not regard that as a concrete rule, and certainly not one worth bothering about. Lots of newsgroups I visited before coming here allowed top posting, so it is arrogant for someone to say "I personally don't like top posting, so I'll make a rule that disallows it". A sensible rule, and one which I have no problem in following, is that if a question is posted in English then I will answer in English. That makes sense, whereas "no top posting" does not. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Daniel Brown" wrote in message news:ab5568160907080950o7fa7af0ckbee192b34410e...@mail.gmail.com... > On Wed, Jul 8, 2009 at 12:38, Tony Marston > wrote: >> What rules? I never agreed to abide by any rules before I started posting >> to >> this group. My newsreader assumes top posting by default, so I have been >> top >> posting for the past 10 years. If you don't like it then it is your >> problem, >> not mine. > >Absolutely 100% completely incorrect, and in all honesty, that's > quite an ignorant attitude. That's not to say that I think *you* are > ignorant, but rather the attitude toward established rules and > guidelines that have been around long before you began posting, and > will remain long after you leave. > >See: >http://php.net/mailing-lists.php --- which links to: >http://php.net/reST/php-src/README.MAILINGLIST_RULES > (Specifically: "General" #3) > >So while it's my problem, it is also *your* problem, as the offender. > >If you didn't agree to rules beforehand, that's your issue. > Ignorance is not a defense. You were - or had the opportunity to be - > made aware of the rules of the list, and as such, agree to abide by > them by continuing to post in this - or any - public forum. Much the > same as, by traveling to a foreign country, you agree to be bound by > their rules and regulations. You cannot simply claim that you did not > know of a rule. > >And for the record, Gmail assumes top-posting as well. It takes > between one and three seconds to align each message properly, which is > a pain in the butt each time, I agree, but it's something that has to > be done. Otherwise, it breaks threads and makes the archives very > difficult to read --- damning the purpose of even having them there > for the benefit of others on the Internet. > >For years, we've all adapted to this, because they were the rules, > and because we respect each other enough in the community to follow > them. Here's hoping that you won't be the odd-man-out of that > respectful group. > >Thanks. > > -- > > daniel.br...@parasane.net || danbr...@php.net > http://www.parasane.net/ || http://www.pilotpig.net/ > Check out our great hosting and dedicated server deals at > http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple login form with cookies
I do not follows rules which cannot be justified beyond the expression "It is there, so obey it!" Why is it there? What are the alternatives? What harm does it do? What happens if the rule is disobeyed? Top posting existed in the early days of the internet, and for a logical reason. Then some arrogant prat came along and said "I don't like this, so I am going to make a rule which forbids it!". I don't like this rule, so I choose to disobey it. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Daniel Brown" wrote in message news:ab5568160907081021x5e88fc74t90351df08b4d3...@mail.gmail.com... > On Wed, Jul 8, 2009 at 13:02, Tony Marston > wrote: >> I do not regard that as a concrete rule, and certainly not one worth >> bothering about. Lots of newsgroups I visited before coming here allowed >> top >> posting, so it is arrogant for someone to say "I personally don't like >> top >> posting, so I'll make a rule that disallows it". A sensible rule, and one >> which I have no problem in following, is that if a question is posted in >> English then I will answer in English. That makes sense, whereas "no top >> posting" does not. > >No matter anymore. You've expressed your distaste for the rules > and your intent on disregarding them, which - in turn - shows that (a) > you believe yourself to be beyond the need to respect the guidelines > the rest of the community follows; and (b) you couldn't give a damn > about contributing to good, solid archives. > >There's certainly no way we can force you to follow the rules, so > I'm done discussing it. It's just a shame that it's not going to work > out in a manner that doesn't speak volumes about your negative > attitude toward others. > >Best of luck in everything you do. > > -- > > daniel.br...@parasane.net || danbr...@php.net > http://www.parasane.net/ || http://www.pilotpig.net/ > Check out our great hosting and dedicated server deals at > http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Obeying the rules (was Simple login form with cookies)
There are too many people in this newsgroup with the idea that you MUST obey the rules, whatever they are, WITHOUT QUESTION. I do not subscribe to this notion. I have been working in IT (or DP as it was originally called) for over 30 years, and in that time I have worked with many groups, and each group has had its own version "the rules" (aka "guidelines" or "standards"). When moving to a new group the new rules will always be different, and will sometimes contradict what you had before. Why is this? Why do some groups say "do A instead of B" while others say "do B instead of A"? Does it make a difference? The problem partially lies in the way in which the rules are created. It starts with some wise ass saying (1) Without rules there will be anarchy, so we must have rules. (2) There are no such things as bad rules. (3) Do not allow any choices. If there is a choice between A and B then choose one as the standard. It doesn't matter which one. (4) Everybody must be the same, nobody is allowed to be different. (5) The rules must be obeyed without question. (6) If a rule causes a problem then you must work around it, you cannot change the rule. Item (5) usually exists because the author of the rule cannot justify its existence. He just flipped a coin and it came down tails instead of heads, so that's it. Any moron can make rules like this. Some people just cannot understand that sometimes a rule was created for a certain set of circumstances, but if the circumstances change then the rule needs changing in order to keep up with the times. Because they do not understand why the rule was created in the first place, they do not see that it needs changing. They also do not have the intelligence to see how the rule might be changed to suit the new circumstances. I have fought against arbitrary and stupid rules for decades, and I will keep fighting till the day I die. If you have a problem with that, then so be it. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Andrew Ballard" wrote in message news:b6023aa40907081232k35fa7b1em4ba543ffbb65e...@mail.gmail.com... > On Wed, Jul 8, 2009 at 3:06 PM, Tony > Marston wrote: > [snip] >> I don't like this rule, so I choose to disobey it. > > Now that's some scary ideology. > > Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
Sometimes I use bottom posting, sometimes I use top posting, and sometimes I use middle posting. It depends on the circumstances. If a post contains several points that need separate responses, then I put my response under each point, and do not accumulate all at the bottom as this would make it difficult to associate an answer with a question. The fact that some people do not view a thread until nearly the end is irrelevant. If a thread has 30 posts it would make the last post unreadable if it contained everything from the start. Have you seen a post with 30 levels of indenting for each different post? That is why most newsreaders and email clients group messages by conversation/thread so that you can step through each post individually. Each post contains just the response so that you don't have to scroll through huge volumes of text in order to pick out the new message. Sometimes the only part of the previous post you leave in is the part for which you are supplying an answer so as to avoid confusion. Where I put my answers depends on the context, so saying that IT MUST ALWAYS BE AT THE BOTTOM doesn't wash with me. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Ashley Sheridan" wrote in message news:200907091022.12752@ashleysheridan.co.uk... > On Thursday 09 July 2009 09:39:11 Tony Marston wrote: >> There are too many people in this newsgroup with the idea that you MUST >> obey the rules, whatever they are, WITHOUT QUESTION. I do not subscribe >> to >> this notion. I have been working in IT (or DP as it was originally >> called) >> for over 30 years, and in that time I have worked with many groups, and >> each group has had its own version "the rules" (aka "guidelines" or >> "standards"). When moving to a new group the new rules will always be >> different, and will sometimes contradict what you had before. Why is >> this? >> Why do some groups say "do A instead of B" while others say "do B instead >> of A"? Does it make a difference? >> >> The problem partially lies in the way in which the rules are created. It >> starts with some wise ass saying >> (1) Without rules there will be anarchy, so we must have rules. >> (2) There are no such things as bad rules. >> (3) Do not allow any choices. If there is a choice between A and B then >> choose one as the standard. It doesn't matter which one. >> (4) Everybody must be the same, nobody is allowed to be different. >> (5) The rules must be obeyed without question. >> (6) If a rule causes a problem then you must work around it, you cannot >> change the rule. >> >> Item (5) usually exists because the author of the rule cannot justify its >> existence. He just flipped a coin and it came down tails instead of >> heads, >> so that's it. Any moron can make rules like this. >> >> Some people just cannot understand that sometimes a rule was created for >> a >> certain set of circumstances, but if the circumstances change then the >> rule >> needs changing in order to keep up with the times. Because they do not >> understand why the rule was created in the first place, they do not see >> that it needs changing. They also do not have the intelligence to see how >> the rule might be changed to suit the new circumstances. >> >> I have fought against arbitrary and stupid rules for decades, and I will >> keep fighting till the day I die. If you have a problem with that, then >> so >> be it. >> >> -- >> Tony Marston >> http://www.tonymarston.net >> http://www.radicore.org >> >> "Andrew Ballard" wrote in message >> news:b6023aa40907081232k35fa7b1em4ba543ffbb65e...@mail.gmail.com... >> >> > On Wed, Jul 8, 2009 at 3:06 PM, Tony >> > Marston wrote: >> > [snip] >> > >> >> I don't like this rule, so I choose to disobey it. >> > >> > Now that's some scary ideology. >> > >> > Andrew > > Tony, > > No offense, but Daniel gave the reason why this rule existed, and it does > seem > like a fairly good reason to be fair. The emails are archived on several > web-based lists. If a thread is made up of a mixture of top and bottom > posting, then it won't be easy to read a all online. It might be fine for > reading in a message-by-message basis in an email client if you've been > following the thread since its inception, but a lot of people will come > into > a thread part way, or choose the digest method for email delivery rather > than > one email per message. > > Thanks, > Ash > http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"Stuart" wrote in message news:a5f019de0907090340k47216f7fh4d83434ef98ce...@mail.gmail.com... 2009/7/9 Tony Marston : > I thought of a better analogy. You ever been on the London > Underground? There's a rule that says you stand on the right-hand side > of escalators. This has no benefit to you, the one who stands there > while the elevator does all the work, but it means those of us who > want to walk up the escalator can do so without having to ask everyone > to move out of the way. The benefit of this rule is to other people > not you, but does that make it a bad rule? Your analogy is urealistic as my choice of top posting has absolutely no effect on any other message is the newsgroup. It has no absolutely no effect on the reader unless the reader chooses to take offence. The first newsgroups I visited after getting my first PC not only allowed top posting, they actively encouraged it, yet no-one complained if someone put their post on the bottom. They were tolerant, you see, because it didn't really matter. Your intolerant attitude on this issue shows just what a small-minded person you are. > I reckon it's the same with > the way you arrange your messages to this list. Top-posting is a lazy > and selfish way to "contribute" to the list, That is opinion, not fact. Other newsgroups allow top posting, so why not this newsgroup? Just because someone says so? That's simply not good enough. > especially when you know > what the rule/convention is. It's worth noting that bottom-posting > without efficient quoting is just as bad IMHO as top-posting. There you go with your personal opinions again. > Anyway, it's clear that you're not willing to do the polite thing on > this issue, so I don't see any point in continuing to discuss it. > > -Stuart > Good. So stop discussing it. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"Bastien Koert" wrote in message news:d7b6cab70907090623s6b37641dt90a564f1d80fe...@mail.gmail.com... On Thu, Jul 9, 2009 at 8:54 AM, Tony Marston wrote: > > "Stuart" wrote in message > news:a5f019de0907090340k47216f7fh4d83434ef98ce...@mail.gmail.com... >> 2009/7/9 Tony Marston : >> >> The first newsgroups I visited after getting my first PC not only allowed >> top posting, they actively encouraged it, yet no-one complained if >> someone >> put their post on the bottom. They were tolerant, you see, because it >> didn't really matter. >> >> Your intolerant attitude on this issue shows just what a small-minded >> person >> you are. >> >>> I reckon it's the same with >>> the way you arrange your messages to this list. Top-posting is a lazy >>> and selfish way to "contribute" to the list, >> >> That is opinion, not fact. Other newsgroups allow top posting, so why not >> this newsgroup? Just because someone says so? That's simply not good >> enough. >> > Tony, > > The only thing I don't agree with here is the name calling. I called him "intolerant" because he jumps on issues which other people just don't care about. I called him "small minded" because he concentrates on small issues which simply don't matter in the great scheme of things. That sounds like fair comment to me It's just like those people who have endless arguments about when to use uppercase and when to use lower case. It simply doesn't matter, so stop wasting your time in arguing about it. > Daniel is > a pretty darn bright guy here, and I feel that slighting him because > of an established convention is not the best approach to dealing with > this. We are all voluntary participants on this list and we all make > valuable contributions to the PHP community. Irrelevant. It does not matter how much good work anybody does if they go and ruin it by trying to enforce some inconsequential petty rule. > Conventions were implemented to make things easier for participants to > view a standard thread in the list. The conventions in other newsgroups are different, and I can't be bothered to change my habits for different newsgroups just becase some internet Nazi says so. > We don't have to like it, but that > is no reason to digress into a pissing match over how the rules are > not sensible to any specific point of view. No, I don't like stupid rules, which is why I choose not to obey them. > I have found that moving > to the gmail client makes the rules more sensible as that is how gmail > displays the emails. Both hotmail and outlook make this tougher as > they don't logically display the thread. Might I suggest that you try > using gmail (some one posted that your client was outlook which is why > I suggest this)? Its a pain, if you have a history with the list that > you store on your machine, but it might be worthwhile exploring. So not only are you dictating how I post, you are also dictating which newsreader I should use? How arrogant! -- Tony Marston http://www.tonymarston.net http://www.radicore.org > -- > > Bastien > > Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"Eddie Drapkin" wrote in message news:68de37340907090705y5b095f8cy68ba0d416b045...@mail.gmail.com... >> I called him "intolerant" because he jumps on issues which other people >> just >> don't care about. >> >> I called him "small minded" because he concentrates on small issues which >> simply don't matter in the great scheme of things. That sounds like fair >> comment to me It's just like those people who have endless arguments >> about >> when to use uppercase and when to use lower case. It simply doesn't >> matter, >> so stop wasting your time in arguing about it. > > And it's not just as small minded (I'm not agreeing with you, by the > way) to assume that your point is the only valid point in the > discussion? I never said that my point is the *only* valid point, just that it is a valid point. I don't complain about other people and their bottom posting (which I consider to be a bit anal, if you get the pun!) so stop trying to force me to conform to your petty rules. > Nor is it just as small minded to systematically attack > someone, and the community they take part in, because they have the > audacity to disagree with you? I am not attacking, I am defending. There is a slight difference. >> Irrelevant. It does not matter how much good work anybody does if they go >> and ruin it by trying to enforce some inconsequential petty rule. > > It's obviously not inconsequential, as you're making such a fuss about > it. If it's so inconsequential, why not bottom post and be done with > it? If it's so inconsequential then stop complaining about it. >> The conventions in other newsgroups are different, and I can't be >> bothered >> to change my habits for different newsgroups just becase some internet >> Nazi >> says so. >> > > Congratulations, rule-abiding denizens of php-general, we're now all > Nazis! I'm not saying that every person who reads this newsgroup is a Nazi, only those who take great delight in dictating how people should use *their* newsgroup. > Way to invoke Godwin, by the way, it clearly always wins these > internet argu-debates and doesn't make you look like a loon at all. > I'm going to take this opportunity to jump on the "no more respect" > bandwagon. > >> So not only are you dictating how I post, you are also dictating which >> newsreader I should use? How arrogant! > > "I don't like your rules, rules that existed before I got here and > will exist after I leave and are agreed on by the community, so I'll > not follow them!" is one of the most arrogant things I've ever seen on > this list. He was making a suggestion, ffs, and you just want to be > an ass and take everything personally. You're making an entire > mountain range out of the proverbial molehill. It is *you* who are making a mountain out of the no-top-posting molehill. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"Bastien Koert" wrote in message news:d7b6cab70907090705i1575fe0ft21a2cc82c992b...@mail.gmail.com... > On Thu, Jul 9, 2009 at 9:54 AM, Tony > Marston wrote: >> >> "Bastien Koert" wrote in message >> news:d7b6cab70907090623s6b37641dt90a564f1d80fe...@mail.gmail.com... >> On Thu, Jul 9, 2009 at 8:54 AM, Tony >> Marston wrote: >>> >>> "Stuart" wrote in message >>> news:a5f019de0907090340k47216f7fh4d83434ef98ce...@mail.gmail.com... >>>> 2009/7/9 Tony Marston : >>>> >>>> The first newsgroups I visited after getting my first PC not only >>>> allowed >>>> top posting, they actively encouraged it, yet no-one complained if >>>> someone >>>> put their post on the bottom. They were tolerant, you see, because it >>>> didn't really matter. >>>> >>>> Your intolerant attitude on this issue shows just what a small-minded >>>> person >>>> you are. >>>> >>>>> I reckon it's the same with >>>>> the way you arrange your messages to this list. Top-posting is a lazy >>>>> and selfish way to "contribute" to the list, >>>> >>>> That is opinion, not fact. Other newsgroups allow top posting, so why >>>> not >>>> this newsgroup? Just because someone says so? That's simply not good >>>> enough. >>>> >>> Tony, >>> >>> The only thing I don't agree with here is the name calling. >> >> I called him "intolerant" because he jumps on issues which other people >> just >> don't care about. >> >> I called him "small minded" because he concentrates on small issues which >> simply don't matter in the great scheme of things. That sounds like fair >> comment to me It's just like those people who have endless arguments >> about >> when to use uppercase and when to use lower case. It simply doesn't >> matter, >> so stop wasting your time in arguing about it. >> >>> Daniel is >>> a pretty darn bright guy here, and I feel that slighting him because >>> of an established convention is not the best approach to dealing with >>> this. We are all voluntary participants on this list and we all make >>> valuable contributions to the PHP community. >> >> Irrelevant. It does not matter how much good work anybody does if they go >> and ruin it by trying to enforce some inconsequential petty rule. >> >>> Conventions were implemented to make things easier for participants to >>> view a standard thread in the list. >> >> The conventions in other newsgroups are different, and I can't be >> bothered >> to change my habits for different newsgroups just becase some internet >> Nazi >> says so. >> >>> We don't have to like it, but that >>> is no reason to digress into a pissing match over how the rules are >>> not sensible to any specific point of view. >> >> No, I don't like stupid rules, which is why I choose not to obey them. >> >>> I have found that moving >>> to the gmail client makes the rules more sensible as that is how gmail >>> displays the emails. Both hotmail and outlook make this tougher as >>> they don't logically display the thread. Might I suggest that you try >>> using gmail (some one posted that your client was outlook which is why >>> I suggest this)? Its a pain, if you have a history with the list that >>> you store on your machine, but it might be worthwhile exploring. >> >> So not only are you dictating how I post, you are also dictating which >> newsreader I should use? How arrogant! >> > > No, Tony, not dictating at all. Merely sharing my experience. It may > or may not work for you, but that is for you to decide. I've decided. It doesn't work for me. End of story. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"Daniel Brown" wrote in message news:ab5568160907090729j4c2cc67esff2823dcb493d...@mail.gmail.com... > On Thu, Jul 9, 2009 at 09:54, Tony Marston > wrote: >> >> I called him "intolerant" because he jumps on issues which other people >> just >> don't care about. > >Point #1: You're obviously wrong, as this thread has already > received more replies than most on-topic, PHP-centric threads. > >> I called him "small minded" because he concentrates on small issues which >> simply don't matter in the great scheme of things. That sounds like fair >> comment to me It's just like those people who have endless arguments >> about >> when to use uppercase and when to use lower case. It simply doesn't >> matter, >> so stop wasting your time in arguing about it. > > Point #2: When attempting to prove your case, do your best to > keep your facts and players straight --- you did not call me either of > these things; you placed your unnecessary opinion of such on Stuart. > And while that really doesn't sit well with me, it's just becoming > more and more evident that you, like many others in the past, will > simply wind up being ignored by the majority of the list, save for > folks who don't know or don't care about your lack of respect for > them. I have no respect for anyone who wastes time in trying to force others to obey their petty rules. >> Irrelevant. It does not matter how much good work anybody does if they go >> and ruin it by trying to enforce some inconsequential petty rule. > >Had I been a hippie as well, I might just be inclined to agree > with you. So if we're throwing opinions around, let mine ring loud > and clear: thank God I'm not. Besides, I couldn't have pulled off the > bellbottom look, and in all my years, I still can't grow a half-decent > beard (which means that joining al-Qaeda may be out of my future as > well darn). > >> The conventions in other newsgroups are different, and I can't be >> bothered >> to change my habits for different newsgroups just becase some internet >> Nazi >> says so. > >You change the topic for each newsgroup, don't you? And you do it > out of respect for the context of that particular group. You wouldn't > (well, maybe *you* would) ask a question about a carburetor on a > mailing list for expectant mothers, which makes sense. Now you're being silly. > Following a simple rule by not top-posting makes sense as well, > which has been outlined already. The whole point about this particlar rule is that it has no purpose other than to force everybody to conform to somebody's idea of perfection. Who gave this person the right to make such rules?. Top posting has existed for ages, and a lot of people don't care about it one way or the other. > Your greatest failure in this argument, Tony, is > not being able to articulate your proof as to *why* it's a stupid > rule. It's stupid because there is no valid reason as to why top posting is *bad*. It has existed on the internet ever since there was an internet, so for someone to stand up and say "I don't like this, so I'll make a rule agains it" it just arrogance on their part. I'm not saying that everyone should top post, or bottom post, or middle post, or even sideways post. It simply doesn't matter. > All I've been able to ascertain to date is that you (ALWAYS) > have an opinion as to why the Establishment is a Bad Thing[tm], and > how The Man will never be able to keep you down. Fight the power, > Marston. Spread the word of the Revolution. Manifest Destiny! (What > was the argument again?) It is my God-given right to question anything and everything, especially any rule made by mortal man. If you don't like it when I have the audacity to question >> No, I don't like stupid rules, which is why I choose not to obey them. > >This is like a five-year-old saying, "I don't like your stupid > face, so I'm not gonna' look at it." Reading your sentence, I > envisage the voice of a spoiled toddler. > >> So not only are you dictating how I post, you are also dictating which >> newsreader I should use? How arrogant! > > Your arrogance toward the community and ignorance of fundamental, > purposeful guidelines I'm not trying to impose my will on the community, I'm just refusing to bow to *your* will. If they are truly "guidelines" and not "rules" then stop trying to force them down my throat. I don't tell you to stop with your anal bottom posting, so stop telling me to stop with
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"Ashley Sheridan" wrote in message news:1247162816.3514.17.ca...@localhost.localdomain... > On Thu, 2009-07-09 at 16:57 +0100, Tony Marston wrote: >> It's stupid because there is no valid reason as to why top posting is >> *bad*. >> It has existed on the internet ever since there was an internet, so >> for >> someone to stand up and say "I don't like this, so I'll make a rule >> agains >> it" it just arrogance on their part. > > Tony, I believe I (among others) mentioned a perfectly valid reason for > *not* top-posting. > > In-case you forgot, I'll go through it again: > > This mailing list is ingested (afaik) in three main ways by people: > > 1. One email per message made to the list > 2. Daily email digests > 3. Web-based list archives You may think they are valid reasons, but I do not. When I first started to post in newsgroups top posting was not only allowed, it was encouraged, and no-one complained. This went on for years, then all of a sudden someone decided that top posting was bad, and made a rule against it. Why should I change the habits of years just because you say so? Whether I post at the top or the bottom DOESN'T REALLY MATTER. It is just another religious war. I think bottom posting is bad because I have to scroll all the way to the bottom of the post in order to read the response, whereas if its at the top I can read it without scrolling. > Now, it might not make too much difference where the posts are if you > are reading the list by the first means. Yeah, it's annoying seeing > emails that are a mix of top and bottom-posting, but it can be dealt > with. > > The second way of reading through the list groups together bunches of > the messages, which is difficult to read if the posting is a mix of top > and bottom. > > The web-based content is even more difficult to follow if the posting > types mix. The fact that there are many different ways of reading newsroups which favour either top or bottom posting just adds to the chaos. My newsreader favours top posting, so that's what I'll stick to. > This list has always used bottom-posting as a convention, because if > everyone sticks to it, the whole thing is made easier to read by both > members and guests reading the list in their browsers. Different newsgroups have different conventions, and I just can't be bothered to switch from one to the other just to satisfy a petty whim. > Someone earlier in the thread mentioned escalators. And I have already pointed out that this was a false analogy. If I stand on the wrong side of the escalator I will block other people, but if I top post I block nobody. Some people may notice I've posted at the top, some may not. Some may think it's bad, some may not. But wherever I post it does not stop them from reading what I wrote. > The convention in > the UK is to stand on the right, and walk on the left. It's different in > the US. Would you try and have an argument with someone on an escalator > because s/he thought you were on the wrong side because you're used to > using a particular side and can't be bothered to go by their > conventions? More and more as you post I find this is actually a likely > scenario, but I'm willing to accept you might not. The thing is, both > these things are general conventions, put in place to benefit others, > which hardly put you out of your way (as I mentioned yesterday, it can > be done in 1-2 seconds) > > Please can you not just keep to the convention used on this list? The > list is not here solely for your benefit, but that of others too. People > often come here knowing little of PHP, and making their lives more > difficult by having threads that follow no logical convention is just > rude and inconsiderate. Top posting does not make life more difficult, it does not make the post unreadable. It is a minor detail of no great consequence, so stop trying to make a federal case out of it. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
""Bob McConnell"" wrote in message news:ff8482a96323694490c194babeac24a0049ad...@email.cbord.com... From: HallMarc Websites >> >> Having just come in to the particular thread, I actually have work that >> keeps me away from here, I'm wondering why this is worth the energy and time >> I have seen wasted on this subject. Seems to me everyone needs to take a >> deep breath and a step back. As far as anyone going against convention, >> seems to me that people who think outside the box, go against convention, >> break the rules, whatever are the ones who keep life interesting and >> occasionally help us find something new. I would hate to live in a real life >> "Stepford Wives" existence. > Actually, I found it quite amusing to watch Tony paint himself into a > corner and try to defend his indefensible position. Top posting is not indefensible as it has been used in other newsgroups without problems for over a decade. It wasn't wrong then, so why is it wrong now? > He reminds me of a > number of individuals, and not a few institutions, whose attitude is > "I've already made up my mind, don't try to confuse me with facts." The "fact" is that some people care about top posting while others do not. Some people are passionately against it while others couldn't give a toss. I personally don't give a toss, but I do see red when some jumped up pipsqueak tries to force me to conform to his vision of what is right and wrong. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > Plus, it has been a timely and welcome diversion from other more > pressing issues. Who needs the Comedy channel when we have this? > > It will be even more interesting to see if anyone on this list pays any > attention to him in the future. > > Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"tedd" wrote in message news:p06240800c67be78e3...@[192.168.1.101]... > At 2:22 PM -0400 7/9/09, HallMarc Websites wrote: >> As far as anyone going against convention, >>seems to me that people who think outside the box, go against convention, >>break the rules, whatever are the ones who keep life interesting and >>occasionally help us find something new. I would hate to live in a real >>life >>"Stepford Wives" existence. >> >>[Marc Hall - HallMarc Websites - http://www.hallmarcwebsites.com >>610.446.3346] > > > Marc: > > True, one of the things that makes life interesting are those who think > outside "the box", but for some of us "the box" is a bit less obvious and > requires more thought. > > When someone wants to argue a point, the point should be worth arguing. > This argument is akin to saying "I don't like calling today 'Thursday' -- > I think that's stupid! So, I'll call it 'MyDay' instead". While that would > certainly be thinking outside "the box", it would also not be worth > debating. Yet another fatuous argument. "Thursday" has never been called "Myday", so I would never propose such a thing. Top posting is different for the simple reason that it existed in other newsgroups long before this group started, and I object to being forced to change my posting methods on nothing more than a whim. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > I wish my life was so simple that I could raise issue with things like > this, but my life requires more cerebral windmills to tilt. > > One of the things I've learned in my over 60 years, is to pick the battles > that are worth fighting and let other contentions pass. In the wise, > beyond their years, words of the Beatles "Let it be." > > 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] Obeying the rules (was Simple login form with cookies)
"Still Learnin'" wrote in message news:4a5641d1.9040...@gmail.com... > Tony Marston wrote: > >> I have no respect for anyone who wastes time in trying to force others to >> obey their petty rules. > > ... >> The whole point about this particlar rule is that it has no purpose other >> than to force everybody to conform to somebody's idea of perfection. > > You've been told more than twice, it isn't an arbitrary rule. It isn't > a petty rule. It isn't about perfection. It is arbitrary. It is petty. It is about someone's idea of perfection. > It's about clarity. So that the threaded archives are intelligible > instead of jumbled. So that the post-by-post emails properly read from > top to bottom. That's why other newsgroups allow top posting because the response in each post is at the top, where the newsreader starts, so you don't have to scroll over the text of the previous post to get to the important stuff. If a thread contained 30 posts would you really want the text of all 30 contained in the same message? How difficult would it be to separate one message from another? > It's also about courtesy, not dropping dingleberries dozens or scores > of lines long (and some of you others could stand to snip the extraneous > even though you do properly bottom-post). So what are the rules about snipping then? -- Tony Marston http://www.tonymarston.net http://www.radicore.org > Like has been said: if you don't play by the playground rules, don't > be surprised if the other kids don't want to play with you. > > SL > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
My sincerest apologies. I have been a complete jackass this entire time and every single one of you has been correct. From this point forward I vow to keep my God damned mouth shut unless spoken to. You see, I have been struggling with defining my sexual identity and trying to come to terms with my preference toward glittery and sparkly shoes. Unfortunately my choice of stockings does not bode well for this preference. But I will be damned if the rules of fashion will dictate what does and does not go well together. So I am off to fight a different and winnable battle. I love you all so very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
This post did not come from me. The headers contain this: Received: from [74.54.247.2] ([74.54.247.2:59280] helo=mail.caracol-cream.com) Very funny. -- (the real) Tony Marston http://www.tonymarston.net http://www.radicore.org ""(the fake) Tony Marston"" wrote in message news:e1mp00d-0005iz...@mail.caracol-cream.com... > > > My sincerest apologies. I have been a complete jackass this entire > time and every single one of you has been correct. From this point > forward I vow to keep my God damned mouth shut unless spoken to. > > You see, I have been struggling with defining my sexual identity > and trying to come to terms with my preference toward glittery and > sparkly shoes. Unfortunately my choice of stockings does not bode > well for this preference. But I will be damned if the rules of > fashion will dictate what does and does not go well together. > > So I am off to fight a different and winnable battle. > > I love you all so very much. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Obeying the rules (was Simple login form with cookies)
"Still Learnin'" wrote in message news:4a565c73.8090...@gmail.com... > Tony Marston wrote: > >>> You've been told more than twice, it isn't an arbitrary rule. It isn't >>> a petty rule. It isn't about perfection. >> >> It is arbitrary. It is petty. It is about someone's idea of perfection. > > One of us clearly manifests a reality gap. How many people do you > have siding with your position, on this list? > >>> It's about clarity. So that the threaded archives are intelligible >>> instead of jumbled. So that the post-by-post emails properly read from >>> top to bottom. >> >> That's why other newsgroups allow top posting because the response in >> each post is at the top, where the newsreader starts, so you don't have >> to scroll over the text of the previous post to get to the important >> stuff. > > This is not a newsgroup. It is an email list that archives emails > on the php.net web site, and has a newsgroup subscribed. It *is* a newsgroup because I can access it through my newsreader. I can recieve copies of posts in my email client, but I can only post using my newsreader. >> If a thread contained 30 posts would you really want the text of all 30 >> contained in the same message? How difficult would it be to separate one >> message from another? > > What broken program (or script) puts the text of 30 posts into the > same post? You seem to be grasping at straws. When you hit "reply" in your newsreader what happens? It creates a new post with the original message quoted in its entirety. Some newsreadrs then posiition the cursor at the top ready for your reply, while others position it at the bottom. If this happens 30 times then the last post contains copies of the all the previous 29 messages. >>> It's also about courtesy, not dropping dingleberries dozens or scores >>> of lines long (and some of you others could stand to snip the extraneous >>> even though you do properly bottom-post). >> >> So what are the rules about snipping then? > > You're the 30-year professional, figure them out. I'm Still Learnin' Why should I have to figure it out? Surely some little Hitler has created a rule so that the rest of us sheep don't have to think for ourselves? -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie: Composition by Association - Pagination Class general question.
Two things strike me as wrong with your thinking: (1) The idea that you have a separate DAO for each entity instead of a single generic DAO which can act for any entity in the system. (2) The idea that pagination requires its own class, and therefore needs this "is-a" and "has-a" nonsense. As for (1) even in my pre-OO days I was used to using a single generic DAO for all database access. The only time that more than one DAO existed was for a different DBMS engine. This is why I have one DAO class for MySQL, one for PostgreSQL and another for Oracle. If you are incapable of writing a single generic DAO then it just shows that you still have a lot to learn. For an idea on how this works take a look at http://www.tonymarston.net/php-mysql/databaseobjects.html As for (2) it should be obvious that pagination is not an entity in its own right that has its own properties and methods, it is merely a function which can be performed on any entity within the system. It should also be obvious that the requirements of pagination cannot be satisfied in a single class as some of the processing has to be handled in the presentation (UI) layer while the remainder is handled in the data access layer. The presentation layer needs a means to submit a request for a particular page number as well as the page size (rows per page). These two values are sent to the DAO which then translates them into values for LIMIT and OFFSET. After the DAO has issued the sql SELECT statement it needs to return two values - the current page number and the last available page number. The presentation layer then needs a mechanism to display these two values. This is explained in http://www.tonymarston.net/php-mysql/pagination.html If you still don't see how this works then you can run my sample application at http://www.tonymarston.net/php-mysql/sample-application.html You can even download the code so that you can step through it with your debugger. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""MEM"" wrote in message news:000701ca0867$992912e0$cb7b38...@com... Hello, I have a Animals DAO class that I'd like to apply a pagination class to it. Between this two classes, there will be a composition relation (more precisely, an association one). My question is: Is a Pagination that "has a" Animal. OR Is a Animal that "has a" pagination? Should we create on Class Pagination a property named $_animal OR, should we create on class Animal a property named $_pagination? I'm inclined to accept the second one, since, if I put the property $_animal on my classe Pagination, I will end up, on the Pagination Class, with so many properties as pagination objects... :s Any help please? Márcio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.
""MEM"" wrote in message news:002001ca0898$5d183840$1748a8...@com... > > As for (1) even in my pre-OO days I was used to using a single > > generic DAO for all database access. The only time that more > > than one DAO existed was for a different DBMS engine. This > > is why I have one DAO class for MySQL, one for PostgreSQL > > and another for Oracle. If you are incapable of writing a > > single generic DAO then it just shows that you still have a lot to > > learn. For an idea on how this works take a look at > > http://www.tonymarston.net/php-mysql/databaseobjects.html > > I'm absolutly sure that I have a lot to learn. Really a lot. :-) > I have post some days ago, a way for using a generic CRUD class and DAO, > but I get no replys so I wrongly suppose that my question was a > nonsense question, and that CRUD and DAO would be a nonsense. > > I'm trying to use PDO with prepare statements and BindParam, so I'm afraid > that my "newbility" doesn't allow me to pass directly from your example to > one that uses PDO. Why not? Why can't you replace a call to a mysqli function with a call to a PDO function? > Also, I also intend to use fetchObject method instead of fetchAssoc quite > often, Why? What's the benefit? The fetchAssoc method gives you an array of values, while the fetchObject method gives you a container for an array of values. You still still have to work with an array of values. > with also puts your tutorial far away from my capacities. Because of > this, I'm trying to follow what I can get on the web, using PDO and > general > CRUD operations: Why don't you learn how to use the mysqli functions before you handle the switch to PDO? What do you have to lose? > BUT: > > Here: > 1) http://oopgarden.richardknop.com/index/view/1 > > or Here: > 2) http://phpro.org/tutorials/Easy-Access-With-PDO-CRUD.html > > when we have to create complex querys by using limits, order, etc... > either > they are inexistent possibilities (like on the link 2), If you read my tutorial you should see that building a SELECT statement is nothing more than combining several small strings into a larger single string. String manipulation is simple in PHP. Using this technique I can create very complex SQL statements, so don't tell me that it can't be done. > or, like on link 1 > they are so close to the equivalent sql sintax that I'm questioning the > advantage of having a general DAO CRUD class at all (supposing that the > only > advantage is that we write less words on the code). Having less code to maintain is *precisely* the advantage of having a single DAO. If you design it correctly then you can switch from one DAO class to another in order to switch from one DBMS engine to aother. > Please advice, besides the fact that we "never have to code any of the SQL > SELECT, INSERT, UPDATE or DELETE statements for any table as they will be > generated at runtime.", is there any other advantage on using a general > DAO > class instead of one DAO class for each table? Because you have less code to maintain. If you look carefully you should see that the only difference between the DAO for TableA and the DAO for TableB is the table name and the table structure. If you could pass these as arguments into a generic DAO then you would not need a separate DAO for each table. OOP is about creating reusable code to reduce the maintenance burden, so if you insist that a separate DAO for each individual table is the way to go then you don't understand how to apply the principles of OOP correctly. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Newbie: Composition by Association - PaginationClass general question.
"Paul M Foster" wrote in message news:20090719220923.gv14...@quillandmouse.com... > On Sun, Jul 19, 2009 at 03:56:43PM +0100, Tony Marston wrote: > >> Two things strike me as wrong with your thinking: >> >> (1) The idea that you have a separate DAO for each entity instead of a >> single generic DAO which can act for any entity in the system. >> (2) The idea that pagination requires its own class, and therefore needs >> this "is-a" and "has-a" nonsense. >> >> As for (1) even in my pre-OO days I was used to using a single generic >> DAO >> for all database access. The only time that more than one DAO existed was >> for a different DBMS engine. This is why I have one DAO class for MySQL, >> one >> for PostgreSQL and another for Oracle. If you are incapable of writing a >> single generic DAO then it just shows that you still have a lot to learn. >> For an idea on how this works take a look at >> http://www.tonymarston.net/php-mysql/databaseobjects.html > > This brings up a question. Most of the tutorials I've read on your site > deal with classes tailored to specific tables. However, in much of my > software, I have to deal with queries which access multiple tables. For > example, my invoice table contains the customer number, but not their > name. For that, I have to go to the customer table. Thus, my queries > often access multiple tables with where clauses which ensure I get the > proper data from secondary tables. I've never used "views" in SQL, but > it appears that this is what would be called a "view". > > So in your constellation of software, would you create a subclass of > genericTable which essentially is a "view"? Otherwise, how would you > handle this? > > Paul Such things can be handled automatically by my generic DAO. Amongst the details which are exported from my data dictionary into each table structure file (which is accessed by the database table class) is a list of all the parent/foreign tables, the foreign key field(s), and which fields to retrieve from the parent table. So when the sql SELECT statement is being constructed it can use this information to add a JOIN to the parent table in order to retrieve the specified field(s). This is documented in http://www.tonymarston.net/php-mysql/data-dictionary.html#sql.joins Any number of parent relations can be defined for a table, and any number of fields can be retrieved from those tables and added to the SELECT list. All the developer has to do is define the relationship in the data dictionary and the framework will handle the boring stuff of generating the necessary SQL. So, using your example, I would define my customer table as a parent to my invoice table, identify which foreign key field relates to which primary key field in the parent table, define customer_name as the field to be retrieved from the customer table, then sit back and watch the framework do its stuff. Each time I read from the invoice table the result would automatically include the customer name. Easy peasy lemon squeezy. It's not rocket science, but it is neat. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.
""MEM"" wrote in message news:000201ca0a9f$ca3fb110$5ebf13...@com... > > > As for (1) even in my pre-OO days I was used to using a single > > > generic DAO for all database access. The only time that more > > > than one DAO existed was for a different DBMS engine. This > > > is why I have one DAO class for MySQL, one for PostgreSQL > > > and another for Oracle. If you are incapable of writing a > > > single generic DAO then it just shows that you still have a lot to > > > learn. For an idea on how this works take a look at > > > http://www.tonymarston.net/php-mysql/databaseobjects.html > Before I dig in on this DAO, I'm wondering, where should I, and how could > I, > properly place a JOIN on this kind of pattern? Is it easy done or, on a > JOIN > scenario (and I will have a lot of them) I choose probably choose another > pattern? > > Regards, > Márcio Adding a JOIN to the SQL statement which is generated by the framework is very easy, as shown in my FAQ at http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq08. You have two choices where you can place the code: (1) In the component script. (2) In the table class, as shown in http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq84 -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "PHP 6 and MySQL 5 for Dynamic Web Sites" Book
"Eddie Drapkin" wrote in message news:68de37340908060841x129a9096w6c0907f85614c...@mail.gmail.com... > > Does no one see the inherent issues in buying a book about a > not-feature-complete version of the language? PHP 6 does not exist yet, and no hosting companies provide it as an option, so describing existing versions of PHP as "not-feature-complete" is a bit premature. As the book is simply an update to his original version which was published in 2003, and again in 2005, it is about using PHP and MySQL to build a dynamic web site, and as such every version is still perfectly valid and useful to the novice programmer. This not a book which is supposed to describe every possible feature within the PHP language as it is not necessary to use every possible feature in order to build a dynamic website. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "PHP 6 and MySQL 5 for Dynamic Web Sites" Book
Don't be so pedantic. PHP 6 does not exist in a live, production-ready version. It is still under development and has not even reached the beta stage. Anyone who writes a book which documents the features of PHP 6 is being very premature as those features may change at any moment. The features will not be frozen until the first GA release. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Ashley Sheridan" wrote in message news:1249585209.2818.0.ca...@localhost... > On Thu, 2009-08-06 at 17:24 +0100, Tony Marston wrote: >> PHP 6 does not exist yet, > > Funny, that's not what the PHP site says: > > http://snaps.php.net/ > > Thanks, > Ash > http://www.ashleysheridan.co.uk > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question: what are frameworks?
""Parham Doustdar"" wrote in message news:5c.b0.05105.f18be...@pb1.pair.com... > Hi there, I> I've heard of frameworks, but I don't quite know what they are used for. > I've done a little search on the internet, but even though I've been able > to find different PHP frameworks, I'm not quite sure what they offer, or > in what they differ, or why I shouldn't just use PHP as it is. > Can someone give a little bit of explaination? > Thanks! A framework is more than just a simple collection of libraries, it is a support structure in which another software project (application) can be organised and developed. The simplest framework is nothing more than a menu system which informs the user what application components are available, and provides the means for the user to choose an option from that list and cause it to executed or activated. This means that each application component can be developed without the need for any code to handle the menu functionality. The component is simply plugged into the framework and it is instantly available. This simple framework can be extended to provide other features, such as security. Instead of allowing just anybody to access the application it may need to be restricted to registered users only, and this can be accomplished by inserting a login mechanism into the framework. It may then be decided that not every user is allowed to access every component, so additional access control mechanisms can be built in. It should be possible to extend the framework without having to touch every single component that runs within it. The framework may provide other facilities, such as providing the ability to navigate between components, to pass messages between components, audit logging, workflow, et cetera. This allows the application programmers to concentrate on the needs of the application without being bogged down with other details. Some people seem to think that each application needs its own separate framework in order to satisfy the unique needs of that application, but they have simply not learned to abstract out that functionality which is common to every application. It is therefore possible to build a framework that can be used by any number of different applications. RADICORE is such a framework. An advantage of a reusable framework is that once a programmer has become familiar with it he can carry that knowledge forward into the next application without having to learn a different framework. A framework is a support structure in which another software project (application) can be organised and developed. The simplest framework is nothing more than a menu system which informs the user what application components are available, and provides the means for the user to choose an option from that list and cause it to executed or activated. This means that each application component can be developed without the need for any code to handle the menu functionality. The component is simply plugged into the framework and it is instantly available. This simple framework can be extended to provide other features, such as security. Instead of allowing just anybody to access the application it may need to be restricted to registered users only, and this can be accomplished by inserting a login mechanism into the framework. It may then be decided that not every user is allowed to access every component, so additional access control mechanisms can be built in. It should be possible to extend the framework without having to touch every single component that runs within it. The framework may provide other facilities, such as providing the ability to navigate between components, to pass messages between components, audit logging, workflow, et cetera. This allows the application programmers to concentrate on the needs of the application without being bogged down with other details. Some people seem to think that each application needs its own separate framework in order to satisfy the unique needs of that application, but they have simply not learned to abstract out that functionality which is common to every application. It is therefore possible to build a framework that can be used by any number of different applications. RADICORE is such a framework. An advantage of a reusable framework is that once a programmer has become familiar with it he can carry that knowledge forward into the next application without having to learn a different framework. There are lots of different PHP frameworks available for the simple reason that there are lots of different PHP programmers who each have their own methodologies and techniques. Some frameworks are written to aid the development of particular kinds of software, such as building web sites or CMS systems, whereas others (like Radicore) are for building web applications. -- Tony Marston http://www.tonymar
[PHP] Re: how to say "inverse your value" (to a boolean)?
Try $tableRowBGcolorBoolCounter = !$tableRowBGcolorBoolCounter Notice that it says '= !' instead of !='. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "John Butler" wrote in message news:52842d6f-dd45-44a6-ae06-2e58ef8f6...@gmail.com... > quick Q: > I have this inside a foreach{} that I want to alternate between on and > off so I can alternate the background-color of my 's. > > $tableRowBGcolorBoolCounter != $tableRowBGcolorBoolCounter; //-boolean on > and off > > I am looking thru' docs and books, but can't remember (nor find now) in > PHP how to say "inverse your value" (to a boolean). > ? > > TIA! -G > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is select_db necessary?
"Paul M Foster" wrote in message news:20090812035618.gd2...@quillandmouse.com... > On Tue, Aug 11, 2009 at 08:23:21PM -0700, Allen McCabe wrote: > >> I have seen different scripts for working with SQL, and most follow the >> same >> method with on difference. >> >> Variables are defined (host, password, etc.) >> mysql_connect command >> >> //then, the difference >> >> mysql_select_db command >> >> //back to common >> >> $sql = "SELECT ... " >> $result = mysql_query($ql) >> >> Is the database selection necessary, or is that implied with a SELECT or >> other SQL command? > > All major SQL DBMSes can have multiple databases available. A given > database may contain a variety of tables. If you simply start firing SQL > commands at a DBMS, it won't know which database to look in unless you > tell it. By contrast, the connection process in PostgreSQL must include > a database; there is no separate database selection function call. This is not totally accurate. With MySQL you connect to a server which is a container for one or more databases, so you need select_db in order to identify the current database name. With PostgreSQL you connect to a database which is a container for one or more schemas, so you need to issue the "SET search_path TO " command in order to identify the current schema. Oracle is the same in that you connect to a server which is a container for one or more databases, and unless you give every table a public synonym you must use the "ALTER SESSION SET CURRENT_SCHEMA = " command to identify the current schema. In all these cases this will allow you to issue an sql query which contains table names which do not have to be qualified with their database/schema names. If you wish to refer to a table which is not in the current database/schema then you must include the database/schema name. I consider the use of the term "schema", as used by PostgreSQL and Oracle, to be inaccurate in that a database table is subordinate to a database, not a schema. That is why it is called a "database" table and not a "schema" table. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is select_db necessary?
"PJ" wrote in message news:4a82aa58.2020...@videotron.ca... > Paul M Foster wrote: >> On Tue, Aug 11, 2009 at 08:23:21PM -0700, Allen McCabe wrote: >> >> >>> I have seen different scripts for working with SQL, and most follow the >>> same >>> method with on difference. >>> >>> Variables are defined (host, password, etc.) >>> mysql_connect command >>> >>> //then, the difference >>> >>> mysql_select_db command >>> >>> //back to common >>> >>> $sql = "SELECT ... " >>> $result = mysql_query($ql) >>> >>> Is the database selection necessary, or is that implied with a SELECT or >>> other SQL command? >>> >> >> All major SQL DBMSes can have multiple databases available. A given >> database may contain a variety of tables. If you simply start firing SQL >> commands at a DBMS, it won't know which database to look in unless you >> tell it. By contrast, the connection process in PostgreSQL must include >> a database; there is no separate database selection function call. >> >> Paul >> > I seem to recall from the manual, that once you have done mysql_connect > , any subsequent queries will be directed at the same db until another > mysql_connect points to another db. I repeat the call with every query > as a precaution. > I'm not expert, but I thought I'd offer my observation and am open to > correction. ;-) > PJ This only works if you specify a database name in the call to mysqli_connect(). If provided (it is optional) it identifies the default database name for all subsequent queries. If, like me, you have multiple databases available, then you need to use select_db in order to switch the default database from one to another. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mbstring.func_overload cannot been changed in htaccess
I have reported this problem in http://bugs.php.net/bug.php?id=49238. It would appear that this option, which was first made available in PHP 4.2.0, has been silently dropped. Apparently the decision was made in order to fix http://bugs.php.net/bug.php?id=43227, but nothing was explicitly stated in the bug report, nor in any release notes, and the documentation still has not been updated to reflect this change even after 6 months. This causes a problem if your site is on a shared server and you don't have access to either php.ini or httpd.conf. If this option is turned off by default, then how do you turn it on? If it is on by default then how do you turn it off? It needs to be turned off for phpMyAdmin otherwise it will issue a message warning about possible data corruption. Should this option be reinstated? -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Amortization calculator
Try this: http://www.tonymarston.net/php-mysql/amortise.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""Dan Harrington"" <[EMAIL PROTECTED]> wrote in message news:!~!UENERkVCMDkAAQACABgA0GQuLQQZMkSIxO1FcYz7L8KQVmQdtX3Lb0SRpx9/[EMAIL PROTECTED] > > Hello, > > I am looking for a 365-day (as opposed to 360) amortization calculator. > Does anyone know of one written in PHP that could be used to calculate > payments, P&I, etc on loans with the various variables changeable like > this? > http://ray.met.fsu.edu/cgi-bin/amortize > > Thanks > Dan > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] array field type
"Sancar Saran" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sunday 04 March 2007 23:04, Sancar Saran wrote: >> Hi, >> >> I want to know is there any db server around there for store php arrays >> natively. >> >> Regards >> >> Sancar > Thanks for responses, it seems I have to give more info about situation. > > In my current project, we had tons of arrays. They are very deep and > unpredictable nested arrays. > > Currently we are using serialize/unserialize and it seems it comes with > own > cpu cost. Xdebug shows some serializing cost blips. Sure it was not SO BIG > deal (for now of course). > > My db expertise covers a bit mysql and mysql does not have any array type > field (enum just so simple). Wrong! Take a look at the SET datatype http://dev.mysql.com/doc/refman/4.1/en/set.html. This allows you to have an array of values in a single field, and the user can select any number of them. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > I just want to know is there any way to keep array data type natively in a > sql > field. > > Regards. > > Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php 4 and 5
""Haydar Tuna"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, >Most important change is Object Oriented Features. PHP 5 support > Object Oriented programming features. Technically this is incorrect. PHP 4 does provide basic support for OOP, but PHP 5 provides better support. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > PHP 5 also supports more library than PHP 4.:) > > > -- > Haydar TUNA > Republic Of Turkey - Ministry of National Education > Education Technology Department Ankara / TURKEY > Web: http://www.haydartuna.net > > > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Dear All, >> >> What different between 4 and 5 ? >> >> Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using a reentrant form
I honestly don't know why people use the approach of having a hidden field on a re-entrant form to indicate whether it should be validated or not. I have used re-entrant forms for years without such a thing. How? Quite simply there are two phases to a form - GET, which requests a form from the server, and POST, which sends a form to the server. It is therefore quite obvious that I validate on every POST. Simple, isn't it? -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Todd Cary" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > To validate a page, I set the form value to the page name the user is on. > Then there is a hidden variable, "looped" that is set to "1". By checking > "looped", I know if the user has re-entered the form so I can do my > validation checks. > > Is there a disadvantage to this approach? > > Thank you... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using a reentrant form
""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > And if the user re-loads the page they just POSTed? Easy peasy. After a successful POST I perform a redirect, either to the same page or a different, which changes the POST into a GET. So if the user presses the "refresh" button it simply repeats the GET. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > On Wed, March 14, 2007 10:24 am, Tony Marston wrote: >> I honestly don't know why people use the approach of having a hidden >> field >> on a re-entrant form to indicate whether it should be validated or >> not. I >> have used re-entrant forms for years without such a thing. How? Quite >> simply >> there are two phases to a form - GET, which requests a form from the >> server, >> and POST, which sends a form to the server. It is therefore quite >> obvious >> that I validate on every POST. Simple, isn't it? >> >> -- >> Tony Marston >> http://www.tonymarston.net >> http://www.radicore.org >> >> "Todd Cary" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> To validate a page, I set the form value to the page name the user >>> is on. >>> Then there is a hidden variable, "looped" that is set to "1". By >>> checking >>> "looped", I know if the user has re-entered the form so I can do my >>> validation checks. >>> >>> Is there a disadvantage to this approach? >>> >>> Thank you... >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some starving artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Design Dilemma - Database Data Abstraction
other table rather than a field (I > would have to ask that there are no fields with the same name). This table > has an FK to the id of the users tables and one other record working as a > PK. Accesing the array this way I have one of the values of the PK (the > user > id), and I use the other as the array index. > > There is also the problem with many-to-many relationships. If there was > only > one table that related two tables in this way, I could do the following: > > $DB['users'][$userid]['groups'] <- groups where the user belongs > $DB['groups'][$groupid]['users'] <- the users of a group > > There would be a third table other than users and groups which doesn't > show > up. But, what to do when there is more than one relationship table for the > same two tables? And if the relationship table also had some extra fields? > Also the delete action presents some problems: > > unset($DB['users'][$userid]['groups'][$groupid]); > > Am I deleting the group or the relationship between that user and group? I > believe the last is more coherent, but still it can be prone to confusion. > > I could make $DB['users'][$userid]['groups'][$groupid] represent the > relationship rather than a record of groups table, where both the group > data > and the relationship data are stored (I would have to ask that there are > no > field names duplicated between these tables). This way I solve the problem > with the extra data, and the problem with the delete. About the > possibility > that there may be two relationship tables for the same pair of tables, > using > explicitly the name of the relationship table instead of the name of the > other table would solve the ambiguety (but I think it would be unusual, > and > I rather keep the access through the name of the other table). > > I'm sure there are more things I'm not considering, that's why I ask your > help to find them, and your opinion about what I've said up to now. > I think you ought to take a look at http://www.tonymarston.net/php-mysql/databaseobjects.html and http://www.tonymarston.net/php-mysql/databaseobjects2.html which explain the approach which I have adopted. You can download a working sample from http://www.tonymarston.net/php-mysql/sample-application.html. If you feel REALLY adventurous you can download its big brother from http://www.radicore.org/ In this the data access object handles all communication with the database, and the business objects deal with nothing but PHP arrays. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOM and XSLTProcessor
If there are parts of an XML document where you do not want '<' and '>' changed in '<' and '>' during the transformation then you need to use the disable-output-escaping option, as in the following example. You also need to insert such text into the XML document using the createCDATASection() method otherwise the tags will be converted BEFORE the XSLT processor gets to look at it. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""Buesching, Logan J"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] This could offer a possible workaround. Let me first state that I cannot simply do: echo htmlspecialchars_decode($proc->transformToXML($doc)); If I were to do that, then it would assume that all of these encodings need to be decoded; which definitely is not the case. I only want to do this for a few of the encodings, which I will know before the XSL processing. I guess I can do some processing after it went through the XSL Processor to decode some of the encodings that I do not want, but that just seems like it would add a lot of unnecessary overhead if it can be avoided. Thanks for the idea though. -Logan -Original Message- From: Tijnema ! [mailto:[EMAIL PROTECTED] Sent: Monday, April 09, 2007 4:40 AM To: Buesching, Logan J Cc: php-general@lists.php.net Subject: Re: [PHP] DOM and XSLTProcessor On 4/9/07, Buesching, Logan J <[EMAIL PROTECTED]> wrote: > Greetings, > > > > I apologize if this is a little long, but I am trying to put as much > information as I have done in this first post. I am running PHP 5 and > attempting to use DOM to create data to show on a webpage and using > XSLTProcessor with an XSLT sheet to output it into XHTML. Everything is > pretty fine an dandy until I wish to print raw text, such as xdebug and > var_dump. > > > > My knowledge of DOM and XSLTProcessor is about a 5/10, such that I know > most basics, but not the more advanced things. Whenever I try to add > data using createTextNode, it is always escaped, such that if I do > something, when shown to the screen, it shows > <strong> etc... > > > > Here is the general outline: > > > > > $doc=new DOMDocument("1.0"); > > $root=$doc->createElement("root"); > > $wantedCode=$doc->createTextNode("Something"); > > $root->appendChild($wantedCode); > > $doc->appendChild($root); > > $proc=new XSLTProcessor; > > $proc->importStylesheet(DOMDocument::load("test.xslt")); > > echo $proc->transformToXML($doc); > > ?> > > > > SomeSheet is something like: > > > > > > > > > > The expected output that I would like to get is: > > Something > > (This would just bold my text, not literally see the tags). > > > > The actual output is: > > <strong>Something</strong> > > (This outputs the tags to the end user, which is what I do not > want). > > > > I checked the manual at: > http://us3.php.net/manual/en/function.dom-domdocument-createtextnode.php > . A user comment suggested to use CDATA nodes, so I attempted to change > my code to the following: > > > > > $doc=new DOMDocument("1.0"); > > $root=$doc->createElement("root"); > > //note the change right here > > $wantedCode=$doc->createCDATASection("Something"); > > $root->appendChild($wantedCode); > > $doc->appendChild($root); > > $proc=new XSLTProcessor; > > $proc->importStylesheet(DOMDocument::load("test.xslt")); > > echo $proc->transformToXML($doc); > > > > ?> > > > > But this was of no success; it just had the same output. > > > > Is there anyone that is able to help me out here? > > > > Thanks, > > Logan Try using htmlspecialchars_decode before outputting your data: http://www.php.net/manual/en/function.htmlspecialchars-decode.php Tijnema > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML. Prevent < from turning into <
You need to look at "disable_output_escaping" at http://www.w3.org/TR/xslt#disable-output-escaping -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Matthew Croud" wrote in message news:2c4840c2-45db-4d6c-b5fa-2cb15b171...@obviousdigital.com... > > On 9 Sep 2009, at 14:26, Bastien Koert wrote: > >> On Wed, Sep 9, 2009 at 5:27 AM, Matthew Croud >> wrote: >>> >>> Hiya, >>> I'm writing an app that let's my client upload images, the image html >>> code >>> is added to an XML file. >>> Take a look at the element below: >>> >>> >>>e1022 >>> >>>Blue Ski Trousers >>>8.99 >>> >>> >>> Now, whenever PHP writes this to the XML files, it turns the < and >>> > into >>> < and > . which means it does not display on the webpage. How >>> can I >>> prevent this from happening ? >>> >>> Many thanks, >>> Matt >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> str_replace? >> >> >> -- >> >> Bastien >> >> Cat, the other other white meat > > > I've tried that but no matter what i do in the PHP side of things, as > soon as I save that XML the conversion takes place. > Should the XML be encoded in any way, is there a setting somewhere that > prevents this ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hoping for a hand with a login script
You are constructing your query in "$qury" yet you are trying to read it from "$query". Because they have different spellings they are treated as different variables. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Watson Blair" wrote in message news:28f3c0b00909100206o20e8ba9cr7a326e9e68f7d...@mail.gmail.com... > Hey guys,This is a simple issue I'm sure, however I'm having one hell of a > time seeing my way clear of it. I appreciate any support you guys could > throw my way. > > So I'm trying to set up a small website that includes a store ( > www.rareintaglio.com), i have all of my HTML hammed out and now I'm > working > on creating an admin login for the sites owner to input data from a back > end. I have it set up so that he goes to /adminlogin.php, enters his info > and gains access to the back end of the website using Session variables > (valid vs. invalid) however i keep getting this reply when i try to run > the > script: > > Results: SELECT * FROM adminlog WHARE username = 'gourmet28e' AND password > = > '***' > Query failed: Query was empty > here's the /adminlogin script: > > > > > session_start ; > > ?> > > > > > > > > > > > > Home > Store > About > > > > > > > if ($_SESSION['user'] == invalid) > { > echo 'Invalid Username or Password, please try again'; > } > if ($_SESSION['user'] == valid) > { > header ("Location: http://www.rareintaglio.com/member.php";); > } > ?> > > > Admin Name: > > > Password: > > > > > > All Pages and Images Copyright @ 2009, Devour.tv Ltd. > All Rights Reserved > > > > > and /session.php goes a little like: > $host="Rareintag.db.4159106.hostedresource.com"; // Host name > $username="Rareintag"; // Mysql username > $password="**"; // Mysql password > $db_name="Rareintag"; // Database name > $tbl_name="adminlog"; // Table name > > // Connect to server and select databse. > mysql_connect("$host", "$username", "$password")or die("cannot connect"); > mysql_select_db("$db_name")or die("cannot select DB"); > > // username and password sent from form > $username=$_POST['username']; > $password=$_POST['password']; > $qury = "SELECT * FROM adminlog WHARE username = '$username' AND password > = > '$password'"; > echo ''; > echo "Query: " . $query; > echo ''; > echo "Results: " . $result; > echo $qury; > echo ''; > $result = mysql_query($query) or die('Query failed: ' . mysql_error()); > > if($result == 0){ > $_SESSION['user'] = invalid ; > header("Location: http://www.rareintaglio.com/adminlogin.php";); > } > else > { > $_SESSION['user'] = valid ; > header("Location: http://www.rareintaglio.com/members.php";); > } > ?> > > However as I mentioned above i keep getting an error, > does anyone know where I took a wrong turn? > Thanks, > Watson > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question: Sorting through table headers?
What you are trying to do is ridiculously easy, and something which I accomplished years ago. Basically every column heading needs to be output as a hyperlink which repeats the current page with the addition of "orderby=" in the URL. This information appears in the $_GET array, so you just repeat the previous sql query with the addition of an ORDER BY clause. This assumes that you have already taken care of caching the query and paginating the results. You cannot do this in a separate class as it requires action in both the presentation (UI) and data access layers, and a single class is not allowed to operate in more than one layer. -- Tony Marston http://www.tonymarston.net http://www.radicore.org ""Parham Doustdar"" wrote in message news:77.26.26879.9b9ad...@pb1.pair.com... Hello there, I've been asked to create something like the tables you usually see, where the headers are actually links and when you click the links, the table gets sorted based on the header. Are there any classes that you know of that would do the job? My current idea is to return an array of the colomn which contains the data you want to sort on (like 'name') then sort the array and do something like: [code] for (i = 0; i < length(array); i++) mysql_query("select * from table where 'name' = ${aray[i]}"); [/code] Any better algorithms anyone? Thanks! -- --- Contact info: Skype: parham-d MSN: fire_lizard16 at hotmail dot com GoogleTalk: parha...@gmail.com Twitter: PD90 email: parham90 at GMail dot com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What is the best practice for adding persistence to an MVC model?
It sounds like you need a combination of MVC and the 3 Tier Architecture. They are not the same thing, for reasons described at http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq26 I have combined both these patterns in the Radicore framework - take a look at http://www.radicore.org/. If you don't like the idea of downloading a large framework there is a small sample application described in http://www.tonymarston.net/php-mysql/sample-application.html which is available for download. Basically you need to have code in every business object (every object in the Business layer) which communicates with a separate object for all its database access. This is known as a Data Access Object as it exists in the Data Access layer. If you do it right it will be possible to have a separate DAO for each DBMS so that you can switch between one database engine and another by simply changing a single configuration variable. In my own framework I have implemented DAOs for MySQL, PostgreSQL and Oracle. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Eric Bauman" wrote in message news:b9.45.36627.eb296...@pb1.pair.com... > I'm in the process of implementing an ultra-light MVC framework in PHP. It > seems to be a common opinion that the loading of data from a database, > file etc. should be independent of the Model, and I agree. What I'm unsure > of is the best way to link this "data layer" into MVC. > > I've considered a few options: > > *Datastore interacts with Model* > > //controller > public function update() > { > > $model = $this->loadModel('foo'); > $data = $this->loadDataStore('foo', $model); > > $data->loadBar(9); //loads data and populates Model > $model->setBar('bar'); > $data->save(); //reads data from Model and saves > > } > > *Controller mediates between Model and Datastore* > > Seems a bit verbose and requires the model to know that a datastore > exists. > > //controller > public function update() > { > > $model = $this->loadModel('foo'); > $data = $this->loadDataStore('foo'); > > $model->setDataStore($data); > > $model->getDataStore->loadBar(9); //loads data and populates Model > $model->setBar('bar'); > $model->getDataStore->save(); //reads data from Model and saves > > } > > *Datastore extends Model* > > What happens if we want to save a Model extending a database datastore to > a flatfile datastore? > > //controller > public function update() > { > > $model = $this->loadHybrid('foo'); //get_class == Datastore_Database > > $model->loadBar(9); //loads data and populates > $model->setBar('bar'); > $model->save(); //saves > > } > > *Model extends datastore* > > This allows for Model portability, but it seems wrong to extend like this. > Further, the datastore cannot make use of any of the Model's methods. > > //controller extends model > public function update() > { > > $model = $this->loadHybrid('foo'); //get_class == Model > > $model->loadBar(9); //loads data and populates > $model->setBar('bar'); > $model->save(); //saves > > } > > > > Any input on the "best" option - or alternative - would be most > appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting tables into forms
Try the Radicore framework at http://www.radicore.org This will allow you to import your table definitions into its Data Dictionary, export those definitions to produce table classes, then you can generate the basic maintenance tasks using transaction patterns. This takes 5 minutes per table, and you don't have to write any code - no PHP, no HTML, no SQL. You even get an RBAC system so that you can run the transactions of a menu, and decide which users have access to which tasks. There is also an inbuilt Audit Logging system (which does not use database triggers) and a Workflow engine. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "chetan rane" wrote in message news:248b70ae0910271901o6ffd569dl203c9a08bfe8a...@mail.gmail.com... > Hi Ben > > The quickest way to this is by using a framework. > and the best way i could find was using the yiiframework > www.yiiframework.com > > i could create a basic form with validations in less then 15 minutes. > > On Wed, Oct 28, 2009 at 6:42 AM, ben...@gmail.com > wrote: > >> Does anyone have a quick way of converting tables into forms? >> >> -- >> ** >> The content of this e-mail message and any attachments are >> confidential and may be legally privileged, intended solely for the >> addressee. If you are not the intended recipient, be advised that any >> use, dissemination, distribution, or copying of this e-mail is >> strictly prohibited. If you receive this message in error, please >> notify the sender immediately by reply email and destroy the message >> and its attachments. >> * >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > -- > with regards, > > Chetan Dattaram Rane > Mob : +91 9766646714 > Phone: 0831-2462055 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
The POSIX regex functions are currently marked as DEPRECATED in 5.3.0 and are due to be removed completely in PHP 6. I propose that instead of being dropped they be converted into wrappers for the equivalent PCRE functions. It does not matter how long various people have been preaching in various unofficial channels that users should switch to using the PCRE functions (preg_*) instead of the POSIX ones (ereg_*) as many users simply do not access those channels. The first time that a significant number of users will become aware of this is when they switch to 5.3.0 or later, and they will be very, very upset. Some users do not test their applications against each new PHP version as it comes out, they just use whatever version their hosting company provides them with. It does not matter that the PHP developers cannot find someone to upgrade the POSIX functions, it does not matter that the same functionality can be provided with the PCRE functions, all the users will know is that their scripts, some of which have been running for many years, will suddenly not work and will need serious programming effort before they can run again. You know how long it took for sites to upgrade from PHP 4 to 5 because of the backward compatibility issues, so imagine even more resistance and a slower uptake for PHP 6. The POSIX functions have been a core part of the language since the early days of PHP, so to suddenly dump them for no good reason will alienate and upset a large number of people. When I say "no good reason" I mean from the user's point of view. The fact that it is taking (has taken?) considerable effort to get the PCRE functions working with Unicode for PHP 6, and no-one is prepared to spend similar effort on the POSIX functions, may make it seem in the users eyes that the PHP developers are either lazy or incompetent. It does not matter that the PHP developers are unpaid volunteers - that is no reason for shoddy workmanship. If they can't do the job properly they shouldn't do it at all. BC breaks, especially on a range of functions which have been a core part of the language for many, many years, do not go down well with the users, and remember that it is the incredibly large number of people who use PHP, not the efforts of the developers, that has made it such a popular language. So annoying large numbers of users will create a PR disaster. If the PCRE functions have been made to work with Unicode, and each of the POSIX functions has a PCRE equivalent, then surely an intelligent move would be to convert all the POSIX functions into simple wrappers for their PCRE equivalents. So instead of spending huge amounts of effort in making the POSIX functions work with Unicode you simply cut out the code behind each POSIX function and replace it to a call to the relevant PCRE function. This should only require a relatively small amount of developer effort which should be balanced against the huge amount that would otherwise be required in userland. If the PHP developers are not prepared to undertake this small amount of effort then they should be prepared for considerable amounts of fallout from lots of unhappy users. I would strongly suggest that a start be made on this as soon as possible so that the changeover to PCRE wrappers can be fully tested and debugged before PHP 6 goes live. This will make the changeover from POSIX to PCRE totally transparent, and will be greatly appreciated in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
"It is for the better"? How can you justify that? It is a problem that will cause a lot of headaches for a lot of users, yet the solution which I have proposed will remove that problem with only very little effort, yet still leave only one regex engine which has to be supported in PHP 6. You have to balance out the small bit of effort required in implementing this solution against the huge amount of effort required in changing thousands, if not millions of scripts. For the PHP developers to say "we can't be bothered to update the POSIX functions to deal with unicode, so we've decided to drop them from PHP entirely even though it will break lots of scripts" will not go down well in userland. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "John Black" wrote in message news:4af70120.1040...@network-technologies.org... > The same can be said about the removal of magic_quotes(), it will break A > LOT of old scripts. > I am in the same boat, I did not keep up to date with the PHP developer > plans and just found out about ereg when I installed PHP 5.3. > > I think it was handled properly by displaying warning messages before > actually removing it. It will give people enough time to update their > scripts or weed out the old and insecure scripts. > > Yes, it will create some headache but, AFAIK, it is for the better. > > -- > John > Intelligent Life > http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
That's an amateur fudge, not a professional fix. Besides, what happens if your hosting company won't let you install PECL extensions? -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Eddie Drapkin" wrote in message news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... > On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston > wrote: >> "It is for the better"? How can you justify that? It is a problem that >> will >> cause a lot of headaches for a lot of users, yet the solution which I >> have >> proposed will remove that problem with only very little effort, yet still >> leave only one regex engine which has to be supported in PHP 6. >> >> You have to balance out the small bit of effort required in implementing >> this solution against the huge amount of effort required in changing >> thousands, if not millions of scripts. >> >> For the PHP developers to say "we can't be bothered to update the POSIX >> functions to deal with unicode, so we've decided to drop them from PHP >> entirely even though it will break lots of scripts" will not go down well >> in >> userland. >> >> >> -- >> Tony Marston >> http://www.tonymarston.net >> http://www.radicore.org >> >> "John Black" wrote in message >> news:4af70120.1040...@network-technologies.org... >>> The same can be said about the removal of magic_quotes(), it will break >>> A >>> LOT of old scripts. >>> I am in the same boat, I did not keep up to date with the PHP developer >>> plans and just found out about ereg when I installed PHP 5.3. >>> >>> I think it was handled properly by displaying warning messages before >>> actually removing it. It will give people enough time to update their >>> scripts or weed out the old and insecure scripts. >>> >>> Yes, it will create some headache but, AFAIK, it is for the better. >>> >>> -- >>> John >>> Intelligent Life >>> http://xkcd.com/638/ >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > The plan, as far as I am aware, is to move POSIX regular expressions > into PECL as of PHP6. If you can fix your scripts by simply running > "pecl install ereg" what's all the hee-hawing about? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
"Eddie Drapkin" wrote in message news:68de37340911081330v799803f3he6ed60ecc6e67...@mail.gmail.com... On Sun, Nov 8, 2009 at 4:13 PM, Tony Marston wrote: > That's an amateur fudge, not a professional fix. Besides, what happens if > your hosting company won't let you install PECL extensions? > > -- > Tony Marston > http://www.tonymarston.net > http://www.radicore.org > > "Eddie Drapkin" wrote in message > news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... >> On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston >> wrote: >>> "It is for the better"? How can you justify that? It is a problem that >>> will >>> cause a lot of headaches for a lot of users, yet the solution which I >>> have >>> proposed will remove that problem with only very little effort, yet >>> still >>> leave only one regex engine which has to be supported in PHP 6. >>> >>> You have to balance out the small bit of effort required in implementing >>> this solution against the huge amount of effort required in changing >>> thousands, if not millions of scripts. >>> >>> For the PHP developers to say "we can't be bothered to update the POSIX >>> functions to deal with unicode, so we've decided to drop them from PHP >>> entirely even though it will break lots of scripts" will not go down >>> well >>> in >>> userland. >>> >>> >>> -- >>> Tony Marston >>> http://www.tonymarston.net >>> http://www.radicore.org >>> >>> "John Black" wrote in message >>> news:4af70120.1040...@network-technologies.org... >>>> The same can be said about the removal of magic_quotes(), it will break >>>> A >>>> LOT of old scripts. >>>> I am in the same boat, I did not keep up to date with the PHP developer >>>> plans and just found out about ereg when I installed PHP 5.3. >>>> >>>> I think it was handled properly by displaying warning messages before >>>> actually removing it. It will give people enough time to update their >>>> scripts or weed out the old and insecure scripts. >>>> >>>> Yes, it will create some headache but, AFAIK, it is for the better. >>>> >>>> -- >>>> John >>>> Intelligent Life >>>> http://xkcd.com/638/ >>> >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> The plan, as far as I am aware, is to move POSIX regular expressions >> into PECL as of PHP6. If you can fix your scripts by simply running >> "pecl install ereg" what's all the hee-hawing about? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > Then you've got several options: > 1) Don't upgrade PHP. Not an acceptable option. > 2) Pick a different hosting provider. Not an acceptable optional. > 3) Fix your scripts. The scripts aren't broken. It's PHP 6 that's going to be broken. > You talk about a "professional" fix. The right fix is to remove the > depracated elements My whole argument is that they shouldn't have been deprecated in the first place. > from your scripts before upgrading PHP, which > realistically shouldn't be that big of a deal for the vast majority of > expressions. It is going to be a VERY big deal for all hose users who suddenly finf that their scripts won't run in PHP 6. > Rather than accept the change and just fix your scripts, It's not a change, it's a removal of core functions that have worked flawlessly for years. Both the POSIX and the PCRE functions needed to be updated to work with unicode, but the developers couldn't be bothered to update both. The only reason that the POSIX have been deprecated is because the PHP developers are either too lazy or too incompetent to provide a proper fix. > you propose a problem that breaks a lot of other things and introduces > way more problems than it solves. > You're not the first person to post this exact same tantrum on this l> list and the response has always been: fix your scripts The scripts aren't broken, it's PHP 6 that's broken. > or don't upgrade. Not an acceptable option. > Seeing as PHP 6 is a long ways away you've got plenty of > time to fix your scripts Just as the PHP developers have plenty of time to do a proper job. > and it's not like this is being sprung overnight, To a lot of peope it will appear to be sprung overnight as the first time they will know that the POSIX functions have been removed is when their scripts don't work. > so do the real professional thing The professional thing would be to fix PHP 6 so that is doesn't break existing scripts needlessly. > and upgrade your scripts, > if you want to upgrade (when 6 is released). Breaking BC happens. There is a difference between breaking BC because of genuinely insurmountable reasons, and breaking it because of pure laziness. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
"Robert Cummings" wrote in message news:4af7549d.1060...@interjinn.com... > Tony Marston wrote: >> "Eddie Drapkin" wrote in message >> news:68de37340911081330v799803f3he6ed60ecc6e67...@mail.gmail.com... >> On Sun, Nov 8, 2009 at 4:13 PM, Tony Marston >> wrote: >>> That's an amateur fudge, not a professional fix. Besides, what happens >>> if >>> your hosting company won't let you install PECL extensions? >>> >>> -- >>> Tony Marston >>> http://www.tonymarston.net >>> http://www.radicore.org >>> >>> "Eddie Drapkin" wrote in message >>> news:68de37340911081209p45577d46r70a3c194f1079...@mail.gmail.com... >>>> On Sun, Nov 8, 2009 at 2:47 PM, Tony Marston >>>> wrote: >>>>> "It is for the better"? How can you justify that? It is a problem that >>>>> will >>>>> cause a lot of headaches for a lot of users, yet the solution which I >>>>> have >>>>> proposed will remove that problem with only very little effort, yet >>>>> still >>>>> leave only one regex engine which has to be supported in PHP 6. >>>>> >>>>> You have to balance out the small bit of effort required in >>>>> implementing >>>>> this solution against the huge amount of effort required in changing >>>>> thousands, if not millions of scripts. >>>>> >>>>> For the PHP developers to say "we can't be bothered to update the >>>>> POSIX >>>>> functions to deal with unicode, so we've decided to drop them from PHP >>>>> entirely even though it will break lots of scripts" will not go down >>>>> well >>>>> in >>>>> userland. >>>>> >>>>> >>>>> -- >>>>> Tony Marston >>>>> http://www.tonymarston.net >>>>> http://www.radicore.org >>>>> >>>>> "John Black" wrote in message >>>>> news:4af70120.1040...@network-technologies.org... >>>>>> The same can be said about the removal of magic_quotes(), it will >>>>>> break >>>>>> A >>>>>> LOT of old scripts. >>>>>> I am in the same boat, I did not keep up to date with the PHP >>>>>> developer >>>>>> plans and just found out about ereg when I installed PHP 5.3. >>>>>> >>>>>> I think it was handled properly by displaying warning messages before >>>>>> actually removing it. It will give people enough time to update their >>>>>> scripts or weed out the old and insecure scripts. >>>>>> >>>>>> Yes, it will create some headache but, AFAIK, it is for the better. >>>>>> >>>>>> -- >>>>>> John >>>>>> Intelligent Life >>>>>> http://xkcd.com/638/ >>>>> >>>>> >>>>> -- >>>>> PHP General Mailing List (http://www.php.net/) >>>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>> >>>>> >>>> The plan, as far as I am aware, is to move POSIX regular expressions >>>> into PECL as of PHP6. If you can fix your scripts by simply running >>>> "pecl install ereg" what's all the hee-hawing about? >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >>> Then you've got several options: >>> 1) Don't upgrade PHP. >> >> Not an acceptable option. >> >>> 2) Pick a different hosting provider. >> >> Not an acceptable optional. >> >>> 3) Fix your scripts. >> >> The scripts aren't broken. It's PHP 6 that's going to be broken. > > I think you're missing the point of a full version increase. This is not a > minor or micro version change... script breakage is *expected*. But breakage should be kept to an absolute minimum, and developer laziness or incompetence is not an acceptable excuse. > You don't think PHP should support legacy cruft in the core forever do > you? Widely use regex functions are not "legacy cruft". Besides, who decides what is "cruft" and should be removed from the language? > If unicode support is
Re: [PHP] Convert deprecated POSIX functions into wrappers forequivalent PCRE functions
"Paul M Foster" wrote in message news:20091109030235.gh3...@quillandmouse.com... > On Sun, Nov 08, 2009 at 06:30:37PM -0500, Robert Cummings wrote: > >> Also, why support >> two libraries for which one is obviously inferior in speed and >> functionality? >> > > Because Tony's Radicore framework has a bunch of ereg* calls in it. ;-} Just like a lot of other people's work. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > Paul > > -- > Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
"Robert Cummings" wrote in message news:4af76e1f.2050...@interjinn.com... > Tony Marston wrote: >> "Robert Cummings" wrote in message >>>>> Then you've got several options: >>>>> 1) Don't upgrade PHP. >>>> Not an acceptable option. >>>> >>>>> 2) Pick a different hosting provider. >>>> Not an acceptable optional. >>>> >>>>> 3) Fix your scripts. >>>> The scripts aren't broken. It's PHP 6 that's going to be broken. >>> I think you're missing the point of a full version increase. This is not >>> a minor or micro version change... script breakage is *expected*. >> >> But breakage should be kept to an absolute minimum, and developer >> laziness or incompetence is not an acceptable excuse. > > Not quite true... major version moves are an opportunity to make a break > for freedom. All there needs to be is an upgrade path... and that is > clearly in play right now with the warning indicating that POSIX regex > functions are being deprecated. But a lot of people won't see those warnings until they run 5.3.0 for the first time. It is common practice, at least in all the other languages that I have used, that is something is going to be removed that it is marked as deprecated at the start of the previous release, not at the end. So marking the POIX functions as deprecated should have happened in 5.0, not 5.3. >>> You don't think PHP should support legacy cruft in the core forever do >>> you? >> >> Widely use regex functions are not "legacy cruft". Besides, who decides >> what is "cruft" and should be removed from the language? > > They most certainly are cruft. That is just your opinion. Other people think that PHP should be rewritten so that it appears more like their favourite language. Among the suggestions I have seen are: - make all variables statically typed instead of dynamically typed. - remove all procedural functions and make the language "pure" OO. Who decides if they are right? >.. hence the reason they are being removed. The people who decide what is, >and is not, cruft are the very same people who are writing the code. If you >are not happy with this then there's the age old saying in open source... >"put up or shut up". I can't because I don't program in C. So I shall do the nextbest thing - complain at every opporunity. >>> If unicode support is slopped onto the current POSIX regex functions >>> won't that then make them non-POSIX? Food for thought. Also, why support >>> two libraries for which one is obviously inferior in speed and >>> functionality? >> >> That is why I suggested that instead of dropping the POSIX functions >> entirely and seriously annoying lots of users, that they should simply be >> rewritten as wrappers for the PCRE functions. In that way all the calls >> to ereg_* would still work, but all they would do is immediately call the >> relevant preg_* function. The small amount of effort that tghis would >> take would kill two birds with one stone: >> >> (1) There would be only one regex engine to support, which would be PCRE. >> (2) Lots of developers would be spared the hassle of modifying their code >> as all the calls to POSIX functions would still work as expected because >> the language would redirect to the PCRE function automatically. > > This would probably be worse than removing the POSIX functions. > POSIX and PCRE I daresay are not completely compatible. "probably" and "daresay" mean that you are just guessing. According to some people who know what they are talking about there is a one-for-one comparison between each POSIX and each PCRE function. > At least when you remove the POSIX functions then the problem space is > well defined. And lots of sers will be pissed off because they won'tbe able to upgrade to PHP 6 without major programmer intervention. > Suddenly having POSIX regex functions that are really wrappers around PCRE > functions may introduce subtle differences in output for the same horde of > users but without the same explicability. "may introduce"? There you go, guessng again. Can you point out *any* POSIX function that cannot be converted into PCRE? >> I am not suggesting that the POSIX functions be rewritten to deal with >> unicode as that would require a huge amount of effort, but by redirecting >> al POSIX calls to the equivalent PCRE function would have the same effect >> for far less effort. >> >> The choice is simple - either a small amount of eff
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
"Ashley Sheridan" wrote in message news:1257764339.1076.56.ca...@localhost... > On Mon, 2009-11-09 at 00:23 +, Tony Marston wrote: > >> developer laziness >> or incompetence is not an acceptable excuse. > > > Exactly, so fix your scripts! But my scripts aren't broken! It's PHP 6 that is broken. > I do wonder though, what hosting company you use that would just upgrade > to PHP6 without warning on you and 'break' your scripts, How many hosting companies write to all their account holders to ask permission before upgrading PHP, not just from 4 to 5, but all the releases in between? Very few of them, if any, in my experience. > yet at the same > time would not allow you to install what you call an 'amateur fudge'. I > can't think of any hosting company that would care so little about their > customers. Some hosting companies won't allow you to use htaccess files, refuse to install any optional extension, let alone one from the PECL or PEAR repositories. Some of them won't give you more than one MySQL database. Different companies provide different levels of service. The only thing that the DO have in common is that they charge you for it. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert deprecated POSIX functions into wrappers for equivalent PCRE functions
"David Otton" wrote in message news:193d27170911090331k7ecbe69cl1dd30651273e7...@mail.gmail.com... > 2009/11/9 Tony Marston : > >> So you wouldn't trust the PHP developers to write simple code which takes >> each POSIX function and redirects it to a PCRE function? I have more >> faith >> in their ability than I do yours. > > If it's as simple as you claim, why don't you mock-up your solution in > PHP, rather than C? Because I can't do that until I install PHP 6, but as I never play with beta software waiting for it to go live will be too late. > You'll get taken more seriously if you have > working code that someone can write unit tests against. > > If your solution doesn't get any traction with the core team, you'll > still be able to offer it to the community as a simple download, just > "include this at the top of your script to fix "ereg*() not found" > problems". That would be really useful to all those people whose cause > you are championing. > > (BTW, the reference implementation for PHP is... PHP. There isn't an > ISO standard or anything here. How PHP6 behaves is correct, because > it's PHP6). > > (BTW^2 - you're on the wrong list for this. If you want to influence > the guys who make the decisions you need to take this to > php-internals, where the heavyweights hang out). I have tried subscribing to the internals list, but none of my postings ever appears. I've tried looking at the PHP wiki, but I cannot see any method of creating an RFC. I have, however, created a request in php_compat in the PEAR system at http://pear.php.net/bugs/bug.php?id=16769 -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Return object to client
It is not possible to return an object via a web service, only data. You can create an object in the client process, then populate it with data obtained from a web service. -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Manoj Singh" wrote in message news:3859a530911260441i1c08dd1agd6826748baa84...@mail.gmail.com... > Hi All, > > I am implementing the web service through PHP SOAP library. > > Actually I want to return the object to the client through web service so > that client can call all the methods of that object. > > Please help me out. > > Regards, > Manoj > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Good SQL builder class
Take a look at http://www.tonymarston.net/php-mysql/databaseobjects.html You can also download a working example of this code from http://www.tonymarston.net/php-mysql/sample-application.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Anton Heuschen" wrote in message news:e6d501390912040509k1b27f082mc22ff95d46004...@mail.gmail.com... > Good day. > > I'm looking for a good class to handle building dynamically from and > array (and if it is good it will automatically determine / or even > have different methods) to handle mutli-dimensional arrays or simple > associative arrays ... and build the SQL statement : > > for example I have an array : > > $home[$suburb]["street"] = test1; > $home[$suburb]["housenr"] =2; > > > Ok to keep it simple to 2, then I want to build the SQL like > > insert into homes (STREET, HOUSENR) VALUES ($val1,$val2); > > > something like that, but I could also pass some array like : > > $home["street"] = test2; > $home["housenr"] = 2; > > > but the idea stays the same = the index is the name of the DB fields > and the assigned value the element > > > > I have looked on hotscripts and phpclasses but I have no idea how good > the solutions are that I have found thus far - therefor need some > recommendation from someone else past experience of this -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] If design patterns are not supposed to produce reusable code then why use them?
I have recently been engaged in an argument via email with someone who criticises my low opinion of design patterns (refer to http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that design patterns are merely a convention and not a reusable component. My argument is that something called a pattern is supposed to have a recurring theme, some element of reusability, so that all subsequent implementations of a pattern should require less effort than the first implementation. If design patterns do not provide any reusable code then what is the point of using them? I do not use design patterns as I consider them to be the wrong level of abstraction. I am in the business of designing and developing entire applications which comprise of numerous application transactions, so I much prefer to use transaction patterns (refer to http://www.tonymarston.net/php-mysql/design-patterns-are-dead.html and http://www.tonymarston.net/php-mysql/transaction-patterns.html ) as these provide large amounts of reusable code and are therefore a significant aid to programmer productivity. What is your opinion? Are design patterns supposed to provide reusable code or not? If not, and each implementation of a pattern takes just as much time as the first, then where are the productivity gains from using design patterns? -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?
"Larry Garfield" wrote in message news:200912311743.16759.la...@garfieldtech.com... > Meant to send this to the list, sorry. > > -- Forwarded Message -- > > Subject: Re: [PHP] If design patterns are not supposed to produce reusable > code then why use them? > Date: Thursday 31 December 2009 > From: Larry Garfield > To: "Tony Marston" > > On Wednesday 30 December 2009 10:50:40 am Tony Marston wrote: >> I have recently been engaged in an argument via email with someone who >> criticises my low opinion of design patterns (refer to >> http://www.tonymarston.net/php-mysql/design-patterns.html ). He says that >> design patterns are merely a convention and not a reusable component. My >> argument is that something called a pattern is supposed to have a >> recurring >> theme, some element of reusability, so that all subsequent >> implementations >> of a pattern should require less effort than the first implementation. If >> design patterns do not provide any reusable code then what is the point >> of >> using them? >> >> >> >> I do not use design patterns as I consider them to be the wrong level of >> abstraction. I am in the business of designing and developing entire >> applications which comprise of numerous application transactions, so I >> much >> prefer to use transaction patterns (refer to >> http://www.tonymarston.net/php-mysql/design-patterns-are-dead.html and >> http://www.tonymarston.net/php-mysql/transaction-patterns.html ) as these >> provide large amounts of reusable code and are therefore a significant >> aid >> to programmer productivity. >> >> >> >> What is your opinion? Are design patterns supposed to provide reusable >> code >> or not? If not, and each implementation of a pattern takes just as much >> time as the first, then where are the productivity gains from using >> design >> patterns? > > It depends what you're reusing. Design patterns are reusable concepts, > not > reusable code. That's the key difference. > > Knowledge of design patterns is like knowledge of how different food > ingredients interact. "Hm, this needs something to bring out the taste > more, > so I'll add salt." You're not going to add the same salt to each dish, > obviously, but the idea is that you need something that will bring out the > taste, and there are certain spices that will bring out the existing taste > of > whatever it is you put them on, such as salt. Food recipes are a bad analogy for design patterns. A food recipe explicitly identifies a list of ingredients and a list of actions which are required to produce the intended result. The design pattern equivalent of a recipe would simply state "take a bunch of ingredients, mix them up, heat them up, serve them up". A design pattern merely identifies the concept, not the implementation, so where is the REAL benefit? Where is the re-usability? > Similarly, if you want, say, a piece of code that will connect to a > database, > you want a pre-built library, not a design pattern. (There's no shortage > of > those.) If, however, you want a mechanism by which you can have different > implementations of the same system, and want to swap them out without > rewriting the calling code, then what you want is the factory *pattern*. > There may not be existing code yet for whatever system you're writing. > However, once you recognize "Ah, I want a common interface with a > swappable > implementation, and I want to pick the implementation at runtime based on > some > arbitrarily complex logic", then you know you don't need to think through > how > you go about structuring the code to do that. Instead, you look up a > description of the factory pattern and go "ah, that makes sense, and it > solves > 3 problems that I didn't realize I'd run into later". Then you go and > implement code that follows that pattern, and you don't have to think > through > the algorithm. I would not use the factory pattern for such a thing. I have actually written an application which can switch between database engines - MySQL, PostgreSQL and Oracle - simply by changing a single line of code. Although I *could* use the factory pattern, in my experience it would be overkill and too complicated. > Now, it is possible to make generic implementations of some patterns that > you > can re-leverage. Eg, you can have a common factory interface and a way to > request a factory, which in turn will give you the implementation object > you > want. The common elements of those factorie
Re: [PHP] If design patterns are not supposed to produce reusable code then why use them?
"Larry Garfield" wrote in message news:201001010553.41956.la...@garfieldtech.com... > On Friday 01 January 2010 05:26:48 am Tony Marston wrote: > >> > It depends what you're reusing. Design patterns are reusable concepts, >> > not reusable code. That's the key difference. >> > >> > Knowledge of design patterns is like knowledge of how different food >> > ingredients interact. "Hm, this needs something to bring out the taste >> > more, >> > so I'll add salt." You're not going to add the same salt to each dish, >> > obviously, but the idea is that you need something that will bring out >> > the taste, and there are certain spices that will bring out the >> > existing >> > taste of >> > whatever it is you put them on, such as salt. >> >> Food recipes are a bad analogy for design patterns. A food recipe >> explicitly identifies a list of ingredients and a list of actions which >> are required to produce the intended result. The design pattern >> equivalent >> of a recipe would simply state "take a bunch of ingredients, mix them up, >> heat them up, serve them up". A design pattern merely identifies the >> concept, not the >> implementation, so where is the REAL benefit? Where is the re-usability? > > Note that I did not say that design patterns are a recipe. I said they're > knowledge of how different foods interact. They're meta-knowledge that > makes > you a better chef, not a faster short-order cook. Knowledge of how foods interact will not in itself make anyone a good cook. Knowledge of design patterns will not in itself make anyone a good programmer. It is how that knowledge is applied which makes the difference. The problem with design patterns is that the actual implementation is left up to the indvidual, and if the implementation is faulty the fact that a design pattern was used is nothing more than a red herring. >> > Similarly, if you want, say, a piece of code that will connect to a >> > database, you want a pre-built library, not a design pattern. >> > (There's no shortage of >> > those.) If, however, you want a mechanism by which you can have >> > different implementations of the same system, and want to swap them out >> > without rewriting the calling code, then what you want is the factory >> > *pattern*. There may not be existing code yet for whatever system >> > you're >> > writing. However, once you recognize "Ah, I want a common interface >> > with >> > a swappable implementation, and I want to pick the implementation at >> > runtime based on some arbitrarily complex logic", then you know you >> > don't >> > need to think through how >> > you go about structuring the code to do that. Instead, you look up a >> > description of the factory pattern and go "ah, that makes sense, and it >> > solves 3 problems that I didn't realize I'd run into later". Then you >> > go and >> > implement code that follows that pattern, and you don't have to think >> > through the algorithm. But the problem is that you DO have to think through the algorithm as a design pattern exists just as a vague outline, a description of a possible solution, not a workable solution that you can just plug in and go. >> I would not use the factory pattern for such a thing. I have actually >> written an application which can switch between database engines - MySQL, >> PostgreSQL and Oracle - simply by changing a single line of code. >> Although >> I *could* use the factory pattern, in my experience it would be overkill >> and too complicated. > > Oh really? I've written such a DB abstraction system as well. (I think > most > people have at some point.) Although I did not specifically go into it > saying > "I will use a factory for this", in practice it really is. Some client > code > says "hey, I need a DB connection, gimme!", an intermediary piece of code > figures out which DB connection you need (based on configuration data, > what > servers are available, or whatever), and passes back a PDO connection > object > on which you run queries. That's a factory, in a nutshell. I suspect > your DB > abstraction system works on the same general principle. > > Yes, you're already using common design patterns, I wager, even if you had > to > "invent" them yourself. I may be using constructs which have proved to be efficacious in my many years of experience, but I do not look at my soluti
[PHP] Re: [PHP-DB] School timetable in php
"tamouse mailing lists" wrote in message news:CAHUC_t-cch8cBXZvzWtx42ZPFEuVkMPG=50jkwv+gygelk_...@mail.gmail.com... On Sun, Apr 22, 2012 at 1:41 AM, Vinay Kannan wrote: Weekly subject wise lecture schedule, subject wise / faculty wise. On Sun, Apr 22, 2012 at 12:02 PM, tamouse mailing lists wrote: On Fri, Apr 20, 2012 at 7:00 AM, Vinay Kannan wrote: > I am trying to develop a school time table system in php mysql, > anybody > has any headsup on the same, i was thinking about some existing > scripts to > take a look at. I have a sample application called "Classroom Scheduling" which comes with the Radicore framework. Even if you don't want to use the code, the database design might be useful. If you visit the Radicore website at http://www.radicore.org you can logon to the demonstration system, click on the PROTO button, then select "Classroom". This has functions for rooms, teachers, subjects, lessons, classes and students. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Function size
On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: > A rule of thumb is no more than 50 lines per > function, most much less. Back in the day when we didn't have nifty > gui screens and an 24 line terminals (yay green on black!), if a > function exceeded one printed page, it was deemed too long and marked > for refactoring. I think the idea of setting an arbitrary limit on the number of lines that a function should contain is quite ludicrous and something which I will completely ignore. If a function requires a hundred or more lines then so be it. The only reason to take a block of code and put it into its own function is when that code is likely to be called more than once so that it conforms to the DRY principle. If it is only ever used in one place then there is no point. The problems I have with creating lots of small used-only-once functions is as follows: - you have to create a meaningful name for each function. - all those functions should be arranged in alphabetical order within their containing file - having them in a random sequence makes it difficult to find the one you want. - when browsing through the code you have to keep jumping to another function, and then returning to where you came from. I don't know about you, but I would rather use the scroll wheel on my mouse than keep jumping from one position in the file to another. Another problem I have encountered in the past with such an idea is that it encourages a stupid programmer to decrease the number of lines of code by compressing as many statements as possible into a single line, which then makes the code less easy to read and understand. This is much worse than having more than 20 lines in a function. Whether a file contains 10 functions of 100 lines each, or 100 functions of 10 lines each, you still end up with 1000 lines of code. If you do not have the mental capacity to deal with a 100-line function then you are in the wrong job. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Function size
"Ashley Sheridan" wrote in message news:1338326229.2616.31.camel@localhost.localdomain... > On Tue, 2012-05-29 at 17:06 -0400, Paul M Foster wrote: > >> On Tue, May 29, 2012 at 08:52:46AM +0100, Tony Marston wrote: >> >> > On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: >> > > A rule of thumb is no more than 50 lines per >> > > function, most much less. Back in the day when we didn't have nifty >> > > gui screens and an 24 line terminals (yay green on black!), if a >> > > function exceeded one printed page, it was deemed too long and marked >> > > for refactoring. >> > >> > I think the idea of setting an arbitrary limit on the number of lines >> > that a >> > function should contain is quite ludicrous and something which I will >> > completely ignore. If a function requires a hundred or more lines then >> > so be >> > it. The only reason to take a block of code and put it into its own >> > function >> > is when that code is likely to be called more than once so that it >> > conforms >> > to the DRY principle. If it is only ever used in one place then there >> > is no >> > point. >> > >> > The problems I have with creating lots of small used-only-once >> > functions is >> > as follows: >> > - you have to create a meaningful name for each function. >> > - all those functions should be arranged in alphabetical order within >> > their >> > containing file - having them in a random sequence makes it difficult >> > to >> > find the one you want. >> > > And yeah, alphabetical order? Really? This is a throwback to my 3GL days when all components within a file were arranged in alphabetical sequence so that they were easier to find when you looked at the printed listing. > Group them by similarity, sure. > But today, with IDEs that will jump straight to functions and class > methods, and the good ol' find tool on every editor I've ever seen, is > sorting them alphabetically really necessary? Seems like a waste of time > that is likely not going to be done by fellow developers working on the > same codebase. I have never come across an IDE that jumps to a function when you click on its name, so how does it return to where you jumped from? Rather than artificially reduce the size of a function to satisfy someone else's limited attention span I would rather use the scroll wheel on my mouse. Scrolling up or down within a single function is easier than searching/finding/jumping to a series of sub-functions which may exist at random locations within the same file. I will only split a large function into sub-functions when it makes sense to do so, and not because some nerd cannot scan more than 20 lines at a time. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Function size
"tamouse mailing lists" wrote in message news:cahuc_t__sw-_yhrw4n4uqr-fa46+cebunzgehboaatrafla...@mail.gmail.com... On Tue, May 29, 2012 at 2:52 AM, Tony Marston wrote: On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: A rule of thumb is no more than 50 lines per function, most much less. Back in the day when we didn't have nifty gui screens and an 24 line terminals (yay green on black!), if a function exceeded one printed page, it was deemed too long and marked for refactoring. I think the idea of setting an arbitrary limit on the number of lines that a function should contain is quite ludicrous and something which I will completely ignore. If a function requires a hundred or more lines then so be it. The only reason to take a block of code and put it into its own function is when that code is likely to be called more than once so that it conforms to the DRY principle. If it is only ever used in one place then there is no point. You obviously haven't spent much time maintaining other people's code. I have been maintaining other people's code, which have been written to many different standards of varying quality, for many years. There is a point: if you are unfamiliar with code, wading through screens and screens of a function to find things like block beginning/ends makes for difficult time finding places where changes need to be made. I *never* have huge numbers of lines between a block beginning and end. Even if I did my IDE can quickly find the other end of the block for me. If you will never have your code maintained by anyone else, or collaborate with anyone else, feel free to do what you want. My code has been available in an open source framework for over 6 years, and I have never received any complaints on the readability of my code, only compliments. The problems I have with creating lots of small used-only-once functions is as follows: - you have to create a meaningful name for each function. Yes, you do, which is also considered a hallmark of good design. - all those functions should be arranged in alphabetical order within their containing file - having them in a random sequence makes it difficult to find the one you want. Also correct; this is a key point in making sure your scripts are maintainable. Ah-ha! So someone agrees with me on that point after all. - when browsing through the code you have to keep jumping to another function, and then returning to where you came from. I don't know about you, but I would rather use the scroll wheel on my mouse than keep jumping from one position in the file to another. May I suggest an editor/IDE that lets you navigate to functions directly, then? I am *NOT* going to change my IDE just to suit *YOUR* preferences. Another problem I have encountered in the past with such an idea is that it encourages a stupid programmer to decrease the number of lines of code by compressing as many statements as possible into a single line, which then makes the code less easy to read and understand. This is much worse than having more than 20 lines in a function. There are counterbalancing things as well. If the only aspect of one's coding standards are "make it fit on one screen" then yes, you might see someone idiotic enough to do that. However, a good set of coding standards includes things which will prevent this, such as not stacking code like that. Whether a file contains 10 functions of 100 lines each, or 100 functions of 10 lines each, you still end up with 1000 lines of code. If you do not have the mental capacity to deal with a 100-line function then you are in the wrong job. The rules of thumb for coding standards are for maintainability, primarily, so throwing up strawmen to try to weasel out of an idea is pretty specious. I will only follow standards which have a genuine purpose and a genuine benefit. I will *NOT* follow any which I consider to be arbitrary, artificial and pointless. There is *NO* limit to the number of lines in a function/method, and there is *NO* limit on the number of methods within a class. The only thing that matters is that the code is readable and maintainable. If some functions overflow the current screen then LEARN TO USE THE MOUSE WHEEL! That is what is was invented for in the first place. I will *NOT* make my code more difficult to read by creating a huge number of artificially small functions. If you do not care about how much time it takes to fix defects in other people's code, then I hope you remain a solitary programmer and don't expect anyone else to use your code, otherwise, you are in the wrong job. I *DO* care, which is why I write code which is readable and maintainable. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Function size
"Tim Streater" wrote in message news:d0.7c.45755.25a3b...@pb1.pair.com... On 03 Jun 2012 at 10:02, Tony Marston wrote: "tamouse mailing lists" wrote in message news:cahuc_t__sw-_yhrw4n4uqr-fa46+cebunzgehboaatrafla...@mail.gmail.com... There is a point: if you are unfamiliar with code, wading through screens and screens of a function to find things like block beginning/ends makes for difficult time finding places where changes need to be made. I *never* have huge numbers of lines between a block beginning and end. Even if I did my IDE can quickly find the other end of the block for me. E.g. TextWrangler does this easily enough: just double-click immediately after an opening brace, and everything is highlighted to the closing brace. - all those functions should be arranged in alphabetical order within their containing file - having them in a random sequence makes it difficult to find the one you want. Also correct; this is a key point in making sure your scripts are maintainable. Ah-ha! So someone agrees with me on that point after all. +1 - when browsing through the code you have to keep jumping to another function, and then returning to where you came from. I don't know about you, but I would rather use the scroll wheel on my mouse than keep jumping from one position in the file to another. May I suggest an editor/IDE that lets you navigate to functions directly, then? I am *NOT* going to change my IDE just to suit *YOUR* preferences. TW provided a popup list of your functions. It still helps to have them in alpha order though, for ease of navigation in the popup list. [snip arguments] I write functions to do specific things. E.g. I have a function (actually in JavaScript) called switchTab() which switches from one user view to another. It's just over 200 lines long and is mostly a giant case statement - and it's already loaded with function calls. I suppose I could break it up into five separate functions, more or less one for each case value, but then I'd have lots of unimportant local variables to pass around as argument values, and, what's worse, lots of unimportant functions cluttering the place up. Exactly! That's one good reason *NOT* to break up a large function into artificially small pieces. You generate a lot of useless code just to handle the small pieces, and wading through lots of useless code makes it less readable. In my opinion it takes less effort to use the scroll wheel on my mouse than it does to jump/return from different parts of the file. There are times when it makes sense to split a large function into smaller pieces, but I'm afraid that doing so for no other reason than to satisfy someone's personal line limit is just not good enough. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hungarian Notation interest with PHP
"Mihamina Rakotomandimby" wrote in message news:4fccc97a.1060...@rktmb.org... Hi all, I have a colleague stuck with this thing named "Hungarian Notation" http://goo.gl/xYv8O We try to define our internal coding standards, which is very close to the Symfony ones http://goo.gl/f2rcO But we're in conflict because the colleague really argue about his "Hungarian Notation". Have you got some ressources arguing against this? I ran out of mine to convince him... Take a look at http://en.wikipedia.org/wiki/Hungarian_notation which shows that quite a few 'big' names are against it. I personally hate it because it ties a variable to a particular type, which in PHP is useless as a variable is allowed to change its type 'on the fly'. Even in a strongly typed language it can cause problems - I remember many years ago having a variable called $numCustomerId because CustomerId was supposed to be numeric. Then it transpired that it could actually contain alpha characters, so it had to be a string and not a number. Changing all occurrences of $numCustomerId to $strCustomerId was a royal PITA, but it would have been totally confusing to allow alpha characters in a variable that was supposed to contain nothing but numbers. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO: extend or encapsulate?
wrote in message news:1535031289.371987.1342162338279.javamail.open-xcha...@email.1und1.de... tamouse mailing lists hat am 13. Juli 2012 um 07:06 geschrieben: It's Friday, so... Yes, it's true, I have just started looking at using PDO instead of mysqli -- a bit behind the times... My question at this stage, is do people tend to extend the PDO class for their own use, or encapsulate it in a class (or do most people use it mostly in procedural code?) I stick to use it as components as it is said "Do not use inheritance for code re-use" :) The idea that you shouldn't use inheritance for code reuse is absolute nonsense as it makes a mockery of one of the fundamental principles of object oriented programming. If you make a mess of inheritance it's because your implementation is flawed, not that the concept is flawed. Next you'll be saying "don't use encapsulation"or "don't use polymorphism". What a bunch of idiots! -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Web dev, DB and "proper db design".
"Richard Quadling" wrote in message news:CAKUjMCWJ4wiUO904OvYkS53Fsg4PPXa=qbokcvhwfemcpkp...@mail.gmail.com... Hi. I've just had a conversation regarding DB, foreign keys and their benefits. I was told "I've never worked on a web application where foreign keys were used in the database". As someone who has spent 25 years working on accounting/epos systems on MS SQL Server (yep, windows) and now in a web environment and hearing the above, ... well, ... slightly concerned. So, in the biggest broadest terms, what do you lot do? DBs with no foreign keys (constrainted or not). ORM builders with manual definition of relationships between the tables. Inline SQL where you have to just remember all the relationships. Views for simple lookups? How do you handle updatable views (does mysql support them?) etc. Is there a difference in those in 'startups' and web only situations, or those doing more traditional development (split that as you like - I'm just trying to get an understanding and not go off on one!). No definitive answers, and I hope I get some wide experiences here. Thanks for looking. Richard. There is a difference between having a field which is used as a foreign key and having a foreign key constraint defined in the database. Remember that foreign keys can be used in SELECT statements without there being a FK constraint. Constraints are only used in INSERT/UPDATE/DELETE operations, and never used for SELECTs You cannot have relationships in a database without foreign keys, but you can have foreign keys with constraints. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web dev, DB and "proper db design".
at there is a difference between a foreign key and a foreign key constraint. Foreign keys can exist without constraints, so saying that you cannot use a field as a foreign key in a SELECT statement without having a constraint defined in the database is just plain wrong. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web dev, DB and "proper db design".
"Lester Caine" wrote in message news:51d6987c.9050...@lsces.co.uk... Tony Marston wrote: I was designing and building database applications before relational databases became popular, and in those old hierarchical and network databases there were no such things as foreign key constraints. Database integrity had to be handled in the code, which is what we did. When I started working with relational databases there were features of the language, such as FK constraints, which were rarely used even though they were there. When I started working on web applications the predominant database was MySQL, and the vast majority of ISPs would only offer MyISAM and not Innodb, and MyISAM does not support FK constraints. This was my point about MySQL ... what database were you using before MySQL came along? I used ORACLE and SOLID, and before that Hewlett Packard's IMAGE (network DB) and Data General's INFOS (hierarchical DB). There are some programmers who complain that without foreign keys being defined in the database, how do you recognise relationships to build into SELECT statements? Simple. Every primary key is in the format ‘_id’, so if you see this format in a table, and is a different table, then it’s a foreign key. This is actually easier to identify than having to look in a separate place. Remember that there is a difference between a foreign key and a foreign key constraint. Foreign keys can exist without constraints, so saying that you cannot use a field as a foreign key in a SELECT statement without having a constraint defined in the database is just plain wrong. Certainly in some instances then managing everything in code makes sense. Cross database working for instance. So everything works the same for each engine. But the main advantage of adding constraints in the database is that it protects the foreign entries from being deleted while they are still in use. One of the problems I end up having to recover is where a hickup in the PHP or user side of things has deleted an entry, or more usually the whole table! In this case a properly implemented constraint would have prevented the problem. While using a constraint to manage the deletion of detail elements has a place in reducing traffic between program and database, the protection of detail elements is the more useful reason for maintaining them. In my framework I define relationships and any constraints in my data dictionary, and these are enforced by a standard module in the framework. This means that any RESTRICTED constraints can be detected in the code without executing a DELETE and having it abort. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Beginner Tutorials for using CLASSES in PHP4
There's a small sample application that demonstrates how to use classes with PHP 4 at http://www.tonymarston.net/php-mysql/sample-application.html It also has a bigger framework at http://www.radicore.org/ -- Tony Marston http://www.tonymarston.net http://www.radicore.org "Jeff Cohan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yes, I know how to Google, and I've been Googling... > > But I would appreciate advice about good beginner tutorials using > classes in PHP4 based on your actual experiences. I.e., have some of > you found tutorials that really unlocked the doors for you? > > Ideally, such tutorials would have somewhat realistic examples. (I > already know how to output "Hello, World" using a class, and I tend > to find examples like those unhelpful. Maybe it's just me.) > > My main challenge is modularizing yer basic BREAD/CRUD operations > with MySQL databases. > > I've made some strides in creating increasingly modular functions to > present browse lists, edit forms and add forms; to perform > field-level and form-level validations; and to perform inserts, > updates and deletes. My approach is to utilize multidimensional > arrays which define the column names, column labels (for forms), > form control types (input, select, checkbox, etc.) and other > attributes of the form controls. I've got a "library" of validation > routines with error messages that appear on the form under the > culprit form control. > > But I think taking the next step to use classes is going to make my > life much easier. > > TIA for any guidance you might be able to offer. > > Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > although some people believe differently than i; i would argue > trying to learn how to design w/ the classes that php4 provides > is a waste of time. I disagree. PHP 4 gives you access to classes, encapsulation, inheriance and polymorphism. This is all you need for OO programming. All that extra crap in PHP 5 is just window dressing. > most books you will find regarding object oriented > design assume the language has the basic constructs. ppp mainly. > also, there are other important facilities php4 lacks like abstract > classes You can write abstact classses in PHP 4, it's just that you can't use the word "abstract". Interfaces are totally irrelevant as any method can be accessed directly through its function definition. > and interfaces, not to mention you have to explicitly assign objects by > reference in php4. (if you dont want a copy created). > unless you are bound to php4 by work or something > i suggest you start working w/ php5. also, if your looking for some > design > techniques i recommend studying design patterns. Design patterns are overrated. For building transactions in CRUD applications you need transaction patterns. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > the heads first book > is a great starting point. > actually if you want a solid reference thats free on the web look at > phpPatterns <http://www.phppatterns.com/docs/start> > the code is mostly php4 i believe. > > -nathan > > > On 9/29/07, Jeff Cohan <[EMAIL PROTECTED]> wrote: >> >> Yes, I know how to Google, and I've been Googling... >> >> But I would appreciate advice about good beginner tutorials using >> classes in PHP4 based on your actual experiences. I.e., have some of >> you found tutorials that really unlocked the doors for you? >> >> Ideally, such tutorials would have somewhat realistic examples. (I >> already know how to output "Hello, World" using a class, and I tend >> to find examples like those unhelpful. Maybe it's just me.) >> >> My main challenge is modularizing yer basic BREAD/CRUD operations >> with MySQL databases. >> >> I've made some strides in creating increasingly modular functions to >> present browse lists, edit forms and add forms; to perform >> field-level and form-level validations; and to perform inserts, >> updates and deletes. My approach is to utilize multidimensional >> arrays which define the column names, column labels (for forms), >> form control types (input, select, checkbox, etc.) and other >> attributes of the form controls. I've got a "library" of validation >> routines with error messages that appear on the form under the >> culprit form control. >> >> But I think taking the next step to use classes is going to make my >> life much easier. >> >> TIA for any guidance you might be able to offer. >> >> Jeff >> >> -- >> 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] Beginner Tutorials for using CLASSES in PHP4
""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > there is no way to create an abstract class in php4. Oh yes there is! I knw, because I have done it! The definition of an abstrract class is one that cannot be instantiated into an object. It can, however, be extended into a subclass, and that subclass can be instantiated into an object. Although in PHP 5 this can be achieved by using the "abstract" keyword in the class definition, in PHP 4 you can achieve exactly the same result by defining a method in the abstract class which contains code which forces an error, but when redefined in the subclass this code is replaced so that it does not cause an error. The end result is the same, but the mechanism is different. > in an abstract class definition subclasses are forced to implement those > methods > that have been declared abstract. or they are allowed to declare the > method > as abstract themselves and force their children to provide a concrete > definition. > the only way to achieve this in php4 is to have an essentially empty > definition in a Not an empty definition, but one that contains code which triggers an error. > class and through external documentation or communication w/ other > developers, > indicate the function need be overridden to be usable. > communicating externally, something that could be communicated inside the > language > itself is very delicate, one that would not do well in a scenario with a > large > number of developers. > > interfaces introduce the concept of design-by-contract. they are very > powerful because > they give code another avenue to be polymorphic. You DO NOT need interfaces to activate a class method. You DO NOT need interfaces to utilise polymorphism. > inheritance is often > overused because > people dont understand the power of composition and the benefit of > interfaces to facilitate > composition. Just because SOME people overuse inheritance does not mean that EVERYBODY overuses inheritance. My class structure is only two levels deep - an abstract superclass with any number of concrete subclasses underneath it. > for people coming to php4 from languages like java, or even .net; anything > that > implements proper access control mechanisms, abstract classes and > interfaces; those > people may be able to design systems w/ php4 that are properly structured. You do not need access contol mechanisms or interfaces to write properly structured code. > starting out w/ > php4 and trying to learn oop will likely lead individuals into bad > practices > that they cannot foresee > until years down the road, when their systems are growing at a slow rate > and > they have to > figure out why or somebody who understands oop comes in and explains where > the problems are. > > the most common mistake i encounter with oop php4 is accessing class > member > functions directly. > this is a complete violation of encapsulation and php4 provides no way to > enforce it. Absolute rubbish. Keeping data private has nothing to do with encapsulation. > yes, php4 does provide some of the fundamental oop facilities and its all > the community had for a while. > the bottom line is the facilities it offers for oop are bare and i see no > reason to try to understand its > peculiarities and weaknesses when php5 is here and php6 is on the way. Rubbish. PHP 4's implementation of OO supports classes, objects, encapsulation, inheritance and polymorphism. That is more than enough for a competent programmer. Everything else is eye candy. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > -nathan > > On 10/2/07, Tony Marston <[EMAIL PROTECTED]> wrote: >> >> >> ""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > although some people believe differently than i; i would argue >> > trying to learn how to design w/ the classes that php4 provides >> > is a waste of time. >> >> I disagree. PHP 4 gives you access to classes, encapsulation, inheriance >> and >> polymorphism. This is all you need for OO programming. All that extra >> crap >> in PHP 5 is just window dressing. >> >> > most books you will find regarding object oriented >> > design assume the language has the basic constructs. ppp mainly. >> > also, there are other important facilities php4 lacks like abstract >> > classes >> >> You can write abstact classses in PHP 4, it's just that you can't use the >> word "abstract". Interfaces are totally irrelevant as any method can be >> accessed directly through its function definiti
Re: [PHP] Beginner Tutorials for using CLASSES in PHP4
""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > keeping data private is how encapsulation in facilitated. Absolute rubbish. Encapsulation is the act of placing data and the operations that perform on that data in the same class. The data does not have to be private at all. > here is a really simple way to violate encapsulation in php4 > > class BreakMe { > // private > var $iWishIWasPrivate; > } > > // later on > > $instance = new BreakMe(); > > $instance->iWishIWasPrivate = 'encapsulation violated'; > > if the member variable was supposed to be private well we have just > violated > encapsulation. Encapsulation is NOT data hiding. > further more when you migrate to php5 you will find many > headaches > as you mark the would-be private variable in php4 private in php5. My code has to run using both PHP 4 and PHP 5, so I don't waste my time marking any variables as private or protected. > the proper technique is to drive all access to member variables in php4 > through member functions. That is *A* technique, but not the only technique. > the problem that arises is anybody can simply go and violate the > encapsulation > as i have demonstrated w/o any warning. I repeat, encapsulation has absolutely nothing to do with data hiding. > the only way to discover this is > through reading > the code, which in a large environment is a lengthy time consuming > process. > > i never said interfaces needed to be used to facilitate polymorphism. i > just said they supply an additional means of polymorphism, I do not need an interface to access a method, therefore interfaces are redundant. > its actually more powerful than inheritance alone because > a class can implement any number of interfaces, not just one parent class. A class can implement any number of methods, and I do not need interfaces to access those mehods, so interfaces are redundant. > also, interfaces > dont require that the behavior be carried over, which is one of the > problems > w/ overusing > inheritance; it isnt always the case that behavior should be propagated. Then don't overuse inheritance. > admittedly your abstract class mechanism is somewhat similar to what the > keyword supplies in > php5, but i beg the question; why clutter up userspace and contrive > techniques that the language > supplies in php5. Because I originally wrote my code using PHP 4, and the same code has to run in both PHP 4 and PHP 5. > php4 is outdated; that is the point. But is is still widely used. There are a lot of hosting companies who have yet to upgrade to PHP 5, so the need for PHP 4 is still there. > for someone trying to learn oop, i > maintain that doing so using php4 > is a waste of time. That is just your opinion. I beg to differ. > that would be like learning java4 even though java6 is > in use, its just silly. But if a lot of servers refused to upgrade from java 4 it would be pointless using code that only worked in java 6.. -- Tony Marston http://www.tonymarston.net http://www.radicore.org > -nathan > > On 10/3/07, Tony Marston <[EMAIL PROTECTED]> wrote: >> >> >> ""Nathan Nobbe"" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > there is no way to create an abstract class in php4. >> >> Oh yes there is! I knw, because I have done it! The definition of an >> abstrract class is one that cannot be instantiated into an object. It >> can, >> however, be extended into a subclass, and that subclass can be >> instantiated >> into an object. >> >> Although in PHP 5 this can be achieved by using the "abstract" keyword in >> the class definition, in PHP 4 you can achieve exactly the same result by >> defining a method in the abstract class which contains code which forces >> an >> error, but when redefined in the subclass this code is replaced so that >> it >> does not cause an error. >> >> The end result is the same, but the mechanism is different. >> >> > in an abstract class definition subclasses are forced to implement >> > those >> > methods >> > that have been declared abstract. or they are allowed to declare the >> > method >> > as abstract themselves and force their children to provide a concrete >> > definition. >> > the only way to achieve this in php4 is to have an essentially empty >> > definition in a >> >> Not an empty definition, but one that contains code which triggers an >> error. >> >> > class and through external documentation or communication w/ other