php-general Digest 3 Mar 2013 13:26:15 -0000 Issue 8146
php-general Digest 3 Mar 2013 13:26:15 - Issue 8146 Topics (messages 320367 through 320369): Re: Introduction ... ! 320367 by: Tedd Sperling 320368 by: Tedd Sperling static Logging class? 320369 by: Lars Nielsen Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Mar 2, 2013, at 11:26 AM, Stuart Dallas stu...@3ft9.com wrote: On 2 Mar 2013, at 16:25, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: No - Tedd is old. The rest of us are just Spring chickens. Speak for yourself, I'm an autumn turkey! -Stuart What's this autumn nonsense? tedd _ t...@sperling.com http://sperling.com---End Message--- ---BeginMessage--- On Mar 2, 2013, at 2:20 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: See, you can't really call yourself old until that's pooping and cramping... That reminds me -- a couple of my older friends and I were discussing getting old. One friend said At 8:00 am I have a terrible time taking a poop. My other friend said -- At 8:00 am my problem is taking a piss. I replied -- At 8:00 am I crap like a goose and piss like a race hoarse. Both friends said: That doesn't sound bad -- what's the problem? I told them Yeah, but I wake up at 9:00 am. Cheers, tedd _ t...@sperling.com http://sperling.com ---End Message--- ---BeginMessage--- Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen ---End Message---
php-general Digest 4 Mar 2013 02:40:11 -0000 Issue 8147
php-general Digest 4 Mar 2013 02:40:11 - Issue 8147 Topics (messages 320370 through 320375): Re: static Logging class? 320370 by: shiplu 320371 by: Ravi Gehlot 320372 by: Larry Garfield 320373 by: Lars Nielsen 320375 by: Ravi Gehlot Re: Holding datetimes in a DB. 320374 by: Richard Quadling Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- You can use singleton pattern for this. Use one instance for whole application. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader ---End Message--- ---BeginMessage--- Hello Lars, I would apply the Singleton Pattern where you would have 1 instance for you entire application. As far as whether or not to use a static method, I would weigh the options. If you just want to call a method that you know will not have to be changed in the future and that method will not be using any pre-defined properties, then it makes sense to call a static method. Bear in mind that static methods can not be overridden. Best of luck, - [image: logo] *Ravi Gehlot * Mobile: 407-283-5282 Orlando, FL 32765-8085 http://www.RaviGehlot.Net/ https://github.com/ravigehlot *First, solve the problem. Then, write the code.* [image: Twitter] http://www.twitter.com/ravigehlot [image: LinkedIn]http://www.linkedin.com/in/ravigehlot [image: Amazon]https://www.amazon.com/gp/pdp/profile/A35NGY72YZSFR7?ie=UTF8ref_=ya_56 [image: Meetup] http://www.meetup.com/members/12029903/ [image: pinterest]http://pinterest.com/ravigehlot/ [image: reddit] http://www.reddit.com/user/ravigehlot/ Contact me: [image: Google Talk] ravigehlot [image: Skype] ravigehlot [image: Y! Messenger] ravigehlot On Sun, Mar 3, 2013 at 8:26 AM, Lars Nielsen l...@lfweb.dk wrote: Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Make a real classed object that you pass to various objects that need it. Otherwise you make your life way harder for unit testing. Don't have a class that self-enforces that it's a singleton. That way lies pain. In particular, I recommend using or writing a class based on the PSR-3 recommendation: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md There's even stock code for the interface and some useful base classes available: https://packagist.org/packages/psr/log And for added fun, there are already publicly available open source libraries that implement PSR-3 that you can just drop in and use, such as: https://packagist.org/packages/monolog/monolog (If that's too heavy for you, writing your own PSR-3 compatible logger is dead-simple.) I'm sure you're about to say zOMG this is just a hobby project, I don't need something that fancy and all injected and shit! If it's a simple project, use a simple container to do all the hard work for you: https://packagist.org/packages/pimple/pimple (That's 100 lines of executable code. Quite powerful, dead simple to use.) Cheers. --Larry Garfield, FIG member On 03/03/2013 07:26 AM, Lars Nielsen wrote: Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen ---End Message--- ---BeginMessage--- Thanks a lot Larry! This PSR-3 looks just the way to do such things! :-) I hope i chat with you at DrupalCon Praha! http://www.linkedin.com/profile/view?id=18644639 Best regards Lars Nielsen Make a real classed object that you pass to various objects that need it. Otherwise you make your life way harder for unit testing. Don't have a class that self-enforces that it's a singleton. That way lies pain. In particular, I recommend using or writing a class based on the PSR-3 recommendation: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md There's even stock code for the interface and some useful base classes available:
[PHP] static Logging class?
Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] static Logging class?
Hello Lars, I would apply the Singleton Pattern where you would have 1 instance for you entire application. As far as whether or not to use a static method, I would weigh the options. If you just want to call a method that you know will not have to be changed in the future and that method will not be using any pre-defined properties, then it makes sense to call a static method. Bear in mind that static methods can not be overridden. Best of luck, - [image: logo] *Ravi Gehlot * Mobile: 407-283-5282 Orlando, FL 32765-8085 http://www.RaviGehlot.Net/ https://github.com/ravigehlot *First, solve the problem. Then, write the code.* [image: Twitter] http://www.twitter.com/ravigehlot [image: LinkedIn]http://www.linkedin.com/in/ravigehlot [image: Amazon]https://www.amazon.com/gp/pdp/profile/A35NGY72YZSFR7?ie=UTF8ref_=ya_56 [image: Meetup] http://www.meetup.com/members/12029903/ [image: pinterest]http://pinterest.com/ravigehlot/ [image: reddit] http://www.reddit.com/user/ravigehlot/ Contact me: [image: Google Talk] ravigehlot [image: Skype] ravigehlot [image: Y! Messenger] ravigehlot On Sun, Mar 3, 2013 at 8:26 AM, Lars Nielsen l...@lfweb.dk wrote: Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] static Logging class?
Make a real classed object that you pass to various objects that need it. Otherwise you make your life way harder for unit testing. Don't have a class that self-enforces that it's a singleton. That way lies pain. In particular, I recommend using or writing a class based on the PSR-3 recommendation: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md There's even stock code for the interface and some useful base classes available: https://packagist.org/packages/psr/log And for added fun, there are already publicly available open source libraries that implement PSR-3 that you can just drop in and use, such as: https://packagist.org/packages/monolog/monolog (If that's too heavy for you, writing your own PSR-3 compatible logger is dead-simple.) I'm sure you're about to say zOMG this is just a hobby project, I don't need something that fancy and all injected and shit! If it's a simple project, use a simple container to do all the hard work for you: https://packagist.org/packages/pimple/pimple (That's 100 lines of executable code. Quite powerful, dead simple to use.) Cheers. --Larry Garfield, FIG member On 03/03/2013 07:26 AM, Lars Nielsen wrote: Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] static Logging class?
Thanks a lot Larry! This PSR-3 looks just the way to do such things! :-) I hope i chat with you at DrupalCon Praha! http://www.linkedin.com/profile/view?id=18644639 Best regards Lars Nielsen Make a real classed object that you pass to various objects that need it. Otherwise you make your life way harder for unit testing. Don't have a class that self-enforces that it's a singleton. That way lies pain. In particular, I recommend using or writing a class based on the PSR-3 recommendation: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md There's even stock code for the interface and some useful base classes available: https://packagist.org/packages/psr/log And for added fun, there are already publicly available open source libraries that implement PSR-3 that you can just drop in and use, such as: https://packagist.org/packages/monolog/monolog (If that's too heavy for you, writing your own PSR-3 compatible logger is dead-simple.) I'm sure you're about to say zOMG this is just a hobby project, I don't need something that fancy and all injected and shit! If it's a simple project, use a simple container to do all the hard work for you: https://packagist.org/packages/pimple/pimple (That's 100 lines of executable code. Quite powerful, dead simple to use.) Cheers. --Larry Garfield, FIG member On 03/03/2013 07:26 AM, Lars Nielsen wrote: Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Holding datetimes in a DB.
On 1 March 2013 10:49, Richard Quadling rquadl...@gmail.com wrote: Hi. My heads trying to remember something I may or may not have known to start with. If I hold datetimes in a DB in UTC and can represent a date to a user based upon a user preference Timezone (not an offset, but a real timezone : Europe/Berlin, etc.) am I missing anything? Richard. Thank you to everyone who pitched in. My initial assumptions seem to hold. Richard. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] static Logging class?
Hello Larry, Thanks for sharing! - [image: logo] *Ravi Gehlot * Mobile: 407-283-5282 Orlando, FL 32765-8085 http://www.RaviGehlot.Net/ https://github.com/ravigehlot *First, solve the problem. Then, write the code.* [image: Twitter] http://www.twitter.com/ravigehlot [image: LinkedIn]http://www.linkedin.com/in/ravigehlot [image: Amazon]https://www.amazon.com/gp/pdp/profile/A35NGY72YZSFR7?ie=UTF8ref_=ya_56 [image: Meetup] http://www.meetup.com/members/12029903/ [image: pinterest]http://pinterest.com/ravigehlot/ [image: reddit] http://www.reddit.com/user/ravigehlot/ Contact me: [image: Google Talk] ravigehlot [image: Skype] ravigehlot [image: Y! Messenger] ravigehlot On Sun, Mar 3, 2013 at 1:48 PM, Larry Garfield la...@garfieldtech.comwrote: Make a real classed object that you pass to various objects that need it. Otherwise you make your life way harder for unit testing. Don't have a class that self-enforces that it's a singleton. That way lies pain. In particular, I recommend using or writing a class based on the PSR-3 recommendation: https://github.com/php-fig/**fig-standards/blob/master/** accepted/PSR-3-logger-**interface.mdhttps://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md There's even stock code for the interface and some useful base classes available: https://packagist.org/**packages/psr/loghttps://packagist.org/packages/psr/log And for added fun, there are already publicly available open source libraries that implement PSR-3 that you can just drop in and use, such as: https://packagist.org/**packages/monolog/monologhttps://packagist.org/packages/monolog/monolog (If that's too heavy for you, writing your own PSR-3 compatible logger is dead-simple.) I'm sure you're about to say zOMG this is just a hobby project, I don't need something that fancy and all injected and shit! If it's a simple project, use a simple container to do all the hard work for you: https://packagist.org/**packages/pimple/pimplehttps://packagist.org/packages/pimple/pimple (That's 100 lines of executable code. Quite powerful, dead simple to use.) Cheers. --Larry Garfield, FIG member On 03/03/2013 07:26 AM, Lars Nielsen wrote: Hi, I work on a little hobby-project, and i want to make a oo logging facility. (php5.3 oop) Is it best to make a class with static functions that i can call from my other classes? Or is it more appropriate to make a real logging-class i should instantiate every time i need to log something? (I just want to log to a file) Best regards Lars Nielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Introduction ... !
Hello Nick, Welcome to the list. I joined the list awhile back then unsubscribed for no apparent reason. This list was very active years ago. I came back about a few months ago just as a watcher. I didn't really post or participate at all. I guess, there are a lot of watchers only people here. They receive digest e-mails; they just don't participate in any way. Then, there are those who lost their jobs due to the recession and so they dropped off the list as well. There are a lot of developers unemployed. I would imagine that other developers didn't keep up with the changes. PHP has come a long way as far as Object Oriented Programming is concerned. There have been many discussions about Design Patterns and extending existing classes. So a lot has changed in the last 5 years. I do believe that the list will pick up again. Welcome back, Ravi. On Fri, Mar 1, 2013 at 10:57 AM, Nick Whiting prg...@gmail.com wrote: Hello PHP'ers! Just thought I would introduce myself to the mailing list since I've worked with PHP for almost 10 years now and yet haven't really been community active ... I've developed quite a few open-source projects over the years that I hope someone here will find as useful as I have ... they are all hosted on Github @prggmr. XPSPL - Signal Processor in PHP docpx - PHP Documentation Generator for Sphinx Again Hello Everyone! Cheers! -- Nickolas Whiting - prggmr.org - Remember to write less code that does more faster -
[PHP] Open form in new window
I have many different submit button. input value=Update type=submit input name=DPRmode value=Enter Data type=submit When php processes value=Enter Data, I would like to open a new window, but only if I click this one. Possible? I knw ther is an HTML target= thingy. Can PHP do anything magic? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Open form in new window
On 4-3-2013 6:44, John Taylor-Johnston wrote: I have many different submit button. input value=Update type=submit input name=DPRmode value=Enter Data type=submit When php processes value=Enter Data, I would like to open a new window, but only if I click this one. Possible? I knw ther is an HTML target= thingy. Can PHP do anything magic? No, it can't. PHP is a *serverside* language, while opening a new window is fully *clientside*. You could, after recieving the form submission, send back a redirect which opens in a new window; but far easier would be to use javascript which would open a new window on submission instead. PHP is definitly the wrong choice for things like opening browser windows. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php