Re: [PHP] What design patterns do you usually use?

2008-02-28 Thread Aschwin Wesselius

Zoltán Németh wrote:

well, if classes are not convenient for you, then sure it would take
more time but only for the first time. after that, my experience is that
development time is less with classes
I do use classes, but mix it with procedural code and some function 
libraries. But I'm a self-educated webdeveloper. I just use classes 
since a couple of years (started PHP in 1999) and hadn't an example how 
to factor certain solutions for known problems. Nowadays I hear about 
patterns and deep OOP and design with real architecture in mind. Fine, 
PHP gets more mature, gets more attention and can fit in an enterprise 
environment (ducks.;-).


But to teach myself software engineering is still a steep curve even if 
I've done a lot of webprogramming in the past. I can't find the time to 
study software engineering to a level that is desired these days for 
webprogramming. I'd love to follow some courses or workshops here and 
there, but that doesn't compare to 4 years of hardcore computer science. 
I also see that besides nice OOP etc. there is a need for security 
expertise, configuration / optimization expertise, Web x.x expertise, 
database expertise. I think you cannot become a guru at all these fields 
to a same level even if I want to and probably am able to.


What I want to say is, yes classes can take some trouble away, but right 
now I don't have the complete skills to software engineer the whole 
shebang over and over. I'd rather have the job done in time than do it 
the 'professional engineering' way.



--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 00.02-kor Dotan Cohen ezt írta:
 On 27/02/2008, Zoltán Németh [EMAIL PROTECTED] wrote:
 
  sorry that's messed up a bit, as I typed it right here in my mailer ;)
 
   preg_replace('/\b([^\s]+)a\b.*/U', '$1A', 'whatever i want that hasa a
   on the end');
 
   greets
 
  Zoltán Németh
 
 
 Thank you very much, Zoltan. Is there a known UTF-8 limitation?
 Because it works fine for me in English letters (well, the opposite of
 what I needed but I was able to work with it as which polar I start
 with was arbitrary), but not in Hebrew letters. For instance, this
 works as expected:
 
 $test=aabacada aa a f;
 $test=preg_replace('/\b([^\s]+)a\b.*/U', '$1A', $test);
 print $test; // PRINTS aabacadA aA a f
 
 However, this does not:
 
 $test=אאבאגאדא אא א ;
 $test=preg_replace('/\b([^\s]+)ע\b.*/U', '$1א', $test);
 print $test; // PRINTS אאבאגאדא אא א
 
 Am I misunderstanding something, or is there a UTF-8 problem, or
 something else? Thank you for your assistance, it is much appreciated
 and I'm learning what I can.

in the above example I don't see the character-to-be-replaced in the
original string, so I'm not surprised it does not get replaced ;)

you can test the regex further here:
http://www.spaweditor.com/scripts/regex/index.php

I pasted your data in there (don't be surprised that after posting it
turns them into html entities), replaced the last character to the one
in the regex and the preg_replace worked

greets
Zoltán Németh

 
 Dotan Cohen
 
 http://what-is-what.com
 http://gibberish.co.il
 א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
 
 A: Because it messes up the order in which people normally read text.
 Q: Why is top-posting such a bad thing?

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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-28 Thread Dotan Cohen
On 28/02/2008, Casey [EMAIL PROTECTED] wrote:
Thank you very much, Zoltan. Is there a known UTF-8 limitation?
Because it works fine for me in English letters (well, the opposite of
what I needed but I was able to work with it as which polar I start
with was arbitrary), but not in Hebrew letters. For instance, this
works as expected:
  
$test=aabacada aa a f;
$test=preg_replace('/\b([^\s]+)a\b.*/U', '$1A', $test);
print $test; // PRINTS aabacadA aA a f
  
However, this does not:
  
$test=אאבאגאדא אא א ;
$test=preg_replace('/\b([^\s]+)ע\b.*/U', '$1א', $test);
print $test; // PRINTS אאבאגאדא אא א
  
Am I misunderstanding something, or is there a UTF-8 problem, or
something else? Thank you for your assistance, it is much appreciated
and I'm learning what I can.

 The a character (97) is different from the א character (1488).

  $a = html_entity_decode('#1488;');

 $test=preg_replace('/\b([^\s]+)' . $a . '\b.*/U', '$1A', $test);


 Will this work?

No, it doesn't. I've been playing around a bit and learning, and it
looks like it really should work. With English letters it does. But
not with Hebrew.  You can see the result and the exact  code used
here:
http://gibberish.co.il/test.html

I appreciate the assistance. I'm certain that we're missing only some
small detail here.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-28 Thread Dotan Cohen
On 28/02/2008, Zoltán Németh [EMAIL PROTECTED] wrote:
   Thank you very much, Zoltan. Is there a known UTF-8 limitation?
   Because it works fine for me in English letters (well, the opposite of
   what I needed but I was able to work with it as which polar I start
   with was arbitrary), but not in Hebrew letters. For instance, this
   works as expected:
  
   $test=aabacada aa a f;
   $test=preg_replace('/\b([^\s]+)a\b.*/U', '$1A', $test);
   print $test; // PRINTS aabacadA aA a f
  
   However, this does not:
  
   $test=אאבאגאדא אא א ;
   $test=preg_replace('/\b([^\s]+)ע\b.*/U', '$1א', $test);
   print $test; // PRINTS אאבאגאדא אא א
  
   Am I misunderstanding something, or is there a UTF-8 problem, or
   something else? Thank you for your assistance, it is much appreciated
   and I'm learning what I can.


 in the above example I don't see the character-to-be-replaced in the
  original string, so I'm not surprised it does not get replaced ;)

It was supposed to be this:

$test=אאבאגאדא אא א ;
$test=preg_replace('/\b([^\s]+)א\b.*/U', '$1ע', $test);
print $test; // PRINTS אאבאגאדא אא א

But I reversed them while trying a string of different letters, and
apparently only CTRL-Z'ed part of the code before copying to here.
Sorry. The code above also does not work. Not on my server, and not at
spaweditor.com (Thanks for that resource, by the way). You can see the
result and the exact code used here:
http://gibberish.co.il/test.html

  you can test the regex further here:
  http://www.spaweditor.com/scripts/regex/index.php

Thanks, that is a great resource.

  I pasted your data in there (don't be surprised that after posting it
  turns them into html entities), replaced the last character to the one
  in the regex and the preg_replace worked

Not for me. These are my parameters:

Enter regular expression here: /\b([^\s]+)א\b.*/U
Enter your data here: אאבאגאדא אא א ח
Enter text to replace matches with here: (backreferences are ok): $1ע
Regular expression options: PERL
Function: preg_replace
Flags: 0 limit

I really appreciate the help.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


[PHP] Traverse directory - Find empty directory

2008-02-28 Thread Holografix
Hi

I'm using Spl RecursiveDirectoryIterator to traverse a directory and have no 
problem with it but now I'm stuck. I only need to display directories with 
no files in it.

Can someone help with this?

My current code:

set_time_limit(0);

$files = new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator('c:\dev'), 
RecursiveIteratorIterator::SELF_FIRST);
foreach($files as $file) {
if ($files-isDir()) {
echo $file . br/;
}
}

I have
c:\dev
c:\dev\php
c:\dev\php\file1.php
c:\dev\php\file2.php
c:\dev\php\test
c:\dev\php\test\db

I would like to display 'test' because although there is a 'db'  folder, 
there are no files in c:\dev\php\test



Bets regards,
holo 

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



Re: [PHP] Getting the name of a function

2008-02-28 Thread Jochem Maas

Daniel Brown schreef:

On Wed, Feb 27, 2008 at 1:56 PM, Richard S. Crawford
[EMAIL PROTECTED] wrote:

For my own amusement, I'm writing a function that will print out detailed
 error messages for an API that I'm creating for a minor project.  One of the
 pieces of information I'd like to return would be the name of the function
 that called the error function.

[snip!]

 I know that I could pass the name of the function as a parameter to the
 error() function (e.g. error(bad_function,This is dumb)) but I'd rather
 keep it simpler than that.

 Is there a way to do this?


Not without a lower-level stack trace utility like xdebug, as far


huh? what about debug_backtrace() ... contains plenty of info, including
function names of everything in the stack. of course something like xdebug
can take it to a whole new level.


as I know.  However, you can slightly modify your code to do this:

?php
function error ($func,$message) {
   print The error message is $message;
   print The function that called the error was: .$func.\n;
}

function bad_function($param) {
   error (__FUNCTION__,This is dumb);
   return false;
}

bad_function(blah);
?

I also placed that online in my code library (to which I always
forget to link, but have dozens of examples), along with a function to
list all of the user-level functions available to the current script.

[Demo]http://www.pilotpig.net/code-library/function-info.php
[Source]   
http://www.pilotpig.net/code-library/source.php?f=function-info.php



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



Re: [PHP] Cannot even come up with the beginning of a regex

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 11.23-kor Dotan Cohen ezt írta:
 On 28/02/2008, Zoltán Németh [EMAIL PROTECTED] wrote:
Thank you very much, Zoltan. Is there a known UTF-8 limitation?
Because it works fine for me in English letters (well, the opposite of
what I needed but I was able to work with it as which polar I start
with was arbitrary), but not in Hebrew letters. For instance, this
works as expected:
   
$test=aabacada aa a f;
$test=preg_replace('/\b([^\s]+)a\b.*/U', '$1A', $test);
print $test; // PRINTS aabacadA aA a f
   
However, this does not:
   
$test=אאבאגאדא אא א ;
$test=preg_replace('/\b([^\s]+)ע\b.*/U', '$1א', $test);
print $test; // PRINTS אאבאגאדא אא א
   
Am I misunderstanding something, or is there a UTF-8 problem, or
something else? Thank you for your assistance, it is much appreciated
and I'm learning what I can.
 
 
  in the above example I don't see the character-to-be-replaced in the
   original string, so I'm not surprised it does not get replaced ;)
 
 It was supposed to be this:
 
 $test=אאבאגאדא אא א ;
 $test=preg_replace('/\b([^\s]+)א\b.*/U', '$1ע', $test);
 print $test; // PRINTS אאבאגאדא אא א
 
 But I reversed them while trying a string of different letters, and
 apparently only CTRL-Z'ed part of the code before copying to here.
 Sorry. The code above also does not work. Not on my server, and not at
 spaweditor.com (Thanks for that resource, by the way). You can see the
 result and the exact code used here:
 http://gibberish.co.il/test.html
 
   you can test the regex further here:
   http://www.spaweditor.com/scripts/regex/index.php
 
 Thanks, that is a great resource.
 
   I pasted your data in there (don't be surprised that after posting it
   turns them into html entities), replaced the last character to the one
   in the regex and the preg_replace worked
 
 Not for me. These are my parameters:
 
 Enter regular expression here: /\b([^\s]+)א\b.*/U
 Enter your data here: אאבאגאדא אא א ח
 Enter text to replace matches with here: (backreferences are ok): $1ע
 Regular expression options: PERL
 Function: preg_replace
 Flags: 0 limit

strange, now for a second try it did not work for me either... maybe I
confused some hebrew letters last time...

with html entities it won't work, as a html entity is a set of
characters for the regex interpreter.

anyone utf8 experts in here? I've run out of ideas...

greets,
Zoltán Németh


 
 I really appreciate the help.
 
 Dotan Cohen
 
 http://what-is-what.com
 http://gibberish.co.il
 א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
 
 A: Because it messes up the order in which people normally read text.
 Q: Why is top-posting such a bad thing?

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



Re: [PHP] Guidance

2008-02-28 Thread Stut

On 28 Feb 2008, at 01:21, Jochem Maas wrote:
hmm. thing is you need a bit of paper to call yourself an  
engineer .. I ain't

got one.


Not in my book you don't. Experience has shown that bits of paper lie  
better than most people do. Prove yourself to me in person - I'll  
trust that over any bit of paper.


-Stut

--
http://stut.net/

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



[PHP] php --ini and the like

2008-02-28 Thread Jochem Maas

was just cruising the manual and came accross a nice tidbit.

from: http://nl.php.net/features.commandline



Shows configuration file names and scanned directories. Available as of PHP 
5.2.3.

Example#3 --ini example

$ php --ini
Configuration File (php.ini) Path: /usr/dev/php/5.2/lib
Loaded Configuration File: /usr/dev/php/5.2/lib/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:  (none)


Shows information about the given function or class method (e.g. number and 
name of the parameters). Available as of PHP 5.1.2.
This option is only available if PHP was compiled with Reflection support.

Example#4 basic --rf usage

$ php --rf var_dump
Function [ internal public function var_dump ] {

  - Parameters [2] {
Parameter #0 [ required $var ]
Parameter #1 [ optional $... ]
  }
}

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



[PHP] reverse string without strrev();

2008-02-28 Thread Shelley

Hi all,

What do you think is the best way to display string 'abcdef' as 'fedcba'?

Any ideas appreciated.

Thanks in advance.


--
Regards,
Shelley

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Aschwin Wesselius

Shelley wrote:

Hi all,

What do you think is the best way to display string 'abcdef' as 'fedcba'?



$tmp = '';
$str = 'abcdef';

for ($i = strlen($str); $i = 0; $i--) {

  $tmp.= $str[$i];
}

echo $tmp;


--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Aschwin Wesselius

Stut wrote:

On 28 Feb 2008, at 11:30, Aschwin Wesselius wrote:

Shelley wrote:

Hi all,

What do you think is the best way to display string 'abcdef' as 
'fedcba'?



$tmp = '';
$str = 'abcdef';

for ($i = strlen($str); $i = 0; $i--) {

 $tmp.= $str[$i];
}

echo $tmp;


Close, but no cigar. $i should be initialised to strlen($str)-1 
otherwise you start one character beyond the end of the string.



Ah, well. You're right, but it works none the less.



--
Aschwin Wesselius

social

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

/social

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



[PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

hi there,

I can't seem to manage to buffer output (of an included file) in a CLI script,
the following does not work:


// buffer output so we can avoid the shebang line being 
output (and strip it from the output we log)
$oldIFvalue = ini_set('implicit_flush', false);
ob_start();

if ([EMAIL PROTECTED] $script) {
ob_end_clean();
} else {
$output = explode(\n, ob_get_clean());
if ($output[0]  preg_match('%^#!\/%', $output[0]))
unset($output[0]);
}

ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop the shebang 
line that *may*
be present in the included script from being output to stdout.

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



RE: [PHP] output buffering in CLI script.

2008-02-28 Thread Andrés Robinet
 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 28, 2008 6:39 AM
 To: [php] PHP General List
 Subject: [PHP] output buffering in CLI script.
 
 hi there,
 
 I can't seem to manage to buffer output (of an included file) in a CLI
 script,
 the following does not work:
 
 
  // buffer output so we can avoid the shebang line
 being output (and strip it from the output we log)
  $oldIFvalue = ini_set('implicit_flush', false);
  ob_start();
 
  if ([EMAIL PROTECTED] $script) {
  ob_end_clean();
  } else {
  $output = explode(\n, ob_get_clean());
  if ($output[0]  preg_match('%^#!\/%',
 $output[0]))
  unset($output[0]);
  }
 
  ini_set('implicit_flush', $oldIFvalue);
 
 
 the reason I'm wanting to do this is, primarily, in order to stop the
 shebang line that *may*
 be present in the included script from being output to stdout.
 
 --

Aren't you deleting the output when you do ob_get_clean?
Meaning, you are missing an echo of the captured buffer, like:

$output = explode(\n, ob_get_clean());
if ($output[0]  preg_match('%^#!\/%', $output[0]))
unset($output[0]);
echo join(\n, $output); // You need to echo this, since you lost your buffer
by doing ob_get_clean

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Stut

On 28 Feb 2008, at 11:39, Jochem Maas wrote:
I can't seem to manage to buffer output (of an included file) in a  
CLI script,

the following does not work:


   // buffer output so we can avoid the shebang line  
being output (and strip it from the output we log)

   $oldIFvalue = ini_set('implicit_flush', false);
   ob_start();

   if ([EMAIL PROTECTED] $script) {
   ob_end_clean();
   } else {
   $output = explode(\n, ob_get_clean());
   if ($output[0]  preg_match('%^#!\/%',  
$output[0]))

   unset($output[0]);
   }

   ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop  
the shebang line that *may*

be present in the included script from being output to stdout.


On my local machine here PHP does not output the shebang line. AFAIK  
it detects and strips it at the compilation phase. Have you tried it?


-Stut

--
http://stut.net/

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Stut

On 28 Feb 2008, at 11:40, Aschwin Wesselius wrote:

Stut wrote:

On 28 Feb 2008, at 11:30, Aschwin Wesselius wrote:

Shelley wrote:

Hi all,

What do you think is the best way to display string 'abcdef' as  
'fedcba'?



$tmp = '';
$str = 'abcdef';

for ($i = strlen($str); $i = 0; $i--) {

$tmp.= $str[$i];
}

echo $tmp;


Close, but no cigar. $i should be initialised to strlen($str)-1  
otherwise you start one character beyond the end of the string.



Ah, well. You're right, but it works none the less.


Just because it works doesn't mean it's right.

-Stut

--
http://stut.net/

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Aschwin Wesselius

Stut wrote:

Just because it works doesn't mean it's right.

-Stut




What I meant was that I tested the script and it worked, so I didn't 
spot the flaw (wich is obvious and you were right).


No big deal.



--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Stuart Dallas

On 28 Feb 2008, at 11:52, Stut wrote:

On 28 Feb 2008, at 11:39, Jochem Maas wrote:
I can't seem to manage to buffer output (of an included file) in a  
CLI script,

the following does not work:


  // buffer output so we can avoid the shebang line  
being output (and strip it from the output we log)

  $oldIFvalue = ini_set('implicit_flush', false);
  ob_start();

  if ([EMAIL PROTECTED] $script) {
  ob_end_clean();
  } else {
  $output = explode(\n, ob_get_clean());
  if ($output[0]  preg_match('%^#!\/%',  
$output[0]))

  unset($output[0]);
  }

  ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop  
the shebang line that *may*

be present in the included script from being output to stdout.


On my local machine here PHP does not output the shebang line. AFAIK  
it detects and strips it at the compilation phase. Have you tried it?


Hang on, ignore that. You're including the file, not running it on the  
CLI.


What do you mean when you say it doesn't work? Do you mean you get no  
output?


I suggest you remove the @ at the start of the include while  
developing it. Or alternatively spit something out after you call  
ob_end_clean so you know it couldn't include the file.


-Stut

--
http://stut.net/

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Stut

On 28 Feb 2008, at 11:30, Aschwin Wesselius wrote:

Shelley wrote:

Hi all,

What do you think is the best way to display string 'abcdef' as  
'fedcba'?



$tmp = '';
$str = 'abcdef';

for ($i = strlen($str); $i = 0; $i--) {

 $tmp.= $str[$i];
}

echo $tmp;


Close, but no cigar. $i should be initialised to strlen($str)-1  
otherwise you start one character beyond the end of the string.


-Stut

--
http://stut.net/

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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

Andrés Robinet schreef:

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 28, 2008 6:39 AM
To: [php] PHP General List
Subject: [PHP] output buffering in CLI script.

hi there,

I can't seem to manage to buffer output (of an included file) in a CLI
script,
the following does not work:


 // buffer output so we can avoid the shebang line
being output (and strip it from the output we log)
 $oldIFvalue = ini_set('implicit_flush', false);
 ob_start();

 if ([EMAIL PROTECTED] $script) {
 ob_end_clean();
 } else {
 $output = explode(\n, ob_get_clean());
 if ($output[0]  preg_match('%^#!\/%',
$output[0]))
 unset($output[0]);
 }

 ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop the
shebang line that *may*
be present in the included script from being output to stdout.

--


Aren't you deleting the output when you do ob_get_clean?
Meaning, you are missing an echo of the captured buffer, like:

$output = explode(\n, ob_get_clean());
if ($output[0]  preg_match('%^#!\/%', $output[0]))
unset($output[0]);
echo join(\n, $output); // You need to echo this, since you lost your buffer
by doing ob_get_clean


I'm retrieving the output buffer and shoving it in $output - which is
subsequently logged to a file. but output is not being buffered at all 
regardless
of implicit_flush setting and/or use of ob_start()

:-(



Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |

 Web: bestplace.biz  | Web: seo-diy.com



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



Re: [PHP] Guidance

2008-02-28 Thread Timothy Asiedu
Dear Sir/Madam,
   
  Please I would be grateful if you could remove my e-mail address: [EMAIL 
PROTECTED] from the general Mailing List. 
   
  I look forward to having a favourable response from you. Thank you.
   
   
  Best regards,
   
   
  Timothy Asiedu.
   
  

Stut [EMAIL PROTECTED] wrote:
  On 27 Feb 2008, at 21:50, Shawn McKenzie wrote:
 Shawn McKenzie wrote:
 Stut wrote:
 I've interviewed more than my fair share of web developers who
 couldn't reverse an array without using array_reverse if their life
 depended on it. Sometimes it really does scare me!

 So my experience is that there are far more web developers out there
 than software engineers who do web development, and it's getting 
 harder
 to find decent software engineers to do web-based work at a 
 reasonable
 price. The good ones are rare - so rare in fact that I'm having 
 trouble
 finding one at the moment. If anyone considers themselves a software
 engineer rather than a web developer and would like a job in Windsor
 drop me a note.

 Job! Now!

 foreach($array as $k = $v) {
 $reversed[$v] = $k;
 }
 $array = $reversed; //optional
 No wait!

Yeah, nice try ;)

Anyways, I assume you're based in the US somewhere so unless you're 
considering emigrating to the UK you were never in the running.

-Stut

-- 
http://stut.net/

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



   
-
Never miss a thing.   Make Yahoo your homepage.

Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

Stut schreef:

On 28 Feb 2008, at 11:39, Jochem Maas wrote:
I can't seem to manage to buffer output (of an included file) in a CLI 
script,

the following does not work:


   // buffer output so we can avoid the shebang line 
being output (and strip it from the output we log)

   $oldIFvalue = ini_set('implicit_flush', false);
   ob_start();

   if ([EMAIL PROTECTED] $script) {
   ob_end_clean();
   } else {
   $output = explode(\n, ob_get_clean());
   if ($output[0]  preg_match('%^#!\/%', 
$output[0]))

   unset($output[0]);
   }

   ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop the 
shebang line that *may*

be present in the included script from being output to stdout.


On my local machine here PHP does not output the shebang line. AFAIK it 
detects and strips it at the compilation phase. Have you tried it?


I have, I actually wrote the code assuming that the shebang line is
ignored (as I had experienced and read about ages ago), I was surprised
to see the shebang line output in the shell ... so I figured I'd just
buffer and strip the line manually given that php decided to treat the shebang
line as regular output when it's the first line of an *included* file ...
but no joy on getting output buffering to work in the shell, STFW didn't do it
for me either, so now I'm hassling you guys :-)

obviously the shebang line doesn't get output if I run said script directly
(or by using exec) ... and yes I need to be able to do it both ways :-)



-Stut



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



Re: [PHP] Guidance

2008-02-28 Thread Stut

On 28 Feb 2008, at 12:15, Timothy Asiedu wrote:
Please I would be grateful if you could remove my e-mail address: [EMAIL PROTECTED] 
 from the general Mailing List.


Unsubscribe instructions are in the footer of every email you receive  
from this list. Follow them to get your favourable response.



To unsubscribe, visit: http://www.php.net/unsub.php


-Stut

--
http://stut.net/

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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

Stuart Dallas schreef:

On 28 Feb 2008, at 11:52, Stut wrote:

On 28 Feb 2008, at 11:39, Jochem Maas wrote:
I can't seem to manage to buffer output (of an included file) in a 
CLI script,

the following does not work:


  // buffer output so we can avoid the shebang line 
being output (and strip it from the output we log)

  $oldIFvalue = ini_set('implicit_flush', false);
  ob_start();

  if ([EMAIL PROTECTED] $script) {
  ob_end_clean();
  } else {
  $output = explode(\n, ob_get_clean());
  if ($output[0]  preg_match('%^#!\/%', 
$output[0]))

  unset($output[0]);
  }

  ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop the 
shebang line that *may*

be present in the included script from being output to stdout.


On my local machine here PHP does not output the shebang line. AFAIK 
it detects and strips it at the compilation phase. Have you tried it?


Hang on, ignore that. You're including the file, not running it on the CLI.

What do you mean when you say it doesn't work? Do you mean you get no 
output?


I mean that the shebang line at the top of the included file is output
to stdout even when I turn on output buffering on prior to including the file.

nothing else is output but that's because the script doesn't generate any 
further
output - it logs everything instead - and I know it runs because the relevant 
lines
appear in the relevant log file.



I suggest you remove the @ at the start of the include while developing 
it. Or alternatively spit something out after you call ob_end_clean so 
you know it couldn't include the file.


the @ is niether here nor there with regard to the problem I have, well more
of an annoyance - nobody is going get hurt by some spurious output to stdout but
it looks messy.

just to clarify - I need to be able to run the script directly (as an 
executable) and
be able to include it within another script ... so the shebang line is needed
(well I could hack around it with a wrapper script to use directly on the 
command line
or run it using /usr/bin/php foo.php ... but I don't find either of those 
satisfactory)





-Stut



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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Nathan Rixham

Jochem Maas wrote:

Stut schreef:

On 28 Feb 2008, at 11:39, Jochem Maas wrote:
I can't seem to manage to buffer output (of an included file) in a 
CLI script,

the following does not work:


   // buffer output so we can avoid the shebang line 
being output (and strip it from the output we log)

   $oldIFvalue = ini_set('implicit_flush', false);
   ob_start();

   if ([EMAIL PROTECTED] $script) {
   ob_end_clean();
   } else {
   $output = explode(\n, ob_get_clean());
   if ($output[0]  preg_match('%^#!\/%', 
$output[0]))

   unset($output[0]);
   }

   ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop the 
shebang line that *may*

be present in the included script from being output to stdout.


On my local machine here PHP does not output the shebang line. AFAIK 
it detects and strips it at the compilation phase. Have you tried it?


I have, I actually wrote the code assuming that the shebang line is
ignored (as I had experienced and read about ages ago), I was surprised
to see the shebang line output in the shell ... so I figured I'd just
buffer and strip the line manually given that php decided to treat the 
shebang

line as regular output when it's the first line of an *included* file ...
but no joy on getting output buffering to work in the shell, STFW didn't 
do it

for me either, so now I'm hassling you guys :-)

obviously the shebang line doesn't get output if I run said script directly
(or by using exec) ... and yes I need to be able to do it both ways :-)



-Stut



