php-general Digest 6 May 2012 12:54:43 -0000 Issue 7803
php-general Digest 6 May 2012 12:54:43 - Issue 7803 Topics (messages 317805 through 317810): I'm missing something 317805 by: Jim Giner 317806 by: Matijn Woudt 317807 by: Jim Giner 317808 by: Jim Giner 317809 by: Matijn Woudt PHP Subroutine Call Blowing UP with Strings 317810 by: George R Smith Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- I have a discrepancy in the number of elements in my arrays and can't see why. Here is some code: Note the lines with the *** *** $plyrs = 0; unset($plyrnames_ar); unset($js_names); unset($js_seeds); *** $rows = mysql_num_rows($qrslts); ***echo in mysql there are $rows rowsbr; while ($row = mysql_fetch_array($qrslts)) { // build the name value here $mi = ($row['MI']=='') ? '' : .$row['MI']; $nm = $row['LastName']., .$row['FirstName'].$mi; if ($row['srtdbls']=='X') { $mi = ($row['partMI']=='') ? '' : .$row['partMI']; $nm .= /.$row['partLN']., .$row['partFN'].$mi; } *** $plyrs++; $plyrnames_ar[$nm] = $row['Draw_pos']; } *** echo before sort there are .count($plyrnames_ar). in plyrsnames_arbr; ksort($plyrnames_ar); foreach ($plyrnames_ar as $nm=$sd) { $js_names[] = $nm; $js_seeds[] = $sd; } *** echo plyrs is $plyrs and there are .count($js_names). entries in js_rnames and .count ***($plyrnames_ar). entries in plyrnames_ar and .count($js_seeds). in js_seeds; exit(); The problem is that my $plyrs field comes up 18, while in truth there are only 17 rows of data in my database. All of the other array-size counts echo out as being only 17, but my $rows and $plyrs fields come up as 18. I was having problems with my javascript showing an undefined array element and took a bit o time to determine what it was and where it was happening. Questions - does mysql_num_rows return a extra row that somehow doesn't get processed in the while loop? And if it does how come the counter ($plyrs) that I put into the loop comes up higher than it should.? ---End Message--- ---BeginMessage--- On Sun, May 6, 2012 at 12:38 AM, Jim Giner jim.gi...@albanyhandball.com wrote: I have a discrepancy in the number of elements in my arrays and can't see why. Here is some code: Note the lines with the *** *** $plyrs = 0; unset($plyrnames_ar); unset($js_names); unset($js_seeds); *** $rows = mysql_num_rows($qrslts); ***echo in mysql there are $rows rowsbr; while ($row = mysql_fetch_array($qrslts)) { // build the name value here $mi = ($row['MI']=='') ? '' : .$row['MI']; $nm = $row['LastName']., .$row['FirstName'].$mi; if ($row['srtdbls']=='X') { $mi = ($row['partMI']=='') ? '' : .$row['partMI']; $nm .= /.$row['partLN']., .$row['partFN'].$mi; } *** $plyrs++; $plyrnames_ar[$nm] = $row['Draw_pos']; } *** echo before sort there are .count($plyrnames_ar). in plyrsnames_arbr; ksort($plyrnames_ar); foreach ($plyrnames_ar as $nm=$sd) { $js_names[] = $nm; $js_seeds[] = $sd; } *** echo plyrs is $plyrs and there are .count($js_names). entries in js_rnames and .count ***($plyrnames_ar). entries in plyrnames_ar and .count($js_seeds). in js_seeds; exit(); The problem is that my $plyrs field comes up 18, while in truth there are only 17 rows of data in my database. All of the other array-size counts echo out as being only 17, but my $rows and $plyrs fields come up as 18. I was having problems with my javascript showing an undefined array element and took a bit o time to determine what it was and where it was happening. Questions - does mysql_num_rows return a extra row that somehow doesn't get processed in the while loop? And if it does how come the counter ($plyrs) that I put into the loop comes up higher than it should.? My guess would be that you end up with 2 rows having the same $nm, overwriting the value that's already in $plyrnames_ar. - Matijn ---End Message--- ---BeginMessage--- My guess would be that you end up with 2 rows having the same $nm, overwriting the value that's already in $plyrnames_ar. - Matijn Genius at work! Thanks - I'll look into that. ---End Message--- ---BeginMessage--- Yup that was it! Something I knew would happen during my design, but forgot to code for now. Jim Giner jim.gi...@albanyhandball.com wrote in message news:e2.dc.30075.c6ea5...@pb1.pair.com... My guess would be that you end up with 2 rows having the same $nm, overwriting the value that's already in $plyrnames_ar. - Matijn Genius at work! Thanks - I'll look into that. ---End Message--- ---BeginMessage--- On Sun, May 6, 2012 at 12:53 AM, Jim Giner jim.gi...@albanyhandball.com wrote: Yup that was
php-general Digest 7 May 2012 01:10:31 -0000 Issue 7804
php-general Digest 7 May 2012 01:10:31 - Issue 7804 Topics (messages 317811 through 317815): Re: PHP Subroutine Call Blowing UP with Strings 317811 by: Maciek Sokolewicz Re: code deployment through php 317812 by: rene7705 IDE 317813 by: Ethan Rosenberg 317814 by: Simon Schick 317815 by: Ethan Rosenberg Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On 06-05-2012 14:54, George R Smith wrote: root@dellT710:/var/www# php qm_get_clients.php *** glibc detected *** php: free(): invalid next size (fast): 0x0a2c3998 *** Sounds like a segfault to me, which is fully the fault of the extension, and not something you're doing in PHP. Try asking the developers of the QM extension for help. - Tul ---End Message--- ---BeginMessage--- On Sat, May 5, 2012 at 5:13 AM, tamouse mailing lists tamouse.li...@gmail.com wrote: On Wed, May 2, 2012 at 5:23 AM, rene7705 rene7...@gmail.com wrote: On Wed, May 2, 2012 at 11:47 AM, rene7705 rene7...@gmail.com wrote: I can't use anything like git on my shared hoster. But I suppose I could use something like git at home, and use a sync script like I posted in my OP on the shared hoster. Maybe you git gurus can help me along a bit further. I've managed to install msysgit and get it to work on my windows dev box, so far so good. Now, I'm wondering how to set up my repositories. The last cvs I used was Microsoft's visual source control back in the 90's, so I'm very rusty. At the same time, I'd prefer not to experiment too much.. I've got a tree structure in a folder called simply code, that I have in several locations on my windows box. Each site that I develop for has a folder in .../htdocs/sites/ somedomain.com, and many of these sites will need a copy of the common code folder in them. I can restrict myself to developing in one domain's subdir only. The non-common code for each domain is designed to run from any $_SERVER['SERVER_NAME'] and any sub-directory it happens to be in. In other words, http://my-dev-box.biz/sites/somedomain.com/ will show the same thing from windowze as http://somedomain.com will from shared hosted linux. I would also like to version control the non-common code for each domain. And I would like to store the entire repository on my windows box at home in 2 or 3 specific locations (on seperate disks encrypted with truecrypt.org, and also a truecrypted usb disk, if and when that's plugged in). For distributing the common code to the shared hosted live server (my workflow is to check finalized changes on my win box against all my sites that used the common code base, before deploying to the shared hoster live server), I can simply FTP one finalized copy and use the simplest of rm -rf and cp -r commands in a short script to distribute the changes. I could even do without the PHP filesync code I posted earlier (altho it was fun to build! :) That darn hoster of mine won't support git on shared hosting, only on much more expensive virtual dedicated and dedicated plans :( But I've also found http://serverfault.com/questions/26836/setting-up-a-git-repo-on-my-godaddy-hosting-plan and http://www.lyraphase.com/wp/uncategorized/how-to-build-git-for-a-host-with-no-compiler/ that show me how I might get git running on my (kinda lame now) shared hosting account. Maybe a stupid question, but would perhaps copying the common code around with a simple script be faster than multiple pushes by git? Using git, you can set up either publicly hosted repositories on github.com or gitorious.org or perhaps other public repo places. If you don't want you code to be publicly available, you can set up private repositories as well. Not being familiar with Windows implementations much at all, I can't tell you specifically what to do with msysgit, so these will be more generic instructions. I'm going to assume you don't have a host somewhere with ssh access. In this case you'll most likely want/need to set up your repository on your local system. (Note that it isn't *strictly* necessary to have a repository -- you can clone a new tree from the existing code tree, however having a repository can ensure a clean code set in case your working tree gets out of sync somehow.) (These instructions are modified from http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux ) First, create a directory you want to hold all of your local repositories (such as C:\User\rene\MyRepositories). Then create a subdirectory off that to hold your server/application common code