PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > first php 5 class
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
first php 5 class

Réponse
 
LinkBack Outils de la discussion
Vieux 30/01/2008, 21h06   #26
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 2:55 PM, Greg Donald <gdonald@gmail.com> wrote:
> If you only need to test data integrity then it seems good enough. I
> would argue that being able to test xhr requests is a basic
> requirement at this stage in web development.


how exactly do you test an xhr request?
my suspicion is that you would just set data in superglobal
arrays, eg.
$_POST['somevar'] = ' blah';

i dont really see what the difference between an xhr request
and a non-xhr request is in the context of a unit test.
its still http..

-nathan
  Réponse avec citation
Vieux 30/01/2008, 21h11   #27
Greg Donald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On 1/30/08, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> On Jan 30, 2008 2:38 PM, Greg Donald <gdonald@gmail.com> wrote:
> > If you like Java then stick with PHP as that's where the syntax is
> > clearly headed:
> >
> > http://www.php.net/~helly/php/ext/spl/

>
> ive been studying spl a lot recently. actually, last night
> i was benching it against foreach over standard arrays.
> the results were staggering, spl is roughly twice as fast.
> and if you iterate over the same structure more than once,
> say ArrayIterator, vs. multiple times iterating over a regular
> array w/ the foreach or while construct, the savings only
> compound!
> when you said earlier that people arent interested in learning
> php, this is something i immediately thought of. primarily
> because spl debuted in php 5.0 and practically nobody is
> using it (which could just be my skewed perception) when it
> is extremely powerful.


I think your perception is correct. But Perl is very powerful too,
and not so many people use it for new web development either.. with
list serve traffic being my reference.

SPL's main drawback for me personally is carpal tunnel syndrome, I
don't have it and I don't care to acquire it.


--
Greg Donald
http://destiney.com/
  Réponse avec citation
Vieux 30/01/2008, 21h22   #28
Greg Donald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On 1/30/08, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> On Jan 30, 2008 2:55 PM, Greg Donald <gdonald@gmail.com> wrote:
> > If you only need to test data integrity then it seems good enough. I
> > would argue that being able to test xhr requests is a basic
> > requirement at this stage in web development.

>
> how exactly do you test an xhr request?
> my suspicion is that you would just set data in superglobal
> arrays, eg.
> $_POST['somevar'] = ' blah';
>
> i dont really see what the difference between an xhr request
> and a non-xhr request is in the context of a unit test.
> its still http..


A unit test, in it's most general sense, has nothing to do with http
specifically, it's just model/data validation for small units of code.
It's answers the question "Does my model read and write records to
and from the database correctly?". It won't catch integration errors,
performance problems, or other system-wide issues not local to the
unit being tested.

An xhr request needs to be tested to see if your javascript fired when
expected and equally important what was sent back, and did what was
sent back land in the DOM where you expected it to. Rails provides
that and much more.


--
Greg Donald
http://destiney.com/
  Réponse avec citation
Vieux 30/01/2008, 21h22   #29
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 3:11 PM, Greg Donald <gdonald@gmail.com> wrote:
> I think your perception is correct. But Perl is very powerful too,
> and not so many people use it for new web development either.. with
> list serve traffic being my reference.
>
> SPL's main drawback for me personally is carpal tunnel syndrome, I
> don't have it and I don't care to acquire it.


i sortof enjoy having php on the backend and javascript on the client side.
it lets be bounce around between paradigms. as per the ruby / prototype
integration, i will say, that is one nice component, that i actually use all
the time now. infact, im on the rails-spinoffs mailing list where we discuss
prototype.
i read a book, 'prototype and scriptaculous in action'; learned a ton of course.
nowadays, my webapps have the web 2.0 buzz. but as far as the generation
of javascript on the server side, i still have mixed feelings. the case made by
rhino is, your favorite java editor, your current java debugger and
you dont have
to learn another language. well, i suppose the case is somewhat similar for the
rails / prototype integration.
javascript is actually quite a complex language and its funny because
people will
always say things like, its such a nice 'little' language. if youre
not familiar w/
functional languages w/ closures and so forth, anonymous objects and
functions, etc..
javascript can be really confusing! i would extend this as a good
reason to understand
the language. but what a hippocrate i am, since im using propel to
get away from
sql to each his own, indeed.

