OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 28 Feb 2008 11:52:36 -0000 Issue 5319

php-general-digest-helplists.php.net
Date: Thu Feb 28 2008 - 05:52:36 CST


php-general Digest 28 Feb 2008 11:52:36 -0000 Issue 5319

Topics (messages 270487 through 270534):

Re: Functions not available when run as Scheduled Task?
        270487 by: Andr閟 Robinet
        270492 by: Jochem Maas
        270493 by: Brian Dunning

Re: Guidance
        270488 by: Stut
        270489 by: tedd
        270490 by: Daniel Brown
        270491 by: Bastien Koert
        270495 by: tedd
        270497 by: Jochem Maas
        270498 by: Robert Cummings
        270514 by: Casey
        270527 by: Stut

Re: Are these Truthful Proof about PHP ??
        270494 by: tedd
        270496 by: Shawn McKenzie
        270508 by: Casey

Flexible Shopping Cart (was: Shopping Carts)
        270499 by: Manuel Barros Reyes
        270506 by: Shawn McKenzie

Re: Multiple Inheritance
        270500 by: chetan rane

Re: sort in while(list($vars) = mysql_fetch_row($result))
        270501 by: Chris

Choose Your Common Design Patterns
        270502 by: skylark

ZCE guidance needed
        270503 by: skylark
        270504 by: skylark
        270505 by: Nathan Nobbe
        270507 by: Wolf
        270509 by: Casey
        270510 by: skylark
        270511 by: Nathan Nobbe
        270512 by: Chris
        270513 by: skylark
        270515 by: Nathan Nobbe
        270516 by: skylark

Re: Cannot even come up with the beginning of a regex
        270517 by: Casey
        270521 by: Zolt醤 N閙eth
        270522 by: Dotan Cohen
        270523 by: Dotan Cohen
        270526 by: Zolt醤 N閙eth

Re: Start/stop daemon using php
        270518 by: Per Jessen

Re: What design patterns do you usually use?
        270519 by: Zolt醤 N閙eth
        270520 by: Aschwin Wesselius

Traverse directory - Find empty directory
        270524 by: Holografix

Re: Getting the name of a function
        270525 by: Jochem Maas

php --ini and the like
        270528 by: Jochem Maas

reverse string without strrev();
        270529 by: skylark
        270530 by: Aschwin Wesselius
        270531 by: Stut
        270533 by: Aschwin Wesselius

output buffering in CLI script.
        270532 by: Jochem Maas
        270534 by: Andr閟 Robinet

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


