php-general Digest 18 Jun 2007 13:25:23 -0000 Issue 4855

Topics (messages 257248 through 257277):

Controlling project version
        257248 by: Miguel Vaz
        257250 by: Larry Garfield
        257251 by: Jim Lucas
        257252 by: Chris
        257256 by: Stut
        257258 by: Chris
        257259 by: Stut
        257261 by: Chris
        257262 by: clive
        257266 by: Colin Guthrie
        257272 by: Jochem Maas
        257273 by: Shafiq Rehman
        257275 by: Colin Guthrie

Re: Unable to use exec() in php
        257249 by: Jim Lucas
        257254 by: makhan
        257257 by: Jim Lucas
        257260 by: Crayon Shin Chan

Re: Php script diagnostic app?
        257253 by: Paul Scott
        257255 by: Paul Scott

Re: pack vs. serialize
        257263 by: Richard Heyes

Re: if test
        257264 by: Jochem Maas

Re: [BULK]  Re: [PHP] OK to have many files in one folder?
        257265 by: clive
        257267 by: Colin Guthrie

Edinburgh, Scotland: PHP Developer Position
        257268 by: Colin Guthrie
        257277 by: Tijnema

Session persistent objects
        257269 by: Markus Feier
        257271 by: Stut
        257274 by: Stut

Re: generating an html intro text ...
        257270 by: Jochem Maas
        257276 by: Edward Kay

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---

        Hi,

I recently finished a project for our local city hall and some people asked me to do some version control for future updates. They suggested the use of a linux script called Recursive Version Control, which i never even heard anything about.

What do you guys/girls use out there? Subversion? CVS? Is there a point in using some linux script versus a "proper" program?

        Would really appreciate some input on this. On everything works, etc. 
Thanks.


        Miguel Vaz

--- End Message ---
--- Begin Message ---
Never heard of RVC.  I use subversion both at work and for my personal stuff.  
Fairly easy to setup once you understand it, fairly easy to use, good command 
line and GUI tools to suit your preference.

On Sunday 17 June 2007, Miguel Vaz wrote:
>       Hi,
>
>       I recently finished a project for our local city hall and some
> people asked me to do some version control for future updates. They
> suggested the use of a linux script called Recursive Version Control,
> which i never even heard anything about.
>
>       What do you guys/girls use out there? Subversion? CVS? Is there a
> point in using some linux script versus a "proper" program?
>
>       Would really appreciate some input on this. On everything works, etc.
> Thanks.
>
>
>       Miguel Vaz


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Miguel Vaz wrote:

    Hi,

I recently finished a project for our local city hall and some people asked me to do some version control for future updates. They suggested the use of a linux script called Recursive Version Control, which i never even heard anything about.

What do you guys/girls use out there? Subversion? CVS? Is there a point in using some linux script versus a "proper" program?

Would really appreciate some input on this. On everything works, etc. Thanks.


    Miguel Vaz

well, since google know nothing of this "linux script", I would be less likely to use it versus a well know prog like CVS or Subversion.

I prefer CVS.

Since you are working with a completed project, for the most part, I would recommend CVS.

One major pitfall that could arise is if you needed to change a directory name. It isn't too easy to do this with CVS, but it is fairly easy with Subversion.

Others may have different opinions about the two mentioned version control system, or suggest a different approach all together. But CVS is what I use, and it seems to work fine in all my projects just fine.

Jim

--- End Message ---
--- Begin Message ---
Miguel Vaz wrote:

    Hi,

I recently finished a project for our local city hall and some people asked me to do some version control for future updates. They suggested the use of a linux script called Recursive Version Control, which i never even heard anything about.

Sure you don't mean RCS ? http://www.gnu.org/software/rcs/ Never used it.

What do you guys/girls use out there? Subversion? CVS? Is there a point in using some linux script versus a "proper" program?

You won't get any sort of revision control with just a script, you need a "proper program" like either cvs or subversion or one of the others (some are commercial - eg bitkeeper).

I use cvs at work (because it was more mature at the time I set it up) and subversion at home.

They are close enough that what you know in one will work in the other for the most part.

Subversion has a few more features (eg renaming a folder in the repository).

I don't like the branching in subversion, it's a lot easier to work with in CVS.

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

--- End Message ---
--- Begin Message ---
Chris wrote:
> Miguel Vaz wrote:
>>
>>     Hi,
>>
>>     I recently finished a project for our local city hall and some
>> people asked me to do some version control for future updates. They
>> suggested the use of a linux script called Recursive Version Control,
>> which i never even heard anything about.
> 
> Sure you don't mean RCS ? http://www.gnu.org/software/rcs/ Never used it.

Sure you have, you just don't realise it.

>>     What do you guys/girls use out there? Subversion? CVS? Is there a
>> point in using some linux script versus a "proper" program?
> 
> You won't get any sort of revision control with just a script, you need
> a "proper program" like either cvs or subversion or one of the others
> (some are commercial - eg bitkeeper).

I fail to see the difference between "just a script" and "a proper
program", but regardless...

> I use cvs at work (because it was more mature at the time I set it up)
> and subversion at home.

CVS wraps RCS, so you have used it!

> They are close enough that what you know in one will work in the other
> for the most part.
> 
> Subversion has a few more features (eg renaming a folder in the
> repository).

There's a little more to it than that. In CVS folders are not tracked at
all. In Subversion they are treated like files, and therefore have their
own history. One of the major effects of this is that you can have empty
folders in your repository - something I usually have in most of my
projects, but that CVS insisted on having a file inside before it would
retain the fact the folder exists.

> I don't like the branching in subversion, it's a lot easier to work with
> in CVS.

That's odd since this is one of the major advantages that Subversion has
over CVS (for me at any rate). When you branch or tag in CVS it will sit
there and create a copy of every single file in the repository.
Depending on the size of your projects this can take a while.

Subversion can create a tag or a branch instantly regardless of the size
of the repository. It does this by using a mechanism akin to pointers.
It doesn't actually create a copy of the files until you commit a change
in a tag or a branch.

Personally I used to use CVS until I discovered Subversion, and I've
never looked back. However, I am now looking forward and have recently
started playing with Git. Git is something of a paradigm shift when
compared to "traditional" source control, but the way it works is
starting to make a lot of sense to me. I suggest you include it in your
evaluations before deciding on a source control system.

http://git.or.cz/

-Stut

-- 
http://stut.net/

--- End Message ---
--- Begin Message ---

I fail to see the difference between "just a script" and "a proper
program", but regardless...

I think of a "script" as something like a firewall script - where-as cvs/subversion have a bunch of different commands to do different things.

All interpretation I guess :P

I use cvs at work (because it was more mature at the time I set it up)
and subversion at home.

CVS wraps RCS, so you have used it!

OK I haven't used RCS *directly* - Happy? ;)

I don't like the branching in subversion, it's a lot easier to work with
in CVS.

That's odd since this is one of the major advantages that Subversion has
over CVS (for me at any rate). When you branch or tag in CVS it will sit
there and create a copy of every single file in the repository.
Depending on the size of your projects this can take a while.

Maybe it's just the whole structure thing I don't understand:

http://svnbook.red-bean.com/nightly/en/svn.tour.importing.html#svn.tour.importing.layout

If you already have your project in subversion, how do you branch it?

Compare that to:

cvs tag -b "branch name" module_name

;)

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

--- End Message ---
--- Begin Message ---
Chris wrote:
That's odd since this is one of the major advantages that Subversion has
over CVS (for me at any rate). When you branch or tag in CVS it will sit
there and create a copy of every single file in the repository.
Depending on the size of your projects this can take a while.

Maybe it's just the whole structure thing I don't understand:

http://svnbook.red-bean.com/nightly/en/svn.tour.importing.html#svn.tour.importing.layout
If you already have your project in subversion, how do you branch it?

Compare that to:

cvs tag -b "branch name" module_name

;)

Ok, this is where you need to understand the fundamental difference between how CVS and Subversion work. For CVS branching and tagging are operations in themselves. In Subversion they're just copies. How you layout your repository is up to you, but the recommended layout is usually used because you need somewhere in the repository to put branches and tags.

As for how to do it... think of it as simply copying files and it should make sense...

svn copy svn+ssh://server/repos/trunk svn+ssh://server/repos/tags/mytag

So, that wasn't too hard was it? It's different to CVS, and it does require that you think about your repositories in a slightly different way, but to me it's a lot more flexible and it's definitely more efficient than CVS. But it's all down to personal choice.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Stut wrote:
Chris wrote:
That's odd since this is one of the major advantages that Subversion has
over CVS (for me at any rate). When you branch or tag in CVS it will sit
there and create a copy of every single file in the repository.
Depending on the size of your projects this can take a while.

Maybe it's just the whole structure thing I don't understand:

http://svnbook.red-bean.com/nightly/en/svn.tour.importing.html#svn.tour.importing.layout
If you already have your project in subversion, how do you branch it?

Compare that to:

cvs tag -b "branch name" module_name

;)

Ok, this is where you need to understand the fundamental difference between how CVS and Subversion work. For CVS branching and tagging are operations in themselves. In Subversion they're just copies. How you layout your repository is up to you, but the recommended layout is usually used because you need somewhere in the repository to put branches and tags.

As for how to do it... think of it as simply copying files and it should make sense...

svn copy svn+ssh://server/repos/trunk svn+ssh://server/repos/tags/mytag

That does make sense - it's just a pain to re-do a repository if you didn't set it up properly in the first place (which I never thought I'd have to do for a version control system).

Anyway thanks for the tip ;)

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

--- End Message ---
--- Begin Message ---
svn is what I prefer.

clive

--- End Message ---
--- Begin Message ---
Stut wrote:
>> I don't like the branching in subversion, it's a lot easier to work with
>> in CVS.
> 
> That's odd since this is one of the major advantages that Subversion has
> over CVS (for me at any rate). When you branch or tag in CVS it will sit
> there and create a copy of every single file in the repository.
> Depending on the size of your projects this can take a while.

Can't agree more with you Stut!

I've used CVS and Subversion quite a lot for a number of years. All my
live sites are just svn checkouts these days - makes deployment very simple.

The branching in Subversion is a gazillion times better than CVS if you
take a bit of time really reading the SVN Book (linked earlier). I sat
down and read it properly and have a pretty good understanding of the
branching and merging procedure and find it very intuitive now. CVS's
branching was always a bit of a dark art to me!

> Personally I used to use CVS until I discovered Subversion, and I've
> never looked back. However, I am now looking forward and have recently
> started playing with Git. Git is something of a paradigm shift when
> compared to "traditional" source control, but the way it works is
> starting to make a lot of sense to me. I suggest you include it in your
> evaluations before deciding on a source control system.

Yeah I need to learn Git too for various projects I work on (Xorg and
compiz/beryl stuff mainly), but it's maybe not the best utility for
website development.

With Git, you keep a full copy (or clone) of the RCS on your local
machine (this means all the changes you ever made!). This can take up a
lot of space for web work with e.g. large graphic files all over the
place (although there are ways to compress down/flatten a git repo).
With Subversion, you'll pretty much need double the space as it keeps a
"clean" copy of all files in addition to the ones you can work on.

With SVN you can do a modicum of offline work - make changes revert to
clean copy, see your changes to the repository (svn diff). With CVS you
have to be online to do this.

With wrappers to SVN like SVK you can also get some of the Git benefits
(and drawbacks) with SVN.

One other good thing about Subversion is the flexibility of it's hooks.
You can setup scripts to automatically deploy your changes to a live
environment. It's ace!

If you are using an interal Wiki, Ticket system I can thoroughly
recommend Trac for this. It has excellent integration with Subversion.

Hope that helps.

Col

--- End Message ---
--- Begin Message ---
Colin Guthrie wrote:
> Stut wrote:
>>> I don't like the branching in subversion, it's a lot easier to work with
>>> in CVS.

<snip lots of interesting stuff about SVN in action>...

> 
> One other good thing about Subversion is the flexibility of it's hooks.
> You can setup scripts to automatically deploy your changes to a live
> environment. It's ace!

2 points I'd like to make:

1. I'd be very wary of using an auto deployment script that is triggered
upon check in unless the deployment was only to test system. I think that
deployment to a production env should have at least one step that requires
human intervention - at the very least you have someone to blame if the shit 
hits
the fan.**

2. CVS has wrapper/hook scripts that can also do tasks like this - although I
gather that SVN's implementation is friendly & more manageable.

> 
> If you are using an interal Wiki, Ticket system I can thoroughly
> recommend Trac for this. It has excellent integration with Subversion.
> 
> Hope that helps.
> 

** 'shit hits the fan' reminds me of something I saw in a LIDL supermarket -
they had a ripoff version of 'PomBaer' crisps (potato chips) which was called
'Bears Hit' ... I kid you not! now you too can say with confidence, 'I feel
like eating some bear shit' :->

--- End Message ---
--- Begin Message ---
Hello,

I use CVS in office and home

--
Shafiq Rehman (ZCE)
http://www.phpgurru.com | http://shafiq.pk
Cell: +92 300 423 9385


On 6/18/07, Jochem Maas <[EMAIL PROTECTED]> wrote:

Colin Guthrie wrote:
> Stut wrote:
>>> I don't like the branching in subversion, it's a lot easier to work
with
>>> in CVS.

<snip lots of interesting stuff about SVN in action>...

>
> One other good thing about Subversion is the flexibility of it's hooks.
> You can setup scripts to automatically deploy your changes to a live
> environment. It's ace!

2 points I'd like to make:

1. I'd be very wary of using an auto deployment script that is triggered
upon check in unless the deployment was only to test system. I think that
deployment to a production env should have at least one step that requires
human intervention - at the very least you have someone to blame if the
shit hits
the fan.**

2. CVS has wrapper/hook scripts that can also do tasks like this -
although I
gather that SVN's implementation is friendly & more manageable.

>
> If you are using an interal Wiki, Ticket system I can thoroughly
> recommend Trac for this. It has excellent integration with Subversion.
>
> Hope that helps.
>

** 'shit hits the fan' reminds me of something I saw in a LIDL supermarket
-
they had a ripoff version of 'PomBaer' crisps (potato chips) which was
called
'Bears Hit' ... I kid you not! now you too can say with confidence, 'I
feel
like eating some bear shit' :->

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



--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
> Colin Guthrie wrote:
>> One other good thing about Subversion is the flexibility of it's hooks.
>> You can setup scripts to automatically deploy your changes to a live
>> environment. It's ace!
> 
> 2 points I'd like to make:
> 
> 1. I'd be very wary of using an auto deployment script that is triggered
> upon check in unless the deployment was only to test system. I think that
> deployment to a production env should have at least one step that requires
> human intervention - at the very least you have someone to blame if the shit 
> hits
> the fan.**

Yeah I should have put a few caveats in there really, seeing as I don't
actually do this myself! For what it's worth if I really were to
implement this it would only be for a branch where only certain
developers have access to. The trunk would be for active dev, it could
then be frozen and tested, then merged to the deployment branch!

> 2. CVS has wrapper/hook scripts that can also do tasks like this - although I
> gather that SVN's implementation is friendly & more manageable.

Yeah, I certainly like it better. I've not looked at CVS hooks for years
but I'm sure I remember the SVN ones being more flexible...

> ** 'shit hits the fan' reminds me of something I saw in a LIDL supermarket -
> they had a ripoff version of 'PomBaer' crisps (potato chips) which was called
> 'Bears Hit' ... I kid you not! now you too can say with confidence, 'I feel
> like eating some bear shit' :->

I don't think I could ever say that with confidence!

Col

--- End Message ---
--- Begin Message ---
makhan wrote:
Hi
I am using exec() funtions to run simple commands like exec('date') in php
without any success. I am using apache on my windows system. Can someno guid
me what could be wrong.

I have checked the php.ini file and its not in the safe mode.

"without any success"

What exactly does this mean?

You get no output? Read this: and read up on the second argument.

http://us2.php.net/manual/en/function.exec.php

Jim

--- End Message ---
--- Begin Message ---
Thanks jim for your reponse , from no success means I am not able to get any
output. I am also using shell_exec('matlab -r myscript') to run my matlab
script. I see a new matlab.exe process starting in the windows task manager.
And the browser keeps busy trying to open this php page. 

I have made my matlab script to write on a text file but this file is never
created.



Jim Lucas-2 wrote:
> 
> makhan wrote:
>> Hi 
>> 
>> I am using exec() funtions to run simple commands like exec('date') in
>> php
>> without any success. I am using apache on my windows system. Can someno
>> guid
>> me what could be wrong.
>> 
>> I have checked the php.ini file and its not in the safe mode.
> 
> "without any success"
> 
> What exactly does this mean?
> 
> You get no output? Read this: and read up on the second argument.
> 
> http://us2.php.net/manual/en/function.exec.php
> 
> Jim
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Unable-to-use-exec%28%29-in-php-tf3937852.html#a11170086
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
makhan wrote:
Thanks jim for your reponse , from no success means I am not able to get any
output. I am also using shell_exec('matlab -r myscript') to run my matlab
script. I see a new matlab.exe process starting in the windows task manager.
And the browser keeps busy trying to open this php page.
I have made my matlab script to write on a text file but this file is never
created.


Try this


<?php

exec('yourcommand.sh', $output);
echo $output;

?>

This should return to you any output that the program may have.

You might have to look into redirecting your standard out and your standard error

Jim




Jim Lucas-2 wrote:
makhan wrote:
Hi
I am using exec() funtions to run simple commands like exec('date') in
php
without any success. I am using apache on my windows system. Can someno
guid
me what could be wrong.

I have checked the php.ini file and its not in the safe mode.
"without any success"

What exactly does this mean?

You get no output? Read this: and read up on the second argument.

http://us2.php.net/manual/en/function.exec.php

Jim

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






--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Unknown

--- End Message ---
--- Begin Message ---
On Monday 18 June 2007 13:15, makhan wrote:

Stop top posting.

> I am also using shell_exec('matlab -r myscript') to run
> my matlab script.

Using shell_exec('matlab -r /path/to/myscript') would be a better idea.

-- 
Crayon

--- End Message ---
--- Begin Message ---
On Sun, 2007-06-17 at 13:53 -0400, Robert Cummings wrote:
> I believe there are profiling tools... probably from Zend. How big is

I prefer using XDEBUG, which is totally free. You can install it from
the pecl repositories: pecl install xdebug

Then, you simply install it as an extension on your development machine,
and execute your scripts. A really nice feature of xdebug is that not
only does it give you detailed stack traces and things when stuff goes
wrong, but you can also do really excellent (and graphical) profiling in
combination with cachegrind (I use KCacheGrind on Ubuntu), which uses
GraphViz to make very interesting graphs of what your code is doing.

If you would like a more detailed HOWTO, please let me know, and I will
write up something for you.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

--- End Message ---
--- Begin Message ---
On Mon, 2007-06-18 at 06:39 +0200, Paul Scott wrote:
> If you would like a more detailed HOWTO, please let me know, and I will
> write up something for you.

http://fsiu.uwc.ac.za/index.php?module=blog&action=viewsingle&postid=gen9Srv59Nme5_9262_1182142431&userid=3897070607

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

--- End Message ---
--- Begin Message ---
Nathan Nobbe wrote:
all,

i have recently stumbled upon the
pack<http://www.php.net/manual/en/function.pack.php>method.
can this be used as a substitute for
serialize<http://www.php.net/manual/en/function.serialize.php>
?

No. pack() is for creating binary representations of data, while serialize() returns a text representation of a PHP sitructure, (for objects the class must be loaded before you unserialize it).

--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

--- End Message ---
--- Begin Message ---
please keep posts on list.

jekillen wrote:
> 
> On Jun 17, 2007, at 12:18 PM, Jochem Maas wrote:
> 
>> jekillen wrote:
>>> Hello again;
>>> does the following test pass if the file is successfully included:
>>> if( include( some file ) )
>>>
>>> or does it pass with:
>>> if( ! include( some file ) )
>>
>> have you tried it?
>>
>>
> Well, typically while waiting for a reply, which I thank you for,
> I did browse through My Oreilly text Programming php
> which did not have anything definitive, and looking at
> the manual which did not have anything completely
> satisfying, I did try it as if( include( some file ) ) and
> it worked. But I also testing a file that I knew would
> cause an error, sure enough the else conditional
> did smear error messages all over the browser  window.

I have no idea what else condition you mean and I also have no idea
what these 'error messages' are or what they have to do with the
original question (which I had assumed was about the testing return
values from an include statement ... something you could have gleaned
from the manual and a couple of tests.


> So I did:
>  if(file_exists( some file ))
>    {
>     include(some file);
>    }
> Thanks again
> JK
> 

--- End Message ---
--- Begin Message ---

I have no clue how big the files are, but you might want to store them
in a database. That can speed up things, but don't ask me how much ;)

Tijnema

no dude, while database are convenient, files systems are faster, I mean thats what they were designed for, serving files.

For lots of files I would store them in directories and sub directories.

-
--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of this email. However, many were excited and some may well have enjoyed the experience.}
--- End Message ---
--- Begin Message ---
clive wrote:
>>
>> I have no clue how big the files are, but you might want to store them
>> in a database. That can speed up things, but don't ask me how much ;)
>>
>> Tijnema
>>
> no dude, while database are convenient, files systems are faster, I mean
> thats what they were designed for, serving files.
> 
> For lots of files I would store them in directories and sub directories.

Yeah amen!

I generally use a two character hex hash in  my main folder to give 255
sub folders each containing files.

In my case the hash is calculated from some known info - e.g. a database
ID and then stored in a meta data table.

Col

--- End Message ---
--- Begin Message ---
Hi,

Don't want to spam the list, but figured after the London Salaries topic
recently, that I'd post this!

We're needing a PHP/MySQL developer, preferably with experience of
general server admin too.

The details can be found here if anyone is interested:
http://www.tribalogic.net/tribalogic/jobs/graduate-php-developer-needed.html

Col

--- End Message ---
--- Begin Message ---
On 6/18/07, Colin Guthrie <[EMAIL PROTECTED]> wrote:
Hi,

Don't want to spam the list, but figured after the London Salaries topic
recently, that I'd post this!

We're needing a PHP/MySQL developer, preferably with experience of
general server admin too.

The details can be found here if anyone is interested:
http://www.tribalogic.net/tribalogic/jobs/graduate-php-developer-needed.html

Col


Well, I have a lot experience with PHP, HTML and MySQL. Also some
experience with Unix system administration.  I'm 15 years old, so
could I apply for the job? :)

Tijnema

--- End Message ---
--- Begin Message ---
In a browser-application, whenever receiving a GET, php will have to
create all involves objects.

I wonder, if there is a way to keep php objects, including all actual
propertys,  during a whole session

Markus

--- End Message ---
--- Begin Message ---
Markus Feier wrote:
In a browser-application, whenever receiving a GET, php will have to
create all involves objects.

I wonder, if there is a way to keep php objects, including all actual
propertys,  during a whole session

Yeah, erm, store the in the session.

Too obvious?

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Please include the list when replying.

Markus Feier wrote:
I thought I read somewhere, there could be a problem storing objects in
sessions.

Do you mean
$_SESSION['objectid']=new classx...

I do indeed mean that. There are a few things you need to be aware of...

* When you call session_start() you must already have included the necessary that defines the classes that might have instances in the session, or have an __autoload function that can load them on demand.

* As always you cannot store resources in the session. To get around this for objects, implement __sleep and __wake methods to dispose of and recreate the resources. Check the manual for full details.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
tedd wrote:
> At 11:39 AM +0200 6/14/07, Jochem Maas wrote:
>> original string:
>>

...
> 
> The problem as I see it is covering all the possibilities that may occur
> even if the text is well formed. Like what if someone introduces a span
> that sets a color for a paragraph, such as:
> 
> <span color:"yellow"; >Dolore magna aliquam erat volutpat ut wisi enim
> ad minim veniam quis nostrud. Consectetuer adipiscing elit sed diam
> nonummy nibh euismod tincidunt ut laoreet exerci tation ullamcorper
> suscipit lobortis! <b>Decima eodem modo </b>typi qui nunc nobis videntur
> parum clari fiant sollemnes in.<span>
> 
> And the </b> tag as well as the </span> tag is outside the 256 limit?
> 
> You would have to search out and pull in all closing tags.
> 
> So, I guess an algorithm could be:

roughly speaking yes this is what is would do, except:

> 
> First, grab 256 characters -- The string. If The string is shorter, then
> quit.

the algo should only be counting 'content characters', i.e. anything that is
html markup should not go towards the string length count, additionally html 
entities
such as '&amp;' should be considered as a single character.

> 
> Second, determine what tags are not closed.
> 
> Third, create closing tags and add them to the end of The string (in
> proper order).
> 
> Fourth, then remove the same number of non-html characters from the end
> of The string.

what the code should do (mmore or less) is quite clear - writing something
flexible & robust to actually do it (and do it fast) is quite another matter.

I have been looking at Edward Vermillon's code but I suspect that what he sent
me is not quite what I'm looking for for a number of reasons:

1. it deals primarily with custom bbcode like markup
2. I have a couple of doubts about the handling of html entities
3. performance

that said I still have to look at it in depth before making any real
conclusions as to it's viability (and or the possiblity to rework the
code to fit my needs).

I'm also looking at an alternative where by I go through the
string and truncate it at the character (or characters that
represent an html entity) that reresents the Nth 'content character'
and then feeding the truncated string to the Tidy extension and let it
figure out the html cleaning part ... does anyone have experience using tidy
to clean (make valid) html snippets using Tidy, that they would like to share?


> 
> OR, just strip out the html tags (strip_tags) and go with straight text
> -- a lot easier.

that's not an option for me.

> 
> Cheers,
> 
> tedd
> 

--- End Message ---
--- Begin Message ---

> -----Original Message-----
> From: Jochem Maas [mailto:[EMAIL PROTECTED]
> Sent: 18 June 2007 13:18
> To: tedd
> Cc: [php] PHP General List
> Subject: Re: [PHP] generating an html intro text ...
>
>
> tedd wrote:
> > At 11:39 AM +0200 6/14/07, Jochem Maas wrote:
> >> original string:
> >>
>
> ...
> >
> > The problem as I see it is covering all the possibilities that may occur
> > even if the text is well formed. Like what if someone introduces a span
> > that sets a color for a paragraph, such as:
> >
> > <span color:"yellow"; >Dolore magna aliquam erat volutpat ut wisi enim
> > ad minim veniam quis nostrud. Consectetuer adipiscing elit sed diam
> > nonummy nibh euismod tincidunt ut laoreet exerci tation ullamcorper
> > suscipit lobortis! <b>Decima eodem modo </b>typi qui nunc nobis videntur
> > parum clari fiant sollemnes in.<span>
> >
> > And the </b> tag as well as the </span> tag is outside the 256 limit?
> >
> > You would have to search out and pull in all closing tags.
> >
> > So, I guess an algorithm could be:
>
> roughly speaking yes this is what is would do, except:
>
> >
> > First, grab 256 characters -- The string. If The string is shorter, then
> > quit.
>
> the algo should only be counting 'content characters', i.e.
> anything that is
> html markup should not go towards the string length count,
> additionally html entities
> such as '&amp;' should be considered as a single character.
>
> >
> > Second, determine what tags are not closed.
> >
> > Third, create closing tags and add them to the end of The string (in
> > proper order).
> >
> > Fourth, then remove the same number of non-html characters from the end
> > of The string.
>
> what the code should do (mmore or less) is quite clear - writing something
> flexible & robust to actually do it (and do it fast) is quite
> another matter.
>
> I have been looking at Edward Vermillon's code but I suspect that
> what he sent
> me is not quite what I'm looking for for a number of reasons:
>
> 1. it deals primarily with custom bbcode like markup
> 2. I have a couple of doubts about the handling of html entities
> 3. performance
>
> that said I still have to look at it in depth before making any real
> conclusions as to it's viability (and or the possiblity to rework the
> code to fit my needs).
>
> I'm also looking at an alternative where by I go through the
> string and truncate it at the character (or characters that
> represent an html entity) that reresents the Nth 'content character'
> and then feeding the truncated string to the Tidy extension and let it
> figure out the html cleaning part ... does anyone have experience
> using tidy
> to clean (make valid) html snippets using Tidy, that they would
> like to share?
>

A few thoughts I've had on this problem:

Assuming it is well formed HTML, you could use a stack. Parse the string
putting all opening tags on the stack and then removing them when the close
tag is found. This will leave you with all the un-closed tags and in the
correct order.

Remember that some tags can be self closing (<br /> etc).

Could you use one of the XML extensions to build a DOM of the snippet? I've
not used them much myself, but I'm guessing they could handle most of the
tag stripping and matching...

HTH,
Edward

--- End Message ---

Reply via email to