Re: [PHP] first php 5 class

2008-01-31 Thread Zoltán Németh
2008. 01. 30, szerda keltezéssel 13.01-kor Greg Donald ezt írta:
 On Jan 30, 2008 12:15 PM, Zoltán Németh [EMAIL PROTECTED] 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 helpers like observers for example are similarly
 very small.

well, symfony has prototype and script.aculo.us built-in. some of the
helper 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/
 

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



Re: [PHP] first php 5 class

2008-01-31 Thread Zoltán Németh
2008. 01. 30, szerda keltezéssel 13.33-kor Greg Donald ezt írta:
 On Jan 30, 2008 12:40 PM, Nathan Nobbe [EMAIL PROTECTED] 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/2007/09/7_reasons_i_switched_back_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
   firstnameBob/firstname
   lastnameAbooey/lastname
   departmentadv/department
   cell555-1212/cell
   address password=[EMAIL PROTECTED]/address
   address password=[EMAIL PROTECTED]/address
 /user
 
 versus the Yaml equivalent:
 
 babooey:
   computer: cpu1
   firstname: Bob
   lastname: Abooey
   cell: 555-1212
   addresses:
 - address: [EMAIL PROTECTED]
   password: 
 - address: [EMAIL PROTECTED]
   password: 
 
 
  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/
 

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



Re: [PHP] first php 5 class

2008-01-31 Thread Zoltán Németh
2008. 01. 31, csütörtök keltezéssel 09.41-kor Nathan Nobbe ezt írta:
 On Jan 31, 2008 3:24 AM, Zoltán Németh [EMAIL PROTECTED] 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?

you mean you have a schema in a db with a bunch of tables? there is a
symfony task for that. symfony propel-build-schema

or if you use propel alone:
http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/HowTos/ExistingDatabases

greets
Zoltán Németh

 
 -nathan
 
 

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



Re: [PHP] first php 5 class

2008-01-31 Thread Nathan Nobbe
im curious, greg, what the ruby guys do for code documentation.
for php there is phpDocumentor or doxygen.  i like them both.
propel has support for the former so when i generate the code
from a schema.xml file, the next thing i do is generate the
phpDocumentor-based docs for my project which is just great.
for the documentation of code i write myself i use doxygen.
after looking over spl i decided to give it a try and i must say,
its pretty sweet.
im halfway anticipating you to tell me that rails has some other
feature built in for this :)

-nathan


Re: [PHP] first php 5 class

2008-01-31 Thread Nathan Nobbe
On Jan 31, 2008 3:24 AM, Zoltán Németh [EMAIL PROTECTED] 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


Re: [PHP] first php 5 class

2008-01-31 Thread Nathan Nobbe
On Jan 31, 2008 9:47 AM, Zoltán Németh [EMAIL PROTECTED] wrote:

 you mean you have a schema in a db with a bunch of tables? there is a
 symfony task for that. symfony propel-build-schema

 or if you use propel alone:

 http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/HowTos/ExistingDatabases


thanks man! ;)

-nathan


Re: [PHP] first php 5 class

2008-01-31 Thread Richard Lynch
On Wed, January 30, 2008 9:42 pm, Nathan Nobbe wrote:
 On Jan 30, 2008 7:58 PM, Richard Lynch [EMAIL PROTECTED] 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?

No.

 spl will definitely beat out the foreach performance over the
 arrays.

The performance is irrelevant unless it's the bottleneck, which it's not.

 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.

I tried several times to use SPL and SPL-like frameworks.

I always felt confused by the names, no matter how long I used them...

You are in a maze of twisty dark passages, all alike.

:-)

ymmv

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

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



Re: [PHP] first php 5 class

2008-01-31 Thread Greg Donald
On Jan 30, 2008 7:21 PM, Jochem Maas [EMAIL PROTECTED] wrote:
 Greg's my hero of the day - even if he has been banging the Ruby drum on
 the PHP Stage half the night ;-)