bit of false logic here but have you tried:

eval(ltrim(file_get_contents($script),$shebang));

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



Re: [PHP] Guidance

2008-02-28 Thread Jochem Maas

Stut schreef:

On 28 Feb 2008, at 12:15, Timothy Asiedu wrote:
Please I would be grateful if you could remove my e-mail address: 
[EMAIL PROTECTED] from the general Mailing List.


Unsubscribe instructions are in the footer of every email you receive 
from this list. Follow them to get your favourable response.


lol ... who gave him a ieee.org address in the first place :-)




To unsubscribe, visit: http://www.php.net/unsub.php


-Stut



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



RES: [PHP] Guidance

2008-02-28 Thread Thiago Pojda
Go to:

http://php.net/mailing-lists.php 

-Mensagem original-
De: Timothy Asiedu [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 28 de fevereiro de 2008 09:16
Para: Stut; php-general@lists.php.net
Cc: [EMAIL PROTECTED]
Assunto: Re: [PHP] Guidance

Dear Sir/Madam,
   
  Please I would be grateful if you could remove my e-mail address:
[EMAIL PROTECTED] from the general Mailing List. 
   
  I look forward to having a favourable response from you. Thank you.
   
   
  Best regards,
   
   
  Timothy Asiedu.
   
  

Stut [EMAIL PROTECTED] wrote:
  On 27 Feb 2008, at 21:50, Shawn McKenzie wrote:
 Shawn McKenzie wrote:
 Stut wrote:
 I've interviewed more than my fair share of web developers who 
 couldn't reverse an array without using array_reverse if their life 
 depended on it. Sometimes it really does scare me!

 So my experience is that there are far more web developers out there 
 than software engineers who do web development, and it's getting 
 harder to find decent software engineers to do web-based work at a 
 reasonable price. The good ones are rare - so rare in fact that I'm 
 having trouble finding one at the moment. If anyone considers 
 themselves a software engineer rather than a web developer and would 
 like a job in Windsor drop me a note.

 Job! Now!

 foreach($array as $k = $v) {
 $reversed[$v] = $k;
 }
 $array = $reversed; //optional
 No wait!

Yeah, nice try ;)

Anyways, I assume you're based in the US somewhere so unless you're
considering emigrating to the UK you were never in the running.

-Stut

--
http://stut.net/

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



   
-
Never miss a thing.   Make Yahoo your homepage.

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Nathan Rixham

Aschwin Wesselius wrote:

Stut wrote:

Just because it works doesn't mean it's right.

-Stut




What I meant was that I tested the script and it worked, so I didn't 
spot the flaw (wich is obvious and you were right).


No big deal.



should it not use curlies?

$tmp = '';
$str = 'abcdef';
for ($i = strlen($str)-1; $i = 0; $i--) {
 $tmp.= $str{$i};
}
echo $tmp;


here's the overkill way to do it:

$str = 'abcdef';
$rev = implode(array_flip(array_reverse(array_flip(str_split($str);
echo $rev;

*sniggers*

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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Stuart Dallas

On 28 Feb 2008, at 12:29, Jochem Maas wrote:

Stuart Dallas schreef:

On 28 Feb 2008, at 11:52, Stut wrote:

On 28 Feb 2008, at 11:39, Jochem Maas wrote:
I can't seem to manage to buffer output (of an included file) in  
a CLI script,

the following does not work:


 // buffer output so we can avoid the shebang  
line being output (and strip it from the output we log)

 $oldIFvalue = ini_set('implicit_flush', false);
 ob_start();

 if ([EMAIL PROTECTED] $script) {
 ob_end_clean();
 } else {
 $output = explode(\n, ob_get_clean());
 if ($output[0]  preg_match('%^#!\/%',  
$output[0]))

 unset($output[0]);
 }

 ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop  
the shebang line that *may*

be present in the included script from being output to stdout.


This works...

test.php
#!/usr/bin/php
?php
echo arse\n;
echo Inc('testinc.php');

function  Inc($f)
{
ob_start();
@include($f);
$content = ob_get_contents();
ob_end_clean();
if (substr($content, 0, 2) == '#!')
{
$content = substr($content, strpos($content, \n)+1);
}
return $content;
}
/test.php

testinc.php
#!/usr/bin/php
?php
echo testinc\n;
/testinc.php

output
[EMAIL PROTECTED]:~$ ./test.php
arse
testinc
/output

-Stut

--
http://stut.net/

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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Aschwin Wesselius

Jochem Maas wrote:

I mean that the shebang line at the top of the included file is output
to stdout even when I turn on output buffering on prior to including 
the file.


nothing else is output but that's because the script doesn't generate 
any further
output - it logs everything instead - and I know it runs because the 
relevant lines
appear in the relevant log file. 



I don't know what goes wrong here. I took your script and it just works, 
so it is not your code (I guess).


I've done this:

$oldIFvalue = ini_set('implicit_flush', false);

ob_start();

if (!include 'scrap2.php') {

   ob_end_clean();
}
else {

   $output = explode(\n, ob_get_clean());

   if ($output[0]  preg_match('%^#!%', $output[0]))
   unset($output[0]);

   echo implode(\n, $output);
}

ini_set('implicit_flush', $oldIFvalue);

The only difference is it echoes imploded $output. And I do a bit 
different preg_match ^#! instead of ^#!\/


If you can include the script you want to include, than it should work.
If you can buffer output without the include file, than it should work.
If you can dump $output after you've done the explode, than it should work.

So, I don't know what goes wrong.


--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Aschwin Wesselius

Nathan Rixham wrote:

should it not use curlies?



I don't know. What is the leading preference nowadays? Does it matter?

Somewhere in the past I learned it with the square brackets like an 
array and it still works like that. Maybe it isn't 'right' (Stut?), but 
that is the way I picked it up.




--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

Nathan Rixham schreef:

Jochem Maas wrote:


...



-Stut



bit of false logic here but have you tried:

eval(ltrim(file_get_contents($script),$shebang));


haven't tried it, did consider it. I hate eval() :-)





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



[PHP] [SOLVEDish] Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

Stuart Dallas schreef:

On 28 Feb 2008, at 12:29, Jochem Maas wrote:

Stuart Dallas schreef:

On 28 Feb 2008, at 11:52, Stut wrote:

On 28 Feb 2008, at 11:39, Jochem Maas wrote:
I can't seem to manage to buffer output (of an included file) in a 
CLI script,

the following does not work:


 // buffer output so we can avoid the shebang line 
being output (and strip it from the output we log)

 $oldIFvalue = ini_set('implicit_flush', false);
 ob_start();

 if ([EMAIL PROTECTED] $script) {
 ob_end_clean();
 } else {
 $output = explode(\n, ob_get_clean());
 if ($output[0]  preg_match('%^#!\/%', 
$output[0]))

 unset($output[0]);
 }

 ini_set('implicit_flush', $oldIFvalue);


the reason I'm wanting to do this is, primarily, in order to stop 
the shebang line that *may*

be present in the included script from being output to stdout.


This works...



indeed ... I tested it and it works on my server too. my code is no different
to yours with regard to the context of the problem. so what's going on.

I think (I know) I forgot to mention one tiny little detail.
the whole 'include' code occurs in a script that forks itself ...
the script forks itself a number of times and each child then performs
the include.

so I tested the fork issue with your script ... it still bloody works,
(see the for loop below) so it's something else ... I thought it might
be the difference between using ob_get_clean() and 
ob_get_contents()+ob_end_clean()
but that doesn't seem to be it either.

the worse thing is my script has just stopped outputting the shebang lines of
the included script(s) ... oh well ... the problem is solved, dunno how, dunno 
why,

situations like these I'd rather the problem didn't go away .. I prefer to know
wtf happened!


test.php
#!/usr/bin/php
?php
echo arse\n;


for ($i = 0; $i  3; $i++) {
$pid  = pcntl_fork();
if ($pid == 0) {
echo Inc('testinc.php');
exit;
}
}



function  Inc($f)
{
ob_start();
@include($f);
$content = ob_get_contents();
ob_end_clean();
if (substr($content, 0, 2) == '#!')
{
$content = substr($content, strpos($content, \n)+1);
}
return $content;
}
/test.php

testinc.php
#!/usr/bin/php
?php
echo testinc\n;
/testinc.php

output
[EMAIL PROTECTED]:~$ ./test.php
arse
testinc
/output

-Stut



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



RE: [PHP] reverse string without strrev();

2008-02-28 Thread Ford, Mike
On 28 February 2008 12:39, Nathan Rixham advised:


 should it not use curlies?

No, they will be deprecated as of PHP6. (Square brackets used to be, but
have been undeprecated and are back in favour!)

 
 $tmp = '';
 $str = 'abcdef';
 for ($i = strlen($str)-1; $i = 0; $i--) {
   $tmp.= $str{$i};
 }
 echo $tmp;

Cheers!

 --
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] Re: [SOLVEDish] Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Nathan Rixham

how's this?

#!/usr/bin/php
?php
class trimshebang {
  function filter($in, $out, $consumed, $closing)
  {
while ($bucket = stream_bucket_make_writeable($in)) {
  $bucket-data = ltrim($bucket-data,#!/usr/bin/php\n);
  $consumed += $bucket-datalen;
  stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
  }
}

stream_filter_register(trim.shebang, trimshebang);
include php://filter/read=trim.shebang/resource=/path/to/include.php;
?

bit more graceful ;)

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



Re: [PHP] Re: [SOLVEDish] Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Aschwin Wesselius

Nathan Rixham wrote:

how's this?

#!/usr/bin/php
?php
class trimshebang {
  function filter($in, $out, $consumed, $closing)
  {
while ($bucket = stream_bucket_make_writeable($in)) {
  $bucket-data = ltrim($bucket-data,#!/usr/bin/php\n);
  $consumed += $bucket-datalen;
  stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
  }
}

stream_filter_register(trim.shebang, trimshebang);
include php://filter/read=trim.shebang/resource=/path/to/include.php;
?

bit more graceful ;)



Me thinks that when shebang doesn't fit /usr/bin/php (which happens 
sometimes) you're doomed.


But it still is a nice example.

--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] Re: [SOLVEDish] Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Nathan Rixham

Aschwin Wesselius wrote:


Me thinks that when shebang doesn't fit /usr/bin/php (which happens 
sometimes) you're doomed.

[snip]
good point.. modified to use BINDIR:

#!/usr/bin/php
?php
class trimshebang {
  function filter($in, $out, $consumed, $closing)
  {
while ($bucket = stream_bucket_make_writeable($in)) {
  $bucket-data = ltrim($bucket-data,#!.PHP_BINDIR./php\n);
  $consumed += $bucket-datalen;
  stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
  }
}

stream_filter_register(trim.shebang, trimshebang);
include php://filter/read=trim.shebang/resource=/path/to/include.php;
?


But it still is a nice example.


thanks :)

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



Re: [PHP] [NOT SOLVEDish] Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

Jochem Maas schreef:

...



indeed ... I tested it and it works on my server too. my code is no 
different

to yours with regard to the context of the problem. so what's going on.

I think (I know) I forgot to mention one tiny little detail.
the whole 'include' code occurs in a script that forks itself ...
the script forks itself a number of times and each child then performs
the include.

so I tested the fork issue with your script ... it still bloody works,
(see the for loop below) so it's something else ... I thought it might
be the difference between using ob_get_clean() and 
ob_get_contents()+ob_end_clean()

but that doesn't seem to be it either.

the worse thing is my script has just stopped outputting the shebang 
lines of
the included script(s) ... oh well ... the problem is solved, dunno how, 
dunno why,


situations like these I'd rather the problem didn't go away .. I prefer 
to know

wtf happened!


wtf happened was I was looking at the wrong output. I changed my code to
be as much like your test code as possible (to the point that I now
use a function to perform the buffering and 'include' and returning output) ... 

the output buffering is not working at all.

I've had enough - /dev/null meet script output, output meet /dev/null




test.php
#!/usr/bin/php
?php
echo arse\n;


for ($i = 0; $i  3; $i++) {
$pid  = pcntl_fork();
if ($pid == 0) {
echo Inc('testinc.php');
exit;
}
}



function  Inc($f)
{
ob_start();
@include($f);
$content = ob_get_contents();
ob_end_clean();
if (substr($content, 0, 2) == '#!')
{
$content = substr($content, strpos($content, \n)+1);
}
return $content;
}
/test.php

testinc.php
#!/usr/bin/php
?php
echo testinc\n;
/testinc.php

output
[EMAIL PROTECTED]:~$ ./test.php
arse
testinc
/output

-Stut





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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Nathan Rixham

Ford, Mike wrote:

On 28 February 2008 12:39, Nathan Rixham advised:



should it not use curlies?


No, they will be deprecated as of PHP6. (Square brackets used to be, but
have been undeprecated and are back in favour!)


$tmp = '';
$str = 'abcdef';
for ($i = strlen($str)-1; $i = 0; $i--) {
  $tmp.= $str{$i};
}
echo $tmp;


Cheers!

 --
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


cheers for the heads up on curlies Mike :)

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Christoph Boget
   should it not use curlies?
   No, they will be deprecated as of PHP6. (Square brackets used to be, but
   have been undeprecated and are back in favour!)
  cheers for the heads up on curlies Mike :)

Where can I read more information about this?

thnx,
Chris

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



Re: [PHP] What design patterns do you usually use?

2008-02-28 Thread tedd

At 8:57 AM +0100 2/28/08, Zoltán Németh wrote:

2008. 02. 27, szerda keltezéssel 14.02-kor tedd ezt írta:
  Just about all my code was reduced to functions

 and all functions were placed in files according
 theme. My main was probably less than 50 lines
 of code.


this is absolutely similar to a well-organized class structure, just
replace 'file' with 'class' :)