> -----Original Message-----
> From: Ray Hauge [mailto:ray.hauge.listsgmail.com]
> Sent: Wednesday, February 27, 2008 6:42 PM
> To: Brian Dunning
> Cc: php-generallists.php.net
> Subject: Re: [PHP] Functions not available when run as Scheduled Task?
>
> Brian Dunning wrote:
> > Don't laugh but we have a Win 2003 Server set up with WAMP, and the
> > PHP/MySQL scripts work great. I set one up to run as a scheduled task:
> >
> > C:\php5\php.exe "D:\wamp\www\scriptname.php"
> >
> > ...but nothing happens and the Scheduled Tasks log says that it exited
> > with an (ff). So I entered the above manually into a command prompt, and
> > it said that mysql_connect() is an unknown function! WTF? It's like it's
> > trying to use a different php.ini file that maybe has mysql commented
> > out. I double checked that all the php.ini files on the machine do have
> > mysql enabled, and anyway mysql works fine normally.
> >
> > Anyone know what PHP is doing to me here in the scheduled service?
> >
>
> I think that there might be a separate php-cli.ini file that is not
> loading the modules that apache does. I'm too lazy to verify, but I
> remember running into that myself a time or two. Check the output of
> phpinfo(); or C:\php5\php.exe -v (I think that'll work on Windows).
>
> --
> Ray Hauge
> www.primateapplications.com
>
> --

Use the -c command line option to be sure, for example:

C:\php5\php.exe -c "C:\php5\php.ini" -f "D:\wamp\www\scriptname.php"

attached mail follows:


Brian Dunning schreef:
> Don't laugh but we have a Win 2003 Server set up with WAMP, and the
> PHP/MySQL scripts work great. I set one up to run as a scheduled task:
>
> C:\php5\php.exe "D:\wamp\www\scriptname.php"
>
> ...but nothing happens and the Scheduled Tasks log says that it exited
> with an (ff). So I entered the above manually into a command prompt, and
> it said that mysql_connect() is an unknown function! WTF? It's like it's
> trying to use a different php.ini file that maybe has mysql commented
> out. I double checked that all the php.ini files on the machine do have
> mysql enabled, and anyway mysql works fine normally.
>
> Anyone know what PHP is doing to me here in the scheduled service?

AFAIK php on windows is generally built with all relevant modules included
(check the php.ini used by apaches mod_php and you'll probably notice the
extension=php_mysql.dll line is actually commented out)

my guess would be that the CLI version of php is built without the mysql
extension.

and if it's not that then it's probably down to difference in php.ini after all.

>

attached mail follows:


Adding this command solved it. Thanks to everyone! I did not even know
this command existed.

On Feb 27, 2008, at 3:46 PM, Andr閟 Robinet wrote:

>> Use the -c command line option to be sure, for example:
>
> C:\php5\php.exe -c "C:\php5\php.ini" -f "D:\wamp\www\scriptname.php"
>
> --

attached mail follows:


On 27 Feb 2008, at 23:25, Jochem Maas wrote:
> Stut schreef:

I DID NOT!! It was him! I only schreef in private!

>
>> On 27 Feb 2008, at 20:59, Daniel Brown wrote:
>>> So let this be at least a basic retort to those who don't consider
>>> web development "real programming." Because you'd be surprised how
>>> much I hear, "oh, you work with web stuff, I thought you meant you
>>> were a real programmer."
>>>
>>> Well, I'm not. I'm an engineer. At least according to my
>>> paycheck. ;-P
>> I hear that a lot and by the numbers it's fairly accurate.
>> In my experience there is a big difference between a web developer
>> and a software engineer. If someone is hiring a web developer then
>> I'm not interested. If they want a properly engineered website then
>> I might be interested.
>
> I guess it's a matter of semantics. to me 'developer' means
> 'engineer' in terms
> of a being able to perform high-level problem analysis, designing a
> solution
> and implementing it ... within budget, whilst keeping an eye on the
> actual
> [commercial] goals of the client (as opposed to the goals a client
> might speak of ...
> what a client says they need, and what they actually need aren't
> often the same)
>
> what others might consider a 'developer' I'd call a 'programmer' -
> someone
> whoe takes my analysis and proposed solution and makes a botch job
> of implementing it ...
> with the added bonus of not actually ever thinking about their
> creation outside
> the confines of their little fish bowl.

Yes it is a matter of semantics, but my definition can be boiled down
to.... "A software engineer engineers a solution whereas a web
developer will simply knock up something that works and move on."

I'm not knocking those who don't apply software engineering principals
to their development - they have their place and the vast majority of
PHP-based websites can be successfully implemented from that point of
view. However, I tend to work on large web-based applications rather
than "simple" sites, and in my world applying software engineering
principals helps to ensure the sites are structurally sound,
maintainable and performant (which Apple Mail thinks should be
"perform ant", love it!).

I would never hire a developer who blindly implements a solution
without thinking about what they're doing. I know I'm not perfect, I
know I make mistakes, and on occasion they have cost an embarrassing
amount of money to fix. I'm also fully aware that other people have
insights that would never occur to me. If I'm farming out work to code
monkeys I need them to sanity check my solution and challenge me if
they think something's wrong or they think the have a better solution.

>> 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!
>
> are there any other restrictions other than not to use
> array_reverse()? ;-)

Well, implemented in PHP would be nice, but nothing beyond that. There
are many different ways to do it.

It's worth noting that I've asked the same question to more than a few
interviewees for traditional C/C++ roles, and I never came across one
that couldn't do it which I find quite interesting.

Incidentally, the same distinction between engineers and developers
applies here too, it's certainly not specific to web development.

-Stut

--
http://stut.net/

attached mail follows:


At 10:21 PM +0000 2/27/08, Stut wrote:
>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

Running?

I thought that emigrating was E migrating .

You know, like we all form an V and flap around. :-)

It's getting late.

Cheers,

tedd

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

attached mail follows:


On Wed, Feb 27, 2008 at 6:52 PM, Stut <stuttlegmail.com> wrote:
> On 27 Feb 2008, at 23:25, Jochem Maas wrote:
> > Stut schreef:
>
> I DID NOT!! It was him! I only schreef in private!

    Sure, blame it on me....