PHP is a great language.  I don't plan to stop using it anytime soon.


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Eric Butera
On Jan 29, 2008 3:29 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Jan 29, 2008 3:19 PM, nihilism machine [EMAIL PROTECTED] wrote:

  Ok, trying to write my first php5 class. This is my first project
  using all OOP PHP5.2.5.
 
  I want to create a config class, which is extended by a connection
  class, which is extended by a database class. Here is my config class,
  how am I looking?
 
  ?php
 
  class dbconfig {
 public $connInfo = array();
 public $connInfo[$hostname] = 'internal-db.s23499.gridserver.com';
 public $connInfo[$username] = 'db23499';
 public $connInfo[$password] = 'ryvx4398';
 public $connInfo[$database] = 'db23499_donors';
 
 public __construct() {
 return $this-$connInfo;
 }
  }
 
  ? http://www.php.net/unsub.php


 if youre going to have a class for configuration information; you probly
 should
 go for singleton:
 http://www.phppatterns.com/docs/design/singleton_pattern?s=singleton

 -nathan


Still pimping singleton, huh? :)

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 8:40 AM, Eric Butera [EMAIL PROTECTED] wrote:

 On Jan 29, 2008 3:29 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 Still pimping singleton, huh? :)


hell yeah :)

i looked at the registry classes you pointed out.
you know what funny about the one in solar?
they refer to the same article i mentioned, namely,
the article at the phppatterns site.  good to know
somebody else out there thinks highly of that site :)

also, i took a look (briefly though), in patterns of
enterprise architecture by martin fowler, which is
(perhaps) where the pattern was originally formalized.
he says that he prefers to have the data in the registry
stored in instance variables, but obviously there are ways
to vary the implementation of a pattern.  ergo, in his
design the registry class itself would be a singleton.

it looks like the 3 examples you showed previously, are
all of essentially the same design.  a class uses static
class members to store the data, and it is essentially
global, because well, any bit of code can reference the class.
id say the technique only works as a consequence of phps
dynamic nature, that is, in other languages like java and c++
i dont think you can create static class members on the fly.
the technique is certainly interesting.

-nathan


Re: [PHP] first php 5 class

2008-01-30 Thread Eric Butera
On Jan 30, 2008 9:57 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Jan 30, 2008 8:40 AM, Eric Butera [EMAIL PROTECTED] wrote:

 
 
  On Jan 29, 2008 3:29 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
  Still pimping singleton, huh? :)
 

 hell yeah :)

 i looked at the registry classes you pointed out.
 you know what funny about the one in solar?
 they refer to the same article i mentioned, namely,
 the article at the phppatterns site.  good to know
 somebody else out there thinks highly of that site :)

 also, i took a look (briefly though), in patterns of
 enterprise architecture by martin fowler, which is
 (perhaps) where the pattern was originally formalized.
 he says that he prefers to have the data in the registry
  stored in instance variables, but obviously there are ways
 to vary the implementation of a pattern.  ergo, in his
 design the registry class itself would be a singleton.

 it looks like the 3 examples you showed previously, are
  all of essentially the same design.  a class uses static
 class members to store the data, and it is essentially
 global, because well, any bit of code can reference the class.
 id say the technique only works as a consequence of phps
  dynamic nature, that is, in other languages like java and c++
 i dont think you can create static class members on the fly.
 the technique is certainly interesting.

 -nathan


The only gripe I have about the registry pattern is the lack of code
completion in PDT. ;)

I love php patterns, but it seems to sort of be dead for years now.

I just keep downloading copies of various frameworks and poke through
their implementations.  At the end of the day though it is my job to
write code, so I'm going to always balance the code purity vs getting
it done.  I am okay with a registry that uses static methods because
it works in my projects.  Some people would insist on being able to
create an instance and pass that around, but I don't need that level
of complexity.

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 10:35 AM, Eric Butera [EMAIL PROTECTED] wrote:

 The only gripe I have about the registry pattern is the lack of code
 completion in PDT. ;)


heh.  does that still blowup when you try to open a file w/ an interface
definition?


 I love php patterns, but it seems to sort of be dead for years now.


me too; ya, it is sort of dead, sad, but its still worth a look to people
getting
there feet wet w/ patterns, and occasionally as a point of reference for
patterns implemented in php.


 I just keep downloading copies of various frameworks and poke through
 their implementations.


this is a great idea, and youve got me doing more of it.


  At the end of the day though it is my job to
 write code, so I'm going to always balance the code purity vs getting
 it done.  I am okay with a registry that uses static methods because
 it works in my projects.


its sorta like the 'php way' for the registry.  theres something we can say
the java guys cant do ;)

  Some people would insist on being able to

 create an instance and pass that around, but I don't need that level
 of complexity.


i dont think Registry::getInstance() is really that much overhead; but it is
another line of code to write :)

-nathan


Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 10:13 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
  I love php patterns, but it seems to sort of be dead for years now.

 me too; ya, it is sort of dead, sad, but its still worth a look to people
 getting
 there feet wet w/ patterns, and occasionally as a point of reference for
 patterns implemented in php.

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-generalw=2

I would assume it's because there are much more interesting advances
in web development technology to focus on elsewhere.


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 11:38 AM, Greg Donald [EMAIL PROTECTED] 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-generalw=2


interesting..

http://marc.info/?l=php-generalw=2I would assume it's because there are
 much more interesting advances
 in web development technology to focus on elsewhere.


such as ?


-nathan


Re: [PHP] first php 5 class

2008-01-30 Thread Eric Butera
On Jan 30, 2008 11:43 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Jan 30, 2008 11:38 AM, Greg Donald [EMAIL PROTECTED] 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-generalw=2


 interesting..

 http://marc.info/?l=php-generalw=2I would assume it's because there are
  much more interesting advances
  in web development technology to focus on elsewhere.


 such as ?


 -nathan


No matter how fancy any scripting language is, it still just generates
(x)html.  :)  If you're more into ajax then json_encode() is really
all that you need, right?

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



Re: [PHP] first php 5 class

2008-01-30 Thread Eric Butera
On Jan 30, 2008 11:13 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 i dont think Registry::getInstance() is really that much overhead;

In my initial tests I found that static methods accessing $GLOBALS
directly was much faster than using an instance and working on it
tucked away in a static variable.  The getInstance() to pull and check
against the existence of the instance and creating it really added a
lot of extra code execution.

I use the intercept filter pattern on my code execution so that I can
set up different filters for authentication, authorization, gzip
output buffering, session management, etc based on my page needs.  I
then wrap that around a front controller.  So the registry has been
key in being able to push and pull data from many different scopes.
Then again sometimes I just use include files like the php patterns
site recommended[1].

Up until the start of this year my company was stuck in PHP4 since in
the real world clients don't want their sites to break because people
want the latest and greatest.  :)  A big reason I've had to dig around
is because I want to use the best ideas yet be able to run them on 4.
Now that we have 5 running everywhere it might be an option to
re-visit and use a fluent interface to do something like:

registry::getInstance()-get('foo');

I'd store the getInstance() instance in some sort of protected self::
accessed property and return if it exists or not.  Maybe when I get
some free time I'll do a benchmark to see how nasty that is versus
just using static methods.

PDT hasn't ever crashed on me, but now that I've typed that... ;D

[1] http://www.phppatterns.com/docs/design/the_front_controller_and_php

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 10:43 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
  I would assume it's because there are much more interesting advances
  in web development technology to focus on elsewhere.

 such as ?

Ruby 1.9, Ruby on Rails 2, Perl6/Parrot.

Parrot is particularly interesting, especially if your into
meta-languages or language creation in general.

http://destiney.com/blog/play-with-perl6-mac-os-x-leopard


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Zoltán Németh
2008. 01. 30, szerda keltezéssel 11.45-kor Greg Donald ezt írta:
 On Jan 30, 2008 10:43 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
   I would assume it's because there are much more interesting advances
   in web development technology to focus on elsewhere.
 
  such as ?
 
 Ruby 1.9, Ruby on Rails 2, Perl6/Parrot.

oh the Ruby and Rails stuff here it comes again... I really don't see
why is it a 'more interesting advance in web development technology'...
and what's more important for me, I really don't like it ;)

as for the new perl, it might worth a look, but I'm almost sure that it
won't replace PHP in what I am doing...

greets
Zoltán Németh

 
 Parrot is particularly interesting, especially if your into
 meta-languages or language creation in general.
 
 http://destiney.com/blog/play-with-perl6-mac-os-x-leopard
 
 
 -- 
 Greg Donald
 http://destiney.com/
 

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 12:45 PM, Greg Donald [EMAIL PROTECTED] wrote:

 On Jan 30, 2008 10:43 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
   I would assume it's because there are much more interesting advances
   in web development technology to focus on elsewhere.
 
  such as ?

 Ruby 1.9, Ruby on Rails 2, Perl6/Parrot.


i love how the ruby crew has 1 framework, whereas php has scads.
php affords the power of choice.
and last time i checked, php was a lot faster:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=alllang=all


 Parrot is particularly interesting, especially if your into
 meta-languages or language creation in general.

 http://destiney.com/blog/play-with-perl6-mac-os-x-leopard


parot does look interesting; but this is drifting from a particular web
technology.
there are many systems out there using the jvm to drop scripting languages
on
top, such as ibm project0, to name one; but i dont see these projects really
catching on.

also, if you want to see some code generation, php-style, check out propel
;)

-nathan


Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 11:52 AM, Zoltán Németh [EMAIL PROTECTED] wrote:
 oh the Ruby and Rails stuff here it comes again... I really don't see
 why is it a 'more interesting advance in web development technology'...
 and what's more important for me, I really don't like it ;)

It's opinionated software and is certainly not for everyone.


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Zoltán Németh
2008. 01. 30, szerda keltezéssel 12.03-kor Greg Donald ezt írta:
 On Jan 30, 2008 11:52 AM, Zoltán Németh [EMAIL PROTECTED] wrote:
  oh the Ruby and Rails stuff here it comes again... I really don't see
  why is it a 'more interesting advance in web development technology'...
  and what's more important for me, I really don't like it ;)
 
 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'?

greets
Zoltán Németh

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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 11:56 AM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 i love how the ruby crew has 1 framework, whereas php has scads.

Ruby has 7 frameworks that I know of: Nitro, IOWA, Ramaze, Cerise,
Ruby on Rails, Merb and Camping.

http://www.nitroproject.org/
http://enigo.com/projects/iowa/
http://ramaze.net/
http://cerise.rubyforge.org/
http://www.rubyonrails.org/
http://www.merbivore.com/
http://code.whytheluckystiff.net/camping

The most popular PHP frameworks are Rails clones it seems.  Zend's
best effort at a framework is an almost direct copy of the Mojavi
framework.

Further, if the number frameworks a language has is any measure of
that's language's quality or capabilities (clue: it isn't) then why
aren't you a Java guy?  It clearly has _more_ frameworks.

  php affords the power of choice.
 and last time i checked, php was a lot faster:

 http://shootout.alioth.debian.org/gp4/benchmark.php?test=alllang=all

That benchmark doesn't include Ruby 1.9.

 also, if you want to see some code generation, php-style, check out propel

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.  Perfect example of an advance in web technology.


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 12:15 PM, Zoltán Németh [EMAIL PROTECTED] 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.

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 helpers like observers for example are similarly
very small.

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

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

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.

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.



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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 1:29 PM, Greg Donald [EMAIL PROTECTED] wrote:
 Ruby has 7 frameworks that I know of: Nitro, IOWA, Ramaze, Cerise,
 Ruby on Rails, Merb and Camping.
 http://www.nitroproject.org/
 http://enigo.com/projects/iowa/
 http://ramaze.net/
 http://cerise.rubyforge.org/
 http://www.rubyonrails.org/
 http://www.merbivore.com/
 http://code.whytheluckystiff.net/camping

good for ruby, rails is the only one people ever mention.

 The most popular PHP frameworks are Rails clones it seems.
im no framework expert, but last time i checked one of the first guys
on the block was, struts, way back in the day.  and most frameworks
for the web are based on mvc, a concept from decades ago, not something
the ruby guys cooked up.

  Further, if the number frameworks a language has is any measure of
 that's language's quality or capabilities (clue: it isn't) then why
 aren't you a Java guy?

java is awesome, it just hasnt worked out for me career wise.

  It clearly has _more_ frameworks.

just pointing out that the rails guys dont have much wiggle room.
surely, youre familiar w/ this post:
http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

 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 =/

Perfect example of an advance in web technology.
perfect example of something that doesnt make much difference.

-nathan

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 12:40 PM, Nathan Nobbe [EMAIL PROTECTED] 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/2007/09/7_reasons_i_switched_back_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
  firstnameBob/firstname
  lastnameAbooey/lastname
  departmentadv/department
  cell555-1212/cell
  address password=[EMAIL PROTECTED]/address
  address password=[EMAIL PROTECTED]/address
/user

versus the Yaml equivalent:

babooey:
  computer: cpu1
  firstname: Bob
  lastname: Abooey
  cell: 555-1212
  addresses:
- address: [EMAIL PROTECTED]
  password: 
- address: [EMAIL PROTECTED]
  password: 


 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.


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 2:38 PM, Greg Donald [EMAIL PROTECTED] 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.

-nathan

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 1:36 PM, Eric Butera [EMAIL PROTECTED] 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/archives/578-Code-Coverage-Reports-with-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.


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 2:33 PM, Greg Donald [EMAIL PROTECTED] wrote:
 On Jan 30, 2008 12:40 PM, Nathan Nobbe [EMAIL PROTECTED] 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/2007/09/7_reasons_i_switched_back_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
   firstnameBob/firstname
   lastnameAbooey/lastname
   departmentadv/department
   cell555-1212/cell
   address password=[EMAIL PROTECTED]/address
   address password=[EMAIL PROTECTED]/address
 /user

 versus the Yaml equivalent:

 babooey:
   computer: cpu1
   firstname: Bob
   lastname: Abooey
   cell: 555-1212
   addresses:
 - address: [EMAIL PROTECTED]
   password: 
 - address: [EMAIL PROTECTED]
   password: 


  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 will concede that typing out the initial schema for my project was cumbersome.
however, once an initial schema is in place, its really not a hassle
add a table or
tweak the existing schema.
if  you were going to make a point that would have really hit, you
should have said
that propel doesnt support automatic generation of xml based on an existing db
schema.  qcodo does this, but then again, qcodo is a complete package, whereas
propel is strictly an orm layer. which is what i mostly prefer,
blending technologies
to suit my needs.  so the real drawback id charge propel w/ atm. is
the overhead for
an existing schema; say you have 100 tables, more even..  now that would be a
real pain to build the schema.xml file for.  of course you can always
use it as an
excuse to scrub the cruft off your database schema, right ? ;)

-nathan

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On Jan 30, 2008 12:40 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
 java is awesome, it just hasnt worked out for me career wise.

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/


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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Eric Butera
On Jan 30, 2008 2:01 PM, Greg Donald [EMAIL PROTECTED] wrote:
 On Jan 30, 2008 12:15 PM, Zoltán Németh [EMAIL PROTECTED] 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.

 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 helpers like observers for example are similarly
 very small.

 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

 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

 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.

 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.




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

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



Thanks for your post.  Competition is a good thing.

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/archives/578-Code-Coverage-Reports-with-PHPUnit-3.html

Making applications spit out Js just seems like a bad idea.  I haven't
seen the way it works, but it seems like you'd have a lack of
flexibility.  If I want to use JS I just symlink whatever copy of YUI
I want into a directory on my server and start using it.

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.


Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 2:55 PM, Greg Donald [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On 1/30/08, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Jan 30, 2008 2:38 PM, Greg Donald [EMAIL PROTECTED] 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/

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On 1/30/08, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Jan 30, 2008 2:55 PM, Greg Donald [EMAIL PROTECTED] 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/

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 3:11 PM, Greg Donald [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 3:22 PM, Greg Donald [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 3:34 PM, Greg Donald [EMAIL PROTECTED] wrote:
 On 1/30/08, Nathan Nobbe [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 4:08 PM, Greg Donald [EMAIL PROTECTED] wrote:
 On 1/30/08, Nathan Nobbe [EMAIL PROTECTED] 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


Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On 1/30/08, Nathan Nobbe [EMAIL PROTECTED] 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/

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On 1/30/08, Nathan Nobbe [EMAIL PROTECTED] 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/

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



Re: [PHP] first php 5 class

2008-01-30 Thread Greg Donald
On 1/30/08, Nathan Nobbe [EMAIL PROTECTED] 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/

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



Re: [PHP] first php 5 class

2008-01-30 Thread Richard Lynch
On Wed, January 30, 2008 10:43 am, Nathan Nobbe wrote:
 On Jan 30, 2008 11:38 AM, Greg Donald [EMAIL PROTECTED] 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-generalw=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?

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



Re: [PHP] first php 5 class

2008-01-30 Thread Richard Lynch
On Wed, January 30, 2008 1:33 pm, Greg Donald wrote:
 On Jan 30, 2008 12:40 PM, Nathan Nobbe [EMAIL PROTECTED] 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/2007/09/7_reasons_i_switched_back_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?

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



Re: [PHP] first php 5 class

2008-01-30 Thread Richard Lynch
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?


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



Re: [PHP] first php 5 class

2008-01-30 Thread Jochem Maas

Greg Donald schreef:

On Jan 30, 2008 1:36 PM, Eric Butera [EMAIL PROTECTED] 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/archives/578-Code-Coverage-Reports-with-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/



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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 8:21 PM, Jochem Maas [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 7:58 PM, Richard Lynch [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Jochem Maas

Nathan Nobbe schreef:

On Jan 30, 2008 8:21 PM, Jochem Maas [EMAIL PROTECTED] 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



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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 10:58 PM, Jochem Maas [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-30 Thread Nathan Nobbe
On Jan 30, 2008 5:13 PM, Greg Donald [EMAIL PROTECTED] 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

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



Re: [PHP] first php 5 class

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 3:19 PM, nihilism machine [EMAIL PROTECTED] wrote:

 Ok, trying to write my first php5 class. This is my first project
 using all OOP PHP5.2.5.

 I want to create a config class, which is extended by a connection
 class, which is extended by a database class. Here is my config class,
 how am I looking?

 ?php

 class dbconfig {
public $connInfo = array();
public $connInfo[$hostname] = 'internal-db.s23499.gridserver.com';
public $connInfo[$username] = 'db23499';
public $connInfo[$password] = 'ryvx4398';
public $connInfo[$database] = 'db23499_donors';

public __construct() {
return $this-$connInfo;
}
 }

 ? http://www.php.net/unsub.php


if youre going to have a class for configuration information; you probly
should
go for singleton:
http://www.phppatterns.com/docs/design/singleton_pattern?s=singleton

-nathan


Re: [PHP] first php 5 class

2008-01-29 Thread Jochem Maas

nihilism machine schreef:
Ok, trying to write my first php5 class. This is my first project using 
all OOP PHP5.2.5.


I want to create a config class, which is extended by a connection 
class, which is extended by a database class. Here is my config class, 
how am I looking?


dunno can't see you. but your class looks like crap, in fact it don't think it
will even parse. have you tried running it?



?php

class dbconfig {
public $connInfo = array();
public $connInfo[$hostname] = 'internal-db.s23499.gridserver.com';
public $connInfo[$username] = 'db23499';
public $connInfo[$password] = 'ryvx4398';
public $connInfo[$database] = 'db23499_donors';


the above is plain wrong.

1. you can't do multiple property definitions for a single [array] property
2. your storing hardcoded values in a class which is meant to be somewhat 
generic/reusable
3. you've just told the world your password/login/db credentials



public __construct() {
return $this-$connInfo;
}


constructors aren't meant to return anything. besides you won't be able to
retrieve the returned value.

not too mention '$this-$connInfo' is the wrong syntax it should be:

$this-connInfo

I'd recommend some more research on basic class syntax.


}

?



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