and


well, if classes are not convenient for you, then sure it would take
more time but only for the first time. after that, my experience is that
development time is less with classes


A rose by any other name.

Outside of being up on the current trend, I don't 
see much difference -- just new paint on an old 
thing. I've seen a couple of paint jobs over the 
years. What I haven't seen is something that I 
can't do with what I've got.


Classes only provide me with a different way to 
organize my code. Sure you can cite data hiding, 
inheritance, and polymorphism, but I didn't have 
problems that required those before -- so why 
should I worry about them now? (however, 
polymorphism is cool).


Yes, it's kind of neat to make a class with it's 
own variables and methods and set a level of 
abstraction that permits you to not care what is 
is used for, but I really do that with functions 
anyway.


From my perspective, increasing complexity doesn't always make things simpler.

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] Guidance

2008-02-28 Thread Zoltán Németh
2008. 02. 28, csütörtök keltezéssel 04.15-kor Timothy Asiedu ezt írta:
 Dear Sir/Madam,

   Please I would be grateful if you could remove my e-mail address: [EMAIL 
 PROTECTED] from the general Mailing List. 

   I look forward to having a favourable response from you. Thank you.

remove yourself. look at the bottom of this message.

greets,
Zoltán Németh



   Best regards,


   Timothy Asiedu.

   
 
 Stut [EMAIL PROTECTED] wrote:
   On 27 Feb 2008, at 21:50, Shawn McKenzie wrote:
  Shawn McKenzie wrote:
  Stut wrote:
  I've interviewed more than my fair share of web developers who
  couldn't reverse an array without using array_reverse if their life
  depended on it. Sometimes it really does scare me!
 
  So my experience is that there are far more web developers out there
  than software engineers who do web development, and it's getting 
  harder
  to find decent software engineers to do web-based work at a 
  reasonable
  price. The good ones are rare - so rare in fact that I'm having 
  trouble
  finding one at the moment. If anyone considers themselves a software
  engineer rather than a web developer and would like a job in Windsor
  drop me a note.
 
  Job! Now!
 
  foreach($array as $k = $v) {
  $reversed[$v] = $k;
  }
  $array = $reversed; //optional
  No wait!
 
 Yeah, nice try ;)
 
 Anyways, I assume you're based in the US somewhere so unless you're 
 considering emigrating to the UK you were never in the running.
 
 -Stut
 
 -- 
 http://stut.net/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

 -
 Never miss a thing.   Make Yahoo your homepage.

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



Re: [PHP] ZCE guidance needed

2008-02-28 Thread Ray Hauge

Nathan Nobbe wrote:

On Wed, Feb 27, 2008 at 10:31 PM, Shelley [EMAIL PROTECTED] wrote:


Greetings all,

Im just need some guidance of how to prepare for the ZCE exam.

Is there somebody passed the exam? Any help infor is highly appreciated.



i read the php architect book and paid for 5 of their sample tests.
http://www.phparch.com/c/books/id/0973862149
some of the questions on the test are really obscure, not really like
about the language as much as the set of functions that ship w/ it.
they try and trip you up, like asking very specific questions about
some of the functions and so forth.
good news is a low score still makes the passing grade ;)

-nathan



Same here.  I read the practice book and took the Vulcan training tests.

http://www.phparch.com/c/product/vulcan/view

My work paid for an online training that got me both of them for free, 
so I used them.  The hardest part for me was just setting a date and 
stop procrastinating.  The test was easier than I was expecting, though 
there were a few things that I didn't know on there.  The tests were my 
best training though.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] Flexible Shopping Cart (was: Shopping Carts)

2008-02-28 Thread tedd

At 12:14 AM -0200 2/28/08, Manuel Barros Reyes wrote:

The details are in that thread but basically what I am looking for is
a shopping cart that has flexibility with respect to the graphical
layout of elements and their appearance  as well as the ability to
extend the framework with custom functionalities.


Good luck. I haven't found any, yet.

All the shopping carts that I have seen make the mistake of allowing 
the developer to think he's proficient in css, when it's usually 
totally absent or horribly intermixed within html.


So in looking, ask how they incorporate css into their program. If 
they go Huh?, go somewhere else.


Actually, you can usually simplify that question by asking them if 
they use a font tag. If they do, then they're clueless.


Oh, when you find something, please let me know.

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] ZCE guidance needed

2008-02-28 Thread Ray Hauge

Nathan Nobbe wrote:

On Wed, Feb 27, 2008 at 10:31 PM, Shelley [EMAIL PROTECTED] wrote:


Greetings all,

Im just need some guidance of how to prepare for the ZCE exam.

Is there somebody passed the exam? Any help infor is highly appreciated.



i read the php architect book and paid for 5 of their sample tests.
http://www.phparch.com/c/books/id/0973862149
some of the questions on the test are really obscure, not really like
about the language as much as the set of functions that ship w/ it.
they try and trip you up, like asking very specific questions about
some of the functions and so forth.
good news is a low score still makes the passing grade ;)

-nathan



My SMTP server didn't like my login for a few minutes, so hopefully I 
don't double-post this.


I used the book and the Vulcan Training tests as well.  I think I got 
more out of the tests than the book, but that's just me.


There were a lot of odd functions in there.  I can't even remember the 
ones that I didn't even know existed.  There were also questions about 
how to configure PHP, so look at the php.ini options as well.


--
Ray Hauge
www.primateapplications.com

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



[PHP] auto-wrap on posts

2008-02-28 Thread Nathan Nobbe
all,

a fellow poster has been kind enough to bring to my attention how jacked
some of my posts appear.
i was manually formatting my posts, but it appears the list server must also
be doing some formatting as many of my posts come out all jacked up looking,
some with only a single word on a line.
ive now resolved to just keep on typing all the way to the end of a line in
the gmail editor, but then they look like crap in the editor; though ill do
it to save face for the public postings if i have to ;)
any body else encounter this ?

-nathan


Re: [PHP] Re: [SOLVEDish] Re: [PHP] output buffering in CLI script.

2008-02-28 Thread Jochem Maas

Nathan Rixham schreef:

how's this?

#!/usr/bin/php
?php
class trimshebang {
  function filter($in, $out, $consumed, $closing)
  {
while ($bucket = stream_bucket_make_writeable($in)) {
  $bucket-data = ltrim($bucket-data,#!/usr/bin/php\n);
  $consumed += $bucket-datalen;
  stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
  }
}

stream_filter_register(trim.shebang, trimshebang);
include php://filter/read=trim.shebang/resource=/path/to/include.php;
?

bit more graceful ;)


it's sick, I like it, nice example of streams filtering while your at it.
I learned something! it also works in so far that the shebang line is no longer
output but the output buffering in *my* script(s) doesn't work, whilst the same
construction does work in Stut's test scripts (although whilst playing with
his script I did manage to bork ik so that the output buffering *doesn't* work
there anymore ... how I did that I can't fathom)

anyway - they problem has been nicely shoved under the carpet. apart from
the shebang lines the script don't ever output anything anyway but rather
log to files ... a simple redirect output to /dev/null in the command line
that is used to run the 'master' script will take care of any spurious cruft
ending up on screen.

thanks to everyone for their input regarding my output! :-)





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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Jason Pruim


On Feb 28, 2008, at 10:06 AM, Nathan Nobbe wrote:


all,





a fellow poster has been kind enough to bring to my attention how  
jacked

some of my posts appear.
i was manually formatting my posts, but it appears the list server  
must also
be doing some formatting as many of my posts come out all jacked up  
looking,

some with only a single word on a line.
ive now resolved to just keep on typing all the way to the end of a  
line in
the gmail editor, but then they look like crap in the editor; though  
ill do

it to save face for the public postings if i have to ;)
any body else encounter this ?




Never had any issues with your posts looking bad... I have had some  
weird line wrappings with someone not on the list, he is using yahoo  
for his e-mail... I would have single words, and in some cases single  
letters on a line.. But I was also looking at it on my PDA... So that  
may have screwed some stuff up...


All-in-all your posts are good from my prospective. :)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Ray Hauge

Nathan Nobbe wrote:

all,

a fellow poster has been kind enough to bring to my attention how jacked
some of my posts appear.
i was manually formatting my posts, but it appears the list server must also
be doing some formatting as many of my posts come out all jacked up looking,
some with only a single word on a line.
ive now resolved to just keep on typing all the way to the end of a line in
the gmail editor, but then they look like crap in the editor; though ill do
it to save face for the public postings if i have to ;)
any body else encounter this ?

-nathan



I haven't noticed any issues with your posts either.

Since we're talking about post issues I'll include this.  I don't seem 
to receive my own emails.  Does the list not send them back to you?  I 
haven't been able to find anything yet.  I just like to see all the 
comments.


Is it the list, or is it Thunderbird/Gmail (I use IMAP forwarding).

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Nathan Rixham

Ray Hauge wrote:

Nathan Nobbe wrote:

all,

a fellow poster has been kind enough to bring to my attention how jacked
some of my posts appear.
i was manually formatting my posts, but it appears the list server 
must also
be doing some formatting as many of my posts come out all jacked up 
looking,

some with only a single word on a line.
ive now resolved to just keep on typing all the way to the end of a 
line in
the gmail editor, but then they look like crap in the editor; though 
ill do

it to save face for the public postings if i have to ;)
any body else encounter this ?

-nathan



I haven't noticed any issues with your posts either.

Since we're talking about post issues I'll include this.  I don't seem 
to receive my own emails.  Does the list not send them back to you?  I 
haven't been able to find anything yet.  I just like to see all the 
comments.


Is it the list, or is it Thunderbird/Gmail (I use IMAP forwarding).



No problems in thunderbird/gmail here, however I do use a gmail account, 
just don't use the gmail interface as I have the php lists added under 
newsgroups in thunderbird.


i think that sentence makes no sence - anyways regards!

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Nathan Nobbe
take a look here on the marc archives.
http://marc.info/?l=php-generalm=120415418217911w=2

there are several lines that have 1 word only in them, some of the words
(for reference) are access, good, patterns, nested.
when i wrote the post (looking in my gmail client) these words are not on
their own line..
does the post look as it does on marc in your mail clients or are the words
in sentences where they belong ?

thanks,

-nathan


Re: [PHP] reverse string without strrev();

2008-02-28 Thread Robert Cummings

On Thu, 2008-02-28 at 12:39 +, Nathan Rixham wrote:
 Aschwin Wesselius wrote:
  Stut wrote:
  Just because it works doesn't mean it's right.
 
  -Stut
 
  
  
  What I meant was that I tested the script and it worked, so I didn't 
  spot the flaw (wich is obvious and you were right).
  
  No big deal.
  
 
 should it not use curlies?
 
 $tmp = '';
 $str = 'abcdef';
 for ($i = strlen($str)-1; $i = 0; $i--) {
   $tmp.= $str{$i};
 }
 echo $tmp;
 
 
 here's the overkill way to do it:
 
 $str = 'abcdef';
 $rev = implode(array_flip(array_reverse(array_flip(str_split($str);
 echo $rev;
 
 *sniggers*

There's always a tradeoff between speed and memory. Here's the low
memory version:

?php

$str = '1234567';
str_reverse_in_place( $str );
echo 'Reversed: '.$str.\n;

function str_reverse_in_place( $str )
{
$a = 0;
$z = strlen( $str ) - 1;

while( $a  $z )
{
$t = $str[$a];
$str[$a] = $str[$z];
$str[$z] = $t;

++$a;
--$z;
}
}

?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread David Giragosian
On 2/28/08, Nathan Nobbe [EMAIL PROTECTED] wrote:
 take a look here on the marc archives.
 http://marc.info/?l=php-generalm=120415418217911w=2

 there are several lines that have 1 word only in them, some of the words
 (for reference) are access, good, patterns, nested.
 when i wrote the post (looking in my gmail client) these words are not on
 their own line..
 does the post look as it does on marc in your mail clients or are the words
 in sentences where they belong ?

 thanks,

 -nathan


Your emails come through to my gmail account as you first described,
Nathan, ie, sometimes with just one word on a line, and just like the
marc archives.

Ray, if I start a thread, I'm fairly sure the list sends the email back to me.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Aschwin Wesselius

Robert Cummings wrote:

There's always a tradeoff between speed and memory. Here's the low
memory version:

?php

$str = '1234567';
str_reverse_in_place( $str );
echo 'Reversed: '.$str.\n;

function str_reverse_in_place( $str )
{
$a = 0;
$z = strlen( $str ) - 1;

while( $a  $z )
{
$t = $str[$a];
$str[$a] = $str[$z];
$str[$z] = $t;

++$a;
--$z;
}
}

?
  


Sorry, Rob, that function doesn't return anything. ;-)



--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Nathan Nobbe
On Thu, Feb 28, 2008 at 10:35 AM, David Giragosian [EMAIL PROTECTED]
wrote:

 On 2/28/08, Nathan Nobbe [EMAIL PROTECTED] wrote:
  take a look here on the marc archives.
  http://marc.info/?l=php-generalm=120415418217911w=2
 
  there are several lines that have 1 word only in them, some of the words
  (for reference) are access, good, patterns, nested.
  when i wrote the post (looking in my gmail client) these words are not
 on
  their own line..
  does the post look as it does on marc in your mail clients or are the
 words
  in sentences where they belong ?
 
  thanks,
 
  -nathan
 

 Your emails come through to my gmail account as you first described,
 Nathan, ie, sometimes with just one word on a line, and just like the
 marc archives.


thanks, ill just have to be careful editing from gmail then..

Ray, if I start a thread, I'm fairly sure the list sends the email back to
 me.


i dont get an email back until someone replies.

-nathan


Re: [PHP] reverse string without strrev();

2008-02-28 Thread Aschwin Wesselius

Aschwin Wesselius wrote:

Sorry, Rob, that function doesn't return anything. ;-)



Bugger, it's getting late. Didn't see the .



--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Jason Pruim


On Feb 28, 2008, at 10:30 AM, Nathan Nobbe wrote:


take a look here on the marc archives.
http://marc.info/?l=php-generalm=120415418217911w=2

there are several lines that have 1 word only in them, some of the  
words

(for reference) are access, good, patterns, nested.
when i wrote the post (looking in my gmail client) these words are  
not on

their own line..
does the post look as it does on marc in your mail clients or are  
the words

in sentences where they belong ?



Okay, now after looking at the archives and comparing to my e-mail, it  
does sometimes have 1 word on the line... To me though it looks like  
somewhere along the pipe it's getting broken by line wrappings being  
limited to a certain number of characters...


Does the list do line wrapping before sending out?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Jason Pruim


On Feb 28, 2008, at 10:25 AM, Ray Hauge wrote:


Nathan Nobbe wrote:

all,
a fellow poster has been kind enough to bring to my attention how  
jacked

some of my posts appear.
i was manually formatting my posts, but it appears the list server  
must also
be doing some formatting as many of my posts come out all jacked up  
looking,

some with only a single word on a line.
ive now resolved to just keep on typing all the way to the end of a  
line in
the gmail editor, but then they look like crap in the editor;  
though ill do

it to save face for the public postings if i have to ;)
any body else encounter this ?
-nathan


I haven't noticed any issues with your posts either.

Since we're talking about post issues I'll include this.  I don't  
seem to receive my own emails.  Does the list not send them back to  
you?  I haven't been able to find anything yet.  I just like to see  
all the comments.



Hey Ray,

I get a copy of the messages sent to me. I think it's a setting when  
you signup that you can choose but I'm not positive.


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] php --ini and the like

2008-02-28 Thread Nathan Nobbe
On Thu, Feb 28, 2008 at 6:08 AM, Jochem Maas [EMAIL PROTECTED] wrote:

 was just cruising the manual and came accross a nice tidbit.

 from: http://nl.php.net/features.commandline

 Shows configuration file names and scanned directories. Available as of
 PHP 5.2.3.

 Example#3 --ini example

 $ php --ini
 Configuration File (php.ini) Path: /usr/dev/php/5.2/lib
 Loaded Configuration File: /usr/dev/php/5.2/lib/php.ini
 Scan for additional .ini files in: (none)
 Additional .ini files parsed:  (none)



this is really nice, because i often alias local configuration files for per
user modifications of php.ini on the cli.  similar to the .htaccess feature
for the webserver php.ini files.  but sometimes i forget if i have the file
aliased or not..  this provides a very convenient way to check.

thanks ;)

-nathan


Re: [PHP] reverse string without strrev();

2008-02-28 Thread Robert Cummings

On Thu, 2008-02-28 at 16:39 +0100, Aschwin Wesselius wrote:
 Aschwin Wesselius wrote:
  Sorry, Rob, that function doesn't return anything. ;-)
 
 
 Bugger, it's getting late. Didn't see the .

It wouldn't really be in place if it wasn't a reference. Since the
engine would immediately perform a copy on the first write to a passed
non reference string :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread David Giragosian
On 2/28/08, Jason Pruim [EMAIL PROTECTED] wrote:

 On Feb 28, 2008, at 10:25 AM, Ray Hauge wrote:

  Nathan Nobbe wrote:
  all,
  a fellow poster has been kind enough to bring to my attention how
  jacked
  some of my posts appear.
  i was manually formatting my posts, but it appears the list server
  must also
  be doing some formatting as many of my posts come out all jacked up
  looking,
  some with only a single word on a line.
  ive now resolved to just keep on typing all the way to the end of a
  line in
  the gmail editor, but then they look like crap in the editor;
  though ill do
  it to save face for the public postings if i have to ;)
  any body else encounter this ?
  -nathan
 
  I haven't noticed any issues with your posts either.
 
  Since we're talking about post issues I'll include this.  I don't
  seem to receive my own emails.  Does the list not send them back to
  you?  I haven't been able to find anything yet.  I just like to see
  all the comments.


 Hey Ray,

 I get a copy of the messages sent to me. I think it's a setting when
 you signup that you can choose but I'm not positive.



That rings a bell, Jason. I think you're right.

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Richard Heyes

Sorry, Rob, that function doesn't return anything. ;-)


It's not meant to:

?php

// ...

$str = '123';
str_reverse_in_place($str);

echo $str;
?

--
Richard Heyes
Employ me (!):
http://www.phpguru.org/cv

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Aschwin Wesselius

Robert Cummings wrote:

It wouldn't really be in place if it wasn't a reference. Since the
engine would immediately perform a copy on the first write to a passed
non reference string :)
  


Still to much to learn. Nice list to learn from thanks.

I just started to learn more and more about C syntax and solutions, 
where a lot of optimization and tradeoffs is made. Memory, speed, 
filesystem access etc.


I had to look twice before I understood what you did with the shuffle.

--
Aschwin Wesselius

social

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

/social

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



Re: [PHP] Getting the name of a function

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 5:06 AM, Jochem Maas [EMAIL PROTECTED] wrote:
 Daniel Brown schreef:
  On Wed, Feb 27, 2008 at 1:56 PM, Richard S. Crawford
   [EMAIL PROTECTED] wrote:
   [snip!]
I know that I could pass the name of the function as a parameter to the
error() function (e.g. error(bad_function,This is dumb)) but I'd 
 rather
keep it simpler than that.
  
Is there a way to do this?
  
   Not without a lower-level stack trace utility like xdebug, as far

  huh? what about debug_backtrace() ... contains plenty of info, including
  function names of everything in the stack. of course something like xdebug
  can take it to a whole new level.

You're right.  Forgot about that function.  :-\

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



RES: [PHP] auto-wrap on posts

2008-02-28 Thread Thiago Pojda
Only thing I've seen is my post formatting getting messed up after then
4th~5th line. I'm on outlook tho.

-Mensagem original-
De: Nathan Nobbe [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 28 de fevereiro de 2008 12:06
Para: PHP General list
Assunto: [PHP] auto-wrap on posts

all,

a fellow poster has been kind enough to bring to my attention how jacked
some of my posts appear.
i was manually formatting my posts, but it appears the list server must also
be doing some formatting as many of my posts come out all jacked up looking,
some with only a single word on a line.
ive now resolved to just keep on typing all the way to the end of a line in
the gmail editor, but then they look like crap in the editor; though ill do
it to save face for the public postings if i have to ;) any body else
encounter this ?

-nathan

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



RES: [PHP] ZCE guidance needed

2008-02-28 Thread Thiago Pojda
 

-Mensagem original-
De: Ray Hauge [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 28 de fevereiro de 2008 11:23
Para: Nathan Nobbe
Cc: Shelley; php-general@lists.php.net
Assunto: Re: [PHP] ZCE guidance needed

Same here.  I read the practice book and took the Vulcan training tests.

http://www.phparch.com/c/product/vulcan/view

My work paid for an online training that got me both of them for free, so I
used them.  The hardest part for me was just setting a date and stop
procrastinating.  The test was easier than I was expecting, though there
were a few things that I didn't know on there.  The tests were my best
training though.

---

I've been reading the ZCE FAQ and there says they will ask stuff about
regex. How much of regex do they ask about? I have to say I know very little
about this :)


-- 
Ray Hauge
www.primateapplications.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] Sometimes I wonder why I even started programming...

2008-02-28 Thread Philip Thompson

On Feb 27, 2008, at 4:51 PM, Jochem Maas wrote:


Jason Pruim schreef:
So I was supposed to go home a half hour ago but that didn't  
happen... I hate deadlines! :P


in my home language Pruim means prune ... you sound like you've had  
to suck on

one to many ;-)



Can someone tell me why this code works for setting the table name:


dunno. lets rewrite the thing shall we? let cutdown on variable  
usage, shorten some
names and use a verb rather than a noun to name the function ... and  
let's learn

about 'by reference' parameters (notice the '' before '$table')

function authenticate($user, $pass, $table)
{
// do you want to stop/catch 're-authentication'?
if ($_SESSION['loggedin'])
return;

// escape your data!
   $pass =  
mysql_real_escape_string(md5(someThingOnlyDanBrownCouldGuess. 
$pass));

$name = mysql_real_escape_string($user);

	// only select what you need (no semi-colons [needed] to delimit  
the query)
	// name + password should be unique! so no real need for the LIMIT  
clause
   $res  = mysql_query(SELECT tableName FROM current WHERE  
loginName='{$name}' AND loginPassword='{$pass}' LIMIT 0,1);


// I think a die() is overkill
	// rather an abrupt end to the script, such errors can be with more  
grace

if (!$res)
die(Wrong data supplied or database error  .mysql_error());

// nobody found - bad credentials, authentication failed
if (!mysql_numrows($res))
return false;

// grab data
$row = mysql_fetch_assoc($res);

// set session data
$_SESSION['user']   = $user;
   $_SESSION['loggedin'] 	= true; // use a BOOLEAN ... because  
NO equates to TRUE!


// no idea what this 'table name' is about but ...
// let's set the 'by reference' variable to the value we found
$table = $row['tableName'];

// user authenticated!
   return true;
}


which you would use like so:

$spoon = null;
if (authenticate(Jochem, MySecret, $spoon))
echo authenticated! table is set to $spoon;
else
echo authentication failed, there is no \$spoon;



I think the real question is... why are you using tabs instead of  
spaces? =D


~Philip

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 10:25 AM, Ray Hauge [EMAIL PROTECTED] wrote:
  Since we're talking about post issues I'll include this.  I don't seem
  to receive my own emails.  Does the list not send them back to you?  I
  haven't been able to find anything yet.  I just like to see all the
  comments.

It's intelligent design on Gmail's part.  If you send an email to
a list, Gmail filters the message sent back to you so that it doesn't
appear in your inbox until someone replies to the thread.  The
exception is if a bounce is received.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 11:13 AM, Thiago Pojda
[EMAIL PROTECTED] wrote:
  I'm on outlook tho.

That's your first mistake ;-P

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Daniel Brown
It should also be noted that Gmail has its own way of handling
line breaks, like it or not - at least via the web interface.

Write out a simple mail script with complete From: and
X-Mailer: headers.  You'll see at least the X-Mailer: line appear
in the message body.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Ray Hauge

Daniel Brown wrote:

On Thu, Feb 28, 2008 at 10:25 AM, Ray Hauge [EMAIL PROTECTED] wrote:

 Since we're talking about post issues I'll include this.  I don't seem
 to receive my own emails.  Does the list not send them back to you?  I
 haven't been able to find anything yet.  I just like to see all the
 comments.


It's intelligent design on Gmail's part.  If you send an email to
a list, Gmail filters the message sent back to you so that it doesn't
appear in your inbox until someone replies to the thread.  The
exception is if a bounce is received.



That makes complete sense.  GMail stores my sent message and if I was 
reading it on GMail I'd see my sent message.  I'll have to see if 
there's any way I can change that at the GMail level.


Thanks for the help.

--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread David Giragosian
On 2/28/08, Daniel Brown [EMAIL PROTECTED] wrote:
 On Thu, Feb 28, 2008 at 10:25 AM, Ray Hauge [EMAIL PROTECTED] wrote:
   Since we're talking about post issues I'll include this.  I don't seem
   to receive my own emails.  Does the list not send them back to you?  I
   haven't been able to find anything yet.  I just like to see all the
   comments.

It's intelligent design on Gmail's part.  If you send an email to
 a list, Gmail filters the message sent back to you so that it doesn't
 appear in your inbox until someone replies to the thread.  The
 exception is if a bounce is received.


Oh no, I sense another topic drift into religious waters... ;-)

-- 

-David.

When the power of love
overcomes the love of power,
the world will know peace.

-Jimi Hendrix

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



Re: [PHP] auto-wrap on posts

2008-02-28 Thread Eric Butera
On Thu, Feb 28, 2008 at 10:06 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 all,

  a fellow poster has been kind enough to bring to my attention how jacked
  some of my posts appear.
  i was manually formatting my posts, but it appears the list server must also
  be doing some formatting as many of my posts come out all jacked up looking,
  some with only a single word on a line.
  ive now resolved to just keep on typing all the way to the end of a line in
  the gmail editor, but then they look like crap in the editor; though ill do
  it to save face for the public postings if i have to ;)
  any body else encounter this ?

  -nathan


Confirmed.  I always thought you were pasting your emails into gmail
from something else.

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



Re: [PHP] ZCE guidance needed

2008-02-28 Thread Nathan Nobbe
On Thu, Feb 28, 2008 at 11:13 AM, Thiago Pojda 
[EMAIL PROTECTED] wrote:

 -Mensagem original-
 De: Ray Hauge [mailto:[EMAIL PROTECTED]
 Enviada em: quinta-feira, 28 de fevereiro de 2008 11:23
 Para: Nathan Nobbe
 Cc: Shelley; php-general@lists.php.net
 Assunto: Re: [PHP] ZCE guidance needed

 Same here.  I read the practice book and took the Vulcan training tests.

 http://www.phparch.com/c/product/vulcan/view

 My work paid for an online training that got me both of them for free, so
 I
 used them.  The hardest part for me was just setting a date and stop
 procrastinating.  The test was easier than I was expecting, though there
 were a few things that I didn't know on there.  The tests were my best
 training though.

 ---

 I've been reading the ZCE FAQ and there says they will ask stuff about
 regex. How much of regex do they ask about? I have to say I know very
 little
 about this :)


as far as i recall there wasnt a ton on it.
if you read through the study guide and take some of the sample tests you
should be in good shape.

-nathan


RES: [PHP] auto-wrap on posts

2008-02-28 Thread Thiago Pojda

-Mensagem original-
De: Daniel Brown [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 28 de fevereiro de 2008 13:14

On Thu, Feb 28, 2008 at 11:13 AM, Thiago Pojda
[EMAIL PROTECTED] wrote:
  I'm on outlook tho.

That's your first mistake ;-P
--

I have no choice, company policies ;)

--
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] reverse string without strrev();

2008-02-28 Thread Robin Vickery
On 28/02/2008, Robert Cummings [EMAIL PROTECTED] wrote:

  On Thu, 2008-02-28 at 12:39 +, Nathan Rixham wrote:
   Aschwin Wesselius wrote:
Stut wrote:
Just because it works doesn't mean it's right.
   
-Stut
   
   
   
What I meant was that I tested the script and it worked, so I didn't
spot the flaw (wich is obvious and you were right).
   
No big deal.
   
  
   should it not use curlies?
  
   $tmp = '';
   $str = 'abcdef';
   for ($i = strlen($str)-1; $i = 0; $i--) {
 $tmp.= $str{$i};
   }
   echo $tmp;
  
  
   here's the overkill way to do it:
  
   $str = 'abcdef';
   $rev = implode(array_flip(array_reverse(array_flip(str_split($str);
   echo $rev;
  
   *sniggers*


 There's always a tradeoff between speed and memory. Here's the low
  memory version:

  ?php

  $str = '1234567';
  str_reverse_in_place( $str );
  echo 'Reversed: '.$str.\n;

  function str_reverse_in_place( $str )
  {
 $a = 0;
 $z = strlen( $str ) - 1;

 while( $a  $z )
 {
 $t = $str[$a];
 $str[$a] = $str[$z];
 $str[$z] = $t;

 ++$a;
 --$z;
 }
  }

  ?


every byte counts :-)

function str_reverse_in_place( $str )
{
   $a = -1;
   $z = strlen($str);

   while( ++$a  --$z )
   {
   $str[$a] = $str[$a] ^ $str[$z];
   $str[$z] = $str[$a] ^ $str[$z];
   $str[$a] = $str[$a] ^ $str[$z];
   }
}

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Eric Butera
On Wed, Feb 27, 2008 at 5:12 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Wed, Feb 27, 2008 at 4:55 PM, Jason Pruim [EMAIL PROTECTED] wrote:
   So I was supposed to go home a half hour ago but that didn't happen...
I hate deadlines! :P

 You whine like a mule.

  [snip!]

  function authentication($user, $pass, $authenticated, $table){
  
   // Keep in mind, PASSWORD has meaning in MySQL
   // Do your string sanitizing here
   // (e.g. - $user = 
 mysql_real_escape_string($_POST['user']);)
   $salt = salt;
   $salt1 = $salt;
   $salt1 .= $pass;
  
   $password = md5($salt1);
   $loginQuery = SELECT * FROM current WHERE 
 loginName='.$user.'
AND loginPassword='.$password.' LIMIT 0,1;;
   $loginResult = mysql_query($loginQuery) or 
 die(Wrong data supplied
or database error  .mysql_error());
   while($row1 = mysql_fetch_array($loginResult)) {
   $_SESSION['user'] = $row1['loginName'];
   $_SESSION['loggedin'] = YES;
   $authenticated = true;
   $table = $row1['tableName'];
  
   }
   return $table;
   return $authenticated;
   }   \

 I recognize that code, Jason!  At least the base of it (and the
  comments).  ;-P

 See in the first block how you're using $_SESSION?  That's why
  you're able to read it later because you have two return $xxx
  lines in each function.

 As soon as a function reaches a `return` statement, it returns
  that data and exits, so the second `return` is never processed.

  --
  /Dan

  Daniel P. Brown
  Senior Unix Geek
  ? while(1) { $me = $mind--; sleep(86400); } ?



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



Guess all your posts stating to sanitize data just really don't have
an impact, huh?  Perhaps you should stop posting code that doesn't
validate/escape as it will be copied and pasted as I've told you
before.

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



Re: [PHP] Guidance

2008-02-28 Thread Andrew Ballard
On Thu, Feb 28, 2008 at 7:32 AM, Jochem Maas [EMAIL PROTECTED] wrote:
 Stut schreef:

  On 28 Feb 2008, at 12:15, Timothy Asiedu wrote:
   Please I would be grateful if you could remove my e-mail address:
   [EMAIL PROTECTED] from the general Mailing List.
  
   Unsubscribe instructions are in the footer of every email you receive
   from this list. Follow them to get your favourable response.

  lol ... who gave him a ieee.org address in the first place :-)


Considering his message came from a Yahoo address?

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



[PHP] Hot job opportunity - Sr. Software Developer/Architect

2008-02-28 Thread Nick Gasparro
Hello Group!

 

I have an immediate need for a Sr. Developer/Architect; with one of Denver's
Best employers.  They are a Web 2.0 company, rapidly growing and very
profitable.  They will pay top compensation and provide relocation
assistance for the right person.  

 

Here is what they are looking for:

 

The individual will lead the architecture and implementation for our web
delivered applications. Implementing industry best practices, leading a team
of developers and mentoring other developers will also be important aspects
of this role. You must be familiar with design patterns and be able to write
classes that adhere to standard OOP methodologies. Some experience with
Agile software development practices is a must.

Required Experience:

*   OOP Development and Architecture
*   Test Driven Development and Unit Testing
*   Java, C++, PHP or other Object Oriented languages
*   Experience in the Web Development industry
*   Experience in Telecom, Desktop Software, or other development
industries other than Web
*   Understanding of Design Patterns, especially MVC
*   Agile software development practices
*   SQL
*   Linux
*   HTML
*   Version Control

Desirable Skills:

*   PHP
*   CSS
*   Javascript
*   XML
*   UML
*   MySQL
*   Apache
*   Web Services (XML-RPC, SOAP, etc...)
*   AJAX
*   Actionscript
*   Flash
*   Flex

 

Please send me a copy of your resume in MS word format if you are
interested.

 

Nick Gasparro

Managing Partner, REMY Corp.

1637 Wazee Street

Denver, CO 80202

303-539-0448 Direct

303-547-7469 Cell

[EMAIL PROTECTED] 

www.remycorp.com

 



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Jason Pruim


On Feb 28, 2008, at 11:11 AM, Philip Thompson wrote:


On Feb 27, 2008, at 4:51 PM, Jochem Maas wrote:


Jason Pruim schreef:
So I was supposed to go home a half hour ago but that didn't  
happen... I hate deadlines! :P


in my home language Pruim means prune ... you sound like you've had  
to suck on

one to many ;-)



Can someone tell me why this code works for setting the table name:


dunno. lets rewrite the thing shall we? let cutdown on variable  
usage, shorten some
names and use a verb rather than a noun to name the function ...  
and let's learn

about 'by reference' parameters (notice the '' before '$table')

function authenticate($user, $pass, $table)
{
// do you want to stop/catch 're-authentication'?
if ($_SESSION['loggedin'])
return;

// escape your data!
  $pass =  
mysql_real_escape_string(md5(someThingOnlyDanBrownCouldGuess. 
$pass));

$name = mysql_real_escape_string($user);

	// only select what you need (no semi-colons [needed] to delimit  
the query)
	// name + password should be unique! so no real need for the LIMIT  
clause
  $res  = mysql_query(SELECT tableName FROM current WHERE  
loginName='{$name}' AND loginPassword='{$pass}' LIMIT 0,1);


// I think a die() is overkill
	// rather an abrupt end to the script, such errors can be with  
more grace

if (!$res)
die(Wrong data supplied or database error  .mysql_error());

// nobody found - bad credentials, authentication failed
if (!mysql_numrows($res))
return false;

// grab data
$row = mysql_fetch_assoc($res);

// set session data
$_SESSION['user']   = $user;
  $_SESSION['loggedin'] 	= true; // use a BOOLEAN ... because  
NO equates to TRUE!


// no idea what this 'table name' is about but ...
// let's set the 'by reference' variable to the value we found
$table = $row['tableName'];

// user authenticated!
  return true;
}


which you would use like so:

$spoon = null;
if (authenticate(Jochem, MySecret, $spoon))
echo authenticated! table is set to $spoon;
else
echo authentication failed, there is no \$spoon;



I think the real question is... why are you using tabs instead of  
spaces? =D


~Philip


My editor automatically replaces like 4 spaces with a tab... Is there  
a reason not to use tabs instead of spaces? :)






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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Jason Pruim


On Feb 28, 2008, at 11:28 AM, Eric Butera wrote:

On Wed, Feb 27, 2008 at 5:12 PM, Daniel Brown [EMAIL PROTECTED]  
wrote:
On Wed, Feb 27, 2008 at 4:55 PM, Jason Pruim [EMAIL PROTECTED]  
wrote:
So I was supposed to go home a half hour ago but that didn't  
happen...

I hate deadlines! :P


   You whine like a mule.

[snip!]

   function authentication($user, $pass, $authenticated,  
$table){


   // Keep in mind, PASSWORD has meaning in  
MySQL

   // Do your string sanitizing here
   // (e.g. - $user =  
mysql_real_escape_string($_POST['user']);)

   $salt = salt;
   $salt1 = $salt;
   $salt1 .= $pass;

   $password = md5($salt1);
   $loginQuery = SELECT * FROM current WHERE  
loginName='.$user.'

AND loginPassword='.$password.' LIMIT 0,1;;
   $loginResult = mysql_query($loginQuery) or  
die(Wrong data supplied

or database error  .mysql_error());
   while($row1 =  
mysql_fetch_array($loginResult)) {
   $_SESSION['user'] =  
$row1['loginName'];

   $_SESSION['loggedin'] = YES;
   $authenticated = true;
   $table = $row1['tableName'];

   }
   return $table;
   return $authenticated;
   }   \


   I recognize that code, Jason!  At least the base of it (and the
comments).  ;-P

   See in the first block how you're using $_SESSION?  That's why
you're able to read it later because you have two return $xxx
lines in each function.

   As soon as a function reaches a `return` statement, it returns
that data and exits, so the second `return` is never processed.

--
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?



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




Guess all your posts stating to sanitize data just really don't have
an impact, huh?  Perhaps you should stop posting code that doesn't
validate/escape as it will be copied and pasted as I've told you
before.


The code for escaping and sanitizing the input is in a different  
module of the program. I actually do it right before sending it to my  
authentication function.  I didn't see the need to post it since it  
wasn't related to the problem :)


And the comments were from Mr. Brown who gave me the code originally  
that has now been adapted to use in a different program :)






--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



[PHP] Re: Hot job opportunity - Sr. Software Developer/Architect

2008-02-28 Thread Nathan Rixham

Nick Gasparro wrote:

Hello Group!

 


I have an immediate need for a Sr. Developer/Architect; with one of Denver's
Best employers.  They are a Web 2.0 company, rapidly growing and very
profitable.  They will pay top compensation and provide relocation
assistance for the right person.  

 


Here is what they are looking for:

 


The individual will lead the architecture and implementation for our web
delivered applications. Implementing industry best practices, leading a team
of developers and mentoring other developers will also be important aspects
of this role. You must be familiar with design patterns and be able to write
classes that adhere to standard OOP methodologies. Some experience with
Agile software development practices is a must.

Required Experience:

*   OOP Development and Architecture
*   Test Driven Development and Unit Testing
*   Java, C++, PHP or other Object Oriented languages
*   Experience in the Web Development industry
*   Experience in Telecom, Desktop Software, or other development
industries other than Web
*   Understanding of Design Patterns, especially MVC
*   Agile software development practices
*   SQL
*   Linux
*   HTML
*   Version Control

Desirable Skills:

*   PHP
*   CSS
*   Javascript
*   XML
*   UML
*   MySQL
*   Apache
*   Web Services (XML-RPC, SOAP, etc...)
*   AJAX
*   Actionscript
*   Flash
*   Flex

 


Please send me a copy of your resume in MS word format if you are
interested.

 


Nick Gasparro

Managing Partner, REMY Corp.

1637 Wazee Street

Denver, CO 80202

303-539-0448 Direct

303-547-7469 Cell

[EMAIL PROTECTED] 


www.remycorp.com

 





