php-general Digest 4 Apr 2010 22:26:30 -0000 Issue 6675
php-general Digest 4 Apr 2010 22:26:30 - Issue 6675 Topics (messages 303806 through 303817): Just a test. 303806 by: ttplayer About the php mail function and imap_mail function 303807 by: ttplayer 303808 by: dispy 303812 by: Andre Polykanine Re: PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond 303809 by: SED 303810 by: ralston $_SERVER['PHP_AUTH_USER'] has gone 303811 by: Satz Klauer 303813 by: Nilesh Govindarajan 303814 by: shiplu 303815 by: Nathan Rixham 303816 by: Daniel P. Brown Howto send command over ssh using sockets 303817 by: Radek Krejèa 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--- Hi,everyone. Have a good day. This is just a test if my email address has been added to the mailing list.---End Message--- ---BeginMessage--- Hi, everyone! I have a problem about the php mail function and imap_mail function. When I use the mail or imap_mail function to send a email, the php script sends the email through the local mail sever with sendmail or another MTA supported. However, I have a gmail account. I just want the php script to send emails via my gmail account. How can I do it? Thank you.---End Message--- ---BeginMessage--- Am 04.04.2010 14:28, schrieb ttplayer: Hi, everyone! I have a problem about the php mail function and imap_mail function. When I use the mail or imap_mail function to send a email, the php script sends the email through the local mail sever with sendmail or another MTA supported. However, I have a gmail account. I just want the php script to send emails via my gmail account. How can I do it? Thank you. a) use an external SMTP-class, you could take a look at PEAR (which directly etablishes a connection to your gmail-account) b) configure your mail-server/system that he delivers the mails via an external SMTP_Server - there are several tutorials how to do that in the inet Regards, Valentin Dreismann ---End Message--- ---BeginMessage--- Hello ttplayer, If GMail does allow sending through socket, wait a bit, I'll upload a class written on my own for sending mail through a custom SMTP via socket. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: ttplayer f...@qq.com To: php-general php-gene...@lists.php.net Date: Sunday, April 4, 2010, 3:28:33 PM Subject: [PHP] About the php mail function and imap_mail function Hi, everyone! I have a problem about the php mail function and imap_mail function. When I use the mail or imap_mail function to send a email, the php script sends the email through the local mail sever with sendmail or another MTA supported. However, I have a gmail account. I just want the php script to send emails via my gmail account. How can I do it? Thank you. ---End Message--- ---BeginMessage--- Hi Kevin, Thank you for your assistance. I finally gave up and let my self to default Microsoft Installation for IIS7.5+PHP+MySQL. Everything runs fine on my developer machine - and that was my main goal - so I'm fine. However, after about 48 hours of search, I was not able to find to how to do this manually - and it shock me (as a open source fan). At least, my Linuxs' servers are still intact. Ps. there is still snowing here in Iceland (heat -15°C in wind) and a volcano eruption that is growing. :) Thanks for your help, Summi -Original Message- From: SED [mailto:s...@sed.is] Sent: 4. apríl 2010 10:06 To: 'Kevin Kinsey' Cc: php-gene...@lists.php.net Subject: RE: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond Hi Kevin, - MySQL 5.1 (64bit) is listening at port 0.0.0.0:3306 - MySQL 4.1 (32bit) is listening at port 0.0.0.0:3307 - When running MySQL command via PHP (CMD or browser) I get 127.0.0.1:3306 Established - I can connect to MySQL via CMD or MySQL Administrator GUI. - PHP (32bit) loads php_mysql.dll - php.ini works 100% - All Firewalls are disabled on LAN - Is this a PHP bug or am I getting crazy? ;-) - Is there a 64bit of PHP who is assumed ok for develope machine with firewalls? Regards, Summi -Original Message- From: Kevin Kinsey [mailto:k...@daleco.biz] Sent: 4. apríl 2010 01:02 To: Sumarliði Einar Daðason Cc: php-gene...@lists.php.net Subject: Re: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed
RE: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond
Hi Kevin, - MySQL 5.1 (64bit) is listening at port 0.0.0.0:3306 - MySQL 4.1 (32bit) is listening at port 0.0.0.0:3307 - When running MySQL command via PHP (CMD or browser) I get 127.0.0.1:3306 Established - I can connect to MySQL via CMD or MySQL Administrator GUI. - PHP (32bit) loads php_mysql.dll - php.ini works 100% - All Firewalls are disabled on LAN - Is this a PHP bug or am I getting crazy? ;-) - Is there a 64bit of PHP who is assumed ok for develope machine with firewalls? Regards, Summi -Original Message- From: Kevin Kinsey [mailto:k...@daleco.biz] Sent: 4. apríl 2010 01:02 To: Sumarliði Einar Daðason Cc: php-general@lists.php.net Subject: Re: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond Sumarliði Einar Daðason wrote: I have setup PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) with success. phpinfo() shows the MySQL extension loaded, but when I try to use mysql_connect( $host, $user, $password ) in a PHP script I get following error: PHP Warning: mysql_connect() [a href='function.mysql-connect'function.mysql-connect/a]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\inetpub\wwwroot\old\index.php on line 29 I have search on the Internet for a solution for this but without any luck. Any ideas? Yes, first check that MySQL is actually listening on port 3306 (Netstat should do that trick), and, if it is, try turning your firewall off. What is the value of $host? KDK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Just a test.
Hi,everyone. Have a good day. This is just a test if my email address has been added to the mailing list.
[PHP] About the php mail function and imap_mail function
Hi, everyone! I have a problem about the php mail function and imap_mail function. When I use the mail or imap_mail function to send a email, the php script sends the email through the local mail sever with sendmail or another MTA supported. However, I have a gmail account. I just want the php script to send emails via my gmail account. How can I do it? Thank you.
Re: [PHP] About the php mail function and imap_mail function
Am 04.04.2010 14:28, schrieb ttplayer: Hi, everyone! I have a problem about the php mail function and imap_mail function. When I use the mail or imap_mail function to send a email, the php script sends the email through the local mail sever with sendmail or another MTA supported. However, I have a gmail account. I just want the php script to send emails via my gmail account. How can I do it? Thank you. a) use an external SMTP-class, you could take a look at PEAR (which directly etablishes a connection to your gmail-account) b) configure your mail-server/system that he delivers the mails via an external SMTP_Server - there are several tutorials how to do that in the inet Regards, Valentin Dreismann -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond
Hi Kevin, Thank you for your assistance. I finally gave up and let my self to default Microsoft Installation for IIS7.5+PHP+MySQL. Everything runs fine on my developer machine - and that was my main goal - so I'm fine. However, after about 48 hours of search, I was not able to find to how to do this manually - and it shock me (as a open source fan). At least, my Linuxs' servers are still intact. Ps. there is still snowing here in Iceland (heat -15°C in wind) and a volcano eruption that is growing. :) Thanks for your help, Summi -Original Message- From: SED [mailto:s...@sed.is] Sent: 4. apríl 2010 10:06 To: 'Kevin Kinsey' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond Hi Kevin, - MySQL 5.1 (64bit) is listening at port 0.0.0.0:3306 - MySQL 4.1 (32bit) is listening at port 0.0.0.0:3307 - When running MySQL command via PHP (CMD or browser) I get 127.0.0.1:3306 Established - I can connect to MySQL via CMD or MySQL Administrator GUI. - PHP (32bit) loads php_mysql.dll - php.ini works 100% - All Firewalls are disabled on LAN - Is this a PHP bug or am I getting crazy? ;-) - Is there a 64bit of PHP who is assumed ok for develope machine with firewalls? Regards, Summi -Original Message- From: Kevin Kinsey [mailto:k...@daleco.biz] Sent: 4. apríl 2010 01:02 To: Sumarliði Einar Daðason Cc: php-general@lists.php.net Subject: Re: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond Sumarliði Einar Daðason wrote: I have setup PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) with success. phpinfo() shows the MySQL extension loaded, but when I try to use mysql_connect( $host, $user, $password ) in a PHP script I get following error: PHP Warning: mysql_connect() [a href='function.mysql-connect'function.mysql-connect/a]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\inetpub\wwwroot\old\index.php on line 29 I have search on the Internet for a solution for this but without any luck. Any ideas? Yes, first check that MySQL is actually listening on port 3306 (Netstat should do that trick), and, if it is, try turning your firewall off. What is the value of $host? KDK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond
-Original Message- From: SED [mailto:s...@sed.is] Sent: Sunday, April 04, 2010 11:48 AM To: 'SED' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond Hi Kevin, Thank you for your assistance. I finally gave up and let my self to default Microsoft Installation for IIS7.5+PHP+MySQL. Everything runs fine on my developer machine - and that was my main goal - so I'm fine. However, after about 48 hours of search, I was not able to find to how to do this manually - and it shock me (as a open source fan). At least, my Linuxs' servers are still intact. Ps. there is still snowing here in Iceland (heat -15°C in wind) and a volcano eruption that is growing. :) Thanks for your help, Summi -Original Message- From: SED [mailto:s...@sed.is] Sent: 4. apríl 2010 10:06 To: 'Kevin Kinsey' Cc: php-general@lists.php.net Subject: RE: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond Hi Kevin, - MySQL 5.1 (64bit) is listening at port 0.0.0.0:3306 - MySQL 4.1 (32bit) is listening at port 0.0.0.0:3307 - When running MySQL command via PHP (CMD or browser) I get 127.0.0.1:3306 Established - I can connect to MySQL via CMD or MySQL Administrator GUI. - PHP (32bit) loads php_mysql.dll - php.ini works 100% - All Firewalls are disabled on LAN - Is this a PHP bug or am I getting crazy? ;-) - Is there a 64bit of PHP who is assumed ok for develope machine with firewalls? Regards, Summi -Original Message- From: Kevin Kinsey [mailto:k...@daleco.biz] Sent: 4. apríl 2010 01:02 To: Sumarliði Einar Daðason Cc: php-general@lists.php.net Subject: Re: [PHP] PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) - established connection failed because connected host has failed to respond Sumarliði Einar Daðason wrote: I have setup PHP (32 bit) on IIS7.5 and MySQL 5.1.45 (64 bit) with success. phpinfo() shows the MySQL extension loaded, but when I try to use mysql_connect( $host, $user, $password ) in a PHP script I get following error: PHP Warning: mysql_connect() [a href='function.mysql-connect'function.mysql-connect/a]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\inetpub\wwwroot\old\index.php on line 29 I have search on the Internet for a solution for this but without any luck. Any ideas? Yes, first check that MySQL is actually listening on port 3306 (Netstat should do that trick), and, if it is, try turning your firewall off. What is the value of $host? KDK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SERVER['PHP_AUTH_USER'] has gone
Hi, I'm running a system with Fedora 12 and Apache/PHP default installation. That means PHP is used as module in Apache, it is NOT running as CGI. Nevertheless for the latest PHP version installed there $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] and $_SERVER['REMOTE_USER'] do no longer work, they are empty and I get a warning that they do not exist. It looks for me like a big incompatible change from one version of PHP to an other (which is a mess). So how can I get them back? Or what is the intended way to access the HTTP Basic Auth username and password?
Re: [PHP] About the php mail function and imap_mail function
Hello ttplayer, If GMail does allow sending through socket, wait a bit, I'll upload a class written on my own for sending mail through a custom SMTP via socket. -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: ttplayer f...@qq.com To: php-general php-general@lists.php.net Date: Sunday, April 4, 2010, 3:28:33 PM Subject: [PHP] About the php mail function and imap_mail function Hi, everyone! I have a problem about the php mail function and imap_mail function. When I use the mail or imap_mail function to send a email, the php script sends the email through the local mail sever with sendmail or another MTA supported. However, I have a gmail account. I just want the php script to send emails via my gmail account. How can I do it? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER['PHP_AUTH_USER'] has gone
On 04/04/10 22:04, Satz Klauer wrote: Hi, I'm running a system with Fedora 12 and Apache/PHP default installation. That means PHP is used as module in Apache, it is NOT running as CGI. Nevertheless for the latest PHP version installed there $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] and $_SERVER['REMOTE_USER'] do no longer work, they are empty and I get a warning that they do not exist. It looks for me like a big incompatible change from one version of PHP to an other (which is a mess). So how can I get them back? Or what is the intended way to access the HTTP Basic Auth username and password? Why not dump the $_SERVER array and check it out ? -- Nilesh Govindarajan Site Server Administrator www.itech7.com मेरा भारत महान ! मम भारत: महत्तम भवतु ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER['PHP_AUTH_USER'] has gone
You can use, http://php.net/getallheaders function and parse the authentication header. For basic authentication, username and password are kept base64 encoded and separated by a : Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) On Sun, Apr 4, 2010 at 10:19 PM, Satz Klauer satzkla...@googlemail.com wrote: Hi, I'm running a system with Fedora 12 and Apache/PHP default installation. That means PHP is used as module in Apache, it is NOT running as CGI. Nevertheless for the latest PHP version installed there $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] and $_SERVER['REMOTE_USER'] do no longer work, they are empty and I get a warning that they do not exist. It looks for me like a big incompatible change from one version of PHP to an other (which is a mess). So how can I get them back? Or what is the intended way to access the HTTP Basic Auth username and password? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_SERVER['PHP_AUTH_USER'] has gone
Satz Klauer wrote: Hi, I'm running a system with Fedora 12 and Apache/PHP default installation. That means PHP is used as module in Apache, it is NOT running as CGI. Nevertheless for the latest PHP version installed there $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] and $_SERVER['REMOTE_USER'] do no longer work, they are empty and I get a warning that they do not exist. It looks for me like a big incompatible change from one version of PHP to an other (which is a mess). So how can I get them back? Or what is the intended way to access the HTTP Basic Auth username and password? just a quick sanity check; you do have the specific site/directory set up to send and receive basic auth yeah? sounds very much to me like this is an apache config issue and not php :) regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_SERVER['PHP_AUTH_USER'] has gone
Sorry for the top-post. Easter has me on the DROID instead of my PC. I second Rixham's thought. Is it a DSO, CGI, FCGI? What pops out in var_dump($_SERVER) and var_dump($_ENV)? On Apr 4, 2010 3:49 PM, Nathan Rixham nrix...@gmail.com wrote: Satz Klauer wrote: Hi, I'm running a system with Fedora 12 and Apache/PHP default installatio... just a quick sanity check; you do have the specific site/directory set up to send and receive basic auth yeah? sounds very much to me like this is an apache config issue and not php :) regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub
[PHP] Howto send command over ssh using sockets
Hello, I am trying send command to remote host over ssh with sockets. But I need to set up username/password. I am trying to modify this script (from www.php.net - function fsockopen), but I dont know, where set username/password because I got this message: Bad protocol version identification 'password' from ip Library ssh2 is not currentu userfull for me, because I am not admin of server. Thank you Radek ?php / * Author: Richard Lajaunie * Mail : richard.lajau...@cote-azur.cci.fr * * subject : this script retreive all mac-addresses on all ports * of a Cisco 3548 Switch by a telnet connection * * base on the script by: xbensemhoun at t-systems dot fr on the same page **/ if ( array_key_exists(1, $argv) ){ $cfgServer = $argv[1]; }else{ echo ex: 'php test.php 10.0.0.0' \n; exit; } $cfgPort= 23;//port, 22 if SSH $cfgTimeOut = 10; $usenet = fsockopen($cfgServer, $cfgPort, $errno, $errstr), $cfgTimeOut); if(!$usenet){ echo Connexion failed\n; exit(); }else{ echo Connected\n; fputs ($usenet, password\r\n); fputs ($usenet, en\r\n); fputs ($usenet, password\r\n); fputs ($usenet, sh mac-address-table\r\n); fputs ($usenet, ); // this space bar is this for long output // this skip non essential text $j = 0; while ($j16){ fgets($usenet, 128); $j++; } stream_set_timeout($usenet, 2); // set the timeout for the fgets $j = 0; while (!feof($usenet)){ $ret = fgets($usenet, 128); $ret = str_replace(\r, '', $ret); $ret = str_replace(\n, , $ret); if (ereg(FastEthernet, $ret)){ echo $ret \n; } if (ereg('--More--', $ret) ){ fputs ($usenet, ); // for following page } $info = stream_get_meta_data($usenet); if ($info['timed_out']) { $j++; } if ($j 2){ fputs ($usenet, lo); break; } } } echo End.\r\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Constructor usage
Hi folks. Somewhat philosophical question here. I have heard, although not confirmed, that the trend in the Java world in the past several years has been away from constructors. That is, rather than this: class Foo { public void Foo(Object a, Object b, Object c) {} } Foo f = new Foo(a, b, c); The preference is now for this: class Foo { public void setA(Object a) {} public void setB(Object b) {} public void setC(Object c) {} } Foo f = new Foo(a, b, c); f.setA(a); f.setB(b); f.setC(c); I suppose there is some logic there when working with factories, which you should be doing in general. However, I don't know if that makes the same degree of sense in PHP, even though the OO models are quite similar. So, I'll throw the question out. Who uses example 1 above vs. example 2 when writing dependency-injection-based OOP? Why? What trade-offs have you encountered, and was it worth it? --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Constructor usage
Larry Garfield wrote: Hi folks. Somewhat philosophical question here. I have heard, although not confirmed, that the trend in the Java world in the past several years has been away from constructors. That is, rather than this: class Foo { public void Foo(Object a, Object b, Object c) {} } Foo f = new Foo(a, b, c); The preference is now for this: class Foo { public void setA(Object a) {} public void setB(Object b) {} public void setC(Object c) {} } Foo f = new Foo(a, b, c); f.setA(a); f.setB(b); f.setC(c); I suppose there is some logic there when working with factories, which you should be doing in general. However, I don't know if that makes the same degree of sense in PHP, even though the OO models are quite similar. So, I'll throw the question out. Who uses example 1 above vs. example 2 when writing dependency-injection-based OOP? Why? What trade-offs have you encountered, and was it worth it? Hi Larry, In the Java world a huge reason is because Classes have to be able to be instantiated with no arguments in order to reverse engineered w/ JAXB so that the classes can be used for web services (and wsdl's created etc). Thus most of them have no arguments. Personally I also find it good practise to instantiate with no arguments and then set the state of the instance by calling setters. A nice way around it is to create static methods which instantiate the class w/ a protected or private constructor. class Foo { private $a; private function __construct() {} public function setA( $a ) { $this-a = $a; } public static function instantiateWithASet( $a ) { $temp = new self; $temp-setA( $a ); return $temp; } } it's almost overloading lol. Regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO Design Formally
Hello PHPers, I've been doing the programming thing for about 10 years now: amateur side gigs turned into ten years pretty fast. I think i have a fairly strong sense of object oriented design, data modeling, etc... However, sometimes I wish I had a stronger academic understanding of the design / planning phase of new systems. Then I could be absolutely certain my design is correct before investing mega $ and time into the implementation phase. I think I'd save myself a lot of time and frustration if I could improve my designs before I started coding...obvious right? Well, i've read the wikis, the forums, the blogs, etc... I think i need a text book. I'm looking for an OO design methodology recommendations which focuses on churning out reuseable / flexible deliverables. I'm not afraid of getting all academic about it either. It is about time I really got down into the nitty gritty of proper OO design methods. I'd appreciate any recommendations as for improving my OO design approach/methodology. Thanks, dK ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Design Formally
On Sun, Apr 4, 2010 at 8:37 PM, Daniel Kolbo kolb0...@umn.edu wrote: Hello PHPers, I've been doing the programming thing for about 10 years now: amateur side gigs turned into ten years pretty fast. I think i have a fairly strong sense of object oriented design, data modeling, etc... However, sometimes I wish I had a stronger academic understanding of the design / planning phase of new systems. Then I could be absolutely certain my design is correct before investing mega $ and time into the implementation phase. I think I'd save myself a lot of time and frustration if I could improve my designs before I started coding...obvious right? Well, i've read the wikis, the forums, the blogs, etc... I think i need a text book. I'm looking for an OO design methodology recommendations which focuses on churning out reuseable / flexible deliverables. I'm not afraid of getting all academic about it either. It is about time I really got down into the nitty gritty of proper OO design methods. I'd appreciate any recommendations as for improving my OO design approach/methodology. Thanks, dK ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php *Nice books for all skill levels, but not focused on PHP (still applicable) :* * * http://www.amazon.com/Head-First-Object-Oriented-Analysis-Design/dp/0596008678/ref=sr_1_1?ie=UTF8s=booksqid=1270428919sr=8-1 http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124/ref=sr_1_3?ie=UTF8s=booksqid=1270428919sr=8-3 *Nice PHP-specific books (very practical):* * * http://www.amazon.com/PHP-Action-Objects-Design-Agility/dp/1932394753/ref=sr_1_24?ie=UTF8s=booksqid=1270429041sr=1-24 http://www.amazon.com/Pro-PHP-Patterns-Frameworks-Testing/dp/1590598199/ref=sr_1_17?ie=UTF8s=booksqid=1270429041sr=1-17 *More Academic*: http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420/ref=sr_1_1?ie=UTF8s=booksqid=1270429181sr=1-1 *Functional Bliss (now PHP 5.3 offers more functional programming capabilities, so it's nice to see how other languages leverage the paradigm ;):* http://www.amazon.com/Practical-Common-Lisp-Peter-Seibel/dp/1590592395/ref=sr_1_1?ie=UTF8s=booksqid=1270429493sr=1-1 http://www.amazon.com/Programming-Erlang-Software-Concurrent-World/dp/193435600X/ref=sr_1_2?ie=UTF8s=booksqid=1270429533sr=1-2 There are others, but I limited my suggestions to books I own. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com
Re: [PHP] Howto send command over ssh using sockets
Instead of ssh, you could use telnet to connect to the Cisco router (which incidentally runs on port 23, but is likely to be disabled on the cisco router, unless you have a pre-SSH capable IOS running on it (like my old cisco crap :( ) ), because i strongly doubt you have written or are willing to write your own encryption libraries for this project, you might also want to read IETF RFC 854 [http://tools.ietf.org/html/rfc854] about the telnet protocol, as you are writing your own client, and not using a pre-made one, judging from your script. Or if you do not like the idea of sending clear-text passwords to the router, you might want to learn about proc_open() (or popen()) and use the native ssh utility that most likely is present on the server, taking great care to READ THE MANUAL for the ssh command, because you most likely do _not_ want it to spit out ANSI-escapes to you script. Kind regards from Johan Lidström Örnsköldsvik, Sweden irc://irc.freenode.net/Dr_Kao frozendude+php...@gmail.com P.S. currently borrowing a friends account. 2010/4/5 Radek Krejča radek.kre...@starnet.cz: Hello, I am trying send command to remote host over ssh with sockets. But I need to set up username/password. I am trying to modify this script (from www.php.net - function fsockopen), but I dont know, where set username/password because I got this message: Bad protocol version identification 'password' from ip Library ssh2 is not currentu userfull for me, because I am not admin of server. Thank you Radek ?php / * Author: Richard Lajaunie * Mail : richard.lajau...@cote-azur.cci.fr * * subject : this script retreive all mac-addresses on all ports * of a Cisco 3548 Switch by a telnet connection * * base on the script by: xbensemhoun at t-systems dot fr on the same page **/ if ( array_key_exists(1, $argv) ){ $cfgServer = $argv[1]; }else{ echo ex: 'php test.php 10.0.0.0' \n; exit; } $cfgPort = 23; //port, 22 if SSH $cfgTimeOut = 10; $usenet = fsockopen($cfgServer, $cfgPort, $errno, $errstr), $cfgTimeOut); if(!$usenet){ echo Connexion failed\n; exit(); }else{ echo Connected\n; fputs ($usenet, password\r\n); fputs ($usenet, en\r\n); fputs ($usenet, password\r\n); fputs ($usenet, sh mac-address-table\r\n); fputs ($usenet, ); // this space bar is this for long output // this skip non essential text $j = 0; while ($j16){ fgets($usenet, 128); $j++; } stream_set_timeout($usenet, 2); // set the timeout for the fgets $j = 0; while (!feof($usenet)){ $ret = fgets($usenet, 128); $ret = str_replace(\r, '', $ret); $ret = str_replace(\n, , $ret); if (ereg(FastEthernet, $ret)){ echo $ret \n; } if (ereg('--More--', $ret) ){ fputs ($usenet, ); // for following page } $info = stream_get_meta_data($usenet); if ($info['timed_out']) { $j++; } if ($j 2){ fputs ($usenet, lo); break; } } } echo End.\r\n; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Constructor usage
On Sun, Apr 4, 2010 at 6:36 PM, Larry Garfield la...@garfieldtech.comwrote: Hi folks. Somewhat philosophical question here. I have heard, although not confirmed, that the trend in the Java world in the past several years has been away from constructors. That is, rather than this: class Foo { public void Foo(Object a, Object b, Object c) {} } Foo f = new Foo(a, b, c); The preference is now for this: class Foo { public void setA(Object a) {} public void setB(Object b) {} public void setC(Object c) {} } Foo f = new Foo(a, b, c); f.setA(a); f.setB(b); f.setC(c); I suppose there is some logic there when working with factories, which you should be doing in general. However, I don't know if that makes the same degree of sense in PHP, even though the OO models are quite similar. So, I'll throw the question out. Who uses example 1 above vs. example 2 when writing dependency-injection-based OOP? Why? What trade-offs have you encountered, and was it worth it? --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php That's an interesting question to ponder, Larry. In some ways, working with a constructor requires a greater amount of knowledge concerning the object. Perhaps I'm the service that's responsible for injecting the appropriate DB object. I don't care about the Auth object, nor do I care about Logging object to be injected. I only care about providing the DB object. If the Foo object implements an interface (e.g., setDBObject(DBObject dbo)), I can be handed any object with the interface, and perform the injection, no questions asked. The same technique can be carried out for the Auth object and logging object. Carried out far enough, and you can work up a nice IoC structure that doesn't even blink when you change the object by adding another instance variable that is to be injected. I wouldn't have to touch any *existing* code to accommodate these changes. However, when you consider the constructor example, you have to interlace your code in such a way that there's a point where you know: - All of the objects that Foo expects in the constructor, and what the order is. - Which instance of each object to send for this particular instance of Foo. In this situation (where I'm using the constructor), I much more likely to have to rework existing code to accommodate the changes in the object. I do believe you are correct, there does seem to be a trend that way in Java and C# (although some of C#'s syntactic sugar does offer a couple other options.) That said, I'll admit I've been leaning in the other way for the past year since being exposed to some functional programming paradigms. I've actually been using more constructors in C# and Java and PHP to create immutable objects (private instance vars and private setters, but public getters.) Although it does require more knowledge of the underlying object structure in surrounding code, it also affords me immutability, which has it's own merits. Just my OPINIONS ;) Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com
Re: [PHP] Constructor usage
On Sun, Apr 04, 2010 at 05:36:23PM -0500, Larry Garfield wrote: Hi folks. Somewhat philosophical question here. I have heard, although not confirmed, that the trend in the Java world in the past several years has been away from constructors. That is, rather than this: class Foo { public void Foo(Object a, Object b, Object c) {} } Foo f = new Foo(a, b, c); The preference is now for this: class Foo { public void setA(Object a) {} public void setB(Object b) {} public void setC(Object c) {} } Foo f = new Foo(a, b, c); f.setA(a); f.setB(b); f.setC(c); I suppose there is some logic there when working with factories, which you should be doing in general. However, I don't know if that makes the same degree of sense in PHP, even though the OO models are quite similar. So, I'll throw the question out. Who uses example 1 above vs. example 2 when writing dependency-injection-based OOP? Why? What trade-offs have you encountered, and was it worth it? One problem I have with parameterless constructors is this: When you rely on setters to shape your object rather than the constructor, your other methods cannot assume the object is in proper shape to be usable. There's no guarantee the programmer won't forget one of the vital setters. So each method in the object must test to ensure the object can actually be used properly. This isn't a deal-breaker, but it seems like an awfully unnecessary piece of additional code which must be replicated in each method. (Naturally, this is moot where the class doesn't depend on any outside objects or parameters to operate.) By the way, I've found this to be a problem in C++ as well. I personally prefer not to have to pass parameters to a constructor, but even in C++, doing so seems a simpler solution than relying on the programmer to remember to call the proper setters. I've found that many of my classes require other classes in order to operate. Moreover, they must be instantiated in the proper order, or things fall apart. So I took the step of creating my own dependency injection instantiator class which handles all this for me. Classes with dependencies typically are specified so that the requisite objects are passed to the constructor (the simplest way). Each class which is managed by the DII is registered first, with whatever parameter or object dependencies needed. Then the DII's instantiate() method is called as needed for each object. The DII class handles instantiating objects in the proper order and with the proper dependencies. The programmer's job is made much simpler. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Medical Task Force
hello world :) yea, i have some exp with coding and medical science too.. i'm not a packager of any ubuntu software center stuff, but i have built and released open source software before.. it's usually stored at http://mediabeez.ws/ but the computer that's running on has crashed and acted very very weirdly (too often in the last minute / hour / day / did-that-same-weirdness-about-a-week-ago aswell).. so mediabeez.ws will be back up, and to prove that i wrote htmlMicroscope, check the php-general mailinglist for php-coders. keyword htmlMicroscope. A working copy of that can be found on google code too. If you have any serious, non personal computer related issues or serverpark issues, then i'm willing to be invited to a mailinglist of yours where despite me not being on the ubuntu-dev or debian-dev teams, maybe i can occasionally provide a small bit of advice here and there. but don't expect me to make descisions for groups of other living humans or whatever they think is going on. i'm not a priest / politician / leader-type. unless ABSOLUTELY necessary... if u know what i mean. ciao for now ppl ;) On Thu, Apr 1, 2010 at 11:32 PM, Sascha 'saigkill' Manns samann...@directbox.com wrote: Hello Mates, warm Greetings from the openSUSE Community. We all knowing that we have a lack of Software from Medical needs (Medicine Doctors or Clinics). So we (the openSUSE, Fedora and Debian Developers) have founded an Special Task Force for building new Packages with Medical needs. We trying to share our Experience and Patches. So we are pleased to invite the Ubuntu Project, to be a part of this Task Force. If you're an Packager or interested in learning that, you're welcome. Please answer to this List. Have a nice evening... -- Sincerely yours Sascha Manns openSUSE Community Support Agent openSUSE Marketing Team Blog: http://saigkill.wordpress.com Web: http://www.open-slx.de (openSUSE Box Support German) Web: http://www.open-slx.com (openSUSE Box Support English) -- Ubuntu-devel-discuss mailing list ubuntu-devel-disc...@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: Medical Task Force
hey, i did not fake that cc header on my last mail. i just hit reply-all and added php-general because i find it significant for this list too.. and guys, i'm very very sorry to have ever used walk over to you-language against fellow programmers, i'll try to refrain from such behaviour in the future, but i was very stressed already that week. and i have reason to fear more stress in coming weeks, but i'll be fine.. anyways, i wont be techposting for a while i think. mediabeez.ws will stay offline for months maybe 8 months even... -- Forwarded message -- From: Sascha 'saigkill' Manns samann...@directbox.com Date: Fri, Apr 2, 2010 at 1:33 PM Subject: Re: Medical Task Force To: ubuntu-devel-disc...@lists.ubuntu.com, schultz.patr...@gmail.com Cc: ubuntu-devel-discuss-boun...@lists.ubuntu.com Am Freitag, 2. April 2010 02:14:15 wrote schultz.patr...@gmail.com: I would also be interested; I currently write software for RIS/PACS machines. Is there a website with more information? Regards, Patrick Schultz Sent from my Verizon Wireless BlackBerry -Original Message- From: Bruno Girin brunogi...@gmail.com Date: Fri, 02 Apr 2010 00:52:22 To: ubuntu-devel-disc...@lists.ubuntu.com Subject: Re: Medical Task Force Hi Sasha, On Thu, 2010-04-01 at 23:32 +0200, Sascha 'saigkill' Manns wrote: Hello Mates, warm Greetings from the openSUSE Community. We all knowing that we have a lack of Software from Medical needs (Medicine Doctors or Clinics). So we (the openSUSE, Fedora and Debian Developers) have founded an Special Task Force for building new Packages with Medical needs. We trying to share our Experience and Patches. So we are pleased to invite the Ubuntu Project, to be a part of this Task Force. If you're an Packager or interested in learning that, you're welcome. Please answer to this List. I have no knowledge in packaging but I would be very interested to learn and to be part of this task force. I have experience working with the NHS in the UK, hence the interest. I'm not sure that's any help though :-) First of all we have created an distro specific Subproject: http://en.opensuse.org/OpenSUSE-Medical http://fedoraproject.org/wiki/SIGs/FedoraMedical http://www.debian.org/devel/debian-med/ Mailinglists: opensuse-medical (subscribe opensuse-medical+subscr...@opensuse.org) fedora-medical (subscribe https://fedorahosted.org/mailman/listinfo/medical-sig) debian-med (subscribe http://lists.debian.org/debian-med/) All from the Task Force has subscribed all that Mailinglists. Maybe it is possible to create an Medical Subproject in Ubuntu with an own Maillinglist. Have a nice day :-) -- Sincerely yours Sascha Manns openSUSE Community Support Agent openSUSE Marketing Team Blog: http://saigkill.wordpress.com Web: http://www.open-slx.de (openSUSE Box Support German) Web: http://www.open-slx.com (openSUSE Box Support English) -- Ubuntu-devel-discuss mailing list ubuntu-devel-disc...@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert a string into an array
yea i'm not the only one with those type of problems. sometimes times slows down in my room so much not even my speakers sound normal anymore; equipment that doesn't work (despite being crappy and known by it's patterns of refusal to work; still EXTRA abnormal since about a week or so)... it sounds like the who's reading my passwords with me while i type 'm in... === 'is there anyone looking over my shoulder despite no living humans even in my entire properly locked room (with strong walls)' the idea here is; take a break. work on a different project for a week or so, but the best idea is; move around through the country side and realize that your car will get gas at every gasstation... check your atm cards, but not your online banking account status, just to buy a pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of your favorite smokes(cigarettes in this case), but buy 10 packs with that card, and make sure you have enough good old cash that you know to be truely valid (coins are best) to get just 2 large packs of cigarettes.. things like that will give you the confidence you need to proceed on your project i think.. the #1 rule i use (when you dont yet have any need for a #0 rule or a #-1 rule (dont add those lightly and never on a whim or hope of being saved from death in the next 5 minutes)) is: truely honest living humans should never use the same type of lie construct in the same type of situation for the second time within at least 1 to 3 weeks.. but hey, necessity may require you to break any rule... rules? only guidelines are usefull ;) (pirates of the caribean #1 movie) On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: Medical Task Force
Hey, not sure how comprehensive you're looking to be but for health informatics there are a number of hl7 and PACS tools out there which are open source, most are just a google search away. -matty On Apr 4, 2010 11:23 PM, Rene Veerman rene7...@gmail.com wrote: hey, i did not fake that cc header on my last mail. i just hit reply-all and added php-general because i find it significant for this list too.. and guys, i'm very very sorry to have ever used walk over to you-language against fellow programmers, i'll try to refrain from such behaviour in the future, but i was very stressed already that week. and i have reason to fear more stress in coming weeks, but i'll be fine.. anyways, i wont be techposting for a while i think. mediabeez.ws will stay offline for months maybe 8 months even... -- Forwarded message -- From: Sascha 'saigkill' Manns samann...@directbox.com Date: Fri, Apr 2, 2010 at 1:33 PM Subject: Re: Medical Task Force To: ubuntu-devel-disc...@lists.ubuntu.com, schultz.patr...@gmail.com Cc: ubuntu-devel-discuss-boun...@lists.ubuntu.com Am Freitag, 2. April 2010 02:14:15 wrote schultz.patr...@gmail.com: I would also be interested; I currently write software for RIS/PACS machines. Is there a website with more information? Regards, Patrick Schultz Sent from my Verizon Wireless BlackBerry -Original Message- From: Bruno Girin brunogi...@gmail.com Date: Fri, 02 Apr 2010 00:52:22 To: ubuntu-devel-disc...@lists.ubuntu.com Subject: Re: Medical Task Force Hi Sasha, On Thu, 2010-04-01 at 23:32 +0200, Sascha 'saigkill' Manns wrote: Hello Mates, warm ... I have no knowledge in packaging but I would be very interested to learn and to be part of this task force. I have experience working with the NHS in the UK, hence the interest. I'm not sure that's any help though :-) First of all we have created an distro specific Subproject: http://en.opensuse.org/OpenSUSE-Medical http://fedoraproject.org/wiki/SIGs/FedoraMedical http://www.debian.org/devel/debian-med/ Mailinglists: opensuse-medical (subscribe opensuse-medical+subscr...@opensuse.orgopensuse-medical%2bsubscr...@opensuse.org ) fedora-medical (subscribe https://fedorahosted.org/mailman/listinfo/medical-sig) debian-med (subscribe http://lists.debian.org/debian-med/) All from the Task Force has subscribed all that Mailinglists. Maybe it is possible to create an Medical Subproject in Ubuntu with an own Maillinglist. Have a nice day :-) -- Sincerely yours Sascha Manns openSUSE Community Support Agent openSUSE Marketing Team Blog: ...
Re: [PHP] convert a string into an array
you sure you're only smoking cigarettes? has to be one of the most random replies to any php thread I've ever seen - awesome! regards Rene Veerman wrote: yea i'm not the only one with those type of problems. sometimes times slows down in my room so much not even my speakers sound normal anymore; equipment that doesn't work (despite being crappy and known by it's patterns of refusal to work; still EXTRA abnormal since about a week or so)... it sounds like the who's reading my passwords with me while i type 'm in... === 'is there anyone looking over my shoulder despite no living humans even in my entire properly locked room (with strong walls)' the idea here is; take a break. work on a different project for a week or so, but the best idea is; move around through the country side and realize that your car will get gas at every gasstation... check your atm cards, but not your online banking account status, just to buy a pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of your favorite smokes(cigarettes in this case), but buy 10 packs with that card, and make sure you have enough good old cash that you know to be truely valid (coins are best) to get just 2 large packs of cigarettes.. things like that will give you the confidence you need to proceed on your project i think.. the #1 rule i use (when you dont yet have any need for a #0 rule or a #-1 rule (dont add those lightly and never on a whim or hope of being saved from death in the next 5 minutes)) is: truely honest living humans should never use the same type of lie construct in the same type of situation for the second time within at least 1 to 3 weeks.. but hey, necessity may require you to break any rule... rules? only guidelines are usefull ;) (pirates of the caribean #1 movie) On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine an...@oire.org wrote: Hello everyone, It's quite simple but I'm still stuck. What I need is the following: I have an array as a parameter of my custom function. However, I'd like to allow users to enter a string instead of an array. In this case (if the parameter is a string), it must be replaced with an array containing only one item - actually, that string. What I'm doing gives me (presumably) errors; function Send ($tonames, $toemails, $subject, $message) { ... if ((!is_array($tonames)) || (!is_array($toemails))) { $tonames[]=$tonames; $toemails[]=$toemails; } I can't give the new array a new name since I address it further in a loop as my function's parameter... hope you understand what I'm saying) Thanks! -- With best regards from Ukraine, Andre Http://oire.org/ - The Fantasy blogs of Oire Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: http://twitter.com/m_elensule -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Constructor usage
On Sunday 04 April 2010 09:21:28 pm Paul M Foster wrote: So, I'll throw the question out. Who uses example 1 above vs. example 2 when writing dependency-injection-based OOP? Why? What trade-offs have you encountered, and was it worth it? One problem I have with parameterless constructors is this: When you rely on setters to shape your object rather than the constructor, your other methods cannot assume the object is in proper shape to be usable. There's no guarantee the programmer won't forget one of the vital setters. So each method in the object must test to ensure the object can actually be used properly. This isn't a deal-breaker, but it seems like an awfully unnecessary piece of additional code which must be replicated in each method. (Naturally, this is moot where the class doesn't depend on any outside objects or parameters to operate.) Yeah, I tend toward using constructors for injection for the same reason: That way I always know for sure that if I have an object, it's complete. I defer most object instantiation to factories anyway, so in practice it's not a huge issue for me. I've found that many of my classes require other classes in order to operate. Moreover, they must be instantiated in the proper order, or things fall apart. So I took the step of creating my own dependency injection instantiator class which handles all this for me. Classes with dependencies typically are specified so that the requisite objects are passed to the constructor (the simplest way). Each class which is managed by the DII is registered first, with whatever parameter or object dependencies needed. Then the DII's instantiate() method is called as needed for each object. The DII class handles instantiating objects in the proper order and with the proper dependencies. The programmer's job is made much simpler. Paul Sounds overly complicated, but whatever works. :-) In my experience so far I find that a well-designed factory is sufficient, but it may not be in larger or more involved OO frameworks than I've used to date. --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php