Re: [PHP] code deployment through php

2012-05-14 Thread rene7705
On Sun, May 6, 2012 at 3:32 PM, rene7705 rene7...@gmail.com wrote:
 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
 (C:\Users\rene\MyRepositories\commoncode).

 Make that directory (..\commoncode) a *bare* repository. (Not sure how
 that's done with msysgit, but the basic git command is: git init
 --bare C:\Users\rene\MyRepositories\commoncode)

 Then you add the repository as a remote to the working tree: git
 remote add origin C:\Users\rene\MyRepositories\commoncode

 Now you can push commits to your repository with the following sequence:

 git add files you want to commit
 git commit
 git push origin master

 Now, to *deploy*, you can do the following:

 Somewhere outside your working tree, create a directory called deploy:

 mkdir C:\Users\rene\deploy

 Then clone your the repository of your commond code:

 git clone C:\Users\rene\MyRepositories\commoncode cleancode-20120404

 Then you can ftp the contents of cleancode-20120404 to your server as
 needed.

 Sorry to be unable to tell you the exact steps with msysgit, but I
 hope you can interpolate from the commands above.


 Thanks for that 

Re: [PHP] code deployment through php

2012-05-06 Thread rene7705
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
 (C:\Users\rene\MyRepositories\commoncode).

 Make that directory (..\commoncode) a *bare* repository. (Not sure how
 that's done with msysgit, but the basic git command is: git init
 --bare C:\Users\rene\MyRepositories\commoncode)

 Then you add the repository as a remote to the working tree: git
 remote add origin C:\Users\rene\MyRepositories\commoncode

 Now you can push commits to your repository with the following sequence:

 git add files you want to commit
 git commit
 git push origin master

 Now, to *deploy*, you can do the following:

 Somewhere outside your working tree, create a directory called deploy:

 mkdir C:\Users\rene\deploy

 Then clone your the repository of your commond code:

 git clone C:\Users\rene\MyRepositories\commoncode cleancode-20120404

 Then you can ftp the contents of cleancode-20120404 to your server as
 needed.

 Sorry to be unable to tell you the exact steps with msysgit, but I
 hope you can interpolate from the commands above.


Thanks for that useful info, tamouse..

I didn't check this list for a few days thinking the thread had gone dead,
but 

Re: [PHP] code deployment through php

2012-05-04 Thread tamouse mailing lists
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
(C:\Users\rene\MyRepositories\commoncode).

Make that directory (..\commoncode) a *bare* repository. (Not sure how
that's done with msysgit, but the basic git command is: git init
--bare C:\Users\rene\MyRepositories\commoncode)

Then you add the repository as a remote to the working tree: git
remote add origin C:\Users\rene\MyRepositories\commoncode

Now you can push commits to your repository with the following sequence:

git add files you want to commit
git commit
git push origin master

Now, to *deploy*, you can do the following:

Somewhere outside your working tree, create a directory called deploy:

mkdir C:\Users\rene\deploy

Then clone your the repository of your commond code:

git clone C:\Users\rene\MyRepositories\commoncode cleancode-20120404

Then you can ftp the contents of cleancode-20120404 to your server as needed.

Sorry to be unable to tell you the exact steps with msysgit, but I
hope you can interpolate from the commands above.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code deployment through php

2012-05-02 Thread rene7705
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.


Re: [PHP] code deployment through php

2012-05-02 Thread rene7705
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?


Re: [PHP] code deployment through php

2012-05-02 Thread Lester Caine

rene7705 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.


I have some legacy hosting packages which are just ftp access and BC just lists 
them and allows me to manage things quickly when I need to update those sites. 
One of these days they will get moved to an easier location :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code deployment through php

2012-05-01 Thread Camilo Sperberg

On 1 mei 2012, at 10:59, rene7705 wrote:

 Hi folks.
 
 I was here a while ago, trying to figure out how to keep deployment
 instances of my common code, running on more than 1 site, in sync with
 eachother.
 
 I've looked at rsync which was recommended here, but didn't like it much,
 nor could I find a good windows version of it.
 
 So yesterday, I decided to try a pure PHP solution. My thinking was: run a
 PHP sync script once on each physical machine that holds possibly multiple
 copies of my common code, and FTP the common code only 1 time because I use
 only 1 shared hosting account besides my windows development machine.
 
 I've gotten it so far that it creates an imo good list of what to copy
 where.
 
 The only problem I can foresee is that the copy command will take more than
 30 seconds, which makes it hard to run at the shared hoster.
 
 And obviously, it's going to need some good input checking to prevent
 abuse.
 
 I've put up a demo at
 http://skatescene.biz/sites/mediabeez.ws/sync_secret_cndj593n2/ , you can
 execute the code job to see it in action.
 
 I'll also post the working copy of my sync library at the bottom of this
 post. The only thing missing is the actual copy($source,$dest), I think.
 
 But, I'm wondering if this is a good approach to code deployment. It
 certainly seems easier and more convenient to me than using rsync. Maybe
 i'm an amateur indeed ;)  Anyways, all criticism is welcome here. Thanks
 for your time! :)
 
 ?php
 function sync_echo_jobs ($path) {
 $jobs = sync_read_jobs ($path);
 echo 'div id=rajmvSync_jobs_json!-- '.json_encode($jobs).' --/div';
 echo 'ul class=rajmvSync_jobs';
 foreach ($jobs['jobs'] as $jobName = $job) {
 echo 'li'.$jobName.' (a
 href=javascript:rscg.executeJob(\''.$jobName.'\');execute/a) (a
 href=javascript:rscg.showEditJobForm(\''.$jobName.'\');edit/a)/li';
 }
 echo '/ul';
 ?
 ?php
 }
 
 function sync_read_jobs ($path) {
 $filepath = $path.'/rajmvSync_jobs.json';
 if (file_exists($filepath)) {
 $r = json_decode (file_get_contents($filepath), true);
 } else {
 $r = array (
 'jobs' = array()
 );
 }
 return $r;
 }
 
 function sync_write_jobs ($path, $jobs) {
 $filepath = $path.'/rajmvSync_jobs.json';
 file_put_contents ($filepath, json_encode($jobs));
 }
 
 function sync_addOrEditJob ($path, $name, $paths) {
 $jobs = sync_read_jobs ($path);
 $jobs['jobs'][$name] = array (
 'paths' = $paths
 );
 sync_write_jobs ($path, $jobs);
 }
 
 function sync_executeJob ($path, $name) {
 $jobs = sync_read_jobs ($path);
 if (array_key_exists($name, $jobs['jobs'])) {
 $job = $jobs['jobs'][$name];
 $paths = explode (\n, $job['paths']);
 // work only on approved paths;
 $pathsApproved = array();
 foreach ($paths as $idx=$pathToSync) {
 $drive = strtolower(substr($pathToSync,0,2));
 if ($drive=='m:') $pathsApproved[]=$pathToSync;
 }
 $paths = $pathsApproved;
 
 // get a list of files for each path to sync with the other paths in the
 same list/var
 $fileLists = array();
 foreach ($paths as $idx = $pathToSync) {
 $fileLists[$pathToSync] = getFilePathList ($pathToSync, true, /(.*)/,
 array('file'));
 }
 // get all the last modified timestamps for each of the found files
 $fileList = array();
 foreach ($paths as $idx = $pathToSync) {
 foreach ($fileLists[$pathToSync] as $idx2 = $filepathToSync) {
 $fileRelativePath = str_replace ($pathToSync, '', $filepathToSync);
 if (!array_key_exists($fileRelativePath, $fileList))
 $fileList[$fileRelativePath] = array();
 $fileList[$fileRelativePath][$pathToSync] = filemtime($filepathToSync);
 }
 }
 // $copyList will hold all the copy commands, initialize;
 $copyList = array();
 foreach ($fileList as $fileRelativePath = $locationResults) {
 foreach ($locationResults as $pathToSync = $filemtime) {
 if (!array_key_exists($fileRelativePath, $copyList))
 $copyList[$fileRelativePath] = array(
 'latest' = null,
 'source' = null,
 'destinations' = array()
 );
 if (is_null($copyList[$fileRelativePath]['latest']) || $filemtime 
 $copyList[$fileRelativePath]['latest']) {
 $copyList[$fileRelativePath]['source'] = $pathToSync;
 $copyList[$fileRelativePath]['latest'] = $filemtime;
 }
 }
 }
 
 // schedule copy command for all files with older filemtime() than the
 latest copy
 foreach ($fileList as $fileRelativePath = $locationResults) {
 foreach ($locationResults as $pathToSync = $filemtime) {
 if ($filemtime  $copyList[$fileRelativePath]['latest']) {
 $copyList[$fileRelativePath]['destinations'][] = $pathToSync;
 }
 }
 }
 // schedule copy command for all new files that must go to all $pathToSync
 where it is not present yet:
 foreach ($copyList as $fileRelativePath = $fileRec) {
 if (count($fileList[$fileRelativePath])!=count($paths)) {
 foreach ($paths as $idx=$pathToSync) {
 if (!array_key_exists($pathToSync, $fileList[$fileRelativePath]))
 $copyList[$fileRelativePath]['destinations'][] = $pathToSync;
 }
 }
 }
 
 // debug output of actual copy commands
 foreach ($copyList as $fileRelativePath = $fileRec) {
 if 

Re: [PHP] code deployment through php

2012-05-01 Thread rene7705
On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg unrea...@gmail.com wrote:

 If I understood the problem correctly, you want to keep a single copy of
 your code on every machine you work, including the final server.


Well, I want to work on 1 copy of my common code on my windows machine,
then sync those changes to all my sites (hosted on the win dev box) to see
if it messes up the other sites, then FTP those changes to my hosting
account, and run the sync script there as well.


 Have you read about SVN ? You can set up a cronjob to execute it
 automatically if you want, there are clients for Windows, Zend Studio, etc
 etc.


I've read about some source control systems, I've tried them out, but I'd
rather go for this simpler approach tbh.
I already do regular backups that are timestamped, it's enough for me right
now I think.


Re: [PHP] code deployment through php

2012-05-01 Thread Stuart Dallas
On 1 May 2012, at 10:19, rene7705 wrote:

 On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg unrea...@gmail.com wrote:
 
 If I understood the problem correctly, you want to keep a single copy of
 your code on every machine you work, including the final server.
 
 
 Well, I want to work on 1 copy of my common code on my windows machine,
 then sync those changes to all my sites (hosted on the win dev box) to see
 if it messes up the other sites, then FTP those changes to my hosting
 account, and run the sync script there as well.
 
 
 Have you read about SVN ? You can set up a cronjob to execute it
 automatically if you want, there are clients for Windows, Zend Studio, etc
 etc.
 
 
 I've read about some source control systems, I've tried them out, but I'd
 rather go for this simpler approach tbh.
 I already do regular backups that are timestamped, it's enough for me right
 now I think.

If you really think rolling your own deployment system is simpler than using 
source control then I don't think you've understood all of the advantages of 
source control. I know it can look complicated, but it's really not, and it 
will make it far easier to keep track of what you're doing and what changes are 
deployed where than the system you described. I strongly recommend you 
reconsider.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

RE: [PHP] code deployment through php

2012-05-01 Thread admin

-Original Message-
From: Stuart Dallas [mailto:stu...@3ft9.com] 
Sent: Tuesday, May 01, 2012 8:19 AM
To: rene7705
Cc: Camilo Sperberg; php-general
Subject: Re: [PHP] code deployment through php

On 1 May 2012, at 10:19, rene7705 wrote:

 On Tue, May 1, 2012 at 11:11 AM, Camilo Sperberg unrea...@gmail.com
wrote:
 
 If I understood the problem correctly, you want to keep a single copy 
 of your code on every machine you work, including the final server.
 
 
 Well, I want to work on 1 copy of my common code on my windows 
 machine, then sync those changes to all my sites (hosted on the win 
 dev box) to see if it messes up the other sites, then FTP those 
 changes to my hosting account, and run the sync script there as well.
 
 
 Have you read about SVN ? You can set up a cronjob to execute it 
 automatically if you want, there are clients for Windows, Zend 
 Studio, etc etc.
 
 
 I've read about some source control systems, I've tried them out, but 
 I'd rather go for this simpler approach tbh.
 I already do regular backups that are timestamped, it's enough for me 
 right now I think.

If you really think rolling your own deployment system is simpler than using
source control then I don't think you've understood all of the advantages of
source control. I know it can look complicated, but it's really not, and it
will make it far easier to keep track of what you're doing and what changes
are deployed where than the system you described. I strongly recommend you
reconsider.

-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/




Stuart,
If I may add to your post
 
Version control for different environments (Development and Production) is
SO key with SVN.
SVN has logging and other key features. 

Many, and when I say many that is an understatement, Many companies enforce
SVN for their protection.

Ever had a script not fully transfer, and only partial code remains?
With SVN you can roll it back and Whala! You have the original source back.

For one of my roles as Project Manager, I love Tortoise SVN. I have changed
the scripting a bit to send me emails with descriptions of changes as they
happen with attached files.
This way I can actually filter my emails to find the exact person who made
the bad change, what they had, and what they did instead of searching the
logs.

Since my developers can only push to the Development Servers I can fix
issues before they become a Production Issue.
No more, Developers having access to the server directly. They make their
changes and commit their changes up, I review and can schedule changes to be
committed to Production Servers.
To setup a new Developer I simply check out the SVN library for them and
they are up to speed day one.

The setup is very easy, Yes the controls are a tiny bit confusing at FIRST. 
But if you want success, then SVN is a SMART decision for any project.




Richard Buskirk














-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code deployment through php

2012-05-01 Thread Larry Garfield

On 5/1/12 4:19 AM, rene7705 wrote:

On Tue, May 1, 2012 at 11:11 AM, Camilo Sperbergunrea...@gmail.com  wrote:


If I understood the problem correctly, you want to keep a single copy of
your code on every machine you work, including the final server.



Well, I want to work on 1 copy of my common code on my windows machine,
then sync those changes to all my sites (hosted on the win dev box) to see
if it messes up the other sites, then FTP those changes to my hosting
account, and run the sync script there as well.



Have you read about SVN ? You can set up a cronjob to execute it
automatically if you want, there are clients for Windows, Zend Studio, etc
etc.



I've read about some source control systems, I've tried them out, but I'd
rather go for this simpler approach tbh.
I already do regular backups that are timestamped, it's enough for me right
now I think.


No it's not.  Really.  For what you describe, a proper version control 
system is the correct tool.  Rolling your own with rsync and cron is 
setting yourself up for failure.


A couple people here have mentioned SVN.  I used to use SVN, but now 
have migrated everything I do to Git.  Without getting into a religious 
battle between Git and SVN, I do strongly recommend you look into it. 
This is an excellent resource for why to use it and how to use it:


http://progit.org/book

If you're serious about development, get serious about version control.

--Larry Garfield

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code deployment through php

2012-05-01 Thread Lester Caine

rene7705 wrote:

Well, I want to work on 1 copy of my common code on my windows machine,
then sync those changes to all my sites (hosted on the win dev box) to see
if it messes up the other sites, then FTP those changes to my hosting
account, and run the sync script there as well.


I have a number of windows based customers who also like to review what we are 
doing, so I ended up with HG. TortoiseHg provides a nice gui based DVCS system 
interface on Windows which works identically on Linux and I can push and pull 
changes around the place without having to worry about anything.


The servers 'pull' a copy of the code base from a local server master, which is 
managed from the development environment. Config information is protected on 
each site, and the whole thing works identically on both windows and linux so I 
don't have to worry what the customers are using. THEY can work to their own 
site and change what we give them access to, while the core code is managed from 
the central repo.


If they come up with something useful it can be merged back into the master copy 
:) One of the few pieces of software I actually pay for is BeyondCompare which 
provides the same cross platform facilities for merging files and with it's 
built in ftp interface allows manually inspecting the file structure on any of 
the machines. A couple of my Mac based customers are now investigating the same 
development base.


Add Eclipse/PHPEclipse on top and you have the ultimate cross platform IDE :)

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread Robert Cummings

On 11-08-31 08:20 PM, Tedd Sperling wrote:

On Aug 30, 2011, at 3:09 PM, Robert Cummings wrote:


On 11-08-30 11:36 AM, Richard Quadling wrote:

On 30 August 2011 15:04, Tedd Sperlingtedd.sperl...@gmail.com   wrote:

To all:

I prefer the Whitesmiths style:

http://rebel.lcc.edu/sperlt/citw229/brace-styles.php

But style is really up to the individual -- what works best for you is the 
best (unless it's a team effort or the clients demand).

Cheers,

tedd


At last Someone's code I could read without having to reformat it
every bloody time!!!

http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style


You're just saying that so Tedd will be your friend!! Come now, let's be honest 
with everyone... Whitesmith's is -GLEE! ;)

Cheers,
Rob.


No, not indenting braces is T LYY.

Make things uniform -- a condition followed by indented code located between 
equally indented braces makes sense to me. How people read other code styles is 
a mystery to me.


Come now Tedd! It's only Thursday and yet you jest so!!

:)

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread George Langley

On 2011-08-31, at 11:44 PM, Ross McKay wrote:

 On Tue, 30 Aug 2011 10:04:54 -0400, Tedd Sperling wrote:
 
 I prefer the Whitesmiths style:
 
 http://rebel.lcc.edu/sperlt/citw229/brace-styles.php
 
 But style is really up to the individual -- what works best for you 
 is the best (unless it's a team effort or the clients demand).
 
 I note on your page that you prefer Whitesmiths (truly ugly!) style even
 for JavaScript. I'd strongly recommend against that, and also Allman
 style, due to semicolon insertion. e.g. (randomly selected from Google)
 
 http://encosia.com/in-javascript-curly-brace-placement-matters-an-example/
 http://robertnyman.com/2008/10/16/beware-of-javascript-semicolon-insertion/
 
 Sure, instances of the problem are minimal, but if you're in the habit
 of Dangerous Open Brace Placement then you just might fall afoul of it.
 
 Besides, my editor (Geany) folds code mostly neatly with KR :)
---
FWIW, am working my way through an O'Reilly book (HTML5 Canvas) right 
now and they appear to use The One True Brace Style in their code examples.
Not religious about it, but it does help me know which code I wrote and 
what was touched by someone else!

George
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread Robert Cummings

On 11-09-01 01:44 AM, Ross McKay wrote:

On Tue, 30 Aug 2011 10:04:54 -0400, Tedd Sperling wrote:


I prefer the Whitesmiths style:

http://rebel.lcc.edu/sperlt/citw229/brace-styles.php

But style is really up to the individual -- what works best for you
is the best (unless it's a team effort or the clients demand).


I note on your page that you prefer Whitesmiths (truly ugly!) style even
for JavaScript. I'd strongly recommend against that, and also Allman
style, due to semicolon insertion. e.g. (randomly selected from Google)

http://encosia.com/in-javascript-curly-brace-placement-matters-an-example/
http://robertnyman.com/2008/10/16/beware-of-javascript-semicolon-insertion/

Sure, instances of the problem are minimal, but if you're in the habit
of Dangerous Open Brace Placement then you just might fall afoul of it.

Besides, my editor (Geany) folds code mostly neatly with KR :)


That's because JavaScript is broken in some ways. As much as I like 
JavaScript, some parts of the language were thrown together by flinging 
crap at a fan and seeing what sticks to the wall... this being a prime 
example.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread Ross McKay
Robert Cummings wrote:

That's because JavaScript is broken in some ways. As much as I like 
JavaScript, some parts of the language were thrown together by flinging 
crap at a fan and seeing what sticks to the wall... this being a prime 
example.

Sounds a lot like PHP :) which I must add I love dearly, though it
certainly resembles your remark much more closely than JavaScript.

But on-topic, novices using a coding style and feeling their way around
a new language would be better served by the 1TB style than anything
that easily allows statement insertion (either by them, or by silly
language defects like JavaScript's semicolon insertion). 
-- 
Ross McKay, Toronto, NSW Australia
Hold very tight please! Ting! Ting! - Flanders and Swann

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread Robert Cummings

On 11-09-01 02:39 AM, Ross McKay wrote:

Robert Cummings wrote:


That's because JavaScript is broken in some ways. As much as I like
JavaScript, some parts of the language were thrown together by flinging
crap at a fan and seeing what sticks to the wall... this being a prime
example.


Sounds a lot like PHP :) which I must add I love dearly, though it
certainly resembles your remark much more closely than JavaScript.

But on-topic, novices using a coding style and feeling their way around
a new language would be better served by the 1TB style than anything
that easily allows statement insertion (either by them, or by silly
language defects like JavaScript's semicolon insertion).


Oh for sure, it's necessary that novices have something towards which 
they can evolve. If they start with Allman's then how could they improve 
their brace style :)


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread Richard Quadling
On 30 August 2011 23:25, Richard Quadling rquadl...@gmail.com wrote:
 On 30 August 2011 20:09, Robert Cummings rob...@interjinn.com wrote:
 You're just saying that so Tedd will be your friend!! Come now, let's be
 honest with everyone... Whitesmith's is -GLEE! ;)

 Beauty is in the eye of the beholder.

So I think we've all established that Whitesmith's is the way to go,
but what about markup languages?

Take our own lovely PHPDocumentation.

Here, in the main, we have all subordinate elements starting on their
own line, indented.

Is there really any other way that would make sense?


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread Tim Streater
On 01 Sep 2011 at 11:42, Richard Quadling rquadl...@gmail.com wrote: 

 On 30 August 2011 23:25, Richard Quadling rquadl...@gmail.com wrote:
 On 30 August 2011 20:09, Robert Cummings rob...@interjinn.com wrote:
 You're just saying that so Tedd will be your friend!! Come now, let's be
 honest with everyone... Whitesmith's is -GLEE! ;)

 Beauty is in the eye of the beholder.

 So I think we've all established that Whitesmith's is the way to go,

I've been using the Whitesmith's style since I started coding in BCPL in the 
mid-70s. Having the braces line up is a big help.


--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Code should be selv-maintaining!

2011-09-01 Thread Tedd Sperling
On Sep 1, 2011, at 8:16 AM, Tim Streater wrote:

 On 01 Sep 2011 at 11:42, Richard Quadling rquadl...@gmail.com wrote: 
 
 On 30 August 2011 23:25, Richard Quadling rquadl...@gmail.com wrote:
 On 30 August 2011 20:09, Robert Cummings rob...@interjinn.com wrote:
 You're just saying that so Tedd will be your friend!! Come now, let's be
 honest with everyone... Whitesmith's is -GLEE! ;)
 
 Beauty is in the eye of the beholder.
 
 So I think we've all established that Whitesmith's is the way to go,
 
 I've been using the Whitesmith's style since I started coding in BCPL in the 
 mid-70s. Having the braces line up is a big help.

Good.

Not only do I use the Whitesmith style for PHP, but I use it for Javascript, 
CSS, and everything that has braces (excepting grandchildren).

In addition, I also teach college level programming where I present my view on 
style. While I may not influence established programmers (good habits or no), 
young minds are open to suggestion. :-)


Cheers,

tedd

_
t...@sperling.com
http://sperling.com






RE: [PHP] Code should be selv-maintaining!

2011-08-31 Thread Jen Rasmussen
Genius! 

-Original Message-
From: Matt Graham [mailto:danceswithcr...@usa.net] 
Sent: Tuesday, August 30, 2011 5:59 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Code should be selv-maintaining!

From:  David Harkness davi...@highgearmedia.com
 I don't always use braces, but when I do I use Compact Control Readability
 style. Stay coding, my friends.

...and when you use CCR style, you can sing, I see a bad brace a-risin'?

-- 
Matt G / Dances With Crows
The Crow202 Blog:  http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-31 Thread Tedd Sperling
On Aug 30, 2011, at 3:09 PM, Robert Cummings wrote:

 On 11-08-30 11:36 AM, Richard Quadling wrote:
 On 30 August 2011 15:04, Tedd Sperlingtedd.sperl...@gmail.com  wrote:
 To all:
 
 I prefer the Whitesmiths style:
 
 http://rebel.lcc.edu/sperlt/citw229/brace-styles.php
 
 But style is really up to the individual -- what works best for you is 
 the best (unless it's a team effort or the clients demand).
 
 Cheers,
 
 tedd
 
 At last Someone's code I could read without having to reformat it
 every bloody time!!!
 
 http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style
 
 You're just saying that so Tedd will be your friend!! Come now, let's be 
 honest with everyone... Whitesmith's is -GLEE! ;)
 
 Cheers,
 Rob.

No, not indenting braces is T LYY.

Make things uniform -- a condition followed by indented code located between 
equally indented braces makes sense to me. How people read other code styles is 
a mystery to me.

Cheers,

tedd


_
t...@sperling.com
http://sperling.com








Re: [PHP] Code should be selv-maintaining!

2011-08-31 Thread Paul M Foster
On Wed, Aug 31, 2011 at 08:20:14PM -0400, Tedd Sperling wrote:

 On Aug 30, 2011, at 3:09 PM, Robert Cummings wrote:
 
  On 11-08-30 11:36 AM, Richard Quadling wrote:
  On 30 August 2011 15:04, Tedd Sperlingtedd.sperl...@gmail.com
  wrote:
  To all:
  
  I prefer the Whitesmiths style:
  
  http://rebel.lcc.edu/sperlt/citw229/brace-styles.php
  
  But style is really up to the individual -- what works best for
  you is the best (unless it's a team effort or the clients
  demand).
  
  Cheers,
  
  tedd
  
  At last Someone's code I could read without having to reformat
  it every bloody time!!!
  
  http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style
  
  You're just saying that so Tedd will be your friend!! Come now,
  let's be honest with everyone... Whitesmith's is -GLEE!
  ;)
  
  Cheers, Rob.
 
 No, not indenting braces is T
 LYY.
 
 Make things uniform -- a condition followed by indented code located
 between equally indented braces makes sense to me. 
 How people read
 other code styles is a mystery to me.

Indeed it is a mystery, a religious one. The way we do it is because we
finally broke through the clouds of earthly obfuscation to comprehend
the blinding truth that is KR. Amen.

(Nah, it wasn't Kool-Aid. Tasted more like a cross between RC Cola and
Dr Pepper.) ;-}

Paul


-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-31 Thread Ross McKay
On Tue, 30 Aug 2011 10:04:54 -0400, Tedd Sperling wrote:

I prefer the Whitesmiths style:

http://rebel.lcc.edu/sperlt/citw229/brace-styles.php

But style is really up to the individual -- what works best for you 
is the best (unless it's a team effort or the clients demand).

I note on your page that you prefer Whitesmiths (truly ugly!) style even
for JavaScript. I'd strongly recommend against that, and also Allman
style, due to semicolon insertion. e.g. (randomly selected from Google)

http://encosia.com/in-javascript-curly-brace-placement-matters-an-example/
http://robertnyman.com/2008/10/16/beware-of-javascript-semicolon-insertion/

Sure, instances of the problem are minimal, but if you're in the habit
of Dangerous Open Brace Placement then you just might fall afoul of it.

Besides, my editor (Geany) folds code mostly neatly with KR :)
-- 
Ross McKay, Toronto, NSW Australia
Let the laddie play wi the knife - he'll learn
- The Wee Book of Calvin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Tedd Sperling
On Aug 29, 2011, at 4:32 PM, George Langley wrote:

 The One True Brace Style:
 
 http://en.wikipedia.org/wiki/Indent_style
 
 Didn't know there was a name for the way I learned to indent! Make sense to 
 me - looks so much cleaner and less scrolling/printing.
   And, I already add a comment to confirm the end brace:
 
 } // end if($myVar)
 
 to clarify any long nests.
 
 George

To all:

I prefer the Whitesmiths style:

http://rebel.lcc.edu/sperlt/citw229/brace-styles.php

But style is really up to the individual -- what works best for you is the 
best (unless it's a team effort or the clients demand).

Cheers,

tedd

---

t...@sperling.com
http://sperling.com




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Richard Quadling
On 30 August 2011 15:04, Tedd Sperling tedd.sperl...@gmail.com wrote:
 To all:

 I prefer the Whitesmiths style:

 http://rebel.lcc.edu/sperlt/citw229/brace-styles.php

 But style is really up to the individual -- what works best for you is the 
 best (unless it's a team effort or the clients demand).

 Cheers,

 tedd

At last Someone's code I could read without having to reformat it
every bloody time!!!

http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Robert Cummings

On 11-08-30 11:36 AM, Richard Quadling wrote:

On 30 August 2011 15:04, Tedd Sperlingtedd.sperl...@gmail.com  wrote:

To all:

I prefer the Whitesmiths style:

http://rebel.lcc.edu/sperlt/citw229/brace-styles.php

But style is really up to the individual -- what works best for you is the 
best (unless it's a team effort or the clients demand).

Cheers,

tedd


At last Someone's code I could read without having to reformat it
every bloody time!!!

http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style


You're just saying that so Tedd will be your friend!! Come now, let's be 
honest with everyone... Whitesmith's is -GLEE! ;)


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-30 Thread David Harkness
I don't always use braces, but when I do I use Compact Control Readability
style. Stay coding, my friends.


RE: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Daevid Vincent
LOLercopter! 

 -Original Message-
 From: David Harkness [mailto:davi...@highgearmedia.com]
 Sent: Tuesday, August 30, 2011 12:57 PM
 To: Robert Cummings
 Cc: rquadl...@gmail.com; Tedd Sperling; php-general@lists.php.net
 Subject: Re: [PHP] Code should be selv-maintaining!
 
 I don't always use braces, but when I do I use Compact Control Readability
 style. Stay coding, my friends.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Jen Rasmussen
David Harkness ...you must be...
the most interesting coder in the world ;)

-Original Message-
From: David Harkness [mailto:davi...@highgearmedia.com] 
Sent: Tuesday, August 30, 2011 2:57 PM
To: Robert Cummings
Cc: rquadl...@gmail.com; Tedd Sperling; php-general@lists.php.net
Subject: Re: [PHP] Code should be selv-maintaining!

I don't always use braces, but when I do I use Compact Control Readability
style. Stay coding, my friends.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Richard Quadling
On 30 August 2011 20:09, Robert Cummings rob...@interjinn.com wrote:
 You're just saying that so Tedd will be your friend!! Come now, let's be
 honest with everyone... Whitesmith's is -GLEE! ;)

Beauty is in the eye of the beholder.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Jason Pruim

On Aug 30, 2011, at 6:25 PM, Richard Quadling wrote:

 On 30 August 2011 20:09, Robert Cummings rob...@interjinn.com wrote:
 You're just saying that so Tedd will be your friend!! Come now, let's be
 honest with everyone... Whitesmith's is -GLEE! ;)
 
 Beauty is in the eye of the beholder.

I always thought that was beer holder?

Is it friday yet? ;)


Jason Pruim
li...@pruimphotography.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-30 Thread Matt Graham
From:  David Harkness davi...@highgearmedia.com
 I don't always use braces, but when I do I use Compact Control Readability
 style. Stay coding, my friends.

...and when you use CCR style, you can sing, I see a bad brace a-risin'?

-- 
Matt G / Dances With Crows
The Crow202 Blog:  http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-29 Thread Robert Cummings

On 11-08-29 03:42 PM, Rico Secada wrote:

You go into your homemade library of code to re-use some piece that you
already are using 12 other places in production. Now, last time you
worked on the code you thought it was almost perfect. While working on
the code this time you find an undiscovered bug or some part of the
code that looks like you where on drugs when you made it.


*lol* Yes, I think we've all seen it from time to time. Have you ever 
gone back and looked at your school assignments in coding? *shudder*. 
The horror is compounded by the fact I was using KR style indentation 
back then ;)


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Code should be selv-maintaining!

2011-08-29 Thread admin

 -Original Message-
 From: Rico Secada [mailto:coolz...@it.dk]
 Sent: Monday, August 29, 2011 3:42 PM
 To: php-general@lists.php.net
 Subject: [PHP] Code should be selv-maintaining!
 
 Dont get me wrong, I love programming! But what an absolute pain in the
 ass it is when you re-use old code only to discover something less
 well
 made.
 
 You all know about this right?
 
 You go into your homemade library of code to re-use some piece that you
 already are using 12 other places in production. Now, last time you
 worked on the code you thought it was almost perfect. While working on
 the code this time you find an undiscovered bug or some part of the
 code that looks like you where on drugs when you made it.
 
 Of course we develop experience and more skills all the time, and as a
 good programmer we never stop doing that, but what a pain it is when
 the above happens and you have to patch the code being used those 12
 other places too, and each place maybe has a slightly different usage,
 so minor changes affect other stuff. And this goes on while your head
 is spinning around trying to stay focused on the very task at hand that
 originated the need for a quick re-usage of old code in the first
 place.
 
 Why the hell can't code be self-maintaining!? :))
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


In a framework this is not a problem, and easy to update. Development as a
whole, is a living document ever growing and expanding it abilities.
If taking advantage of the new ability is a long upgrade process then the
design is stagnate . This is called the longevity of a design and is why
many developers No longer use what is called as flat text programming.
Thinking object oriented programming in frameworks is the only way I do
business.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code should be selv-maintaining!

2011-08-29 Thread Geoff Shang

On Mon, 29 Aug 2011, Rico Secada wrote:


You go into your homemade library of code to re-use some piece that you
already are using 12 other places in production. Now, last time you
worked on the code you thought it was almost perfect. While working on
the code this time you find an undiscovered bug or some part of the
code that looks like you where on drugs when you made it.


This is why it's good to write this kind of thing as functions.  Then if 
you find some great problem with it later, you can drop in the replacement 
functions and the code that calls it (hopefully) won't need modification.


Of course, it's easier to be cleverer after the event.

Geoff.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re:[PHP] code quest

2011-02-15 Thread Kirk Bailey
Frankly, while that modulo looks like something worthy of learning, 
for my immediate time critical need I went with a quicker method, 
which is working. The complete script is below. It simply counts 
cells and resets the row when a number is exceeded.

?php
# The next several lines declare an array of directories which are 
NOT to be listed!#

$excludes[] = 'attachments'; #20
$excludes[] = 'data';
$excludes[] = 'include';
$excludes[] = 'resources';
$excludes[] = 'stats';
$excludes[] = '_private';
$excludes[] = '_vti_bin';
$excludes[] = '_vti_cnf';
$excludes[] = '_vti_log';
$excludes[] = '_vti_pvt';
$excludes[] = '_vti_txt'; #30
$excludes[] = '_vxi_txt';
$excludes[] = 'css';
$excludes[] = 'img';
$excludes[] = 'images';
$excludes[] = 'js';
$excludes[] = 'cgi';
$excludes[] = 'cgi-bin';
$excludes[] = 'ssfm';
$ls = scandir(dirname(__FILE__));
$counter=0; #40
echo 'table border=1 cellspacing=1 cellpadding=5 
bgcolor=F0F0F0tr';
foreach ($ls as $d) {  if (is_dir($d)  
!preg_match('/^\./',basename($d)) !in_array(basename($d),$excludes))

 {
  ++$counter ;
  echo 'td width=150 valign=topcenter'.$d.'bra 
href='.$d.'';
  echo 'img src=./'.$d.'/thumb.png width=120 HEIGHT=175 
border=5/abr/center';

  include($d./desc.txt);
  echo '/td';
  if ($counter  3)
{
echo '/trtr'; #50
$counter=0;
}
  };
};
echo '/tr/table';
?

--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2011-02-14 Thread Richard Quadling
On 15 February 2011 00:53, Kirk Bailey kbai...@howlermonkey.net wrote:
 Now I have a situation. I need to take the code from my former home page and
 modify it to lay out a table (let's say 5 cells wide) and as many rows deep
 to contain all the items. Each item is the name of the directory, under
 which is an icon image from that directory, under which is a description
 file read from that directory. Here is my code thus far:

 ?php
 # The next several lines declare an array of directories which are NOT to be
 listed!#
 $excludes[] = 'attachments'; #20
 $excludes[] = 'data';
 $excludes[] = 'include';
 $excludes[] = 'resources';
 $excludes[] = 'stats';
 $excludes[] = '_private';
 $excludes[] = '_vti_bin';
 $excludes[] = '_vti_cnf';
 $excludes[] = '_vti_log';
 $excludes[] = '_vti_pvt';
 $excludes[] = '_vti_txt'; #30
 $excludes[] = '_vxi_txt';
 $excludes[] = 'css';
 $excludes[] = 'img';
 $excludes[] = 'images';
 $excludes[] = 'js';
 $excludes[] = 'cgi';
 $excludes[] = 'cgi-bin';
 $excludes[] = 'ssfm';
 $ls = scandir(dirname(__FILE__));
 echo 'table border=1 cellspacing=5 cellpadding=0 bgcolor=E0E0E0tr
 align=center'; #40
 foreach ($ls as $d) {  if (is_dir($d)  !preg_match('/^\./',basename($d))
 !in_array(basename($d),$excludes))
  {
  echo 'td'.$d.'bra href='.$d.'img
 src=/Categories/'.$d.'/thumb.png border=5/abr';
  include($d./desc.txt);
  echo '/td';
  };
 };
 echo '/tr/table';
 ?

 Now I am stymied on changing this to add /trtr at the right points in
 the structure. I am new to php, and welcome all suggestions and gainful
 comments.

$ls = scandir(dirname(__FILE__));
echo 'table border=1 cellspacing=5 cellpadding=0 bgcolor=E0E0E0'; #40
foreach ($ls as $d) {  if (is_dir($d) 
!preg_match('/^\./',basename($d)) !in_array(basename($d),$excludes))
 {
 echo 'tr align=centertd', $d, 'bra href=', $d, 'img
src=/Categories/', $d, '/thumb.png border=5/abr';
 include($d./desc.txt);
 echo '/td/tr';
 };
};
echo '/table';

maybe?

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2011-02-14 Thread Kirk Bailey
well, this ends the row after every cell. I am trying to get a row 
of 5 cells across, then end it and start a new row. If the routines 
stops before the end of the count of 5 due to lack of further 
directories, closing out the table following the loops will onclude 
a /tr tag.



On 2/14/2011 8:30 PM, Richard Quadling wrote:

On 15 February 2011 00:53, Kirk Baileykbai...@howlermonkey.net  wrote:

Now I have a situation. I need to take the code from my former home page and
modify it to lay out a table (let's say 5 cells wide) and as many rows deep
to contain all the items. Each item is the name of the directory, under
which is an icon image from that directory, under which is a description
file read from that directory. Here is my code thus far:

?php
# The next several lines declare an array of directories which are NOT to be
listed!#
$excludes[] = 'attachments'; #20
$excludes[] = 'data';
$excludes[] = 'include';
$excludes[] = 'resources';
$excludes[] = 'stats';
$excludes[] = '_private';
$excludes[] = '_vti_bin';
$excludes[] = '_vti_cnf';
$excludes[] = '_vti_log';
$excludes[] = '_vti_pvt';
$excludes[] = '_vti_txt'; #30
$excludes[] = '_vxi_txt';
$excludes[] = 'css';
$excludes[] = 'img';
$excludes[] = 'images';
$excludes[] = 'js';
$excludes[] = 'cgi';
$excludes[] = 'cgi-bin';
$excludes[] = 'ssfm';
$ls = scandir(dirname(__FILE__));
echo 'table border=1 cellspacing=5 cellpadding=0 bgcolor=E0E0E0tr
align=center'; #40
foreach ($ls as $d) {  if (is_dir($d)  !preg_match('/^\./',basename($d))
!in_array(basename($d),$excludes))
  {
  echo 'td'.$d.'bra href='.$d.'img
src=/Categories/'.$d.'/thumb.png border=5/abr';
  include($d./desc.txt);
  echo '/td';
  };
};
echo '/tr/table';
?

Now I am stymied on changing this to add/trtr  at the right points in
the structure. I am new to php, and welcome all suggestions and gainful
comments.

$ls = scandir(dirname(__FILE__));
echo 'table border=1 cellspacing=5 cellpadding=0 bgcolor=E0E0E0'; #40
foreach ($ls as $d) {  if (is_dir($d)
!preg_match('/^\./',basename($d))!in_array(basename($d),$excludes))
  {
  echo 'tr align=centertd', $d,'bra href=', $d, 'img
src=/Categories/', $d, '/thumb.png border=5/abr';
  include($d./desc.txt);
  echo '/td/tr';
  };
};
echo '/table';

maybe?



--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2011-02-14 Thread Jim Lucas
On 2/14/2011 4:53 PM, Kirk Bailey wrote:
 Now I have a situation. I need to take the code from my former home page and
 modify it to lay out a table (let's say 5 cells wide) and as many rows deep to
 contain all the items. Each item is the name of the directory, under which is 
 an
 icon image from that directory, under which is a description file read from 
 that
 directory. Here is my code thus far:
 
 ?php
 # The next several lines declare an array of directories which are NOT to be
 listed!#
 $excludes[] = 'attachments'; #20
 $excludes[] = 'data';
 $excludes[] = 'include';
 $excludes[] = 'resources';
 $excludes[] = 'stats';
 $excludes[] = '_private';
 $excludes[] = '_vti_bin';
 $excludes[] = '_vti_cnf';
 $excludes[] = '_vti_log';
 $excludes[] = '_vti_pvt';
 $excludes[] = '_vti_txt'; #30
 $excludes[] = '_vxi_txt';
 $excludes[] = 'css';
 $excludes[] = 'img';
 $excludes[] = 'images';
 $excludes[] = 'js';
 $excludes[] = 'cgi';
 $excludes[] = 'cgi-bin';
 $excludes[] = 'ssfm';
 $ls = scandir(dirname(__FILE__));
 echo 'table border=1 cellspacing=5 cellpadding=0 bgcolor=E0E0E0tr
 align=center'; #40
 foreach ($ls as $d) {  if (is_dir($d)  !preg_match('/^\./',basename($d))
 !in_array(basename($d),$excludes))
  {
   echo 'td'.$d.'bra href='.$d.'img src=/Categories/'.$d.'/thumb.png
 border=5/abr';
   include($d./desc.txt);
   echo '/td';
   };
 };
 echo '/tr/table';
 ?
 
 Now I am stymied on changing this to add /trtr at the right points in the
 structure. I am new to php, and welcome all suggestions and gainful comments.
 

You want modulo math...

Check out this page

http://www.cmsws.com/examples/php/modulo_array_output.php

If you like the output, here is the source

http://www.cmsws.com/examples/php/modulo_array_output.phps

The bottom two examples show how you can use other HTML tags to present data.

Jim Lucas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2011-02-14 Thread Kirk Bailey
Very nice; I am leaning in the direction of doing it this way. Thank 
you!

:-)



On 2/14/2011 9:24 PM, Jim Lucas wrote:

On 2/14/2011 4:53 PM, Kirk Bailey wrote:

Now I have a situation. I need to take the code from my former home page and
modify it to lay out a table (let's say 5 cells wide) and as many rows deep to
contain all the items. Each item is the name of the directory, under which is an
icon image from that directory, under which is a description file read from that
directory. Here is my code thus far:

?php
# The next several lines declare an array of directories which are NOT to be
listed!#
$excludes[] = 'attachments'; #20
$excludes[] = 'data';
$excludes[] = 'include';
$excludes[] = 'resources';
$excludes[] = 'stats';
$excludes[] = '_private';
$excludes[] = '_vti_bin';
$excludes[] = '_vti_cnf';
$excludes[] = '_vti_log';
$excludes[] = '_vti_pvt';
$excludes[] = '_vti_txt'; #30
$excludes[] = '_vxi_txt';
$excludes[] = 'css';
$excludes[] = 'img';
$excludes[] = 'images';
$excludes[] = 'js';
$excludes[] = 'cgi';
$excludes[] = 'cgi-bin';
$excludes[] = 'ssfm';
$ls = scandir(dirname(__FILE__));
echo 'table border=1 cellspacing=5 cellpadding=0 bgcolor=E0E0E0tr
align=center'; #40
foreach ($ls as $d) {  if (is_dir($d)  !preg_match('/^\./',basename($d))
!in_array(basename($d),$excludes))
  {
   echo 'td'.$d.'bra href='.$d.'img src=/Categories/'.$d.'/thumb.png
border=5/abr';
   include($d./desc.txt);
   echo '/td';
   };
};
echo '/tr/table';
?

Now I am stymied on changing this to add/trtr  at the right points in the
structure. I am new to php, and welcome all suggestions and gainful comments.


You want modulo math...

Check out this page

http://www.cmsws.com/examples/php/modulo_array_output.php

If you like the output, here is the source

http://www.cmsws.com/examples/php/modulo_array_output.phps

The bottom two examples show how you can use other HTML tags to present data.

Jim Lucas



--
end

Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Code formatter

2011-02-02 Thread Hansen, Mike
 

 -Original Message-
 From: ken.gu...@gmail.com [mailto:ken.gu...@gmail.com] On 
 Behalf Of Ken Guest
 Sent: Monday, January 31, 2011 3:26 PM
 To: Hansen, Mike
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Code formatter
 
 
 
 On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike 
 mike.han...@atmel.com wrote:
 
 
   I've got an application that I'm fixing up and I'd like 
 to run it through a code formatter. Is there something like 
 Perl Tidy for PHP? If so, what are you experiences with it. 
 No prob running it on the command line. It'd be great if it 
 followed the PEAR coding standards.
   
   
 
 
 Have you found http://pear.php.net/package/PHP_Beautifier  
 yet? ;) http://www.php.net/unsub.php 
 
 
 Ken
 

It mostly works ok. Unfortunately, there's a bug in it that removes blank 
lines. 

I found this one that seems to work: http://beta.phpformatter.com/

I'd rather have one I can run on the command line, but this will have to do.

Mike

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code formatter

2011-02-02 Thread Ken Guest
replies inline...

On Wed, Feb 2, 2011 at 3:23 PM, Hansen, Mike mike.han...@atmel.com wrote:



  -Original Message-
  From: ken.gu...@gmail.com [mailto:ken.gu...@gmail.com] On
  Behalf Of Ken Guest
  Sent: Monday, January 31, 2011 3:26 PM
  To: Hansen, Mike
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] Code formatter
 
 
 
  On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike
  mike.han...@atmel.com wrote:
 
 
I've got an application that I'm fixing up and I'd like
  to run it through a code formatter. Is there something like
  Perl Tidy for PHP? If so, what are you experiences with it.
  No prob running it on the command line. It'd be great if it
  followed the PEAR coding standards.
 
 
 
 
  Have you found http://pear.php.net/package/PHP_Beautifier
  yet? ;) http://www.php.net/unsub.php
 
 
  Ken
 

 It mostly works ok. Unfortunately, there's a bug in it that removes blank
 lines.

 I found this one that seems to work: http://beta.phpformatter.com/

 I'd rather have one I can run on the command line, but this will have to
 do.