> I'm not knocking those who don't apply software engineering principals
> to their development - they have their place and the vast majority of
> PHP-based websites can be successfully implemented from that point of
> view. However, I tend to work on large web-based applications rather
> than "simple" sites, and in my world applying software engineering
> principals helps to ensure the sites are structurally sound,
> maintainable and performant (which Apple Mail thinks should be
> "perform ant", love it!).

    Coincidentally, I just informed Jochem about ten minutes ago that
my spell-checker extension in Firefox (probably Aspell-based, since it
recognizes the word "Aspell") considers the word "ain't" to be
correct. Unfortunately, what should be a positive (and thus proper
opposite), "ain" - which I conjecture should be the redneck equivalent
of "is" - does not exist in the lexicon.... but I digress.

> I would never hire a developer who blindly implements a solution
> without thinking about what they're doing. I know I'm not perfect, I
> know I make mistakes, and on occasion they have cost an embarrassing
> amount of money to fix. I'm also fully aware that other people have
> insights that would never occur to me. If I'm farming out work to code
> monkeys I need them to sanity check my solution and challenge me if
> they think something's wrong or they think the have a better solution.

    I don't mind people telling me I've done something wrong or not as
well as I should have. Sure, I've been pounding keyboards for many
moons, but even Bill Gates, Steve Jobs, and Richard Lynch will all
agree that a second set of eyes and another brain will offer better
insight and help teach an aged canine new alternatives to
mysql_fetch_assoc(). ;-P

> It's worth noting that I've asked the same question to more than a few
> interviewees for traditional C/C++ roles, and I never came across one
> that couldn't do it which I find quite interesting.

    Never came across one who *could* or *could not*? Just checking
for typos here. If that's typed correctly, it's certainly worth
noting. I'd envision more people attempting to reverse the order or,
as Shawn did earlier, doing the equivalent of PHP's array_flip().

> Incidentally, the same distinction between engineers and developers
> applies here too, it's certainly not specific to web development.

    And while it hasn't been said otherwise, I also consider this
worth noting - especially for new PHP programmers who are afraid of
looking like fools when asking questions to further their knowledge or
don't consider their grasp of the language good enough to keep
learning:

    Just because you don't know every function in the PHP manual
doesn't mean you're not going to be a good programmer. That's why the
manual is there. That's why this list is here. I learn a new
function every week (not on purpose, but I did write a script to do a
random one daily and just never used it) that I never before knew.
For example: array_reverse() and array_flip(). I had been writing my
own functions to handle similar operations. Now, when I need
something in the future, I'll remember the functions and employ them.
And if/when I'm granted the time and opportunity, I'll update the
function files that use those routines and make them a bit more
economical.

--
</Dan>

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

attached mail follows:


UK? I was hoping for Windsor Ontario Canada

bastien

----------------------------------------
> CC: php-generallists.php.net
> From: stuttlegmail.com
> To: nospammckenzies.net
> Date: Wed, 27 Feb 2008 22:21:59 +0000
> Subject: Re: [PHP] Guidance
>
> 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
>

_________________________________________________________________

attached mail follows:


At 11:52 PM +0000 2/27/08, Stut wrote:
>It's worth noting that I've asked the same question to more than a
>few interviewees for traditional C/C++ roles, and I never came
>across one that couldn't do it which I find quite interesting.
>
>Incidentally, the same distinction between engineers and developers
>applies here too, it's certainly not specific to web development.
>
>-Stut

In all seriousness, I haven't a clue as to what to call myself these
days. I think the lines have blurred considerably, at least for me.

I'm certainly no longer a master at anything, the technology is too
diverse. But I can get just about anything done, if time is not an
issue, and it's usually is not a problem.

I guess the bottom line is what your clients/employers think. If they
approve, then I guess that you can be just about anything. If they
don't, then that narrows the field a bit.

Cheers,

tedd

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

attached mail follows:


Stut schreef:
> On 27 Feb 2008, at 23:25, Jochem Maas wrote:
>> Stut schreef:
>
> I DID NOT!! It was him! I only schreef in private!
>

that's what they all say ... my thunderbird knows different ;-)

>
>>> 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!
>>
>> are there any other restrictions other than not to use
>> array_reverse()? ;-)

well for the record then (it's late, I'm on my third glass of wine,
it could probably be more efficient) ... feel free to use in your
next php3 project :-)