what id like to know, since you seem to know so much about the ruby on
rails framework,
is, what sort of debugging support is there? this is a weak spot in
php to be sure. ive
tried multiple clients w/ xdebug w/ marginal success at this point.

-nathan
  Réponse avec citation
Vieux 30/01/2008, 21h33   #30
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 3:22 PM, Greg Donald <gdonald@gmail.com> wrote:
> An xhr request needs to be tested to see if your javascript fired when
> expected and equally important what was sent back, and did what was
> sent back land in the DOM where you expected it to. Rails provides
> that and much more.


ill admit the prospect of doing that programmattically is enticing.
scriptaculous has a unit testing framework, one class really, that i
intend to look into.
btw. i cooked up an abbreviated spl for you

<?php
class RII extends RecursiveIteratorIterator {}
class RAI extends RecursiveArrayIterator {}

$testData = array('a', 'b', 'c',
array('d', 'e', 'f',
array('g', 'h', 'i')));

foreach(new RII(new RAI($testData)) as $key => $val) {
echo "$key => $val" . PHP_EOL;
}
?>


-nathan
  Réponse avec citation
Vieux 30/01/2008, 21h34   #31
Greg Donald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On 1/30/08, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> what id like to know, since you seem to know so much about the ruby on
> rails framework,
> is, what sort of debugging support is there? this is a weak spot in
> php to be sure. ive
> tried multiple clients w/ xdebug w/ marginal success at this point.


Rails has support for ruby-debug built-in.

`gem install ruby-debug` to install it.

You would then add 'debugger' or 'breakpoint' into the code in
question. When execution hits that point your (development) server
drops into an IRB session where you would find your entire Rails
environment at your fingertips. You can interrogate the get/post data
or perform a database query. Whatever you can do in code you can do
in irb in real-time, zero limitations.

Ruby's IRB itself is a lot of fun even when not debugging:

> irb
>> 'ruby' > 'php'

=> true

It's like having a shell built directly into the language.


--
Greg Donald
http://destiney.com/
  Réponse avec citation
Vieux 30/01/2008, 21h43   #32
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 3:34 PM, Greg Donald <gdonald@gmail.com> wrote:
> On 1/30/08, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> > what id like to know, since you seem to know so much about the ruby on
> > rails framework,
> > is, what sort of debugging support is there? this is a weak spot in
> > php to be sure. ive
> > tried multiple clients w/ xdebug w/ marginal success at this point.

>
> Rails has support for ruby-debug built-in.
>
> `gem install ruby-debug` to install it.
>
> You would then add 'debugger' or 'breakpoint' into the code in
> question. When execution hits that point your (development) server
> drops into an IRB session where you would find your entire Rails
> environment at your fingertips. You can interrogate the get/post data
> or perform a database query. Whatever you can do in code you can do
> in irb in real-time, zero limitations.
>
> Ruby's IRB itself is a lot of fun even when not debugging:
>
> > irb
> >> 'ruby' > 'php'

> => true
>
> It's like having a shell built directly into the language.


php has an interactive shell; php -a.
therein you have access to anything in the language your
include path, or the local disc.
however, ive never heard of an extension whereby the debugger
drops you into a 'php -a' session.
and btw. php does have pecl and pear, these are both modular
systems where functional components can be easily installed or
upgraded on any given system, despite the underlying os, with
little effort.

-nathan
  Réponse avec citation
Vieux 30/01/2008, 22h08   #33
Greg Donald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On 1/30/08, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> php has an interactive shell; php -a.
> therein you have access to anything in the language your
> include path, or the local disc.


You obviously have a very different understanding of the word "interactive".

`php -a` seems pretty broken to me:

> php -a

Interactive mode enabled

