RE: [PHP] switch case madness
LOL, so true -Original Message- From: Adam Richardson [mailto:simples...@gmail.com] Sent: Wednesday, January 19, 2011 12:28 PM To: PHP-General Subject: Re: [PHP] switch case madness On Wed, Jan 19, 2011 at 12:44 PM, Micky Hulse wrote: > On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn wrote: > > On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote: > >> [snip] > >> ... > >> [/snip] > >> Imagine when there'll be the day when you do not have to code at > >> all...just copy 'n paste snippets together in the order that you wish > >> them to work in and Voila'! - instant web app. > >> Th!! > > They have that. It's called Ruby on Rails. > > CodeIgniter and/or Django (Python) are fun. > > What about a middle of the road solution? > > Google for "php micro framework" and/or "python micro framework". > > I have yet to use a micro framework myself, but I am looking forward > to playing around with one for one of my next PHP projects... I would > love to find one that has a decent "micro" templating system. :D > > M > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Here are some interesting frameworks you might want to check out: Lithium Fat-free Limonade Nephtali (my framework) fits within one file (except the config file). I'll send you a note off-list highlighting Nephtali's features. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
On Wed, Jan 19, 2011 at 12:44 PM, Micky Hulse wrote: > On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn wrote: > > On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote: > >> [snip] > >> ... > >> [/snip] > >> Imagine when there'll be the day when you do not have to code at > >> all...just copy 'n paste snippets together in the order that you wish > >> them to work in and Voila'! - instant web app. > >> Th!! > > They have that. It's called Ruby on Rails. > > CodeIgniter and/or Django (Python) are fun. > > What about a middle of the road solution? > > Google for "php micro framework" and/or "python micro framework". > > I have yet to use a micro framework myself, but I am looking forward > to playing around with one for one of my next PHP projects... I would > love to find one that has a decent "micro" templating system. :D > > M > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Here are some interesting frameworks you might want to check out: Lithium Fat-free Limonade Nephtali (my framework) fits within one file (except the config file). I'll send you a note off-list highlighting Nephtali's features. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
Re: [PHP] switch case madness
On Jan 19, 2011, at 12:44 PM, Micky Hulse wrote: > On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn wrote: >> They have that. It's called Ruby on Rails. > > CodeIgniter and/or Django (Python) are fun. > > What about a middle of the road solution? > > Google for "php micro framework" and/or "python micro framework". > > I have yet to use a micro framework myself, but I am looking forward > to playing around with one for one of my next PHP projects... I would > love to find one that has a decent "micro" templating system. :D > > M I love using CodeIgniter. I think it's the best minimalist PHP framework out there, and thankfully it doesn't pretend to be Rails. I've been told to look at Lithium but haven't gotten around to it yet. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] switch case madness
On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn wrote: > On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote: >> [snip] >> ... >> [/snip] >> Imagine when there'll be the day when you do not have to code at >> all...just copy 'n paste snippets together in the order that you wish >> them to work in and Voila'! - instant web app. >> Th!! > They have that. It's called Ruby on Rails. CodeIgniter and/or Django (Python) are fun. What about a middle of the road solution? Google for "php micro framework" and/or "python micro framework". I have yet to use a micro framework myself, but I am looking forward to playing around with one for one of my next PHP projects... I would love to find one that has a decent "micro" templating system. :D M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
. >> >> I do see from where it is you're coming, though, Josh --- once >> you've gotten the fundamentals, a lot of times it's easier - sometimes >> even a better idea - to use an existing, mature solution. What helps >> you to determine its value from a code standpoint? Your existing >> experience. >> >> -- >> >> Network Infrastructure Manager >> Documentation, Webmaster Teams >> http://www.php.net/ > > You are correct, and it is a shame to see many developers fall into the copy > / paste realm, especially with a language like PHP where such snippets are > often found easily but of dubious quality. Rolling your own is a great way to > understand how things work (or should work) internally, as well as giving you > valuable practice. I don't mean to discredit is. As I mentioned, more often > then not I'm a fan of it. > > Regards, > > -Josh > > Joshua Kehn | josh.k...@gmail.com > http://joshuakehn.com > > I find that at first, in any language, playing with the snippets through a form of stimuli and response(I move this, this happens, or doesn;t), helps to reinforce what I'm learning. But after understanding the snippet, I don't find that reapplying it later subverts the concept of being a 'real coder', because in the end you want to move to a more efficient means of coding, which is, if I'm not mistaken, where these larger frameworks come from-snippets that are reusable(all the way down to a login system snippet). -- It sure does get lonely up under this bridge. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
> On Tue, Jan 18, 2011 at 23:39, Joshua Kehn wrote: >The use of existing packages is so increasingly prevalent that I > have the unfortunate displeasure of knowing many "developers" who do > nothing but this, yet who can't even answer simple questions about > general coding, and who cry and complain that a "previous developer" > must have borked something. I think Donovan is right on track here > --- he's just getting started, and challenging himself to learn the > language at a deeper level. That will make him a developer, not just > a copy-and-paster. > >I do see from where it is you're coming, though, Josh --- once > you've gotten the fundamentals, a lot of times it's easier - sometimes > even a better idea - to use an existing, mature solution. What helps > you to determine its value from a code standpoint? Your existing > experience. > > -- > > Network Infrastructure Manager > Documentation, Webmaster Teams > http://www.php.net/ You are correct, and it is a shame to see many developers fall into the copy / paste realm, especially with a language like PHP where such snippets are often found easily but of dubious quality. Rolling your own is a great way to understand how things work (or should work) internally, as well as giving you valuable practice. I don't mean to discredit is. As I mentioned, more often then not I'm a fan of it. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] switch case madness
On Tue, Jan 18, 2011 at 23:39, Joshua Kehn wrote: > > Why not use one of the countless, not to mention secure and stable cookie > management systems available? If it's an exercise cool, I misunderstood. > > I'm not one to normally shun people rolling their own code, lord knows I've > done it more then once or twice, but there are some things I wouldn't touch > with a ten foot pool, and cookie management is one of them. The other would > be things like CSV parsers or text manipulations. The use of existing packages is so increasingly prevalent that I have the unfortunate displeasure of knowing many "developers" who do nothing but this, yet who can't even answer simple questions about general coding, and who cry and complain that a "previous developer" must have borked something. I think Donovan is right on track here --- he's just getting started, and challenging himself to learn the language at a deeper level. That will make him a developer, not just a copy-and-paster. I do see from where it is you're coming, though, Josh --- once you've gotten the fundamentals, a lot of times it's easier - sometimes even a better idea - to use an existing, mature solution. What helps you to determine its value from a code standpoint? Your existing experience. -- Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
> Imagine when there'll be the day when you do not have to code at > all...just copy 'n paste snippets together in the order that you wish > them to work in and Voila'! - instant web app. I have a Wordpress plugin that will do all of that for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote: > [snip] > ... > [/snip] > > Imagine when there'll be the day when you do not have to code at > all...just copy 'n paste snippets together in the order that you wish > them to work in and Voila'! - instant web app. > > > Th!! > They have that. It's called Ruby on Rails. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
RE: [PHP] switch case madness
[snip] ... [/snip] Imagine when there'll be the day when you do not have to code at all...just copy 'n paste snippets together in the order that you wish them to work in and Voila'! - instant web app. Th!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
On Jan 18, 2011, at 11:53 PM, Donovan Brooke wrote: > The idea of using existing resources for efficiency is very valid indeed.. > especially with a job at hand. But, there are good reasons to > roll-your-own... education and knowing your own code are 2 that are important > to me right now. Besides, a cookie based log-in system is really not that > complex. ;-) > > Now.. payment gateway API? AJAX requests? I'll take the snippets please. > > Cheers, > Donovan (moving on to database administration) Payment gateways suck. AJAX requests are easy if you roll JavaScript well and have a decent inspector (Firebug). I agree, a simple login is not that complex. I thought it was a bit more involved then that. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] switch case madness
On Tue, Jan 18, 2011 at 10:53:19PM -0600, Donovan Brooke wrote: > >Why not use one of the countless, not to mention secure and stable cookie > management systems available? If it's an exercise cool, I misunderstood. > > > >I'm not one to normally shun people rolling their own code, lord knows > I've done it more then once or twice, but there are some things I wouldn't > touch with a ten foot pool, and cookie management is one of them. The > other would be things like CSV parsers or text manipulations. > > > >Regards, > > > >-Josh > > > The idea of using existing resources for efficiency is very valid > indeed.. especially with a job at hand. But, there are good reasons to > roll-your-own... education and knowing your own code are 2 that are > important to me right now. Besides, a cookie based log-in system is > really not that complex. ;-) I have to agree here. Login systems aren't that hard to do. And finding a "library" or "toolkit" which does exactly what you want exactly the way you want may not be so easy. For example, I don't use MySQL unless I absolutely have to. But there aren't that many such systems based on PostgreSQL. I could take their MySQl code and hack it. But while analyzing their code, you find you could have done this yourself in half a day, less if you've done it before. I'm just thick enough to believe that most programming problems are relatively easily solved from scratch. And it's an interesting challenge to do so. Particularly when the result is something which can be reused in later projects. Yes, of course, I wouldn't touch payment gateways and the like. Paul -- Paul M. Foster http://noferblatz.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
Why not use one of the countless, not to mention secure and stable cookie management systems available? If it's an exercise cool, I misunderstood. I'm not one to normally shun people rolling their own code, lord knows I've done it more then once or twice, but there are some things I wouldn't touch with a ten foot pool, and cookie management is one of them. The other would be things like CSV parsers or text manipulations. Regards, -Josh The idea of using existing resources for efficiency is very valid indeed.. especially with a job at hand. But, there are good reasons to roll-your-own... education and knowing your own code are 2 that are important to me right now. Besides, a cookie based log-in system is really not that complex. ;-) Now.. payment gateway API? AJAX requests? I'll take the snippets please. Cheers, Donovan (moving on to database administration) -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
On Jan 18, 2011, at 11:33 PM, Donovan Brooke wrote: >>> -- >>> D Brooke >> >> I just died a bit on the inside. >> >> Why would you build that from scratch? >> >> Regards, >> >> -Josh > > > Alright, I'll bite (since I affected you that much) ;-), > > do tell... > > Why not? Would you rather I use PHP's session_start()? > > > Donovan > Why not use one of the countless, not to mention secure and stable cookie management systems available? If it's an exercise cool, I misunderstood. I'm not one to normally shun people rolling their own code, lord knows I've done it more then once or twice, but there are some things I wouldn't touch with a ten foot pool, and cookie management is one of them. The other would be things like CSV parsers or text manipulations. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] switch case madness
-- D Brooke I just died a bit on the inside. Why would you build that from scratch? Regards, -Josh Alright, I'll bite (since I affected you that much) ;-), do tell... Why not? Would you rather I use PHP's session_start()? Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
On Jan 18, 2011, at 11:01 PM, Donovan Brooke wrote: > Thanks. > > I had initialized $t_mssg as an empty string further up the chain out of old > habit.. removed that, and now it works... just built my first > basic cookie-based PHP/MySQL log-in script from scratch! ;-) > > Fun stuff, > Donovan > > > > -- > D Brooke I just died a bit on the inside. Why would you build that from scratch? Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] switch case madness
Thanks. I had initialized $t_mssg as an empty string further up the chain out of old habit.. removed that, and now it works... just built my first basic cookie-based PHP/MySQL log-in script from scratch! ;-) Fun stuff, Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch case madness
$t_mssg = 0 is different from $t_mssg = "0" (in all languages, as far as I know, maybe not in python, but I don't know python) On Tue, Jan 18, 2011 at 10:30 PM, Donovan Brooke wrote: > Hello, > > I must not understand PHP's switch/case.. > The case '0' below fires when $t_mssg = "" apparently. > Is this how it's suppose to work? I would think > it would only fire if it equaled "0". > > -- > print "-$t_mssg- "; > > if (isset($t_mssg)) { > switch ($t_mssg) { >case 0: > echo 'Log In Successful'; > break; > } > } > -- > > TIA, > Donovan > > -- > D Brooke > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Mujtaba
Re: [PHP] switch case madness
On Jan 18, 2011, at 10:30 PM, Donovan Brooke wrote: > Hello, > > I must not understand PHP's switch/case.. > The case '0' below fires when $t_mssg = "" apparently. > Is this how it's suppose to work? I would think > it would only fire if it equaled "0". > > -- > print "-$t_mssg- "; > > if (isset($t_mssg)) { > switch ($t_mssg) { >case 0: > echo 'Log In Successful'; > break; > } > } > -- > > TIA, > Donovan > > -- > D Brooke I use switch cases so rarely I would have to refer you to the documentation. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] switch case madness
Hi, If it is a string "0", you should use: case "0". Because in PHP, 0 == false == null. You need to know the difference between == and ===. Regards, Dong Chen On Wed, Jan 19, 2011 at 2:30 PM, Donovan Brooke wrote: > Hello, > > I must not understand PHP's switch/case.. > The case '0' below fires when $t_mssg = "" apparently. > Is this how it's suppose to work? I would think > it would only fire if it equaled "0". > > -- > print "-$t_mssg- "; > > if (isset($t_mssg)) { > switch ($t_mssg) { >case 0: > echo 'Log In Successful'; > break; > } > } > -- > > TIA, > Donovan > > -- > D Brooke > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, CHEN Dong
[PHP] switch case madness
Hello, I must not understand PHP's switch/case.. The case '0' below fires when $t_mssg = "" apparently. Is this how it's suppose to work? I would think it would only fire if it equaled "0". -- print "-$t_mssg- "; if (isset($t_mssg)) { switch ($t_mssg) { case 0: echo 'Log In Successful'; break; } } -- TIA, Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php