if (!function_exists('array_reverse')) {
        function array_reverse($a, $pk = false) {
                $r = array();

                if ($pk) {
                        do {
                                end($a);
                                $v = each($a);
                                $r[ $v[0] ] = $v[1];
                        } while (array_pop($a) && count($a));
                } else {
                        while ($i = array_pop($a)) $r[] = $i;
                }

                return $r;
        }
}

        function ar($a, $pk = false) {
                $r = array();

                if ($pk) {
                        do {
                                end($a);
                                $v = each($a);
                                $r[ $v[0] ] = $v[1];
                        } while (array_pop($a));
                } else {
                        while ($i = array_pop($a)) $r[] = $i;
                }

                return $r;
        }

>
> Well, implemented in PHP would be nice, but nothing beyond that. There
> are many different ways to do it.

skinacat.com

> It's worth noting that I've asked the same question to more than a few
> interviewees for traditional C/C++ roles, and I never came across one
> that couldn't do it which I find quite interesting.
>
> Incidentally, the same distinction between engineers and developers
> applies here too, it's certainly not specific to web development.

hmm. thing is you need a bit of paper to call yourself an engineer .. I ain't
got one.

>
> -Stut
>

attached mail follows:


On Thu, 2008-02-28 at 02:21 +0100, Jochem Maas wrote:
> Stut schreef:
> >
> > It's worth noting that I've asked the same question to more than a
> > few interviewees for traditional C/C++ roles, and I never came
> > across one that couldn't do it which I find quite interesting.
> >
> > Incidentally, the same distinction between engineers and developers
> > applies here too, it's certainly not specific to web development.
>
> hmm. thing is you need a bit of paper to call yourself an engineer ..
> I ain't got one.