sprintf( '%f^[[3~^[[3~

My backspace doesn't work. Ctrl-C to start over. I'm guessing I
would lose any local variables at this point?

> php -a

Interactive mode enabled

echo 'foo';

So where's the output?


> php -a

Interactive mode enabled

^[[A

Aww.. no up-arrow history either?

`php -a` doesn't work very well from where I sit.


IRB actually works:

> irb
>> [].class

=> Array
>> [].methods.sort

=> ["&", "*", "+", "-", "<<", "<=>", "==", "===", "=~", "[]", "[]=",
"__id__", "__send__", "all?", "any?", "assoc", "at", "class", "clear",
"clone", "collect", "collect!", "compact", "compact!", "concat",
"delete", "delete_at", "delete_if", "detect", "display", "dup",
"each", "each_index", "each_with_index", "empty?", "entries", "eql?",
"equal?", "extend", "fetch", "fill", "find", "find_all", "first",
"flatten", "flatten!", "freeze", "frozen?", "gem", "grep", "hash",
"id", "include?", "index", "indexes", "indices", "inject", "insert",
"inspect", "instance_eval", "instance_of?",
"instance_variable_defined?", "instance_variable_get",
"instance_variable_set", "instance_variables", "is_a?", "join",
"kind_of?", "last", "length", "map", "map!", "max", "member?",
"method", "methods", "min", "nil?", "nitems", "object_id", "pack",
"partition", "po", "poc", "pop", "pretty_inspect", "pretty_print",
"pretty_print_cycle", "pretty_print_inspect",
"pretty_print_instance_variables", "private_methods",
"protected_methods", "public_methods", "push", "rassoc", "reject",
"reject!", "replace", "require", "respond_to?", "reverse", "reverse!",
"reverse_each", "ri", "rindex", "select", "send", "shift",
"singleton_methods", "size", "slice", "slice!", "sort", "sort!",
"sort_by", "taint", "tainted?", "to_a", "to_ary", "to_s", "transpose",
"type", "uniq", "uniq!", "unshift", "untaint", "values_at", "zip",
"|"]


And since you can't see it I will also mention that IRB has beautiful
syntax highlighting.


> however, ive never heard of an extension whereby the debugger
> drops you into a 'php -a' session.
>
> and btw. php does have pecl and pear, these are both modular


Every time I ever went to the PEAR site I played a game of 'how many
times do I have to click before I dig down deep enough to realize the
docs aren't really there'.

Meanwhile every gem you install with Ruby has an rdoc package with
complete api docs for the gem. You just fire up your local `gem
server` and browse to http://localhost:8808/ to view complete api
docs, offline or on.


--
Greg Donald
http://destiney.com/
  Réponse avec citation
Vieux 30/01/2008, 22h21   #34
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 4:08 PM, Greg Donald <gdonald@gmail.com> wrote:
> On 1/30/08, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> > php has an interactive shell; php -a.
> > therein you have access to anything in the language your
> > include path, or the local disc.

>
> You obviously have a very different understanding of the word

"interactive".
>
> `php -a` seems pretty broken to me:
>
> > php -a

> Interactive mode enabled
>
> sprintf( '%f^[[3~^[[3~
>
> My backspace doesn't work. Ctrl-C to start over. I'm guessing I
> would lose any local variables at this point?
>
> > php -a

> Interactive mode enabled
>
> echo 'foo';
>
> So where's the output?
>
>
> > php -a

> Interactive mode enabled
>
> ^[[A
>
> Aww.. no up-arrow history either?
>
> `php -a` doesn't work very well from where I sit.


php > $rf = new ReflectionClass('Iterator');
php > echo $rf;
Interface [ <internal> interface Iterator implements Traversable ] {

- Constants [0] {
}

- Static properties [0] {
}

- Static methods [0] {
}

- Properties [0] {
}

- Methods [5] {
Method [ <internal> abstract public method current ] {
}

Method [ <internal> abstract public method next ] {
}

Method [ <internal> abstract public method key ] {
}

Method [ <internal> abstract public method valid ] {
}

Method [ <internal> abstract public method rewind ] {
}
}
}

up arrow works just fine. history is gone if it crashes, but
if you exit gracefully, eg. with quit, then the history will be there.
maybe youre using debian or some other silly os; i run gentoo
and there is no prob w/ php -a. although i wont lie; it seems to
be jacked on all the debian systems ive tried

> And since you can't see it I will also mention that IRB has beautiful
> syntax highlighting.


nice

> Every time I ever went to the PEAR site I played a game of 'how many
> times do I have to click before I dig down deep enough to realize the
> docs aren't really there'.

thats cause a lot of them are on the php site itself. again, ill admit, the
docs are scattered, but they are there:
http://us2.php.net/manual/en/ref.apc.php
http://us2.php.net/manual/en/ref.apd.php

> Meanwhile every gem you install with Ruby has an rdoc package with
> complete api docs for the gem. You just fire up your local `gem
> server` and browse to http://localhost:8808/ to view complete api
> docs, offline or on.


you can host the php docs on a local webserver if you like, or download
them; there is even a chm version:
http://us2.php.net/docs-echm.php

-nathan

  Réponse avec citation
Vieux 30/01/2008, 23h13   #35
Greg Donald
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On 1/30/08, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> up arrow works just fine. history is gone if it crashes, but
> if you exit gracefully, eg. with quit, then the history will be there.
> maybe youre using debian or some other silly os; i run gentoo


Gentoo is a damn fun distro I must admit.. but using it for anything
besides a development server seems very risky to me. You've got the
Gentoo creat0r running off to lick salt with the M$ weiners up in WA
right when Gentoo was peaking in popularity. In less than a year he
realizes his mistake and comes back crying wanting to control stuff
again as if he had never left. Then just recently the Gentoo
leadership forgot to renew the non-profit tax status paperwork!?!?
With all that spare time waiting for things to compile I figured they
wouldn't have forgotten about such an important task. Do they not
having meetings or whatever?

And where's my 2007.1 release? At the start we were getting a new
Gentoo release four times a year. Then it went to two, then last year
was just one. Contrary to what you may think, `emerge -uND` is not an
upgrade path, at least not for a serious server deployment. The
bottom line is emerge breaks things, and the older the Gentoo install,
the more likely the breakage will occur.

Why do I even have to deal with etc-update? Who has time for all that
silliness? Obviously you and not me, but that's life. Sooner or
later you too will get tired of cleaning up behind emerge. Took me
like two years I guess. I like my Linux stable, and Gentoo is not
stable, especially not right now.

> and there is no prob w/ php -a. although i wont lie; it seems to
> be jacked on all the debian systems ive tried


I compiled my PHP from source so the jacking may be of my own doing, I
don't know. See anything in my config that might prevent it from
working?

/configure --prefix=/usr/local/php5
--with-config-file-path=/usr/local/php5/lib
--with-apxs2=/usr/local/apache2/bin/apxs --with-gettext --with-gd
--with-jpeg-dir --with-png-dir --with-freetype-dir --with-xpm-dir
--with-mcrypt --with-mhash --with-curl --enable-mbstring --with-zlib
--enable-ftp --enable-sockets --enable-bcmath --with-bz2 --enable-zip
--with-mysql --without-iconv
--with-oci8=instantclient,/opt/oracle/instantclient_10_2
--with-pdo-oci=instantclient,/opt/oracle/instantclient_10_2,10.2
--with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-ldap
--with-openssl --with-ldap-sasl

> you can host the php docs on a local webserver if you like, or download
> them; there is even a chm version:
>
> http://us2.php.net/docs-echm.php


Right, but it's not integrated like gems are. When you install a gem
the docs are created by rdoc for you on the fly using the gem's Ruby
code itself. As a result you can't not get current api docs when you
install a gem.


--
Greg Donald
http://destiney.com/
  Réponse avec citation
Vieux 31/01/2008, 00h46   #36
Richard Lynch
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Wed, January 30, 2008 10:43 am, Nathan Nobbe wrote:
> On Jan 30, 2008 11:38 AM, Greg Donald <gdonald@gmail.com> wrote:
>
>> If list traffic is any sign, PHP is indeed slowing down from the
>> "new
>> peeps wanting to learn it" perspective:
>>
>> http://marc.info/?l=php-general&w=2

>
>
> interesting..


Perhaps everybody on the whole planet already knows php?

:-)

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
  Réponse avec citation
Vieux 31/01/2008, 01h36   #37
Richard Lynch
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Wed, January 30, 2008 1:33 pm, Greg Donald wrote:
> On Jan 30, 2008 12:40 PM, Nathan Nobbe <quickshiftin@gmail.com> wrote:
>> just pointing out that the rails guys dont have much wiggle room.
>> surely, youre familiar w/ this post:
>> http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html

>
> One article from one developer means what exaclty? Perhaps he wasn't
> writing enough lines of code per day to be stay happy using Rails?


Actually...

It meant a lot more to me than most other articles, since he clearly
gave Rails a fair tryout, and he doesn't claim "Rails Sucks" or
anything of the sort.

He just described exactly WHY Rails was not suitable for his needs, in
case your needs were similar.

I'd have to say that it's been the most meaningful
comparison/description of Rails I've ever seen :-)

I am biased, however, as I've known the guy since he started posting
on this very list (or perhaps its predecessor back when there was only
"one" PHP list) and I was answering his questions.

He's actually built a rather amazing site/business if you look into it...

http://cdbaby.com/about



--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
  Réponse avec citation
Vieux 31/01/2008, 01h58   #38
Richard Lynch
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Wed, January 30, 2008 1:44 pm, Nathan Nobbe wrote:
> when you said earlier that people arent interested in learning
> php, this is something i immediately thought of. primarily
> because spl debuted in php 5.0 and practically nobody is
> using it (which could just be my skewed perception) when it
> is extremely powerful.


I don't use SPL because it makes my head spin to read it, and I never
ever try to do something as silly as iterate over a *LARGE* array in
end-user pages.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

  Réponse avec citation
Vieux 31/01/2008, 02h21   #39
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

Greg Donald schreef:
> On Jan 30, 2008 1:36 PM, Eric Butera <eric.butera@gmail.com> wrote:
>> Thanks for your post. Competition is a good thing.

>
> I agree. PHP is the reason we're not all still working out of a cgi-bin.
>
>> Have you looked at the PHPUnit code coverage reports? Of course it
>> isn't built in like you say, which sounds pretty nice.
>> http://sebastian-bergmann.de/archive...PHPUnit-3.html

>
> If you only need to test data integrity then it seems good enough. I
> would argue that being able to test xhr requests is a basic
> requirement at this stage in web development.
>
>> What is the advantage of having integrated subversion/git? Using
>> stand-alone svn I can manage any files I want within projects using an
>> IDE or command line. Sometimes I don't want to commit directories or
>> new features yet and I can pick and choose my way.

>
> One command `cap deploy` to deploy all your code to multiple load
> balanced web servers, recipe style. Supports SSH, Subversion, web
> server clustering, etc. And the best thing about Capistrano is that
> it isn't Rails specific, you can use it for any sort of code rollout.
> The recipes are written in Ruby not some silly contrivance like XML.


I woke up from disturbed sleep thinking about how to manage stuff like
syncronized webserver restarts, config testing, caching clearance, etc.

I was going to ask but you've just pretty much answered the question ...
I guess it really is time to dust off those Ruby books and actually read them :-)

Greg's my hero of the day - even if he has been banging the Ruby drum on
the PHP Stage half the night ;-)

one thing I would offer as a solution to rolling out code to multiple servers,
GFS - as in all the load-balanced webservers 'mount' a GFS (http://www.redhat.com/gfs/)
and all the code/etc is on that - this means rolling out on one machine automatically
makes the new version available to all machines.

>
>
> --
> Greg Donald
> http://destiney.com/
>

  Réponse avec citation
Vieux 31/01/2008, 04h42   #40
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 7:58 PM, Richard Lynch <ceo@l-i-e.com> wrote:
> I don't use SPL because it makes my head spin to read it, and I never
> ever try to do something as silly as iterate over a *LARGE* array in
> end-user pages.


are there pages where you iterate over the same 'small' array more than
once? spl will definitely beat out the foreach performance over the arrays.

its really not that bad to learn, and once you have it down, its so easy.
you can decorate one thing w/ another to get new behavior at runtime.
suppose you have a structure, you want to get some stuff out of it. ok,
iterate over it, but wait you dont want all of it, wrap it in a FilterIterator,
but wait, you might need those results again, wrap it in a CachingIterator.
not only is the library seamless, but its faster than the stock stuff. and
it has lots of other useful features as well, besides the iterators.

-nathan
  Réponse avec citation
Vieux 31/01/2008, 04h45   #41
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 8:21 PM, Jochem Maas <jochem@iamjochem.com> wrote:
> Greg's my hero of the day - even if he has been banging the Ruby drum on
> the PHP Stage half the night ;-)


greg does seem to know a crap-ton about ruby, and gentoo even

> one thing I would offer as a solution to rolling out code to multiple servers,
> GFS - as in all the load-balanced webservers 'mount' a GFS (http://www.redhat.com/gfs/)
> and all the code/etc is on that - this means rolling out on one machine automatically
> makes the new version available to all machines.


heres my solution; portage. its essentially a customizable platform
for versioned software
distribution. sorry folks, youll need gentoo for that one
actually, they have it running on other os' as well, albiet not so great afaik.

-nathan
  Réponse avec citation
Vieux 31/01/2008, 04h58   #42
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

Nathan Nobbe schreef:
> On Jan 30, 2008 8:21 PM, Jochem Maas <jochem@iamjochem.com> wrote:
>> Greg's my hero of the day - even if he has been banging the Ruby drum on
>> the PHP Stage half the night ;-)

>
> greg does seem to know a crap-ton about ruby, and gentoo even
>
>> one thing I would offer as a solution to rolling out code to multiple servers,
>> GFS - as in all the load-balanced webservers 'mount' a GFS (http://www.redhat.com/gfs/)
>> and all the code/etc is on that - this means rolling out on one machine automatically
>> makes the new version available to all machines.

>
> heres my solution; portage. its essentially a customizable platform
> for versioned software
> distribution. sorry folks, youll need gentoo for that one
> actually, they have it running on other os' as well, albiet not so great afaik.


besides being a nightmare, portage doesn't answer the question of rolling out stuff
to multiple machines simultaneously.

>
> -nathan
>

  Réponse avec citation
Vieux 31/01/2008, 05h24   #43
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 10:58 PM, Jochem Maas <jochem@iamjochem.com> wrote:
> besides being a nightmare, portage doesn't answer the question of rolling out stuff
> to multiple machines simultaneously.


portage is one of the most elegant software distribution mechanisms
ever created.
and you dont have to have a cluster to leverage its usefulness. how
would i push
to multiple machines simultaneously, probly batch an emerge of the
latest version
of my code as soon as its available in my proprietary overlay. the
remote machines
periodically poll the source box for the latest version of the
overlay. when its available
they then run an install script which updates to w/e is specified by
the latest ebuild.
and you could easily embed 'instructions' in such overlays; like roll
back to version x,
in the event of a catastrophe; though i cant think if a great way to
force an immediate
rollback, at least not off the top of my head.
i mean, you could really build it yourself, especially since php is
just source files to
push around. but why reinvent the wheel, portage is already here and
it works great.

-nathan
  Réponse avec citation
Vieux 31/01/2008, 05h29   #44
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 30, 2008 5:13 PM, Greg Donald <gdonald@gmail.com> wrote:
> Gentoo is a damn fun distro I must admit.. but using it for anything
> besides a development server seems very risky to me. You've got the
> Gentoo creat0r running off to lick salt with the M$ weiners up in WA
> right when Gentoo was peaking in popularity. In less than a year he
> realizes his mistake and comes back crying wanting to control stuff
> again as if he had never left. Then just recently the Gentoo
> leadership forgot to renew the non-profit tax status paperwork!?!?
> With all that spare time waiting for things to compile I figured they
> wouldn't have forgotten about such an important task. Do they not
> having meetings or whatever?


its a real sob story isnt it? afaik, debian hit a pretty big trough a while
back before 4.0 came out. anyway, ill say this much; i go to php.net
one day, there is an announcment, php 5.2.5 released. so, instinctively,
i type emerge --sync; emerge php, and viola, php 5.2.5, customized for
my system, no sweat. debian has 5.2.4 in unstable atm; ouch.

> And where's my 2007.1 release? At the start we were getting a new
> Gentoo release four times a year.


live cd updates are mostly a convenience factor for new installs so they are
up to date w/o any subsequent installations. but ya; i guess its kinda lame.

> bottom line is emerge breaks things, and the older the Gentoo install,
> the more likely the breakage will occur.


it seems to be working pretty well for me. and ive worked at a couple of shops
that were free bsd / gentoo shops. really no worse off than the debian shop im
at now. in practice anyway.

> /configure --prefix=/usr/local/php5
> --with-config-file-path=/usr/local/php5/lib
> --with-apxs2=/usr/local/apache2/bin/apxs --with-gettext --with-gd
> --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xpm-dir
> --with-mcrypt --with-mhash --with-curl --enable-mbstring --with-zlib
> --enable-ftp --enable-sockets --enable-bcmath --with-bz2 --enable-zip
> --with-mysql --without-iconv
> --with-oci8=instantclient,/opt/oracle/instantclient_10_2
> --with-pdo-oci=instantclient,/opt/oracle/instantclient_10_2,10.2
> --with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-ldap
> --with-openssl --with-ldap-sasl


i dont know man, im not a c guy =/, but i did look at mine, built via portage.
it looks like i have --enable-cli which from my reading on the php.net site
is enabled by default since 4.3 and since i dont see --disable-cli in ur config
im assuming it has to be enabled; so really, your guess is as good as mine
i would assume --enable-cli adds support for the interactive interpreter..

-nathan
  Réponse avec citation
Vieux 31/01/2008, 09h19   #45
Zoltán Németh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

2008. 01. 30, szerda keltezéssel 13.01-kor Greg Donald ezt Ãrta:
> On Jan 30, 2008 12:15 PM, Zoltán Németh <znemeth@alterationx.hu> wrote:
> > > It's opinionated software and is certainly not for everyone.

> >
> > ok it's not for everyone, certainly not for me. but what is it from your
> > point of view that makes it a 'more interesting advance'?

>
> 1) Test driven development is built-in, and not just unit tests, but
> functional tests and integration tests too. In addition there's
> several plugins that extend your tests into realms you may not have
> thought of. There's Rcov which will tell you what code you haven't
> written test for. I know, you don't write tests. It's perfectly
> natural to not write tests when your framework doesn't support them
> out of the box.


nowadays I write tests, as I use symfony and it support tests. I also
use Selenium tests for functional testing.

>
> 2) Prototype and script.aculo.us are built-in. Not just included in
> the download but fully integrated into the models.
>
> Symphony tried to pull off the same thing with it's framework but it's
> fairly messy in my opinion.
>
> update_element_function('foo', array(
> 'content' => "New HTML",
> ));
>
> Compared to the Rails equivalent:
>
> page.replace_html 'foo', :html => 'New HTML'
>
> The other Javascript ers like observers for example are similarly
> very small.


well, symfony has prototype and script.aculo.us built-in. some of the
er functions may be clumsy a bit, but the ones I use most of the
time (link_to_remote, remote_function and the other ajax stuff) are
perfect for what they do

>
> 3) Database migrations that allow for versioned SQL. I can roll out
> new sql or roll back my broken sql with a single command.
>
> rake db:migrate VERISON=42
>
> I can rebuild my entire database from scratch:
>
> rake db:migrate VERISON=0; rake db:migrate
>
> The migrations are Ruby code that are very tight in syntax:
>
> class CreateSessions < ActiveRecord::Migration
>
> def self.up
> create_table :sessions do |t|
> t.string :session_id, :null => false
> t.datetime :updated_at, :null => false
> t.text :data
> end
> add_index :sessions, :session_id
> add_index :sessions, :updated_at
> end
>
> def self.down
> drop_table :sessions
> end
>
> end


that sounds good, I wish I would have it in symfony

>
> 4) Capistrano which is fully integrated with Subversion (and soon Git
> I heard) allows me to roll out a versioned copy of my application with
> a single command:
>
> cap deploy
>
> And then I can also rollback just as easily in case of an error:
>
> cap rollback


