Re: [PHP] Form Validation
Ashley Sheridan wrote: On Wed, 2009-08-12 at 12:21 -0400, Micheleh Davis wrote: Please help. My form validation worked fine until I added the terms check at the bottom. Any ideas? //form validation step one function validateStep1(myForm){ // list of required fields with (myForm) { var requiredFields = new Array ( firstName, lastName, phone, email, terms) } // check for missing required fields for (var i = 0; i requiredFields.length; i++){ if (requiredFields[i].value == ){ alert (You left a required field blank. Please enter the required information.); requiredFields[i].focus(); return false; } } // check for valid email address format var eaddress= myForm.email.value; var validaddress= /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/; //var validaddress= /^((\w+).?(\w+))+...@\w+/i; var result= eaddress.match(validaddress); if (result == null) { alert (Please enter your complete email address.); myForm.email.focus(); return false; } // check for valid phone format var check= myForm.phone.value; check= check.replace(/[^0-9]/g,); if (check.length 10) { alert (please enter your complete phone number.); return false; }//end if return true; //begin terms and conditions check var termsCheck= myForm.terms.value; if (bcForm1.checked == false) { alert ('Please read and select I Agree to the Terms and Conditions of Service.'); return false; } else { return true; } //end terms check Erm, where's the PHP code in that? Thanks, Ash http://www.ashleysheridan.co.uk Indeed. And I hope that there is server-side form validation also. HTH, Stijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is select_db necessary?
'Twas brillig, and Jay Blanchard at 12/08/09 17:32 did gyre and gimble: [snip] I'm interested to know why you consider this to be very flexible and how this leaves the selection in the database's hands? [/snip] Flexible because I can connect to more than one database on a server using one connection without having to re-issue a select_db command, especially in a code container requiring connection to multiple databases. Fair point, but I would say that in the majority of cases an app pretty much connects to one database. I personally have exceptions to that rule, so I fully appreciate that this is not always the case and some people may see more of this type of setup than others, but I think it probably holds for the majority. In this case it doesn't provide any extra flexibility - that's why I asked :) I guess it's only flexible if you are are dealing with a multi-db system. Even then it's arguably more flexible to keep a primary db selected and use it sans db prefix and use only the other databases in a fully namespaced way. (as this keeps flexibility of changing db easily - without the need for a wrapper. [snip] If I were to implement this and they try some destructive testing/demo on a sacrificial database, I'd have to use a whole other server instance (as all the queries would hardcode in the db name). [/snip] I am unsure of what you're after here. We are only using a hard-coded example but we can certainly improve this by using a class or function. True, but arguably unnecessary overhead - especially in the one db app common case. Not necessarily significant, but it all adds up. [snip] Is it not more flexible if you omit the table name in every single query and specify it once in your bootstrap/connection code? Thus doing tests on other dbs etc. is a pretty simple switch of the connection code. [/snip] Sure it is, unless you have to connect to more than one database in any given code container. Consider this, I include a database server connection (one file) and I do not have to do a select_db in other subsequent files if I include the database name in the SQL query itself; include(inc/dataConnect.inc); // containing server connection only Now in foo.php would you rather; $theDatabaseSelected = select_db('database', $dbc); $theQuery = SELECT foo FROM bar WHERE glorp; Or; $theQuery = SELECT a.foo FROM database.bar a WHERE glorp; Now consider that I have to get information from more than one database (on the same server) in a single container for display. Do you want to issue the select_db each time? $theDatabaseSelected = select_db('database', $dbc); $theQuery = SELECT foo FROM bar WHERE glorp; $theNextDatabaseSelected = select_db('nextDatabase', $dbc); $theQuery = SELECT glorp FROM foo WHERE bar; Or would it be easier to do this? $theQuery = SELECT a.foo FROM database.bar a WHERE glorp; $theNextQuery = SELECT a.glorp FROM database.foo a WHERE bar; Aside from the incorrect db name :p, it is arguable easier :) I'm not ultimately suggesting that this isn't a useful technique at times (I do do this myself in some apps), but I still reckon that for the majority of applications, it's makes more sense to work with a known database at all times for your connection and avoid the whole db name whenever possible. [snip] Also telling the db engine what database you want to use in every query is not, IMO, leaving the selection in the the database's hands. [/snip] Sure it is, if not you have to use PHP (select_db) to perform the database selection which sends an additional query ('use database') to the database system. In other words, would you query all of the raw data out of the database and use PHP to process that data when the database can do a much more effective job of filtering out what you do not need? Well that analogy is lost on me... I really don't see what the comparison of a select db statement vs a db delimited table in queries has to do with reading raw data out and processing it in PHP But regardless (and this is more of a nitpicking semantic thing than anything PHP/db related now!), if I let the db do the work then I set it up with certain information and then give it limited information repeatedly and let it work things out. By setting it up with a select db and letting it figure out which schema I want my data from by not telling it in multiple individual queries, I'm very much letting the db do the work. If I tell it explicitly at all times what database to use then I'm doing the work that could have been offloaded to the database. And if your query system goes via a wrapper to put in the right db schema names (e.g. from a config file) as you suggested, then the work you are doing on each query is very much real work done in PHP (str_replace, regexp matching/replacing, concatenation or whatever). So perhaps it depends on your view point and preconceptions and we're both coming at the flexible and
[PHP] Re: Re: Re: Design Patterns
Hi Ralph. If u want to understand the Martin's job u need to read about design patterns. A good place to start? Wikipedia ( http://en.wikipedia.org/wiki/Design_Patterns). The use of Design patterns is an advanced programming method. It helps us to improve our object oriented programation. I hope this helps you, Jaime
RE: [PHP] Re: Is select_db necessary?
[snip] So perhaps it depends on your view point and preconceptions and we're both coming at the flexible and offloading arguments with different starting views. Anyway, I only asked out of curiosity which I think has been satisfied (i.e. ultimately I don't fully agree with you! :p). [/snip] No worries! We are discussing semantics and situations which are always unique. Our primary application is one that uses data from many disparate and discrete data sources, integrating these things to make life simpler for the end user. The methodology that I describe is quite useful in that situation. We do have other applications that use a single database and where we explicitly state the database using select_db; the database name never has to appear in the query at all. I occasionally hear a little whining and moaning about this as the queries become less self-documenting, forcing everyone to add more commentary to the code to make up for the deficiency. Actually I have found that during code review in these 'single database' applications many of the queries do have the database name stated. The devs have seen the value in this method across the board. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where is interbase.dll?
Hi, I downloaded PHP 5.3.0, and since then I can't use fbird_connect. When I inspected the installed files, I realized that php_interbase.dll is not there! Where is it? Or where can I get it? SanTa
[PHP] where does CURLOPT_QUOTE output go?
just for example's sake, say i were doing something like $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'ftp://user:p...@server/dir/filename'); curl_setopt($ch, CURLOPT_UPLOAD, true); curl_setopt($ch, CURLOPT_FILE, $outfileh); curl_setopt($ch, CURLOPT_INFILE, $infileh); curl_setopt($ch, CURLOPT_STDERR, $stderrh); curl_setopt($ch, CURLOPT_POSTQUOTE, array(STAT,FEAT)); to upload a file via ftp. (assume my file handles are all set up correctly.) where do the replies from the FTP server to the STAT and FEAT commands end up? not in $outfile, i've confirmed. the only thing i've come up with is to set verbose and parse stderr. ick! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] literal strings vs variable strings
Hi all. Is this going to save me anything? ?php # literal foreach($items as $item) if( 'something' == $item-something() ) return true; ?php # variable $something = 'something'; foreach($items as $item) if( $something == $item-something() ) return true; -- Martin Scotta
[PHP] Re: Re: Re: Design Patterns
Thanks Jaime, very nice, but I'm a programmer since 1982 and into OOP since 1988 with the outcome if IBM's C++ compiler on the OS2 platform. Don't u think it could be reasonable to ask if such an overhead IN PHP is necessary? does anybody agree that PHP might be the wrong language to accomplish such a designpattern. Specialy if I find classes about interpreting things. Don't u think to blow up a servers memonry just to have a nice little framework could be ask? Don't u think it makes sence to remember that PHP is just to output a simple text file? Has inbedween all the OOP ability everybody forgotten that this is the simple purpose? Are there anybody who understands that PHP is an INTERPRETING language and has anybody an idear what is the amount of code running to do a simple $something = new object(); versus echo $something Design pattern are very good, standarizing even better. but would u agree that, out of Martins presented work, u can not see the how AND how fast the code is created to output the header the head and body and all other tags. What I can see, the result will be a lot of code, lots of includes for a view bytes. For me, wrong language with unneccesary overhead. as i can see there must be some more folks out there thinking a bit similar, or why is the feetback so relatively poor. and at least u create design pattern for a PURPOSE. so again for what pupose are this overhead in PHP As long as nobody tells me for what benefit this work is done I would say the design pattern should be done in other packages ready made for that with an PHP output. this would not affect any server resources. now after more then 25 years behind the keyboard I got possibly a bit thumb. lets open the discussion. ralph_def...@yahoo.de Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message news:62f65ec80908130320t70078242y65308d2ef0288...@mail.gmail.com... Hi Ralph. If u want to understand the Martin's job u need to read about design patterns. A good place to start? Wikipedia ( http://en.wikipedia.org/wiki/Design_Patterns). The use of Design patterns is an advanced programming method. It helps us to improve our object oriented programation. I hope this helps you, Jaime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: literal strings vs variable strings
I dont think so, because PHP is an interpreter, the string 'something' has to be extracted and then be put in memory after that the code will compare the two memory locations. doesnt give me any benefit. however, comparing strings with the '==' does involve case sensitivity and also leading or trailing spaces will guide to not equal. thats why I prefere the comparison functions anyway Martin Scotta martinsco...@gmail.com wrote in message news:6445d94e0908130702v4c2e5b77xe4b891546cc85...@mail.gmail.com... Hi all. Is this going to save me anything? ?php # literal foreach($items as $item) if( 'something' == $item-something() ) return true; ?php # variable $something = 'something'; foreach($items as $item) if( $something == $item-something() ) return true; -- Martin Scotta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Determining Calling Script Information
Hi, Is there a way (other than using __LINE__ and __FILE__) to determine which file line called a function/method? I would like to add some debugging information to a method but I don't want to have to go through to each line that calls it and add the __LINE__ and __FILE__ parameters. Guess I'm looking for a simple solution. Anyway, if there is a way just point me in the right direction and I'll take it from there. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determining Calling Script Information
On Thu, Aug 13, 2009 at 10:48 AM, Matt Giddingsmcgid...@svsu.edu wrote: Hi, Is there a way (other than using __LINE__ and __FILE__) to determine which file line called a function/method? I would like to add some debugging information to a method but I don't want to have to go through to each line that calls it and add the __LINE__ and __FILE__ parameters. Guess I'm looking for a simple solution. Anyway, if there is a way just point me in the right direction and I'll take it from there. Thanks, Matt You can use debug_backtrace() inside the function. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determining Calling Script Information
Matt Giddings wrote: Hi, Is there a way (other than using __LINE__ and __FILE__) to determine which file line called a function/method? I would like to add some debugging information to a method but I don't want to have to go through to each line that calls it and add the __LINE__ and __FILE__ parameters. Guess I'm looking for a simple solution. Anyway, if there is a way just point me in the right direction and I'll take it from there. See the help for debug_backtrace() Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
On Thu, Aug 13, 2009 at 8:09 AM, Ralph Deffke ralph_def...@yahoo.de wrote: Thanks Jaime, very nice, but I'm a programmer since 1982 and into OOP since 1988 with the outcome if IBM's C++ compiler on the OS2 platform. Don't u think it could be reasonable to ask if such an overhead IN PHP is necessary? does anybody agree that PHP might be the wrong language to accomplish such a designpattern. Specialy if I find classes about interpreting things. Don't u think to blow up a servers memonry just to have a nice little framework could be ask? Don't u think it makes sence to remember that PHP is just to output a simple text file? Has inbedween all the OOP ability everybody forgotten that this is the simple purpose? Are there anybody who understands that PHP is an INTERPRETING language and has anybody an idear what is the amount of code running to do a simple $something = new object(); versus echo $something Design pattern are very good, standarizing even better. but would u agree that, out of Martins presented work, u can not see the how AND how fast the code is created to output the header the head and body and all other tags. What I can see, the result will be a lot of code, lots of includes for a view bytes. For me, wrong language with unneccesary overhead. as i can see there must be some more folks out there thinking a bit similar, or why is the feetback so relatively poor. and at least u create design pattern for a PURPOSE. so again for what pupose are this overhead in PHP As long as nobody tells me for what benefit this work is done I would say the design pattern should be done in other packages ready made for that with an PHP output. this would not affect any server resources. now after more then 25 years behind the keyboard I got possibly a bit thumb. lets open the discussion. since the 1980's, another advent has come about, called cheap memory, and fast cpu's. so the answer is no, nobody cares about how many cycles it takes to instantiate a new class in php. for those who do, they can go off and code apps based on sets of global functions or straight proceedural code, as php supports them all. if you're writing an app in todays world of fast cheap hardware, where you're concerned about the number of cycles it takes to instantiate an object being too high; i suppose you should be considering something like C++ for said app. also, it stands to reason that since nobody cares about the object creation overhead, that the very next thing the community will do after getting classes in their language is reach out to design patterns. just as GoF and you did back in the day, w/ the advent of objc/C++ coming out after having lived through years of C. -nathan
Re: [PHP] Determining Calling Script Information
Thanks for the pointers! Matt Robert Cummings wrote: Matt Giddings wrote: Hi, Is there a way (other than using __LINE__ and __FILE__) to determine which file line called a function/method? I would like to add some debugging information to a method but I don't want to have to go through to each line that calls it and add the __LINE__ and __FILE__ parameters. Guess I'm looking for a simple solution. Anyway, if there is a way just point me in the right direction and I'll take it from there. See the help for debug_backtrace() Cheers, Rob. -- Matt Giddings Web Programmer Information Technology Services Saginaw Valley State University Phone: 989.964.7247 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
Hi Ralph, Sorry, I haven't understand your question. Do you think OOP isn't usefull for PHP? The PHP task is just to output a text file but the process might involve a lot of work: database access, communication with web services, etc. Do you think duplicate code is better than use more memory? What is your proposal? I'm very interested in more opinions. 2009/8/13 Ralph Deffke ralph_def...@yahoo.de Thanks Jaime, very nice, but I'm a programmer since 1982 and into OOP since 1988 with the outcome if IBM's C++ compiler on the OS2 platform. Don't u think it could be reasonable to ask if such an overhead IN PHP is necessary? does anybody agree that PHP might be the wrong language to accomplish such a designpattern. Specialy if I find classes about interpreting things. Don't u think to blow up a servers memonry just to have a nice little framework could be ask? Don't u think it makes sence to remember that PHP is just to output a simple text file? Has inbedween all the OOP ability everybody forgotten that this is the simple purpose? Are there anybody who understands that PHP is an INTERPRETING language and has anybody an idear what is the amount of code running to do a simple $something = new object(); versus echo $something Design pattern are very good, standarizing even better. but would u agree that, out of Martins presented work, u can not see the how AND how fast the code is created to output the header the head and body and all other tags. What I can see, the result will be a lot of code, lots of includes for a view bytes. For me, wrong language with unneccesary overhead. as i can see there must be some more folks out there thinking a bit similar, or why is the feetback so relatively poor. and at least u create design pattern for a PURPOSE. so again for what pupose are this overhead in PHP As long as nobody tells me for what benefit this work is done I would say the design pattern should be done in other packages ready made for that with an PHP output. this would not affect any server resources. now after more then 25 years behind the keyboard I got possibly a bit thumb. lets open the discussion. ralph_def...@yahoo.de Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message news:62f65ec80908130320t70078242y65308d2ef0288...@mail.gmail.com... Hi Ralph. If u want to understand the Martin's job u need to read about design patterns. A good place to start? Wikipedia ( http://en.wikipedia.org/wiki/Design_Patterns). The use of Design patterns is an advanced programming method. It helps us to improve our object oriented programation. I hope this helps you, Jaime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jaime J. Perera Merino Aplicaciones Informáticas. Desarrollo y Formación jaimejper...@gmail.com - 655460979
Re: [PHP] Re: Re: Re: Design Patterns
funny then that I see here serious people discussing the benefit of shortening code and cutting out commends. maby thats a general problem of our society that everybody think higher cheaper faster. this will have a limit guys !!! u can not go smaler then an atom. funny as well that I make my main money in optimizing code to speed and low server resources. Im one of the old guys who can do both hardware and software and I'm telling u this is suspect to me. I still can build a computer from board and powersupply upward. looks like that u joung guys got a little dream implementet by ur profs. Did u know that the industry is complaining that the engeneers coming from the universities are useless for business? a big complain! the real world is different. Hosting companies will always try to keep a server machine as long as they can, because a paid server DOES MAKE MONEY. so where is then the cheap and fast server. how many servers out there still running on PHP4? have u thouhgt about? again, design pattern make sence, but on a companies policy base or on a medium upwards sized project. but there will be more languages be involved in one company it would be much better to use a language independent tool. again this is chasing mice with an elephant ralph_def...@yahoo.de Nathan Nobbe quickshif...@gmail.com wrote in message news:7dd2dc0b0908130809p456de5e7g35641de69af14...@mail.gmail.com... On Thu, Aug 13, 2009 at 8:09 AM, Ralph Deffke ralph_def...@yahoo.de wrote: Thanks Jaime, very nice, but I'm a programmer since 1982 and into OOP since 1988 with the outcome if IBM's C++ compiler on the OS2 platform. Don't u think it could be reasonable to ask if such an overhead IN PHP is necessary? does anybody agree that PHP might be the wrong language to accomplish such a designpattern. Specialy if I find classes about interpreting things. Don't u think to blow up a servers memonry just to have a nice little framework could be ask? Don't u think it makes sence to remember that PHP is just to output a simple text file? Has inbedween all the OOP ability everybody forgotten that this is the simple purpose? Are there anybody who understands that PHP is an INTERPRETING language and has anybody an idear what is the amount of code running to do a simple $something = new object(); versus echo $something Design pattern are very good, standarizing even better. but would u agree that, out of Martins presented work, u can not see the how AND how fast the code is created to output the header the head and body and all other tags. What I can see, the result will be a lot of code, lots of includes for a view bytes. For me, wrong language with unneccesary overhead. as i can see there must be some more folks out there thinking a bit similar, or why is the feetback so relatively poor. and at least u create design pattern for a PURPOSE. so again for what pupose are this overhead in PHP As long as nobody tells me for what benefit this work is done I would say the design pattern should be done in other packages ready made for that with an PHP output. this would not affect any server resources. now after more then 25 years behind the keyboard I got possibly a bit thumb. lets open the discussion. since the 1980's, another advent has come about, called cheap memory, and fast cpu's. so the answer is no, nobody cares about how many cycles it takes to instantiate a new class in php. for those who do, they can go off and code apps based on sets of global functions or straight proceedural code, as php supports them all. if you're writing an app in todays world of fast cheap hardware, where you're concerned about the number of cycles it takes to instantiate an object being too high; i suppose you should be considering something like C++ for said app. also, it stands to reason that since nobody cares about the object creation overhead, that the very next thing the community will do after getting classes in their language is reach out to design patterns. just as GoF and you did back in the day, w/ the advent of objc/C++ coming out after having lived through years of C. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
I use a combination of procedural and OOP for my scripts. Mainly because I have a lot of old code I wrote before I understood OOP. Now that I do it makes my life so much easier because of the organizational and reusability benefits. In today's world I will gladly trade a little overhead for fasting coding. At work we have a quad processor IBM server with 4GB of RAM - no speed problems there. At home I use a 1.25GHz Mac Mini and no speed problems there either. Take care, Floyd On Aug 13, 2009, at 11:17 AM, Jaime Jose Perera Merino wrote: Hi Ralph, Sorry, I haven't understand your question. Do you think OOP isn't usefull for PHP? The PHP task is just to output a text file but the process might involve a lot of work: database access, communication with web services, etc. Do you think duplicate code is better than use more memory? What is your proposal? I'm very interested in more opinions. 2009/8/13 Ralph Deffke ralph_def...@yahoo.de Thanks Jaime, very nice, but I'm a programmer since 1982 and into OOP since 1988 with the outcome if IBM's C++ compiler on the OS2 platform. Don't u think it could be reasonable to ask if such an overhead IN PHP is necessary? does anybody agree that PHP might be the wrong language to accomplish such a designpattern. Specialy if I find classes about interpreting things. Don't u think to blow up a servers memonry just to have a nice little framework could be ask? Don't u think it makes sence to remember that PHP is just to output a simple text file? Has inbedween all the OOP ability everybody forgotten that this is the simple purpose? Are there anybody who understands that PHP is an INTERPRETING language and has anybody an idear what is the amount of code running to do a simple $something = new object(); versus echo $something Design pattern are very good, standarizing even better. but would u agree that, out of Martins presented work, u can not see the how AND how fast the code is created to output the header the head and body and all other tags. What I can see, the result will be a lot of code, lots of includes for a view bytes. For me, wrong language with unneccesary overhead. as i can see there must be some more folks out there thinking a bit similar, or why is the feetback so relatively poor. and at least u create design pattern for a PURPOSE. so again for what pupose are this overhead in PHP As long as nobody tells me for what benefit this work is done I would say the design pattern should be done in other packages ready made for that with an PHP output. this would not affect any server resources. now after more then 25 years behind the keyboard I got possibly a bit thumb. lets open the discussion. ralph_def...@yahoo.de Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message news:62f65ec80908130320t70078242y65308d2ef0288...@mail.gmail.com... Hi Ralph. If u want to understand the Martin's job u need to read about design patterns. A good place to start? Wikipedia ( http://en.wikipedia.org/wiki/Design_Patterns). The use of Design patterns is an advanced programming method. It helps us to improve our object oriented programation. I hope this helps you, Jaime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jaime J. Perera Merino Aplicaciones Informáticas. Desarrollo y Formación jaimejper...@gmail.com - 655460979 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
NO NO NO OOP is the best ever inventet ! see my comments on this list, I will also come up with an pure oop opensource OMS very soon. I just think a dam big pattern catalog like this one is like an elephant chacing mice. I mean I can think of customers asking for a documentation of course of the page u created for them calling the next day asking wher the hell are the code for the page are documented in the 1000 pages of documentation u had to give them. I can think of two of my largest customers with their intranet application with 23000 members and more then 5 hits during working hours where I startet sweating while figting for every 1ms. I'm thinking of people with even more hits a day, they even dont start using PHP so I dont know if thats the right way to blow up with includes and thousands of classes. Im complaining on the deepnes and breakdown of the single pattern I miss the orientation on the real problem - outputting marup text cheers ralph_def...@yahoo.de Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message news:62f65ec80908130817x3edc8ffav4153b7c1a44a2...@mail.gmail.com... Hi Ralph, Sorry, I haven't understand your question. Do you think OOP isn't usefull for PHP? The PHP task is just to output a text file but the process might involve a lot of work: database access, communication with web services, etc. Do you think duplicate code is better than use more memory? What is your proposal? I'm very interested in more opinions. 2009/8/13 Ralph Deffke ralph_def...@yahoo.de Thanks Jaime, very nice, but I'm a programmer since 1982 and into OOP since 1988 with the outcome if IBM's C++ compiler on the OS2 platform. Don't u think it could be reasonable to ask if such an overhead IN PHP is necessary? does anybody agree that PHP might be the wrong language to accomplish such a designpattern. Specialy if I find classes about interpreting things. Don't u think to blow up a servers memonry just to have a nice little framework could be ask? Don't u think it makes sence to remember that PHP is just to output a simple text file? Has inbedween all the OOP ability everybody forgotten that this is the simple purpose? Are there anybody who understands that PHP is an INTERPRETING language and has anybody an idear what is the amount of code running to do a simple $something = new object(); versus echo $something Design pattern are very good, standarizing even better. but would u agree that, out of Martins presented work, u can not see the how AND how fast the code is created to output the header the head and body and all other tags. What I can see, the result will be a lot of code, lots of includes for a view bytes. For me, wrong language with unneccesary overhead. as i can see there must be some more folks out there thinking a bit similar, or why is the feetback so relatively poor. and at least u create design pattern for a PURPOSE. so again for what pupose are this overhead in PHP As long as nobody tells me for what benefit this work is done I would say the design pattern should be done in other packages ready made for that with an PHP output. this would not affect any server resources. now after more then 25 years behind the keyboard I got possibly a bit thumb. lets open the discussion. ralph_def...@yahoo.de Jaime Jose Perera Merino jaimejper...@gmail.com wrote in message news:62f65ec80908130320t70078242y65308d2ef0288...@mail.gmail.com... Hi Ralph. If u want to understand the Martin's job u need to read about design patterns. A good place to start? Wikipedia ( http://en.wikipedia.org/wiki/Design_Patterns). The use of Design patterns is an advanced programming method. It helps us to improve our object oriented programation. I hope this helps you, Jaime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jaime J. Perera Merino Aplicaciones Informáticas. Desarrollo y Formación jaimejper...@gmail.com - 655460979 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where is interbase.dll?
Sándor Tamás (HostWare Kft.) wrote: Hi, I downloaded PHP 5.3.0, and since then I can't use fbird_connect. When I inspected the installed files, I realized that php_interbase.dll is not there! Where is it? Or where can I get it? http://tech.groups.yahoo.com/group/firebird-php/files/ The discussion on the problem with this in windows is also on the php-firebird list. Bottom line - for a number of useful php extensions - is to stick with PHP5.2.x for the time being. The change of rules for PHP5.3 has blocked a number of extensions from being built since they require VC6 or VC9 versions of everything. -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
Ralph Deffke napsal(a): NO NO NO OOP is the best ever inventet ! see my comments on this list, I will also come up with an pure oop opensource OMS very soon. I just think a dam big pattern catalog like this one is like an elephant chacing mice. I mean I can think of customers asking for a documentation of course of the page u created for them calling the next day asking wher the hell are the code for the page are documented in the 1000 pages of documentation u had to give them. I can think of two of my largest customers with their intranet application with 23000 members and more then 5 hits during working hours where I startet sweating while figting for every 1ms. I'm thinking of people with even more hits a day, they even dont start using PHP so I dont know if thats the right way to blow up with includes and thousands of classes. I deeply and completely agree. Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
Ralph Deffke wrote: funny then that I see here serious people discussing the benefit of shortening code and cutting out commends. maby thats a general problem of our society that everybody think higher cheaper faster. this will have a limit guys !!! u can not go smaler then an atom. funny as well that I make my main money in optimizing code to speed and low server resources. Im one of the old guys who can do both hardware and software and I'm telling u this is suspect to me. I still can build a computer from board and powersupply upward. looks like that u joung guys got a little dream implementet by ur profs. Did u know that the industry is complaining that the engeneers coming from the universities are useless for business? a big complain! the real world is different. Hosting companies will always try to keep a server machine as long as they can, because a paid server DOES MAKE MONEY. so where is then the cheap and fast server. how many servers out there still running on PHP4? have u thouhgt about? again, design pattern make sence, but on a companies policy base or on a medium upwards sized project. but there will be more languages be involved in one company it would be much better to use a language independent tool. again this is chasing mice with an elephant Except for incompetent algorithms, it is almost always cheaper to throw money at a new server than to have a coder micro optimize his/her code. Similarly, it is usually cheaper to throw more hardware at a well programmed solution that uses modern programming concepts than to have a programmer use the most rudimentary of programming techniques to save on cycles. With respect to why you see shortening of code and cutting out comments, perhaps you are referring to the recent Calendar thread, where a bunch of us were just having some good old optimization fun. I for one enjoy the occasional diversion of optimizing some code just for the sake of optimizing it. Sometimes even, the optimization is even the cleanest/most readable solution. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
Martin Zvarík wrote: Ralph Deffke napsal(a): NO NO NO OOP is the best ever inventet ! see my comments on this list, I will also come up with an pure oop opensource OMS very soon. I just think a dam big pattern catalog like this one is like an elephant chacing mice. I mean I can think of customers asking for a documentation of course of the page u created for them calling the next day asking wher the hell are the code for the page are documented in the 1000 pages of documentation u had to give them. I can think of two of my largest customers with their intranet application with 23000 members and more then 5 hits during working hours where I startet sweating while figting for every 1ms. I'm thinking of people with even more hits a day, they even dont start using PHP so I dont know if thats the right way to blow up with includes and thousands of classes. I deeply and completely agree. Yes, certainly optimize on an as-needed basis. But well written PHP code should certainly scale quite well horizontally. Extremely traffic laden websites are quite likely to see a bottleneck at the database before a bottleneck in the code. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
Robert Cummings wrote: Martin Zvarík wrote: Ralph Deffke napsal(a): NO NO NO OOP is the best ever inventet ! see my comments on this list, I will also come up with an pure oop opensource OMS very soon. I just think a dam big pattern catalog like this one is like an elephant chacing mice. I mean I can think of customers asking for a documentation of course of the page u created for them calling the next day asking wher the hell are the code for the page are documented in the 1000 pages of documentation u had to give them. I can think of two of my largest customers with their intranet application with 23000 members and more then 5 hits during working hours where I startet sweating while figting for every 1ms. I'm thinking of people with even more hits a day, they even dont start using PHP so I dont know if thats the right way to blow up with includes and thousands of classes. I deeply and completely agree. Yes, certainly optimize on an as-needed basis. But well written PHP code should certainly scale quite well horizontally. Extremely traffic laden websites are quite likely to see a bottleneck at the database before a bottleneck in the code. Hi, You all should understand that on high traffic sites, C or C++ is far more frequently used and called PHP because they use a whole lot of custom extensions to speed things up. In addition, memcached speeds up database access so much that the speed of PHP starts to matter. This is why PHP 5.3.0 is somewhere around 30% faster than any previous PHP version when running common applications, because the core developers realized that the base efficiency begins to matter and spent considerable effort improving basic language performance. There are a lot of ways to improve PHP's efficiency, and arguing over whether to use design patterns is not a particularly effective one. Profiling early and often to understand the slowest portions of your code is an effective method. There are many, many talks/videos/etc. that can be found via google.com which discuss these principles, but suffice to say that xdebug, APC, and most importantly siege and apache benchmark are your friends in this endeavor. For Ralph: it might help you to know that facebook.com improved their performance by splitting up things into lots and lots of classes, and using autoload. I don't have specific details because I don't work there, but the programmer who coded this solution was telling me the generalities at php|tek 2 years ago. The pages that saw improvement were ones with a large number of possible execution branches in different requests. autoload simply reduced the number of needed files to the bare minimum from a wide variety of choices. This surprised me, because the prevailing opinion at the time was that autoload always reduces performance. The point to take from this story is that what you think to be true doesn't matter, the only thing is really understanding where your bottlenecks are by profiling aggressively, and even more important, why its slow, so you can fix it. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
but what Im asking is that the reality? go and talk to accountant and tell them after spending soansomuch for the new site hes has to buy a new server ! what will acountant say, what u think. another more important point is in reality u take a project on on a specific hardware base. lets say it a pretty new server fast a mercedes 500 but not a ferrari V1. because of ur great reusable code u do an extra ordinary competitive price bacause u are ready made that fast, u put it on the server and ? womm because of thausand of includes and stuff the customer is not happy with the speed. what u think who is going to pay the new hardware? or better who is going to cut down the code. well its me, because as senior consultant i'm taking over the projects from young programmers who went out of business because the postulations of the closed contract put them bankrupt. THATS THE REALITY so guys tell me on a design pattern frame work what requirements the server should fullfill that I can astimate if the customers situation will not put me out of business? Robert Cummings rob...@interjinn.com wrote in message news:4a84400a.9090...@interjinn.com... Ralph Deffke wrote: funny then that I see here serious people discussing the benefit of shortening code and cutting out commends. maby thats a general problem of our society that everybody think higher cheaper faster. this will have a limit guys !!! u can not go smaler then an atom. funny as well that I make my main money in optimizing code to speed and low server resources. Im one of the old guys who can do both hardware and software and I'm telling u this is suspect to me. I still can build a computer from board and powersupply upward. looks like that u joung guys got a little dream implementet by ur profs. Did u know that the industry is complaining that the engeneers coming from the universities are useless for business? a big complain! the real world is different. Hosting companies will always try to keep a server machine as long as they can, because a paid server DOES MAKE MONEY. so where is then the cheap and fast server. how many servers out there still running on PHP4? have u thouhgt about? again, design pattern make sence, but on a companies policy base or on a medium upwards sized project. but there will be more languages be involved in one company it would be much better to use a language independent tool. again this is chasing mice with an elephant Except for incompetent algorithms, it is almost always cheaper to throw money at a new server than to have a coder micro optimize his/her code. Similarly, it is usually cheaper to throw more hardware at a well programmed solution that uses modern programming concepts than to have a programmer use the most rudimentary of programming techniques to save on cycles. With respect to why you see shortening of code and cutting out comments, perhaps you are referring to the recent Calendar thread, where a bunch of us were just having some good old optimization fun. I for one enjoy the occasional diversion of optimizing some code just for the sake of optimizing it. Sometimes even, the optimization is even the cleanest/most readable solution. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
Greg I completly aggree, but dont miss the point that I'M adigted to OOP WHY NOT A FRAMEWORK CLOSER TO THE REAL POINT CALLED DOM design pattern for HTML XHTML XML SVG Database conection and retrieving. WHY CLASSES FOR CALLERS AND RECEIVERS AND INTERPRETERS. a div is it a caller? a receiver? why there a only dom classes? why not forgetting about the tag shit and a bunch of classes for it? well wait I will come up with it if I find ever the time and stop learning from this list. I also believe that u can force a good design patter by supplying a some good very well design base classes. I mean talk to an JAVA freak, I dont think they will come up with that type of framework. as we just talking about that when can we expect PHP to extend unlimited classes in one class. for the newbies following the bullheaded experts fight: something like this class wow extents database, users, accessright implements HTML { } WHEN Greg Beaver g...@chiaraquartet.net wrote in message news:4a84460d.3080...@chiaraquartet.net... Robert Cummings wrote: Martin Zvarík wrote: Ralph Deffke napsal(a): NO NO NO OOP is the best ever inventet ! see my comments on this list, I will also come up with an pure oop opensource OMS very soon. I just think a dam big pattern catalog like this one is like an elephant chacing mice. I mean I can think of customers asking for a documentation of course of the page u created for them calling the next day asking wher the hell are the code for the page are documented in the 1000 pages of documentation u had to give them. I can think of two of my largest customers with their intranet application with 23000 members and more then 5 hits during working hours where I startet sweating while figting for every 1ms. I'm thinking of people with even more hits a day, they even dont start using PHP so I dont know if thats the right way to blow up with includes and thousands of classes. I deeply and completely agree. Yes, certainly optimize on an as-needed basis. But well written PHP code should certainly scale quite well horizontally. Extremely traffic laden websites are quite likely to see a bottleneck at the database before a bottleneck in the code. Hi, You all should understand that on high traffic sites, C or C++ is far more frequently used and called PHP because they use a whole lot of custom extensions to speed things up. In addition, memcached speeds up database access so much that the speed of PHP starts to matter. This is why PHP 5.3.0 is somewhere around 30% faster than any previous PHP version when running common applications, because the core developers realized that the base efficiency begins to matter and spent considerable effort improving basic language performance. There are a lot of ways to improve PHP's efficiency, and arguing over whether to use design patterns is not a particularly effective one. Profiling early and often to understand the slowest portions of your code is an effective method. There are many, many talks/videos/etc. that can be found via google.com which discuss these principles, but suffice to say that xdebug, APC, and most importantly siege and apache benchmark are your friends in this endeavor. For Ralph: it might help you to know that facebook.com improved their performance by splitting up things into lots and lots of classes, and using autoload. I don't have specific details because I don't work there, but the programmer who coded this solution was telling me the generalities at php|tek 2 years ago. The pages that saw improvement were ones with a large number of possible execution branches in different requests. autoload simply reduced the number of needed files to the bare minimum from a wide variety of choices. This surprised me, because the prevailing opinion at the time was that autoload always reduces performance. The point to take from this story is that what you think to be true doesn't matter, the only thing is really understanding where your bottlenecks are by profiling aggressively, and even more important, why its slow, so you can fix it. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Re: Re: Design Patterns
[snip] u can not go smaler then an atom. [/snip] Neutrons, electrons, gluons, protons particles all smaller than an atom. There are others if you want to get into a discussion of quantum physics and mechanics, but we should probably take that discussion offline. Many folks here are building enterprise capable applications with PHP, its OOP capabilities and the afore mentioned design patterns. This level of application, especially when combined with other technologies (like the bits that make up AJAX), are much better served by using design patterns so that consistency, readability and code-ability are enhanced. You're correct in that the end result is just a text file...but look at the format of that file output! When those files are handled by the proper container, such as a web browser or relational database system they become powerful tools and information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
Ralph Deffke wrote: but what Im asking is that the reality? go and talk to accountant and tell them after spending soansomuch for the new site hes has to buy a new server ! what will acountant say, what u think. another more important point is in reality u take a project on on a specific hardware base. lets say it a pretty new server fast a mercedes 500 but not a ferrari V1. because of ur great reusable code u do an extra ordinary competitive price bacause u are ready made that fast, u put it on the server and ? womm because of thausand of includes and stuff the customer is not happy with the speed. what u think who is going to pay the new hardware? or better who is going to cut down the code. well its me, because as senior consultant i'm taking over the projects from young programmers who went out of business because the postulations of the closed contract put them bankrupt. THATS THE REALITY so guys tell me on a design pattern frame work what requirements the server should fullfill that I can astimate if the customers situation will not put me out of business? You could do well to read up on accelerators then since they will save you a large portion of the inclusion/compilation overhead. As a senior consultant you should know that. Everything you've mentioned so far is YOUR reality... possibly shared by others, but so far I'm not seeing too many coming in with the same problem. As a matter of my own discipline, I tend towards shallow class hierarchies and lazy loading of libraries. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
At 12:32 PM -0400 8/13/09, Robert Cummings wrote: With respect to why you see shortening of code and cutting out comments, perhaps you are referring to the recent Calendar thread, where a bunch of us were just having some good old optimization fun. I for one enjoy the occasional diversion of optimizing some code just for the sake of optimizing it. Sometimes even, the optimization is even the cleanest/most readable solution. Cheers, Rob. I agree with Rob. I would even venture to say that optimization, such as in our calendar exercise, has nothing to do with the speed of the code but rather the cleanest/most readable solution. One can certainly say This one runs faster but what does that matter when we are dealing with a one time operation that takes milliseconds, or less, to run? The real savings here is seen in maintainability. How well can the next programmer (who might be you) figure out what the code is doing? The time I spend reviewing code is billable. You want to save money, then hire programmers who write clean and easy to understand code. Cryptic crap does not mean that you're a clever programmer, it only shows that you don't know any better. 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
AW: [PHP] Re: Re: Re: Design Patterns
for those of u not being a physician semiconductors are of pretty big atoms, but this is not the main problem, the problem is that u have to cut out structures off these semiconductors in order to build faster computers this matters. many physicians believe that we are pretty close to a ultimate limit if we dont procees with the *biological* chips we facing a limit soon. the other point is the cost, faster chips wount be any cheaper in the future due to very expencive production processes. So we should start thinking in optimization realy. at least some bewareness it will not be endless ralph_def...@yahoo.de Von: Jay Blanchard jblanch...@pocket.com An: Ralph Deffke ralph_def...@yahoo.de; php-general@lists.php.net Gesendet: Donnerstag, den 13. August 2009, 20:15:31 Uhr Betreff: RE: [PHP] Re: Re: Re: Design Patterns [snip] u can not go smaler then an atom. [/snip] Neutrons, electrons, gluons, protons particles all smaller than an atom. There are others if you want to get into a discussion of quantum physics and mechanics, but we should probably take that discussion offline. Many folks here are building enterprise capable applications with PHP, its OOP capabilities and the afore mentioned design patterns.. This level of application, especially when combined with other technologies (like the bits that make up AJAX), are much better served by using design patterns so that consistency, readability and code-ability are enhanced. You're correct in that the end result is just a text file...but look at the format of that file output! When those files are handled by the proper container, such as a web browser or relational database system they become powerful tools and information.
Re: [PHP] Re: Re: Re: Design Patterns
On Thu, Aug 13, 2009 at 1:00 PM, Ralph Deffke ralph_def...@yahoo.de wrote: for those of u not being a physician semiconductors are of pretty big atoms, but this is not the main problem, the problem is that u have to cut out structures off these semiconductors in order to build faster computers this matters. many physicians believe that we are pretty close to a ultimate limit if we dont procees with the *biological* chips we facing a limit soon. the other point is the cost, faster chips wount be any cheaper in the future due to very expencive production processes. So we should start thinking in optimization realy. at least some bewareness it will not be endless ralph_def...@yahoo.de i for one have decided to start off my next server platform for the web, entirely in assembly ;) -nathan
[PHP] design pattern
so guys why u don't discuss Martins outcome? is there no advice, idears? isn't there a need for it? nobody want to use it? I WANT TO LEARN ralph_def...@yahoo.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] design pattern
Ralph Deffke wrote: so guys why u don't discuss Martins outcome? is there no advice, idears? isn't there a need for it? nobody want to use it? I WANT TO LEARN Maybe it's your grasp of the English language, maybe not. But I detect an air of aggression to your posts. ARE YOU JUST TROLLING? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Re: Re: Re: Design Patterns
Ralph Deffke wrote: for those of u not being a physician semiconductors are of pretty big atoms, but this is not the main problem, the problem is that u have to cut out structures off these semiconductors in order to build faster computers this matters. many physicians believe that we are pretty close to a ultimate limit if we dont procees with the *biological* chips we facing a limit soon. the other point is the cost, faster chips wount be any cheaper in the future due to very expencive production processes. So we should start thinking in optimization realy. at least some bewareness it will not be endless ralph_def...@yahoo.de My physician had best never mention cutting structures off my semiconductor. -- 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] design pattern
On Thu, Aug 13, 2009 at 4:04 PM, Ralph Deffke ralph_def...@yahoo.de wrote: so guys why u don't discuss Martins outcome? is there no advice, idears? isn't there a need for it? nobody want to use it? I WANT TO LEARN ralph_def...@yahoo.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I was following the entirely conversation, I must admit I wasn't expecting such thread. It is not common to see design patterns applied to PHP applications and, is more common to don't see PHP applications. They are just scripts. Many scripts in a simple folder puts together to do the dirty work. Of course there are many kicking-ass PHP Applications, but they are a minimum portion compared to old-fashioned scripts. So, how do we start writing good quality PHP Applications? That's a very good question, and I don't know the answer, but I think by talking about design patterns we are in a good way. It's true that using design patterns the code will run slower, but it'll be flexible, maintable, and the most important: simple. After all that's what we are looking for, something really simple that make our life as developers happier every day. How do you explain the crescent number of php frameworks for rapid development? PHP core team has taken OOP seriously. Do you note the new SPL objects? The core team creates those objects using many designs patterns. By example the RecursiveDirectoryIterator and it's family use the decorator pattern. Also features such as late static binding were added because a design pattern. I think there will be some separation in the community, those who will stay using scripts and those who will use heavily OOP. I do not know who the dark side will be, xD -- Martin Scotta
Re: [PHP] design pattern
well u got to know me personal, however may be u mix it with sarcasm? may be I can't express that as good as I want in english. if u follow the posts didn't some put me in the stupid corner? I think its legal to ask why the question of Martin are not discussed. and I still think, my question what he want to accomplish still is legal and reasonable. Many posts said, code done with design pattern framework are easy to maintain and understand. I ask u; is Martins work easy to understand? he put a lot of effort, but with even design pattern it comes to the point of a good presentation. not all people are the top smartest. as u may have realised, he changed the presentation already and is coming up with a more overview like documentation. he is realy working hard, and I can't wait to see what benefit I could have from his work what size of project it is worth for. he deserves that design pattern experts comment his work. ralph_def...@yahoo.de Robert Cummings rob...@interjinn.com wrote in message news:4a846ea7.5010...@interjinn.com... Ralph Deffke wrote: so guys why u don't discuss Martins outcome? is there no advice, idears? isn't there a need for it? nobody want to use it? I WANT TO LEARN Maybe it's your grasp of the English language, maybe not. But I detect an air of aggression to your posts. ARE YOU JUST TROLLING? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] design pattern
Hi Martin, thanks for ur efforts, this is a lot of good work. for my opinion the start is a bit too much theoretical and valid for all type of application. In simple words, u are too close to the book. I would love to have something closer to the purpose of PHP and its applications. if u have a look at the SMARTY documentation u have good explanation (and a bad example by the way concerned oop) what are the real world problem. When it comes to the final u find the most spagetti code in putting the page grafic designer toghether with the business logic. It would be great if this could be put in good oop patterns. As I can not see that with the little amount of time I have got, p l e a s e tell me what will come up on this edge? ralph_def...@yahoo.de Martin Scotta martinsco...@gmail.com wrote in message news:6445d94e0908131322w722a37bbi24983ae143c5d...@mail.gmail.com... On Thu, Aug 13, 2009 at 4:04 PM, Ralph Deffke ralph_def...@yahoo.de wrote: so guys why u don't discuss Martins outcome? is there no advice, idears? isn't there a need for it? nobody want to use it? I WANT TO LEARN ralph_def...@yahoo.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I was following the entirely conversation, I must admit I wasn't expecting such thread. It is not common to see design patterns applied to PHP applications and, is more common to don't see PHP applications. They are just scripts. Many scripts in a simple folder puts together to do the dirty work. Of course there are many kicking-ass PHP Applications, but they are a minimum portion compared to old-fashioned scripts. So, how do we start writing good quality PHP Applications? That's a very good question, and I don't know the answer, but I think by talking about design patterns we are in a good way. It's true that using design patterns the code will run slower, but it'll be flexible, maintable, and the most important: simple. After all that's what we are looking for, something really simple that make our life as developers happier every day. How do you explain the crescent number of php frameworks for rapid development? PHP core team has taken OOP seriously. Do you note the new SPL objects? The core team creates those objects using many designs patterns. By example the RecursiveDirectoryIterator and it's family use the decorator pattern. Also features such as late static binding were added because a design pattern. I think there will be some separation in the community, those who will stay using scripts and those who will use heavily OOP. I do not know who the dark side will be, xD -- Martin Scotta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Re: Re: Design Patterns
[snip]. Cryptic crap does not mean that you're a clever programmer, it only shows that you don't know any better. [/snip] I know people like this -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session variables - help
I am asking a similar question to one I asked yesterday (which received no answers) with more information in the hopes someone will be kind enough to guide me. I have an order form populated with an array (as opposed to a database table). The user can enter quantities, and the form posts all the information to the order_process page where the values they entered are listed for review. I decided I wanted to allow them to edit quantities before actually submitting the form (by which I mean before using the mail() function). I found that $_SESSION is the way to go. On the order summary page (order_process.php), I start a session and I get all the POST information via: [code] session_start(); extract($_POST); [/code] Instead of echoing the quantity values of each item, I populate an input field with them within an echo: [code] //when this function is called, $a is a the quantity variable $show_01_qty function writeResultRow($a, $b, $c, $d, $e, $f) { if($a != '') { echo trinput type='text' value=' . $a . ' name=' . $a . ' id=' . $a . ' size='2' //td; . . . } [/code] Now, in order to update a quantity, the user replaces the quantity in the input field with the new number, and clicks a submit button which posts to order_update.php. I have the following code for order_update.php: [code] session_start(); extract($_POST); foreach ($_POST as $var = $val) { if ($val 0) { $_SESSION[$var] = $val; } else { unset($var); } header(Location: order_process.php); } [/code] This is not working, however, and it just loads order_process.php with no values for the varaibles, as if I just refreshed the page with no sessions. Help please!
Re: [PHP] session variables - help
I have the following code for order_update.php: [code] session_start(); extract($_POST); foreach ($_POST as $var = $val) { if ($val 0) { $_SESSION[$var] = $val; } else { unset($var); } header(Location: order_process.php); } [/code] This is not working, however, and it just loads order_process.php with no values for the varaibles, as if I just refreshed the page with no sessions. Maybe you left it out but I didn't see any place where you used $_SESSION in order_process.php. Also, your redirect in order_update.php appears to be inside your foreach loop, which would definitely mess things right up -- but maybe that was just a typo in your email? Otherwise the logic in order_update.php looks OK, but there are a few side notes that jumped out: 1. I'm not seeing why you used extract($_POST) in order_update.php. Right after the extract() call, you iterate through $_POST with a foreach loop, so what's the purpose of calling extract()? Is there more code that you left out? 2. Calling extract($_POST) is dangerous. The PHP manual warns against it, although without giving much of an explanation: http://us2.php.net/manual/en/function.extract.php Apart from making it difficult to filter the input you're expecting to see, extract($_POST) also allows a malicious end-user to define any variable of his choosing and to overwrite any variables that you may have defined in the script before the extract() call. I like to use filter_input() to read the values of POST variables. By much the same token, you'll want to escape $a, etc., in your writeResultRow() function, with something like htmlentities(). 3. Why the unset($var) in order_update.php? $var already gets reset each time foreach iterates. So, calling unset() on it at the end of the loop doesn't really do much. I'm wondering what you were aiming at there. Thanks, Ben
[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
Re: [PHP] session variables - help
Ben, First of all, I thank you for your time and help. My ai with using unset($var) in update_order.php is to set the SESSION variable for an item to ' ' (empty) so that it would not show up on the order summary (because my writeResultRow() function will only write a row if that variable is greater than 0). I just can't figure out what I'm missing here. Before I received your response, I made a few changes to my code, which helped streamline the calculating parts (grabbing values from SESSION instead of POST, and now when I update order_summary, the values will remain because it pulls them from the SESSION). I want to edit the values in the SESSION, so that when update_order.php redirects to order_process.php, the values are changed, and if applicable, an item is removed from the html table (if the quantity is less than 1). Here is some more complete code: [code = order_process.php] ?php session_start(); // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION foreach($_POST as $k=$v) { $_SESSION[$k]=$v; } $thisPage=AFY; //NAVIGATION PURPOSES include(afyshows.php); //CONTAINS ARRAYS FOR SHOW ENTITIES; POPULATES ORDER FORM ? . . . /pform name=update action=update_order.php method=post !-- HIDDEN FORM VALUES FOR SESSION PURPOSES -- input type=hidden name=School id=School value=?php $_SESSION['School']; ? / input type=hidden name=Grade id=Grade value=?php $_SESSION['Grade']; ? / input type=hidden name=Address id=Address value=?php $_SESSION['Address']; ? / input type=hidden name=City id=City value=?php $_SESSION['City']; ? / input type=hidden name=State id=State value=?php $_SESSION['State']; ? / input type=hidden name=Zip id=Zip size=9 value=?php $_SESSION['Zip']; ? / input type=hidden name=Contact id=Contact value=?php $_SESSION['Contact']; ? / input type=hidden name=Phone id=Phone value=?php $_SESSION['Phone']; ? / input type=hidden name=Fax id=Fax value=?php $_SESSION['Fax']; ? / input type=hidden name=Email id=Email value=?php $_SESSION['Email']; ? / . . . ?php function findTotalCost($b, $c) { $total = $b * $c; return $total; } function writeResultRow($a, $b, $c, $d, $e, $f) { if($a != '') { echo \ntr\n\t; echo td'.$b./tdtd.$c./tdtd.$d./td; echo td.$e./tdtdnbsp;/tdtdinput type='text' value='.$a.' name='.$a.' id='.$a.' size='2' //tdtd=/tdtd\$.$f./td; echo /tr; } } //SETS $Total_show_01 to PRICE * QUANTITY //FORMATS TOTAL //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES $Total_show_01 = findTotalCost($shows['show_01']['price'], $_SESSION['show_01_qty']); $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', ''); writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'], $shows['show_01']['date'], $shows['show_01']['time'], $shows['show_01']['price'],$Total_show_01_fmtd); //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38) ? . . . input name=updates id=updates type=submit value=Update/ [/code] Now, here is the update_order.php code in entirety: [code] ?php session_start(); foreach ($_SESSION as $var = $val) { if ($val == 0) { unset($_SESSION[$var]); } elseif ($val == '') { unset($_SESSION[$var]); } else { $val = $_SESSION[$var]; } } header(Location: order_process.php); //NOTICE I FIXED THE LOCATION OF THE header() FUNCTION //BUT IT STILL DOES NOT UPDATE ? [/code] If you're still with me, I thank you. I removed all the styling elements from the html to make it easier for you (and me) to see what it says. I have invested many hours into this, and have generated many many lines of code, but I hope what I gave you is sufficient, while not being overwhelming at this hour. Thank you very much for your help thus far, anything else would be greatly appreciated. On Thu, Aug 13, 2009 at 5:56 PM, Ben Dunlap bdun...@agentintellect.comwrote: I have the following code for order_update.php: [code] session_start(); extract($_POST); foreach ($_POST as $var = $val) { if ($val 0) { $_SESSION[$var] = $val; } else { unset($var); } header(Location: order_process.php); } [/code] This is not working, however, and it just loads order_process.php with no values for the varaibles, as if I just refreshed the page with no sessions. Maybe you left it out but I didn't see any place where you used $_SESSION in order_process.php. Also, your redirect in order_update.php appears to be inside your foreach loop, which would definitely mess things right up -- but maybe that was just a typo in your email? Otherwise the logic in order_update.php looks OK, but there are a few side notes that jumped out: 1. I'm not seeing why you used extract($_POST) in order_update.php. Right after the extract() call, you iterate through $_POST with a foreach loop, so what's the purpose of calling extract()? Is there more code that you left out? 2. Calling extract($_POST) is dangerous. The PHP manual warns against it, although without giving much of an explanation: