[PHP] php4 vs php5

2003-07-24 Thread Robert Janeczek
hi, i`m working on presentation of php5 features and i would like to add
some comparison between php4 and php5. new coding features are of course
available in doc on php.net, but i`m wondering where can i find benchmarks
that show speed differences between the two. if there are none i would like
to hear from core developers about which types (loops, math operations,
objects code) of code will show the differences so i could write my own
benchmark.

rash



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



[PHP] [bug?] good old upload problem

2003-07-30 Thread Robert Janeczek
php 4.2.3
apache 1.3.20

when uploading files bigger than limits set in php.ini warning is being
reported (in files) and no further script execution takes place. to be
specific - it looks like no execution is being made at all. i get 0 bytes
response. i don`t want to upload files bigger then limit tells, i just want
to display nice error message so user will know what hit him. is this
possible?

rash



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



[PHP] zend studio 2.0

2002-02-17 Thread robert janeczek

hi
i write in php about 1.5 years. from the beginning i use macromedia homesite
and i`m quite content of it. but...debugger, environment not optimized for
php developers etc. so i wanted to try zend studio, i downloaded it,
installed (w2k, i already had an apache, so i deleted what came with
installer). then: apache unstability, server downs, generaly - not usable.
so i uninstalled everything and came back to homesite.

i`ve read this (http://www.byte.com/documents/s=6975/byt1013213009328/)
article and now i look different on all of this. so - what`s your opinion -
is it good or bad tool. should i try again or wait for next version?

rashid



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




Re: [PHP] zend studio 2.0

2002-02-17 Thread robert janeczek

> Well I was hoping that article was interesting. It wasn't. I should
> have known when I saw the use of homesite as an alternative.

sure, it was just simple look at zend studio, but it made me wonder why the
tool didn`t work on my system :) [yes - i think i know what was wrong, no
need to look for bugs in zs2.0 :)]

> The article had this one interesting line:
>
> > Like many open-source languages, the biggest problem with PHP up until
> > recently has been a lack of tools.
>
> I guess knowledge and imagination doesn't count as tools.

debugger integrated with IDE does...

> I could be wrong. I've been developing websites for the last 7 years.
> I still use TextPad (coupled with Perl, and UNIX/LINUX) yet I
> develop on a windoze platform with cygwin installed.

what i need from my editor is:
- debugger
- color coding
- syntax check, just to spare time waiting for page showing that i forgot
')' in code

> I'd suggest using Perl to improve your productivity which I assume
> is the real question at hand.

hmmmlet`s say i prefer php.

> Will Zend make your more productive
> than homesite?

maybe...that`s what i want to know.

> Now I may be completely wrong. It's just that I've worked with
> people who use these GUI centric tools and they spend half their
> time in the air, waiting for their hand to move to and from mouse to
> keyboard.

i don`t want to have delphi-like ide, i want just a nice debugger with basic
options.

> Learn Perl, not to write cgi (god forbid, even I prefer PHP for this) or
> necessarily for mod_perl (very good) but just to generate code for
> yourself. Perl is an excellent tool but you can't get it with a GUI.
> You use text editors for which there is keyboard command for 99%
> of the actions you do.  If you already KNOW PHP then Perl will be
> simple.

i wrote few scripts in perl, i know it exists, i know i can use it if i
must, but, for now, i use php.

rash



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




Re: [PHP] zend studio 2.0

2002-02-18 Thread robert janeczek

> The problems you were having with the server components of the studio
sound
> quite odd - can you elaborate on them?  (probably off-list, it's best if
> you could submit a bug report about it through zend.com/store/pickup.php,
> evaluation support).
>
> This is water under the bridge now, but you could also install the server
> components of the studio onto your existing Apache installation instead of
> reinstalling it.  Maybe the uninstall/reinstall brought some mess into
your
> system...

like i wrote to zeev privately - it probably was my fault and i`ll try
installing again all the tools.

rash



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




[PHP] object variables declararing

2002-04-23 Thread robert janeczek

hi

have look at this code:

class test {
  function test(){
 //$this->a = 10;
 print_r($this);
  }

  function test2(){
 print_r($this);
  }
}

$t=new test();
$t->test2();

what do you see? empty object twice...
now uncomment the commented line. now the object got a variable - which is
quite unusual, because what`s the reason for declaring them with var keyword
except nice looking code? i uderstand on-the-flight creation of local
variables, but class variables? hm... can someone explain the reason of
enabling this possibility?

rash




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




[PHP] destructor not called for static members?

2005-03-10 Thread Robert Janeczek
am i missing something or destructor isn`t called for objects that are 
assigned to static fields in other objects? here is some example code:

class c1 {
  public function __destruct() {
echo '__destruct';
  }
}

class c2 {
  private static $_ref;
  public function __construct() {
self::$_ref = new c1();
//$this->_ref =  new c1();
  }
}
$obj = new c2();
unset($obj);
?>
i thought this should display __destruct in both cases from 
c2::__construct, but only the one with non static access seems to call 
c1::destruct. and if i remove unsetting $obj from the end of code this 
one also doesn`t work. is it expected behaviour? or maybe when 
__destructor is called after script finishes execution than output is no 
longer possible? i tried also send some information to file and this 
also didn`t work. help please :)

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


Re: [PHP] destructor not called for static members?

2005-03-10 Thread Robert Janeczek
[EMAIL PROTECTED] wrote:
Hi It is an expected behavior because when you define a static 
variableit is shared by all objects of the same class. If When you 
unset one object and the destruct of the static object will be
called, all the  other objects will lose the static var as well.
yes, but why destuctor isn`t called after all the execution is finished? 
i mean the moment when php does clean up before it finishes to process 
request?

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


[PHP] enterprise patterns headache

2005-04-13 Thread Robert Janeczek
Hi!
I`m currently working on PHP5-based extranet system which makes
intensive use of enterprise patterns. Some problems encountered during
developement cause serious haeadaches, but we`re going forward :)
I`m not 100% happy with architecture decisions we`ve made in the process
and therefore I came here to ask if maybe someone has better ideas than
we did.
Whole system is built on Data Mapper + Unit of Work + Identity Map +
Lazy Load base. Everything worked well until we started testing if lazy
loading is as lazy as it is supposed to be. We've used __set and __get
magic methods to automate loading data to ghost object when something
tried to access data inside. Yesterday was magic-methods-removal-day,
because we realized post-factum that using magic method sets a flag
blocking usage of another magic methods within that call. With high
encapsulation we were screwed - there was no way to assure not having
chained magic method calls (which still was far from being infinite
recurrency). __get returning null in such situations without any warning
caused many acts of disbelief in power of debugger among the developers
:] Yes, I know it`s all in comments to manual page. NOW I know that :]
Back to the architecture problem...
Inside mappers we have standard find($ID) methods returning ghosts of
real objects, which are filled at later time. Currently this mechanism
is implemented almost exacly as in Martin Fowler's sample code - by
adding notifyRead/notifyWrite in first line of public setters and
getters. This works nicely, collections of object also don`t cause
problems because they are not instantiated before we really need the
elements.
We also use separate methods for finding objects using criteria
different than just ID in database. So, some objects have
findByName($name) or findActive() methods which work very similiar to
find($ID) method, but use different queries. The problem with this
methods is the same thing which helps us very much in different parts of
application - Lazy Load.
Sample code:
$company = CompanyMapper::find(1); // we have ghost inside $company
//some other operations, but we don`t touch $company
$company2 = CompanyMapper::findByName('Big Ltd.');
Now let`s assume, that company with ID=1 has name Big Ltd. We have two
independent copies of the same object what kinda sucks :] The problem is
that both finding methods return ghosts and the second one doesn`t know
his ID yet. If there would be only ID-based searching than Identity Map
would detect it and caused returning the same instance, but it`s not...
Unfortunately, we cannot afford to loose lazy load for those searching
methods which use something different than ID. Our current solution is
putting every ghost object inside handler object, because it allows us
to switch object inside without rest of application noticing. This
however requires many classes with nothing more than bunch of methods
which transfer calls to another objects. We are working on piece of
code, which will use Reflection to autogenerate these classes, but still
it`s not very nice solution imho.
Long story short - what`s the best way to be able to load business
objects as ghosts using different criteria without problem with multiple
instances of the same object in the application.
rashid
ps. wow.. that was looong... :D
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] enterprise patterns headache

2005-04-14 Thread Robert Janeczek
On Wed, 13 Apr 2005, Richard Lynch wrote:
On Wed, April 13, 2005 2:01 pm, Robert Janeczek said:
I can't claim a detailed understanding of what you are doing, and,
frankly, it sounds like you are creating a BUNCH of over-engineered
headache-inducing code without a good, proven need for it.  YMVV.
The Upper Case Nice Names I used before are not really difficult to 
implement. Some of these patterns are even smaller than most 
implementations of GOF design patterns.

That said, one thing I *did* understand and can comment on:
Sample code:
$company = CompanyMapper::find(1); // we have ghost inside $company
//some other operations, but we don`t touch $company
$company2 = CompanyMapper::findByName('Big Ltd.');
Now let`s assume, that company with ID=1 has name Big Ltd. We have two
independent copies of the same object what kinda sucks :] The problem is
that both finding methods return ghosts and the second one doesn`t know
his ID yet. If there would be only ID-based searching than Identity Map
would detect it and caused returning the same instance, but it`s not...
So why not do this:
Make findByName look up the $ID with the query you already use, possibly
caching the other fields/data you use frequently in some kind of very temp
space: $row (array returned from query).
Then call CompanyMapper::find($ID, $row);
which uses the info it already has given for free in $row, but can also
check your cache of existing object, fill in any free data from $row, and
return the existing object if it's there.
The problem is that both finding methods don`t query the database when 
they are called. They just store information how can the database be 
queried to fetch the data which should be inside them. So - I don`t have 
ID inside $company2 unless I accessed it`s variables.

Perhaps a specialized object that manipulates/returns other objects based
on arguments is in order.  Instead of a zillion objects that all do that
same thing, only one for each real object, you have one that handles all
the other objects the same way, but trying to find the same object in your
cache first, then digging deeper into lazy load (or whatever) to build it.
That`s what Identity Map doing - it keeps track of all business objects 
inside application. Still - after doing find*() there is no way to tell 
that two variables are the same object inside until they are accessed. And 
after they are accessed it`s already to late, because we have two 
instances.

How certain are you that all this code is saving you *ANYTHING*?
Quite much :) Honestly - it`s a pleasure to write code for application 
using this architecture. Repetition of code is basicly non-existent, 
except for interfaces (which are generated automaticly anyway).

Is it worth the development/maintenance expense?
The expenses are not really high. The biggest problem is that if come to 
dead 
end somewhere than we have to look for solutions in java literature :] And 
of course it takes time for PHP developer to switch to using it, but 
that`s not different from any framework.

It`s worth the effort, trust me :)
rash
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php