we use Git here, and for me a 'git clone' is perfect

>
> 5) Ruby on Rails has a built-in plugin architecture for adding vendor
> code. I can add new functionality to my app as easy as
>
> gem install acts_as_taggable
>
> or
>
> gem install pagination
>
> It's a bit like Perl's CPAN if you're familiar.
>
> There are also plugins, engines, and components depending on the level
> of integration you want the vendor code to have.


you can install plugins to symfony as well

>
> 6) Model validations extend into the view. No re-mapping of variables
> like with Smarty or some others I've tried.


> 7) The REST architecture is built-in to Rails. No more SOAP, unless
> you want it of course. No one's using it but it's there.
>


if I need it I can make it with symfony. if I don't need it I don't want
it there to be built in...


and, besides this, for smaller projects no damn framework would be
needed
in that case I'm sure php is better.

greets
Zoltán Németh

>
>
> --
> Greg Donald
> http://destiney.com/
>

  Réponse avec citation
Vieux 31/01/2008, 09h24   #46
Zoltán Németh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

2008. 01. 30, szerda keltezéssel 13.33-kor Greg Donald ezt Ãrta:
> On Jan 30, 2008 12:40 PM, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> > just pointing out that the rails guys dont have much wiggle room.
> > surely, youre familiar w/ this post:
> > http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html

