From jakob.buchgraber at googlemail.com Sun Jul 1 06:28:12 2007 From: jakob.buchgraber at googlemail.com (Jakob Buchgraber) Date: Sun, 01 Jul 2007 12:28:12 +0200 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: <468711D0.2060101@gmx.net> References: <46840B21.6000205@gmx.net> <46841AFE.6040109@gmail.com> <026301c7b9c4$ebe35020$6b01a8c0@gamebox> <46842BBD.80802@gmx.net> <46866C49.4060208@gmail.com> <4686717A.6030507@gmx.net> <4686F530.9060209@gmail.com> <468711D0.2060101@gmx.net> Message-ID: <468781BC.6010802@gmail.com> > I am in no position to correct you, but isn't it that PHP talks to MySQL > rather then the HTTP client? As far as MySQL is concerned, the > connection comes from where the PHP interpreter is located. And since > each connection from PHP to MySQL gets named sufficiently uniquely I > guess that PHP can keep multiple clients apart. Normally one opens a > connection, runs the queries, and then closes it. I always make sure > that I explicitly close the connection, but after reading the > documentation a script end will close the connection as well. Seems to > be quite different from opening files, which stay open and locked even > after the script is done. > It may just be that PHP uses only one persistent connection and feeds > all the queries through that one regardless of client (but returns the > values back to the script instance from where the query came), which is > what you suspect. Unless someone who really knows what is going on comes > forward we can only resort to speculation. > > I will give it a try and see what happens. It's only adding a "p". Since > the mysql_close doesn't do any thing on persistent connections there is > no harm in leaving it in - or so the theory goes. > > I don't see a problem with my current project as this one will never be > used by more than a few dozen clients at a time, but I have other > projects where some optimization may be more than just OK. > > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > Exactly that's what I tried telling you :-D. Of course the HTTP Client (=user) does not connect to mysql it's the PHP script, but the PHP script gets executed when the client makes a request and regardless how many requests he makes the PHP Script/Mysql does not know that this user has already been here. That's what I wanted to tell you as I thought that you thought that persistent connections mean that for every user a new connection is opened and that each connection corresponds to a user and is kept open for e.g. 30 minutes, but that's not true. Anyway, it seems to mean that you got it now and that's actually everything that counts. - Jakob -- Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 From jeff at globalitsoft.com Sun Jul 1 08:40:02 2007 From: jeff at globalitsoft.com (Jeff - GlobalITSoft) Date: Sun, 01 Jul 2007 08:40:02 -0400 Subject: [nycphp-talk] Problem with PHPMailer Class In-Reply-To: <12346.42387.qm@web8704.mail.in.yahoo.com> Message-ID: I believe the latest version of PHP Mailer takes care of this problem. (Ver 1.73 is the latest and this was addressed in 1.72). See: http://phpmailer.sourceforge.net/ Jeff -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]On Behalf Of Shadab Wadiwala Sent: Friday, June 08, 2007 7:03 AM To: NYPHP Talk Subject: [nycphp-talk] Problem with PHPMailer Class Hi !! I am involved in developing a web-based email service as a part of my College Minor Project ..... I rely on PHPMailer library to send mails using SMTP service on port 25 But I am facing some trouble .... Whenever I send a mail I get an error stating :-- LANGUAGE STRING FAILED TO LOAD : RECIPIENTS FAILED What is the remedy to this problem so that I can start to send the mails successfully ... A quick reply in this regard will be very much benficial to me Shadab .I. Wadiwala My homepage:-- http://shadabworld.110mb.com ---------------------------------------------------------------------------- -- Download prohibited? No problem! CHAT from any browser, without download. -------------- next part -------------- An HTML attachment was scrubbed... URL: From volcimaster at gmail.com Sun Jul 1 14:17:28 2007 From: volcimaster at gmail.com (Warren Myers) Date: Sun, 1 Jul 2007 14:17:28 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: <468781BC.6010802@gmail.com> References: <46840B21.6000205@gmx.net> <46841AFE.6040109@gmail.com> <026301c7b9c4$ebe35020$6b01a8c0@gamebox> <46842BBD.80802@gmx.net> <46866C49.4060208@gmail.com> <4686717A.6030507@gmx.net> <4686F530.9060209@gmail.com> <468711D0.2060101@gmx.net> <468781BC.6010802@gmail.com> Message-ID: It should also be noted that connections will automatically timeout, so you don't technically need to close it (though it's a Good Idea (tm)). With pconnect, PHP *should* reopen the connection if it's timed-out on MySQL's end. WMM On 7/1/07, Jakob Buchgraber wrote: > > > I am in no position to correct you, but isn't it that PHP talks to MySQL > > rather then the HTTP client? As far as MySQL is concerned, the > > connection comes from where the PHP interpreter is located. And since > > each connection from PHP to MySQL gets named sufficiently uniquely I > > guess that PHP can keep multiple clients apart. Normally one opens a > > connection, runs the queries, and then closes it. I always make sure > > that I explicitly close the connection, but after reading the > > documentation a script end will close the connection as well. Seems to > > be quite different from opening files, which stay open and locked even > > after the script is done. > > It may just be that PHP uses only one persistent connection and feeds > > all the queries through that one regardless of client (but returns the > > values back to the script instance from where the query came), which is > > what you suspect. Unless someone who really knows what is going on comes > > forward we can only resort to speculation. > > > > I will give it a try and see what happens. It's only adding a "p". Since > > the mysql_close doesn't do any thing on persistent connections there is > > no harm in leaving it in - or so the theory goes. > > > > I don't see a problem with my current project as this one will never be > > used by more than a few dozen clients at a time, but I have other > > projects where some optimization may be more than just OK. > > > > > > David > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > > > Exactly that's what I tried telling you :-D. Of course the HTTP Client > (=user) does not connect to mysql it's the PHP script, but the PHP > script gets executed when the client makes a request and regardless how > many requests he makes the PHP Script/Mysql does not know that this user > has already been here. That's what I wanted to tell you as I thought > that you thought that persistent connections mean that for every user a > new connection is opened and that each connection corresponds to a user > and is kept open for e.g. 30 minutes, but that's not true. > > Anyway, it seems to mean that you got it now and that's actually > everything that counts. > > - Jakob > -- > Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- http://warrenmyers.com "God may not play dice with the universe, but something strange is going on with the prime numbers." --Paul Erd?s "It's not possible. We are the type of people who have everything in our favor going against us." --Ben Jarhvi, Short Circuit 2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuon1 at netzero.net Sun Jul 1 22:57:01 2007 From: tuon1 at netzero.net (tuon1 at netzero.net) Date: Mon, 2 Jul 2007 02:57:01 GMT Subject: [nycphp-talk] (no subject) Message-ID: <20070701.215701.25801.0@webmail14.dca.untd.com> An embedded and charset-unspecified text was scrubbed... Name: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From tedd at sperling.com Sun Jul 1 23:21:20 2007 From: tedd at sperling.com (tedd) Date: Sun, 1 Jul 2007 23:21:20 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: References: <46840B21.6000205@gmx.net> <46841AFE.6040109@gmail.com> <026301c7b9c4$ebe35020$6b01a8c0@gamebox> <46842BBD.80802@gmx.net> <46866C49.4060208@gmail.com> <4686717A.6030507@gmx.net> <4686F530.9060209@gmail.com> <468711D0.2060101@gmx.net> <468781BC.6010802@gmail.com> Message-ID: At 2:17 PM -0400 7/1/07, Warren Myers wrote: >It should also be noted that connections will automatically timeout, >so you don't technically need to close it (though it's a Good Idea >(tm)). As for me, I always close doors after I travel through them -- just a force of habit. I don't open files, take what I need and then not close them. Likewise, I don't open a dB without also closing it after I get what I need. I may do that several times in a single script and I know there is a bit of overhead cost in doing that, but always knowing that I closed the door means something to me. Besides, computers are getting faster than I can adapt anyway, so I'll keep my old habit. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From cliff at pinestream.com Mon Jul 2 07:13:31 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Mon, 02 Jul 2007 07:13:31 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: Message-ID: Hey, just an aside for everyone. I always had my DB close statement as the last line of my scripts. Then one day, everything stopped working properly. Why? Seems right -- when you're done you're done -- right? Wrong. PHP does plenty of "stuff" after your script is finished. Remember -- if you use database-base sessions, use session_write_close BEFORE you close your DB connection. And you probably want to use session_write_close before any header redirects as well to eliminate timing issues. Cliff From ramons at gmx.net Mon Jul 2 08:43:12 2007 From: ramons at gmx.net (David Krings) Date: Mon, 02 Jul 2007 08:43:12 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: References: Message-ID: <4688F2E0.4070506@gmx.net> Cliff Hirsch wrote: > Hey, just an aside for everyone. > > I always had my DB close statement as the last line of my scripts. Then one > day, everything stopped working properly. Why? > > Seems right -- when you're done you're done -- right? Wrong. PHP does plenty > of "stuff" after your script is finished. > > Remember -- if you use database-base sessions, use session_write_close > BEFORE you close your DB connection. And you probably want to use > session_write_close before any header redirects as well to eliminate timing > issues. > > Cliff Thanks for pointing this out. I will add it to my scripts as I make frequent use of header redirects, they are just so effective. Although I should know if I use database-based sessions, I am not sure as I am not sure what exactly a database-based session is. So, what is that? David From cliff at pinestream.com Mon Jul 2 10:11:20 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Mon, 02 Jul 2007 10:11:20 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: <4688F2E0.4070506@gmx.net> Message-ID: On 7/2/07 8:43 AM, "David Krings" wrote: > Cliff Hirsch wrote: >> Hey, just an aside for everyone. >> >> I always had my DB close statement as the last line of my scripts. Then one >> day, everything stopped working properly. Why? >> >> Seems right -- when you're done you're done -- right? Wrong. PHP does plenty >> of "stuff" after your script is finished. >> >> Remember -- if you use database-base sessions, use session_write_close >> BEFORE you close your DB connection. And you probably want to use >> session_write_close before any header redirects as well to eliminate timing >> issues. >> >> Cliff > > Thanks for pointing this out. I will add it to my scripts as I make > frequent use of header redirects, they are just so effective. > > Although I should know if I use database-based sessions, I am not sure > as I am not sure what exactly a database-based session is. So, what is that? Standard PHP sessions are stored in flat files on the server. Not conducive to scale-out as the session is local to a specific server, and there can be security issues in a shared hosting environment. One alternative is to store your sessionz in a database. See: http://us.php.net/manual/en/function.session-set-save-handler.php From david at davidmintz.org Mon Jul 2 10:24:30 2007 From: david at davidmintz.org (David Mintz) Date: Mon, 2 Jul 2007 10:24:30 -0400 Subject: [nycphp-talk] Zend Framework 1.0 released Message-ID: <721f1cc50707020724x4db023ffj34a37cdbfbcad9c8@mail.gmail.com> I suppose you guys have already heard about this: http://devzone.zend.com/article/2262-Zend-Framework-1.0.0-production-release but I haven't seen anything about on this list yet. -- David Mintz http://davidmintz.org/ "Our universe is just one of those things that happens from time to time." --- an unidentified cosmologist -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Mon Jul 2 10:58:01 2007 From: ramons at gmx.net (David Krings) Date: Mon, 02 Jul 2007 10:58:01 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: References: Message-ID: <46891279.5030800@gmx.net> Cliff Hirsch wrote: >> Although I should know if I use database-based sessions, I am not sure >> as I am not sure what exactly a database-based session is. So, what is that? > > Standard PHP sessions are stored in flat files on the server. Not conducive > to scale-out as the session is local to a specific server, and there can be > security issues in a shared hosting environment. One alternative is to store > your sessionz in a database. > > See: http://us.php.net/manual/en/function.session-set-save-handler.php > Aha! So, if I'd have multiple servers and want to carry a session from one server to the next I could do so via a database assuming that the servers each have access to it. Now that's clever! Writing to each own's database will keep the session stuff separated for shared hosting. Good to know. And again, NYPHP in persona of Cliff Hirsh made me a smarter person. Thanks! David From chsnyder at gmail.com Mon Jul 2 12:05:09 2007 From: chsnyder at gmail.com (csnyder) Date: Mon, 2 Jul 2007 12:05:09 -0400 Subject: [nycphp-talk] (no subject) In-Reply-To: <20070701.215701.25801.0@webmail14.dca.untd.com> References: <20070701.215701.25801.0@webmail14.dca.untd.com> Message-ID: On 7/1/07, tuon1 at netzero.net wrote: > > $LoginName = $_POST['Username']; //Get user id from the login form > $LoginPass = $_POST['Password']; //Get user password from the login > form > > > //Search in a table for valid users: Customer_Table > $Query = "SELECT `LoginNameCol`, `PasswordCol` FROM `Customer_Table` > WHERE `LoginNameCol` = '$LoginName' AND > `PasswordCol` = '$LoginPass' "; > $Result = mysql_query($Query); Unfortunately your script allows anyone to log in, because you're not escaping user input before sending it to MySQL. If $_POST['Password'] is "foo' OR '1'='1", the query will always return a result, and the user will be logged in. Please always remember to use mysql_real_escape_string() on user-submitted values before using them in a MySQL query. Perhaps your application is deployed in an environment that has magic_quotes turned on, in which case it won't be vulnerable to the example attack, but it is considered bad form to rely on that feature. -- Chris Snyder http://chxo.com/ From nate at cakephp.org Mon Jul 2 12:09:46 2007 From: nate at cakephp.org (Nate Abele) Date: Mon, 2 Jul 2007 12:09:46 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: <20070702155225.1A29710A806D@cakephp.org> References: <20070702155225.1A29710A806D@cakephp.org> Message-ID: > Cliff Hirsch wrote: >>> Although I should know if I use database-based sessions, I am not >>> sure >>> as I am not sure what exactly a database-based session is. So, >>> what is that? >> >> Standard PHP sessions are stored in flat files on the server. Not >> conducive >> to scale-out as the session is local to a specific server, and >> there can be >> security issues in a shared hosting environment. One alternative >> is to store >> your sessionz in a database. >> >> See: http://us.php.net/manual/en/function.session-set-save- >> handler.php >> > Aha! So, if I'd have multiple servers and want to carry a session from > one server to the next I could do so via a database assuming that the > servers each have access to it. Now that's clever! > Writing to each own's database will keep the session stuff > separated for > shared hosting. Good to know. > > And again, NYPHP in persona of Cliff Hirsh made me a smarter person. > > Thanks! > > David Just FYI, CakePHP allows you to switch between flat-file and database driven sessions with a single configuration setting. ;-) It also allows you to drop in additional session storage engines. - Nate From anoland at indigente.net Mon Jul 2 12:11:14 2007 From: anoland at indigente.net (Adrian Noland) Date: Mon, 2 Jul 2007 12:11:14 -0400 Subject: [nycphp-talk] When to close a mysql connection In-Reply-To: <468711D0.2060101@gmx.net> References: <46840B21.6000205@gmx.net> <46841AFE.6040109@gmail.com> <026301c7b9c4$ebe35020$6b01a8c0@gamebox> <46842BBD.80802@gmx.net> <46866C49.4060208@gmail.com> <4686717A.6030507@gmx.net> <4686F530.9060209@gmail.com> <468711D0.2060101@gmx.net> Message-ID: <1d8a0e930707020911n42f8f960v89b4751f4890cff8@mail.gmail.com> Persistent connections need to be used with care. The following article explains some problems: http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/ Additionally, the default configurations for PHP, Apache and MySQL don't lend themselves well to persistent connections. One disparity that will bite you in the end is the default timeout to close the connection. MySQL's default timeout is 8 hours. The expected environment is a desktop client that will re-use the same connection again and again. HTTP does not work the same way. If you wind up with several orphaned connections to the DB server they will just sit around waiting for nothing until the connection times out. This will use up all your available connections. Another configuration issue is the number of MySQL connections need to match the number of threads/processes configured for Apache. http://us.php.net/manual/en/features.persistent-connections.php "You are probably using a multi-process web server such as Apache. Since database connections cannot be shared among different processes a new one is created if the request happen to come to a different web server child process." Adrian -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonbaer at jonbaer.com Mon Jul 2 12:28:21 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Mon, 2 Jul 2007 12:28:21 -0400 Subject: [nycphp-talk] Zend Framework 1.0 released In-Reply-To: <721f1cc50707020724x4db023ffj34a37cdbfbcad9c8@mail.gmail.com> References: <721f1cc50707020724x4db023ffj34a37cdbfbcad9c8@mail.gmail.com> Message-ID: I have a tiny small gripe about it, look @ all the things which are left in the incubator folder ... Im all for showcasing new stuff but it should be out of the !core! distro to avoid confusion and temptation to use. public function __construct($date, $locale, $parameter) { throw new Zend_Date_Exception('Calendar class yet not implemented... will be done when Zend_Date is ready!'); } I was not expecting that folder to be there when I downloaded the release, I had hoped they would have been ready to use. - Jon On Jul 2, 2007, at 10:24 AM, David Mintz wrote: > I suppose you guys have already heard about this: > > http://devzone.zend.com/article/2262-Zend-Framework-1.0.0- > production-release > > but I haven't seen anything about on this list yet. > -- > David Mintz > http://davidmintz.org/ > > "Our universe is just one of those things that happens from time to > time." > --- an unidentified cosmologist > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at davidmintz.org Mon Jul 2 13:21:29 2007 From: david at davidmintz.org (David Mintz) Date: Mon, 2 Jul 2007 13:21:29 -0400 Subject: [nycphp-talk] Zend Framework 1.0 released In-Reply-To: References: <721f1cc50707020724x4db023ffj34a37cdbfbcad9c8@mail.gmail.com> Message-ID: <721f1cc50707021021w3afe4313ubebf2423a51b3e78@mail.gmail.com> That's just one of a number of things that some people are upset about. And it does have its learning curve, and there are some apparent oddities that I do not grok. And yet, still, in my ever so humble opinion, this is the FW that looks most promising. The MVC is idiot-simple to set up, and it's easy to take pieces a la carte -- you aren't bound to adopt a whole monolithic package. Of course lots of FWs claim this flexibility but this one really does seem pretty loose. The documentation, while not bug-free or beyond criticism, is extensive and detailed. There are lots of tasty classes with tons of power and convenience. I like. On 7/2/07, Jon Baer wrote: > > I have a tiny small gripe about it, look @ all the things which are left > in the incubator folder ... > > Im all for showcasing new stuff but it should be out of the !core! distro > to avoid confusion and temptation to use. > > public function __construct($date, $locale, $parameter) > { > throw new Zend_Date_Exception('Calendar class yet not > implemented... will be done when Zend_Date is ready!'); > } > > I was not expecting that folder to be there when I downloaded the release, > I had hoped they would have been ready to use. > > - Jon > > On Jul 2, 2007, at 10:24 AM, David Mintz wrote: > > I suppose you guys have already heard about this: > > > http://devzone.zend.com/article/2262-Zend-Framework-1.0.0-production-release > > but I haven't seen anything about on this list yet. > -- > David Mintz > http://davidmintz.org/ > > "Our universe is just one of those things that happens from time to time." > > --- an unidentified cosmologist > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- David Mintz http://davidmintz.org/ "Our universe is just one of those things that happens from time to time." --- an unidentified cosmologist -------------- next part -------------- An HTML attachment was scrubbed... URL: From cliff at pinestream.com Mon Jul 2 15:07:43 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Mon, 02 Jul 2007 15:07:43 -0400 Subject: [nycphp-talk] More type casting help Message-ID: in_array($value, $options, true) solves issues with type conversion (like ?foobar? == (int)0) But what about the equivalent for a key search? array_key_exists ( mixed key, array search ) performs automatic type conversion ? evil. I came up with: count(array_keys($options, $value, true)) === 0 Any other ideas? Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From cliff at pinestream.com Mon Jul 2 15:11:34 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Mon, 02 Jul 2007 15:11:34 -0400 Subject: [nycphp-talk] More type casting help In-Reply-To: Message-ID: Ignore my solution ? hasty and wrong. On 7/2/07 3:07 PM, "Cliff Hirsch" wrote: > in_array($value, $options, true) solves issues with type conversion (like > ?foobar? == (int)0) > > But what about the equivalent for a key search? > > array_key_exists ( mixed key, array search ) performs automatic type > conversion ? evil. > > I came up with: count(array_keys($options, $value, true)) === 0 > > Any other ideas? > > Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From preinheimer at gmail.com Mon Jul 2 21:45:13 2007 From: preinheimer at gmail.com (Paul Reinheimer) Date: Mon, 2 Jul 2007 21:45:13 -0400 Subject: [nycphp-talk] Rely on destructor to be called?! In-Reply-To: <468407F0.6090909@gmail.com> References: <468407F0.6090909@gmail.com> Message-ID: <6ec19ec70707021845r4e283215se80e35980d728c7a@mail.gmail.com> So just to ensure that I haven't forgotten something? Is there any other > situation where it's not invoked? > It might depend on the setting for ignore_user_abort, if that's off, and the user aborts the request I'm not sure if/how the destructors are called. paul -- Paul Reinheimer Zend Certified Engineer -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Tue Jul 3 09:49:44 2007 From: ramons at gmx.net (David Krings) Date: Tue, 03 Jul 2007 09:49:44 -0400 Subject: [nycphp-talk] Length of variable names Message-ID: <468A53F8.4080108@gmx.net> Hi! Is there any (noticeable) difference between using short variable names and long ones? I rather use variable names such as $firstnamecounter than just $i, $john, or $doe (I've seen code where the developer used almost exclusively his first and last name for just about everything). I try to give each important variable a name that is descriptive and unique within my project so that I can name the same thing by the same name across multiple scripts. I just wonder if I should get used to a different naming convention now that my projects get more complex. David From ramons at gmx.net Tue Jul 3 09:54:14 2007 From: ramons at gmx.net (David Krings) Date: Tue, 03 Jul 2007 09:54:14 -0400 Subject: [nycphp-talk] Text control for PHP Message-ID: <468A5506.9030209@gmx.net> Hi! Can anyone recommend a text control for use with PHP? Ideally one that can be integrated in an HTML form and that produces an HTML formatted string. Or anything else that is easy to use and works (of course). Thanks in advance, David From gatzby3jr at gmail.com Tue Jul 3 10:02:03 2007 From: gatzby3jr at gmail.com (Brian O'Connor) Date: Tue, 3 Jul 2007 10:02:03 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <468A53F8.4080108@gmx.net> References: <468A53F8.4080108@gmx.net> Message-ID: <29da5d150707030702g1357362aka332e03209bd9d84@mail.gmail.com> Usually I like to give my variables descriptive names, but in the shortest way possible. However, with regards to $i being the counter, that's a pretty common coding practice ($i being used to increment, and usually $j being the next variable (I believe because its after i in the alphabet but if there's an actual reason beyond that I'd like to know). It's used because it's short (one letter) and almost everybody knows what it does. I also don't think there's ever a time to just use your first and last name (or at all, for that matter) as variables, unless somehow those were descriptive of what they hold (doubtful). There are, however many standards that people use for variable naming. camelCasing is one of them (first letter of each 'word' in your variable name is capitalized except for the first), which I like to use. Other people prefer the underscore notation, where each word is seperated by an underscore (ie my_variable_name). Other things include Instance variables in classes. Although not so useful in PHP (and other languages that require you to prefix instance variables with something [$this->]), some people prefix instance variables with an underscore, or sometimes 'm_', for member. Global variables are usually all capital letters with underscores between words (MY_GLOBAL_VARIABLE). These are just some standards however, and there is much debate around them. Some languages also have different standards than other (C# comes to mind with function names starting with a capital letter, rather than most that say start with a lower letter). The best is really to be able to adapt to different projects if you join midway, and if you start your own, make sure you're consistent. On 7/3/07, David Krings wrote: > > Hi! > > Is there any (noticeable) difference between using short variable names > and long ones? I rather use variable names such as $firstnamecounter > than just $i, $john, or $doe (I've seen code where the developer used > almost exclusively his first and last name for just about everything). > I try to give each important variable a name that is descriptive and > unique within my project so that I can name the same thing by the same > name across multiple scripts. > > I just wonder if I should get used to a different naming convention now > that my projects get more complex. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Brian O'Connor -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonbaer at jonbaer.com Tue Jul 3 10:05:49 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Tue, 3 Jul 2007 10:05:49 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <468A53F8.4080108@gmx.net> References: <468A53F8.4080108@gmx.net> Message-ID: Should probably stick w/ Zend coding standards ... http://framework.zend.com/manual/en/coding-standard.naming- conventions.html#coding-standard.naming-conventions.variables But I think all you really need to do is answer the question, "If someone else were to takeover my code would they understand it @ first glance". Ive had people come back to me three or four times when I first started PHP and realized time to change the way the code looks/feels. Ehh not to say it still doesn't happen, maybe less frequently :-) - Jon On Jul 3, 2007, at 9:49 AM, David Krings wrote: > Hi! > > Is there any (noticeable) difference between using short variable > names and long ones? I rather use variable names such as > $firstnamecounter than just $i, $john, or $doe (I've seen code > where the developer used almost exclusively his first and last name > for just about everything). > I try to give each important variable a name that is descriptive > and unique within my project so that I can name the same thing by > the same name across multiple scripts. > > I just wonder if I should get used to a different naming convention > now that my projects get more complex. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From selyah1 at yahoo.com Tue Jul 3 10:48:39 2007 From: selyah1 at yahoo.com (selyah) Date: Tue, 3 Jul 2007 07:48:39 -0700 (PDT) Subject: [nycphp-talk] insertgoto statement Message-ID: <105188.73651.qm@web30811.mail.mud.yahoo.com> Hi All: I am in the process of creating a php script that adds a item to a database. This script works fine. The portion that i am asking assistance for is, after adding the item to the database, I am not sure how to use the i #insertgoto for the newly added item to be displayed in a view page script. I looked at dreamweaver on examples, but this from DM is a bit confusing. could someone please show an example of using this command in a more simplistic fashion. Thanks very much -------------- next part -------------- An HTML attachment was scrubbed... URL: From anoland at indigente.net Tue Jul 3 12:25:24 2007 From: anoland at indigente.net (Adrian Noland) Date: Tue, 3 Jul 2007 12:25:24 -0400 Subject: [nycphp-talk] Text control for PHP In-Reply-To: <468A5506.9030209@gmx.net> References: <468A5506.9030209@gmx.net> Message-ID: <1d8a0e930707030925t66d9b913w209d9344de866448@mail.gmail.com> Text control? What do you mean? Something like tinyMCE or FCKeditor? http://tinymce.moxiecode.com/ http://www.fckeditor.net/ On 7/3/07, David Krings wrote: > > Hi! > > Can anyone recommend a text control for use with PHP? Ideally one that > can be integrated in an HTML form and that produces an HTML formatted > string. > > Or anything else that is easy to use and works (of course). > > Thanks in advance, > > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dirn at dirnonline.com Tue Jul 3 12:41:19 2007 From: dirn at dirnonline.com (Andy Dirnberger) Date: Tue, 3 Jul 2007 12:41:19 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <468A53F8.4080108@gmx.net> References: <468A53F8.4080108@gmx.net> Message-ID: <006401c7bd90$fc4d4090$6301a8c0@dirnpc> I had a professor back in college who told a story about a program he received from a student in which each variable was the name of a beer. The student had done such a good job documenting it, though, that the purpose of each variable was easily understood. To get back on topic, Hungarian Notation is one way of prefixing variables (does anyone still use it though?). http://web.umr.edu/~cpp/common/hungarian.html The important thing to keep in mind is to be consistent in your conventions. It will make things easier for someone (even you) reading your code. As far as i goes, I've always assumed it was just shorthand for something like index or increment. Nested for loops are often then controlled with j and then k. You can use these with confidence that people will understand the meaning. But if you feel more comfortable using a variable called $counter than one called $i, by all means do so. There are plenty of people out there who refuse to use i. > -----Original Message----- > From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On > Behalf Of David Krings > Sent: Tuesday, July 03, 2007 9:50 AM > To: NYPHP Talk > Subject: [nycphp-talk] Length of variable names > > Hi! > > Is there any (noticeable) difference between using short variable names > and long ones? I rather use variable names such as $firstnamecounter > than just $i, $john, or $doe (I've seen code where the developer used > almost exclusively his first and last name for just about everything). > I try to give each important variable a name that is descriptive and > unique within my project so that I can name the same thing by the same > name across multiple scripts. > > I just wonder if I should get used to a different naming convention now > that my projects get more complex. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From kenrbnsn at rbnsn.com Tue Jul 3 13:13:05 2007 From: kenrbnsn at rbnsn.com (Ken Robinson) Date: Tue, 03 Jul 2007 13:13:05 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <006401c7bd90$fc4d4090$6301a8c0@dirnpc> References: <468A53F8.4080108@gmx.net> <006401c7bd90$fc4d4090$6301a8c0@dirnpc> Message-ID: <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> Quoting Andy Dirnberger : > As far as i goes, I've always assumed it was just shorthand for something > like index or increment. Nested for loops are often then controlled with j > and then k. You can use these with confidence that people will understand > the meaning. But if you feel more comfortable using a variable called > $counter than one called $i, by all means do so. There are plenty of people > out there who refuse to use i. The use of variable names like $i, $j, $k, etc for counters is a hold over from early Fortran which declared that only variables starting with certain letters could be integers. The first letter was "i". I seem to remember that only the letters i, j, l, l, m, n were used for integer variables, so the use quickly became a "standard" and it's been carried over into other languages through the use of examples written by old time programmers. Ken From lists at enobrev.com Tue Jul 3 14:01:39 2007 From: lists at enobrev.com (Mark Armendariz) Date: Tue, 3 Jul 2007 14:01:39 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> References: <468A53F8.4080108@gmx.net> <006401c7bd90$fc4d4090$6301a8c0@dirnpc> <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> Message-ID: <009801c7bd9c$3507f410$0300a8c0@enobrev> > From: talk-bounces at lists.nyphp.org > [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Ken Robinson > The use of variable names like $i, $j, $k, etc for counters > is a hold over from early Fortran which declared that only > variables starting with certain letters could be integers. > The first letter was "i". I seem to remember that only the > letters i, j, l, l, m, n were used for integer variables, so > the use quickly became a "standard" and it's been carried > over into other languages through the use of examples written > by old time programmers. > > Ken All this time I'd thought it meant 'index' and was specifically to keep loops short and sweet - and then j, k, etc just incrementally from index. Thanks for info, Ken. As for hungarian notation, I have my own similar convention that I try to use everywhere (php, javascript, actionscript, python, etc). I picked it up from the developers at Cuban Council in SF. A is array, I int, O is object, etc. My own addition to their convention is to make array counts an integer with the same name as the array: $aEmployees = $oEmployees->getAll(); $iEmployees = count($aEmployees); May be hard to read for some, as it probably just looks like 4 of the same variable, but for my own internal cpu, I can see I have 3 related variables all with their own specific purpose. It does very well for me, though everyone has their habits for good or not. Mark From dirn at dirnonline.com Tue Jul 3 14:13:18 2007 From: dirn at dirnonline.com (Andy Dirnberger) Date: Tue, 3 Jul 2007 14:13:18 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> References: <468A53F8.4080108@gmx.net> <006401c7bd90$fc4d4090$6301a8c0@dirnpc> <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> Message-ID: <008e01c7bd9d$d637ba40$6301a8c0@dirnpc> Ken, Thanks. Looks like a lot of us just learned something new today. DiRN > -----Original Message----- > From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On > Behalf Of Ken Robinson > Sent: Tuesday, July 03, 2007 1:13 PM > To: talk at lists.nyphp.org > Subject: RE: [nycphp-talk] Length of variable names > > Quoting Andy Dirnberger : > > > As far as i goes, I've always assumed it was just shorthand for something > > like index or increment. Nested for loops are often then controlled with j > > and then k. You can use these with confidence that people will understand > > the meaning. But if you feel more comfortable using a variable called > > $counter than one called $i, by all means do so. There are plenty of people > > out there who refuse to use i. > > The use of variable names like $i, $j, $k, etc for counters is a hold > over from early Fortran which declared that only variables starting > with certain letters could be integers. The first letter was "i". I > seem to remember that only the letters i, j, l, l, m, n were used for > integer variables, so the use quickly became a "standard" and it's > been carried over into other languages through the use of examples > written by old time programmers. > > Ken > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From ramons at gmx.net Tue Jul 3 16:48:25 2007 From: ramons at gmx.net (David Krings) Date: Tue, 03 Jul 2007 16:48:25 -0400 Subject: [nycphp-talk] Text control for PHP In-Reply-To: <1d8a0e930707030925t66d9b913w209d9344de866448@mail.gmail.com> References: <468A5506.9030209@gmx.net> <1d8a0e930707030925t66d9b913w209d9344de866448@mail.gmail.com> Message-ID: <468AB619.4060805@gmx.net> Adrian Noland wrote: > Text control? What do you mean? Something like tinyMCE or FCKeditor? > http://tinymce.moxiecode.com/ > http://www.fckeditor.net/ > That is spot on! Thank you very much! David From tedd at sperling.com Tue Jul 3 19:17:26 2007 From: tedd at sperling.com (tedd) Date: Tue, 3 Jul 2007 19:17:26 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> References: <468A53F8.4080108@gmx.net> <006401c7bd90$fc4d4090$6301a8c0@dirnpc> <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> Message-ID: At 1:13 PM -0400 7/3/07, Ken Robinson wrote: >Quoting Andy Dirnberger : > >>As far as i goes, I've always assumed it was just shorthand for something >>like index or increment. Nested for loops are often then controlled with j >>and then k. You can use these with confidence that people will understand >>the meaning. But if you feel more comfortable using a variable called >>$counter than one called $i, by all means do so. There are plenty of people >>out there who refuse to use i. > >The use of variable names like $i, $j, $k, etc for counters is a >hold over from early Fortran which declared that only variables >starting with certain letters could be integers. The first letter >was "i". I seem to remember that only the letters i, j, l, l, m, n >were used for integer variables, so the use quickly became a >"standard" and it's been carried over into other languages through >the use of examples written by old time programmers. > >Ken Hey, let's watch those "old programmer" remarks, because some of us are still around. But, you are right about the i, j, k, l, m, n integer thing as a legacy from FORTRAN. Oh, those were the good old days when programming was more like adventures in key punching. Where you would drop off a large stack of IBM cards one day and then pick up a few reams of paper the next day with all your key punching errors. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From ramons at gmx.net Tue Jul 3 20:09:58 2007 From: ramons at gmx.net (David Krings) Date: Tue, 03 Jul 2007 20:09:58 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: References: <468A53F8.4080108@gmx.net> <006401c7bd90$fc4d4090$6301a8c0@dirnpc> <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> Message-ID: <468AE556.3020302@gmx.net> tedd wrote: > Hey, let's watch those "old programmer" remarks, because some of us are > still around. But, you are right about the i, j, k, l, m, n integer > thing as a legacy from FORTRAN. Oh, those were the good old days when > programming was more like adventures in key punching. Where you would > drop off a large stack of IBM cards one day and then pick up a few reams > of paper the next day with all your key punching errors. Not any different today. I write some PHP code and need until the next day to figure out all the runtime errors. ;) I talked today with a developer and the talk came across functions and modular code. He thought it is something "new", but I learned about that 20 years ago programming LOGO on the C64. LOGO is a nice language to pick up the basics, but at least the C64 version was more a NOGO. Although, the turtle was cute, looked like a triangle... BUT...back to the original question, does the length of a variable name have any impact on performance or such? David From d.ananyev at gmail.com Tue Jul 3 22:44:03 2007 From: d.ananyev at gmail.com (=?KOI8-R?B?5M3J1NLJyiDhzsHO2MXX?=) Date: Wed, 4 Jul 2007 06:44:03 +0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <468AE556.3020302@gmx.net> References: <468A53F8.4080108@gmx.net> <006401c7bd90$fc4d4090$6301a8c0@dirnpc> <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> <468AE556.3020302@gmx.net> Message-ID: <5ee48e770707031944n6aab1db4i2c254337af9a0eee@mail.gmail.com> > > > BUT...back to the original question, does the length of a variable name > have any impact on performance or such? Hi. In older php versions it does. Variables with long names was much slower then with short names. But in php5 i am not sure if this problem exists. And it is very simple to determine, just test it with a small script accessing short and long variables. -- ? ?????????, ??????? ??????? d.ananyev at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From d.ananyev at gmail.com Tue Jul 3 22:47:48 2007 From: d.ananyev at gmail.com (=?KOI8-R?B?5M3J1NLJyiDhzsHO2MXX?=) Date: Wed, 4 Jul 2007 06:47:48 +0400 Subject: [nycphp-talk] Text control for PHP In-Reply-To: <468AB619.4060805@gmx.net> References: <468A5506.9030209@gmx.net> <1d8a0e930707030925t66d9b913w209d9344de866448@mail.gmail.com> <468AB619.4060805@gmx.net> Message-ID: <5ee48e770707031947x2df131f5m1657fd5df6c5633a@mail.gmail.com> Hi. And take a look at this links http://www.geniisoft.com/showcase.nsf/WebEditors http://htmlarea.com/directory/Web_Software_Components/WYSIWYG_Editors/ -- ? ?????????, ??????? ??????? d.ananyev at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tedd at sperling.com Wed Jul 4 10:02:09 2007 From: tedd at sperling.com (tedd) Date: Wed, 4 Jul 2007 10:02:09 -0400 Subject: [nycphp-talk] Length of variable names In-Reply-To: <468AE556.3020302@gmx.net> References: <468A53F8.4080108@gmx.net> <006401c7bd90$fc4d4090$6301a8c0@dirnpc> <20070703131305.oautd6b6jw4ks88w@www.rbnsn.com> <468AE556.3020302@gmx.net> Message-ID: At 8:09 PM -0400 7/3/07, David Krings wrote: >BUT...back to the original question, does the length of a variable >name have any impact on performance or such? Does the length of variable names have any impact on performance? I doubt it, but it should be easy enough to prove. Just write two routines -- one with short names and one with long and have them run a set time (perhaps years) and compare their performance. Does the length of variable names have any impact on such? If you're the programmer reviewing/maintaining someone else's code, I would say "Yes, it does." Both too cryptic and too long makes code difficult to read. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From rick at click-rick.net Wed Jul 4 12:45:28 2007 From: rick at click-rick.net (Rick Retzko) Date: Wed, 4 Jul 2007 12:45:28 -0400 Subject: [nycphp-talk] Using PHP for a Stand-Alone application Message-ID: <009d01c7be5a$bb8e55b0$6600a8c0@adam> Hi All - I've developed a web-based audition registration application for musical organizations (All-State Chorus, Regional Band, etc). The application has been well received, but some organizations are too small to benefit from the web orientation and have asked if the application could be provided in a single-user version without hosting. I'm exploring how to rewrite the app in PHP5 using sqlite as the backend database, but haven't figured out how to package the code so that it can be loaded onto another PC without the need to install and configure an Apache server for each user. My prospective clients will not be PC-literate beyond medium-weight spreadsheet usage. Any and all thoughts are most appreciated! Best Regards - Rick ============ MFR Holdings, LLC rick at click-rick.net 201.755.4083 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Wed Jul 4 13:08:27 2007 From: ramons at gmx.net (David Krings) Date: Wed, 04 Jul 2007 13:08:27 -0400 Subject: [nycphp-talk] Using PHP for a Stand-Alone application In-Reply-To: <009d01c7be5a$bb8e55b0$6600a8c0@adam> References: <009d01c7be5a$bb8e55b0$6600a8c0@adam> Message-ID: <468BD40B.5070304@gmx.net> Rick Retzko wrote: > Hi All ? > > I?ve developed a web-based audition registration application for musical > organizations (All-State Chorus, Regional Band, etc). The application > has been well received, but some organizations are too small to benefit > from the web orientation and have asked if the application could be > provided in a single-user version without hosting. > > > > I?m exploring how to rewrite the app in PHP5 using sqlite as the backend > database, but haven?t figured out how to package the code so that it can > be loaded onto another PC without the need to install and configure an > Apache server for each user. My prospective clients will not be > PC-literate beyond medium-weight spreadsheet usage. > > > > Any and all thoughts are most appreciated! > There are several stand-alone web servers available for free that are optimized to run with PHP. WebSrv from Luckasoft comes to mind, which has a nice installer that loads the latest PHP distribution and installs it. I am sure that you could package this up or at least create some simple documentation for installing the server and your code. If the users leave the defaults in place you can create a self-extracting ZIP that writes the files to the right place. You can get the EnginSite WebSrv from here: http://luckasoft.com/download/websrv.exe I always use Apachefriend's XAMPP, which installs nicely, but not in a way I think a novice can deal with it, but it does not need any configuration. Or, you can make a 'real' desktop application using PHP and GTK (see http://gtk.php.net/). You could also use a real installer such as INNO Setup or the one from NullSoft (both freeware IIRC). That puts the burden on you and you need to make sure that everything installs right. Or you can make a video / simulation showing how to install everything. HTH, David From tom at supertom.com Wed Jul 4 13:31:23 2007 From: tom at supertom.com (Tom Melendez) Date: Wed, 4 Jul 2007 10:31:23 -0700 Subject: [nycphp-talk] Using PHP for a Stand-Alone application In-Reply-To: <009d01c7be5a$bb8e55b0$6600a8c0@adam> References: <009d01c7be5a$bb8e55b0$6600a8c0@adam> Message-ID: <117286890707041031s33fc20dq8e9b5feba4409c03@mail.gmail.com> Hi Rick, On 7/4/07, Rick Retzko wrote: > > Hi All ? > > I've developed a web-based audition registration application for musical > organizations (All-State Chorus, Regional Band, etc). The application has > been well received, but some organizations are too small to benefit from the > web orientation and have asked if the application could be provided in a > single-user version without hosting. > Not the answer you want, but I would address this as a business model issue. Everything that isn't web based today will probably be tomorrow. If I'm "reading into" your statement correctly they seem to have an issue with the hosting cost. The answer then, is, to reduce or replace the hosting cost. Build it into the support costs perhaps. If they don't want recurring fees then build it into license cost (with an availability cap of say, 3 years). Keeping it web-based will benefit you both in many ways, including: - Deployment - Support (if they have internet access and a web browser it should work, no PC issues to worry about) - One code base - They can access the application anywhere and one day, not too far from now, they'll want to. - tons more which I'm sure you've heard before I'm exploring how to rewrite the app in PHP5 using sqlite as the backend > database, but haven't figured out how to package the code so that it can be > loaded onto another PC without the need to install and configure an Apache > server for each user. My prospective clients will not be PC-literate beyond > medium-weight spreadsheet usage. > See above, this is only more work (and a lot more work at that) for you with no real benefit IMO. You now have the issues of backups, upgrades, support, maintenance, security fixes on individual, possibly not-internet-connected machines for which you probably can't charge for. The computer-illiteracy of your clients is even more of a reason to keep it web-based as they don't want to deal with this stuff, either. HTH, Tom http://www.liphp.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonbaer at jonbaer.com Wed Jul 4 14:03:59 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Wed, 4 Jul 2007 14:03:59 -0400 Subject: [nycphp-talk] Using PHP for a Stand-Alone application In-Reply-To: <009d01c7be5a$bb8e55b0$6600a8c0@adam> References: <009d01c7be5a$bb8e55b0$6600a8c0@adam> Message-ID: <99810425-D6CD-49CF-AD57-B9293607AF50@jonbaer.com> I think its fair to say that PHP is definitely not a standalone friendly language, the best effort I have seen is something like Phar format but even then you need to bring the kitchen sink to each client and its not a format built into PHP itself (shame). It's sad that there is not anything like a small lightweight portable vm you can run around with, there is a project called Slingshot in Ruby/Rails which is the idea, a "web browser" with your embedded web app. I think this issue is what Adobe AIR is trying to showcase. If the code is possibly doable where it is just really data access, you might look to port your code to Javascript and the client: Firefox with GoogleGears installed. http://code.google.com/apis/gears/ You can seriously get away with writting a full blown data app w/ just a single html file and few lines of Javascript. Im not sure but I think trying for a single "master" table and then having some mechanism for getting all the "slave" sqlite databases and merging (or copy to master) is a piece that is missing for this solution. - Jon On Jul 4, 2007, at 12:45 PM, Rick Retzko wrote: > Hi All ? > > I?ve developed a web-based audition registration application for > musical organizations (All-State Chorus, Regional Band, etc). The > application has been well received, but some organizations are too > small to benefit from the web orientation and have asked if the > application could be provided in a single-user version without > hosting. > > > > I?m exploring how to rewrite the app in PHP5 using sqlite as the > backend database, but haven?t figured out how to package the code > so that it can be loaded onto another PC without the need to > install and configure an Apache server for each user. My > prospective clients will not be PC-literate beyond medium-weight > spreadsheet usage. > > > > Any and all thoughts are most appreciated! > > > > Best Regards - > > > > Rick > > ============ > > MFR Holdings, LLC > > rick at click-rick.net > > 201.755.4083 > > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonbaer at jonbaer.com Wed Jul 4 15:35:57 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Wed, 4 Jul 2007 15:35:57 -0400 Subject: [nycphp-talk] Using PHP for a Stand-Alone application In-Reply-To: <99810425-D6CD-49CF-AD57-B9293607AF50@jonbaer.com> References: <009d01c7be5a$bb8e55b0$6600a8c0@adam> <99810425-D6CD-49CF-AD57-B9293607AF50@jonbaer.com> Message-ID: <58BF677C-E045-45ED-93F8-D4586D07E648@jonbaer.com> Forgot to paste the second link ... good in-depth article for Gears ... http://www.onlamp.com/lpt/a/7055 - Jon On Jul 4, 2007, at 2:03 PM, Jon Baer wrote: > I think its fair to say that PHP is definitely not a standalone > friendly language, the best effort I have seen is something like > Phar format but even then you need to bring the kitchen sink to > each client and its not a format built into PHP itself (shame). > > It's sad that there is not anything like a small lightweight > portable vm you can run around with, there is a project called > Slingshot in Ruby/Rails which is the idea, a "web browser" with > your embedded web app. I think this issue is what Adobe AIR is > trying to showcase. > > If the code is possibly doable where it is just really data access, > you might look to port your code to Javascript and the client: > Firefox with GoogleGears installed. > > http://code.google.com/apis/gears/ > > You can seriously get away with writting a full blown data app w/ > just a single html file and few lines of Javascript. Im not sure > but I think trying for a single "master" table and then having some > mechanism for getting all the "slave" sqlite databases and merging > (or copy to master) is a piece that is missing for this solution. > > - Jon > > On Jul 4, 2007, at 12:45 PM, Rick Retzko wrote: > >> Hi All ? >> >> I?ve developed a web-based audition registration application for >> musical organizations (All-State Chorus, Regional Band, etc). The >> application has been well received, but some organizations are too >> small to benefit from the web orientation and have asked if the >> application could be provided in a single-user version without >> hosting. >> >> >> >> I?m exploring how to rewrite the app in PHP5 using sqlite as the >> backend database, but haven?t figured out how to package the code >> so that it can be loaded onto another PC without the need to >> install and configure an Apache server for each user. My >> prospective clients will not be PC-literate beyond medium-weight >> spreadsheet usage. >> >> >> >> Any and all thoughts are most appreciated! >> >> >> >> Best Regards - >> >> >> >> Rick >> >> ============ >> >> MFR Holdings, LLC >> >> rick at click-rick.net >> >> 201.755.4083 >> >> >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php > From anoland at indigente.net Thu Jul 5 09:00:47 2007 From: anoland at indigente.net (Adrian Noland) Date: Thu, 5 Jul 2007 09:00:47 -0400 Subject: [nycphp-talk] Using PHP for a Stand-Alone application In-Reply-To: <117286890707041031s33fc20dq8e9b5feba4409c03@mail.gmail.com> References: <009d01c7be5a$bb8e55b0$6600a8c0@adam> <117286890707041031s33fc20dq8e9b5feba4409c03@mail.gmail.com> Message-ID: <1d8a0e930707050600o59c7fc92tf7633737c03a3dbd@mail.gmail.com> While I agree with everything Tom said, if you really *must* have a web server, check out nanoweb. A web server written in PHP. http://nanoweb.si.kz/manual/ On 7/4/07, Tom Melendez wrote: > > Hi Rick, > > On 7/4/07, Rick Retzko wrote: > > > > Hi All ? > > > > I've developed a web-based audition registration application for musical > > organizations (All-State Chorus, Regional Band, etc). The application has > > been well received, but some organizations are too small to benefit from the > > web orientation and have asked if the application could be provided in a > > single-user version without hosting. > > > Not the answer you want, but I would address this as a business model > issue. Everything that isn't web based today will probably be tomorrow. If > I'm "reading into" your statement correctly they seem to have an issue with > the hosting cost. The answer then, is, to reduce or replace the hosting > cost. Build it into the support costs perhaps. If they don't want > recurring fees then build it into license cost (with an availability cap of > say, 3 years). Keeping it web-based will benefit you both in many ways, > including: > - Deployment > - Support (if they have internet access and a web browser it should work, > no PC issues to worry about) > - One code base > - They can access the application anywhere and one day, not too far from > now, they'll want to. > - tons more which I'm sure you've heard before > > I'm exploring how to rewrite the app in PHP5 using sqlite as the backend > > database, but haven't figured out how to package the code so that it can be > > loaded onto another PC without the need to install and configure an Apache > > server for each user. My prospective clients will not be PC-literate beyond > > medium-weight spreadsheet usage. > > > > See above, this is only more work (and a lot more work at that) for you > with no real benefit IMO. You now have the issues of backups, upgrades, > support, maintenance, security fixes on individual, possibly > not-internet-connected machines for which you probably can't charge for. > The computer-illiteracy of your clients is even more of a reason to keep it > web-based as they don't want to deal with this stuff, either. > > HTH, > > Tom > http://www.liphp.org > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsnyder at gmail.com Thu Jul 5 10:49:25 2007 From: chsnyder at gmail.com (csnyder) Date: Thu, 5 Jul 2007 10:49:25 -0400 Subject: [nycphp-talk] Using PHP for a Stand-Alone application In-Reply-To: <117286890707041031s33fc20dq8e9b5feba4409c03@mail.gmail.com> References: <009d01c7be5a$bb8e55b0$6600a8c0@adam> <117286890707041031s33fc20dq8e9b5feba4409c03@mail.gmail.com> Message-ID: On 7/4/07, Tom Melendez wrote: > > See above, this is only more work (and a lot more work at that) for you with > no real benefit IMO. You now have the issues of backups, upgrades, support, > maintenance, security fixes on individual, possibly not-internet-connected > machines for which you probably can't charge for. The computer-illiteracy > of your clients is even more of a reason to keep it web-based as they don't > want to deal with this stuff, either. > Wow, +1. I'm busy trying to wean the .org I work for off of a desktop app because the deployment and support costs are staggering as compared to a web business model. Do you really know what you're getting into deploying to the desktop? In addition to what Tom said, think through how you will release critical updates, particularly if they change the database schema. Are you willing to visit (or at least do remote desktop sessions with) each of your clients to handle the details? What if they customize the app between upgrades? These issues crop up with web deployment as well, obviously, but one deployment on a server (and one monthly hosting fee) could support thousands of users. -- Chris Snyder http://chxo.com/ From ben at projectskyline.com Sat Jul 7 19:13:55 2007 From: ben at projectskyline.com (Ben Sgro (ProjectSkyLine)) Date: Sat, 7 Jul 2007 19:13:55 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> Message-ID: <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> Hey again, So, I had a string of interviews over the last two weeks. I have just hired one candidate that I believe will be a good addition to our company. I ended up using the Joel Spolsky (or whoever coined this) question: I have two variables and I want to switch their values. Some candidates totaly froze, and other's got it quickly. I also showed some source code, a *small* 150L script, and asked them what it did. Not only was it commented, but the function & variable names are extremely obvious. Some looked in awe and said, "this is a small script?" while some took a few minutes and looked over the code, then attempted to explaint to me what it did. Overall, it was a great experiance. I look forward to finding new talent to add to our growing company. Thanks for all the responses and feedback! - Ben Ben Sgro, Chief Engineer ProjectSkyLine - Defining New Horizons +1 718.487.9368 (N.Y. Office) Our company: www.projectskyline.com Our products: www.project-contact.com This e-mail is confidential information intended only for the use of the individual to whom it is addressed. ----- Original Message ----- From: "Steve Manes" To: "NYPHP Talk" Sent: Thursday, June 28, 2007 10:40 AM Subject: Re: [nycphp-talk] Questions to ask at a job interview? > Ben Sgro (ProjectSkyline) wrote: >> Now, the position being filled is that of an entry level programmer. >> I do not expect this person to be well trained in PHP/MySQL, >> but they must have a pretty strong understanding of programming >> methodologies in general (they are a college grad - CIS). >> So, again, what are some good metrics I can use to test these >> perspective employees? > > Start with general logic tasks at the white board, like reversing a string > in place. Then inverting all the words in a sentence like "I really hate > taking tests", then reversing the letters in all the words in a sentence. > This should be done language-agnostic (no strrchr() or reverse()). What > I'm mostly interested in learning is how the applicant problem-solves. > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From ramons at gmx.net Sat Jul 7 20:05:12 2007 From: ramons at gmx.net (David Krings) Date: Sat, 07 Jul 2007 20:05:12 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> Message-ID: <46902A38.6080707@gmx.net> Ben Sgro (ProjectSkyLine) wrote: > Hey again, > > So, I had a string of interviews over the last two weeks. > > I have just hired one candidate that I believe will be a good addition > to our company. > > I ended up using the Joel Spolsky (or whoever coined this) question: > > I have two variables and I want to switch their values. > > Some candidates totaly froze, and other's got it quickly. I'd use a third variable to keep a copy of one variable before basically making both the same first and then assigning the saved to copy to the originally uncopied variable. Did I get hired? No! Well, unless you are desparate... Thanks to Google I now know the answer: $x = $x xor $y; $y = $x xor $y; $x = $x xor $y; I guess this shows that I have no formal programming training. Although, when would anyone want to switch variable values? Just use the one that already has the right value. Saves three lines of code! Same amount of lines is used with a helper variable, but the xor stuff uses less memory. > I also showed some source code, a *small* 150L script, and asked them > what it did. > > Not only was it commented, but the function & variable names are > extremely obvious. Mind sharing that test script with me (us)? I simply want to know how good or bad I am. > Some looked in awe and said, "this is a small script?" while some took a > few minutes > and looked over the code, then attempted to explaint to me what it did. > My record is currently at 761 lines for a script including comments and empty lines. I think 150 isn't huge. > Overall, it was a great experiance. I look forward to finding new talent > to add to our growing > company. > > Thanks for all the responses and feedback! > > - Ben Thanks for asking and sharing with us. And for giving a PHP beginner an awesome opportunity to pick up some more skill. I wish I could spend more time on learning PHP. David David From Consult at CovenantEDesign.com Sat Jul 7 20:11:21 2007 From: Consult at CovenantEDesign.com (CED) Date: Sat, 7 Jul 2007 20:11:21 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com><00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> Message-ID: <002d01c7c0f4$84026090$6401a8c0@ced> I think 150 lines is huge, I want to do it in two. =D -Ed Edward JS Prevost II Me at EdwardPrevost.info www.EdwardPrevost.info ----- Original Message ----- From: "David Krings" To: "NYPHP Talk" Sent: Saturday, July 07, 2007 8:05 PM Subject: Re: [nycphp-talk] Questions to ask at a job interview? > Ben Sgro (ProjectSkyLine) wrote: > > Hey again, > > > > So, I had a string of interviews over the last two weeks. > > > > I have just hired one candidate that I believe will be a good addition > > to our company. > > > > I ended up using the Joel Spolsky (or whoever coined this) question: > > > > I have two variables and I want to switch their values. > > > > Some candidates totaly froze, and other's got it quickly. > > I'd use a third variable to keep a copy of one variable before basically > making both the same first and then assigning the saved to copy to the > originally uncopied variable. > Did I get hired? > No! Well, unless you are desparate... > Thanks to Google I now know the answer: > $x = $x xor $y; > $y = $x xor $y; > $x = $x xor $y; > > I guess this shows that I have no formal programming training. Although, > when would anyone want to switch variable values? Just use the one that > already has the right value. Saves three lines of code! Same amount of > lines is used with a helper variable, but the xor stuff uses less memory. > > > I also showed some source code, a *small* 150L script, and asked them > > what it did. > > > > Not only was it commented, but the function & variable names are > > extremely obvious. > > Mind sharing that test script with me (us)? I simply want to know how > good or bad I am. > > > Some looked in awe and said, "this is a small script?" while some took a > > few minutes > > and looked over the code, then attempted to explaint to me what it did. > > > > My record is currently at 761 lines for a script including comments and > empty lines. I think 150 isn't huge. > > > Overall, it was a great experiance. I look forward to finding new talent > > to add to our growing > > company. > > > > Thanks for all the responses and feedback! > > > > - Ben > > Thanks for asking and sharing with us. And for giving a PHP beginner an > awesome opportunity to pick up some more skill. I wish I could spend > more time on learning PHP. > > > David > > > David > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > > From ben at projectskyline.com Sat Jul 7 21:07:17 2007 From: ben at projectskyline.com (Ben Sgro (ProjectSkyLine)) Date: Sat, 7 Jul 2007 21:07:17 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com><00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> Message-ID: <013301c7c0fc$55540610$0201a8c0@gamebox> Hey again, "I think 150 lines is huge, I want to do it in two. =D" heh. "Although, when would anyone want to switch variable values? Just use the one that already has the right value. Saves three lines of code!" Good point. I just liked the question because it makes them think. "My record is currently at 761 lines for a script including comments and empty lines. I think 150 isn't huge.". So what did you do in those 761L? That script I showed is actually: [sk at tinman dmiid]$ cat mine.php | wc -l 125 Only 125L of code. You can view it here: http://www.projectskyline.com/phplist/mine.txt Its a datamining script. "I wish I could spend more time on learning PHP." Me too. Right now I'm working through, 'PHP5 Objects, Patterns and Practice", & 'The PEAR Installer Manifesto'. <-- Is pretty neat so far...I'm curious about using phing and the pear channels for distributing applications and application updates. Oh, and not to mention 'Pro PHP Security'. I should buy some stock in bookpool & Apress! heh. - Ben Ben Sgro, Chief Engineer ProjectSkyLine - Defining New Horizons +1 718.487.9368 (N.Y. Office) Our company: www.projectskyline.com Our products: www.project-contact.com This e-mail is confidential information intended only for the use of the individual to whom it is addressed. ----- Original Message ----- From: "David Krings" To: "NYPHP Talk" Sent: Saturday, July 07, 2007 8:05 PM Subject: Re: [nycphp-talk] Questions to ask at a job interview? > Ben Sgro (ProjectSkyLine) wrote: >> Hey again, >> >> So, I had a string of interviews over the last two weeks. >> >> I have just hired one candidate that I believe will be a good addition to >> our company. >> >> I ended up using the Joel Spolsky (or whoever coined this) question: >> >> I have two variables and I want to switch their values. >> >> Some candidates totaly froze, and other's got it quickly. > > I'd use a third variable to keep a copy of one variable before basically > making both the same first and then assigning the saved to copy to the > originally uncopied variable. > Did I get hired? > No! Well, unless you are desparate... > Thanks to Google I now know the answer: > $x = $x xor $y; > $y = $x xor $y; > $x = $x xor $y; > > I guess this shows that I have no formal programming training. Although, > when would anyone want to switch variable values? Just use the one that > already has the right value. Saves three lines of code! Same amount of > lines is used with a helper variable, but the xor stuff uses less memory. > >> I also showed some source code, a *small* 150L script, and asked them >> what it did. >> >> Not only was it commented, but the function & variable names are >> extremely obvious. > > Mind sharing that test script with me (us)? I simply want to know how good > or bad I am. > >> Some looked in awe and said, "this is a small script?" while some took a >> few minutes >> and looked over the code, then attempted to explaint to me what it did. >> > > My record is currently at 761 lines for a script including comments and > empty lines. I think 150 isn't huge. > >> Overall, it was a great experiance. I look forward to finding new talent >> to add to our growing >> company. >> >> Thanks for all the responses and feedback! >> >> - Ben > > Thanks for asking and sharing with us. And for giving a PHP beginner an > awesome opportunity to pick up some more skill. I wish I could spend more > time on learning PHP. > > > David > > > David > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From ramons at gmx.net Sat Jul 7 23:23:41 2007 From: ramons at gmx.net (David Krings) Date: Sat, 07 Jul 2007 23:23:41 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <013301c7c0fc$55540610$0201a8c0@gamebox> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com><00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> Message-ID: <469058BD.8090708@gmx.net> Ben Sgro (ProjectSkyLine) wrote: > Hey again, > > "I think 150 lines is huge, I want to do it in two. =D" > heh. > > "Although, when would anyone want to switch variable values? Just use > the one that > already has the right value. Saves three lines of code!" > > Good point. I just liked the question because it makes them think. Made me think, too, because I guessed that the helper variable deal is way to obvious to be the desired answer. Besides that, we all do many things that have no real purpose. > > "My record is currently at 761 lines for a script including comments and > empty lines. I think 150 isn't huge.". > > So what did you do in those 761L? Grab an image file, check if it is jpg, check if it has exif information in it, if yes, grab the exif data, then check against all known keys of the exif array and echo those with explanatory text in a table. There are quite a few keys that can be in the resulting array and I want to show only those values that are really there and provide for explanatory text. Most exif reader scripts just barf up the content of the array and don't bother to format it nice and add the field definitions to it. So there are tons of isset checks and several switch()es. Is there a shorter way? Sure there is. I could parse through the array keys and load the definitions from an ini file and add a check for the case that the value is yet another array. Why check for 50 keys when the array has only three. To my defense, the isset and switch way makes it less intellectually challenging covering all the weird array values. Some are binary strings (Flash), some are just some wild numbers who each mean something different (LightSource), then there is the thumbnail image, and so on. That exif array is a total mess and dealing with each key separately is just easier. It also allows me to show things like picture orientation in a more obvious way. Rather than showing "Orientation: 6" I show an image of the letter "F" rotated in the way the image is oriented based on exif information. That isn't obvious from the image itself, because by the time I show exif information I already rotated the image on the fly based on rotation settings that I get from the database. Sure, I could use the exif values, but not all cameras record orientation. The one that I have doesn't and it is the main source of the images, but some other user may have a nicer camera. > Only 125L of code. You can view it here: > http://www.projectskyline.com/phplist/mine.txt > > Its a datamining script. It threw me off at the beginning as I think "browser" when thinking PHP. That script strikes me to get executed typically from the command line. It grabs results from Google searching for files of a particular type and stores them in a local folder. Right? Thanks for sharing. David From urb at e-government.com Sat Jul 7 23:25:58 2007 From: urb at e-government.com (Urb LeJeune) Date: Sat, 07 Jul 2007 23:25:58 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <013301c7c0fc$55540610$0201a8c0@gamebox> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> Message-ID: <7.0.1.0.2.20070707230749.028b1810@e-government.com> I've been following this thread with interest. To a certain point I think you're going about this in the wrong way. Programming is about problem solving, it's about syntax, that's the easy part. I good problem solver can use a book to lean the syntax to code a solved problem. Someone who aces a programming test because they have memorized a manual is non necessarily a good problem solver. Try this on a candidate. Write an algorithm (not language specific code) to do the following: Players is a variable holding the number of players in a single elimination tournament. If you loose a match, you're out. The winner is determined when there is no one left to play. Output the value of Matches which is a variable containing the number of matches required in the tournament. On problem that is non-trivial will have multiple solutions, we want the most efficient. Resist the temptation to express the algorithm in PHP or any other programming language. The algorithm is like: 1. Input Players as the number of players in a single elimination tournament. ... ... X. Output Matches which is the number of matches required in a single elimination tournament containing N (Players) players Hire any candidates who come up with an elegant solution. Then teach them any syntactic structures they don't know. BTW, I personally think swapping the contents of two variables without a temporary variables proves nothing. It's a trick we learned if we studied assembly language. Tricks do not a good programmer make. When is the last time you used an XOR is a real program? Urb Dr. Urban A. LeJeune, President E-Government.com 800-204-9545 From tedd at sperling.com Sun Jul 8 12:17:05 2007 From: tedd at sperling.com (tedd) Date: Sun, 8 Jul 2007 12:17:05 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <46902A38.6080707@gmx.net> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> Message-ID: At 8:05 PM -0400 7/7/07, David Krings wrote: >Ben Sgro (ProjectSkyLine) wrote: >>Hey again, >> >>So, I had a string of interviews over the last two weeks. >> >>I have just hired one candidate that I believe will be a good >>addition to our company. >> >>I ended up using the Joel Spolsky (or whoever coined this) question: >> >>I have two variables and I want to switch their values. >> >>Some candidates totaly froze, and other's got it quickly. list($a,$b) = array($b,$a); I hate interviews. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From rolan at omnistep.com Sun Jul 8 12:21:52 2007 From: rolan at omnistep.com (Rolan Yang) Date: Sun, 08 Jul 2007 12:21:52 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> Message-ID: <46910F20.60507@omnistep.com> tedd wrote: > At 8:05 PM -0400 7/7/07, David Krings wrote: >> Ben Sgro (ProjectSkyLine) wrote: >>> Hey again, >>> >>> So, I had a string of interviews over the last two weeks. >>> >>> I have just hired one candidate that I believe will be a good >>> addition to our company. >>> >>> I ended up using the Joel Spolsky (or whoever coined this) question: >>> >>> I have two variables and I want to switch their values. >>> >>> Some candidates totaly froze, and other's got it quickly. > > list($a,$b) = array($b,$a); > > I hate interviews. > > Cheers, > > tedd sweet. ~Rolan From ramons at gmx.net Sun Jul 8 12:55:48 2007 From: ramons at gmx.net (David Krings) Date: Sun, 08 Jul 2007 12:55:48 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7.0.1.0.2.20070707230749.028b1810@e-government.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> Message-ID: <46911714.6000500@gmx.net> Urb LeJeune wrote: > I've been following this thread with interest. To a certain point I think > you're going about this in the wrong way. Programming is about > problem solving, it's about syntax, that's the easy part. I good > problem solver can use a book to lean the syntax to code a solved > problem. Someone who aces a programming test because they > have memorized a manual is non necessarily a good problem > solver. I fully agree with that! I worked with many developers and the really good ones weren't the ones who knew the latest tricks, but who understood the business. > Try this on a candidate. > > Write an algorithm (not language specific code) to do the following: > > Players is a variable holding the number of players in a single > elimination tournament. If you loose a match, you're out. The > winner is determined when there is no one left to play. > > Output the value of Matches which is a variable containing the > number of matches required in the tournament. > > On problem that is non-trivial will have multiple solutions, we > want the most efficient. > > Resist the temptation to express the algorithm in PHP or any > other programming language. Huh? That is a mathematical, statistical problem of half-life periods. IMHO is not that useful unless providing the logic behind it is sufficient as an answer. My objection is about asking for an "efficient solution". I think it is much more important to stay with Confucius on this: the way is the goal. I'd say that someone who gets this requests and asks for a pen and paper to draw a picture is already a good candidate. Asking for an efficient algorithm and a mathematical approach is unfortunately in line how programming gets taught these days. No wonder why people rather get MBAs instead of science degrees. Who wants to get beaten with the math stick each and every time? Use math and logic if common sense fails. I met many engineers who where math experts, but too stupid to operate a screw driver. They could design complex machinery for a site, but didn't bother checking if the parts would fit through the doors. I studied EE and would have enjoyed it more (and probably be better at it) if it wasn't always about some integral to be solved first. I created quite many scripts that are in no way efficient, but they all work and I got them to work reliably. When I look at them today I know at least a dozen ways on how to improve them and do the same with less, but at the core the path to finding the solution remains the same. I also tried and dealt with many different programming languages and in general they are all very similar, excluding machine code and assembler (means 'real' programming). They all got their decision structures, they all got their output commands, they typically use pointers for files, database, etc., they generally all know about arrays. So yes, nailing someone on a specific programming language doesn't mean all that much. Although in this case knowledge of PHP is key and the more I look at that script the more I think it is a good choice. One doesn't even need to know anything about OOP in order to figure out what it does. Another option is to ask what the steps are to accomplish this data mining process. One other intriguing problem I came across recently was this: I have a set of several file folders. They are all numbered sequentially. I want to create three independent functions for adding one folder, deleting one folder, and moving a folder to a new position and each time end with consecutively numbered folders and have those who are not affected by the operation keep their names. Writing the code was somewhat easy after I figured out what I need to do and in which order. In my case I also had to sync the changes with a database table, so I had to make sure that one thing worked before doing the other (I chose to first do the file system stuff, then change the db record, but the other way around is as good/bad). > BTW, I personally think swapping the contents of two variables without a > temporary variables proves nothing. It's a trick we learned if we studied > assembly language. Tricks do not a good programmer make. When is > the last time you used an XOR is a real program? Exactly! I think that using the temp variable is a good solution even if it takes a few bytes more of memory. The days of 64kB RAM are over where that really mattered. As long as someone doesn't answer this: $a = $b; $b = $a; it is not a lost cause (but some may even stop after the first line!). Take my example from above with moving the position of one folder within the set of folders. Need to rename one folder first, then complete the sequence until the new position for the folder is reached, and then rename that folder. In case of two folders I have the same problem as asked with exchanging the variable values. So, how do I XOR folders in a file system? And how many XORs does it need to accomplish this for the likely case of having more than two folders? IMHO, any test that has a direct practical approach is way better than some question about a nifty, but useless trick. In the end interviewing and hiring people isn't any different than learning programming. Practice makes perfect and one just has to be aware of the fact that not everything works out as intended. David From tedd at sperling.com Sun Jul 8 13:01:23 2007 From: tedd at sperling.com (tedd) Date: Sun, 8 Jul 2007 13:01:23 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> Message-ID: At 7:13 PM -0400 7/7/07, Ben Sgro \(ProjectSkyLine\) wrote: >Hey again, > >So, I had a string of interviews over the last two weeks. > >I have just hired one candidate that I believe will be a good >addition to our company. > >I ended up using the Joel Spolsky (or whoever coined this) question: > >I have two variables and I want to switch their values. > >Some candidates totaly froze, and other's got it quickly. > >I also showed some source code, a *small* 150L script, and asked >them what it did. > >Not only was it commented, but the function & variable names are >extremely obvious. >Some looked in awe and said, "this is a small script?" while some >took a few minutes >and looked over the code, then attempted to explaint to me what it did. > >Overall, it was a great experiance. I look forward to finding new >talent to add to our growing >company. > >Thanks for all the responses and feedback! > >- Ben Ben: I hate interviews and I hate test. Both are usually conducted/written by people who have less talent/knowledge about the subject than the people they expect to hire. When it comes to programing, what I provide to my employer/client is not just me, but rather a collection of experience, knowledge, talent, computer, and resources -- it's a package deal. If you want to test any of those elements separately, then you're not testing my capability. You might as well ask my computer if it plays well with others. Solution -- give me a task and time to complete it -- and then review my code and let me explain how it works. After all, that's what you should be concerned about, right? Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From michael.southwell at nyphp.com Sun Jul 8 13:11:18 2007 From: michael.southwell at nyphp.com (Michael Southwell) Date: Sun, 08 Jul 2007 13:11:18 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7.0.1.0.2.20070707230749.028b1810@e-government.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> Message-ID: <6.2.3.4.2.20070708130808.028d07b0@pop.nyphp.com> At 11:25 PM 7/7/2007, you wrote: >Write an algorithm (not language specific code) to do the following: > >Players is a variable holding the number of players in a single >elimination tournament. If you loose a match, you're out. The >winner is determined when there is no one left to play. This is trivial: number of matches required to get a winner = number of players - 1 explanation: one match eliminates one player every player but one must be eliminated to have a winner therefore....... Michael Southwell, Vice President for Education New York PHP http://www.nyphp.com/training - In-depth PHP Training Courses From urb at e-government.com Sun Jul 8 13:29:23 2007 From: urb at e-government.com (Urb LeJeune) Date: Sun, 08 Jul 2007 13:29:23 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <46911714.6000500@gmx.net> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> <46911714.6000500@gmx.net> Message-ID: <7.0.1.0.2.20070708131416.028e1158@e-government.com> >> express the algorithm in PHP or any >>other programming language. > >Huh? That is a mathematical, statistical problem of half-life >periods. IMHO is not that useful unless providing the logic behind >it is sufficient as an answer. That's easy for you to say :-) I'm not asking for a mathematical proof, just a logical proof. >My objection is about asking for an "efficient solution". I think it >is much more important to stay with Confucius on this: the way is the goal. Again, any non-trivial problem will have multiple solutions. > I'd say that someone who gets this requests and asks for a pen and > paper to draw a picture is already a good candidate. What is a picture of this problem? >Asking for an efficient algorithm and a mathematical approach is >unfortunately in line how programming gets taught these days. I don't think you'll see that when we get to the "ideal" solution. > No wonder why people rather get MBAs instead of science degrees. > Who wants to get beaten with the math stick each and every time? > Use math and logic if common sense fails. Let's assume I buy that approach, which I don't. What is the logic to solve this problem? >Writing the code was somewhat easy after I figured out what I need >to do and in which order. In my case I also had to sync the changes >with a database table, so I had to make sure that one thing worked >before doing the other (I chose to first do the file system stuff, >then change the db record, but the other way around is as good/bad). Many years ago we learned to flow chart a problem before programming. It is, unfortunately, a dying skill. In the early 1970s Edsger Dijkstra , one of the great pioneers of computer science, delivered a paper in which he suggested that the first programming course in a CS curriculum be taught without a computer. When I first read the paper I though he was nuts. As time has passed I am now of the opinion that the may was correct. Will anyone take the challenge and give the group an algorithm to solve the problem? If you have seen this problem do post it until people have a chance to think. Urb Dr. Urban A. LeJeune, President E-Government.com 800-204-9545 From urb at e-government.com Sun Jul 8 13:40:40 2007 From: urb at e-government.com (Urb LeJeune) Date: Sun, 08 Jul 2007 13:40:40 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <6.2.3.4.2.20070708130808.028d07b0@pop.nyphp.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> <6.2.3.4.2.20070708130808.028d07b0@pop.nyphp.com> Message-ID: <7.0.1.0.2.20070708133037.028e1b38@e-government.com> >This is trivial: >number of matches required to get a winner = number of players - 1 >explanation: >one match eliminates one player >every player but one must be eliminated to have a winner >therefore....... I didn't know someone has actually solved the problem when I posted the last message. The answer is elegant, not trivial. I gave this problem to people in a first programming class over a period of 15 years. Maybe 10 people solved it correctly in the approximately 1,000 students who took it. Almost everyone did something like. N = N /2 rounded up. M = N /2 rounded down. If N = 1 display Matches about half tried it with an example of N being a power of two and never rounded. This is an emulation of an actual tournament. Another variation was: N = decrement N M = increment M If N = 1 display Matches. Your answer required a different philosophical approach. You are asking, how is a looser determined? The above two approaches ask how is a winner determined? Urb Urb Dr. Urban A. LeJeune, President E-Government.com 800-204-9545 From ramons at gmx.net Sun Jul 8 14:25:32 2007 From: ramons at gmx.net (David Krings) Date: Sun, 08 Jul 2007 14:25:32 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7.0.1.0.2.20070708131416.028e1158@e-government.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> <46911714.6000500@gmx.net> <7.0.1.0.2.20070708131416.028e1158@e-government.com> Message-ID: <46912C1C.3090206@gmx.net> Urb LeJeune wrote: > >>> express the algorithm in PHP or any >>> other programming language. >> >> Huh? That is a mathematical, statistical problem of half-life periods. >> IMHO is not that useful unless providing the logic behind it is >> sufficient as an answer. > > That's easy for you to say :-) > > I'm not asking for a mathematical proof, just a logical proof. OK, that wasn't clear to me. >> My objection is about asking for an "efficient solution". I think it >> is much more important to stay with Confucius on this: the way is the >> goal. > > Again, any non-trivial problem will have multiple solutions. Yes, exactly, but doesn't demanding an efficient solution mean that only one is correct whereas all others are not even if they work fine? >> I'd say that someone who gets this requests and asks for a pen and >> paper to draw a picture is already a good candidate. > > What is a picture of this problem? A diagram as shown for the NCAA basketball torunament pairings in the sports section of a newspaper. Or in my case the pairings for the German soccer cup. >> Asking for an efficient algorithm and a mathematical approach is >> unfortunately in line how programming gets taught these days. > > I don't think you'll see that when we get to the "ideal" solution. The ideal solution to the problem or the ideal solution to teaching programming? Assuming you mean this problem, it ends up to be a mathematical problem. My point was that figuring the problem out and then crafting the mathematical formula for it is IMHO a better approach than to start with a formula and then see if it fits the problem. >> No wonder why people rather get MBAs instead of science degrees. Who >> wants to get beaten with the math stick each and every time? Use math >> and logic if common sense fails. > > Let's assume I buy that approach, which I don't. What is the > logic to solve this > problem? Ah, there were several studies done in Europe asking high school graduates if they want to study science. Many said no citing the need for advanced math skills to be the main reason. I also inquired once about the results of the recruiting efforts for engineering students of one of the best German universities for science. They even went with a "science truck" to high schools showing off all kinds of neat stuff. Their efforts fell flat mainly because they told all the school kids they have to be good in math to be an engineer. I think that learning concepts and guessing right is way more important than learning theories and exactly calculating the 10th position after the period. Maybe it is taught differently around here. Now, the logic is like this: Let's start with 4 teams (final four): we get two semifinals and one final, which makes for three games. Let's take 6 teams. First we get three matches and then have three teams left. One gets a bye, the two others play, for a current total of four matches and two remaining teams, which results into one final game for a total of five games. Now with 5 times four play and one gets a bye, having two matches down and three teams left. Two play one game, one gets a bye, for a total of three matches, two teams left, which brings a total of four matches. So far odd and even start numbers as well as odd and even intermittent numbers are covered. Shows that the total of games is always one less than teams starting. That is something a fanatic, straight thinking ESPN watcher can figure out without ever attending any advanced math classes. OK, counting and the first rules of arithmetic proof to be helpful, but it is assumed that after 4th grade everyone knows that. I count that under common knowledge. > >> Writing the code was somewhat easy after I figured out what I need to >> do and in which order. In my case I also had to sync the changes with >> a database table, so I had to make sure that one thing worked before >> doing the other (I chose to first do the file system stuff, then >> change the db record, but the other way around is as good/bad). > > Many years ago we learned to flow chart a problem before > programming. See above, I basically proposed a flow chart. And this is how I was supposed to learn ANSI C 12 years ago. My flow charts were great, my code sucked. > It is, unfortunately, a dying skill. In the early 1970s Edsger Dijkstra > , one of the > great pioneers of computer science, delivered a paper in which he suggested > that the first programming course in a CS curriculum be taught without a > computer. When I first read the paper I though he was nuts. As time has > passed I am now of the opinion that the may was correct. It is coming back to life, but today it is called UML and has flashy drag&drop applications. But this is exactly how I was introduced to computer programming. My 5th grade math teacher was a computer whiz (an Apple IIe specialist) and each exam had at least one task that started like this: "Stell' Dir vor Du bist ein Computer..." - Imagine you are a computer... I got Ds in math until I got a female (and pretty) math teacher in grades 11-13. My grades went from almost F to A. Whatever does it. ;) Even got the BSEE in below average time with an above average grade. As mentioned earlier, I also got a written warning for bad grades in English, now I am a tech writer at a US reasearch foundation. So much for concluding anything from test results. Indeed an interesting discussion! David From chsnyder at gmail.com Sun Jul 8 15:01:38 2007 From: chsnyder at gmail.com (csnyder) Date: Sun, 8 Jul 2007 15:01:38 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <46902A38.6080707@gmx.net> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> Message-ID: On 7/7/07, David Krings wrote: > I'd use a third variable to keep a copy of one variable before basically > making both the same first and then assigning the saved to copy to the > originally uncopied variable. > Did I get hired? > No! Well, unless you are desparate... > Thanks to Google I now know the answer: > $x = $x xor $y; > $y = $x xor $y; > $x = $x xor $y; > Heh. If you gave me that answer I wouldn't hire you. Good luck at Google, though. -- Chris Snyder http://chxo.com/ From tedd at sperling.com Sun Jul 8 16:37:15 2007 From: tedd at sperling.com (tedd) Date: Sun, 8 Jul 2007 16:37:15 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7.0.1.0.2.20070708133037.028e1b38@e-government.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> <6.2.3.4.2.20070708130808.028d07b0@pop.nyphp.com> <7.0.1.0.2.20070708133037.028e1b38@e-government.com> Message-ID: At 1:40 PM -0400 7/8/07, Urb LeJeune wrote: > I gave this problem to people >in a first programming class over a period of 15 years. Maybe 10 >people solved it correctly in the approximately 1,000 students who >took it. Urb: No offense, but I've taught computer programming (and other disciplines) and I believe that most people who are taking a course in programming have a better than average intelligence. If I presented a question to 1000 students and had less 10 people provide a correct answer over 15 years, then I would be examining the question, not questioning the ability of the students. Especially, IF the question might had been presented differently would have rendered a larger number of correct answers. What did the 990 students learn from your question? As you know, the most important part of any solution is to understand the problem. If I asked you "Why are manhole covers round?" -- would you get the answer right away? Conversely, if I asked what shape would best stop a cover from being dropped down a hole? -- would you better understand the problem and find the answer quicker? And most importantly, would you be better off for being asked a straight forward question and discovering the answer or a tricky question and getting it wrong? From my perspective, the point is to teach, not to confuse. Cheers, tedd PS: As for flow charts, never used them and never will. For some people it's a complete waste of time, like pen and paper vs the keyboard -- I haven't the time to waste to do it twice. -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From ramons at gmx.net Sun Jul 8 18:07:25 2007 From: ramons at gmx.net (David Krings) Date: Sun, 08 Jul 2007 18:07:25 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> Message-ID: <4691601D.9090104@gmx.net> csnyder wrote: >> Thanks to Google I now know the answer: >> $x = $x xor $y; >> $y = $x xor $y; >> $x = $x xor $y; > > Heh. If you gave me that answer I wouldn't hire you. > Good luck at Google, though. Uhm, just out of curiosity....is that answer wrong (just because Google shows it as a result, doesn't mean it is right, but the page I got it from gave a plausible explanation)? Undoubtedly, my skills in software QA, support, and tech writing are better than my programming skills. David From chsnyder at gmail.com Sun Jul 8 18:30:32 2007 From: chsnyder at gmail.com (csnyder) Date: Sun, 8 Jul 2007 18:30:32 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <4691601D.9090104@gmx.net> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <4691601D.9090104@gmx.net> Message-ID: On 7/8/07, David Krings wrote: > csnyder wrote: > >> Thanks to Google I now know the answer: > >> $x = $x xor $y; > >> $y = $x xor $y; > >> $x = $x xor $y; > > > > Heh. If you gave me that answer I wouldn't hire you. > > Good luck at Google, though. > > Uhm, just out of curiosity....is that answer wrong (just because Google > shows it as a result, doesn't mean it is right, but the page I got it > from gave a plausible explanation)? > > Undoubtedly, my skills in software QA, support, and tech writing are > better than my programming skills. > Well, give it a try in php and see if it works. But actually, my response was a knee-jerk reaction against code tries to be clever when simple would work just as well. Your first instinct, make a copy and then reassign the values, is a straightforward way to do it. Other developers--web developers--will immediately understand, and not have to audit your code to figure out what's happening. Don't let lack of computer science theory psych you out of being a good engineer. -- Chris Snyder http://chxo.com/ From ramons at gmx.net Sun Jul 8 18:42:00 2007 From: ramons at gmx.net (David Krings) Date: Sun, 08 Jul 2007 18:42:00 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <4691601D.9090104@gmx.net> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <4691601D.9090104@gmx.net> Message-ID: <46916838.4090606@gmx.net> David Krings wrote: > csnyder wrote: >>> Thanks to Google I now know the answer: >>> $x = $x xor $y; >>> $y = $x xor $y; >>> $x = $x xor $y; >> >> Heh. If you gave me that answer I wouldn't hire you. >> Good luck at Google, though. > Yo! I wouldn't hire myself. Blindly trusting what someone else claims is the thing to do isn't clever. I finally did what I should have done before posting this: I tried it out and it doesn't work. But again prooves the point that this test isn't all it should be. The help variable approach works and I got that in place much quicker than this broken stuff. The correct answer was posted earlier and is also in the PHP Cookbook on books.google.com. Supposedly it enhances clarity, which I doubt it does unless one is very intimate with the list() and array() functions. Ah, I guess I can't talk myself out of having screwed up. LOL David From tedd at sperling.com Sun Jul 8 19:34:26 2007 From: tedd at sperling.com (tedd) Date: Sun, 8 Jul 2007 19:34:26 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7.0.1.0.2.20070708133037.028e1b38@e-government.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> <6.2.3.4.2.20070708130808.028d07b0@pop.nyphp.com> <7.0.1.0.2.20070708133037.028e1b38@e-government.com> Message-ID: At 1:40 PM -0400 7/8/07, Urb LeJeune wrote: >>This is trivial: >>number of matches required to get a winner = number of players - 1 >>explanation: >>one match eliminates one player >>every player but one must be eliminated to have a winner >>therefore....... Only if there are no draws. Was it given that every match had only two players and each match resulted in one winner and one loser? If so, I didn't see it. If draws are allowed, then there is no answer. If you like these sort of brain teasers, then try taking the LSAT sometime. I think you'll find the questions a bit more difficult. But, does answering questions like that prove lawyers make better programmers? I would like to think not. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From tedd at sperling.com Sun Jul 8 20:21:46 2007 From: tedd at sperling.com (tedd) Date: Sun, 8 Jul 2007 20:21:46 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <46916838.4090606@gmx.net> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <4691601D.9090104@gmx.net> <46916838.4090606@gmx.net> Message-ID: At 6:42 PM -0400 7/8/07, David Krings wrote: > >The correct answer was posted earlier and is also in the PHP >Cookbook on books.google.com. Supposedly it enhances clarity, which >I doubt it does unless one is very intimate with the list() and >array() functions. David: Nothing enhances clarity better than familiarity. True, the answer was noted in the PHP Cookbook on page 120, but the point was that I remembered it. I have literally scores of different programming books which I read time and time again. Each time, I learn and remember something new -- AND where I read it. My books are filled with sticky notes sticking out of the pages with dozens of things I want to remember. Even with this list -- every time someone post a routine or a snip-it of code to solve a problem, I copy, make an index for it, catalog it, list who said it (that's important), and sometimes even make a working example so I can reference it later when I run into the same problem. I have hundred's or working examples as my reference. Sure, it's a lot of hard work, but it's necessary if you're going to be good at what you do. No profession is easy and what you know, is what you sell. Like the old mechanic who was brought a car that didn't run right. He listened to the engine and took a hammer and hit it. Suddenly the engine ran like it was new. The customer asked "How much do I owe you?" To which the mechanic said "A hundred bucks!" The customer replied "That's a lot of money just to hit an engine with a hammer." The mechanic replied "No, that only cost a buck -- it was knowing where to hit it that cost the most." Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From shiflett at php.net Sun Jul 8 21:36:38 2007 From: shiflett at php.net (Chris Shiflett) Date: Sun, 08 Jul 2007 21:36:38 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <4691601D.9090104@gmx.net> Message-ID: <46919126.90309@php.net> > Your first instinct, make a copy and then reassign the > values, is a straightforward way to do it. I agree that using xor isn't a very straightforward solution, but I do like to look for creative, clever solutions: $foo = $foo + $bar; $bar = $foo - $bar; $foo = $foo - $bar; By the way, I'm hiring. :-) Chris -- Chris Shiflett http://shiflett.org/ From pjlists at pobox.com Sun Jul 8 21:46:46 2007 From: pjlists at pobox.com (=?BIG5?B?UC4gSnUgKKa2un7moik=?=) Date: Mon, 9 Jul 2007 09:46:46 +0800 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7fb2405d0707080917l15fce8al348ee90da5400902@mail.gmail.com> References: <7fb2405d0707080917l15fce8al348ee90da5400902@mail.gmail.com> Message-ID: <7fb2405d0707081846o5a0514c3ld854442ed3c73634@mail.gmail.com> Hello all, I'm new to this list but not to PHP. I've been architecting and developing Web applications and networked software products for about 17 years and have had the good fortune to work for some very interesting clients such as Nike, BMG Direct, the Chicago Tribune, Lycos, &c. I've also conducted programming skill assessments which resulted in stronger candidate matches for fast paced projects. However, I've also interviewed candidates whom I thought were weak technically and poor choices, but with whom the hiring manager had long-term relationships. Guess what? Those candidates worked hard, got up to speed, and ended up being valuable long term investments! I agree with Urb in that I'd much rather see a third variable for the value-swapping question than the "xor" which obfuscates the code. Only in extreme resource duress (embedded systems, PDAs, watch PCs :) would I resort to obfuscation for optimization, and when I do I always feel a slight pang of guilt. Thanks for this resource, and I hope to meet you all when I re-move to NYC (grew up there, left a decade ago) in July/August! Regards, Patricia Ju > > Message: 6 > > Date: Sat, 07 Jul 2007 23:25:58 -0400 > > From: Urb LeJeune > > Subject: Re: [nycphp-talk] Questions to ask at a job interview? > > To: NYPHP Talk > > Message-ID: <7.0.1.0.2.20070707230749.028b1810 at e-government.com> > > Content-Type: text/plain; charset="us-ascii"; format=flowed > > > > I've been following this thread with interest. To a certain point I think > > you're going about this in the wrong way. Programming is about > > problem solving, it's about syntax, that's the easy part. I good > > problem solver can use a book to lean the syntax to code a solved > > problem. Someone who aces a programming test because they > > have memorized a manual is non necessarily a good problem > > solver. > > > > Try this on a candidate. > > > > Write an algorithm (not language specific code) to do the following: > > > > Players is a variable holding the number of players in a single > > elimination tournament. If you loose a match, you're out. The > > winner is determined when there is no one left to play. > > > > Output the value of Matches which is a variable containing the > > number of matches required in the tournament. > > > > On problem that is non-trivial will have multiple solutions, we > > want the most efficient. > > > > Resist the temptation to express the algorithm in PHP or any > > other programming language. > > > > The algorithm is like: > > > > 1. Input Players as the number of players in a single elimination tournament. > > ... > > ... > > X. Output Matches which is the number of matches required in a single > > elimination tournament containing N (Players) players > > > > Hire any candidates who come up with an elegant solution. Then teach > > them any syntactic structures they don't know. > > > > BTW, I personally think swapping the contents of two variables without a > > temporary variables proves nothing. It's a trick we learned if we studied > > assembly language. Tricks do not a good programmer make. When is > > the last time you used an XOR is a real program? > > > > Urb > > > > Dr. Urban A. LeJeune, President > > E-Government.com > > 800-204-9545 > > > > > > > > > > ------------------------------ > > > > _______________________________________________ > > talk mailing list > > talk at lists.nyphp.org > > http://lists.nyphp.org/mailman/listinfo/talk > > > > End of talk Digest, Vol 9, Issue 10 > > *********************************** > > > > > -- > Taiwan Cell: +886.917.268.640 > US/Int'l Cell: +1.503.616.3100 > > ??????? > Failure is the mother of success. > -- Taiwan Cell: +886.917.268.640 US/Int'l Cell: +1.503.616.3100 ??????? Failure is the mother of success. From ben at projectskyline.com Sun Jul 8 21:50:49 2007 From: ben at projectskyline.com (Ben Sgro (ProjectSkyLine)) Date: Sun, 8 Jul 2007 21:50:49 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com><00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <4691601D.9090104@gmx.net> <46919126.90309@php.net> Message-ID: <005f01c7c1cb$94cf8ba0$0201a8c0@gamebox> Hey Again, There's been a ton of great comments...I realize that the questions and tactics I used in this interview session may not have been the best, but I have learned a lot through this process, and look forward to doing it again in the future. Someone mentioned asking the candidate to write a solution to a problem then walk me through their code ... I like this, and I've had to do it in the past. Actually, they just took the source code and told me they would get back to me. I guess I wasn't 100% sure what types of questions would be appropriate, since this is an intern position, and I don't except too much language specific knowledge. I do expect..er want, a smart, hard working person. "My books are filled with sticky notes sticking out of the pages with dozens of things I want to remember." heh, mine too! "Someone who aces a programming test because they have memorized a manual is non necessarily a good problem solver." Very true. "Write an algorithm (not language specific code) to do the following:" That's a good idea ... I may give more thought as too what I will ask as a problem solving question in the future. I'll probably do a bit of googling to see what others have asked, and been asked. "BTW, I personally think swapping the contents of two variables without a temporary variables proves nothing." True, I guess I just like to see how quickly, and what way, they solve the problem. *Any* problem will do I suppose. Thanks again for all the feedback, its been a pleasure reading the replies. - Ben Ben Sgro, Chief Engineer ProjectSkyLine - Defining New Horizons +1 718.487.9368 (N.Y. Office) Our company: www.projectskyline.com Our products: www.project-contact.com This e-mail is confidential information intended only for the use of the individual to whom it is addressed. ----- Original Message ----- From: "Chris Shiflett" To: "NYPHP Talk" Sent: Sunday, July 08, 2007 9:36 PM Subject: Re: [nycphp-talk] Questions to ask at a job interview? >> Your first instinct, make a copy and then reassign the >> values, is a straightforward way to do it. > > I agree that using xor isn't a very straightforward solution, but I do > like to look for creative, clever solutions: > > $foo = $foo + $bar; > $bar = $foo - $bar; > $foo = $foo - $bar; > > By the way, I'm hiring. :-) > > Chris > > -- > Chris Shiflett > http://shiflett.org/ > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From support at dailytechnology.net Mon Jul 9 08:19:04 2007 From: support at dailytechnology.net (Brian Dailey) Date: Mon, 09 Jul 2007 08:19:04 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <46919126.90309@php.net> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <4691601D.9090104@gmx.net> <46919126.90309@php.net> Message-ID: <469227B8.7090502@dailytechnology.net> That would only work if the variable were an integer. If I remember correctly, the variable type was unspecified. ;-) - Brian Chris Shiflett wrote: >> Your first instinct, make a copy and then reassign the >> values, is a straightforward way to do it. > > I agree that using xor isn't a very straightforward solution, but I do > like to look for creative, clever solutions: > > $foo = $foo + $bar; > $bar = $foo - $bar; > $foo = $foo - $bar; > > By the way, I'm hiring. :-) > > Chris > -- Thanks! - Brian Dailey Software Developer New York, NY www.dailytechnology.net -------------- next part -------------- A non-text attachment was scrubbed... Name: support.vcf Type: text/x-vcard Size: 276 bytes Desc: not available URL: From smanes at magpie.com Mon Jul 9 13:18:10 2007 From: smanes at magpie.com (Steve Manes) Date: Mon, 09 Jul 2007 13:18:10 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7.0.1.0.2.20070707230749.028b1810@e-government.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> Message-ID: <46926DD2.6070902@magpie.com> A ! B ! B @ A @ Nobody said you couldn't use Forth... ($a, $b) = ($b, $a); ... or Perl From shiflett at php.net Mon Jul 9 13:33:38 2007 From: shiflett at php.net (Chris Shiflett) Date: Mon, 09 Jul 2007 13:33:38 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <46926DD2.6070902@magpie.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox> <46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox> <7.0.1.0.2.20070707230749.028b1810@e-government.com> <46926DD2.6070902@magpie.com> Message-ID: <46927172.4070907@php.net> Steve Manes wrote: > A ! B ! B @ A @ > > Nobody said you couldn't use Forth... > > ($a, $b) = ($b, $a); > > ... or Perl But this is a PHP list. :-) list($a, $b) = array($b, $a); Chris -- Chris Shiflett http://shiflett.org/ From rudy at taytek.com Mon Jul 9 13:38:31 2007 From: rudy at taytek.com (Rudy) Date: Mon, 9 Jul 2007 13:38:31 -0400 Subject: [nycphp-talk] Questions to ask at a job interview? References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox><46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox><7.0.1.0.2.20070707230749.028b1810@e-government.com> <46926DD2.6070902@magpie.com> Message-ID: <006c01c7c24f$f9251370$8b030a0a@InterDigital.com> Wow that was a blast from my past. Now using the stack is kind of like using a helper variable but all us Forth programmers know that the stack is much more efficient. Oh yeah not to mention using RPN. I still use my 20+ year-old HP 15C calculator and find it extremely difficult to use a non RPN calculator. Rudy ----- Original Message ----- From: "Steve Manes" To: "NYPHP Talk" Sent: Monday, July 09, 2007 1:18 PM Subject: Re: [nycphp-talk] Questions to ask at a job interview? >A ! B ! B @ A @ > > Nobody said you couldn't use Forth... > > ($a, $b) = ($b, $a); > > ... or Perl > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From 1j0lkq002 at sneakemail.com Mon Jul 9 14:02:49 2007 From: 1j0lkq002 at sneakemail.com (inforequest) Date: Mon, 09 Jul 2007 11:02:49 -0700 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <006c01c7c24f$f9251370$8b030a0a@InterDigital.com> References: <007401c7b97f$af7cdf10$6b01a8c0@gamebox> <4683C84B.5040603@magpie.com> <00a701c7c0ec$7f39ae90$0201a8c0@gamebox><46902A38.6080707@gmx.net> <013301c7c0fc$55540610$0201a8c0@gamebox><7.0.1.0.2.20070707230749.028b1810@e-government.com> <46926DD2.6070902@magpie.com> <006c01c7c24f$f9251370$8b030a0a@InterDigital.com> Message-ID: <26576-17417@sneakemail.com> Rudy rudy-at-taytek.com |nyphp dev/internal group use| wrote: > Wow that was a blast from my past. Now using the stack is kind of > like using a helper variable but all us Forth programmers know that > the stack is much more efficient. Oh yeah not to mention using RPN. > I still use my 20+ year-old HP 15C calculator and find it extremely > difficult to use a non RPN calculator. > > Rudy > > ----- Original Message ----- From: "Steve Manes" > To: "NYPHP Talk" > Sent: Monday, July 09, 2007 1:18 PM > Subject: Re: [nycphp-talk] Questions to ask at a job interview? > > >> A ! B ! B @ A @ >> >> Nobody said you couldn't use Forth... >> >> ($a, $b) = ($b, $a); >> >> ... or Perl > RPN rules. Anything less is child's play. -- ------------------------------------------------------------- Your web server traffic log file is the most important source of web business information available. Do you know where your logs are right now? Do you know who else has access to your log files? When they were last archived? Where those archives are? --John Andrews Competitive Webmaster and SEO Blogging at http://www.johnon.com From 1j0lkq002 at sneakemail.com Mon Jul 9 17:21:50 2007 From: 1j0lkq002 at sneakemail.com (inforequest) Date: Mon, 09 Jul 2007 14:21:50 -0700 Subject: [nycphp-talk] Questions to ask at a job interview? In-Reply-To: <7fb2405d0707081846o5a0514c3ld854442ed3c73634@mail.gmail.com> References: <7fb2405d0707080917l15fce8al348ee90da5400902@mail.gmail.com> <7fb2405d0707081846o5a0514c3ld854442ed3c73634@mail.gmail.com> Message-ID: <24048-31613@sneakemail.com> P. Ju (???) pjlists-at-pobox.com |nyphp dev/internal group use| wrote: > Hello all, > > I'm new to this list but not to PHP. I've been architecting and > developing Web applications and networked software products for about > 17 years and have had the good fortune to work for some very > interesting clients such as Nike, BMG Direct, the Chicago Tribune, > Lycos, &c. > > I've also conducted programming skill assessments which resulted in > stronger candidate matches for fast paced projects. However, I've also > interviewed candidates whom I thought were weak technically and poor > choices, but with whom the hiring manager had long-term relationships. > Guess what? Those candidates worked hard, got up to speed, and ended > up being valuable long term investments! > > I agree with Urb in that I'd much rather see a third variable for the > value-swapping question than the "xor" which obfuscates the code. Only > in extreme resource duress (embedded systems, PDAs, watch PCs :) would > I resort to obfuscation for optimization, and when I do I always feel > a slight pang of guilt. > > Thanks for this resource, and I hope to meet you all when I re-move to > NYC (grew up there, left a decade ago) in July/August! > > Regards, > > Patricia Ju Fermi questions are well respected (http://mathforum.org/workshops/sum96/interdisc/fermicollect.html), but the bottom line is YOU do the hiring and YOU suffer the consequences (or reap the rewards). Someone once said "A" people hire "A" people, and "B" people hire "C" people :-) I think the environment has more impact on the development of an individual as a worker than the hiring process or the technical skills at hire time. So hire accordingly. But hey, that's just me :-) -- ------------------------------------------------------------- Your web server traffic log file is the most important source of web business information available. Do you know where your logs are right now? Do you know who else has access to your log files? When they were last archived? Where those archives are? --John Andrews Competitive Webmaster and SEO Blogging at http://www.johnon.com From ramons at gmx.net Mon Jul 9 20:16:42 2007 From: ramons at gmx.net (David Krings) Date: Mon, 09 Jul 2007 20:16:42 -0400 Subject: [nycphp-talk] Removing one element from an array Message-ID: <4692CFEA.5010903@gmx.net> Hi! I have an array with numerical keys. I need to remove one element of the array and then rekey the array to have consecutive keys again. I got the rekeying down, but how do I pop off an array element in the middle of an array? Is that done using unset($array[123]) ? I'm having a deer-staring-in-the-headlights-moment. David From dell at sala.ca Mon Jul 9 20:33:38 2007 From: dell at sala.ca (Dell Sala) Date: Mon, 9 Jul 2007 20:33:38 -0400 Subject: [nycphp-talk] Removing one element from an array In-Reply-To: <4692CFEA.5010903@gmx.net> References: <4692CFEA.5010903@gmx.net> Message-ID: <0B1030E8-170E-46B2-8EFB-D1447FE06A5C@sala.ca> take a look at array_splice() -- Dell On Jul 9, 2007, at 8:16 PM, David Krings wrote: > Hi! > > I have an array with numerical keys. I need to remove one element > of the array and then rekey the array to have consecutive keys > again. I got the rekeying down, but how do I pop off an array > element in the middle of an array? Is that done using unset($array > [123]) ? I'm having a deer-staring-in-the-headlights-moment. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From g.hagger at gmail.com Mon Jul 9 20:49:01 2007 From: g.hagger at gmail.com (Graham Hagger) Date: Mon, 09 Jul 2007 20:49:01 -0400 Subject: [nycphp-talk] Removing one element from an array In-Reply-To: <4692CFEA.5010903@gmx.net> References: <4692CFEA.5010903@gmx.net> Message-ID: <4692D77D.9000803@gmail.com> Hi David, Ran into this myself a short time ago. There's probably a better answer, but I ended using array_diff. Basically I pass in the original array, and a new single element array containing the element to remove, and pocket the difference. To (kinda) rewrite the manual/online help for this purpose: |$array1 = array("a" => "green", "red", "blue", "red"); $result = array_diff($array1, array("b" => "green")); should return $result as containing red, blue and red, but no green. | Graham David Krings wrote: > Hi! > > I have an array with numerical keys. I need to remove one element of > the array and then rekey the array to have consecutive keys again. I > got the rekeying down, but how do I pop off an array element in the > middle of an array? Is that done using unset($array[123]) ? I'm having > a deer-staring-in-the-headlights-moment. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From jonbaer at jonbaer.com Mon Jul 9 21:03:12 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Mon, 9 Jul 2007 21:03:12 -0400 Subject: [nycphp-talk] Removing one element from an array In-Reply-To: <4692CFEA.5010903@gmx.net> References: <4692CFEA.5010903@gmx.net> Message-ID: Hmmm (not sure why Im always trying to compact stuff to one line now) ... $array = array(1,2,3,3,3,3,4,5); $remove = 3; while (in_array($remove, $array)) unset($array[array_search($remove, $array)]); print_r(array_values($array)); - Jon On Jul 9, 2007, at 8:16 PM, David Krings wrote: > Hi! > > I have an array with numerical keys. I need to remove one element > of the array and then rekey the array to have consecutive keys > again. I got the rekeying down, but how do I pop off an array > element in the middle of an array? Is that done using unset($array > [123]) ? I'm having a deer-staring-in-the-headlights-moment. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From cliff at pinestream.com Mon Jul 9 21:07:53 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Mon, 09 Jul 2007 21:07:53 -0400 Subject: [nycphp-talk] Removing one element from an array In-Reply-To: Message-ID: Look at array_slice From ramons at gmx.net Mon Jul 9 22:22:26 2007 From: ramons at gmx.net (David Krings) Date: Mon, 09 Jul 2007 22:22:26 -0400 Subject: [nycphp-talk] Removing one element from an array In-Reply-To: References: Message-ID: <4692ED62.7000603@gmx.net> Cliff Hirsch wrote: > Look at array_slice > Based on the vote tally array_slice won, but I don't get this command. I just went for broke and tried my unset suspicion and indeed it works. This is the scenario: I have abunch of record IDs in an array, which I stuffed into the $_SESSION variable. The IDs belong to pictures and I just deleted one picture, which means that I need to remove the non-existent ID from the array. This is the code: // Remove current element from display array $display = $_SESSION['sessiondisplay']; unset($display[$_SESSION['sessionviewpointer']]); // Rekey display array $display = array_values($display); // register new array with $_SESSION $_SESSION['sessiondisplay'] = $display; The unset on a specific array key unsets only that value. The array key is gone and thus the value is no longer in the array. Rekeying using array_values patches the hole and gets me a consecutive, numerically keyed array. I also store the current pointer in $_SESSION and as it turns out I don't even have to do anything with the pointer as it automatically points at the next array element. Nevertheless, I am intrigued by array_slice, but I guess I postpone understanding that until tomorrow. Thanks for the pointers. David From dell at sala.ca Mon Jul 9 22:56:17 2007 From: dell at sala.ca (Dell Sala) Date: Mon, 9 Jul 2007 22:56:17 -0400 Subject: [nycphp-talk] Removing one element from an array In-Reply-To: <4692ED62.7000603@gmx.net> References: <4692ED62.7000603@gmx.net> Message-ID: <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> On Jul 9, 2007, at 10:22 PM, David Krings wrote: > Cliff Hirsch wrote: >> Look at array_slice > > Based on the vote tally array_slice won, but I don't get this > command. I just went for broke and tried my unset suspicion and > indeed it works. Your solution seems fine to me. You just save a couple of lines with array_splice. > Nevertheless, I am intrigued by array_slice, but I guess I postpone > understanding that until tomorrow. I think you want array_splice, not array_slice. array_splice removes a section of an array an optionally replaces it with another array. It resets the keys of the array if it is numerically indexed. In your case, you leave out the replacement argument. An example in your context might look like this: array_splice($_SESSION['sessiondisplay'], $_SESSION ['sessionviewpointer'], 1); This would only makes sense if $_SESSION['sessiondisplay'] is a numerically indexed array, and if $_SESSION['sessionviewpointer'] is an int. -- Dell From ramons at gmx.net Tue Jul 10 06:43:54 2007 From: ramons at gmx.net (David Krings) Date: Tue, 10 Jul 2007 06:43:54 -0400 Subject: [nycphp-talk] Removing one element from an array In-Reply-To: <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> References: <4692ED62.7000603@gmx.net> <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> Message-ID: <469362EA.9060902@gmx.net> Dell Sala wrote: > I think you want array_splice, not array_slice. > > array_splice removes a section of an array an optionally replaces it > with another array. It resets the keys of the array if it is numerically > indexed. In your case, you leave out the replacement argument. > > An example in your context might look like this: > > array_splice($_SESSION['sessiondisplay'], > $_SESSION['sessionviewpointer'], 1); > > This would only makes sense if $_SESSION['sessiondisplay'] is a > numerically indexed array, and if $_SESSION['sessionviewpointer'] is an > int. > > -- Dell Thanks, I'll try that out as well and probably use it. The array is numerically indexed and the pointer is an integer. If I understand this right, my approach would then work on any array and any pointer. Good to know as well. :) David From cliff at pinestream.com Tue Jul 10 13:31:27 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Tue, 10 Jul 2007 13:31:27 -0400 Subject: [nycphp-talk] Please wait, processing, message technique Message-ID: For long and indeterminate page processing, like connecting with a credit card payment gateway or calculating pi to thousands of significant digits, what is your preferred method for displaying ?please wait?? I see two techniques: 1. Use Javascript upon form submission to display the ?please wait? message 2. Echo a ?please wait? page from the server and then do a 302 redirect upon completion of the scrpt. Issues: 1. Not everyone uses JavaScript 2. Can you issue a header redirect after echoing a ?please wait? message. I though headers need to be sent first. Is a 302 header redirect an exception? Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim_lists at o2group.com Tue Jul 10 13:45:51 2007 From: tim_lists at o2group.com (Tim Lieberman) Date: Tue, 10 Jul 2007 11:45:51 -0600 Subject: [nycphp-talk] Please wait, processing, message technique In-Reply-To: References: Message-ID: <4693C5CF.7020204@o2group.com> Never really thought about it. If your backend processes is asynchronous (or if you make it so) you could have your "progress" script just meta refresh until the back-end has a result, and then on the next refresh, 302 out of there. Cliff Hirsch wrote: > For long and indeterminate page processing, like connecting with a > credit card payment gateway or calculating pi to thousands of > significant digits, what is your preferred method for displaying > ?please wait?? > > I see two techniques: > > 1. Use Javascript upon form submission to display the ?please wait? > message > 2. Echo a ?please wait? page from the server and then do a 302 > redirect upon completion of the scrpt. > > > Issues: > > 1. Not everyone uses JavaScript > 2. Can you issue a header redirect after echoing a ?please wait? > message. I though headers need to be sent first. Is a 302 header > redirect an exception? > > > Cliff > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From suzerain at suzerain.com Tue Jul 10 13:47:13 2007 From: suzerain at suzerain.com (Marc Antony Vose) Date: Wed, 11 Jul 2007 01:47:13 +0800 Subject: [nycphp-talk] advice on scaling up In-Reply-To: <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> References: <4692ED62.7000603@gmx.net> <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> Message-ID: <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> Hi all: I'm a developer who has concentrated more on smaller-scale projects, but as it turns out one of my projects is beginning to stress the limits of a single server, and so I'm about to begin venturing into the unknown. The project is currently in the "tens of thousands" of users range, but it looks like we need to start drafting a plan to scale it up to "hundreds of thousands" to a million or so users. This is a site that is running on a custom built PHP framework (which seems to be performing rather well), and MySQL. The server's running Apache and Linux (Red Hat). There is some image and data uploading from users, and most pages are served dynamically, currently, with very simple SQL. I have taken the step of caching any page elements that require any kind of recursion or iteration to produce (such as a list of categories that displays the number of related items from other tables in it), but I have not cached, for example, database calls to just one item matching on the primary key. I think this approach has been sensible so far. If I had to classify the site, I'd say it follows a similar usage pattern as something like last.fm, or facebook, only much smaller. Social networking-type thing, but users are not constantly visiting and reloading pages, like a news site. So, more than the PHP coding strategy, my question is about what kind of hosting/server arrangement I would be looking at to handle the kind of load I'm talking about. How many servers will I need to handle the kind of traffic I require? If this question is not so easily answered, then what would be my equation for figuring this out? A friend told me he works on a site that has 4,000,000 users and they have their system optimized to handle 500 requests per second. This is for a search engine-type site...is this a reasonable metric? When you separate database and http servers, then what should be the hardware priorities for each? CPU speed? RAM? hard disk speed, etc.? Perhaps the database is more RAM and HD dependent, and the web server will need more CPU and RAM? I'd be interesting in learning a bit from those of you who are working on larger-scale projects what's powering your servers, and what kind of capacity you think your setup's giving you. Thanks for helping me determine exactly where to research. Cheers, Marc Vose Suzerain Studios From shiflett at php.net Tue Jul 10 14:00:29 2007 From: shiflett at php.net (Chris Shiflett) Date: Tue, 10 Jul 2007 14:00:29 -0400 Subject: [nycphp-talk] advice on scaling up In-Reply-To: <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> References: <4692ED62.7000603@gmx.net> <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> Message-ID: <4693C93D.2050608@php.net> Hi Marc, > I'm a developer who has concentrated more on smaller-scale projects, > but as it turns out one of my projects is beginning to stress the > limits of a single server, and so I'm about to begin venturing into > the unknown. > > The project is currently in the "tens of thousands" of users range, > but it looks like we need to start drafting a plan to scale it up > to "hundreds of thousands" to a million or so users. I recommend my colleague Theo Schlossnagle's book, Scalable Internet Architectures. It addresses these exact types of questions in a "teach a man to fish" sort of way. > This is a site that is running on a custom built PHP framework > (which seems to be performing rather well), and MySQL. I'm not a scalability expert, but one thing I've learned is that many things that perform well now can still cause problems when the scale increases, so keep your mind open to all possibilities. > If I had to classify the site, I'd say it follows a similar usage > pattern as something like last.fm, or facebook, only much smaller. Do you have the feature that allows people to see how many degrees away they are from another user? Anyway, read that book. :-) Chris -- Chris Shiflett http://shiflett.org/ From cliff at pinestream.com Tue Jul 10 14:14:23 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Tue, 10 Jul 2007 14:14:23 -0400 Subject: [nycphp-talk] What's the best way to escape JavaScript data? Message-ID: What is the best way to escape JavaScript data? The PEAR JavaScript package does this: function escapeString($str) { $js_escape = array( "\r" => '\r', "\n" => '\n', "\t" => '\t', "'" => "\\'", '"' => '\"', '\\' => '\\\\' ); return strtr($str,$js_escape); } I also found this, which converts every character to its code ? pretty extreme. function javascript_escape($str) { $new_str = ''; for($i = 0; $i < strlen($str); $i++) { $new_str .= '\x' . dechex(ord(substr($str, $i, 1))); } return $new_str; } Thoughts? Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From mitch.pirtle at gmail.com Tue Jul 10 14:16:40 2007 From: mitch.pirtle at gmail.com (Mitch Pirtle) Date: Tue, 10 Jul 2007 14:16:40 -0400 Subject: [nycphp-talk] advice on scaling up In-Reply-To: <4693C93D.2050608@php.net> References: <4692ED62.7000603@gmx.net> <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> <4693C93D.2050608@php.net> Message-ID: <330532b60707101116v12bd571ao43be5a2c9e8677f6@mail.gmail.com> On 7/10/07, Chris Shiflett wrote: > I recommend my colleague Theo Schlossnagle's book, Scalable Internet > Architectures. It addresses these exact types of questions in a "teach a > man to fish" sort of way. +1 Also, take a look into memcache, it's not as fast as local caches but scales well. Created by the guys at facebook, memcache gets plenty of real-world high traffic exercise ;-) Also consider two separate mysql groups, one cluster for CRUD ops (Create/Replace/Update/Delete) and the other (slaves) for reads (SELECTs). Chances are, once you get busy with memcache you will start spending most of your time dealing with the database itself; and having a separate cluster optimized for SELECTs makes the job a lot easier. -- Mitch From joshmccormack at travelersdiary.com Tue Jul 10 14:18:33 2007 From: joshmccormack at travelersdiary.com (Josh McCormack) Date: Tue, 10 Jul 2007 13:18:33 -0500 Subject: [nycphp-talk] advice on scaling up In-Reply-To: <4693C93D.2050608@php.net> References: <4692ED62.7000603@gmx.net> <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> <4693C93D.2050608@php.net> Message-ID: I've been using Webload from Webload.org quite a since it went open source in the last couple of months. I'd highly recommend it for testing out a new system you'd set up before you put it online in production. You definitely learn a lot about how well your code scales when you load test it with a system that simulates actual activity. Josh On 7/10/07, Chris Shiflett wrote: > Hi Marc, > > > I'm a developer who has concentrated more on smaller-scale projects, > > but as it turns out one of my projects is beginning to stress the > > limits of a single server, and so I'm about to begin venturing into > > the unknown. > > > > The project is currently in the "tens of thousands" of users range, > > but it looks like we need to start drafting a plan to scale it up > > to "hundreds of thousands" to a million or so users. > > I recommend my colleague Theo Schlossnagle's book, Scalable Internet > Architectures. It addresses these exact types of questions in a "teach a > man to fish" sort of way. > > > This is a site that is running on a custom built PHP framework > > (which seems to be performing rather well), and MySQL. > > I'm not a scalability expert, but one thing I've learned is that many > things that perform well now can still cause problems when the scale > increases, so keep your mind open to all possibilities. > > > If I had to classify the site, I'd say it follows a similar usage > > pattern as something like last.fm, or facebook, only much smaller. > > Do you have the feature that allows people to see how many degrees away > they are from another user? > > Anyway, read that book. :-) > > Chris > > -- > Chris Shiflett > http://shiflett.org/ > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Josh McCormack Owner, InteractiveQA Web testing & development http://www.interactiveqa.com 917.620.4902 From chuck at horde.org Tue Jul 10 14:22:37 2007 From: chuck at horde.org (Chuck Hagenbuch) Date: Tue, 10 Jul 2007 14:22:37 -0400 Subject: [nycphp-talk] What's the best way to escape JavaScript data? In-Reply-To: References: Message-ID: <20070710142237.lvhxbuspcco0w84k@technest.org> Quoting Cliff Hirsch : > What is the best way to escape JavaScript data? http://php.net/json-encode -chuck From lists at zaunere.com Tue Jul 10 14:34:06 2007 From: lists at zaunere.com (Hans Zaunere) Date: Tue, 10 Jul 2007 14:34:06 -0400 Subject: [nycphp-talk] advice on scaling up In-Reply-To: <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> References: <4692ED62.7000603@gmx.net><1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> Message-ID: <005f01c7c320$e5c60c40$651ba8c0@MobileZ> > How many servers will I need to handle the kind of traffic I > require? If this question is not so easily answered, then what would > be my equation for figuring this out? A friend told me he works on a > site that has 4,000,000 users and they have their system optimized to > handle 500 requests per second. This is for a search engine-type > site...is this a reasonable metric? Sounds fairly reasonable, but of course it depends dramatically on the type of site it is. Social networks typically have a "heavier" traffic pattern. There's generally more complex application logic, session storage needs, etc. And I think it could be argued that the users would be more likely to constantly refresh and visit pages, as opposed to a search engine or news site. The idea of social networking sites are to keep the user navigating through the site - there's no "external" usage really. And serving socially matched metrics is going to be more intensive - heavier - than a more static-orientated news or search site. Add in Ajax magic, and you could be generating a substantial number of requests per page load. If Ajax is important to the site, get a good JavaScript developer that understands server interaction, load, etc. (I know, I can't believe I just said that). > When you separate database and http servers, then what should be the > hardware priorities for each? CPU speed? RAM? hard disk speed, > etc.? Perhaps the database is more RAM and HD dependent, and the web > server will need more CPU and RAM? Throw the big iron at your database - CPU, RAM, HD. The database is the aggregation point for your application. It's easier to add web servers than to add database servers (and take full advantage of them). And since this is a social networking site, the database will be busy looking up matches/etc (ie, whatever the social magic is in this case). For the web server, I've found that 1gb of RAM, snappy CPU, and any HD works. Put your money in the database hardware, or in development time so that your application knows how to scale across databases completely (read/write). memcached is very useful for session storage, as can a dedicated database be. H From nhart at musicpf.org Tue Jul 10 14:19:19 2007 From: nhart at musicpf.org (Nicholas Hart) Date: Tue, 10 Jul 2007 14:19:19 -0400 Subject: [nycphp-talk] iframe Top of page? In-Reply-To: <95788.81705.qm@web52212.mail.re2.yahoo.com> References: <95788.81705.qm@web52212.mail.re2.yahoo.com> Message-ID: <20070710141919.ctjdfs66sk4kg8oo@192.168.1.6> Hi, Does anyone know how to force an iframe to handle varying page lengths such that it starts back at the top of the page each time? I have a menu.php called from an iframe in index.php. This menu calls balances.php, workdues.php, etc which have varying page lengths depending on the data displayed. Upon pressing 'Return to main menu' I am left to scroll back up - as the menu is a much shorter page than all others. How do you handle this? Any thoughts or suggestions much appreciated. Thanks. -- Nicholas Hart Music Performance Fund From rahmin at insite-out.com Tue Jul 10 16:05:42 2007 From: rahmin at insite-out.com (Rahmin Pavlovic) Date: Tue, 10 Jul 2007 16:05:42 -0400 Subject: [nycphp-talk] What's the best way to escape JavaScript data? In-Reply-To: <20070710142237.lvhxbuspcco0w84k@technest.org> Message-ID: Chuck Hagenbuch wrote: > Quoting Cliff Hirsch : > >> What is the best way to escape JavaScript data? > > http://php.net/json-encode > json_encode() loosely takes PHP data types and converts it to JavaScript Object Notation (JSON) -- it actually doesn't escape the data itself that well. It depends on your app -- you may want to retain HTML tags, for example -- but I tend to trim, remove all UNIX chars, strip HTML tags and convert to HTML entities. From ps at sun-code.com Tue Jul 10 18:16:45 2007 From: ps at sun-code.com (Peter Sawczynec) Date: Tue, 10 Jul 2007 18:16:45 -0400 Subject: [nycphp-talk] iframe Top of page? In-Reply-To: <20070710141919.ctjdfs66sk4kg8oo@192.168.1.6> References: <95788.81705.qm@web52212.mail.re2.yahoo.com> <20070710141919.ctjdfs66sk4kg8oo@192.168.1.6> Message-ID: <003b01c7c340$06948b30$13bda190$@com> I'm not sure I get your problem exactly, but whether you are on the web page inside the iframe or on the parent web page that contains the iframe you can force your self to a certain position on a web page by using HTML anchor tags. You put the (hidden) anchor tag at the top of your main menu: And the link to the main menu top anchor is like so: Return to main menu A link to an anchor tag will force the web page to scroll up to it. This is a potential solution. Additionally, I believe you can even do URL hrefs like this, that will go to webpage.htm and move to the posiiton of anchor menutop: http://www.exanmple.com/webpage.htm#menutop But, my raw HTML gets a bit foggy nowadays. Warmest regards, Peter Sawczynec Technology Dir. Sun-code.com Web related services 646.316.3678 ps at sun-code.com -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Nicholas Hart Sent: Tuesday, July 10, 2007 2:19 PM To: talk at lists.nyphp.org Subject: Re: [nycphp-talk] iframe Top of page? Hi, Does anyone know how to force an iframe to handle varying page lengths such that it starts back at the top of the page each time? I have a menu.php called from an iframe in index.php. This menu calls balances.php, workdues.php, etc which have varying page lengths depending on the data displayed. Upon pressing 'Return to main menu' I am left to scroll back up - as the menu is a much shorter page than all others. How do you handle this? Any thoughts or suggestions much appreciated. Thanks. -- Nicholas Hart Music Performance Fund _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From arzala at gmail.com Tue Jul 10 07:19:00 2007 From: arzala at gmail.com (Anirudh Zala) Date: Tue, 10 Jul 2007 16:49:00 +0530 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> Message-ID: <200707101649.00624.arzala@gmail.com> On Wednesday 20 Jun 2007 21:42:13 Nelly Yusupova wrote: > Hello Everyone, > > I wrote a script that allows users to upload up to 10 photo files to the > server. The script automatically resizes the photos to the appropriate > size. The upload and resizing scripts are working perfectly. The problem > is that clients are uploading large photo files and it takes a long time to > upload them. > > Is there a script or any way I can resize the pictures before uploading? > > Thank you in advance. > > Sincerely, > Nelly Yusupova > DigitalWoman.com > nelly at digitalwoman.com > 917 603-9226 (phone) > http://www.digitalwoman.com There is no standard solutions for this problem. However you can use a technique called "background-transfer" or "early transfer" in which as soon as user moves to 2nd box to select 2nd picture for uploading, transfer of 1st image starts in background. You need to use Ajax for this. Hence when user moved to last box or finally to upload button, 70% of images would have transferred in background. This saves lot of uploading time and user thinks that transfer of images went faster however in reality it is same. Many large image, graphics, video sites use this technique to reduce large uploading time just by controlling the way of transfer. Resizing images at client is not good solution even if it is possible to resize because then on server side you may have very limited image data to make further processing on them like printing, enhancing etc. Thanks Anirudh Zala From ramons at gmx.net Wed Jul 11 06:46:20 2007 From: ramons at gmx.net (David Krings) Date: Wed, 11 Jul 2007 06:46:20 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: <200707101649.00624.arzala@gmail.com> References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <200707101649.00624.arzala@gmail.com> Message-ID: <4694B4FC.1080404@gmx.net> Anirudh Zala wrote: > Hence when user moved to last box or finally to upload button, 70% of images > would have transferred in background. This saves lot of uploading time and > user thinks that transfer of images went faster however in reality it is > same. > And what would one do if the user changes his/her mind and browses to a different picture in the first five boxes? If the concern is transmission time / amount then why design a system that allows for bogus uploads? And what to do if the user turned ECMAScript off? Just asking.... David From tedd at sperling.com Wed Jul 11 07:51:44 2007 From: tedd at sperling.com (tedd) Date: Wed, 11 Jul 2007 07:51:44 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: <200707101649.00624.arzala@gmail.com> References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <200707101649.00624.arzala@gmail.com> Message-ID: On Wednesday 20 Jun 2007 21:42:13 Nelly Yusupova wrote: > Hello Everyone, > > I wrote a script that allows users to upload up to 10 photo files to the > server. The script automatically resizes the photos to the appropriate > size. The upload and resizing scripts are working perfectly. The problem > is that clients are uploading large photo files and it takes a long time to > upload them. > > Is there a script or any way I can resize the pictures before uploading? > > Thank you in advance. > > Sincerely, > Nelly Yusupova > DigitalWoman.com > nelly at digitalwoman.com Nelly: Sure, you'll have to write something client-side, namely javascript to do it. But, there's all sorts of javascript scripts to resize images available to choose from, try Google "resize images javascript" Here's one that should do with a little work: http://www.xs4all.nl/~sbpoley/webmatters/resize.html Here's one that allows the user to crop and resize their pictures. http://mondaybynoon.com/2007/01/22/crop-resize-with-javascript-php-and-imagemagick/ Lot's of neat stuff. I would like to see your end-result. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From paulcheung at tiscali.co.uk Wed Jul 11 09:43:25 2007 From: paulcheung at tiscali.co.uk (PaulCheung) Date: Wed, 11 Jul 2007 14:43:25 +0100 Subject: [nycphp-talk] Creating a MySQL DataBase using/through php script. Can anybody help?? Message-ID: <001001c7c3c1$74c88030$0300a8c0@X9183> Can anybody see what I am doing wrong? Using Mike McGrath's book "PHP 5 in easy steps" I have been trying to get both his textbook example on page 144 "Creating a database" and the example from the www.ineasysteps.com website to work. Not being able to get either the textbook example or "create_db.php" to work and in pure frustration I contacted the publishers and got a reply from Mike and implemented his suggested changes; Using the MySQL "show databases;" line command to verify database creation, it shows no database was created. Here is the code including the Mike's suggested changes. It all appears to work on the surface; but you will need to check a little deeper under the surface to see what I mean. Paul Creating databases
Current databases:
Name:
From jmcgraw1 at gmail.com Wed Jul 11 09:59:24 2007 From: jmcgraw1 at gmail.com (Jake McGraw) Date: Wed, 11 Jul 2007 09:59:24 -0400 Subject: [nycphp-talk] Creating a MySQL DataBase using/through php script. Can anybody help?? In-Reply-To: <001001c7c3c1$74c88030$0300a8c0@X9183> References: <001001c7c3c1$74c88030$0300a8c0@X9183> Message-ID: Ah, you may need to modify the @mysql_query() command like so: @mysql_query('CREATE DATABASE '.$_REQUEST['db']); So that the final submitted query looks like (for $_REQUEST['db'] = 'myDatabase'): CREATE DATABASE myDatabase Whereas before you were issuing the query: myDatabase Which makes no sense and would have resulted in an error, except that you were using an the error control (@) operator. See http://us2.php.net/@ for more information. - jake On 7/11/07, PaulCheung wrote: > Can anybody see what I am doing wrong? > > Using Mike McGrath's book "PHP 5 in easy steps" I have been trying to get > both his textbook example on page 144 "Creating a database" and the example > from the www.ineasysteps.com website to work. Not being able to get either > the textbook example or "create_db.php" to work and in pure frustration I > contacted the publishers and got a reply from Mike and implemented his > suggested changes; Using the MySQL "show databases;" line command to verify > database creation, it shows no database was created. Here is the code > including the Mike's suggested changes. It all appears to work on the > surface; but you will need to check a little deeper under the surface to see > what I mean. > > Paul > > > $conn = @mysql_connect( "localhost", "paul", "enter" ) > or die( "Sorry - could not connect to MySQL" ); > > $rs1 = @mysql_query( $_REQUEST['db'] ); > $rs2= @mysql_list_dbs($conn); > > $list = ""; > > for( $row=0; $row < mysql_num_rows( $rs2 ); $row++ ) > { > $list .= mysql_tablename( $rs2, $row ) . " | "; > } > ?> > > > > Creating databases > > >
> > Current databases: >
> Name: > >
> > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > From dell at sala.ca Wed Jul 11 10:01:31 2007 From: dell at sala.ca (Dell Sala) Date: Wed, 11 Jul 2007 10:01:31 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <200707101649.00624.arzala@gmail.com> Message-ID: On Jul 11, 2007, at 7:51 AM, tedd wrote: > On Wednesday 20 Jun 2007 21:42:13 Nelly Yusupova wrote: >> >> Is there a script or any way I can resize the pictures before >> uploading? > > Nelly: > > Sure, you'll have to write something client-side, namely javascript > to do it. But, there's all sorts of javascript scripts to resize > images available to choose from, try Google "resize images javascript" I don't believe there is any way to actually modify and image file on the client-side using Javascript. (If someone knows a way, I'd love to hear about it!) For client-side image processing you'd need use a technology that has image resampling capabilities, and possibly something that has write permissions on the client's machine. First thing that comes to mind is a Java applet. php Gallery created a desktop client that serves a similar purpose, but I'm pretty sure it's specific to the php Gallery API. But this gives you an idea of what it would take to implement client-side image resizing... probably Java. http://codex.gallery2.org/Gallery_Remote > Here's one that should do with a little work: > > http://www.xs4all.nl/~sbpoley/webmatters/resize.html This is cool, but it doesn't actually resize the image. It just displays different pre-sized images that are already on the server. > Here's one that allows the user to crop and resize their pictures. > > http://mondaybynoon.com/2007/01/22/crop-resize-with-javascript-php- > and-imagemagick/ Also cool stuff, but all the processing happens on the server-side. -- Dell From jonbaer at jonbaer.com Wed Jul 11 10:54:54 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Wed, 11 Jul 2007 10:54:54 -0400 Subject: [nycphp-talk] Creating a MySQL DataBase using/through php script. Can anybody help?? In-Reply-To: References: <001001c7c3c1$74c88030$0300a8c0@X9183> Message-ID: You would also need to set special GRANT privileges for user "paul". http://dev.mysql.com/doc/refman/5.1/en/create-database.html http://dev.mysql.com/doc/refman/5.1/en/grant.html Also of note ... -snip- If you manually create a directory under the data directory (for example, with mkdir), the server considers it a database directory and it shows up in the output of SHOW DATABASES. -snip- - Jon On Jul 11, 2007, at 9:59 AM, Jake McGraw wrote: > Ah, you may need to modify the @mysql_query() command like so: > > @mysql_query('CREATE DATABASE '.$_REQUEST['db']); > > So that the final submitted query looks like (for $_REQUEST['db'] = > 'myDatabase'): > > CREATE DATABASE myDatabase > > Whereas before you were issuing the query: > > myDatabase > > Which makes no sense and would have resulted in an error, except that > you were using an the error control (@) operator. See > http://us2.php.net/@ for more information. > > - jake > > On 7/11/07, PaulCheung wrote: >> Can anybody see what I am doing wrong? >> >> Using Mike McGrath's book "PHP 5 in easy steps" I have been trying >> to get >> both his textbook example on page 144 "Creating a database" and >> the example >> from the www.ineasysteps.com website to work. Not being able to >> get either >> the textbook example or "create_db.php" to work and in pure >> frustration I >> contacted the publishers and got a reply from Mike and implemented >> his >> suggested changes; Using the MySQL "show databases;" line command >> to verify >> database creation, it shows no database was created. Here is the code >> including the Mike's suggested changes. It all appears to work on the >> surface; but you will need to check a little deeper under the >> surface to see >> what I mean. >> >> Paul >> >> >> > $conn = @mysql_connect( "localhost", "paul", "enter" ) >> or die( "Sorry - could not connect to MySQL" ); >> >> $rs1 = @mysql_query( $_REQUEST['db'] ); >> $rs2= @mysql_list_dbs($conn); >> >> $list = ""; >> >> for( $row=0; $row < mysql_num_rows( $rs2 ); $row++ ) >> { >> $list .= mysql_tablename( $rs2, $row ) . " | "; >> } >> ?> >> >> >> >> Creating databases >> >> >>
> method="post"> >> >> Current databases: >>
>> Name: >> >>
>> >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php >> > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From ashaw at polymerdb.org Wed Jul 11 11:46:33 2007 From: ashaw at polymerdb.org (Allen Shaw) Date: Wed, 11 Jul 2007 10:46:33 -0500 Subject: [nycphp-talk] Creating a MySQL DataBase using/through php script. Can anybody help?? In-Reply-To: <001001c7c3c1$74c88030$0300a8c0@X9183> References: <001001c7c3c1$74c88030$0300a8c0@X9183> Message-ID: <4694FB59.3070004@polymerdb.org> Hi Paul, You've gotten some good answers on your actual question, so I won't repeat them. But as an important side note, watch out what you copy from the books. This line is terribly risky: > $rs1 = @mysql_query( $_REQUEST['db'] ); If, for example, I requested http://example.com/create_db.php?db=drop+database+mysql%3B the script as it is would attempt to drop the mysql database (and hopefully you're not connecting to mysql as a user who could actually do that...) See this great article from Chris Shiflett on why user input should always be filtered and escaped: http://shiflett.org/articles/sql-injection I realize you copied most of this code out of the book, and that's no shame -- learning by example is one of the best ways to do it. It's a shame that the author has published code examples like this. - Allen PaulCheung wrote: > Using Mike McGrath's book "PHP 5 in easy steps" ... and the > example from the www.ineasysteps.com website > > $conn = @mysql_connect( "localhost", "paul", "enter" ) > or die( "Sorry - could not connect to MySQL" ); > > $rs1 = @mysql_query( $_REQUEST['db'] ); > $rs2= @mysql_list_dbs($conn); > -- Allen Shaw Polymer (http://polymerdb.org) slidePresenter (http://slides.sourceforge.net) From tedd at sperling.com Wed Jul 11 11:50:06 2007 From: tedd at sperling.com (tedd) Date: Wed, 11 Jul 2007 11:50:06 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <200707101649.00624.arzala@gmail.com> Message-ID: At 10:01 AM -0400 7/11/07, Dell Sala wrote: >On Jul 11, 2007, at 7:51 AM, tedd wrote: > >>On Wednesday 20 Jun 2007 21:42:13 Nelly Yusupova wrote: >>> >>> Is there a script or any way I can resize the pictures before uploading? >> >>Nelly: >> >>Sure, you'll have to write something client-side, namely javascript >>to do it. But, there's all sorts of javascript scripts to resize >>images available to choose from, try Google "resize images >>javascript" >-snip- >Also cool stuff, but all the processing happens on the server-side. > >-- Dell My bad - you're right. I had a senior moment. I was thinking that because the operation had to take place client-side that a client-side language should work. However, javascript doesn't have access to client-side files. Sorry, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From paulcheung at tiscali.co.uk Wed Jul 11 12:02:52 2007 From: paulcheung at tiscali.co.uk (PaulCheung) Date: Wed, 11 Jul 2007 17:02:52 +0100 Subject: [nycphp-talk] Creating a MySQL DataBase using/through php script.Can anybody help?? References: <001001c7c3c1$74c88030$0300a8c0@X9183> Message-ID: <004a01c7c3d4$f0b44ea0$0300a8c0@X9183> Thanks everybody it is all working now. Paul ----- Original Message ----- From: Jon Baer To: NYPHP Talk Sent: Wednesday, July 11, 2007 3:54 PM Subject: Re: [nycphp-talk] Creating a MySQL DataBase using/through php script.Can anybody help?? You would also need to set special GRANT privileges for user "paul". http://dev.mysql.com/doc/refman/5.1/en/create-database.html http://dev.mysql.com/doc/refman/5.1/en/grant.html Also of note ... -snip- If you manually create a directory under the data directory (for example, with mkdir), the server considers it a database directory and it shows up in the output of SHOW DATABASES. -snip- - Jon On Jul 11, 2007, at 9:59 AM, Jake McGraw wrote: Ah, you may need to modify the @mysql_query() command like so: @mysql_query('CREATE DATABASE '.$_REQUEST['db']); So that the final submitted query looks like (for $_REQUEST['db'] = 'myDatabase'): CREATE DATABASE myDatabase Whereas before you were issuing the query: myDatabase Which makes no sense and would have resulted in an error, except that you were using an the error control (@) operator. See http://us2.php.net/@ for more information. - jake On 7/11/07, PaulCheung wrote: Can anybody see what I am doing wrong? Using Mike McGrath's book "PHP 5 in easy steps" I have been trying to get both his textbook example on page 144 "Creating a database" and the example from the www.ineasysteps.com website to work. Not being able to get either the textbook example or "create_db.php" to work and in pure frustration I contacted the publishers and got a reply from Mike and implemented his suggested changes; Using the MySQL "show databases;" line command to verify database creation, it shows no database was created. Here is the code including the Mike's suggested changes. It all appears to work on the surface; but you will need to check a little deeper under the surface to see what I mean. Paul Creating databases
Current databases:
Name:
_______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php ------------------------------------------------------------------------------ _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From tommyo at gmail.com Wed Jul 11 14:00:18 2007 From: tommyo at gmail.com (Thomas O'Neill) Date: Wed, 11 Jul 2007 13:00:18 -0500 Subject: [nycphp-talk] Please wait, processing, message technique In-Reply-To: <4693C5CF.7020204@o2group.com> References: <4693C5CF.7020204@o2group.com> Message-ID: I did something like what you see on orbitz. Check it out.. http://tconeill.com/examples/pixelcrunch/ On 7/10/07, Tim Lieberman wrote: > > Never really thought about it. > > If your backend processes is asynchronous (or if you make it so) you > could have your "progress" script just meta refresh until the back-end > has a result, and then on the next refresh, 302 out of there. > > Cliff Hirsch wrote: > > For long and indeterminate page processing, like connecting with a > > credit card payment gateway or calculating pi to thousands of > > significant digits, what is your preferred method for displaying > > "please wait"? > > > > I see two techniques: > > > > 1. Use Javascript upon form submission to display the "please wait" > > message > > 2. Echo a "please wait" page from the server and then do a 302 > > redirect upon completion of the scrpt. > > > > > > Issues: > > > > 1. Not everyone uses JavaScript > > 2. Can you issue a header redirect after echoing a "please wait" > > message. I though headers need to be sent first. Is a 302 header > > redirect an exception? > > > > > > Cliff > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > New York PHP Community Talk Mailing List > > http://lists.nyphp.org/mailman/listinfo/talk > > > > NYPHPCon 2006 Presentations Online > > http://www.nyphpcon.com > > > > Show Your Participation in New York PHP > > http://www.nyphp.org/show_participation.php > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -- Tom O'Neill tommyo at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve.francia at gmail.com Wed Jul 11 14:04:19 2007 From: steve.francia at gmail.com (Steve Francia) Date: Wed, 11 Jul 2007 14:04:19 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <200707101649.00624.arzala@gmail.com> Message-ID: Javascript doesn't have access to the client-side files.. But Java and Flash do. You could do this in Flash pretty easily. Agreed as a general rule you would want to store the full size images server side, but I can think of many exceptions to that rule, a common one is, using it for an icon/avatar. -Steve -- Steve Francia http://zoopframework.com On 7/11/07, tedd wrote: > > At 10:01 AM -0400 7/11/07, Dell Sala wrote: > >On Jul 11, 2007, at 7:51 AM, tedd wrote: > > > >>On Wednesday 20 Jun 2007 21:42:13 Nelly Yusupova wrote: > >>> > >>> Is there a script or any way I can resize the pictures before > uploading? > >> > >>Nelly: > >> > >>Sure, you'll have to write something client-side, namely javascript > >>to do it. But, there's all sorts of javascript scripts to resize > >>images available to choose from, try Google "resize images > >>javascript" > >-snip- > >Also cool stuff, but all the processing happens on the server-side. > > > >-- Dell > > My bad - you're right. I had a senior moment. > > I was thinking that because the operation had to take place > client-side that a client-side language should work. However, > javascript doesn't have access to client-side files. > > Sorry, > > tedd > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jli at rightmedia.com Wed Jul 11 15:47:46 2007 From: jli at rightmedia.com (Jeffrey Li) Date: Wed, 11 Jul 2007 15:47:46 -0400 Subject: [nycphp-talk] Re: Resize pictures before uploading (Jeffrey Li) Message-ID: ImageMagick is a great command line tool that can modify images but the processing will happen on the server side after image has already been uploaded. You can use exec() within your script to execute the ImageMagick commands http://www.imagemagick.org/script/index.php > > At 10:01 AM -0400 7/11/07, Dell Sala wrote: > >On Jul 11, 2007, at 7:51 AM, tedd wrote: > > > >>On Wednesday 20 Jun 2007 21:42:13 Nelly Yusupova wrote: > >>> > >>> Is there a script or any way I can resize the pictures before > uploading? > >> > >>Nelly: > >> > >>Sure, you'll have to write something client-side, namely javascript > >>to do it. But, there's all sorts of javascript scripts to resize > >>images available to choose from, try Google "resize images > >>javascript" > >-snip- > >Also cool stuff, but all the processing happens on the server-side. > > > >-- Dell > > My bad - you're right. I had a senior moment. > > I was thinking that because the operation had to take place > client-side that a client-side language should work. However, > javascript doesn't have access to client-side files. > > Sorry, > > tedd > -- From michael.southwell at nyphp.com Wed Jul 11 22:50:12 2007 From: michael.southwell at nyphp.com (Michael Southwell) Date: Wed, 11 Jul 2007 22:50:12 -0400 Subject: [nycphp-talk] TRUE/FALSE and $_SESSION variables Message-ID: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> This tiny script: '; $_SESSION['ineligibleFlag'] = FALSE; print_r( $_SESSION ); produces this output: it is false Array ( [ineligibleFlag] => ) The docs tell me that sessions can handle everything that can be serialized, and that serialize can handle everything but resources, and that I shouldn't define resource constants. But FALSE is not a resource that I know of, and so none of that explains (that I can see, anyway) why the session can't hold this value. I can easily work around this, but I'd like to understand it as well. Michael Southwell, Vice President for Education New York PHP http://www.nyphp.com/training - In-depth PHP Training Courses From ken at secdat.com Wed Jul 11 22:57:24 2007 From: ken at secdat.com (Kenneth Downs) Date: Wed, 11 Jul 2007 22:57:24 -0400 Subject: [nycphp-talk] TRUE/FALSE and $_SESSION variables In-Reply-To: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> References: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> Message-ID: <46959894.5050601@secdat.com> "false" is a keyword, same as "true" and "null". > This tiny script: > session_start(); > $ineligibleFlag = FALSE; This assigns $ineligibleFlag the boolean value of 0 or "false" > if ( $ineligibleFlag === FALSE ) echo 'it is false
'; This tests to see if $inelegibleFlag is boolean and false (triple equals requires type and value to match), which is exactly what you just assigned it to, so you get a match. Try assigning $ineligibleFlag = 0, or '0' , or '' (empty string) and see the various results you get. > $_SESSION['ineligibleFlag'] = FALSE; > print_r( $_SESSION ); > > produces this output: > it is false > Array ( [ineligibleFlag] => ) > > The docs tell me that sessions can handle everything that can be > serialized, and that serialize can handle everything but resources, > and that I shouldn't define resource constants. But FALSE is not a > resource that I know of, and so none of that explains (that I can see, > anyway) why the session can't hold this value. I can easily work > around this, but I'd like to understand it as well. > > Michael Southwell, Vice President for Education > New York PHP > http://www.nyphp.com/training - In-depth PHP Training Courses > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010 From nyphp at n0p.net Wed Jul 11 23:00:37 2007 From: nyphp at n0p.net (Flavio daCosta) Date: Wed, 11 Jul 2007 23:00:37 -0400 Subject: [nycphp-talk] TRUE/FALSE and $_SESSION variables In-Reply-To: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> References: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> Message-ID: <46959955.5090100@n0p.net> Use var_dump( $_SESSION ); for the result you are searching for. From shiflett at php.net Wed Jul 11 23:05:17 2007 From: shiflett at php.net (Chris Shiflett) Date: Wed, 11 Jul 2007 23:05:17 -0400 Subject: [nycphp-talk] TRUE/FALSE and $_SESSION variables In-Reply-To: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> References: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> Message-ID: <46959A6D.60307@php.net> Michael Southwell wrote: > This tiny script: > session_start(); > $ineligibleFlag = FALSE; > if ( $ineligibleFlag === FALSE ) echo 'it is false
'; > $_SESSION['ineligibleFlag'] = FALSE; > print_r( $_SESSION ); > > produces this output: > it is false > Array ( [ineligibleFlag] => ) When cast to a string, FALSE is the empty string. Chris -- Chris Shiflett http://shiflett.org/ From michael.southwell at nyphp.com Wed Jul 11 23:14:42 2007 From: michael.southwell at nyphp.com (Michael Southwell) Date: Wed, 11 Jul 2007 23:14:42 -0400 Subject: [nycphp-talk] TRUE/FALSE and $_SESSION variables In-Reply-To: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> References: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> Message-ID: <6.2.3.4.2.20070711230949.028d40a0@pop.nyphp.com> At 10:50 PM 7/11/2007, you wrote: >This tiny script: Well, that was a perfect example of bad question asking, which solicited answers to things I wasn't trying to ask ;-( -- sorry, guys, but thanks anyway. So let me try again: $_SESSION['ineligibleFlag'] = TRUE; if ( $_SESSION['ineligibleFlag'] === TRUE ) echo 'not'; 'not' is not echoed. Why not? Michael Southwell, Vice President for Education New York PHP http://www.nyphp.com/training - In-depth PHP Training Courses From nyphp at n0p.net Wed Jul 11 23:19:03 2007 From: nyphp at n0p.net (Flavio daCosta) Date: Wed, 11 Jul 2007 23:19:03 -0400 Subject: [nycphp-talk] TRUE/FALSE and $_SESSION variables In-Reply-To: <6.2.3.4.2.20070711230949.028d40a0@pop.nyphp.com> References: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> <6.2.3.4.2.20070711230949.028d40a0@pop.nyphp.com> Message-ID: <46959DA7.7020508@n0p.net> On 07/11/2007 11:14 PM, Michael Southwell wrote: > $_SESSION['ineligibleFlag'] = TRUE; > if ( $_SESSION['ineligibleFlag'] === TRUE ) echo 'not'; > > 'not' is not echoed. Why not? Works for me. (5.0.5 and 5.2.1) From shiflett at php.net Wed Jul 11 23:22:56 2007 From: shiflett at php.net (Chris Shiflett) Date: Wed, 11 Jul 2007 23:22:56 -0400 Subject: [nycphp-talk] TRUE/FALSE and $_SESSION variables In-Reply-To: <6.2.3.4.2.20070711230949.028d40a0@pop.nyphp.com> References: <6.2.3.4.2.20070711223935.028ee1e0@mail.optonline.net> <6.2.3.4.2.20070711230949.028d40a0@pop.nyphp.com> Message-ID: <46959E90.3080703@php.net> Try this example. (It works for me.) TRUE

'; } else { echo '

Not TRUE

'; } print_r($_SESSION); ?> Chris Michael Southwell wrote: > $_SESSION['ineligibleFlag'] = TRUE; > if ( $_SESSION['ineligibleFlag'] === TRUE ) echo 'not'; > > 'not' is not echoed. Why not? -- Chris Shiflett http://shiflett.org/ From arzala at gmail.com Wed Jul 11 08:34:00 2007 From: arzala at gmail.com (Anirudh Zala) Date: Wed, 11 Jul 2007 18:04:00 +0530 Subject: [nycphp-talk] advice on scaling up In-Reply-To: <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> References: <1A3E8185-1DE3-4CDA-BEFF-32BD45E4934F@sala.ca> <992E6D4C-B006-4570-817F-45617F0BF5D7@suzerain.com> Message-ID: <200707111804.01304.arzala@gmail.com> On Tuesday 10 Jul 2007 23:17:13 Marc Antony Vose wrote: > Hi all: > > I'm a developer who has concentrated more on smaller-scale projects, > but as it turns out one of my projects is beginning to stress the > limits of a single server, and so I'm about to begin venturing into > the unknown. > > The project is currently in the "tens of thousands" of users range, > but it looks like we need to start drafting a plan to scale it up to > "hundreds of thousands" to a million or so users. > > This is a site that is running on a custom built PHP framework (which > seems to be performing rather well), and MySQL. The server's running > Apache and Linux (Red Hat). There is some image and data uploading > from users, and most pages are served dynamically, currently, with > very simple SQL. I have taken the step of caching any page elements > that require any kind of recursion or iteration to produce (such as a > list of categories that displays the number of related items from > other tables in it), but I have not cached, for example, database > calls to just one item matching on the primary key. I think this > approach has been sensible so far. > > If I had to classify the site, I'd say it follows a similar usage > pattern as something like last.fm, or facebook, only much smaller. > Social networking-type thing, but users are not constantly visiting > and reloading pages, like a news site. > > So, more than the PHP coding strategy, my question is about what kind > of hosting/server arrangement I would be looking at to handle the > kind of load I'm talking about. > > How many servers will I need to handle the kind of traffic I > require? If this question is not so easily answered, then what would > be my equation for figuring this out? A friend told me he works on a > site that has 4,000,000 users and they have their system optimized to > handle 500 requests per second. This is for a search engine-type > site...is this a reasonable metric? > > When you separate database and http servers, then what should be the > hardware priorities for each? CPU speed? RAM? hard disk speed, > etc.? Perhaps the database is more RAM and HD dependent, and the web > server will need more CPU and RAM? > > I'd be interesting in learning a bit from those of you who are > working on larger-scale projects what's powering your servers, and > what kind of capacity you think your setup's giving you. > > Thanks for helping me determine exactly where to research. > > Cheers, > > Marc Vose > Suzerain Studios Let me try to suggest some general points. At client environment you may use Ajax (and JSON) to increase responsiveness of your website. But effective implementation of Ajax requires good knowledge of JS and how it interacts with server. On server side you may split your application in 3 type of environments viz: Database environment, Static server environment for serving static contents of your site like images, css etc and Main environment for executing PHP code and serving output. Hence good configuration and well written code can effectively utilize all of 3 environments. Database environment may include Replication of Clustering depending upon requirement, load and budget, Static environment may be running on lightweight web server like Lighttpd just to serve static data, and Main server environment may be implemented using LVS (type of clustering) to execute PHP code and to server output from more than 1 servers to balance load. Additionally, you may also implementing caching of output and code at various levels. For that, you can use Opcode/Bytecode cacheres like XCache, APC, eAccelerator etc. to execute your PHP scripts more faster, if you are using frameworks like Symfony, Zend etc. then you can use their own caching methods and finally reverse proxies like Varnish, Squid to cache static and dynamic data at web server level. I hope these suggestions will help you in understanding scaling of your application. -- Anirudh Zala From arzala at gmail.com Thu Jul 12 03:11:49 2007 From: arzala at gmail.com (Anirudh Zala) Date: Thu, 12 Jul 2007 12:41:49 +0530 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: <4694B4FC.1080404@gmx.net> References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <200707101649.00624.arzala@gmail.com> <4694B4FC.1080404@gmx.net> Message-ID: <200707121241.49790.arzala@gmail.com> On Wednesday 11 Jul 2007 16:16:20 David Krings wrote: > Anirudh Zala wrote: > > Hence when user moved to last box or finally to upload button, 70% of > > images would have transferred in background. This saves lot of uploading > > time and user thinks that transfer of images went faster however in > > reality it is same. > > And what would one do if the user changes his/her mind and browses to a > different picture in the first five boxes? If the concern is > transmission time / amount then why design a system that allows for > bogus uploads? Then those 5 pictures will get uploaded again to replace older ones hence no bogus uploads. However you can say that 5 images were uploaded without any need but practically it has been seen that only 15% to 20% images are re-uploaded by users. > And what to do if the user turned ECMAScript off? If script is off then regular form will upload all images at once using POST method. > > Just asking.... Thanks Anirudh Zala > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From randalrust at gmail.com Thu Jul 12 09:33:03 2007 From: randalrust at gmail.com (Randal Rust) Date: Thu, 12 Jul 2007 09:33:03 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> Message-ID: On 6/20/07, Nelly Yusupova wrote: > Is there a script or any way I can resize the pictures before uploading? We run into this kind of situation all the time with our CMS. Clients just don't seem to get why they can't upload photos from their 9 megapixel camera to their website and then have them display properly. Usually we have to actually show them that a 72 ppi image is something like 24 inches wide on their 19-inch monitor, then they get it. Assuming that these people who are uploading images are all in the same office, or work together, then it's simple. They need to go buy copies of Photoshop LE and you need to give them the instructions on how to resample and resize the images before they upload them. -- Randal Rust R.Squared Communications www.r2communications.com From support at dailytechnology.net Thu Jul 12 09:39:54 2007 From: support at dailytechnology.net (Brian Dailey) Date: Thu, 12 Jul 2007 09:39:54 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> Message-ID: <46962F2A.5060504@dailytechnology.net> A less expensive option (if you're going to go the "fix the root cause" route) is to use the free program Irfanview. I'm sure there are other free alternatives, but Irfanview is fairly easy for the uninitiated to use. - Brian Randal Rust wrote: > On 6/20/07, Nelly Yusupova wrote: > >> Is there a script or any way I can resize the pictures before uploading? > > We run into this kind of situation all the time with our CMS. Clients > just don't seem to get why they can't upload photos from their 9 > megapixel camera to their website and then have them display properly. > Usually we have to actually show them that a 72 ppi image is something > like 24 inches wide on their 19-inch monitor, then they get it. > > Assuming that these people who are uploading images are all in the > same office, or work together, then it's simple. They need to go buy > copies of Photoshop LE and you need to give them the instructions on > how to resample and resize the images before they upload them. > -- Thanks! - Brian Dailey Software Developer New York, NY www.dailytechnology.net -------------- next part -------------- A non-text attachment was scrubbed... Name: support.vcf Type: text/x-vcard Size: 264 bytes Desc: not available URL: From dell at sala.ca Thu Jul 12 14:39:06 2007 From: dell at sala.ca (Dell Sala) Date: Thu, 12 Jul 2007 14:39:06 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: <46962F2A.5060504@dailytechnology.net> References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <46962F2A.5060504@dailytechnology.net> Message-ID: <09F7BCB2-3AEC-4EC3-A137-780C51F6C089@sala.ca> On Jul 12, 2007, at 9:39 AM, Brian Dailey wrote: > Randal Rust wrote: >> On 6/20/07, Nelly Yusupova wrote: >>> Is there a script or any way I can resize the pictures before >>> uploading? >> They need to go buy copies of Photoshop LE and you need to give >> them the instructions on how to resample and resize the images >> before they upload them. > > A less expensive option (if you're going to go the "fix the root > cause" route) is to use the free program Irfanview. I'm sure there > are other free alternatives, but Irfanview is fairly easy for the > uninitiated to use. Check out http://picnik.com/ This is a surprisingly powerful and easy-to-use online image editor. All implemented in flash. Basic accounts are free. One cool feature is that you can email the image somewhere after you've finished editing it. I've been toying with the idea of implementing a CMS tool that supports image uploads through a pop account. The idea would be, after you've finished editing your image in picnic, you would email it to upload at SOMDOMAIN.COM, and the CMS application would automatically check that mailbox for new images. Probably some security issues with this though... any thoughts? -- Dell From cliff at pinestream.com Thu Jul 12 21:54:15 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Thu, 12 Jul 2007 21:54:15 -0400 Subject: [nycphp-talk] ADOdb status Message-ID: I just stumbled across ADOdb. Is this database abstraction library still active? Have things like PDO or PEAR DB made it obsolete? Cliff -------------- next part -------------- An HTML attachment was scrubbed... URL: From brenttech at gmail.com Thu Jul 12 22:22:39 2007 From: brenttech at gmail.com (Brent Baisley) Date: Thu, 12 Jul 2007 22:22:39 -0400 Subject: [nycphp-talk] Please wait, processing, message technique In-Reply-To: References: Message-ID: I think you can rely on Javascript being present and enabled, with the all the web 2.0 stuff out there it just about has to be. When I needed to run something long, I've run it in the background using the exec command. If you have command line php enabled, this could be just another php script. In that script you could use pcntl_fork to speed things up even more (multiprocessing). I would then periodically call a script to check on the progress. Or the user could surf and do other things and then come back the page, at which time a check would be performed. O'Reilly sort of works this way when you want to create a PDF of a book chapter. If you use exec, you need to make sure it disconnects itself from the php process. As I recall you need to run it in the background (&) and send output to /dev/null. I forget if you need to do nohup also. You could get a bunch of things going at once, credit card payment and pi calcs. On Jul 10, 2007, at 1:31 PM, Cliff Hirsch wrote: > For long and indeterminate page processing, like connecting with a > credit card payment gateway or calculating pi to thousands of > significant digits, what is your preferred method for displaying > ?please wait?? > > I see two techniques: > Use Javascript upon form submission to display the ?please wait? > message > Echo a ?please wait? page from the server and then do a 302 > redirect upon completion of the scrpt. > > Issues: > Not everyone uses JavaScript > Can you issue a header redirect after echoing a ?please wait? > message. I though headers need to be sent first. Is a 302 header > redirect an exception? > > Cliff > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From matteo.rinaudo at gmail.com Thu Jul 12 22:25:39 2007 From: matteo.rinaudo at gmail.com (Matteo Rinaudo) Date: Thu, 12 Jul 2007 22:25:39 -0400 Subject: [nycphp-talk] ADOdb status In-Reply-To: References: Message-ID: > I just stumbled across ADOdb. Is this database abstraction library still > active? Have things like PDO or PEAR DB made it obsolete? Hi, it looks like this project is still active (Activity Percentile (last week) : 97.78 in Source Forge), and the latest releases: adodb-php-4-and-5 adodb-495a-for-php May 20, 2007 adodb-php5-only adodb-501-for-php May 17, 2007 adodb-python adodb-py-202b May 21, 2007 are not so outdated. PDO and PEAR DB are excellent tools to access data; I use ADOdb. Matteo From jeff.loiselle at gmail.com Thu Jul 12 22:41:57 2007 From: jeff.loiselle at gmail.com (Jeff Loiselle) Date: Thu, 12 Jul 2007 22:41:57 -0400 Subject: [nycphp-talk] ADOdb status In-Reply-To: References: Message-ID: <56E93F08-C684-48ED-9FA2-3107AAB1A9F2@gmail.com> Live and kicking it is Sent from my iPhone On Jul 12, 2007, at 9:54 PM, Cliff Hirsch wrote: > I just stumbled across ADOdb. Is this database abstraction library > still active? Have things like PDO or PEAR DB made it obsolete? > > Cliff > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at enobrev.com Fri Jul 13 03:11:18 2007 From: lists at enobrev.com (Mark Armendariz) Date: Fri, 13 Jul 2007 03:11:18 -0400 Subject: [nycphp-talk] ADOdb status In-Reply-To: <56E93F08-C684-48ED-9FA2-3107AAB1A9F2@gmail.com> References: <56E93F08-C684-48ED-9FA2-3107AAB1A9F2@gmail.com> Message-ID: <009501c7c51d$02e89970$0200a8c0@enobrev> I don't imagine they've stopped working on it. I used it for years until I started doing my own abstraction late last year. Still a huge fan of the library. Last I read on the list a few month back, they were still pretty active with it stating that even in the world of PDO they would still be useful. Here's the guy who runs it (John Lim): http://phplens.com/phpeverywhere/ Mark _____ From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Jeff Loiselle Sent: Thursday, July 12, 2007 10:42 PM To: NYPHP Talk Subject: Re: [nycphp-talk] ADOdb status Live and kicking it is Sent from my iPhone On Jul 12, 2007, at 9:54 PM, Cliff Hirsch wrote: I just stumbled across ADOdb. Is this database abstraction library still active? Have things like PDO or PEAR DB made it obsolete? Cliff _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From cliff at pinestream.com Fri Jul 13 06:20:31 2007 From: cliff at pinestream.com (Cliff Hirsch) Date: Fri, 13 Jul 2007 06:20:31 -0400 Subject: [nycphp-talk] Please wait, processing, message technique In-Reply-To: Message-ID: On 7/12/07 10:22 PM, "Brent Baisley" wrote: > I think you can rely on Javascript being present and enabled, with the all the > web 2.0 stuff out there it just about has to be. > > When I needed to run something long, I've run it in the background using the > exec command. If you have command line php enabled, this could be just another > php script. In that script you could use pcntl_fork to speed things up even > more (multiprocessing).? > I would then periodically call a script to check on the progress. Or the user > could surf and do other things and then come back the page, at which time a > check would be performed. O'Reilly sort of works this way when you want to > create a PDF of? a book chapter. > > If you use exec, you need to make sure it disconnects itself from the php > process. As I recall you need to run it in the background (&) and send output > to /dev/null. I forget if you need to do nohup also. You could get a bunch of > things going at once, credit card payment and pi calcs. > Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From jakob.buchgraber at googlemail.com Fri Jul 13 14:09:47 2007 From: jakob.buchgraber at googlemail.com (Jakob Buchgraber) Date: Fri, 13 Jul 2007 20:09:47 +0200 Subject: [nycphp-talk] Rely on destructor to be called?! In-Reply-To: <6ec19ec70707021845r4e283215se80e35980d728c7a@mail.gmail.com> References: <468407F0.6090909@gmail.com> <6ec19ec70707021845r4e283215se80e35980d728c7a@mail.gmail.com> Message-ID: <4697BFEB.8020908@gmail.com> > It might depend on the setting for ignore_user_abort, if that's off, and > the user aborts > the request I'm not sure if/how the destructors are called. > Good point. I tested this with the following script: The destructor definitely gets called as the file exists regardless if I abort the request or not. jakob -- Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 From jostevison at mac.com Fri Jul 13 22:07:21 2007 From: jostevison at mac.com (jostevison at mac.com) Date: Fri, 13 Jul 2007 20:07:21 -0600 Subject: [nycphp-talk] CakePHP Message-ID: So I thought I would take a look at diving into learning CakePHP. Should I be using version 1.1 or 1.2? I see people using both but 1.2 says Alpha on the download page. With which can I get the best documentation? Thanks, Jeff From jonbaer at jonbaer.com Fri Jul 13 22:56:31 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Fri, 13 Jul 2007 22:56:31 -0400 Subject: [nycphp-talk] CakePHP In-Reply-To: References: Message-ID: <1DA7983A-2AB0-45A8-8C3B-93F25556AEA1@jonbaer.com> @ this point it really depends on what you are looking to do, for the most basic stuff you can use either, 1.2 comes w/ more behaviors and helpers and a nice Memcache engine for more advanced usage. Umm ConsoleShell is 1.2 and a few other niceties. Just keep you eyes peeled + im sure using 1.2 would help the team out tracking issues ... anything crucial to your app should be reviewed in link below. https://trac.cakephp.org/milestone/1.2.x.x - Jon On Jul 13, 2007, at 10:07 PM, jostevison at mac.com wrote: > So I thought I would take a look at diving into learning CakePHP. > Should I be using version 1.1 or 1.2? I see people using both but > 1.2 says Alpha on the download page. With which can I get the best > documentation? > > Thanks, > > Jeff > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From shadab_w at yahoo.co.in Sat Jul 14 07:53:15 2007 From: shadab_w at yahoo.co.in (Shadab Wadiwala) Date: Sat, 14 Jul 2007 12:53:15 +0100 (BST) Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP Message-ID: <561120.82185.qm@web8708.mail.in.yahoo.com> Hello friends, I m working on a minor project using PHP/MySQL in my college. I have been assigned a tough task to do. The project is a web-based email service on the lines of Yahoo Mail and Gmail. Actually I need to create an online POP3 account and an SMTP account of an end-user in the email server using PHP. I don't have any experience in online POP3 and SMTP accounts creation and not aware with the PHP codes to perform the specific task. So if u know any thing regarding the above mentioned task so pls help me. Thank you Shadab .I. Wadiwala My homepage:-- http://shadabworld.110mb.com --------------------------------- Here?s a new way to find what you're looking for - Yahoo! Answers -------------- next part -------------- An HTML attachment was scrubbed... URL: From rolan at omnistep.com Sat Jul 14 10:50:43 2007 From: rolan at omnistep.com (Rolan Yang) Date: Sat, 14 Jul 2007 10:50:43 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <561120.82185.qm@web8708.mail.in.yahoo.com> References: <561120.82185.qm@web8708.mail.in.yahoo.com> Message-ID: <4698E2C3.3060006@omnistep.com> Shadab Wadiwala wrote: > Hello friends, > > I m working on a minor project using PHP/MySQL in my college. > I have been assigned a tough task to do. > The project is a web-based email service on the lines of Yahoo Mail > and Gmail. > > Actually I need to create an online POP3 account and an SMTP account > of an end-user in the email server using PHP. > I don't have any experience in online POP3 and SMTP accounts creation > and not aware with the PHP codes to perform the specific task. > > So if u know any thing regarding the above mentioned task so pls help me. Does NYPHP get to share your degree upon graduation? ~Rolan From pyurt at yahoo.com Sat Jul 14 12:32:46 2007 From: pyurt at yahoo.com (pyurt) Date: Sat, 14 Jul 2007 09:32:46 -0700 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <561120.82185.qm@web8708.mail.in.yahoo.com> Message-ID: <047c01c7c634$a12c1bd0$6700a8c0@Pres2103> Did you mean "minor" project or a "miner" project? "There's gold in them thar hills!" Paul The most accurate credible, & timely website directory on the web: mastermoz.com _____ From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Shadab Wadiwala Sent: Saturday, July 14, 2007 4:53 AM To: NYPHP Talk Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP Hello friends, I m working on a minor project using PHP/MySQL in my college. I have been assigned a tough task to do. The project is a web-based email service on the lines of Yahoo Mail and Gmail. Actually I need to create an online POP3 account and an SMTP account of an end-user in the email server using PHP. I don't have any experience in online POP3 and SMTP accounts creation and not aware with the PHP codes to perform the specific task. So if u know any thing regarding the above mentioned task so pls help me. Thank you Shadab .I. Wadiwala My homepage:-- http://shadabworld.110mb.com _____ Here's a new way to find what you're looking for - Yahoo! Answers -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Sat Jul 14 12:33:37 2007 From: ramons at gmx.net (David Krings) Date: Sat, 14 Jul 2007 12:33:37 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <561120.82185.qm@web8708.mail.in.yahoo.com> References: <561120.82185.qm@web8708.mail.in.yahoo.com> Message-ID: <4698FAE1.5090803@gmx.net> Shadab Wadiwala wrote: > Hello friends, > > I m working on a minor project using PHP/MySQL in my college. > I have been assigned a tough task to do. > The project is a web-based email service on the lines of Yahoo Mail and > Gmail. > > Actually I need to create an online POP3 account and an SMTP account of > an end-user in the email server using PHP. > I don't have any experience in online POP3 and SMTP accounts creation > and not aware with the PHP codes to perform the specific task. > > So if u know any thing regarding the above mentioned task so pls help me. > > Thank you > Did you at least google for "PHP POP3 SMTP"? That gives as the top result this page: http://www.weberdev.com/get_example-501.html You then need some mail server, there is usually one or more in every Linux distro or you can use Mercury Mail on Windows or ask the IT department at your school if they can provide you with a dummy server that can only send email to itself or so. You may want to find the most popular mail server applications and read through their documentation. That will give you a good start to learn how to talk to a mail server. You can also read up on the POP3 and SMTP standards, I am pretty sure they are documented in detail to the nth degree. Sure, you can copy the example and hope that it works, but be sure that your prof will do the same (profs tend to be quite smart). Also, this mailing list gets archived on the web and is searchable, so be careful what you ask for. If you copy, at least reference the source or better come up with a good story. Otherwise be prepared to get exmatriculated for plagiarism. That aside, I think you should talk to your prof and discuss this with him/her. I don't consider this a "minor project" and wonder what a major project would be. Maybe you both can agree on something that is still challanging to you, but isn't impossible given your current knowledge and the time available. You asking this now makes me suspect that this is a summer session course, so you won't have much time. Good luck! David From max at neuropunks.org Fri Jul 20 13:46:23 2007 From: max at neuropunks.org (Max Gribov) Date: Fri, 20 Jul 2007 13:46:23 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <561120.82185.qm@web8708.mail.in.yahoo.com> References: <561120.82185.qm@web8708.mail.in.yahoo.com> Message-ID: <46A0F4EF.2040103@neuropunks.org> Shadab Wadiwala wrote: > Hello friends, > > I m working on a minor project using PHP/MySQL in my college. > I have been assigned a tough task to do. > The project is a web-based email service on the lines of Yahoo Mail > and Gmail. > > Actually I need to create an online POP3 account and an SMTP account > of an end-user in the email server using PHP. This implies that both POP/IMAP and SMTP server share same backend for authentication/storage - LDAP or SQL would be easiest because you can easily change those in PHP. There are plenty of documents describing how to set something like this up. This sounds like 50% programming project and 50% sysadmin project. Good luck. > I don't have any experience in online POP3 and SMTP accounts creation > and not aware with the PHP codes to perform the specific task. > > So if u know any thing regarding the above mentioned task so pls help me. > > Thank you > > > */_Shadab .I. Wadiwala_/* > *_My homepage:--_ http://shadabworld.110mb.com* > > ------------------------------------------------------------------------ > Here?s a new way to find what you're looking for - Yahoo! Answers > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From shadab_w at yahoo.co.in Sat Jul 14 13:54:40 2007 From: shadab_w at yahoo.co.in (Shadab Wadiwala) Date: Sat, 14 Jul 2007 18:54:40 +0100 (BST) Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <4698FAE1.5090803@gmx.net> Message-ID: <420673.43090.qm@web8711.mail.in.yahoo.com> Hi all, Well , I suppose the people on the community are still not clear with my question. So let me make it clear .... I mean if somebody registers with my email service..... then his/her POP3 and SMTP accounts should be created automatically in the email server ..... like as they r created on YahooMail and Gmail or ant other web-based email service without the intervention of the admin. Also Mr. David suspected that is this a minor project and wondered why not its a major project !! So well, this is really a minor project as there is nothing special about building an email service as far u r clear how our application is going to communicate with the email servers. Also someone asked to share the degree i will be getting upon completing my graduation !! So well, i would always like to share it with NYPHP .... I would awarded the degree of ------ Bachelor of technology (B.Tech) in IT upon completion of my graduation. Its equivalent to a BS degree earned from a US University. David Krings wrote: Shadab Wadiwala wrote: > Hello friends, > > I m working on a minor project using PHP/MySQL in my college. > I have been assigned a tough task to do. > The project is a web-based email service on the lines of Yahoo Mail and > Gmail. > > Actually I need to create an online POP3 account and an SMTP account of > an end-user in the email server using PHP. > I don't have any experience in online POP3 and SMTP accounts creation > and not aware with the PHP codes to perform the specific task. > > So if u know any thing regarding the above mentioned task so pls help me. > > Thank you > Did you at least google for "PHP POP3 SMTP"? That gives as the top result this page: http://www.weberdev.com/get_example-501.html You then need some mail server, there is usually one or more in every Linux distro or you can use Mercury Mail on Windows or ask the IT department at your school if they can provide you with a dummy server that can only send email to itself or so. You may want to find the most popular mail server applications and read through their documentation. That will give you a good start to learn how to talk to a mail server. You can also read up on the POP3 and SMTP standards, I am pretty sure they are documented in detail to the nth degree. Sure, you can copy the example and hope that it works, but be sure that your prof will do the same (profs tend to be quite smart). Also, this mailing list gets archived on the web and is searchable, so be careful what you ask for. If you copy, at least reference the source or better come up with a good story. Otherwise be prepared to get exmatriculated for plagiarism. That aside, I think you should talk to your prof and discuss this with him/her. I don't consider this a "minor project" and wonder what a major project would be. Maybe you both can agree on something that is still challanging to you, but isn't impossible given your current knowledge and the time available. You asking this now makes me suspect that this is a summer session course, so you won't have much time. Good luck! David Shadab .I. Wadiwala My homepage:-- http://shadabworld.110mb.com --------------------------------- Here?s a new way to find what you're looking for - Yahoo! Answers -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Sat Jul 14 17:03:41 2007 From: ramons at gmx.net (David Krings) Date: Sat, 14 Jul 2007 17:03:41 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <420673.43090.qm@web8711.mail.in.yahoo.com> References: <420673.43090.qm@web8711.mail.in.yahoo.com> Message-ID: <46993A2D.2010901@gmx.net> Shadab Wadiwala wrote: > Hi all, > > > Well , I suppose the people on the community are still not clear with > my question. So let me make it clear .... > > I mean if somebody registers with my email service..... then his/her > POP3 and SMTP accounts should be created automatically in the email > server ..... like as they r created on YahooMail and Gmail or ant other > web-based email service without the intervention of the admin. So you want to make a user interface using PHP that creates an account on your mail server. Right? In that case, I wonder why you need MySQL... OK, so for which mail server do you want to create the user interface? Or do I still not get it? > Also Mr. David suspected that is this a minor project and wondered why > not its a major project !! > So well, this is really a minor project as there is nothing special > about building an email service as far u r clear how our application is > going to communicate with the email servers. So, if it is nothing special, why do you ask for help? > Also someone asked to share the degree i will be getting upon completing > my graduation !! > So well, i would always like to share it with NYPHP .... > I would awarded the degree of ------ Bachelor of technology (B.Tech) > in IT upon completion of my graduation. > Its equivalent to a BS degree earned from a US University. I think that was just a clever way of telling you that if it is your study project you are expected to figure it out / learn about it yourself rather than to ask others for the solution. So, is it really the same like a BS from a US university? 3/4th of the courses are like history, language, and sports and only 1/4th is about your major? Regardless of that, I for my part don't have any reservations against helping you out. I don't even want half or your degree or such. But, before I speculate any longer, first create clear specifications. 1. What is this gizmo supposed to do in general?* 2. Which tools do you want / have to use? 3. What are all the other prerequisits and limitations? 4. What are the individual functions you need to implement? 5. How are the individual functions supposed to work? 6. What is the required input and expected output of each of these functions? * Describe this without stating "has to work like GMail" or similar comparisons that are not nutritious at all. I have no clue how GMail works, I only know that it works. If you have written detailed and revised answers to all these questions 80% of your work is done. The remaining 20% are 10% for coding and 10% for documenting your code. I have no problem in helping you with the 10% of the coding to the best of my abilities (which aren't that great, sorry), the rest of it is your task. So, and with that I already did 5% of the first 80% for you. Here is your plan of action, get working...at least this is how I got my technician certification as well as my BSEE and MSTM degrees. David From ben at projectskyline.com Sat Jul 14 17:08:10 2007 From: ben at projectskyline.com (Ben Sgro (ProjectSkyLine)) Date: Sat, 14 Jul 2007 17:08:10 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP References: <420673.43090.qm@web8711.mail.in.yahoo.com> <46993A2D.2010901@gmx.net> Message-ID: <001c01c7c65b$16253810$6401a8c0@gamebox> For real, Please put some work in on your end before comming and asking for our help. By the way, your welcome for fixing your phpmailer issues. I'd be glad to help you out, but as David stated, please present a bit more detail or (even better) a full blown spec. - Ben Ben Sgro, Chief Engineer ProjectSkyLine - Defining New Horizons +1 718.487.9368 (N.Y. Office) Our company: www.projectskyline.com Our products: www.project-contact.com This e-mail is confidential information intended only for the use of the individual to whom it is addressed. ----- Original Message ----- From: "David Krings" To: "NYPHP Talk" Sent: Saturday, July 14, 2007 5:03 PM Subject: Re: [nycphp-talk] Online POP3 and SMTP account creation using PHP > Shadab Wadiwala wrote: >> Hi all, >> >> >> Well , I suppose the people on the community are still not clear with >> my question. So let me make it clear .... >> >> I mean if somebody registers with my email service..... then his/her POP3 >> and SMTP accounts should be created automatically in the email server >> ..... like as they r created on YahooMail and Gmail or ant other >> web-based email service without the intervention of the admin. > > So you want to make a user interface using PHP that creates an account on > your mail server. Right? In that case, I wonder why you need MySQL... > > OK, so for which mail server do you want to create the user interface? Or > do I still not get it? > > >> Also Mr. David suspected that is this a minor project and wondered why >> not its a major project !! >> So well, this is really a minor project as there is nothing special about >> building an email service as far u r clear how our application is going >> to communicate with the email servers. > > So, if it is nothing special, why do you ask for help? > >> Also someone asked to share the degree i will be getting upon completing >> my graduation !! >> So well, i would always like to share it with NYPHP .... >> I would awarded the degree of ------ Bachelor of technology (B.Tech) in >> IT upon completion of my graduation. >> Its equivalent to a BS degree earned from a US University. > > I think that was just a clever way of telling you that if it is your study > project you are expected to figure it out / learn about it yourself rather > than to ask others for the solution. So, is it really the same like a BS > from a US university? 3/4th of the courses are like history, language, and > sports and only 1/4th is about your major? > > Regardless of that, I for my part don't have any reservations against > helping you out. I don't even want half or your degree or such. But, > before I speculate any longer, first create clear specifications. > 1. What is this gizmo supposed to do in general?* > 2. Which tools do you want / have to use? > 3. What are all the other prerequisits and limitations? > 4. What are the individual functions you need to implement? > 5. How are the individual functions supposed to work? > 6. What is the required input and expected output of each of these > functions? > > * Describe this without stating "has to work like GMail" or similar > comparisons that are not nutritious at all. I have no clue how GMail > works, I only know that it works. > > If you have written detailed and revised answers to all these questions > 80% of your work is done. The remaining 20% are 10% for coding and 10% for > documenting your code. I have no problem in helping you with the 10% of > the coding to the best of my abilities (which aren't that great, sorry), > the rest of it is your task. > > So, and with that I already did 5% of the first 80% for you. Here is your > plan of action, get working...at least this is how I got my technician > certification as well as my BSEE and MSTM degrees. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From pyurt at yahoo.com Sat Jul 14 18:21:29 2007 From: pyurt at yahoo.com (pyurt) Date: Sat, 14 Jul 2007 15:21:29 -0700 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <001c01c7c65b$16253810$6401a8c0@gamebox> Message-ID: <04a401c7c665$539e0550$6700a8c0@Pres2103> Yes I agree. In my many years of experience specifying the design is often the biggest part of the project. In commercial projects the team can get in the way of the goal with things like feature creep and simple ignorance. I suggest that you do a lot of reading or searching&reading and then ask specific questions of the group...such efforts will bring you the most useful results. I am curious, what country offers a B.Tech degree? Paul The most accurate credible, & timely website directory on the web: mastermoz.com -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Ben Sgro (ProjectSkyLine) Sent: Saturday, July 14, 2007 2:08 PM To: NYPHP Talk Subject: Re: [nycphp-talk] Online POP3 and SMTP account creation using PHP For real, Please put some work in on your end before comming and asking for our help. By the way, your welcome for fixing your phpmailer issues. I'd be glad to help you out, but as David stated, please present a bit more detail or (even better) a full blown spec. - Ben Ben Sgro, Chief Engineer ProjectSkyLine - Defining New Horizons +1 718.487.9368 (N.Y. Office) Our company: www.projectskyline.com Our products: www.project-contact.com This e-mail is confidential information intended only for the use of the individual to whom it is addressed. ----- Original Message ----- From: "David Krings" To: "NYPHP Talk" Sent: Saturday, July 14, 2007 5:03 PM Subject: Re: [nycphp-talk] Online POP3 and SMTP account creation using PHP > Shadab Wadiwala wrote: >> Hi all, >> >> >> Well , I suppose the people on the community are still not clear with >> my question. So let me make it clear .... >> >> I mean if somebody registers with my email service..... then his/her POP3 >> and SMTP accounts should be created automatically in the email server >> ..... like as they r created on YahooMail and Gmail or ant other >> web-based email service without the intervention of the admin. > > So you want to make a user interface using PHP that creates an account on > your mail server. Right? In that case, I wonder why you need MySQL... > > OK, so for which mail server do you want to create the user interface? Or > do I still not get it? > > >> Also Mr. David suspected that is this a minor project and wondered why >> not its a major project !! >> So well, this is really a minor project as there is nothing special about >> building an email service as far u r clear how our application is going >> to communicate with the email servers. > > So, if it is nothing special, why do you ask for help? > >> Also someone asked to share the degree i will be getting upon completing >> my graduation !! >> So well, i would always like to share it with NYPHP .... >> I would awarded the degree of ------ Bachelor of technology (B.Tech) in >> IT upon completion of my graduation. >> Its equivalent to a BS degree earned from a US University. > > I think that was just a clever way of telling you that if it is your study > project you are expected to figure it out / learn about it yourself rather > than to ask others for the solution. So, is it really the same like a BS > from a US university? 3/4th of the courses are like history, language, and > sports and only 1/4th is about your major? > > Regardless of that, I for my part don't have any reservations against > helping you out. I don't even want half or your degree or such. But, > before I speculate any longer, first create clear specifications. > 1. What is this gizmo supposed to do in general?* > 2. Which tools do you want / have to use? > 3. What are all the other prerequisits and limitations? > 4. What are the individual functions you need to implement? > 5. How are the individual functions supposed to work? > 6. What is the required input and expected output of each of these > functions? > > * Describe this without stating "has to work like GMail" or similar > comparisons that are not nutritious at all. I have no clue how GMail > works, I only know that it works. > > If you have written detailed and revised answers to all these questions > 80% of your work is done. The remaining 20% are 10% for coding and 10% for > documenting your code. I have no problem in helping you with the 10% of > the coding to the best of my abilities (which aren't that great, sorry), > the rest of it is your task. > > So, and with that I already did 5% of the first 80% for you. Here is your > plan of action, get working...at least this is how I got my technician > certification as well as my BSEE and MSTM degrees. > > David > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From rolan at omnistep.com Sat Jul 14 19:17:38 2007 From: rolan at omnistep.com (Rolan Yang) Date: Sat, 14 Jul 2007 19:17:38 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <561120.82185.qm@web8708.mail.in.yahoo.com> References: <561120.82185.qm@web8708.mail.in.yahoo.com> Message-ID: <46995992.8010100@omnistep.com> Shadab Wadiwala wrote: > Hello friends, > > I m working on a minor project using PHP/MySQL in my college. > I have been assigned a tough task to do. > The project is a web-based email service on the lines of Yahoo Mail > and Gmail. > > Actually I need to create an online POP3 account and an SMTP account > of an end-user in the email server using PHP. > I don't have any experience in online POP3 and SMTP accounts creation > and not aware with the PHP codes to perform the specific task. > > So if u know any thing regarding the above mentioned task so pls help me. > > Thank you > Dirty, inelegant, but does the job according to your specs above: 1) run sendmail or postfix, which is probably installed by default on your linux distro 2) run the pop3 daemon 3) install and run squirrelmail 3) adduser php script which does something like this: This will probably get you a C- grade, but it works :) ~Rolan From tim_lists at o2group.com Sat Jul 14 19:39:35 2007 From: tim_lists at o2group.com (Tim Lieberman) Date: Sat, 14 Jul 2007 17:39:35 -0600 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <561120.82185.qm@web8708.mail.in.yahoo.com> References: <561120.82185.qm@web8708.mail.in.yahoo.com> Message-ID: <46995EB7.8080704@o2group.com> Wow, everyone's beat you up a bit. I'm not about to do your homework for you, but here's the way you should be thinking: 1) What POP3 server will you be using? 2) Can you be sure that the POP3 server will run on the same box as the web server? 3) How does that server store user information? in files, what kind of format? in a mySQL database? in an LDAP directory? 4) What features of PHP can you use to write to those files, or that database, or that directory? AFAIK, the POP3 protocol has no facility for creating accounts, so account creation will not happen over POP3. You'll need to write some PHP to manage user accounts in whatever datastore the POP3 server uses. A note about (2) above -- if the web app is required to deal with a remote POP3 server, you're going to have to figure out how to manipulate the user accounts on that remote server. If your POP3 server is using a file for user accounts, you'll need to figure out what mechanism you'll use to (securely!) modify that file remotely. If it's mySQL or LDAP, you'll have an easier time? HTH -Tim Shadab Wadiwala wrote: > Hello friends, > > I m working on a minor project using PHP/MySQL in my college. > I have been assigned a tough task to do. > The project is a web-based email service on the lines of Yahoo Mail > and Gmail. > > Actually I need to create an online POP3 account and an SMTP account > of an end-user in the email server using PHP. > I don't have any experience in online POP3 and SMTP accounts creation > and not aware with the PHP codes to perform the specific task. > > So if u know any thing regarding the above mentioned task so pls help me. > > Thank you > > > */_Shadab .I. Wadiwala_/* > *_My homepage:--_ http://shadabworld.110mb.com* > > ------------------------------------------------------------------------ > Here?s a new way to find what you're looking for - Yahoo! Answers > > ------------------------------------------------------------------------ > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From chsnyder at gmail.com Sun Jul 15 14:30:44 2007 From: chsnyder at gmail.com (csnyder) Date: Sun, 15 Jul 2007 14:30:44 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: <46995992.8010100@omnistep.com> References: <561120.82185.qm@web8708.mail.in.yahoo.com> <46995992.8010100@omnistep.com> Message-ID: On 7/14/07, Rolan Yang wrote: > // get $user and $password from $_REQUEST > // validate it > // check to make sure account doesn't exist > `sudo adduser -u $username -p $password -s /sbin/nologin`; > // show confirmation message that says your account has been created. > ?> > > > This will probably get you a C- grade, but it works :) Wow, we're giving the webserver sudo permissions now? You don't need system accounts in order to have mailboxes. Use a mail server that allows virtual user lookup in MySQL. This also allows you to scale your mail operation across multiple servers. Dovecot is apparently a good choice, one that I'm considering after many years with good ol' uw-imap. You can make up virtual UIDs so that the mailboxes are still owned by individual users or all the mail can be owned by a single system user. There's a lot of flexibility there, and good docs on how to get it all integrated with Postfix. Not an easy project, Shadab, but one that has the potential to teach you a lot about how internet email works at the nuts and bolts level. -- Chris Snyder http://chxo.com/ From chsnyder at gmail.com Sun Jul 15 14:42:56 2007 From: chsnyder at gmail.com (csnyder) Date: Sun, 15 Jul 2007 14:42:56 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: <09F7BCB2-3AEC-4EC3-A137-780C51F6C089@sala.ca> References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <46962F2A.5060504@dailytechnology.net> <09F7BCB2-3AEC-4EC3-A137-780C51F6C089@sala.ca> Message-ID: On 7/12/07, Dell Sala wrote: > Check out http://picnik.com/ > > This is a surprisingly powerful and easy-to-use online image editor. > All implemented in flash. Basic accounts are free. > Too cute for words. But it doesn't do anything about resizing/resampling pictures before uploading. Steve Francia mentioned Flash as a platform that has access to local files, but I can't think offhand of how you'd resize images using actionscript--otherwise everyone would be doing it by now. But maybe... On client education front, if you are lucky enough to have clients with Macs, you just need to teach them about Cmd-Shift-4, which gives you crosshairs for taking a screenshot. Open a large image in Preview.app, scale it onscreen, and then Cmd-Shift-4 to produce a smallish png (I know, not jpeg) that can be uploaded in a reasonable amount of time. > One cool feature is that you can email the image somewhere after > you've finished editing it. I've been toying with the idea of > implementing a CMS tool that supports image uploads through a pop > account. The idea would be, after you've finished editing your image > in picnic, you would email it to upload at SOMDOMAIN.COM, and the CMS > application would automatically check that mailbox for new images. > > Probably some security issues with this though... any thoughts? Yeah, how do you keep someone from publishing personal enhancement product ads to your CMS? It should be trivially easy to fake an email from picnik, or for that matter to just use picnik to spam in the first place. -- Chris Snyder http://chxo.com/ From rolan at omnistep.com Sun Jul 15 15:24:55 2007 From: rolan at omnistep.com (Rolan Yang) Date: Sun, 15 Jul 2007 15:24:55 -0400 Subject: [nycphp-talk] Online POP3 and SMTP account creation using PHP In-Reply-To: References: <561120.82185.qm@web8708.mail.in.yahoo.com> <46995992.8010100@omnistep.com> Message-ID: <469A7487.7090204@omnistep.com> csnyder wrote: > On 7/14/07, Rolan Yang wrote: > >> > // get $user and $password from $_REQUEST >> // validate it >> // check to make sure account doesn't exist >> `sudo adduser -u $username -p $password -s /sbin/nologin`; >> // show confirmation message that says your account has been created. >> ?> >> >> >> This will probably get you a C- grade, but it works :) > > Wow, we're giving the webserver sudo permissions now? > > You don't need system accounts in order to have mailboxes. Use a mail > server that allows virtual user lookup in MySQL. This also allows you > to scale your mail operation across multiple servers. > > Dovecot is apparently a good choice, one that I'm considering after > many years with good ol' uw-imap. You can make up virtual UIDs so that > the mailboxes are still owned by individual users or all the mail can > be owned by a single system user. There's a lot of flexibility there, > and good docs on how to get it all integrated with Postfix. > > Not an easy project, Shadab, but one that has the potential to teach > you a lot about how internet email works at the nuts and bolts level. > That was just an example of how to set something up in the simplest/quickest way. I've set up and still maintain a some large custom made clustered mail installations using a combination of postfix/mysql/courier-imap/squirrelmail blended an arsenal of mail blocking/filtering utilities like dspam, spamassassin, and antivirus. Some other interesting additions to that were things like a public key encryption proxy. Perhaps this would make an interesting talk one day, but it's more of a "systems" project than php one. ~Rolan From dell at sala.ca Sun Jul 15 17:08:21 2007 From: dell at sala.ca (Dell Sala) Date: Sun, 15 Jul 2007 17:08:21 -0400 Subject: [nycphp-talk] Resize pictures before uploading In-Reply-To: References: <200706201612.l5KGCcss010473@ms-smtp-03.rdc-nyc.rr.com> <46962F2A.5060504@dailytechnology.net> <09F7BCB2-3AEC-4EC3-A137-780C51F6C089@sala.ca> Message-ID: <37F99A4A-32D3-4F1C-B13D-E658B7D6EAEB@sala.ca> On Jul 15, 2007, at 2:42 PM, csnyder wrote: > On 7/12/07, Dell Sala wrote: > >> Check out http://picnik.com/ >> >> This is a surprisingly powerful and easy-to-use online image editor. >> All implemented in flash. Basic accounts are free. >> > > Too cute for words. But it doesn't do anything about > resizing/resampling pictures before uploading. True enough. >> One cool feature is that you can email the image somewhere after >> you've finished editing it. I've been toying with the idea of >> implementing a CMS tool that supports image uploads through a pop >> account. The idea would be, after you've finished editing your image >> in picnic, you would email it to upload at SOMDOMAIN.COM, and the CMS >> application would automatically check that mailbox for new images. >> >> Probably some security issues with this though... any thoughts? > > Yeah, how do you keep someone from publishing personal enhancement > product ads to your CMS? It should be trivially easy to fake an email > from picnik, or for that matter to just use picnik to spam in the > first place. I got this idea from backpack http://backpackit.com/ They provide an email api for adding to page content. They get around the security issue by randomly generating a reasonably long and complex mailbox name for each page that you create. ex: mouse55allice at youraccount.backpackit.com They also make it easy to regenerate the mailbox name with a single click if you believe it has been compromised. -- Dell From ps at sun-code.com Sun Jul 15 18:22:43 2007 From: ps at sun-code.com (Peter Sawczynec) Date: Sun, 15 Jul 2007 18:22:43 -0400 Subject: [nycphp-talk] PHP Functions Question Message-ID: <001d01c7c72e$aa2f5440$fe8dfcc0$@com> Is anyone aware if there might be an undocumented or obscurely documented special session function called: session_startI() ...instead of the regular: session_start() May have been introduced in PHP 5? And if you know about it, what is the intended purpose. Warmest regards, Peter Sawczynec Technology Dir. Sun-code.com Web related services 646.316.3678 ps at sun-code.com From ps at sun-code.com Sun Jul 15 18:49:02 2007 From: ps at sun-code.com (Peter Sawczynec) Date: Sun, 15 Jul 2007 18:49:02 -0400 Subject: [nycphp-talk] PHP Functions Question In-Reply-To: <001d01c7c72e$aa2f5440$fe8dfcc0$@com> References: <001d01c7c72e$aa2f5440$fe8dfcc0$@com> Message-ID: <001e01c7c732$577caff0$06760fd0$@com> I'll answer my own question here: I was just looking at some obscure legacy typo whose existence was long lost in time and only the most equally obscure circumstances brought it to the fore. Sorry for the ruckus. Peter -----Original Message----- From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Peter Sawczynec Sent: Sunday, July 15, 2007 6:23 PM To: 'Org, Talk at Nyphp.' Subject: [nycphp-talk] PHP Functions Question Is anyone aware if there might be an undocumented or obscurely documented special session function called: session_startI() ...instead of the regular: session_start() May have been introduced in PHP 5? And if you know about it, what is the intended purpose. Warmest regards, Peter Sawczynec Technology Dir. Sun-code.com Web related services 646.316.3678 ps at sun-code.com _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php From shaijudavis at gmail.com Sun Jul 15 20:55:04 2007 From: shaijudavis at gmail.com (shaiju davis) Date: Mon, 16 Jul 2007 06:25:04 +0530 Subject: [nycphp-talk] how to find the mysql server status Message-ID: <30ce306c0707151755mceabf8fxa7fc48c24a847e0b@mail.gmail.com> hi All, How can I get the mysql server status, no. of queries executed in a single page and the time to execute total queries in the index.php page. I would like to get the output like this. [ Execution time: 0.92 secs ] [ Memory usage: Unknown ] [ 50 database queries used ] [ GZIP Disabled ] [ Server load: 0.05 ] If anyone has the idea please reply to this mail. Thanks in advance Shaiju -------------- next part -------------- An HTML attachment was scrubbed... URL: From ramons at gmx.net Sun Jul 15 21:25:25 2007 From: ramons at gmx.net (David Krings) Date: Sun, 15 Jul 2007 21:25:25 -0400 Subject: [nycphp-talk] how to find the mysql server status In-Reply-To: <30ce306c0707151755mceabf8fxa7fc48c24a847e0b@mail.gmail.com> References: <30ce306c0707151755mceabf8fxa7fc48c24a847e0b@mail.gmail.com> Message-ID: <469AC905.7090801@gmx.net> shaiju davis wrote: > hi All, > > How can I get the mysql server status, no. of queries executed in a > single page and the time to execute total queries in the index.php page. > I would like to get the output like this. > [ Execution time: 0.92 secs ] [ Memory usage: Unknown ] [ 50 > database queries used ] [ GZIP Disabled ] [ Server load: 0.05 ] > > If anyone has the idea please reply to this mail. > > > Thanks in advance > Shaiju Execution time - use microtime and calculate the difference between start and end time. Mem use - no clue? Maybe some MySQL command line thingie to query the stats? Query count - counter, each time a query is run/was successful a counter is increased by one. You can also have different counters for total and failed queries (difference is the number of queries that worked). Server load, GZIP - no clue. HTH David From jonbaer at jonbaer.com Sun Jul 15 22:37:26 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Sun, 15 Jul 2007 22:37:26 -0400 Subject: [nycphp-talk] how to find the mysql server status In-Reply-To: <30ce306c0707151755mceabf8fxa7fc48c24a847e0b@mail.gmail.com> References: <30ce306c0707151755mceabf8fxa7fc48c24a847e0b@mail.gmail.com> Message-ID: Sounds like you might want something like mytop ... http://jeremy.zawodny.com/mysql/mytop/ Or SHOW PROCESSLIST http://dev.mysql.com/doc/refman/5.1/en/show-processlist.html Or mysql_stat() http://us2.php.net/manual/en/function.mysql-stat.php However the fact that you want # of queries made in a single page might be better to just do a query log dump and view it. - Jon On Jul 15, 2007, at 8:55 PM, shaiju davis wrote: > hi All, > > How can I get the mysql server status, no. of queries executed in a > single > page and the time to execute total queries in the index.php page. > I would like to get the output like this. > [ Execution time: 0.92 secs ] [ Memory usage: Unknown ] [ 50 > database > queries used ] [ GZIP Disabled ] [ Server load: 0.05 ] > > If anyone has the idea please reply to this mail. > > > Thanks in advance > Shaiju > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at enobrev.com Mon Jul 16 00:05:04 2007 From: lists at enobrev.com (Mark Armendariz) Date: Mon, 16 Jul 2007 00:05:04 -0400 Subject: [nycphp-talk] how to find the mysql server status In-Reply-To: References: <30ce306c0707151755mceabf8fxa7fc48c24a847e0b@mail.gmail.com> Message-ID: <58f08dcf0707152105t78ffcf09h75845e3a9e7f3f26@mail.gmail.com> On 7/15/07, Jon Baer wrote: > > mysql_stat() > http://us2.php.net/manual/en/function.mysql-stat.php mysql_stat is good. You can use a more direct status query if you need more than that using "show status": http://dev.mysql.com/doc/refman/5.1/en/show-status.html ' . print_r($var, 1) . ''; } function get_mysql_full_status() { $aReturn = array(); $oStatus = mysql_query('SHOW STATUS'); while($aStatus = mysql_fetch_row($oStatus)) { $aReturn[$aStatus[0]] = $aStatus[1]; } return $aReturn; } $oConnection = mysql_connect('localhost', 'me', 'y0 m at m@'); dbg(mysql_stat()); dbg(get_mysql_full_status()); ?> > However the fact that you want # of queries made in a single page might be > better to just do a query log dump and view it. If you're using a class or function for db access, you could increment a static or global var each time you run the mysql_query function and then in a destructor or at the end of the page you have your query count. From chsnyder at gmail.com Mon Jul 16 09:37:35 2007 From: chsnyder at gmail.com (csnyder) Date: Mon, 16 Jul 2007 09:37:35 -0400 Subject: [nycphp-talk] Practical Extraction in PHP Message-ID: I've had this idea in the back of my head to do a project that systematically tracks values embedded in web or email reports. For instance, I get logwatch emails from the servers I admin, and each time one of those comes in I'd like to extract the disk free space and put it into a round-robin database. Or I want to track the rendering time for various key pages in a CMS. The problem is that the value isn't always in the same place. It might be a few lines down because of alerts or content that precede it. Or it might look different some days (ending in GB rather than MB). It's possible that some combination of regex and recurrence number ( 5th instance of /[0-9]*(MB|BG)/ ) could work, but it seems messy. We all probably do a little of this on an ad hoc basis, scraping values out of websites and whatnot. Does anyone do it a lot? What kind of tools do you use? Is Perl better suited to the task? Or sed+awk? Does anyone know of a system (preferably php) that does this in the general case? TIA, y'all. -- Chris Snyder http://chxo.com/ From support at dailytechnology.net Mon Jul 16 10:35:20 2007 From: support at dailytechnology.net (Brian Dailey) Date: Mon, 16 Jul 2007 10:35:20 -0400 Subject: [nycphp-talk] Practical Extraction in PHP In-Reply-To: References: Message-ID: <469B8228.4020204@dailytechnology.net> Chris, I just recently was faced with a similar problem, but I'm not sure if my solution is 100% helpful or not. I ended up using grep to find what I was looking for, and then indicating the column position (which was pretty reliable) to further narrow down any false positives. It's sort of difficult to give a lot of help since we can't see the files themselves. I know for the project I worked on there was a lot of tweaking involved to make it 100% accurate. Would it be easier to obtain the results in another fashion? If you ran some sort of 'df -h' on a Linux file system you could get the disk space from that. Are the emailed reports are your only option? - Brian D. csnyder wrote: > I've had this idea in the back of my head to do a project that > systematically tracks values embedded in web or email reports. For > instance, I get logwatch emails from the servers I admin, and each > time one of those comes in I'd like to extract the disk free space and > put it into a round-robin database. Or I want to track the rendering > time for various key pages in a CMS. > > The problem is that the value isn't always in the same place. It might > be a few lines down because of alerts or content that precede it. Or > it might look different some days (ending in GB rather than MB). It's > possible that some combination of regex and recurrence number ( 5th > instance of /[0-9]*(MB|BG)/ ) could work, but it seems messy. > > We all probably do a little of this on an ad hoc basis, scraping > values out of websites and whatnot. Does anyone do it a lot? What kind > of tools do you use? Is Perl better suited to the task? Or sed+awk? > Does anyone know of a system (preferably php) that does this in the > general case? > > TIA, y'all. > -- Thanks! - Brian Dailey Software Developer New York, NY www.dailytechnology.net -------------- next part -------------- A non-text attachment was scrubbed... Name: support.vcf Type: text/x-vcard Size: 276 bytes Desc: not available URL: From ps at sun-code.com Mon Jul 16 22:26:48 2007 From: ps at sun-code.com (Peter Sawczynec) Date: Mon, 16 Jul 2007 22:26:48 -0400 Subject: [nycphp-talk] Manipulating $_REQUEST Directly Message-ID: <001201c7c819$ed88eda0$c89ac8e0$@com> I have inherited some old legacy code that down and dirty uses $_REQUEST to universally grab all varibales from combined GET and/or POST form submissions. So I want to be equally blunt and directly chop up and massage $_REQUEST before any code handles it. I want to have an array of acceptable "white list" $_REQUEST variable names I am looking for, allow those to remain in the $_REQUEST array, but I want all other $_REQUEST variables removed/destroyed out of $_REQUEST. Then simply allow the the remaining "white list" $_REQUEST to flow into the code. So, for example I want to do something really short like so: $whitelist_var_names = array('name', 'address', 'phone'); $_REQUEST = array_intersect_assoc($whitelist_var_names, $_REQUEST); Can anyone give me a really short code burst, or isolate the proper array function(s) that will do this for me? Thank you one and all, if you can help. Warmest regards, Peter Sawczynec Technology Dir. Sun-code.com Web related services 646.316.3678 ps at sun-code.com From chsnyder at gmail.com Tue Jul 17 10:56:30 2007 From: chsnyder at gmail.com (csnyder) Date: Tue, 17 Jul 2007 10:56:30 -0400 Subject: [nycphp-talk] Manipulating $_REQUEST Directly In-Reply-To: <001201c7c819$ed88eda0$c89ac8e0$@com> References: <001201c7c819$ed88eda0$c89ac8e0$@com> Message-ID: On 7/16/07, Peter Sawczynec wrote: > I have inherited some old legacy code that down and dirty uses $_REQUEST > to universally grab all varibales from combined GET and/or POST form > submissions. > > So I want to be equally blunt and directly chop up and massage $_REQUEST > before any code handles it. > > I want to have an array of acceptable "white list" $_REQUEST variable > names I am looking for, allow those to remain in the $_REQUEST array, > but I want all other $_REQUEST variables removed/destroyed out of > $_REQUEST. > > Then simply allow the the remaining "white list" $_REQUEST to flow into > the code. Down and dirty calls for a foreach. ;-) foreach( $_REQUEST AS $key=>$val ) { if ( !in_array( $key, $whitelist ) ) { unset( $_REQUEST[ $key ] ); } else { // do you have validation routines? // whitelist could include type info for validation... switch( $whitelist[ $key ] ) { case 'text': $_REQUEST[ $key ] = validated_text( $val ); break; } // end else } // end foreach } Maybe you were looking for something more efficient, but being able to independently validate the values might make it worth a few extra cycles, depending on whether the downstream code performs validation. -- Chris Snyder http://chxo.com/ From shiflett at php.net Tue Jul 17 11:07:13 2007 From: shiflett at php.net (Chris Shiflett) Date: Tue, 17 Jul 2007 11:07:13 -0400 Subject: [nycphp-talk] Manipulating $_REQUEST Directly In-Reply-To: References: <001201c7c819$ed88eda0$c89ac8e0$@com> Message-ID: <469CDB21.3030507@php.net> As a side note to this discussion, using $_REQUEST is a poor practice. For one, it makes it practically impossible to adhere to the HTTP specification: "In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested." If you're not distinguishing between GET and POST, you can't adhere to this recommendation. This can lead to numerous problems: http://shiflett.org/blog/2006/dec/google-web-accelerator-debate Hope that helps. Chris -- Chris Shiflett http://shiflett.org/ From urb at e-government.com Tue Jul 17 11:19:00 2007 From: urb at e-government.com (Urb LeJeune) Date: Tue, 17 Jul 2007 11:19:00 -0400 Subject: [nycphp-talk] Stripping formatting from a word document In-Reply-To: <469CDB21.3030507@php.net> References: <001201c7c819$ed88eda0$c89ac8e0$@com> <469CDB21.3030507@php.net> Message-ID: <7.0.1.0.2.20070717111743.0298da38@e-government.com> Is anyone aware of any PHP code that will strip formatting from a Word document? Urb Urb Dr. Urban A. LeJeune, President E-Government.com 800-204-9545 From jeff at newnewmedia.com Tue Jul 17 11:24:22 2007 From: jeff at newnewmedia.com (Jeff Loiselle) Date: Tue, 17 Jul 2007 11:24:22 -0400 Subject: [nycphp-talk] Stripping formatting from a word document In-Reply-To: <7.0.1.0.2.20070717111743.0298da38@e-government.com> References: <001201c7c819$ed88eda0$c89ac8e0$@com> <469CDB21.3030507@php.net> <7.0.1.0.2.20070717111743.0298da38@e-government.com> Message-ID: http://us.php.net/strip_tags looks promising. On Jul 17, 2007, at 11:19 AM, Urb LeJeune wrote: > Is anyone aware of any PHP code that will strip formatting from a > Word document? > > Urb > Urb > > Dr. Urban A. LeJeune, President > E-Government.com > 800-204-9545 > > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From chsnyder at gmail.com Tue Jul 17 11:25:28 2007 From: chsnyder at gmail.com (csnyder) Date: Tue, 17 Jul 2007 11:25:28 -0400 Subject: [nycphp-talk] Practical Extraction in PHP In-Reply-To: <469B8228.4020204@dailytechnology.net> References: <469B8228.4020204@dailytechnology.net> Message-ID: On 7/16/07, Brian Dailey wrote: > Would it be easier to obtain the results in another fashion? If you ran > some sort of 'df -h' on a Linux file system you could get the disk space > from that. Are the emailed reports are your only option? Yeah, it's probably just better to have various scripts that extract a value in context, rather than trying to create a general system for extracting values. But extracting from email is particularly attractive because the email is already coming in, so there's no remote configuration necessary. Plus, the systems sending the reports are in many flavors of OS, some of which I have no direct control over (such as firewall appliances). -- Chris Snyder http://chxo.com/ From ben at projectskyline.com Tue Jul 17 11:28:11 2007 From: ben at projectskyline.com (Ben Sgro (ProjectSkyLine)) Date: Tue, 17 Jul 2007 11:28:11 -0400 Subject: [nycphp-talk] Stripping formatting from a word document References: <001201c7c819$ed88eda0$c89ac8e0$@com><469CDB21.3030507@php.net><7.0.1.0.2.20070717111743.0298da38@e-government.com> Message-ID: <012301c7c887$162d5bc0$6401a8c0@gamebox> Hello, http://www.phpwordlib.motion-bg.com/ Looks good...but cost $..so doesn't look so good. But has a demo. Also, this code snippet: > Hi > > I wish to read MS Word document content using PHP as like text file. Is > anybody know any open source PHP script for it. or any other way to do > it? One easy way to grab the text from a word doc is to use the command line program catdoc. here are a couple of examples to get you started. Dan function catdoc_string($str) { // requires catdoc // write to temp file $tmpfname = tempnam ('/tmp','doc'); $handle = fopen($tmpfname,'w'); fwrite($handle,$a); fclose($handle); // run catdoc $ret = shell_exec('catdoc -ab '.escapeshellarg($tmpfname) .' 2>&1'); // remove temp file unlink($tmpfname); if (preg_match('/^sh: line 1: catdoc/i',$ret)) { return false; } return trim($ret); } function catdoc_file($fname) { // requires catdoc // run catdoc $ret = shell_exec('catdoc -ab '.escapeshellarg($fname) .' 2>&1'); if (preg_match('/^sh: line 1: catdoc/i',$ret)) { return false; } return trim($ret); }- Ben Ben Sgro, Chief Engineer ProjectSkyLine - Defining New Horizons +1 718.487.9368 (N.Y. Office) Our company: www.projectskyline.com Our products: www.project-contact.com This e-mail is confidential information intended only for the use of the individual to whom it is addressed. ----- Original Message ----- From: "Jeff Loiselle" To: "NYPHP Talk" Sent: Tuesday, July 17, 2007 11:24 AM Subject: Re: [nycphp-talk] Stripping formatting from a word document > http://us.php.net/strip_tags looks promising. > > On Jul 17, 2007, at 11:19 AM, Urb LeJeune wrote: > >> Is anyone aware of any PHP code that will strip formatting from a >> Word document? >> >> Urb >> Urb >> >> Dr. Urban A. LeJeune, President >> E-Government.com >> 800-204-9545 >> >> >> _______________________________________________ >> New York PHP Community Talk Mailing List >> http://lists.nyphp.org/mailman/listinfo/talk >> >> NYPHPCon 2006 Presentations Online >> http://www.nyphpcon.com >> >> Show Your Participation in New York PHP >> http://www.nyphp.org/show_participation.php > > _______________________________________________ > New York PHP Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > NYPHPCon 2006 Presentations Online > http://www.nyphpcon.com > > Show Your Participation in New York PHP > http://www.nyphp.org/show_participation.php From mailinglists at caseysoftware.com Tue Jul 17 11:30:49 2007 From: mailinglists at caseysoftware.com (Keith Casey) Date: Tue, 17 Jul 2007 11:30:49 -0400 Subject: [nycphp-talk] Stripping formatting from a word document In-Reply-To: References: <001201c7c819$ed88eda0$c89ac8e0$@com> <469CDB21.3030507@php.net> <7.0.1.0.2.20070717111743.0298da38@e-government.com> Message-ID: On 7/17/07, Jeff Loiselle wrote: > http://us.php.net/strip_tags looks promising. > > On Jul 17, 2007, at 11:19 AM, Urb LeJeune wrote: > > > Is anyone aware of any PHP code that will strip formatting from a > > Word document? This one is a bit old but comes in handy too: http://shiflett.org/blog/2005/oct/convert-smart-quotes-with-php I used a variation of it earlier this week. Thanks Chris. ;) kc -- D. Keith Casey Jr. CEO, CaseySoftware, LLC http://CaseySoftware.com From shaijudavis at gmail.com Tue Jul 17 11:50:36 2007 From: shaijudavis at gmail.com (shaiju davis) Date: Tue, 17 Jul 2007 21:20:36 +0530 Subject: [nycphp-talk] closing a page Message-ID: <30ce306c0707170850x2ef44a6dk620eeccb7eaeb26b@mail.gmail.com> hi, I have a php page with content download option and I need to close the window just after it shows the download option. Is it possible ? Thanks in advance, Shaiju Davis. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gatzby3jr at gmail.com Tue Jul 17 11:59:00 2007 From: gatzby3jr at gmail.com (Brian O'Connor) Date: Tue, 17 Jul 2007 11:59:00 -0400 Subject: [nycphp-talk] Should PHP5 be used for this? Message-ID: <29da5d150707170859o5c1296e4r43e08856714b307a@mail.gmail.com> Hello all, -- Brian O'Connor -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonbaer at jonbaer.com Tue Jul 17 12:00:13 2007 From: jonbaer at jonbaer.com (Jon Baer) Date: Tue, 17 Jul 2007 12:00:13 -0400 Subject: [nycphp-talk] closing a page In-Reply-To: <30ce306c0707170850x2ef44a6dk620eeccb7eaeb26b@mail.gmail.com> References: <30ce306c0707170850x2ef44a6dk620eeccb7eaeb26b@mail.gmail.com> Message-ID: echo '