[PHP] observer pattern
Lo, so, I'm wondering - how many of you use the observer pattern in php; and if so, do you implement it 'standalone' or with the spl classes? Is there any particular advantage to doing it your way; whichever your way is? Ken -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a simple sql string in php
On Fri, May 6, 2011 at 10:05 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Hiya, has anyone had any experience with parsing a string of sql to break it down into its component parts? At the moment I'm using several regex's to parse a string, which works, but I'm sure there's a more elegant solution. The general idea is to produce a nice looking page giving details of updated fields and values. I'm only concerned with update statements really, and the queries are very simple, operating on one table at a time, with no sub queries or selects. Thanks in advance if anyone is able to suggest anything! I'd suggest at least taking a look at pear's sql parser package - using it might save you some headaches ;) http://pear.php.net/package/SQL_Parser Thanks Ash -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code formatter
replies inline... On Wed, Feb 2, 2011 at 3:23 PM, Hansen, Mike mike.han...@atmel.com wrote: -Original Message- From: ken.gu...@gmail.com [mailto:ken.gu...@gmail.com] On Behalf Of Ken Guest Sent: Monday, January 31, 2011 3:26 PM To: Hansen, Mike Cc: php-general@lists.php.net Subject: Re: [PHP] Code formatter On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike mike.han...@atmel.com wrote: I've got an application that I'm fixing up and I'd like to run it through a code formatter. Is there something like Perl Tidy for PHP? If so, what are you experiences with it. No prob running it on the command line. It'd be great if it followed the PEAR coding standards. Have you found http://pear.php.net/package/PHP_Beautifier yet? ;) http://www.php.net/unsub.php Ken It mostly works ok. Unfortunately, there's a bug in it that removes blank lines. I found this one that seems to work: http://beta.phpformatter.com/ I'd rather have one I can run on the command line, but this will have to do. Just spotted that bug is reported at http://pear.php.net/package/PHP_Beautifier/bugs - it's a shame it's been logged since 2007 or so with no sign of it getting fixed. :( -- http://blogs.linux.ie/kenguest/
Re: [PHP] Code formatter
On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike mike.han...@atmel.com wrote: I've got an application that I'm fixing up and I'd like to run it through a code formatter. Is there something like Perl Tidy for PHP? If so, what are you experiences with it. No prob running it on the command line. It'd be great if it followed the PEAR coding standards. Have you found http://pear.php.net/package/PHP_Beautifier yet? ;)http://www.php.net/unsub.php Ken -- http://blogs.linux.ie/kenguest/
Re: [PHP] Centralizled Authentication
On Thu, Dec 2, 2010 at 8:06 AM, AmirBehzad Eslami behzad.esl...@gmail.comwrote: Dear list, We have dozen of applications, mostly written in PHP and Python. They're distributed on different servers, but i'm trying to integrate them somehow. Each application has its own users. Is there a way to store all username/passwords into a single datasource and give each user, her proper permissions? Since i'm just a php-programmer, i *thought* of a MySQL database to hold these data, and then use a SOAP-Server to handle the authentication across those applications. Once a user provides her username/password, a SOAP Request will be made to a PHP-Driven Authentication Server, which handles the job to check the permissions and user's identity. It sounds slow, isn't it? Is there a better solution? How do you make authentication across a network of applications? OAuth comes to mind... -- http://blogs.linux.ie/kenguest/
Re: Re[2]: [PHP] Open Source PHP/ mySQL Project Management
With the exception of some work-mandated systems such as fogbugz, I've used mantis successfully for quite a long time. On Fri, Nov 12, 2010 at 1:09 AM, Andre Polykanine an...@oire.org wrote: Hello Jonathan, I tried to use Mantis, however it didn't send e-mails properly so I gave up. -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion - Original message - From: Jonathan Tapicer tapi...@gmail.com To: Don Wieland d...@dwdataconcepts.com Date: Friday, November 12, 2010, 3:00:32 AM Subject: [PHP] Open Source PHP/ mySQL Project Management Hi, I don't know if it meets all of the features you enumerated but Mantis (http://www.mantisbt.org/) is very good, and it is PHP+MySQL (or Postgres, or MSSQL). Jonathan On Thu, Nov 11, 2010 at 7:23 PM, Don Wieland d...@dwdataconcepts.com wrote: Hi gang, I am looking into Project Management apps for my projects. Any suggestions: I am interested in tracking Projects, Milestones, Tickets, Files, Discussions, Documents, Time Tracking, etc... Also, would like to have the system have robust email integration Reminders, Email Ticket echos (where a user can reply it will post back into the PM system and echo back email to assigned users - with file attachments) Suggestions? Thanks! Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://blogs.linux.ie/kenguest/
Re: [PHP] google maps API
Please consider using the OpenLayers API instead ( http://openlayers.org/ and http://openlayers.org/dev/examples/ for examples) as it will also allow end-users to choose a OpenStreetMap layer ( http://www.openstreetmap.org/ ) to be displayed which may render more up-to-date details than are available elsewhere. Ken On Mon, Aug 23, 2010 at 3:37 AM, David Mehler dave.meh...@gmail.com wrote: Hello, Has anyone worked with the google maps API to put a map on their site? If so, please contact me offlist i need to get it going. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://blogs.linux.ie/kenguest/
Re: [PHP] Unit testing in PHP
On Thu, Jun 17, 2010 at 10:51 AM, vikash.i...@gmail.com wrote: Hi, What do you use for unit testing in PHP? phpUnit, SimpleTest or any other? Ages ago, when it was new and shiny I did use SimpleTest. Now I mostly use phpunit - though where necessary (for example if I'm patching a PEAR package that uses them) I use phpt tests ( http://qa.php.net/write-test.php ). If you're starting out on something [new] that doesn't yet have unit tests, I'd suggest phpunit. hth Ken -- http://blogs.linux.ie/kenguest/
[PHP] Irish PHP User Group meeting tonight
Hi. Just to let any of ye know that might be interested, there's a php.ie meeting on tonight in Dublin - in the Longstone pub on Townsend Street starting at eight o'clock. It's located where the red diamond is on this map: http://www.openstreetmap.org/?mlat=53.34595mlon=-6.25559zoom=16layers=B000FTF Ken -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Irish PHP User Group meeting tonight
On Wed, Apr 28, 2010 at 3:38 PM, Daniel Brown danbr...@php.net wrote: On Wed, Apr 28, 2010 at 05:47, Ken Guest k...@linux.ie wrote: Hi. Just to let any of ye know that might be interested, there's a php.ie meeting on tonight in Dublin - in the Longstone pub on Townsend Street starting at eight o'clock. It's located where the red diamond is on this map: http://www.openstreetmap.org/?mlat=53.34595mlon=-6.25559zoom=16layers=B000FTF Ken, Do you want me to add that map link to your event listing on the calendar for today on php.net as well? that would be a handy idea ;-) Thanks! Ken -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Using PEAR Issues
The PEAR Mail package does not fall back from one mechanism to another if the first fails. On Tue, Apr 20, 2010 at 9:16 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-04-20 at 22:17 +0200, Peter Lind wrote: On 20 April 2010 20:17, Alice Wei aj...@alumni.iu.edu wrote: From: peter.e.l...@gmail.com Date: Mon, 19 Apr 2010 10:15:08 +0200 Subject: Re: [PHP] Mail Function Using PEAR Issues To: aj...@alumni.iu.edu CC: php-general@lists.php.net Most, if not all, mail servers keep log files. You should look for the log files to see if the mail server has sent your mail properly or is experiencing problems (those may not feed back into PHP). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype You know where I can find that? I use Evolution Mail, a mail server? I found it through Ubuntu yesterday. Here is the link: http://projects.gnome.org/evolution/ It asks me to put in the type of mail service I used, it grabbed Google, which is smtp.google.com. I still cannot send mail. I start to wonder what is going on. Alice Evolution is a mail client, not a mail server. Apart from that, you're using the 'mail' (PHPs mail function) as the backend mailer in your PEAR script - try using smtp instead and pass the SMTP config data you normally use. Have a look at http://pear.php.net/manual/en/package.mail.mail.factory.php - the smtp part. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype If you've got Pear on Ubuntu, can Pear not default to sendmail if no SMTP connection is set up? Thanks, Ash http://www.ashleysheridan.co.uk -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Using PEAR Issues
you have to install the net_smtp package, simply with this command: $ pear install net_smtp-1.4.2 (which will explicitly install version 1.4.2 of Net_SMTP) If that doesn't work. for whatever reason, you could download the package manually from http://pear.php.net/package/Net_SMTP/download and install it by hand; though for reasons I've outlined in a previous post to this list I'd suggest you use the pear installer. On Thu, Apr 22, 2010 at 12:12 AM, Alice Wei aj...@alumni.iu.edu wrote: Date: Wed, 21 Apr 2010 22:01:03 +0200 Subject: Re: [PHP] Mail Function Using PEAR Issues To: aj...@alumni.iu.edu CC: a...@ashleysheridan.co.uk; php-general@lists.php.net On 21 April 2010 21:58, Alice Wei aj...@alumni.iu.edu wrote: From: peter.e.l...@gmail.com Date: Wed, 21 Apr 2010 21:51:31 +0200 Subject: Re: [PHP] Mail Function Using PEAR Issues To: aj...@alumni.iu.edu CC: a...@ashleysheridan.co.uk; php-general@lists.php.net On 21 April 2010 18:44, Alice Wei aj...@alumni.iu.edu wrote: I have mentioned several posts earlier that I have done nothing about my php.ini file. From what you said, since I use U-Verse, am I supposed to do something as described here: http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf I thought with PEAR, you don't need to do that anymore. Or, am I wrong? Read the PEAR documentation: http://pear.php.net/manual/en/package.mail.mail.factory.php You can use other backends than just 'mail' - try using the smtp and fill in your smtp settings as needed. Regards Peter I saw something like that on http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm, and this is probably what you are talking about? $smtp = Mail::factory('smtp', array ('host' = $host, 'auth' = true, 'username' = $username, 'password' = $password)); Do I still need to install a mail server? I have Evolution Mail on my Linux box, and looks like that is a client and not a server. Or, can I use any of the mail smtp setup, like Google? Or, do use some authentication information from http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf, since I use U-Verse at home? Yes, the example you provide is the right direction - you can put in the smtp details you use to connect from Evolution to GMail, you don't need to setup a separate smtp server on your system. Regards Peter Well, hold it. I have edited my code to hold the information as we have discussed earlier, and this is the error I have now: Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in /usr/share/php/Mail/smtp.php on line 348 Warning: include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/share/php') in /usr/share/php/Mail/smtp.php on line 348 Fatal error: Class 'Net_SMTP' not found in /usr/share/php/Mail/smtp.php on line 349 I am not sure what this means. If I have installed pear correctly, what else do I have to do here? I can see that I have some significant error messages than not getting anything at all. Thanks for your help. Alice _ Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1 -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Using PEAR Issues
On Tue, Apr 20, 2010 at 2:10 AM, David McGlone da...@dmcentral.net wrote: On Mon, 2010-04-19 at 08:25 -0400, Alice Wei wrote: I have not changed any of my SMTP settings since my new installation of PHP with Pear. So, I am not sure what the settings are supposed to be. Would I need to install anything else even when the Pear Mail package has been installed? You might, depending on if you need to use the Mail_Mime or Mail_Queue packages also (for sending emails with attachments etc etc or for sending mails in bulk). Also there's some rather nice new functionality in the more recent versions of Mail and Net_SMTP that enable you to log the ESMTP Id of mails you have submitted to a mail server (along with the SMTP greeting sent by that server when you connect to it). Alice, I never use the PEAR install from my distro, I always download and install PEAR into my working folder. The benefit of doing it this way is so that when you move your project to a different server, nothing will break and you don't have to change anything. Sometimes when I create a new project, I'll just copy the PEAR folder from an older project to the new one. The only thing you may have to change in your PHP code is the path to the PEAR libs only if you don't put them in the same place every time. When some bug is fixed or dependencies of some of those PEAR packages change I think you'll find your attitude towards that will change - there's a pear installer so you don't have to update and track the dependencies by hand - you do regularly update your packages don't you? It's smart to do so because at the very least you don't have to implement work-arounds for bugs that have been fixed in later versions of those packages - and in the worst-case scenario it means you're not using versions that have PEAR Security Advisories issued against them. I believe it's possible to have seperate pear config files per project so you're not limited to having to use the same versions of packages across all projects. If you're using more than a handful of PEAR packages in your project you might want to write your own meta-package for the project; that way you don't have to install all those packages individually; you just do something like $pear install myProject.xml and the pear installer will download and install whichever pear packages you have described in your xml file. Details on doing this are at http://pear.php.net/manual/en/guide.users.dependencytracking.php For the record, this is the example script that I submitted to http://www.web-development-blog.com/archives/php-mail-scripts-using-smtp-transport-a-guide-for-beginners/ for demonstrating how to use the PEAR packages for sending a mail with a file attached.: ?php require_once Mail.php; require_once Mail/mime.php; $from = Fred Flintstone fli...@example.com“; $to = “Barney Rubble barn...@example.net“; $subject = “Mail Subject”; $message = “this is the text of the mail, sent using PEAR’s Mail packages.”; $host = “smtp.example.com”; $port = “25″; $headers = array (‘From’ = $from, ‘To’ = $to, ‘Subject’ = $subject); $smtp = Mail::factory(’smtp’, array (‘host’ = $host, ‘port’ = $port)); $mime = new Mail_mime(); $mime-setTxtBody($message); $mime-addAttachment(“/home/ken/logo.png”, ‘image/png’); $body = $mime-get(); $mail = $smtp-send($to, $mime-headers($headers), $body); if (PEAR::isError($mail)) { echo($mail-getMessage() . “!\n”); } else { echo(“Message successfully sent to $to!\n”); echo “Queued As (ESMTP Id): “, $smtp-queued_as, “\n”; echo “Greeting From Mailserver: “, $smtp-greeting, “\n”; } ? Blessings, David M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array to csv or excel in php
For non-simple data I have been using PEAR's File_CSV package. It's proven itself very useful in regards to not having to determine in my own code whether something needs to be quoted etc etc - especially if the output CSV needs to be wholly RFC 4180 compliant. The documentation of it is rather minimal - at the moment you are dependant on the test/example files and the API docs but grokking how to use it is rather easy. k. On Mon, Apr 19, 2010 at 4:40 PM, Andrew Ballard aball...@gmail.com wrote: On Mon, Apr 19, 2010 at 11:14 AM, Peter Lind peter.e.l...@gmail.com wrote: On 19 April 2010 17:00, Andrew Ballard aball...@gmail.com wrote: On Mon, Apr 19, 2010 at 9:45 AM, Manolis Vlachakis 1. $save=split([|;],$listOfItems); and what i want i s after making some changes to the attributes on the array above to export them on an csv or excel format but directly as a message to the browser .. i dont want it to be saved on the server ... Often when outputting csv, I usually do something like this: ?php $fp = fopen('php://output', 'w') or die('Could not open stream'); foreach ($data as $row) { // Assumes that $row will be an array. // Manipulate the data in $row if necessary. fputcsv($fp, $row); } ? An interesting idea. I'd do: echo implode(',', $row); If it's very simple data that works, but it doesn't allow for the optional enclosure characters that fputcsv() uses in cases where a data element includes the column and/or row delimiter characters. I had originally written something using an array_map callback that did the optional enclosures as needed and then used echo implode() as you suggest, but found the solution I posted was shorter and faster. YMMV Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://blogs.linux.ie/kenguest/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php