>
> One article from one developer means what exaclty? Perhaps he wasn't
> writing enough lines of code per day to be stay happy using Rails?
>
> > > Propel still uses XML last I messed with it. Yaml is a lot better for
> > > similar tasks. The syntax is a lot smaller which makes it a lot
> > > faster than XML.

> > well lets see, it only reads the xml when the code is generated, which is not
> > that often so any slowness of xml is not valid. and last time i generated code
> > in my project it took like under 5 seconds; boy that xml sure was painful =/

>
> Well if all you do is toy projects then XML is fine.
>
> <user id="babooey" on="cpu1">
> <firstname>Bob</firstname>
> <lastname>Abooey</lastname>
> <department>adv</department>
> <cell>555-1212</cell>
> <address password="xxxx">ahunter@example1.com</address>
> <address password="xxxx">babooey@example2.com</address>
> </user>
>
> versus the Yaml equivalent:
>
> babooey:
> computer: cpu1
> firstname: Bob
> lastname: Abooey
> cell: 555-1212
> addresses:
> - address: babooey@example1.com
> password: xxxx
> - address: babooey@example2.com
> password: xxxx
>
>
> > Perfect example of an advance in web technology.
> > perfect example of something that doesnt make much difference.

>
> The time saved writing Yaml instead of XML makes a huge difference to
> me. Similar savings are to be had when comparing PHP to most anything
> except Java.