Just spotted that bug is reported at
http://pear.php.net/package/PHP_Beautifier/bugs - it's a shame it's been
logged since 2007 or so with no sign of it getting fixed. :(



-- 
http://blogs.linux.ie/kenguest/


Re: [PHP] Code formatter

2011-01-31 Thread Ken Guest
On Mon, Jan 31, 2011 at 8:27 PM, Hansen, Mike mike.han...@atmel.com wrote:

 I've got an application that I'm fixing up and I'd like to run it through a
 code formatter. Is there something like Perl Tidy for PHP? If so, what are
 you experiences with it. No prob running it on the command line. It'd be
 great if it followed the PEAR coding standards.


Have you found http://pear.php.net/package/PHP_Beautifier  yet?
;)http://www.php.net/unsub.php


Ken



-- 
http://blogs.linux.ie/kenguest/


Re: [PHP] code quest - ECHO?!?

2010-12-12 Thread David Robley
Kirk Bailey wrote:

 Ok, so what is echo, and how is it different from print.
 
 The code in code quest used echo. I have a copy of learning php 5.0 from
 O'Reilly, and noplace does it mention echo. Why? What's the difference?
 IS there a difference? Is there an advantage to either? Please clarify
 for this newbie.
 

The documentation says it all better than I can:

http://php.net/manual/en/function.echo.php
http://php.net/manual/en/function.print.php

Cheers
-- 
David Robley

OPERATOR! Trace this call and tell me where I am.
Today is Sweetmorn, the 54th day of The Aftermath in the YOLD 3176. 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest - ECHO?!?

2010-12-12 Thread Kirk Bailey
Groovy; they appear to be identical in all but name. IDENTICAL. Or am I 
missing a subtle definition difference?



David Robley wrote:

Kirk Bailey wrote:

  

Ok, so what is echo, and how is it different from print.

The code in code quest used echo. I have a copy of learning php 5.0 from
O'Reilly, and noplace does it mention echo. Why? What's the difference?
IS there a difference? Is there an advantage to either? Please clarify
for this newbie.




The documentation says it all better than I can:

http://php.net/manual/en/function.echo.php
http://php.net/manual/en/function.print.php

Cheers
  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest - ECHO?!?

2010-12-12 Thread Alexandru Patranescu
They are almost identical.
Echo supports multiple parameters like echo $a, $b;
print is 20% slower than echo (by some tests).
echo is shorter than print so it's easy to write.
In fact it's all a matter of taste. The same reason we user die instead of
exit.

Alex



On Sun, Dec 12, 2010 at 6:23 PM, Kirk Bailey kbai...@howlermonkey.netwrote:

 Groovy; they appear to be identical in all but name. IDENTICAL. Or am I
 missing a subtle definition difference?



 David Robley wrote:

 Kirk Bailey wrote:



 Ok, so what is echo, and how is it different from print.

 The code in code quest used echo. I have a copy of learning php 5.0 from
 O'Reilly, and noplace does it mention echo. Why? What's the difference?
 IS there a difference? Is there an advantage to either? Please clarify
 for this newbie.




 The documentation says it all better than I can:

 http://php.net/manual/en/function.echo.php
 http://php.net/manual/en/function.print.php

 Cheers



 --
 end

 Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht+-+
 | BOX |   +-+think



Re: [PHP] code quest - ECHO?!?

2010-12-12 Thread a...@ashleysheridan.co.uk
And the obvious difference, print returns  true on success. I'm not sure what 
would cause an echo it print to ever fail, so it really doesn't make a huge 
difference.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Alexandru Patranescu dreal...@gmail.com
Date: Sun, Dec 12, 2010 18:56
Subject: [PHP] code quest - ECHO?!?
To: Kirk Bailey kbai...@howlermonkey.net
Cc: php-general@lists.php.net


They are almost identical.
Echo supports multiple parameters like echo $a, $b;
print is 20% slower than echo (by some tests).
echo is shorter than print so it's easy to write.
In fact it's all a matter of taste. The same reason we user die instead of
exit.

Alex



On Sun, Dec 12, 2010 at 6:23 PM, Kirk Bailey kbai...@howlermonkey.netwrote:

 Groovy; they appear to be identical in all but name. IDENTICAL. Or am I
 missing a subtle definition difference?



 David Robley wrote:

 Kirk Bailey wrote:



 Ok, so what is echo, and how is it different from print.

 The code in code quest used echo. I have a copy of learning php 5.0 from
 O'Reilly, and noplace does it mention echo. Why? What's the difference?
 IS there a difference? Is there an advantage to either? Please clarify
 for this newbie.




 The documentation says it all better than I can:

 http://php.net/manual/en/function.echo.php
 http://php.net/manual/en/function.print.php

 Cheers



 --
 end

 Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht+-+
 | BOX |   +-+think



Re: [PHP] code quest - ECHO?!?

2010-12-10 Thread Kirk Bailey

Ok, so what is echo, and how is it different from print.

The code in code quest used echo. I have a copy of learning php 5.0 from 
O'Reilly, and noplace does it mention echo. Why? What's the difference? 
IS there a difference? Is there an advantage to either? Please clarify 
for this newbie.


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-04 Thread Kirk Bailey


OK, now here's a giggle; I like ssi includes. If I put the script in as 
an ssi include, will it still work? The functionality would also be 
useful on a page besides the default landing page, such as a 
404error.html page, or a thank you page.


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-04 Thread Kirk Bailey
A good point, but in this application there WILL be AT LEAST 1 
legitimate directory at all times, or else the script would not be used, 
so this ought not be a problem.


My problem is that I understand the basic functions to implement, but 
have not yet aquired sufficient command of php to implement the required 
multi step algorithm.


Jim Lucas wrote:

On 11/26/2010 4:03 PM, Kirk Bailey wrote:
  

Hello all, my name is Kirk Bailey, and I am new to php, so please be forbearing.
I code in python, and am trying to learn this language as our new client runs a
web business based in it.

I need a routine that will return a list of every directory immediately under
the current directory- but nothing else, just a list of directories, 1 level
deep, NO FILES, no listing of current dir or prior dir either.

Now in python, I would use os.walk, and use the list of dirs and throw the other
2 lists away, but this ain't Kansas anymore. Does php even DO lists?

Um, a list is a 1 dimenional array, if have a list ALIST and you plug in 3, you
get back the contents of cell 3 in the list, whaqtever that content is. so if
cell 3 in a 6 celled list was Ruby then ALIST[3] would return the string 
ruby.

It's easy to iterate lists. For instance:

   print 'ul'
   for dir in ALIST:
   print 'lia href=\/dir,dir,'/a
   print '/ul

This would let me produce an ordered list of directories, each a link to that
directory.
This way, when a client installs a new product, the home page area listing
products offered automatically updates.

Further embellishment would let me replace the dir name with a BRIEF description
from a descriptor file read from that dir. Now how to do this in php?




This should do.

The only problem that I foresee would be an empty ul/ul if you have no
directories returned by glob().

print('ul');
foreach ( glob('./*', GLOB_ONLYDIR) AS $dir )
  print('lia href=\'.$dir.'\'.$dir.'/a/li');
print('/ul');


Jim Lucas

  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-04 Thread Kirk Bailey
Now Now, fight nice. We don need no stinkin' @$^*$^(! woids here.  :-P 


Steve Staples wrote:

On Thu, 2010-12-02 at 10:07 -0500, Daniel P. Brown wrote:
  

On Wed, Dec 1, 2010 at 23:13, Kirk Bailey kbai...@howlermonkey.net wrote:
[snip!]


Can this be improved to exclude anything with a '.' or a '-' in it's name?
This will exclude the smileys and cgi-bin and such. If it can be persuaded
to read a 1 line description from each subdirectory it could then use THAT
as the text in the link, instead of the name. This could be useful in many
settings.
  

Sure.  Change:

if (is_dir($d)  $d != '.'  $d != '..') {

To:

if (is_dir($d)  !preg_match('/[\.\-]/',$d)) {

Keep in mind, though, that the change will no longer show anything
that matches the below either:

example.directory
example-directory
special-images
css.files

In other words, you may instead want to explicitly state which
directories to omit, and then drop anything that begins with a dot as
well (hidden directories on *NIX-like boxes) like so:

?php
$excludes[] = 'cgi-bin';
$excludes[] = 'vti_cnf';
$excludes[] = 'private';
$excludes[] = 'thumbnail';

$ls = scandir(dirname(__FILE__));
foreach ($ls as $d) {
  if (is_dir($d)  !preg_match('/^\./',basename($d)) 
!in_array(basename($d),$excludes)) {
  echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
  }
}
?

--
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/




damn you Daniel... I was just about to reply with almost the EXACT same
answer!!!

I think the last example would probably be the best one to use, that way
you can still have some directories with the . or - or even the _ in the
names, and still be able to display them.

Steve

ps thanks for saving me type it all out Daniel :)


  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-04 Thread Kirk Bailey

my current code is as follows:

   *ul
   ?php # The next several lines declare an array of directories which
   are NOT to be listed!
   $excludes[] = 'images';
   $excludes[] = 'cgi-bin';
   $excludes[] = 'vti_cnf';
   $excludes[] = 'private';
   $excludes[] = 'thumbnail';

   $ls = scandir(dirname(__FILE__));
   foreach ($ls as $d) {
 if (is_dir($d)  !preg_match('/^\./',basename($d)) 
   !in_array(basename($d),$excludes)) {
 echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
 }
   }
   ?
   /ul*

The page containing this is at this url:
   http://www.howlermonkey.net/dirlisting.php
I believe this will be a starting point for the functionality I am 
looking for- an automatic menu of areas in a website one may go to. By 
excluding some folders, people don't go trespassing into the cgi-bin or 
images folder, or into areas reserved for administrative uses.



Daniel P. Brown wrote:

On Wed, Dec 1, 2010 at 23:13, Kirk Bailey kbai...@howlermonkey.net wrote:
[snip!]
  

Can this be improved to exclude anything with a '.' or a '-' in it's name?
This will exclude the smileys and cgi-bin and such. If it can be persuaded
to read a 1 line description from each subdirectory it could then use THAT
as the text in the link, instead of the name. This could be useful in many
settings.



Sure.  Change:

if (is_dir($d)  $d != '.'  $d != '..') {

To:

if (is_dir($d)  !preg_match('/[\.\-]/',$d)) {

Keep in mind, though, that the change will no longer show anything
that matches the below either:

example.directory
example-directory
special-images
css.files

In other words, you may instead want to explicitly state which
directories to omit, and then drop anything that begins with a dot as
well (hidden directories on *NIX-like boxes) like so:

?php
$excludes[] = 'cgi-bin';
$excludes[] = 'vti_cnf';
$excludes[] = 'private';
$excludes[] = 'thumbnail';

$ls = scandir(dirname(__FILE__));
foreach ($ls as $d) {
  if (is_dir($d)  !preg_match('/^\./',basename($d)) 
!in_array(basename($d),$excludes)) {
  echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
  }
}
?

  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-04 Thread Matt Graham
From: Kirk Bailey kbai...@howlermonkey.net
 OK, now here's a giggle; I like ssi includes. If I put the script
 in as an ssi include, will it still work?

If you're using Apache, and you do

!--#include virtual=something.php --

...the PHP in something.php will execute and produce output, but
something.php will not have any access to $_GET or $_POST or $_SESSION or any
of those things.  This is generally not what you want.  If you do

?php include(something.php); ?

...then something.php will be able to see and work with the superglobals that
have been set up further up the page, which is *usually* what you want.  You
could try both approaches in a test env and see what you get.  I'll use SSI
for dumb blocks of text and php include for smart blocks of code, because
IME that tends to produce fewer instances of gross stupidity.

Note that YMMV on all this and ICBW.

-- 
Matt G / Dances With Crows
The Crow202 Blog:  http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-04 Thread Kirk Bailey

Ok, let's kick this around.

iterating an array(?; 1 dimensional listing of things) in php, I am 
creating a list of direcoties. I want to open and read in a file in each 
directory with a standard name, which contains a 1 line description of 
the directory and it's purpose.


Now, here's the existing code; this code is online NOW at this url:
http://www.howlermonkey.net/dirlisting.php

   * 1?php # The next several lines declare an array of directories
   which are  
2NOT to be listed!

3$excludes[] = 'images';
4$excludes[] = 'cgi-bin';
5$excludes[] = 'vti_cnf';
6$excludes[] = 'private';
7$excludes[] = 'thumbnail';
8
9$ls = scandir(dirname(__FILE__));
   10foreach ($ls as $d) {
   11if (is_dir($d)  !preg_match('/^\./',basename($d)) 
   12!in_array(basename($d),$excludes)) {
   13 echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
   14 }
   15}
   16?*

Let's say the file to read in /elite is named 'desc.txt'.
It looks like you want me to modify line 13 to say:
echo 'lia href='.$d.''.include($d.'desc.txt').'/abr/'.PHP_EOL;

so, if the file '/elite/desc.txt' contains the line

   *82nd Airbourne - We are an elite unit of army Paratroopers
   *

Then that element in the list would appear as:

   * 82nd Airbourne  -We are an elite unit of army Paratroopers

And would be clickable. Let's try it and see if this hound hunts.

Matt Graham wrote:

From: Kirk Bailey kbai...@howlermonkey.net
  

OK, now here's a giggle; I like ssi includes. If I put the script
in as an ssi include, will it still work?



If you're using Apache, and you do

!--#include virtual=something.php --

...the PHP in something.php will execute and produce output, but
something.php will not have any access to $_GET or $_POST or $_SESSION or any
of those things.  This is generally not what you want.  If you do

?php include(something.php); ?

...then something.php will be able to see and work with the superglobals that
have been set up further up the page, which is *usually* what you want.  You
could try both approaches in a test env and see what you get.  I'll use SSI
for dumb blocks of text and php include for smart blocks of code, because
IME that tends to produce fewer instances of gross stupidity.

Note that YMMV on all this and ICBW.

  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-04 Thread Kirk Bailey
The hound barks, but does not yet properly hunt, and we need to bring 
home the bacon.


OK, here is the current code:

   ?php # The next several lines declare an array of directories which
   are NOT to be listed!
   $excludes[] = 'images';
   $excludes[] = 'cgi-bin';
   $excludes[] = 'vti_cnf';
   $excludes[] = 'private';
   $excludes[] = 'thumbnail';

   $ls = scandir(dirname(__FILE__));
   foreach ($ls as $d) {
 if (is_dir($d)  !preg_match('/^\./',basename($d)) 
   !in_array(basename($d),$excludes)) {
 echo 'lia href='.$d.''.include('./'.$d.'/desc.txt')
   ;#.'/abr/'.PHP_EOL;
 }
   }
   ?

the url again, to view the results, is 
http://www.howlermonkey.net/dirlisting.php and is live right now. The 
results are a tad odd to say the least.





Kirk Bailey wrote:

Ok, let's kick this around.

iterating an array(?; 1 dimensional listing of things) in php, I am 
creating a list of direcoties. I want to open and read in a file in 
each directory with a standard name, which contains a 1 line 
description of the directory and it's purpose.


Now, here's the existing code; this code is online NOW at this url:
http://www.howlermonkey.net/dirlisting.php

   * 1?php # The next several lines declare an array of directories
   which are  2NOT to be listed!
3$excludes[] = 'images';
4$excludes[] = 'cgi-bin';
5$excludes[] = 'vti_cnf';
6$excludes[] = 'private';
7$excludes[] = 'thumbnail';
8
9$ls = scandir(dirname(__FILE__));
   10foreach ($ls as $d) {
   11if (is_dir($d)  !preg_match('/^\./',basename($d)) 
   12!in_array(basename($d),$excludes)) {
   13 echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
   14 }
   15}
   16?*

Let's say the file to read in /elite is named 'desc.txt'.
It looks like you want me to modify line 13 to say:
echo 'lia href='.$d.''.include($d.'desc.txt').'/abr/'.PHP_EOL;

so, if the file '/elite/desc.txt' contains the line

   *82nd Airbourne - We are an elite unit of army Paratroopers
   *

Then that element in the list would appear as:

   * 82nd Airbourne  -We are an elite unit of army Paratroopers

And would be clickable. Let's try it and see if this hound hunts.

Matt Graham wrote:

From: Kirk Bailey kbai...@howlermonkey.net
 

OK, now here's a giggle; I like ssi includes. If I put the script
in as an ssi include, will it still work?



If you're using Apache, and you do

!--#include virtual=something.php --

...the PHP in something.php will execute and produce output, but
something.php will not have any access to $_GET or $_POST or 
$_SESSION or any

of those things.  This is generally not what you want.  If you do

?php include(something.php); ?

...then something.php will be able to see and work with the 
superglobals that
have been set up further up the page, which is *usually* what you 
want.  You
could try both approaches in a test env and see what you get.  I'll 
use SSI
for dumb blocks of text and php include for smart blocks of code, 
because

IME that tends to produce fewer instances of gross stupidity.

Note that YMMV on all this and ICBW.

  




--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-04 Thread Tamara Temple


On Dec 4, 2010, at 2:15 PM, Kirk Bailey wrote:

The hound barks, but does not yet properly hunt, and we need to  
bring home the bacon.


OK, here is the current code:

  ?php # The next several lines declare an array of directories which
  are NOT to be listed!
  $excludes[] = 'images';
  $excludes[] = 'cgi-bin';
  $excludes[] = 'vti_cnf';
  $excludes[] = 'private';
  $excludes[] = 'thumbnail';

  $ls = scandir(dirname(__FILE__));
  foreach ($ls as $d) {
if (is_dir($d)  !preg_match('/^\./',basename($d)) 
  !in_array(basename($d),$excludes)) {
echo 'lia href='.$d.''.include('./'.$d.'/desc.txt')
  ;#.'/abr/'.PHP_EOL;
}
  }
  ?

the url again, to view the results, is http://www.howlermonkey.net/dirlisting.php 
 and is live right now. The results are a tad odd to say the least.




Ok, I don't think that's actually the code that generated the page you  
link to, but let's go with what you've got.


First of all, include() does not return a string to the calling  
program. include() basically redirects the php interpretter to process  
the contents of the file. What include() returns is success or failure  
of the execution of the included script. To use the current setup you  
have with the desc.txt files, you want to do something like this:


echo 'lia href='.$d.'';
include('./'.$d.'/desc.txt');
echo '/a/libr /'.PHP_EOL;

If the file desc.txt contains only text, it will get sent to the  
browser as is.







Kirk Bailey wrote:

Ok, let's kick this around.

iterating an array(?; 1 dimensional listing of things) in php, I am  
creating a list of direcoties. I want to open and read in a file in  
each directory with a standard name, which contains a 1 line  
description of the directory and it's purpose.


Now, here's the existing code; this code is online NOW at this url:
http://www.howlermonkey.net/dirlisting.php

  * 1?php # The next several lines declare an array of directories
  which are  2NOT to be listed!
   3$excludes[] = 'images';
   4$excludes[] = 'cgi-bin';
   5$excludes[] = 'vti_cnf';
   6$excludes[] = 'private';
   7$excludes[] = 'thumbnail';
   8
   9$ls = scandir(dirname(__FILE__));
  10foreach ($ls as $d) {
  11if (is_dir($d)  !preg_match('/^\./',basename($d)) 
  12!in_array(basename($d),$excludes)) {
  13 echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
  14 }
  15}
  16?*

Let's say the file to read in /elite is named 'desc.txt'.
It looks like you want me to modify line 13 to say:
echo 'lia href='.$d.''.include($d.'desc.txt').'/abr/ 
'.PHP_EOL;


so, if the file '/elite/desc.txt' contains the line

  *82nd Airbourne - We are an elite unit of army Paratroopers
  *

Then that element in the list would appear as:

  * 82nd Airbourne  -We are an elite unit of army Paratroopers

And would be clickable. Let's try it and see if this hound hunts.

Matt Graham wrote:

From: Kirk Bailey kbai...@howlermonkey.net


OK, now here's a giggle; I like ssi includes. If I put the script
in as an ssi include, will it still work?



If you're using Apache, and you do

!--#include virtual=something.php --

...the PHP in something.php will execute and produce output, but
something.php will not have any access to $_GET or $_POST or  
$_SESSION or any

of those things.  This is generally not what you want.  If you do

?php include(something.php); ?

...then something.php will be able to see and work with the  
superglobals that
have been set up further up the page, which is *usually* what you  
want.  You
could try both approaches in a test env and see what you get.   
I'll use SSI
for dumb blocks of text and php include for smart blocks of  
code, because

IME that tends to produce fewer instances of gross stupidity.

Note that YMMV on all this and ICBW.






--
end

Very Truly yours,
   - Kirk Bailey,
 Largo Florida

 kniht+- 
+   | BOX |   +- 
+think



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-04 Thread Kirk Bailey

the code is now:

   ?php # The next several lines declare an array of directories which
   are NOT to be listed!
   $excludes[] = 'images';
   $excludes[] = 'cgi-bin';
   $excludes[] = 'vti_cnf';
   $excludes[] = 'private';
   $excludes[] = 'thumbnail';

   $ls = scandir(dirname(__FILE__));
   foreach ($ls as $d) {
 if (is_dir($d)  !preg_match('/^\./',basename($d)) 
   !in_array(basename($d),$excludes)) {
 echo 'lia href='.$d.'';
 echo include($d.'/desc.txt' );
 echo '/abr/'.PHP_EOL;
 }
   }
   ?

And it works!
   BUT!
Where is the 1 coming from?!?
Please inspect the page and see what I mean. This is not in the code, 
and it's not in the source file. Link: 
http://www.howlermonkey.net/dirlisting.php


I hope this dialog is proving at least mildly interesting to the 
remainder of the list as an educational exercise.



Tamara Temple wrote:


On Dec 4, 2010, at 2:15 PM, Kirk Bailey wrote:

The hound barks, but does not yet properly hunt, and we need to bring 
home the bacon.


OK, here is the current code:

  ?php # The next several lines declare an array of directories which
  are NOT to be listed!
  $excludes[] = 'images';
  $excludes[] = 'cgi-bin';
  $excludes[] = 'vti_cnf';
  $excludes[] = 'private';
  $excludes[] = 'thumbnail';

  $ls = scandir(dirname(__FILE__));
  foreach ($ls as $d) {
if (is_dir($d)  !preg_match('/^\./',basename($d)) 
  !in_array(basename($d),$excludes)) {
echo 'lia href='.$d.''.include('./'.$d.'/desc.txt')
  ;#.'/abr/'.PHP_EOL;
}
  }
  ?

the url again, to view the results, is 
http://www.howlermonkey.net/dirlisting.php and is live right now. The 
results are a tad odd to say the least.




Ok, I don't think that's actually the code that generated the page you 
link to, but let's go with what you've got.


First of all, include() does not return a string to the calling 
program. include() basically redirects the php interpretter to process 
the contents of the file. What include() returns is success or failure 
of the execution of the included script. To use the current setup you 
have with the desc.txt files, you want to do something like this:


echo 'lia href='.$d.'';
include('./'.$d.'/desc.txt');
echo '/a/libr /'.PHP_EOL;

If the file desc.txt contains only text, it will get sent to the 
browser as is.







Kirk Bailey wrote:

Ok, let's kick this around.

iterating an array(?; 1 dimensional listing of things) in php, I am 
creating a list of direcoties. I want to open and read in a file in 
each directory with a standard name, which contains a 1 line 
description of the directory and it's purpose.


Now, here's the existing code; this code is online NOW at this url:
http://www.howlermonkey.net/dirlisting.php

  * 1?php # The next several lines declare an array of directories
  which are  2NOT to be listed!
   3$excludes[] = 'images';
   4$excludes[] = 'cgi-bin';
   5$excludes[] = 'vti_cnf';
   6$excludes[] = 'private';
   7$excludes[] = 'thumbnail';
   8
   9$ls = scandir(dirname(__FILE__));
  10foreach ($ls as $d) {
  11if (is_dir($d)  !preg_match('/^\./',basename($d)) 
  12!in_array(basename($d),$excludes)) {
  13 echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
  14 }
  15}
  16?*

Let's say the file to read in /elite is named 'desc.txt'.
It looks like you want me to modify line 13 to say:
echo 'lia 
href='.$d.''.include($d.'desc.txt').'/abr/'.PHP_EOL;


so, if the file '/elite/desc.txt' contains the line

  *82nd Airbourne - We are an elite unit of army Paratroopers
  *

Then that element in the list would appear as:

  * 82nd Airbourne  -We are an elite unit of army Paratroopers

And would be clickable. Let's try it and see if this hound hunts.

Matt Graham wrote:

From: Kirk Bailey kbai...@howlermonkey.net


OK, now here's a giggle; I like ssi includes. If I put the script
in as an ssi include, will it still work?



If you're using Apache, and you do

!--#include virtual=something.php --

...the PHP in something.php will execute and produce output, but
something.php will not have any access to $_GET or $_POST or 
$_SESSION or any

of those things.  This is generally not what you want.  If you do

?php include(something.php); ?

...then something.php will be able to see and work with the 
superglobals that
have been set up further up the page, which is *usually* what you 
want.  You
could try both approaches in a test env and see what you get.  I'll 
use SSI
for dumb blocks of text and php include for smart blocks of 
code, because

IME that tends to produce fewer instances of gross stupidity.

Note that YMMV on all this and ICBW.






--
end

Very Truly yours,
   - Kirk Bailey,
 Largo Florida

 kniht
+-+   | BOX |   
+-+think





--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
   

Re: [PHP] code quest

2010-12-04 Thread Richard Quadling
On 4 December 2010 20:58, Kirk Bailey kbai...@howlermonkey.net wrote:
 the code is now:

   ?php # The next several lines declare an array of directories which
   are NOT to be listed!
   $excludes[] = 'images';
   $excludes[] = 'cgi-bin';
   $excludes[] = 'vti_cnf';
   $excludes[] = 'private';
   $excludes[] = 'thumbnail';

   $ls = scandir(dirname(__FILE__));
   foreach ($ls as $d) {
     if (is_dir($d)  !preg_match('/^\./',basename($d)) 
   !in_array(basename($d),$excludes)) {
         echo 'lia href='.$d.'';
         echo include($d.'/desc.txt' );
         echo '/abr/'.PHP_EOL;
     }
   }
   ?

 And it works!
   BUT!
 Where is the 1 coming from?!?
 Please inspect the page and see what I mean. This is not in the code, and
 it's not in the source file. Link:
 http://www.howlermonkey.net/dirlisting.php

 I hope this dialog is proving at least mildly interesting to the remainder
 of the list as an educational exercise.


 Tamara Temple wrote:

 On Dec 4, 2010, at 2:15 PM, Kirk Bailey wrote:

 The hound barks, but does not yet properly hunt, and we need to bring
 home the bacon.

 OK, here is the current code:

  ?php # The next several lines declare an array of directories which
  are NOT to be listed!
  $excludes[] = 'images';
  $excludes[] = 'cgi-bin';
  $excludes[] = 'vti_cnf';
  $excludes[] = 'private';
  $excludes[] = 'thumbnail';

  $ls = scandir(dirname(__FILE__));
  foreach ($ls as $d) {
    if (is_dir($d)  !preg_match('/^\./',basename($d)) 
  !in_array(basename($d),$excludes)) {
        echo 'lia href='.$d.''.include('./'.$d.'/desc.txt')
  ;#.'/abr/'.PHP_EOL;
    }
  }
  ?

 the url again, to view the results, is
 http://www.howlermonkey.net/dirlisting.php and is live right now. The
 results are a tad odd to say the least.


 Ok, I don't think that's actually the code that generated the page you
 link to, but let's go with what you've got.

 First of all, include() does not return a string to the calling program.
 include() basically redirects the php interpretter to process the contents
 of the file. What include() returns is success or failure of the execution
 of the included script. To use the current setup you have with the desc.txt
 files, you want to do something like this:

    echo 'lia href='.$d.'';
    include('./'.$d.'/desc.txt');
    echo '/a/libr /'.PHP_EOL;

 If the file desc.txt contains only text, it will get sent to the browser
 as is.





 Kirk Bailey wrote:

 Ok, let's kick this around.

 iterating an array(?; 1 dimensional listing of things) in php, I am
 creating a list of direcoties. I want to open and read in a file in each
 directory with a standard name, which contains a 1 line description of the
 directory and it's purpose.

 Now, here's the existing code; this code is online NOW at this url:
 http://www.howlermonkey.net/dirlisting.php

  * 1?php # The next several lines declare an array of directories
  which are      2NOT to be listed!
   3$excludes[] = 'images';
   4$excludes[] = 'cgi-bin';
   5$excludes[] = 'vti_cnf';
   6$excludes[] = 'private';
   7$excludes[] = 'thumbnail';
   8
   9$ls = scandir(dirname(__FILE__));
  10foreach ($ls as $d) {
  11if (is_dir($d)  !preg_match('/^\./',basename($d)) 
  12!in_array(basename($d),$excludes)) {
  13     echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
  14 }
  15}
  16?*

 Let's say the file to read in /elite is named 'desc.txt'.
 It looks like you want me to modify line 13 to say:
 echo 'lia href='.$d.''.include($d.'desc.txt').'/abr/'.PHP_EOL;

 so, if the file '/elite/desc.txt' contains the line

  *82nd Airbourne - We are an elite unit of army Paratroopers
  *

 Then that element in the list would appear as:

  * 82nd Airbourne  -We are an elite unit of army Paratroopers

 And would be clickable. Let's try it and see if this hound hunts.

 Matt Graham wrote:

 From: Kirk Bailey kbai...@howlermonkey.net

 OK, now here's a giggle; I like ssi includes. If I put the script
 in as an ssi include, will it still work?


 If you're using Apache, and you do

 !--#include virtual=something.php --

 ...the PHP in something.php will execute and produce output, but
 something.php will not have any access to $_GET or $_POST or $_SESSION
 or any
 of those things.  This is generally not what you want.  If you do

 ?php include(something.php); ?

 ...then something.php will be able to see and work with the
 superglobals that
 have been set up further up the page, which is *usually* what you want.
  You
 could try both approaches in a test env and see what you get.  I'll use
 SSI
 for dumb blocks of text and php include for smart blocks of code,
 because
 IME that tends to produce fewer instances of gross stupidity.

 Note that YMMV on all this and ICBW.




 --
 end

 Very Truly yours,
               - Kirk Bailey,
                 Largo Florida

                     kniht                        +-+
       | BOX |                       +-+                        think



 --
 end

 Very Truly yours,
                - Kirk 

Re: [PHP] code quest

2010-12-04 Thread Daniel P. Brown
On Sat, Dec 4, 2010 at 15:58, Kirk Bailey kbai...@howlermonkey.net wrote:

 And it works!
   BUT!
 Where is the 1 coming from?!?

No need to see the page.  You're echo'ing an include.  No need to
do that; including the file is enough, and that's what's working.
Adding the echo makes it print the status returned by 'include' ---
which is boolean TRUE, AKA 1.

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-04 Thread Tamara Temple


On Dec 4, 2010, at 2:58 PM, Kirk Bailey wrote:


the code is now:

  ?php # The next several lines declare an array of directories which
  are NOT to be listed!
  $excludes[] = 'images';
  $excludes[] = 'cgi-bin';
  $excludes[] = 'vti_cnf';
  $excludes[] = 'private';
  $excludes[] = 'thumbnail';

  $ls = scandir(dirname(__FILE__));
  foreach ($ls as $d) {
if (is_dir($d)  !preg_match('/^\./',basename($d)) 
  !in_array(basename($d),$excludes)) {
echo 'lia href='.$d.'';
echo include($d.'/desc.txt' );


There should be no echo here


echo '/abr/'.PHP_EOL;
}
  }
  ?

And it works!
  BUT!
Where is the 1 coming from?!?
Please inspect the page and see what I mean. This is not in the  
code, and it's not in the source file. Link: http://www.howlermonkey.net/dirlisting.php


I hope this dialog is proving at least mildly interesting to the  
remainder of the list as an educational exercise.



Tamara Temple wrote:


On Dec 4, 2010, at 2:15 PM, Kirk Bailey wrote:

The hound barks, but does not yet properly hunt, and we need to  
bring home the bacon.


OK, here is the current code:

 ?php # The next several lines declare an array of directories  
which

 are NOT to be listed!
 $excludes[] = 'images';
 $excludes[] = 'cgi-bin';
 $excludes[] = 'vti_cnf';
 $excludes[] = 'private';
 $excludes[] = 'thumbnail';

 $ls = scandir(dirname(__FILE__));
 foreach ($ls as $d) {
   if (is_dir($d)  !preg_match('/^\./',basename($d)) 
 !in_array(basename($d),$excludes)) {
   echo 'lia href='.$d.''.include('./'.$d.'/desc.txt')
 ;#.'/abr/'.PHP_EOL;
   }
 }
 ?

the url again, to view the results, is http://www.howlermonkey.net/dirlisting.php 
 and is live right now. The results are a tad odd to say the least.




Ok, I don't think that's actually the code that generated the page  
you link to, but let's go with what you've got.


First of all, include() does not return a string to the calling  
program. include() basically redirects the php interpretter to  
process the contents of the file. What include() returns is success  
or failure of the execution of the included script. To use the  
current setup you have with the desc.txt files, you want to do  
something like this:


   echo 'lia href='.$d.'';
   include('./'.$d.'/desc.txt');
   echo '/a/libr /'.PHP_EOL;

If the file desc.txt contains only text, it will get sent to the  
browser as is.







Kirk Bailey wrote:

Ok, let's kick this around.

iterating an array(?; 1 dimensional listing of things) in php, I  
am creating a list of direcoties. I want to open and read in a  
file in each directory with a standard name, which contains a 1  
line description of the directory and it's purpose.


Now, here's the existing code; this code is online NOW at this url:
http://www.howlermonkey.net/dirlisting.php

 * 1?php # The next several lines declare an array of directories
 which are  2NOT to be listed!
  3$excludes[] = 'images';
  4$excludes[] = 'cgi-bin';
  5$excludes[] = 'vti_cnf';
  6$excludes[] = 'private';
  7$excludes[] = 'thumbnail';
  8
  9$ls = scandir(dirname(__FILE__));
 10foreach ($ls as $d) {
 11if (is_dir($d)  !preg_match('/^\./',basename($d)) 
 12!in_array(basename($d),$excludes)) {
 13 echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
 14 }
 15}
 16?*

Let's say the file to read in /elite is named 'desc.txt'.
It looks like you want me to modify line 13 to say:
echo 'lia href='.$d.''.include($d.'desc.txt').'/abr/ 
'.PHP_EOL;


so, if the file '/elite/desc.txt' contains the line

 *82nd Airbourne - We are an elite unit of army Paratroopers
 *

Then that element in the list would appear as:

 * 82nd Airbourne  -We are an elite unit of army Paratroopers

And would be clickable. Let's try it and see if this hound hunts.

Matt Graham wrote:

From: Kirk Bailey kbai...@howlermonkey.net


OK, now here's a giggle; I like ssi includes. If I put the script
in as an ssi include, will it still work?



If you're using Apache, and you do

!--#include virtual=something.php --

...the PHP in something.php will execute and produce output, but
something.php will not have any access to $_GET or $_POST or  
$_SESSION or any

of those things.  This is generally not what you want.  If you do

?php include(something.php); ?

...then something.php will be able to see and work with the  
superglobals that
have been set up further up the page, which is *usually* what  
you want.  You
could try both approaches in a test env and see what you get.   
I'll use SSI
for dumb blocks of text and php include for smart blocks of  
code, because

IME that tends to produce fewer instances of gross stupidity.

Note that YMMV on all this and ICBW.






--
end

Very Truly yours,
  - Kirk Bailey,
Largo Florida

kniht+- 
+   | BOX |   +- 
+think





--
end

Very Truly yours,
   - Kirk Bailey,
 Largo 

Re: [PHP] code quest

2010-12-02 Thread Daniel P. Brown
On Wed, Dec 1, 2010 at 23:13, Kirk Bailey kbai...@howlermonkey.net wrote:
[snip!]

 Can this be improved to exclude anything with a '.' or a '-' in it's name?
 This will exclude the smileys and cgi-bin and such. If it can be persuaded
 to read a 1 line description from each subdirectory it could then use THAT
 as the text in the link, instead of the name. This could be useful in many
 settings.

Sure.  Change:

if (is_dir($d)  $d != '.'  $d != '..') {

To:

if (is_dir($d)  !preg_match('/[\.\-]/',$d)) {

Keep in mind, though, that the change will no longer show anything
that matches the below either:

example.directory
example-directory
special-images
css.files

In other words, you may instead want to explicitly state which
directories to omit, and then drop anything that begins with a dot as
well (hidden directories on *NIX-like boxes) like so:

?php
$excludes[] = 'cgi-bin';
$excludes[] = 'vti_cnf';
$excludes[] = 'private';
$excludes[] = 'thumbnail';

$ls = scandir(dirname(__FILE__));
foreach ($ls as $d) {
  if (is_dir($d)  !preg_match('/^\./',basename($d)) 
!in_array(basename($d),$excludes)) {
  echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
  }
}
?

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-02 Thread Steve Staples
On Thu, 2010-12-02 at 10:07 -0500, Daniel P. Brown wrote:
 On Wed, Dec 1, 2010 at 23:13, Kirk Bailey kbai...@howlermonkey.net wrote:
 [snip!]
 
  Can this be improved to exclude anything with a '.' or a '-' in it's name?
  This will exclude the smileys and cgi-bin and such. If it can be persuaded
  to read a 1 line description from each subdirectory it could then use THAT
  as the text in the link, instead of the name. This could be useful in many
  settings.
 
 Sure.  Change:
 
 if (is_dir($d)  $d != '.'  $d != '..') {
 
 To:
 
 if (is_dir($d)  !preg_match('/[\.\-]/',$d)) {
 
 Keep in mind, though, that the change will no longer show anything
 that matches the below either:
 
 example.directory
 example-directory
 special-images
 css.files
 
 In other words, you may instead want to explicitly state which
 directories to omit, and then drop anything that begins with a dot as
 well (hidden directories on *NIX-like boxes) like so:
 
 ?php
 $excludes[] = 'cgi-bin';
 $excludes[] = 'vti_cnf';
 $excludes[] = 'private';
 $excludes[] = 'thumbnail';
 
 $ls = scandir(dirname(__FILE__));
 foreach ($ls as $d) {
   if (is_dir($d)  !preg_match('/^\./',basename($d)) 
 !in_array(basename($d),$excludes)) {
   echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
   }
 }
 ?
 
 -- 
 /Daniel P. Brown
 Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
 (866-) 725-4321
 http://www.parasane.net/
 

damn you Daniel... I was just about to reply with almost the EXACT same
answer!!!

I think the last example would probably be the best one to use, that way
you can still have some directories with the . or - or even the _ in the
names, and still be able to display them.

Steve

ps thanks for saving me type it all out Daniel :)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-01 Thread Jim Lucas
On 11/26/2010 4:03 PM, Kirk Bailey wrote:
 Hello all, my name is Kirk Bailey, and I am new to php, so please be 
 forbearing.
 I code in python, and am trying to learn this language as our new client runs 
 a
 web business based in it.
 
 I need a routine that will return a list of every directory immediately under
 the current directory- but nothing else, just a list of directories, 1 level
 deep, NO FILES, no listing of current dir or prior dir either.
 
 Now in python, I would use os.walk, and use the list of dirs and throw the 
 other
 2 lists away, but this ain't Kansas anymore. Does php even DO lists?
 
 Um, a list is a 1 dimenional array, if have a list ALIST and you plug in 3, 
 you
 get back the contents of cell 3 in the list, whaqtever that content is. so if
 cell 3 in a 6 celled list was Ruby then ALIST[3] would return the string 
 ruby.
 
 It's easy to iterate lists. For instance:
 
print 'ul'
for dir in ALIST:
print 'lia href=\/dir,dir,'/a
print '/ul
 
 This would let me produce an ordered list of directories, each a link to that
 directory.
 This way, when a client installs a new product, the home page area listing
 products offered automatically updates.
 
 Further embellishment would let me replace the dir name with a BRIEF 
 description
 from a descriptor file read from that dir. Now how to do this in php?
 

This should do.

The only problem that I foresee would be an empty ul/ul if you have no
directories returned by glob().

print('ul');
foreach ( glob('./*', GLOB_ONLYDIR) AS $dir )
  print('lia href=\'.$dir.'\'.$dir.'/a/li');
print('/ul');


Jim Lucas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-12-01 Thread Kirk Bailey
Daniel, this is so close to bang on it's unbelivable. Only prob is my 
host provided me with this $^@%^^$! dir which is named .smileys, which 
holds icons for use in the control panel. It should NOT list it, nor 
list the /cgi-bin, nor /images. Can it somehow exclude those 3, or maybe 
a list of things not to notice?


Also, how compatible is it with SSI includes? If part of the echo is an 
ssi include statement, will it work right? Hmmm...




Daniel P. Brown wrote:

On Fri, Nov 26, 2010 at 19:03, Kirk Bailey kbai...@howlermonkey.net wrote:
  

I need a routine that will return a list of every directory immediately
under the current directory- but nothing else, just a list of directories, 1
level deep, NO FILES, no listing of current dir or prior dir either.



Simple:

?php

$ls = scandir(dirname(__FILE__));

foreach ($ls as $d) {
if (is_dir($d)  $d != '.'  $d != '..') {
echo 'a href='.$d.''.$d.'/abr/'.PHP_EOL;
}
}
?

   If you want something more powerful - and often quicker - check
into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
and RecursiveDirectoryIterator[3].  A quick example to link all child
files and directories with relative linking:

?php

$path = dirname(__FILE__);
$list = new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($path));

foreach ($list as $k = $v) {
if (!preg_match('/\./',$v)) {
$v = str_replace($path.'/',null,$v); // We only want
relative linking
echo 'a href='.$v.''.$v.'/abr/'.PHP_EOL;
}
}
?

  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-01 Thread Kirk Bailey
OK, answered my own question; no, an ssi statement inside a php echo 
statement is simply sent out as is, unparxsed. But if it is external to 
the php area, it works fine, so we have to include a function in there 
that will read anything I want to spew- like the 1 line contents of a 
desciptor file in a particular directory.


The idea is to create a directory lister which reads a descriptor for 
that folder and uses it as the text for the link.



Daniel P. Brown wrote:

On Sat, Nov 27, 2010 at 12:36, Daniel P. Brown
daniel.br...@parasane.net wrote:
  

  If you want something more powerful - and often quicker - check
into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
and RecursiveDirectoryIterator[3].  A quick example to link all child
files and directories with relative linking:



Might help to provide the key as well, eh?  Sorry

^1: http://php.net/filesystemiterator
^2: http://php.net/directoryiterator
^3: http://php.net/recursivedirectoryiterator

  


--
end

Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



Re: [PHP] code quest

2010-12-01 Thread Kirk Bailey

OK, the quest thus far:
html
head
TITLEphp experimental page/TITLE
style TYPE=text/css
body { margin-left: 5%; margin-right: 5%; }
A:link, A:visited,  A:active { text-decoration:none; }
A:hover { text-decoration:underline; }
/style
/head
BODY text=00 bgcolor=FF
h2 align=centerSubdirectory listing experimental menuing page/h1P
ul
?php
$ls = scandir(dirname(__FILE__));
foreach ($ls as $d) {
   if (is_dir($d)  $d != '.'  $d != '..') {
   echo 'lia href='.$d.''.$d.'/abr/'.PHP_EOL;
   }
}
?
/ul
P
nbsp;
/body
/html
The results may be seen on this page:
   http://www.howlermonkey.net/dirlisting.php
Can this be improved to exclude anything with a '.' or a '-' in it's 
name? This will exclude the smileys and cgi-bin and such. If it can be 
persuaded to read a 1 line description from each subdirectory it could 
then use THAT as the text in the link, instead of the name. This could 
be useful in many settings.


Daniel P. Brown wrote:

On Fri, Nov 26, 2010 at 19:03, Kirk Bailey kbai...@howlermonkey.net wrote:
  

I need a routine that will return a list of every directory immediately
under the current directory- but nothing else, just a list of directories, 1
lev


Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht   
 +-+  
 | BOX |  
 +-+  
  think   



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-11-27 Thread Ashley Sheridan
On Fri, 2010-11-26 at 20:27 -0500, Bastien wrote:

 
 
 
 On 2010-11-26, at 7:33 PM, Adam Richardson simples...@gmail.com wrote:
 
  On Fri, Nov 26, 2010 at 7:03 PM, Kirk Bailey 
  kbai...@howlermonkey.netwrote:
  
  Hello all, my name is Kirk Bailey, and I am new to php, so please be
  forbearing. I code in python, and am trying to learn this language as our
  new client runs a web business based in it.
  
  I need a routine that will return a list of every directory immediately
  under the current directory- but nothing else, just a list of directories, 
  1
  level deep, NO FILES, no listing of current dir or prior dir either.
  
  Now in python, I would use os.walk, and use the list of dirs and throw the
  other 2 lists away, but this ain't Kansas anymore. Does php even DO lists?
  
  Um, a list is a 1 dimenional array, if have a list ALIST and you plug in 3,
  you get back the contents of cell 3 in the list, whaqtever that content is.
  so if cell 3 in a 6 celled list was Ruby then ALIST[3] would return the
  string ruby.
  
  It's easy to iterate lists. For instance:
  
   print 'ul'
   for dir in ALIST:
   print 'lia href=\/dir,dir,'/a
   print '/ul
  
  This would let me produce an ordered list of directories, each a link to
  that directory.
  This way, when a client installs a new product, the home page area listing
  products offered automatically updates.
  
  Further embellishment would let me replace the dir name with a BRIEF
  description from a descriptor file read from that dir. Now how to do this 
  in
  php?
  
  --
  end
  
  Very Truly yours,
- Kirk Bailey,
  Largo Florida
  
  kniht+-+
 | BOX |   +-+think
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  To get you started:
  
  function get_directories($path)
  {
$files_and_dirs = scandir($path);
$dirs = array_filter($files_and_dirs, function($elem) { return
  is_dir($elem); });
// $dirs also contains . and .., but you can get rid of them quite
  easily
return $dirs;
  }
  
  Happy coding :)
  
  Adam
  
  -- 
  Nephtali:  PHP web framework that functions beautifully
  http://nephtaliproject.com
 
 
 Code igniter, a php framework can do this with one call. It could be worth 
 looking into
 
 Bastien Koert
 905-904-0334
 Sent from my iPhone



I'm not sure CodeIgniter would be of any help here. I don't recall any
function in the CodeIgniter framework that lists directories like this,
so he'd still have to end up coding it himself.

Also, python tends to be used more for command line stuff than websites.
CodeIgniter does have a CLI extension, but the app would just be
severely bloated running an entire PHP framework for what might only
need a light script. Bit like using a sledgehammer to hammer in a thumb
tack, can be done, but not really the best tool for the job.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] code quest

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 12:36, Daniel P. Brown
daniel.br...@parasane.net wrote:

   If you want something more powerful - and often quicker - check
 into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
 and RecursiveDirectoryIterator[3].  A quick example to link all child
 files and directories with relative linking:

Might help to provide the key as well, eh?  Sorry

^1: http://php.net/filesystemiterator
^2: http://php.net/directoryiterator
^3: http://php.net/recursivedirectoryiterator

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-11-26 Thread Adam Richardson
On Fri, Nov 26, 2010 at 7:03 PM, Kirk Bailey kbai...@howlermonkey.netwrote:

 Hello all, my name is Kirk Bailey, and I am new to php, so please be
 forbearing. I code in python, and am trying to learn this language as our
 new client runs a web business based in it.

 I need a routine that will return a list of every directory immediately
 under the current directory- but nothing else, just a list of directories, 1
 level deep, NO FILES, no listing of current dir or prior dir either.

 Now in python, I would use os.walk, and use the list of dirs and throw the
 other 2 lists away, but this ain't Kansas anymore. Does php even DO lists?

 Um, a list is a 1 dimenional array, if have a list ALIST and you plug in 3,
 you get back the contents of cell 3 in the list, whaqtever that content is.
 so if cell 3 in a 6 celled list was Ruby then ALIST[3] would return the
 string ruby.

 It's easy to iterate lists. For instance:

   print 'ul'
   for dir in ALIST:
   print 'lia href=\/dir,dir,'/a
   print '/ul

 This would let me produce an ordered list of directories, each a link to
 that directory.
 This way, when a client installs a new product, the home page area listing
 products offered automatically updates.

 Further embellishment would let me replace the dir name with a BRIEF
 description from a descriptor file read from that dir. Now how to do this in
 php?

 --
 end

 Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht+-+
 | BOX |   +-+think

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


To get you started:

function get_directories($path)
{
   $files_and_dirs = scandir($path);
   $dirs = array_filter($files_and_dirs, function($elem) { return
is_dir($elem); });
   // $dirs also contains . and .., but you can get rid of them quite
easily
   return $dirs;
}

Happy coding :)

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] code quest

2010-11-26 Thread Bastien




On 2010-11-26, at 7:33 PM, Adam Richardson simples...@gmail.com wrote:

 On Fri, Nov 26, 2010 at 7:03 PM, Kirk Bailey kbai...@howlermonkey.netwrote:
 
 Hello all, my name is Kirk Bailey, and I am new to php, so please be
 forbearing. I code in python, and am trying to learn this language as our
 new client runs a web business based in it.
 
 I need a routine that will return a list of every directory immediately
 under the current directory- but nothing else, just a list of directories, 1
 level deep, NO FILES, no listing of current dir or prior dir either.
 
 Now in python, I would use os.walk, and use the list of dirs and throw the
 other 2 lists away, but this ain't Kansas anymore. Does php even DO lists?
 
 Um, a list is a 1 dimenional array, if have a list ALIST and you plug in 3,
 you get back the contents of cell 3 in the list, whaqtever that content is.
 so if cell 3 in a 6 celled list was Ruby then ALIST[3] would return the
 string ruby.
 
 It's easy to iterate lists. For instance:
 
  print 'ul'
  for dir in ALIST:
  print 'lia href=\/dir,dir,'/a
  print '/ul
 
 This would let me produce an ordered list of directories, each a link to
 that directory.
 This way, when a client installs a new product, the home page area listing
 products offered automatically updates.
 
 Further embellishment would let me replace the dir name with a BRIEF
 description from a descriptor file read from that dir. Now how to do this in
 php?
 
 --
 end
 
 Very Truly yours,
   - Kirk Bailey,
 Largo Florida
 
 kniht+-+
| BOX |   +-+think
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 To get you started:
 
 function get_directories($path)
 {
   $files_and_dirs = scandir($path);
   $dirs = array_filter($files_and_dirs, function($elem) { return
 is_dir($elem); });
   // $dirs also contains . and .., but you can get rid of them quite
 easily
   return $dirs;
 }
 
 Happy coding :)
 
 Adam
 
 -- 
 Nephtali:  PHP web framework that functions beautifully
 http://nephtaliproject.com


Code igniter, a php framework can do this with one call. It could be worth 
looking into

Bastien Koert
905-904-0334
Sent from my iPhone
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code documentation

2010-10-09 Thread Laruence

 Hi:
  yep , I thinks so.

On 10/09/2010 18:22, Tommy Pham wrote:

Hi everyone,

It's been a couple of years since I started a PHP project.  Are there any
other document formats other than phpDocumentor?  Is phpDocumentor still the
preferred format?

TIA,
Tommy


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

.


--
Laruence
Senior PHP consultant
http://www.laruence.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code samples in OOo Presenter

2010-03-21 Thread Ashley Sheridan
On Sun, 2010-03-21 at 17:25 -0500, Larry Garfield wrote:

 Hi all.  
 
 I have a busy conference season coming up, and will be giving a number of 
 presentations that involve code, specifically PHP.  I am going to want to put 
 code onto slides in OpenOffice (3.1 specifically, using Kubuntu 9.10), but to 
 date I've never figured out a good way to do that.  Anyone know of a good way 
 to do syntax-highlighted code in OOo?
 
 Things I've tried in the past:
 
 1) Just throw code onto the slide, no highlighting.  This works, but is ugly 
 and harder to read or demonstrate what I am doing.  It's my usual fallback.
 
 2) Screen-shot from a web page that uses syntax highlighting, such as PHP's 
 built-in highlighting.  Very difficult to prepare since the sizing is usually 
 all off.  Ugly.  Very difficult to edit and change because the screen caps 
 have 
 to be regenerated.  And PHP's default coloring for highlighting frequently 
 clashes with the slides and looks godawful on a projector.  (I once ended up 
 with blue text on a black slide.  That was a major fail.)
 
 3) Jump out of the slides into an IDE.  Works, but totally breaks the flow of 
 the presentation.  The IDE usually also has text that's way too small, and I 
 have to reconfigure it into a presentation mode, often on the fly. It also 
 makes discrete snippets harder to show, since there's still the entire rest 
 of 
 the IDE there.
 
 I don't like any of these options. :-)  I don't know what the alternative is, 
 though.  Ideally I'd love to have a custom text region or format or something 
 that is take this and highlight it properly, but I don't know if such a 
 plugin exists.
 
 I could be talked into using KPresenter / KOffice instead if that would be 
 easier, but as I am on Linux I have no access to KeyNote or PowerPoint.
 
 Any suggestions?
 
 --Larry Garfield
 


