OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 31 Jan 2008 07:14:07 -0000 Issue 5266

php-general-digest-helplists.php.net
Date: Thu Jan 31 2008 - 01:14:07 CST


php-general Digest 31 Jan 2008 07:14:07 -0000 Issue 5266

Topics (messages 268358 through 268415):

Re: first php 5 class
        268358 by: Greg Donald
        268360 by: Nathan Nobbe
        268361 by: Greg Donald
        268362 by: Eric Butera
        268363 by: Greg Donald
        268364 by: Nathan Nobbe
        268365 by: Greg Donald
        268366 by: Nathan Nobbe
        268367 by: Nathan Nobbe
        268368 by: Greg Donald
        268369 by: Greg Donald
        268370 by: Nathan Nobbe
        268371 by: Nathan Nobbe
        268372 by: Greg Donald
        268373 by: Nathan Nobbe
        268374 by: Greg Donald
        268375 by: Nathan Nobbe
        268376 by: Greg Donald
        268377 by: Isaac Gouy
        268380 by: Richard Lynch
        268384 by: Richard Lynch
        268390 by: Richard Lynch
        268396 by: Jochem Maas
        268407 by: Nathan Nobbe
        268408 by: Nathan Nobbe
        268409 by: Jochem Maas
        268410 by: Nathan Nobbe
        268411 by: Nathan Nobbe

Re: Help looking for inventory software
        268359 by: Bastien Koert

Re: Sum of results
        268378 by: Richard Lynch

Re: We need PHP/LAMP Developers and Programmers in FL, MD, VA,NY, DC, CA, MA!!!!
        268379 by: Manuel Lemos
        268405 by: resumes.worldnetjobs.com

Re: How can I do this -- method chaining
        268381 by: Richard Lynch
        268383 by: Chris
        268385 by: Richard Lynch
        268386 by: Richard Lynch
        268387 by: Chris
        268388 by: Jochem Maas
        268412 by: Casey
        268413 by: Nathan Nobbe

Re: Timeout while waiting for a server->client transfer to start (large files)
        268382 by: Richard Lynch
        268415 by: Per Jessen

Re: Another question about functions...
        268389 by: Richard Lynch

Re: php embeded in html after first submit html disappear
        268391 by: Janet N
        268399 by: Jochem Maas
        268406 by: Janet N
        268414 by: Nathan Nobbe

Re: Handle time-outs and errors with file()
        268392 by: Richard Lynch

Re: Framed & Linked Content
        268393 by: Richard Lynch
        268394 by: Richard Lynch
        268395 by: Michael McGlothlin

Re: curl timeout vs socket timeout
        268397 by: Richard Lynch

Re: determine file-upload's tmp-filename
        268398 by: Richard Lynch

Re: disable referer ? (was: Framed & Linked Content)
        268400 by: Richard Lynch
        268401 by: Richard Lynch

Re: Best Approach
        268402 by: Jochem Maas

Re: how dod you get to do multiple mysql queries concurrently?
        268403 by: Richard Lynch

Re: how do you get to do multiple mysql queries concurrently?
        268404 by: Richard Lynch

Administrivia:

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

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

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

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

attached mail follows:


On Jan 30, 2008 12:15 PM, Zoltán Németh <znemethalterationx.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.

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/

attached mail follows:


On Jan 30, 2008 1:29 PM, Greg Donald <gdonaldgmail.com> 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

attached mail follows:


On Jan 30, 2008 12:40 PM, Nathan Nobbe <quickshiftingmail.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/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">
  <firstname>Bob</firstname>
  <lastname>Abooey</lastname>
  <department>adv</department>
  <cell>555-1212</cell>
  <address password="xxxx">ahunterexample1.com</address>
  <address password="xxxx">babooeyexample2.com</address>
</user>

versus the Yaml equivalent:

babooey:
  computer: cpu1
  firstname: Bob
  lastname: Abooey
  cell: 555-1212
  addresses:
    - address: babooeyexample1.com
      password: xxxx
    - address: babooeyexample2.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.

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

attached mail follows:


On Jan 30, 2008 2:01 PM, Greg Donald <gdonaldgmail.com> wrote:
> On Jan 30, 2008 12:15 PM, Zoltán Németh <znemethalterationx.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.
>
> 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.

attached mail follows:


On Jan 30, 2008 12:40 PM, Nathan Nobbe <quickshiftingmail.com> 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/

attached mail follows:


On Jan 30, 2008 2:38 PM, Greg Donald <gdonaldgmail.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.

-nathan

attached mail follows:


On Jan 30, 2008 1:36 PM, Eric Butera <eric.buteragmail.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/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/

attached mail follows:


On Jan 30, 2008 2:33 PM, Greg Donald <gdonaldgmail.com> wrote:
> On Jan 30, 2008 12:40 PM, Nathan Nobbe <quickshiftingmail.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/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">
> <firstname>Bob</firstname>
> <lastname>Abooey</lastname>
> <department>adv</department>
> <cell>555-1212</cell>
> <address password="xxxx">ahunterexample1.com</address>
> <address password="xxxx">babooeyexample2.com</address>
> </user>
>
> versus the Yaml equivalent:
>
> babooey:
> computer: cpu1
> firstname: Bob
> lastname: Abooey
> cell: 555-1212
> addresses:
> - address: babooeyexample1.com
> password: xxxx
> - address: babooeyexample2.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 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

attached mail follows:


On Jan 30, 2008 2:55 PM, Greg Donald <gdonaldgmail.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

attached mail follows:


On 1/30/08, Nathan Nobbe <quickshiftingmail.com> wrote:
> On Jan 30, 2008 2:38 PM, Greg Donald <gdonaldgmail.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/

attached mail follows:


On 1/30/08, Nathan Nobbe <quickshiftingmail.com> wrote:
> On Jan 30, 2008 2:55 PM, Greg Donald <gdonaldgmail.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/

attached mail follows:


On Jan 30, 2008 3:11 PM, Greg Donald <gdonaldgmail.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

attached mail follows:


On Jan 30, 2008 3:22 PM, Greg Donald <gdonaldgmail.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

attached mail follows:


On 1/30/08, Nathan Nobbe <quickshiftingmail.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/

attached mail follows:


On Jan 30, 2008 3:34 PM, Greg Donald <gdonaldgmail.com> wrote:
> On 1/30/08, Nathan Nobbe <quickshiftingmail.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

attached mail follows:


On 1/30/08, Nathan Nobbe <quickshiftingmail.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/

attached mail follows:


On Jan 30, 2008 4:08 PM, Greg Donald <gdonaldgmail.com> wrote:
> On 1/30/08, Nathan Nobbe <quickshiftingmail.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

attached mail follows:


On 1/30/08, Nathan Nobbe <quickshiftingmail.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/

attached mail follows:


On 2008-01-30 18:29:57 Greg Donald wrote:
-snip-
> >
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all
> That benchmark doesn't include Ruby 1.9.

Now that the benchmarks game homepage

http://shootout.alioth.debian.org/

includes an A to Z list of language implementations you should find it
easier to see that Ruby 1.9 is in fact shown.

      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping

attached mail follows:


On Wed, January 30, 2008 10:43 am, Nathan Nobbe wrote:
> On Jan 30, 2008 11:38 AM, Greg Donald <gdonaldgmail.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?

attached mail follows:


On Wed, January 30, 2008 1:33 pm, Greg Donald wrote:
> On Jan 30, 2008 12:40 PM, Nathan Nobbe <quickshiftingmail.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/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?

attached mail follows:


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?

attached mail follows:


Greg Donald schreef:
> On Jan 30, 2008 1:36 PM, Eric Butera <eric.buteragmail.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/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/
>

attached mail follows:


On Jan 30, 2008 7:58 PM, Richard Lynch <ceol-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

attached mail follows:


On Jan 30, 2008 8:21 PM, Jochem Maas <jochemiamjochem.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

attached mail follows:


Nathan Nobbe schreef:
> On Jan 30, 2008 8:21 PM, Jochem Maas <jochemiamjochem.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
>

attached mail follows:


On Jan 30, 2008 10:58 PM, Jochem Maas <jochemiamjochem.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

attached mail follows:


On Jan 30, 2008 5:13 PM, Greg Donald <gdonaldgmail.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

attached mail follows:


check for code / systems on
 
www.hotscripts.com
http://sourceforge.net
 
hth
 
bastien> Date: Wed, 30 Jan 2008 19:14:57 +0100> From: zszalbotgmail.com> To: php-generallists.php.net> Subject: [PHP] Help looking for inventory software> > Hello,> > I am sorry if this is appropriate but does anyone know php based, open> source solution that would enable me to put a system handling> inventory (books, booklets). I work for a charity and we are archiving> our old products by making a digital archive. So far we have been> doing it in Excel but I would really like to move it to a relational> database (like mysql).> > Have been googling around for solution but without much luck. Anyway,> it does not have to be an inventory project. Even a modular system> that would allow me to design and generate php files, would be really,> really helpful.> > Sorry if this is wrong group to be asking such a question.> > Thank you in advance for any pointers!> > Zbigniew Szalbot> > -- > PHP General Mailing List (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>
_________________________________________________________________

attached mail follows:


On Wed, January 30, 2008 12:58 am, Dax Solomon Umaming wrote:
> Hi;
>
> I've tried Googling this out but failed to search for an answer to
> this, so
> I'm posting to this list. I'd like to know if there's a way to get the
> sum
> this results:
>
> // Results
> Individual Daily Consumption
> //AccountNo : Consumption
> 4146121002: 1.42
> 4146111002: 0.29
> 4146113002: 1.38
> 4146110002: 0.33
> 4146112002: 0.00
> 4146118002: 9.96
> == MORE ==
>
> // Code that generated the results
> while ($row6 = mysql_fetch_assoc($queryconsumerresults)) {
> // Show Consumer AccountNo and their Consumption
> echo $row6['AccountNo'] . ": " . sprintf("%1.2f",
> (((($row6['Reading'] +
> $row6['KwHrAdjustment']) - ($row6['Reading1'] +
> $row6['KwHrAdjustment1'])) /
> $noofdays) * $row6['Multiplier'])) . "<br />";
> }
>
> I've tried getting the sum() from the MySQL table, but Multiplier is
> either at
> 1 or 2 or 2.5 and the only way I can get an accurate total consumption
> is
> getting the sum from the results.

You should be able to use:
sum( (Reading + KwHrAdjustment - Reading1 + KwHrAdjustment1) /
$noofdays * Multiplier) from MySQL in another query...

But if you are already iterating through the results anyway, it's
probably just as easy to do:

$sum = 0;
while ($row6 = mysql_fetch_assoc(...)){
  $consumption = $row6['Reading'] + ...;
  $sum += $consumption;
}
echo "Total: $sum<hr />\n";

> Is there a way I can place this code on an array? I've tried using
> $indcons = array( sprintf("%1.2f", (((($row6['Reading'] + $row6
> ['KwHrAdjustment']) - ($row6['Reading1'] + $row6['KwHrAdjustment1']))
> /
> $noofdays) * $row6['Multiplier']))) but I've obviously failed.
>
> --
> Dax Solomon Umaming
> http://knightlust.com/
> GPG: 0x715C3547
>

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

attached mail follows:


Hello,

on 01/30/2008 01:52 PM PHP Employer said the following:
> We need PHP/LAMP Developers and Programmers in FL, MD, VA, NY, DC, CA, MA!!!!
>
> World NetMedia is a world class leader in the development of multimedia
> internet sites. We are seeking highly motivated individuals who eat, breath,
> and love the work they do. If you like working in a fun, laid-back, yet
> exciting environment; then we want to hear from you!

Have you looked at the PHP Professionals directory?

http://www.phpclasses.org/professionals/country/us/

--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

attached mail follows:


No, but we will. Thanks.

 

-----Original Message-----
From: Manuel Lemos [mailto:mlemosacm.org]
Sent: Wednesday, January 30, 2008 6:44 PM
To: PHP Employer
Cc: php-generallists.php.net
Subject: Re: [PHP] We need PHP/LAMP Developers and Programmers in FL, MD, VA,NY, DC, CA, MA!!!!

Hello,

on 01/30/2008 01:52 PM PHP Employer said the following:
> We need PHP/LAMP Developers and Programmers in FL, MD, VA, NY, DC, CA, MA!!!!
>
> World NetMedia is a world class leader in the development of multimedia
> internet sites. We are seeking highly motivated individuals who eat, breath,
> and love the work they do. If you like working in a fun, laid-back, yet
> exciting environment; then we want to hear from you!

Have you looked at the PHP Professionals directory?

http://www.phpclasses.org/professionals/country/us/

--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

attached mail follows:


On Wed, January 30, 2008 9:53 am, Stut wrote:
> The "forcing it out of scope" was the crux of my point. However, if
> Jochem is right then it's kinda pointless with the current
> implementation of the GC, but may become relevant in the new GC.

I dunno about the OOP instances getting GC'ed, but PHP *definitely*
reclaims memory from arrays and strings as they go out of scope,
usually.

You can work at something complicated enough to confuse it that it
won't reclaim it, but you have to work at it to get there.

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

attached mail follows:


> I dunno about the OOP instances getting GC'ed, but PHP *definitely*
> reclaims memory from arrays and strings as they go out of scope,
> usually.

Does anyone else find that funny? :)