I never write the xml for propel. we use DBDesigner (although it is not
a well-written software, and there are problems with running it on
linux) and convert its xml files automatically to propel format. what's
more we have our schema generation stuff which joins together several
dbdesigner xmls (and generates code for some features propel does not
have like inheritance and multiple table referencing foreign keys)

however I agree in that yaml is cleaner and easier to write. but php can
use yaml if you have a yaml parser class in your framework, like symfony
has it.

greets
Zoltán Németh

>
>
> --
> Greg Donald
> http://destiney.com/
>

  Réponse avec citation
Vieux 31/01/2008, 15h41   #47
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] first php 5 class

On Jan 31, 2008 3:24 AM, Zoltán Németh <znemeth@alterationx.hu> wrote:

> I never write the xml for propel. we use DBDesigner (although it is not
> a well-written software, and there are problems with running it on
> linux) and convert its xml files automatically to propel format. what's
> more we have our schema generation stuff which joins together several
> dbdesigner xmls (and generates code for some features propel does not
> have like inheritance and multiple table referencing foreign keys)



thats great, i took a look at dbdesigner, though im not yet using it.
however, there is still the problem i indicated regarding existing
schemas. how would you generate a schema.xml file for an already
existing schema with a large number of tables?

-nathan
  Réponse avec citation
Vieux 31/01/2008, 15h45   #48