throw in a $350k relocation package, flexible working hours, full 
travelling expenses, double pay for working during working hours, triple 
pay for working during working hours and onsite, quadruple pay for 
working onsite, during working hours and doing the work I'm supposed to.
Further requirements include, company car, laptop, server, desktop, tv, 
2x32 displays per room, a T1 connection, 3 juniors to do my work and a 
new mousemat everyday. Relocation of the office to where-ever I decide 
to relocate too. A 50% stake-hold in the company* and finally an IBM 101 
keyboard.


*named google inc

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 11:28 AM, Eric Butera [EMAIL PROTECTED] wrote:
  Guess all your posts stating to sanitize data just really don't have
  an impact, huh?  Perhaps you should stop posting code that doesn't
  validate/escape as it will be copied and pasted as I've told you
  before.

I'm not really 100% certain who you think you are, Eric, but I'd
appreciate it if you'd keep some of your sanctimonious and
apparently-all-wise comments on your 127.0.0.1.

That is all.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Re: Hot job opportunity - Sr. Software Developer/Architect

2008-02-28 Thread Nathan Nobbe
On Thu, Feb 28, 2008 at 11:56 AM, Nathan Rixham [EMAIL PROTECTED] wrote:

 throw in a $350k relocation package, flexible working hours, full
 travelling expenses, double pay for working during working hours, triple
 pay for working during working hours and onsite, quadruple pay for
 working onsite, during working hours and doing the work I'm supposed to.
 Further requirements include, company car, laptop, server, desktop, tv,
 2x32 displays per room, a T1 connection, 3 juniors to do my work and a
 new mousemat everyday. Relocation of the office to where-ever I decide
 to relocate too. A 50% stake-hold in the company* and finally an IBM 101
 keyboard.

 *named google inc


i dont know what youre getting at here nathan, but nick is solid and so is
the offer.
trust me ;)

-nathan


Re: [PHP] Re: Hot job opportunity - Sr. Software Developer/Architect

2008-02-28 Thread Nathan Rixham

Nathan Nobbe wrote:

On Thu, Feb 28, 2008 at 11:56 AM, Nathan Rixham [EMAIL PROTECTED] wrote:


throw in a $350k relocation package, flexible working hours, full
travelling expenses, double pay for working during working hours, triple
pay for working during working hours and onsite, quadruple pay for
working onsite, during working hours and doing the work I'm supposed to.
Further requirements include, company car, laptop, server, desktop, tv,
2x32 displays per room, a T1 connection, 3 juniors to do my work and a
new mousemat everyday. Relocation of the office to where-ever I decide
to relocate too. A 50% stake-hold in the company* and finally an IBM 101
keyboard.

*named google inc



i dont know what youre getting at here nathan, but nick is solid and so is
the offer.
trust me ;)

-nathan



yeah but I'm in scotland, uk and it's that 5pm time of day where posts 
like that seem to appear from nowhere.


anyways s I'm busy reading eric vs dan in the other thread lol

:D happy thursday to ya fellow nathan

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



Re: [PHP] Re: Hot job opportunity - Sr. Software Developer/Architect

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 11:56 AM, Nathan Rixham [EMAIL PROTECTED] wrote:
  throw in a $350k relocation package, flexible working hours, full
  travelling expenses, double pay for working during working hours, triple
  pay for working during working hours and onsite, quadruple pay for
  working onsite, during working hours and doing the work I'm supposed to.
  Further requirements include, company car, laptop, server, desktop, tv,
  2x32 displays per room, a T1 connection, 3 juniors to do my work and a
  new mousemat everyday. Relocation of the office to where-ever I decide
  to relocate too. A 50% stake-hold in the company* and finally an IBM 101
  keyboard.

I didn't think the original on the Zend-Engine-CVS list was such a
bad post.  It's brief, direct, to-the-point, and sounds like an
interesting proposition.  However, I'd be inclined to drop everything
and walk out the door the same second, leaving everything I own behind
if an offer like the one you just joked about popped up.

  *named google inc

Especially this part.  ;-P

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Eric Butera
On Thu, Feb 28, 2008 at 11:59 AM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Thu, Feb 28, 2008 at 11:28 AM, Eric Butera [EMAIL PROTECTED] wrote:
Guess all your posts stating to sanitize data just really don't have
an impact, huh?  Perhaps you should stop posting code that doesn't
validate/escape as it will be copied and pasted as I've told you
before.

 I'm not really 100% certain who you think you are, Eric, but I'd
  appreciate it if you'd keep some of your sanctimonious and
  apparently-all-wise comments on your 127.0.0.1.

 That is all.

  --


 /Dan

  Daniel P. Brown
  Senior Unix Geek
  ? while(1) { $me = $mind--; sleep(86400); } ?


And I'd appreciate it if you kept all your posts about wearing dresses
to yourself but it isn't going to happen. :)

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 12:36 PM, Eric Butera [EMAIL PROTECTED] wrote:
 And I'd appreciate it if you kept all your posts about wearing dresses
 to yourself but it isn't going to happen. :)

Heh.  It is a bad visual, isn't it?  ;-P

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Eric Butera
On Thu, Feb 28, 2008 at 11:57 AM, Jason Pruim [EMAIL PROTECTED] wrote:


  On Feb 28, 2008, at 11:28 AM, Eric Butera wrote:

   On Wed, Feb 27, 2008 at 5:12 PM, Daniel Brown [EMAIL PROTECTED]
   wrote:
   On Wed, Feb 27, 2008 at 4:55 PM, Jason Pruim [EMAIL PROTECTED]
   wrote:
   So I was supposed to go home a half hour ago but that didn't
   happen...
   I hate deadlines! :P
  
  You whine like a mule.
  
   [snip!]
  
  function authentication($user, $pass, $authenticated,
   $table){
  
  // Keep in mind, PASSWORD has meaning in
   MySQL
  // Do your string sanitizing here
  // (e.g. - $user =
   mysql_real_escape_string($_POST['user']);)
  $salt = salt;
  $salt1 = $salt;
  $salt1 .= $pass;
  
  $password = md5($salt1);
  $loginQuery = SELECT * FROM current WHERE
   loginName='.$user.'
   AND loginPassword='.$password.' LIMIT 0,1;;
  $loginResult = mysql_query($loginQuery) or
   die(Wrong data supplied
   or database error  .mysql_error());
  while($row1 =
   mysql_fetch_array($loginResult)) {
  $_SESSION['user'] =
   $row1['loginName'];
  $_SESSION['loggedin'] = YES;
  $authenticated = true;
  $table = $row1['tableName'];
  
  }
  return $table;
  return $authenticated;
  }   \
  
  I recognize that code, Jason!  At least the base of it (and the
   comments).  ;-P
  
  See in the first block how you're using $_SESSION?  That's why
   you're able to read it later because you have two return $xxx
   lines in each function.
  
  As soon as a function reaches a `return` statement, it returns
   that data and exits, so the second `return` is never processed.
  
   --
   /Dan
  
   Daniel P. Brown
   Senior Unix Geek
   ? while(1) { $me = $mind--; sleep(86400); } ?
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
   Guess all your posts stating to sanitize data just really don't have
   an impact, huh?  Perhaps you should stop posting code that doesn't
   validate/escape as it will be copied and pasted as I've told you
   before.

  The code for escaping and sanitizing the input is in a different
  module of the program. I actually do it right before sending it to my
  authentication function.  I didn't see the need to post it since it
  wasn't related to the problem :)

  And the comments were from Mr. Brown who gave me the code originally
  that has now been adapted to use in a different program :)


 



  --

  Jason Pruim
  Raoset Inc.
  Technology Manager
  MQC Specialist
  3251 132nd ave
  Holland, MI, 49424-9337
  www.raoset.com
  [EMAIL PROTECTED]





Your escaping should be right before you run the query, not somewhere
else.  What if you change something around and take off the escaping
function?  Or what if you decide to change your database connection?
Having it all in one spot makes it easier to make changes and know it
isn't going to bust.

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



Re: [PHP] reverse string without strrev();

2008-02-28 Thread Robert Cummings

On Thu, 2008-02-28 at 16:26 +, Robin Vickery wrote:
 On 28/02/2008, Robert Cummings [EMAIL PROTECTED] wrote:
 
  There's always a tradeoff between speed and memory. Here's the low
   memory version:
 
   ?php
 
   $str = '1234567';
   str_reverse_in_place( $str );
   echo 'Reversed: '.$str.\n;
 
   function str_reverse_in_place( $str )
   {
  $a = 0;
  $z = strlen( $str ) - 1;
 
  while( $a  $z )
  {
  $t = $str[$a];
  $str[$a] = $str[$z];
  $str[$z] = $t;
 
  ++$a;
  --$z;
  }
   }
 
   ?
 
 
 every byte counts :-)
 
 function str_reverse_in_place( $str )
 {
$a = -1;
$z = strlen($str);
 
while( ++$a  --$z )
{
$str[$a] = $str[$a] ^ $str[$z];
$str[$z] = $str[$a] ^ $str[$z];
$str[$a] = $str[$a] ^ $str[$z];
}
 }
 

Nicely done.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: Hot job opportunity - Sr. Software Developer/Architect

2008-02-28 Thread Robert Cummings

On Thu, 2008-02-28 at 12:09 -0500, Daniel Brown wrote:
 On Thu, Feb 28, 2008 at 11:56 AM, Nathan Rixham [EMAIL PROTECTED] wrote:
   throw in a $350k relocation package, flexible working hours, full
   travelling expenses, double pay for working during working hours, triple
   pay for working during working hours and onsite, quadruple pay for
   working onsite, during working hours and doing the work I'm supposed to.
   Further requirements include, company car, laptop, server, desktop, tv,
   2x32 displays per room, a T1 connection, 3 juniors to do my work and a
   new mousemat everyday. Relocation of the office to where-ever I decide
   to relocate too. A 50% stake-hold in the company* and finally an IBM 101
   keyboard.
 
 I didn't think the original on the Zend-Engine-CVS list was such a
 bad post.  It's brief, direct, to-the-point, and sounds like an
 interesting proposition.  However, I'd be inclined to drop everything
 and walk out the door the same second, leaving everything I own behind
 if an offer like the one you just joked about popped up.

I'd have to agree the offer looks pretty solid. It's rare to see
relocation assistance in an offer on this list. They also didn't say
anything about having to be a U.S. resident... although that might have
been an oversight :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Jason Pruim


On Feb 28, 2008, at 12:39 PM, Eric Butera wrote:

On Thu, Feb 28, 2008 at 11:57 AM, Jason Pruim [EMAIL PROTECTED]  
wrote:



On Feb 28, 2008, at 11:28 AM, Eric Butera wrote:


On Wed, Feb 27, 2008 at 5:12 PM, Daniel Brown [EMAIL PROTECTED]
wrote:

On Wed, Feb 27, 2008 at 4:55 PM, Jason Pruim [EMAIL PROTECTED]
wrote:

So I was supposed to go home a half hour ago but that didn't
happen...
I hate deadlines! :P


  You whine like a mule.

[snip!]


  function authentication($user, $pass, $authenticated,
$table){

  // Keep in mind, PASSWORD has meaning in
MySQL
  // Do your string sanitizing here
  // (e.g. - $user =
mysql_real_escape_string($_POST['user']);)
  $salt = salt;
  $salt1 = $salt;
  $salt1 .= $pass;

  $password = md5($salt1);
  $loginQuery = SELECT * FROM current WHERE
loginName='.$user.'
AND loginPassword='.$password.' LIMIT 0,1;;
  $loginResult = mysql_query($loginQuery) or
die(Wrong data supplied
or database error  .mysql_error());
  while($row1 =
mysql_fetch_array($loginResult)) {
  $_SESSION['user'] =
$row1['loginName'];
  $_SESSION['loggedin'] = YES;
  $authenticated = true;
  $table = $row1['tableName'];

  }
  return $table;
  return $authenticated;
  }   \


  I recognize that code, Jason!  At least the base of it (and the
comments).  ;-P

  See in the first block how you're using $_SESSION?  That's why
you're able to read it later because you have two return $xxx
lines in each function.

  As soon as a function reaches a `return` statement, it returns
that data and exits, so the second `return` is never processed.

--
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?



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




Guess all your posts stating to sanitize data just really don't have
an impact, huh?  Perhaps you should stop posting code that doesn't
validate/escape as it will be copied and pasted as I've told you
before.


The code for escaping and sanitizing the input is in a different
module of the program. I actually do it right before sending it to my
authentication function.  I didn't see the need to post it since it
wasn't related to the problem :)

And the comments were from Mr. Brown who gave me the code originally
that has now been adapted to use in a different program :)








--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]






Your escaping should be right before you run the query, not somewhere
else.  What if you change something around and take off the escaping
function?  Or what if you decide to change your database connection?
Having it all in one spot makes it easier to make changes and know it
isn't going to bust.



It's actually just before I call the function... The database  
connection is in a completely separate function from everything that  
we have been talking about... And all that's in that file is:


$link= false;
function dbmysqlconnect($server, $username, $password, $database) {
		$link = mysql_connect($server, $username, $password, $database) or  
die('Could not connect: ' . mysql_error());
		mysql_select_db($database) or die('Could not select database: ' .  
mysql_error());

return $link;
}


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Eric Butera
On Thu, Feb 28, 2008 at 12:38 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Thu, Feb 28, 2008 at 12:36 PM, Eric Butera [EMAIL PROTECTED] wrote:
   And I'd appreciate it if you kept all your posts about wearing dresses
   to yourself but it isn't going to happen. :)

 Heh.  It is a bad visual, isn't it?  ;-P

  --


 /Dan

  Daniel P. Brown
  Senior Unix Geek
  ? while(1) { $me = $mind--; sleep(86400); } ?