It definitely does it ... usually ;)

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

attached mail follows:


I believe the constructor returns the object created, with no chance
in userland code of altering that fact, over-riding the return value,
or any other jiggery-pokery to that effect.

New causes the constructor to be called in the first place, and that's
about it.

The assignment to a variable is done by the assignment operator "="
and is not required if you don't have any need to actually keep the
object around in a variable.

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

attached mail follows:


On Wed, January 30, 2008 6:19 pm, Chris wrote:
>
>> I dunno about the OOP instances getting GC'ed, but PHP *definitely*
>> reclaims memory from arrays and strings as they go out of scope,
>> usually.
>
> Does anyone else find that funny? :)
>
> It definitely does it ... usually ;)

Ah well.

It definitely does it when it can, but you can confuse it with enough
circular references and large enough data structures that it ends up
with a giant mess of data it can't GC, because it's just not THAT
smart.

There are improvements coming in this area, I think, in PHP 6, if I
remember the posts to internals correctly.

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

attached mail follows:


Richard Lynch wrote:
>
> On Wed, January 30, 2008 6:19 pm, Chris wrote:
>>> I dunno about the OOP instances getting GC'ed, but PHP *definitely*
>>> reclaims memory from arrays and strings as they go out of scope,
>>> usually.
>> Does anyone else find that funny? :)
>>
>> It definitely does it ... usually ;)
>
> Ah well.

I was just picking on the phrasing, nothing else :)

> It definitely does it when it can, but you can confuse it with enough
> circular references and large enough data structures that it ends up
> with a giant mess of data it can't GC, because it's just not THAT
> smart.

Yep, they suck pretty hard and can be pretty hard to unravel at times
but that's another topic altogether.

> There are improvements coming in this area, I think, in PHP 6, if I
> remember the posts to internals correctly.

Awesome :)

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

attached mail follows:


Richard Lynch schreef:
> I believe the constructor returns the object created, with no chance
> in userland code of altering that fact, over-riding the return value,
> or any other jiggery-pokery to that effect.
>
> New causes the constructor to be called in the first place, and that's
> about it.
>
> The assignment to a variable is done by the assignment operator "="
> and is not required if you don't have any need to actually keep the
> object around in a variable.

I thought that's what I said. maybe less clearly :-)

>

attached mail follows:


On Jan 30, 2008 4:53 PM, Jochem Maas <jochemiamjochem.com> wrote:
> Richard Lynch schreef:
> > I believe the constructor returns the object created, with no chance
> > in userland code of altering that fact, over-riding the return value,
> > or any other jiggery-pokery to that effect.
> >
> > New causes the constructor to be called in the first place, and that's
> > about it.
> >
> > The assignment to a variable is done by the assignment operator "="
> > and is not required if you don't have any need to actually keep the
> > object around in a variable.
>
> I thought that's what I said. maybe less clearly :-)
>
>
> >

I don't think constructors return the object:

<?php
class foo {
         private $bar;
        public function __construct($bar) {
                 echo "In constructor\n";
                $this->bar = $bar;
        }
}

$x = new foo("...");
var_dump($x->__construct("....")); # NULL
?>

--
-Casey

attached mail follows:


On Jan 30, 2008 11:29 PM, Casey <heavyccaseygmail.com> wrote:
> I don't think constructors return the object:

im starting to think this as well.
what for example happens when there is not __construct() method ?

class Test {
   private $blah = '';
}

here $blah is part of a new instance, before __construct() would get called,
if it was defined. this makes me think php creates an internal object, and
optionally lets __construct() alter it if defined.
i think somebody may have already said that, but i didnt feel like wading
through the previous posts for it..

-nathan

attached mail follows:


On Tue, January 29, 2008 12:45 pm, Barney Tramble wrote:
> I have a script that I am trying to figure out to allow a remote file
> to
> be sent to a client's browser. It works ok for small files, but it
> keeps
> timing out for large files. I don't think it should even take as long
> as
> it does (i.e. about 10seconds) before it pops up a dialog box for me
> to
> download a 700KB file. Any ideas? It times out on a line around which
> reads
>
> while (!feof($fp))
> {
> $tmp .= fread($fp, 64);
> }

Your script is reading the whole file, 64 measly bytes at a time, into
a monstrous string $tmp.

Then, finally, when you've loaded the whole [bleep] file into RAM in
$tmp, you just echo it out, right?

Don't do that.

:-)

while (!feof($fp)){
  echo fread($fp, 2048);
}

You can play around with 2048 versus 64 versus 1000000 on your box to
see what's "fastest" but I'll be pretty shocked if 64 bytes is the
best performer...

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

attached mail follows:


Richard Lynch wrote:

> Your script is reading the whole file, 64 measly bytes at a time, into
> a monstrous string $tmp.
>
> Then, finally, when you've loaded the whole [bleep] file into RAM in
> $tmp, you just echo it out, right?
>
> Don't do that.
>
> :-)
>
> while (!feof($fp)){
> echo fread($fp, 2048);
> }

And if the OP is opening the file anyway, he might as well use
readfile() instead.

/Per Jessen, Zürich

attached mail follows:


On Tue, January 29, 2008 1:39 pm, Jason Pruim wrote:
> Okay, so I checked everything I can think of, and it's still
> downloading it as an application which means it's downloading the
> entire website instead of just the data from the database... Anyone
> have any idea what to check?

Can you explain what you mean by "downloading it as an application"?...

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

attached mail follows:


is it possible to use "input type="hidden" for signkey form and put it in
the register form before the submit button? I'm not sure but
is it possible to use hidden to make this work?

Thanks.

On Jan 30, 2008 3:16 AM, Jochem Maas <jochemiamjochem.com> wrote:

> Janet N schreef:
> > Hi there,
> >
> > I have two forms on the same php page. Both forms has php embeded
> inside
> > html with it's own submit button.
> >
> > How do I keep the second form from not disappearing when I click submit
> on
> > the first form? My issue is that when I click the submit button from
> the
> > first
> > form (register), the second form (signkey) disappear. Code below, any
> > feedback is appreciated:
>
> we the users clicks submit the form is submitted and a new page is
> returned. nothing
> you can do about that (unless you go the AJAX route, but my guess is
> that's a little
> out of your league given your question).
>
> why not just use a single form that they can fill in, nothing in the logic
> seems to require that they are seperate forms.
>
> BTW your not validating or cleaning your request data. what happens when I
> submit
> $_POST['domain'] with the following value?
>
> 'mydomain.com ; cd / ; rm -rf'
>
> PS - I wouldn't try that $_POST['domain'] value.
> PPS - font tags are so 1995
>
> >
> >
> > <form name="register" method="post" action="/DKIMKey.php">
> > <input type="submit" name="register" value="Submit Key">
> >
> > <?php
> > if (isset($_POST['register']))
> > {
> > $register = $_POST['register'];
> > }
> > if (isset($register))
> > {
> > $filename = '/usr/local/register.sh';
> > if(file_exists($filename))
> > {
> > $command = "/usr/local/register.sh ";
> > $shell_lic = shell_exec($command);
> > echo "<font size=2 color=blue>$shell_lic</font>";
> > }
> > }
> > ?>
> > </form>
> >
> >
> >
> > <form name="signkey" action="/DKIMKey.php" method="post"> <label
> > domain="label">Enter the domain name: </label>
> > <input name="domain" type="text"> <input type="submit"
> name="makesignkey"
> > value="Submit"
> >
> > <?php
> > if (isset($_POST['makesignkey']))
> > {
> > $makesignkey = $_POST['makesignkey'];
> > }
> > if (isset($makesignkey))
> > {
> > if(isset($_POST['domain']))
> > {
> > $filename = '/usr/local//keys/generatekeys';
> > if(file_exists($filename))
> > {
> > $domain = $_POST['domain'];
> > $command = "/usr/local/keys/generatekeys " . $domain;
> >
> > $shell_createDK = shell_exec($command);
> > print("<p><font size=2
> > color=blue>$shell_createDK</font></p>");
> > }
> > }
> > ?>
> > </form>
> >
>
>

attached mail follows:


Janet N schreef:
> is it possible to use "input type="hidden" for signkey form and put it in
> the register form before the submit button? I'm not sure but
> is it possible to use hidden to make this work?

what are you trying to do? do you want to have people fill in both forms
at once then process them serially (i.e. in 2 different requests) ...
if so then break up the forms in to 2 pages ... if not I can't figure out
what you want to do at all. please explain.

>
> Thanks.
>
> On Jan 30, 2008 3:16 AM, Jochem Maas <jochemiamjochem.com> wrote:
>
>> Janet N schreef:
>>> Hi there,
>>>
>>> I have two forms on the same php page. Both forms has php embeded
>> inside
>>> html with it's own submit button.
>>>
>>> How do I keep the second form from not disappearing when I click submit
>> on
>>> the first form? My issue is that when I click the submit button from
>> the
>>> first
>>> form (register), the second form (signkey) disappear. Code below, any
>>> feedback is appreciated:
>> we the users clicks submit the form is submitted and a new page is
>> returned. nothing
>> you can do about that (unless you go the AJAX route, but my guess is
>> that's a little
>> out of your league given your question).
>>
>> why not just use a single form that they can fill in, nothing in the logic
>> seems to require that they are seperate forms.
>>
>> BTW your not validating or cleaning your request data. what happens when I
>> submit
>> $_POST['domain'] with the following value?
>>
>> 'mydomain.com ; cd / ; rm -rf'
>>
>> PS - I wouldn't try that $_POST['domain'] value.
>> PPS - font tags are so 1995
>>
>>>
>>> <form name="register" method="post" action="/DKIMKey.php">
>>> <input type="submit" name="register" value="Submit Key">
>>>
>>> <?php
>>> if (isset($_POST['register']))
>>> {
>>> $register = $_POST['register'];
>>> }
>>> if (isset($register))
>>> {
>>> $filename = '/usr/local/register.sh';
>>> if(file_exists($filename))
>>> {
>>> $command = "/usr/local/register.sh ";
>>> $shell_lic = shell_exec($command);
>>> echo "<font size=2 color=blue>$shell_lic</font>";
>>> }
>>> }
>>> ?>
>>> </form>
>>>
>>>
>>>
>>> <form name="signkey" action="/DKIMKey.php" method="post"> <label
>>> domain="label">Enter the domain name: </label>
>>> <input name="domain" type="text"> <input type="submit"
>> name="makesignkey"
>>> value="Submit"
>>>
>>> <?php
>>> if (isset($_POST['makesignkey']))
>>> {
>>> $makesignkey = $_POST['makesignkey'];
>>> }
>>> if (isset($makesignkey))
>>> {
>>> if(isset($_POST['domain']))
>>> {
>>> $filename = '/usr/local//keys/generatekeys';
>>> if(file_exists($filename))
>>> {
>>> $domain = $_POST['domain'];
>>> $command = "/usr/local/keys/generatekeys " . $domain;
>>>
>>> $shell_createDK = shell_exec($command);
>>> print("<p><font size=2
>>> color=blue>$shell_createDK</font></p>");
>>> }
>>> }
>>> ?>
>>> </form>
>>>
>>
>

attached mail follows:


Hi Jochem,

Thanks for the prompt response. No I do not want people to fill in both
forms at once.

I actually have a three step process. I simplified it to two because if I
can get two steps to work, I should be good to go. Each step depends on the
preceding step having completed successfully. Users therefore need a
success message after each step is successfully completed. We cannot
require that users do all steps in one sitting. It must be possible to do
step one, leave, come back the next day and do 2,etc.

Because there is not enough to each step to justify a full web page devoted
to it alone, I have decided to keep all steps on one page.

Is there any way to use the "hidden" attribute of HTML variables to prevent
the output message from overwriting the page?

On Jan 30, 2008 5:30 PM, Jochem Maas <jochemiamjochem.com> wrote:

> Janet N schreef:
> > is it possible to use "input type="hidden" for signkey form and put it
> in
> > the register form before the submit button? I'm not sure but
> > is it possible to use hidden to make this work?
>
> what are you trying to do? do you want to have people fill in both forms
> at once then process them serially (i.e. in 2 different requests) ...
> if so then break up the forms in to 2 pages ... if not I can't figure out
> what you want to do at all. please explain.
>
> >
> > Thanks.
> >
> > On Jan 30, 2008 3:16 AM, Jochem Maas <jochemiamjochem.com> wrote:
> >
> >> Janet N schreef:
> >>> Hi there,
> >>>
> >>> I have two forms on the same php page. Both forms has php embeded
> >> inside
> >>> html with it's own submit button.
> >>>
> >>> How do I keep the second form from not disappearing when I click
> submit
> >> on
> >>> the first form? My issue is that when I click the submit button from
> >> the
> >>> first
> >>> form (register), the second form (signkey) disappear. Code below, any
> >>> feedback is appreciated:
> >> we the users clicks submit the form is submitted and a new page is
> >> returned. nothing
> >> you can do about that (unless you go the AJAX route, but my guess is
> >> that's a little
> >> out of your league given your question).
> >>
> >> why not just use a single form that they can fill in, nothing in the
> logic
> >> seems to require that they are seperate forms.
> >>
> >> BTW your not validating or cleaning your request data. what happens
> when I
> >> submit
> >> $_POST['domain'] with the following value?
> >>
> >> 'mydomain.com ; cd / ; rm -rf'
> >>
> >> PS - I wouldn't try that $_POST['domain'] value.
> >> PPS - font tags are so 1995
> >>
> >>>
> >>> <form name="register" method="post" action="/DKIMKey.php">
> >>> <input type="submit" name="register" value="Submit Key">
> >>>
> >>> <?php
> >>> if (isset($_POST['register']))
> >>> {
> >>> $register = $_POST['register'];
> >>> }
> >>> if (isset($register))
> >>> {
> >>> $filename = '/usr/local/register.sh';
> >>> if(file_exists($filename))
> >>> {
> >>> $command = "/usr/local/register.sh ";
> >>> $shell_lic = shell_exec($command);
> >>> echo "<font size=2 color=blue>$shell_lic</font>";
> >>> }
> >>> }
> >>> ?>
> >>> </form>
> >>>
> >>>
> >>>
> >>> <form name="signkey" action="/DKIMKey.php" method="post"> <label
> >>> domain="label">Enter the domain name: </label>
> >>> <input name="domain" type="text"> <input type="submit"
> >> name="makesignkey"
> >>> value="Submit"
> >>>
> >>> <?php
> >>> if (isset($_POST['makesignkey']))
> >>> {
> >>> $makesignkey = $_POST['makesignkey'];
> >>> }
> >>> if (isset($makesignkey))
> >>> {
> >>> if(isset($_POST['domain']))
> >>> {
> >>> $filename = '/usr/local//keys/generatekeys';
> >>> if(file_exists($filename))
> >>> {
> >>> $domain = $_POST['domain'];
> >>> $command = "/usr/local/keys/generatekeys " . $domain;
> >>>
> >>> $shell_createDK = shell_exec($command);
> >>> print("<p><font size=2
> >>> color=blue>$shell_createDK</font></p>");
> >>> }
> >>> }
> >>> ?>
> >>> </form>
> >>>
> >>
> >
>
>

attached mail follows:


On Jan 30, 2008 9:09 PM, Janet N <janet9kgmail.com> wrote:
> Because there is not enough to each step to justify a full web page devoted
> to it alone, I have decided to keep all steps on one page.

even if you manage this with a single php file, you should consider showing
only the relevant form for the given segment of the overall process to the user.
as a simple approach, you might have 2 functions, partA() and partB();
the former
would produce the first form, the later the second. this is not exactly what i
would do, but it should give you the idea of splitting things up in your code.

> Is there any way to use the "hidden" attribute of HTML variables to prevent
> the output message from overwriting the page?

that will allow you to have fields that do not display visibly but can pass data
to and from the browser like the other form inputs. you cannot use this to
capture data from a second form on the same page. as far as i know, only
the form information of the form corresponding to the submit button that was
pressed will be sent to the server. if you have another form on the page, even
if it has data filled in, that data will not be sent to the server
when the submit
button of another form is pressed.
you can see a simple example here:
    http://nathan.moxune.com/testForm.php?blah=sdfg

exactly what type of output message is overwriting the page?

-nathan

attached mail follows:


On Tue, January 29, 2008 9:58 am, John Papas wrote:
> I'm using file() to get the contents of a remote page in my script but
> I cannot find any information regarding how I could *gracefully*
> handle a broken network connection or even a time-out (slow
> connection).
>
> Is there a way?
>
> ---
> Example:
> $menu = file('http://www.remotesite.org/mypage.html');

Use http://php.net/set_error_handler

You can change the timeout with set_ini() right before the file() call.

If $menu === false, then it failed.

> foreach ($menu as $line_num => $line) {
> echo $line."\n";
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.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?

attached mail follows:


On Tue, January 29, 2008 9:21 am, Mike Potter wrote:
> There is JavaScript out there, to make a page break out of frames if
> someone else has your page in a frame of theirs.
> Is it possible to do this with PHP or is that the wrong side of
> Server/Client-side operations?

PHP is the wrong side of the tracks for that.

> Related, when target files are PDF's, images, or other than
> .php/.htm(l), does PHP provide any remedies against that
> sort of remote site linking?

Not really.

You can require a login or other authentication by using a PHP wrapper
that spews out the PDF/image/whatever.

But an HTTP request is an HTTP request which your server will respond
to unless you add logic in PHP to make it respond differently.

Nothing built-in; Just plenty of tools to build whatever you want.

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

attached mail follows:


On Tue, January 29, 2008 10:32 am, Per Jessen wrote:
> Robert Cummings wrote:
>
>> The only remedy agaonst remote linking is to embed some kind of
>> expiration in the link that accesses the document.
>
> Wouldn't a check of the REFERER field be enough to disable most remote
> links? (I know it is easily forged.)

Normal users also use browsers which choose not to send it all.

If you don't mind losing X% of your audience because they like to use
such a browser, you're all set... :-v

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

attached mail follows:


>>> The only remedy agaonst remote linking is to embed some kind of
>>> expiration in the link that accesses the document.
>>>
>> Wouldn't a check of the REFERER field be enough to disable most remote
>> links? (I know it is easily forged.)
>>
>
> Normal users also use browsers which choose not to send it all.
>
> If you don't mind losing X% of your audience because they like to use
> such a browser, you're all set... :-v
>
Yeah, those two people would be blocked. Wouldn't bother anyone else.
You can do it but it's not effective against people smart enough to
supply a fake referer. Often you'll just create more problems for
yourself than you'll really see benefit. It is useful sometimes though.

I'd do it at the webserver level though and not with PHP.

--
Michael McGlothlin
Southwest Plumbing Supply

attached mail follows:


On Mon, January 28, 2008 3:56 pm, Ravi Menon wrote:
> 1) curl:
>
> .
> .
> curl_setopt( $handle, CURLOPT_TIMEOUT, 1 );
> .
> .
> $resp = curl_exec($handle) <