Could you use highlight_string() on the code example in a web page then
copy that from the browser and paste that into your presentation? It
should then preserve the formatting used on the browser display, and let
you easily modify the font size.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Code samples in OOo Presenter

2010-03-21 Thread Larry Garfield
On Sunday 21 March 2010 05:41:55 pm Ashley Sheridan wrote:

  I don't like any of these options. :-)  I don't know what the alternative
  is, though.  Ideally I'd love to have a custom text region or format or
  something that is take this and highlight it properly, but I don't know
  if such a plugin exists.
 
  I could be talked into using KPresenter / KOffice instead if that would
  be easier, but as I am on Linux I have no access to KeyNote or
  PowerPoint.
 
  Any suggestions?
 
  --Larry Garfield
 
 Could you use highlight_string() on the code example in a web page then
 copy that from the browser and paste that into your presentation? It
 should then preserve the formatting used on the browser display, and let
 you easily modify the font size.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

I will have to see if OOo preserves formatting when I do that.  However, that 
still leaves the problem of highlight_string()'s colors being rather poor for 
on-screen.  Are those easily configurable?  That would at least give me a 
decent result, kinda, even if it's not as clean as doing it all within the 
presentation program.

--Larry Garfield

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code samples in OOo Presenter

2010-03-21 Thread Paul M Foster
On Sun, Mar 21, 2010 at 07:14:56PM -0500, Larry Garfield wrote:

 On Sunday 21 March 2010 05:41:55 pm Ashley Sheridan wrote:
 
   I don't like any of these options. :-)  I don't know what the alternative
   is, though.  Ideally I'd love to have a custom text region or format or
   something that is take this and highlight it properly, but I don't know
   if such a plugin exists.
  
   I could be talked into using KPresenter / KOffice instead if that would
   be easier, but as I am on Linux I have no access to KeyNote or
   PowerPoint.
  
   Any suggestions?
  
   --Larry Garfield
 
  Could you use highlight_string() on the code example in a web page then
  copy that from the browser and paste that into your presentation? It
  should then preserve the formatting used on the browser display, and let
  you easily modify the font size.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 I will have to see if OOo preserves formatting when I do that.  However, that
 still leaves the problem of highlight_string()'s colors being rather poor for
 on-screen.  Are those easily configurable?  That would at least give me a
 decent result, kinda, even if it's not as clean as doing it all within the
 presentation program.

I think Ash's idea is brilliant, though I probably would show the code
from within the browser, rather than importing it. Also check the
user-supplied code under both the highlight_string() and
highlight_file() function at php.net:

http://us2.php.net/manual/en/function.highlight-string.php
http://us2.php.net/manual/en/function.highlight-file.php

There is also code there to provide line numbers, which would be very
useful for presentations. There are some hints about how you might
change the colors.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code Not entering the value in the Database

2009-01-21 Thread Murray
You don't appear to be doing anything with this line of your code. You build
a string variable, but you don't call anything like mysql_query($sql) to
actually execute the INSERT statement.

M is for Murray


On Wed, Jan 21, 2009 at 12:34 AM, Chris Carter chandan9sha...@yahoo.comwrote:

 $sql = insert into `userstable` (hiddendata) VALUES ('$hiddendata');



Re: [PHP] Code Not entering the value in the Database

2009-01-20 Thread HostWare Kft.


Did I miss something, or you really left the  execution of the last $sql?
After you put the 'INSERT INTO...' string in $sql, you have to mysql_query 
it, or you won't get any result.


SanTa

- Original Message - 
From: Chris Carter chandan9sha...@yahoo.com

To: php-general@lists.php.net
Sent: Tuesday, January 20, 2009 3:34 PM
Subject: [PHP] Code Not entering the value in the Database




Hi,

My code is not giving error but not doing the desired action.

I need to append a value in database just when the user logs in after
entering the username and password. So I am not presenting the user with a
account but just a thank you page.

Steps:

1) User enters the user name and password
2) The login form contains a hidden field with a data
3) After hitting the Submit button the username and password is checked.
4) The hidden data is entered in the database.
5) A mail is sent to the user and he gets a Thank You page.
6) If verification fails then he gets a registeration page.

Here is the code, I have been struggling with:

?php

//include file for db entries, this part is working fine
file.inc
$conn = mysql_connect($host, $user, $password) or die(mysql_error());
$db = mysql_select_db($dbName, $conn) or die(mysql_error());

  // insert new entry in the database if entry submitted

  $emailAddress = $_POST['emailAddress'];
  $password = $_POST['password'];
   //$_SESSION['testing'] = $_POST['emailAddress'];
  // insert new entry into database
  $sql5 = SELECT * FROM userstable WHERE emailAddress='$emailAddress' AND
password = '$password';
  $result5=mysql_query($sql5);

// Mysql_num_row is counting table row
$count5=mysql_num_rows($result5);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count5==1){

$rowset5 = mysql_fetch_array($result5);
$emailAddress = $rowset5['emailAddress'];
$password = $rowset5['password'];

//answer insertion
  $hiddendata= $_POST['hiddendata'];

//Email body that is sent to the logged in user.
$body = Hello $fName\n\nThank You for participating;

$sql = insert into `userstable` (hiddendata) VALUES ('$hiddendata');

mail($emailAddress, Thank you for interest, $body, From: a...@abc.com);
header(Location: thankYou.php);

}
else {
header(location:you-need-to-register.php);
}
?

What exactly am I missing.

Thanks in advance,

Chris
--
View this message in context: 
http://www.nabble.com/Code-Not-entering-the-value-in-the-Database-tp21564252p21564252.html

Sent from the PHP - General mailing list archive at Nabble.com.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code Not entering the value in the Database

2009-01-20 Thread Jan G.B.
2009/1/20 Chris Carter chandan9sha...@yahoo.com:

 Hi,

 My code is not giving error but not doing the desired action.

But it can do a lot more than your desired action.


   // insert new entry in the database if entry submitted

  $emailAddress = $_POST['emailAddress'];
  $password = $_POST['password'];
  $sql5 = SELECT * FROM userstable WHERE 
 emailAddress='$emailAddress' AND
 password = '$password';
  $result5=mysql_query($sql5);

Do yourself a favor and read this from A to Z:
http://de3.php.net/manual/en/security.php
Imagine I send the String: x' OR id=1/*
What would the mysql read now?

SELECT * FROM userstable WHERE emailAddress='x' OR id=1/*' AND ...
everything after /* is not being parsed.


header(location:you-need-to-register.php);
correct would be header(location: http://foo/you-need-to-register.php;);


 What exactly am I missing.

http://php.net/docs.php


Byebye

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-28 Thread Peter Ford

tedd wrote:

At 6:47 PM -0400 7/25/08, Daniel Brown wrote:

On Fri, Jul 25, 2008 at 6:29 PM, tedd [EMAIL PROTECTED] wrote:
  But, there's nothing wrong with starting a sentence with but.


 There, I even started AND ended with one.


Correct, as I said, in Reader's Digest English.  In proper
grammar, it's tantamount to ending a sentence with a preposition[1].
However, even in Reader's Digest English (RDE[TM]), heading a word
with but is acceptable but following it immediately with a comma
is not[2].

1: Hence the name, pre-position --- positioned before.
2: http://www.michbar.org/journal/pdf/pdf4article628.pdf


As I see it, this is more of a When to use a comma thing than a but 
thing.


I use commas like I talk. For example, I would never say:

But that didn't happen.

Instead, I would say

But -- pause -- that didn't happen.

So, I write it:

But, that didn't happen.



It's arguably more correct in this case to use ellipsis:

But ... I could be wrong :)



--
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-28 Thread Philip Thompson

On Jul 24, 2008, at 5:48 AM, Richard Heyes wrote:

Anyone know of an unintrusive code beautifier written specifically  
with in

mind?




With 'what' in mind?


Sorry, PHP.


Not that this thread got off topic at all, but here's a listing (more  
than PHP):


http://en.wikipedia.org/wiki/Prettyprint#Code_Beautifiers

~Philip


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-28 Thread tedd

At 9:06 AM +0100 7/28/08, Peter Ford wrote:

At 6:47 PM -0400 7/25/08, Daniel Brown wrote:

On Fri, Jul 25, 2008 at 6:29 PM, tedd [EMAIL PROTECTED] wrote:

 But, there's nothing wrong with starting a sentence with but.


Correct, as I said, in Reader's Digest English.  In proper
grammar, it's tantamount to ending a sentence with a preposition[1].
However, even in Reader's Digest English (RDE[TM]), heading a word
with but is acceptable but following it immediately with a comma
is not[2].


It's arguably more correct in this case to use ellipsis:


Okay, who said an old dog can't learn new tricks? Both you and Daniel 
have convinced me to stop using But, and start using But ...


As I've said many times before:

I've learned something new every day of my life... and I'm getting 
damned tried of it!


Thanks,

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-28 Thread Jason Pruim


On Jul 28, 2008, at 11:10 AM, tedd wrote:


At 9:06 AM +0100 7/28/08, Peter Ford wrote:

At 6:47 PM -0400 7/25/08, Daniel Brown wrote:
On Fri, Jul 25, 2008 at 6:29 PM, tedd [EMAIL PROTECTED]  
wrote:

But, there's nothing wrong with starting a sentence with but.


   Correct, as I said, in Reader's Digest English.  In proper
grammar, it's tantamount to ending a sentence with a preposition[1].
However, even in Reader's Digest English (RDE[TM]), heading a word
with but is acceptable but following it immediately with a  
comma

is not[2].


It's arguably more correct in this case to use ellipsis:


Okay, who said an old dog can't learn new tricks? Both you and  
Daniel have convinced me to stop using But, and start using  
But ...


As I've said many times before:

I've learned something new every day of my life... and I'm getting  
damned tried of it!


Butt... You're still alive to be apart of it :)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-28 Thread tedd

At 11:20 AM -0400 7/28/08, Jason Pruim wrote:

On Jul 28, 2008, at 11:10 AM, tedd wrote:

As I've said many times before:

I've learned something new every day of my life... and I'm getting 
damned tried of it!


Butt... You're still alive to be apart of it :)


As long as my butt is, I guess you're right.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-26 Thread tedd

At 10:53 PM -0400 7/25/08, Daniel Brown wrote:

On Fri, Jul 25, 2008 at 10:02 PM, tedd [EMAIL PROTECTED] wrote:



[snip=1920's_anecdote]


LOL


 

 So in the end, these were the things I remember being taught by English
 teachers. They taught me well -- but, nothing about writing.  :-)


That's one thing about being a teacher in an official capacity:
your students are likely to learn from you, even if it's not what
you're trying to teach them.

In any case, it sounds like you've met people who prove the rather
offensive adage: those who can, do; those who can't, teach.


Yes, but this also tells me something about myself. In my younger 
years, my level of offensiveness provoked such non-professional 
conduct from others. Now I get it without having to do anything. :-)


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code works alone but not with other code.

2008-07-25 Thread Wolf

 Ed Curtis [EMAIL PROTECTED] wrote: 
 I've got this chunk of code (included) that used to work fine in a 
 script up until a couple of weeks ago. Nothing has changed in the php 
 page at all, it just quit working. If I take this chunk of code and 
 place it alone in a php script it works just fine, but only by itself. I 
 don't understand what's going on and don't see anything that would make 
 the script seem like it's just skipping this chunk of code, without 
 errors, when I run it. I'm using PHP 4.4.4-8 mand MySQL 5.0.32 on Debian 
 Etch.
 
 The code does use nested MySQL queries, it worked before but I thought 
 maybe something changed in PHP or MySQL recently in updates that might 
 have broken it, but there is another chunk of code in the script that 
 uses nested queries as well that works fine just as it had been.
 
 I also have another script that has recently broke and seems to skip a 
 section of code as well without errors. There are no real similarities 
 between the two that I can see.
 
 Thanks,
 
 Ed
!-- Snip --

Doesn't work seems plenty bland, have you tried doing the following:
1.  Putting in die statements
2.  Verified the tables exist and have data in MySQL
3.  Checked the PHP error log
4.  Checked the MySQL error log

Just guessing I'd say your data was empty, but without more information, it's a 
pretty big shot in the dark.

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread tedd

At 3:17 PM -0300 7/24/08, Thiago H. Pojda wrote:

On Thu, Jul 24, 2008 at 3:14 PM, mike [EMAIL PROTECTED] wrote:


 On 7/24/08, Thiago H. Pojda [EMAIL PROTECTED] wrote:

 sadly, I still go and reformat other coworker's code anyway, heh. Yeah, I'm

  -that bad-

That's why I looked for a tool like that months ago. Big project from
someone else, do you feel like reformatting hundreds of files with hundreds
(thousands?) of lines manually?



I do it all the time. In fact, I enjoy doing it (no I don't want to 
do it for anyone else).


What I find interesting/entertaining is reducing the amount of code 
down to what's actually necessary and then reorganizing the code to 
make routines more optimum and generic. Most of the stuff I review is 
reduced considerably.


In short, it's a great way for me to both learn and build my own 
library. When clients don't have me pounding keys for their service, 
I enjoy reviewing, rewriting code and creating demos.


However, I would never use a Code beautifier because as I go through 
the code, the only code that get beautified is the code that I 
approve. When I see code formatted differently than mine, then I know 
it's suspect and I need to review it.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread tedd

At 7:22 PM +0100 7/24/08, Stut wrote:

On 24 Jul 2008, at 19:14, mike wrote:

On 7/24/08, Thiago H. Pojda [EMAIL PROTECTED] wrote:


That doesn't work when you get code from someone else that wasn't prudent
enough ;)


I figured that'd be the reply - it's not my code ... sadly, I still
go and reformat other coworker's code anyway, heh. Yeah, I'm -that
bad-


That's not just bad, it's downright anti-productive. You need to 
either have a standard style across a team or accept that other 
developers format their code differently. If you spend time 
reformatting other peoples code it's a waste of your time. 
Differently (not that I didn't say badly) formatted code does not 
make it wrong, it's just different and if you can't live with that 
then you need to work on getting your preferred format adopted as 
the standard for the team.


IMHO.

-Stut


If what you are doing is for productivity, then I agree with you. 
But, not all coding is for productivity.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread tedd

At 8:10 PM +0100 7/24/08, Richard Heyes wrote:

  (and anal retentive) when you code :)

I am; the problem is no one lives up to my standards... :-)


Anyone else find the two sentences above used together disturbing? 
Something about anal and up that doesn't sound good. :-)


tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread Wolf
 tedd [EMAIL PROTECTED] wrote: 
 At 8:10 PM +0100 7/24/08, Richard Heyes wrote:
(and anal retentive) when you code :)
 
 I am; the problem is no one lives up to my standards... :-)
 
 Anyone else find the two sentences above used together disturbing? 
 Something about anal and up that doesn't sound good. :-)
 
 tedd

So disturbing that it would be nice if I could add an appropriate image to 
it...  ;)

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 12:56 PM, tedd [EMAIL PROTECTED] wrote:
 At 8:10 PM +0100 7/24/08, Richard Heyes wrote:

   (and anal retentive) when you code :)

 I am; the problem is no one lives up to my standards... :-)

 Anyone else find the two sentences above used together disturbing? Something
 about anal and up that doesn't sound good. :-)

This coming from a guy who, two messages prior, started a sentence
with but.

Reader's Digest-standard English aside, Tedd, Freud might have
been right with you.  ;-P

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread Wolf
 Daniel Brown [EMAIL PROTECTED] wrote: 
 On Fri, Jul 25, 2008 at 12:56 PM, tedd [EMAIL PROTECTED] wrote:
  At 8:10 PM +0100 7/24/08, Richard Heyes wrote:
 
(and anal retentive) when you code :)
 
  I am; the problem is no one lives up to my standards... :-)
 
  Anyone else find the two sentences above used together disturbing? Something
  about anal and up that doesn't sound good. :-)
 
 This coming from a guy who, two messages prior, started a sentence
 with but.
 
 Reader's Digest-standard English aside, Tedd, Freud might have
 been right with you.  ;-P

True, but but and butt are two very distinct words...  ;)  I know Dan, it's 
that grammar thing..  Even using the Queen's English makes it a tush for the 
push. ;)

Wolf

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 2:04 PM, Wolf [EMAIL PROTECTED] wrote:

 True, but but and butt are two very distinct words...  ;)  I know Dan, 
 it's that grammar thing..  Even using the Queen's English makes it a tush 
 for the push. ;)

Just reading that opening sentence aloud was fun.

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread Børge Holen
On Friday 25 July 2008 20:10:30 Daniel Brown wrote:
 On Fri, Jul 25, 2008 at 2:04 PM, Wolf [EMAIL PROTECTED] wrote:
  True, but but and butt are two very distinct words...  ;)  I know
  Dan, it's that grammar thing..  Even using the Queen's English makes it a
  tush for the push. ;)

 Just reading that opening sentence aloud was fun.

its just weird. 
Oh btw, this is a NERD list... =D


 --
 /Daniel P. Brown
 Better prices on dedicated servers:
 Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
 Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
 Dedicated servers, VPS, and hosting from $2.50/mo.



-- 
---
Børge Holen
http://www.arivene.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread tedd

At 1:59 PM -0400 7/25/08, Daniel Brown wrote:

On Fri, Jul 25, 2008 at 12:56 PM, tedd [EMAIL PROTECTED] wrote:

 At 8:10 PM +0100 7/24/08, Richard Heyes wrote:


   (and anal retentive) when you code :)

 I am; the problem is no one lives up to my standards... :-)


 Anyone else find the two sentences above used together disturbing? Something
 about anal and up that doesn't sound good. :-)


This coming from a guy who, two messages prior, started a sentence
with but.


But, there's nothing wrong with starting a sentence with but.

There, I even started AND ended with one.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 6:29 PM, tedd [EMAIL PROTECTED] wrote:
 At 1:59 PM -0400 7/25/08, Daniel Brown wrote:

 On Fri, Jul 25, 2008 at 12:56 PM, tedd [EMAIL PROTECTED] wrote:

  At 8:10 PM +0100 7/24/08, Richard Heyes wrote:

   (and anal retentive) when you code :)

  I am; the problem is no one lives up to my standards... :-)

  Anyone else find the two sentences above used together disturbing?
 Something
  about anal and up that doesn't sound good. :-)

This coming from a guy who, two messages prior, started a sentence
 with but.

 But, there's nothing wrong with starting a sentence with but.

 There, I even started AND ended with one.

Correct, as I said, in Reader's Digest English.  In proper
grammar, it's tantamount to ending a sentence with a preposition[1].
However, even in Reader's Digest English (RDE[TM]), heading a word
with but is acceptable but following it immediately with a comma
is not[2].



1: Hence the name, pre-position --- positioned before.
2: http://www.michbar.org/journal/pdf/pdf4article628.pdf

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread tedd

At 6:47 PM -0400 7/25/08, Daniel Brown wrote:

On Fri, Jul 25, 2008 at 6:29 PM, tedd [EMAIL PROTECTED] wrote:
  But, there's nothing wrong with starting a sentence with but.


 There, I even started AND ended with one.


Correct, as I said, in Reader's Digest English.  In proper
grammar, it's tantamount to ending a sentence with a preposition[1].
However, even in Reader's Digest English (RDE[TM]), heading a word
with but is acceptable but following it immediately with a comma
is not[2].

1: Hence the name, pre-position --- positioned before.
2: http://www.michbar.org/journal/pdf/pdf4article628.pdf


As I see it, this is more of a When to use a comma thing than a but thing.

I use commas like I talk. For example, I would never say:

But that didn't happen.

Instead, I would say

But -- pause -- that didn't happen.

So, I write it:

But, that didn't happen.

The But and pause is used by me to get someone's attention before 
presenting my objection.


Now, one can argue if my method is proper or not -- but, I don't 
care. The purpose of writing is to communicate and I do that rather 
well.


I remember three discussions I had with teachers about writing -- one 
teacher in High School told me that no one intelligent would ever 
consider anything I had to say because of my obvious limitations. 
But, I still graduated from High School.


Another teacher marked me down from an A to a B in my last year in 
college because he said that he didn't want me to graduate with 
honors for I wasn't the proper type of person to represent his 
college as an honor student. But, I still graduated with honors.


The last one claimed that my use of commas was excessive in my MS 
thesis. But, I still published, defended my thesis, and received my 
MS.


So in the end, these were the things I remember being taught by 
English teachers. They taught me well -- but, nothing about 
writing.  :-)


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread mike
On 7/25/08, tedd [EMAIL PROTECTED] wrote:

 I do it all the time. In fact, I enjoy doing it (no I don't want to do it
 for anyone else).

 What I find interesting/entertaining is reducing the amount of code down to
 what's actually necessary and then reorganizing the code to make routines
 more optimum and generic. Most of the stuff I review is reduced
 considerably.

 In short, it's a great way for me to both learn and build my own library.
 When clients don't have me pounding keys for their service, I enjoy
 reviewing, rewriting code and creating demos.

 However, I would never use a Code beautifier because as I go through the
 code, the only code that get beautified is the code that I approve. When I
 see code formatted differently than mine, then I know it's suspect and I
 need to review it.

basically, quote what this guy says - this is me in a nutshell. i can
tell my code from others too, so i know if something's been fubared
that i've written :)

tedd you took the words out of my mouth about the subject.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 10:02 PM, tedd [EMAIL PROTECTED] wrote:

[snip=1920's_anecdote]

 So in the end, these were the things I remember being taught by English
 teachers. They taught me well -- but, nothing about writing.  :-)

That's one thing about being a teacher in an official capacity:
your students are likely to learn from you, even if it's not what
you're trying to teach them.

In any case, it sounds like you've met people who prove the rather
offensive adage: those who can, do; those who can't, teach.

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code beautifier

2008-07-24 Thread Aschwin Wesselius

Richard Heyes wrote:

Anyone know of an unintrusive code beautifier written specifically with in mind?

Thanks.

  

Hi,

With 'what' in mind?


--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


Re: [PHP] Code beautifier

2008-07-24 Thread Richard Heyes
 Anyone know of an unintrusive code beautifier written specifically with in
 mind?


 With 'what' in mind?

Sorry, PHP.

-- 
Richard Heyes
http://www.phpguru.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   4   >