All my point is that I've been on this list for a while.  I've posted
code and watched people just copy and paste it.  I've watched other
people copy and paste their examples.  I used to say sanitize your
data and watch the same exact thing in their new function coming back
at me without any sanity checks whatsoever.

So my point is that people don't know how to do it.  If you decide to
help people out with their issues you need to also help them
understand how to filter/escape their data.  Otherwise keep in mind
those people are going to copy your code with the comment saying
sanitize it, and it isn't going to be escaped.  Maybe that is okay
with you but I see that as a problem.  I know Jason said he is doing
it elsewhere, but that is the rare case.

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 12:57 PM, Eric Butera [EMAIL PROTECTED] wrote:
  All my point is that I've been on this list for a while.  I've posted
  code and watched people just copy and paste it.  I've watched other
  people copy and paste their examples.  I used to say sanitize your
  data and watch the same exact thing in their new function coming back
  at me without any sanity checks whatsoever.

Right, but my point is that the rules and spirit of the list
apply: we're not going to hold your hand and write your code for you.
If you want to be smart enough to put together a PHP page, you should
be smart enough to at least ask *how* to sanitize the code.  I'm not
deliberately setting people up for failure, I'm taking into account
that - while it's not as common as it should be - the poster has
common sense.  Quite honestly, we all learned the hard way, I'm sure.
It's what makes us better programmers: experience.  If I had asked for
people to write things for me and blindly installed them and ran the
code, I'd never have learned anything.  Plus, if you provide
immaculate code, you're potentially taking a chunk of time out of your
day, without pay, so that someone else can potentially (and I'd hazard
a guess at likely) make a few bucks on your work.

  So my point is that people don't know how to do it.  If you decide to
  help people out with their issues you need to also help them
  understand how to filter/escape their data.  Otherwise keep in mind
  those people are going to copy your code with the comment saying
  sanitize it, and it isn't going to be escaped.  Maybe that is okay
  with you but I see that as a problem.  I know Jason said he is doing
  it elsewhere, but that is the rare case.

I agree completely and that's what I do.  If I tell someone
that they have to sanitize their code, then I've done my job in that
respect.  There is absolutely no reason whatsoever that I should feel
forced or even compelled to take an additional five minutes for a
one-minute post to explain that they should use
mysql_real_escape_string(), run an arrayed regexp for filtration,
and/or escape all single, double, and backtick quotes.  When they read
my sanitize input string and ask about it, then I'm more than happy
to help, but presuming someone doesn't know how and writing a
dissertation on input sanity - while it is the safe road - is
redundant and potentially insulting to the person.  Especially if it's
someone who's been on the list for a while (as is generally the case
anyway).

Summarizing, I'm not disagreeing by any means that you do have a
valid point; contrarily, I'm absolutely concurring.  I'm just stating
that it's not entirely applicable to the posts to which you refer.
There is a time and a place to presume at least a small piece of
intelligence on behalf of the poster.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Flexible Shopping Cart (was: Shopping Carts)

2008-02-28 Thread Eric Butera
On Thu, Feb 28, 2008 at 9:26 AM, tedd [EMAIL PROTECTED] wrote:
 At 12:14 AM -0200 2/28/08, Manuel Barros Reyes wrote:
  The details are in that thread but basically what I am looking for is
  a shopping cart that has flexibility with respect to the graphical
  layout of elements and their appearance  as well as the ability to
  extend the framework with custom functionalities.

  Good luck. I haven't found any, yet.

  All the shopping carts that I have seen make the mistake of allowing
  the developer to think he's proficient in css, when it's usually
  totally absent or horribly intermixed within html.

  So in looking, ask how they incorporate css into their program. If
  they go Huh?, go somewhere else.

  Actually, you can usually simplify that question by asking them if
  they use a font tag. If they do, then they're clueless.

  Oh, when you find something, please let me know.

  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



Magento is designed with css.  But I know right now that you won't like it. ;)

Here is an example page:
http://svn.magentocommerce.com/source/branches/beta-0.8/app/design/frontend/default/default/template/catalog/product/list.phtml

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Andrew Ballard
On Thu, Feb 28, 2008 at 12:56 PM, Jason Pruim [EMAIL PROTECTED] wrote:


  On Feb 28, 2008, at 12:39 PM, Eric Butera wrote:

   On Thu, Feb 28, 2008 at 11:57 AM, Jason Pruim [EMAIL PROTECTED]
   wrote:
  
  
   On Feb 28, 2008, at 11:28 AM, Eric Butera wrote:
  
   On Wed, Feb 27, 2008 at 5:12 PM, Daniel Brown [EMAIL PROTECTED]
   wrote:
   On Wed, Feb 27, 2008 at 4:55 PM, Jason Pruim [EMAIL PROTECTED]
   wrote:
  
 function authentication($user, $pass, $authenticated,
   $table){
  
 // Keep in mind, PASSWORD has meaning in
   MySQL
 // Do your string sanitizing here
 // (e.g. - $user =
   mysql_real_escape_string($_POST['user']);)
 $salt = salt;
 $salt1 = $salt;
 $salt1 .= $pass;
  
 $password = md5($salt1);
 $loginQuery = SELECT * FROM current WHERE
   loginName='.$user.'
   AND loginPassword='.$password.' LIMIT 0,1;;
 $loginResult = mysql_query($loginQuery) or
   die(Wrong data supplied
   or database error  .mysql_error());
 while($row1 =
   mysql_fetch_array($loginResult)) {
 $_SESSION['user'] =
   $row1['loginName'];
 $_SESSION['loggedin'] = YES;
 $authenticated = true;
 $table = $row1['tableName'];
  
 }
 return $table;
 return $authenticated;
 }   \
  
  
   Guess all your posts stating to sanitize data just really don't have
   an impact, huh?  Perhaps you should stop posting code that doesn't
   validate/escape as it will be copied and pasted as I've told you
   before.
  
   The code for escaping and sanitizing the input is in a different
   module of the program. I actually do it right before sending it to my
   authentication function.  I didn't see the need to post it since it
   wasn't related to the problem :)
  
   And the comments were from Mr. Brown who gave me the code originally
   that has now been adapted to use in a different program :)
  
  
   Your escaping should be right before you run the query, not somewhere
   else.  What if you change something around and take off the escaping
   function?  Or what if you decide to change your database connection?
   Having it all in one spot makes it easier to make changes and know it
   isn't going to bust.


  It's actually just before I call the function... The database
  connection is in a completely separate function from everything that
  we have been talking about... And all that's in that file is:

 $link= false;
 function dbmysqlconnect($server, $username, $password, $database) {
 $link = mysql_connect($server, $username, $password, 
 $database) or
  die('Could not connect: ' . mysql_error());
 mysql_select_db($database) or die('Could not select database: 
 ' .
  mysql_error());
 return $link;

 }



Jason,

Keep in mind that data validation and escaping are two different
concepts. Data validation should happen as soon as you read the value
from the user to make sure that user names are long enough/not too
long, phone numbers or e-mail addresses contain only valid characters,
etc. That part should definitely be happening outside your function.

However, escaping should really only happen at the point it is needed,
and Dan's comments suggest a very good place for this to happen. (I
often put it even later - directly at the point it gets merged into
the string either through concatenation or through a function like
sprintf.) This is because the escape sequences are not part of the
actual data. Your application may need to use any of several different
character escaping functions (or no escaping at all) on the same value
depending on whether that value is going to a browser, a database, a
socket, an LDAP query, etc. This prevents you from having to write
lines like this:

$user = mysql_real_escape_string(stripslashes($user));

or this:

echo htmlspecialchars(stripslashes($my_text));

(This is one reason magic_quotes is such a Bad Idea[tm].)


[BTW - Who trademarked all these phrases on this list anyway? :-)]

What you have done may work and be quite safe. However, Eric pointed
out some very good reasons to keep the character escaping inside this
function.

Andrew

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



Re: [PHP] Flexible Shopping Cart (was: Shopping Carts)

2008-02-28 Thread Daniel Brown
On Thu, Feb 28, 2008 at 1:26 PM, Eric Butera [EMAIL PROTECTED] wrote:
  Magento is designed with css.  But I know right now that you won't like it. 
 ;)

Because their server doesn't have PHP configured properly?  ;-P

  Here is an example page:
  
 http://svn.magentocommerce.com/source/branches/beta-0.8/app/design/frontend/default/default/template/catalog/product/list.phtml

All I see is the PHP source.  Beginning with:

?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [EMAIL PROTECTED] so we can send you a copy immediately.
 *
 * @category   design_default
 * @packageMage
 * @copyright  Copyright (c) 2004-2007 Irubin Consulting Inc. DBA
Varien (http://www.varien.com)
 * @licensehttp://opensource.org/licenses/osl-3.0.php  Open
Software License (OSL 3.0)
 */
?
?
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?
?$_productCollection=$this-getLoadedProductCollection()?
?if(!$_productCollection-getSize()):?
div class=note-msg
?=$this-__('There are no products matching the selection.')?
/div


-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



Re: [PHP] Flexible Shopping Cart (was: Shopping Carts)

2008-02-28 Thread Eric Butera
On Thu, Feb 28, 2008 at 1:32 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Thu, Feb 28, 2008 at 1:26 PM, Eric Butera [EMAIL PROTECTED] wrote:
Magento is designed with css.  But I know right now that you won't like 
 it. ;)

 Because their server doesn't have PHP configured properly?  ;-P


Here is an example page:

 http://svn.magentocommerce.com/source/branches/beta-0.8/app/design/frontend/default/default/template/catalog/product/list.phtml

 All I see is the PHP source.  Beginning with:

  ?php
  /**
   * Magento
   *
   * NOTICE OF LICENSE
   *
   * This source file is subject to the Open Software License (OSL 3.0)
   * that is bundled with this package in the file LICENSE.txt.
   * It is also available through the world-wide-web at this URL:
   * http://opensource.org/licenses/osl-3.0.php
   * If you did not receive a copy of the license and are unable to
   * obtain it through the world-wide-web, please send an email
   * to [EMAIL PROTECTED] so we can send you a copy immediately.
   *
   * @category   design_default
   * @packageMage
   * @copyright  Copyright (c) 2004-2007 Irubin Consulting Inc. DBA
  Varien (http://www.varien.com)
   * @licensehttp://opensource.org/licenses/osl-3.0.php  Open
  Software License (OSL 3.0)
   */
  ?
  ?
  /**
   * Product list template
   *
   * @see Mage_Catalog_Block_Product_List
   */
  ?
  ?$_productCollection=$this-getLoadedProductCollection()?
  ?if(!$_productCollection-getSize()):?
  div class=note-msg
 ?=$this-__('There are no products matching the selection.')?
  /div


  --
  /Dan

  Daniel P. Brown
  Senior Unix Geek
  ? while(1) { $me = $mind--; sleep(86400); } ?


Hi Dan.

It is a svn repo showing the code to a product page to which you
design with styles instead of tables.

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



Re: [PHP] Sometimes I wonder why I even started programming...

2008-02-28 Thread Nathan Rixham

Eric Butera wrote:

On Thu, Feb 28, 2008 at 12:38 PM, Daniel Brown [EMAIL PROTECTED] wrote:

On Thu, Feb 28, 2008 at 12:36 PM, Eric Butera [EMAIL PROTECTED] wrote:
  And I'd appreciate it if you kept all your posts about wearing dresses
  to yourself but it isn't going to happen. :)

Heh.  It is a bad visual, isn't it?  ;-P

 --


/Dan

 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?



All my point is that I've been on this list for a while.  I've posted
code and watched people just copy and paste it.  I've watched other
people copy and paste their examples.  I used to say sanitize your
data and watch the same exact thing in their new function coming back
at me without any sanity checks whatsoever.

So my point is that people don't know how to do it.  If you decide to
help people out with their issues you need to also help them
understand how to filter/escape their data.  Otherwise keep in mind
those people are going to copy your code with the comment saying
sanitize it, and it isn't going to be escaped.  Maybe that is okay
with you but I see that as a problem.  I know Jason said he is doing
it elsewhere, but that is the rare case.


Eric,

You do make a valid point about people copy and pasting code, and that 
we should all take a bit more care; however we also have to remember 
that not all posts are going to newbies, when a solid software 
engineer posts a short query on here, I'm sure they don't expect a fully 
santised application back, when a short snippet of code would more than 
suffice.


One thing I don't understand, why did you go all out and personal on 
Dan? I'm not even going to go into it, you were bang out of order order 
 and you owe the man an apology; no need to explain what you meant, we 
all got it the first time. Further, if you felt the need to challenge 
somebody or give them advice why do it public?


Hell I'm not even involved and that kind of ill-mannered post even 
managed to put me in a bad mood.


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



Re: [PHP] Flexible Shopping Cart (was: Shopping Carts)

2008-02-28 Thread Nathan Rixham

?$_productCollection=$this-getLoadedProductCollection()?
?if(!$_productCollection-getSize()):?
div class=note-msg
?=$this-__('There are no products matching the selection.')?
/div

first 5 lines I've seen of it and it's got short-tags, escapes in and 
out of php/html, no templating engine and no language file, or even 
concideration of future implementation.


and is all that inside a class? I see a $this but no class classname {

just some constuctive critism, could be good though!

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



  1   2   >