Mine says I'm a scientist. Personally, I prefer that label over
engineer.

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. |
`------------------------------------------------------------'

attached mail follows:


On Wed, Feb 27, 2008 at 1:04 PM, Nathan Rixham <nrixhamgmail.com> wrote:
>
> Matty Sarro wrote:
> > I understand and agree completely, and I really appreciate the help. My goal
> > isn't so much to keep from re-writing code, but to have a pretty firm
> > foundation to stand on before I really begin. I mean, with c++ or c, all I
> > needed was the language, and that was pretty much it. I could do everything
> > from there. This seems a lot more like its a marriage of a ton of different
> > technologies :)
> >
> > On Wed, Feb 27, 2008 at 3:32 PM, Daniel Brown <parasanegmail.com> wrote:
> >
> >> On Wed, Feb 27, 2008 at 3:01 PM, Stut <stuttlegmail.com> wrote:
> >>> Maybe it's just me but I usually end up rewriting everything I write
> >>> at least twice. That's just a fact of life and I've found that I end
> >>> up with far better code that way than I do by trying to get it right
> >>> first time. It also tends to be quicker.
> >> [snip!]
> >>> In short, learn by doing. It's served me well.
> >> I made it even shorter, Stut. ;-P
> >>
> >> He's exactly right, Matty. It's a form of evolution called
> >> "versioning". No programmer gets everything perfect the first (or
> >> usually even second, third, eighth) time. Good, usable, lasting code
> >> will be written and rewritten very often. Look at almost any code
> >> that's been around and distributed (including the PHP project itself)
> >> and you'll notice that there are dozens of versions, because over the
> >> years new ideas have come about to make it more productive, more
> >> economical, and all-around better.
> >>
> >> --
> >> </Dan>
> >>
> >> Daniel P. Brown
> >> Senior Unix Geek
> >> <? while(1) { $me = $mind--; sleep(86400); } ?>
> >>
> >
>
> Indeed it is Matty, here's the way I would approach >
>
> 1 (X)HTML
> view source and w3schools are your friends here
>
> 2 CSS
> just the basic will get you started, worth reading W3C CSS spec
> particularly the BOX Model [http://www.w3.org/TR/css3-box/]
>
> 3 Make a project website in plain XHTML with CSS
>
> 4 ECMAScript (javascript)
> Make your static website do a couple of nice things with some javascript.
>
> you can't expect to program anything we related if you can't format the
> output!
>

Oddly, I learned JavaScript and PHP before truly learning XHTML.

By the way, I really hate <font> tags, so learn XHTML! Also, if you're
learning JavaScript, please learn W3C DOM, and not the
document.write(Ugliness). :)

--
-Casey

attached mail follows:


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/

attached mail follows:


At 2:15 PM -0800 2/27/08, Stephen Johnson wrote:
>Talk about a thread hijack... LOL
>
>In my day we had to write basic going up hill in the snow... Both ways...

You had snow?

In my day it was just glaciers -- as far as the eye could see.

We used to freeze our rocks -- I did mention that that's how we
programmed right?

Once those buggers got froze, it was hard to do anything.

Cheers,

tedd

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

attached mail follows:


Daniel Brown wrote:
> On Wed, Feb 27, 2008 at 5:01 PM, Shawn McKenzie <nospammckenzies.net> wrote:
>> Actually, if I recall correctly, I normally had to start with increments
>> of 100.
>
> I always started with 10 and incremented by 10 in both MS and GW
> BASIC (and on TI, C64, LASER, etc.), because then I could go back and
> add 11, 24, 43, 44, 45, 46, etc., if I needed to patch something into
> the code.
>
Yeah, I forgot so much that I needed more than 9 slots to insert lines :-)

attached mail follows:


On Wed, Feb 27, 2008 at 10:03 AM, Dare Williams <darrenwillyyahoo.com> wrote:
> Dear Developers,
>
> http://msdn2.microsoft.com/en-us/library/aa479002.aspx
> I read an Article on the above Microsoft website stating the reason why to Migrate from PHP to ASP.NET. So can you please justify this proofs from Microsoft and let everybody knows if they are all TRUE and MEANIFUL atall or they are just cheap lies to backup their product. Please advice?
>
> Thanks.
> Williams.
>

That article does not "state the reason why to migrate from PHP to
ASP.NET". It describes the differences between the two.

--
-Casey

attached mail follows:


I've sent a message some hours ago and committed the mistake of
including it inside of an already started thread, don't know if
someone read it.

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.

Don't have good experience with oscommerce because of the way the
layout is set with tables, it doesn't give much freedom and couln't
find good docs about it. Saw Zen Cart and it looks promising but have
no experience on it.

Listen to your suggestions.
Thanks again.

attached mail follows:


Manuel Barros Reyes wrote:
> I've sent a message some hours ago and committed the mistake of
> including it inside of an already started thread, don't know if
> someone read it.
>
> 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.
>
> Don't have good experience with oscommerce because of the way the
> layout is set with tables, it doesn't give much freedom and couln't
> find good docs about it. Saw Zen Cart and it looks promising but have
> no experience on it.
>
> Listen to your suggestions.
> Thanks again.

I would very strongly sway you against oscommerce. I wrote a theme
system that is wildly popular for phpnuke and postnuke cmss (AutoTheme)
and had some that wanted it for oscommerce. I moded my code for
oscommerce, but it was a serious bitch. It may do as advertised, but it
is tightly coded and leaves no room for additions. To do *anything*
requires hacking core files, after sifting through crap code to try and
figure how it works, then hack it to what you want.

I once installed zencart and have never used it, but at the point where
people wanted my theme system for zencart I started trying to port it.
It was my lack of enthusiasm that kept it from happening, but from what
I remember it was s rewrite of oscommerce of sorts but a modular system,
  where they coded it in such a fashion that you could add modules, not
hack core code to get the functionality that you needed.

Not sure how the development has progressed but my 2 cents.

-Shawn

attached mail follows:


Thanks Nathan, I had already done that using the Objects of the 2 classes as
shown by you in the example 1.
but there are one thing in that.
If i create the Objects i cannot access the Protected Data from teh parent
classes.

On Thu, Feb 28, 2008 at 4:33 AM, Nathan Nobbe <quickshiftingmail.com>
wrote:

> On Wed, Feb 27, 2008 at 12:05 PM, chetan rane <chetan.d.ranegmail.com>
> wrote:
>
> > Hi All
> >
> > Dose anyone know how to implement multiple inheritance in PHP 5.
> > Interfaces dosent work . I have already Tried it.
>
>
> the idea in a single inheritance language is to implement
> 'multiple inheritance' in the following way.
> implement several interfaces an then compose a common
> classes that implements said interfaces. this is the workaround
> for single inheritance languages. here is a trivial example,
>
> interface CommonStuff {
> function commonFunction($a, $b);
> function moreCommonFunction($x, $y, $z);
> }
>
> interface OftenUsed {
> function imSpecial($c, $d);
> function imMoreSpecial($u, $v, $w);
> }
>
> now you might have standard or common implementations
> of these, sometimes referred to as mixins (taken from ruby,
> i believe [<-- here i go again greg ;)])
>
> class CommonStuffImpl implements CommonStuff {
> function commonFunction($a, $b) {
> return $a + $b;
> }
>
> function moreCommonFunction($x, $y, $z) {
> return $x + $y + $z;
> }
> }
>
> class OftenUsedImpl implements OftenUsed {
> function imSpecial($c, $d) {
> return $c - $d;
> }
>
> function imMoreSpecial($u, $v, $w) {
> return $u - $v - $w;
> }
> }
>
> and now finally for the multiple inheritance workaround;
> suppose you have a class that needs to be both
> CommonStuff and OftenUsed; you simply implement
> both the interfaces, then delegate to the mixins, and
> viola! multiple inheritance the single inheritance way ;)
>
> class MultiInherit implements CommonStuff, OftenUsed {
> private $commonStuffImpl = null;
> private $oftenUsedImpl = null;
>
> public function __construct() {
> $commonStuffImpl = new CommonStuffImpl();
> $oftenUsedImpl = new OftenUsedImpl();
> }
>
> /// now make sure to implement the interfaces and delegate
> function commonFunction($a, $b) {
> return $this->commonStuffImpl->commonFunction($a, $b);
> }
>
> function moreCommonFunction($x, $y, $z) {
> return $this->commonStuffImpl->moreCommonFunction($x, $y, $z);
> }
>
> function imSpecial($c, $d) {
> return $this->oftenUsedImpl->imSpecial($c, $d);
> }
>
> function imMoreSpecial($u, $v, $w) {
> return $this->oftenUsedImpl->imMoreSpecial($u, $v, $w);
> }
> }
>
> bear in mind i just typed that straight into my mail client, so it
> might not be perfect, but you get the idea.
> and also, dont forget about interface inheritance :)
>
> interface Somethingable {
> public function doSomething();
> }
>
> interface Crazyfiable {
> public function getCrazy();
> }
>
> interface Extendable extends Somethingable, Crazyfiable {
> public function extend();
> }
>
> class SuperClass implements Extendable {
> public function doSomething() {
> echo 'i did something ..' . PHP_EOL;
> }
>
> public function extend() {
> echo 'i extended something..' . PHP_EOL;
> }
>
> public function getCrazy() {
> echo 'im a crazy bastard now!' . PHP_EOL;
> }
> }
>
> -nathan
>

--
Have A pleasant Day
Chetan. D. Rane
Location: India
Contact: +91-9986057255
other ID: chetscoolyahoo.com
            chetranerediffmail.com

attached mail follows:


Verdon Vaillancourt wrote:
> Hi,
>
> I'm running into some sorting issues using a while(list($vars) =
> mysql_fetch_row($result)). I can provide more code if needed, but
> thought I would try this little bit first to see if I'm missing a
> fundamental concept and not a detail.
>
> In a nutshell, I have a query first..
> $result = mysql_query("select id, text, url, m_order from menu where
> level = 2 && active = 1 order by m_order");
>
> .. the result of this query is sorted correctly by m_order
>
>
> Then I pass it through this..
> while(list($id, $text, $url, $m_order) = mysql_fetch_row($result)) {
> $out .= "$text - $m_order \n";
> }
> echo $out;
>
> .. it is now no longer in the order it was in the query. In some results
> it is, in others it's not.

Looks ok from your example, however which column are you looking at for
your ordering?

My first guess is that's you're looking at the 'text' column (before the
-) in your output and not seeing that ordered... it's the second column
you should look at since that's you're "order by" in the query.

Provide a short example of what you get when you run the query manually
and what you get as the output where it doesn't match up.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Hi guys,

Relex a little on the topic "What design patterns do you usually use".
Choose the ones you use often at: http:// phparch [dot] cn
And this will answer that question, isn't it?

Those options are the ones that we often use. If there is any option needed
to be replaced, just let me know.
You can choose 2, 3, 4, ... or even more.... :-)
And you can check the result if interested.

Ill report the results regularly if needed. :)

--
Regards,
Shelley

attached mail follows:


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.

Thanks in advance.

--
Regards,
Shelley

attached mail follows:


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.

Thanks in advance.

--
Regards,
Shelley

attached mail follows:


On Wed, Feb 27, 2008 at 10:31 PM, Shelley <myphplistgmail.com> 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

attached mail follows:


---- Shelley <myphplistgmail.com> 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.
>
> Thanks in advance.

Did you really have to post this twice to the list?

When posting to the list, wait for a while for a response before posting again about the same item.

Wolf

attached mail follows:


On Wed, Feb 27, 2008 at 8:09 PM, Nathan Nobbe <quickshiftingmail.com> wrote:
> On Wed, Feb 27, 2008 at 10:31 PM, Shelley <myphplistgmail.com> 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
>

There's a test for PHP? Wow, I never knew that. Is there some kind of
free online test to determine my [self-taught] PHP knowledge? :D

--
-Casey

attached mail follows:


Nathan Nobbe wrote:
> On Wed, Feb 27, 2008 at 10:31 PM, Shelley <myphplistgmail.com
> <mailto:myphplistgmail.com>> 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
>
Really? What I know is there are 70 questions.
But Im interested in how many right answers you should make to pass the
exam.

--
Cheers,
Shelley

attached mail follows:


On Wed, Feb 27, 2008 at 11:45 PM, Shelley <myphplistgmail.com> wrote:

> Really? What I know is there are 70 questions.
> But Im interested in how many right answers you should make to pass the
> exam. :-)
>

well im sure you can search the web just as good as i can ;)
but anyway, i think its like a 60% to pass (NOTE: pulling from rusty memory)

-nathan

attached mail follows:


> But Im interested in how many right answers you should make to pass the
> exam.

As many as you can?

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Nathan Nobbe wrote:
> On Wed, Feb 27, 2008 at 11:45 PM, Shelley <myphplistgmail.com
> <mailto:myphplistgmail.com>> wrote:
>
> Really? What I know is there are 70 questions.
> But Im interested in how many right answers you should make to
> pass the exam. :-)
>
>
> well im sure you can search the web just as good as i can ;)
> but anyway, i think its like a 60% to pass (NOTE: pulling from rusty
> memory)
>
> -nathan
Then it's great. What I imagined was that you should make something like
90%.

I have thought then it should have to be hard to pass.

--
Cheers,
Shelley

attached mail follows:


On Wed, Feb 27, 2008 at 11:54 PM, Shelley <myphplistgmail.com> wrote:

> Nathan Nobbe wrote:
> > On Wed, Feb 27, 2008 at 11:45 PM, Shelley <myphplistgmail.com
> > <mailto:myphplistgmail.com>> wrote:
> >
> > Really? What I know is there are 70 questions.
> > But Im interested in how many right answers you should make to
> > pass the exam. :-)
> >
> >
> > well im sure you can search the web just as good as i can ;)
> > but anyway, i think its like a 60% to pass (NOTE: pulling from rusty
> > memory)
> >
> > -nathan
> Then it's great. What I imagined was that you should make something like
> 90%.
>
> I have thought then it should have to be hard to pass.

trust me, with the level of obscurity in a number of those questions, youll
be cursing the bastard that wrote it just as soon as you start taking it.
after all that studying, only to get to something that requires vast
knowledge of a number php functions, i mean really, everyone under the sun
refers to the functions w/ php.net beside them while they code right? or
maybe i just havent committed all of them to memory like everyone else ;)
they hit you over the head w/ various different array sorting methods and
thats just the beginning. i thought the passing req would be a cinch until
i started taking the exam. then after pushing through my frustration, i was
wondering if i would actually make it. seriously some of them are hit or
miss, theres no way to verify it there on the spot until you hit the grade
button.

-nathan

attached mail follows:


Nathan Nobbe wrote:
> On Wed, Feb 27, 2008 at 11:54 PM, Shelley <myphplistgmail.com
> <mailto:myphplistgmail.com>> wrote:
>
> Nathan Nobbe wrote:
> > On Wed, Feb 27, 2008 at 11:45 PM, Shelley <myphplistgmail.com
> <mailto:myphplistgmail.com>
> > <mailto:myphplistgmail.com <mailto:myphplistgmail.com>>> wrote:
> >
> > Really? What I know is there are 70 questions.
> > But Im interested in how many right answers you should make to
> > pass the exam. :-)
> >
> >
> > well im sure you can search the web just as good as i can ;)
> > but anyway, i think its like a 60% to pass (NOTE: pulling from rusty
> > memory)
> >
> > -nathan
> Then it's great. What I imagined was that you should make
> something like
> 90%.
>
> I have thought then it should have to be hard to pass.
>
>
> trust me, with the level of obscurity in a number of those questions,
> youll be cursing the bastard that wrote it just as soon as you start
> taking it.
> after all that studying, only to get to something that requires vast
> knowledge of a number php functions, i mean really, everyone under the
> sun refers to the functions w/ php.net <http://php.net> beside them
> while they code right? or maybe i just havent committed all of them
> to memory like everyone else ;)
> they hit you over the head w/ various different array sorting methods
> and thats just the beginning. i thought the passing req would be a
> cinch until i started taking the exam. then after pushing through my
> frustration, i was wondering if i would actually make it. seriously
> some of them are hit or miss, theres no way to verify it there on the
> spot until you hit the grade button.
>
> -nathan
You are definitely right. :-)
It's said that you will never use some of those functions all your life!

--
Cheers,
Shelley

attached mail follows:


2008/2/27 Dotan Cohen <dotancohengmail.com>:
> On 27/02/2008, Zolt谩n N茅meth <znemethalterationx.hu> 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.
>
>
>
> 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?
>

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?
--
-Casey

attached mail follows:


2008. 02. 28, cs眉t枚rt枚k keltez茅ssel 00.02-kor Dotan Cohen ezt 铆rta:
> On 27/02/2008, Zolt谩n N茅meth <znemethalterationx.hu> 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?

attached mail follows:


On 28/02/2008, Casey <heavyccaseygmail.com> 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?

attached mail follows:


On 28/02/2008, Zolt谩n N茅meth <znemethalterationx.hu> 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?

attached mail follows:


2008. 02. 28, cs眉t枚rt枚k keltez茅ssel 11.23-kor Dotan Cohen ezt 铆rta:
> On 28/02/2008, Zolt谩n N茅meth <znemethalterationx.hu> 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?

attached mail follows:


David Sveningsson wrote:

> Per Jessen skrev:
>> So obviously something is catching the SIGQUIT before it gets to your
>> daemon. You mention "a php site", so I take it you're running
>> apache.
>> In an apache process you then do an exec(something). I think apache
>> is probably taking care of the SIGQUIT.
>
> Yes, I am using apache (forgot to mention it). Is there a way to stop
> apache from catching the signals?

Hmm, when your daemon does a fork(), it should be perfectly capable of
installing its own signal handlers. Is SIGQUIT enabled? Check your
signal mask.

/Per Jessen, Z眉rich

attached mail follows:


2008. 02. 27, szerda keltez茅ssel 14.02-kor tedd ezt 铆rta:
> At 6:32 PM +0100 2/27/08, Zolt谩n N茅meth wrote:
> >thanks to its good class structure if we need to modify something we
> >know which file to open and where to modify, even if that class was
> >originally the work of someone else in the team. how would you do that
> >without class structure?
> >
> >greets
> >Zolt谩n N茅meth
>
> Zolt谩n:
>
> How? Same as you -- good organization.
>
> My largest program (a Street Atlas type program
> for the Mac) was about 10 percent the size of
> yours (not counting data). But, I was the only
> programmer. It took me almost two years to write
> from scratch.
>
> 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' :)

>
> I seldom use any globals -- for example, this program had only 4 globals.
>
> If I needed to modify anything, I knew exactly
> where to go. That was not a problem.
>
> I understand how classes work and this project
> could have been done that way. But, I think it
> would have taken me longer if I had been forced
> to use them.

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

greets,
Zolt谩n N茅meth

>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>

attached mail follows:


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>

attached mail follows:


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

attached mail follows:


Daniel Brown schreef:
> On Wed, Feb 27, 2008 at 1:56 PM, Richard S. Crawford
> <rscrawfordmossroot.com> 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
>

attached mail follows:


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> $... ]
   }
}

attached mail follows:


Hi all,

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

Any ideas appreciated.

Thanks in advance.

--
Regards,
Shelley

attached mail follows:


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>

attached mail follows:


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/

attached mail follows:


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>

attached mail follows:


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 (!include $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.

attached mail follows:


> -----Original Message-----
> From: Jochem Maas [mailto:jochemiamjochem.com]
> 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 (!include $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閟 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: infobestplace.net 爘 MSN Chat: bestbestplace.net 爘 燬KYPE: bestplace |
燱eb: bestplace.biz | Web: seo-diy.com