php-general Digest 3 Aug 2004 15:46:30 -0000 Issue 2915

Topics (messages 192516 through 192540):

Re: biff_decode function
        192516 by: Jason Wong

I need ob_write($string, $start, $length)
        192517 by: jtl_phpdotnet.spamex.com
        192522 by: Curt Zirzow

Handles for multiple output buffers?
        192518 by: jtl_phpdotnet.spamex.com
        192520 by: Justin Patrin
        192521 by: Robert Cummings
        192525 by: Curt Zirzow

Re: Upgrade PHP? [SOLVED]
        192519 by: Will Collins

Re: Cannot compile
        192523 by: Andrew W
        192524 by: Jason Wong

Manufacturing systems and inventory control
        192526 by: Amimu Austin

Re: php coding software
        192527 by: Jordi Canals

Re: PEAR Spreadsheet_excel_writer problem
        192528 by: Alex Othold

Unable to Destroy Session
        192529 by: Harlequin
        192530 by: Harlequin
        192531 by: Jay Blanchard

Re: Another problem with grids and checkboxes
        192532 by: Henri Marc

how to change SCRIPT_FILENAME syntax??
        192533 by: msa
        192534 by: Jay Blanchard

Re: multiple checkboxes
        192535 by: Robert Sossomon
        192536 by: Matt M.
        192537 by: John W. Holmes
        192538 by: John Nichel
        192539 by: Robert Sossomon

good book on PEAR
        192540 by: Amanda Hemmerich

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 ---
On Tuesday 03 August 2004 04:20, Richard Lynch wrote:

> Perhaps a function which, given a short (subject length) input of
> text, and a dictionary of "bad" words, would return some kind of
> value indicating a percent match of how "close" the text was to any
> of the bad words.

PHP has a number of builtin "String Functions" which does string similarity 
comparisons. I'm not sure how useful they would be for your purpose so you 
would have to play around with them to find out.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Numeric stability is probably not all that important when you're guessing.
*/

--- End Message ---
--- Begin Message ---
The guys in the internals list sent me to this forum.

I am trying to write some serious parsing software in PHP.  I need to use plain, 
vanilla PHP and no add-on modules, because I need to be able to distribute to people 
who don't have sufficient privileges.

In the process of parsing I create a new document composed of concatenated pieces of 
the original document.  I am efficiently catting the new document using output buffer, 
but when I have to copy non-contiguous pieces form the original document, I am forced 
to create substrings, as in:

echo substr($originalDoc, $startOfSnippet, $snippetLength)

My documents are potentially large with possibly thousands of such substrings.  I know 
from writing Java parsers for high-throughput servers that object creation, and in 
particular string creation, is the greatest source of degraded performance.

I'd like to copy the contents of a substring directly to the output buffer without 
creating an intermediate object, as in:

ob_write($string, $start, $length)

I can find no such function and could envision no other way to do this at present.

When can I expect broad support for such a function in the base PHP release?  Or do 
you know of a workaround?

BTW, because I had to ditch my last email address due to spam, I'm subscribed to this 
list through spamex.com.  But because the list makes the emails it distributes appear 
to original from the people who posted, I have no way to reply through spamex back to 
this forum, at least no way to keep the reply in the same thread.  Suggestions, are 
welcome.  Otherwise I'll be starting a new thread.

Thanks for your help!
~joe lapp

--- End Message ---
--- Begin Message ---
* Thus wrote [EMAIL PROTECTED]:
> The guys in the internals list sent me to this forum.
> 
> I am trying to write some serious parsing software in PHP.  I
> need to use plain, vanilla PHP and no add-on modules, because I
> need to be able to distribute to people who don't have sufficient
> privileges.
> 
> In the process of parsing I create a new document composed of
> concatenated pieces of the original document.  I am efficiently
> catting the new document using output buffer, but when I have to
> copy non-contiguous pieces form the original document, I am
> forced to create substrings, as in:
> 
> echo substr($originalDoc, $startOfSnippet, $snippetLength)
> 
> My documents are potentially large with possibly thousands of
> such substrings.  I know from writing Java parsers for
> high-throughput servers that object creation, and in particular
> string creation, is the greatest source of degraded performance.
> 
> I'd like to copy the contents of a substring directly to the
> output buffer without creating an intermediate object, as in:
> 
> ob_write($string, $start, $length)
> 
> I can find no such function and could envision no other way to do
> this at present.
> 


I'm not entirely clear at what your trying to do but perhaps you
want something like this:

function print_substr_direct($string, $start, $len) {
  static $fp = null;

  if ($fp === null ) {
    // Open a connection directly to the output
    $fp = fopen('php://stdout', 'r');
  }
  if ($fp) {
    fputs($fp, substr($string, $start, $len));
  }
}


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
Again, the internals list sent me to this forum for help.

In trying to create a series of parsers in PHP, using only PHP core and no 
non-standard add-ons, I find myself emulating multiple character streams in a class 
that wraps the output buffer.  Every time I open a new stream, I first save the 
current contents of the output buffer and then reset the stream.  When the stream is 
closed, I then restore the output buffer to what it was before.

I'd like more conventional 3GL behavior, where I am permitted multiple buffered 
streams via handles or stream objects.  I see no way to do this with PHP as it stands. 
 I also don't see anyway to emulate this without worsening the problem by creating a 
profusion of strings.

I'm mostly able to work around the performance inefficiences of this wrapper-class 
approach by making the application smart about when to use a new stream.  But I'd 
rather have native support.

When can I expect to see this kind of conventional stream behavior in PHP?  Are there 
any workaround I can use in the meantime?

Thanks for your help!

~joe

P.S.  Again, because this listserv sends emails to me as if they originated from the 
person who made the post, and because I'm now guarding my email address through 
spamex.com, I find that I am unable to respond directly to this thread.  My responses 
will likely appear in new a thread.

--- End Message ---
--- Begin Message ---
On Tue, 03 Aug 2004 00:11:09 -0400, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Again, the internals list sent me to this forum for help.
> 
> In trying to create a series of parsers in PHP, using only PHP core and no 
> non-standard add-ons, I find myself emulating multiple character streams in a class 
> that wraps the output buffer.  Every time I open a new stream, I first save the 
> current contents of the output buffer and then reset the stream.  When the stream is 
> closed, I then restore the output buffer to what it was before.
> 
> I'd like more conventional 3GL behavior, where I am permitted multiple buffered 
> streams via handles or stream objects.  I see no way to do this with PHP as it 
> stands.  I also don't see anyway to emulate this without worsening the problem by 
> creating a profusion of strings.
> 
> I'm mostly able to work around the performance inefficiences of this wrapper-class 
> approach by making the application smart about when to use a new stream.  But I'd 
> rather have native support.
> 
> When can I expect to see this kind of conventional stream behavior in PHP?  Are 
> there any workaround I can use in the meantime?
> 

Why are you looking for such low level functionality in what is
essentially a scripting language? If you're this worried about speed,
you should probably be writing this in C. Or make an extension to PHP.
I know that you say "no non-standard extensions", but if you can't
have an extension, you're not likely to have any major speed
increases.

> Thanks for your help!
> 
> ~joe
> 
> P.S.  Again, because this listserv sends emails to me as if they originated from the 
> person who made the post, and because I'm now guarding my email address through 
> spamex.com, I find that I am unable to respond directly to this thread.  My 
> responses will likely appear in new a thread.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:410f0edb54011976710829!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

--- End Message ---
--- Begin Message ---
On Tue, 2004-08-03 at 00:44, Justin Patrin wrote:
> On Tue, 03 Aug 2004 00:11:09 -0400, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > Again, the internals list sent me to this forum for help.
> > 
> > In trying to create a series of parsers in PHP, using only PHP core and no 
> > non-standard add-ons, I find myself emulating multiple character streams in a 
> > class that wraps the output buffer.  Every time I open a new stream, I first save 
> > the current contents of the output buffer and then reset the stream.  When the 
> > stream is closed, I then restore the output buffer to what it was before.
> > 
> > I'd like more conventional 3GL behavior, where I am permitted multiple buffered 
> > streams via handles or stream objects.  I see no way to do this with PHP as it 
> > stands.  I also don't see anyway to emulate this without worsening the problem by 
> > creating a profusion of strings.
> > 
> > I'm mostly able to work around the performance inefficiences of this wrapper-class 
> > approach by making the application smart about when to use a new stream.  But I'd 
> > rather have native support.
> > 
> > When can I expect to see this kind of conventional stream behavior in PHP?  Are 
> > there any workaround I can use in the meantime?
> > 
> 
> Why are you looking for such low level functionality in what is
> essentially a scripting language? If you're this worried about speed,
> you should probably be writing this in C. Or make an extension to PHP.
> I know that you say "no non-standard extensions", but if you can't
> have an extension, you're not likely to have any major speed
> increases.

Portability I would wager. And portability with as much efficiency as
possible. I guess the current streams implementation requires him to
perform a lot of low level emulation to get past perceived deficiencies
in the stream handling architecture. Not every Joe has the luxury of
installing extensions and so often a PHP script can provide the widest
possible audience.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
* Thus wrote [EMAIL PROTECTED]:
> Again, the internals list sent me to this forum for help.
> 
> In trying to create a series of parsers in PHP, using only PHP
> core and no non-standard add-ons, I find myself emulating
> multiple character streams in a class that wraps the output
> buffer.  Every time I open a new stream, I first save the current
> contents of the output buffer and then reset the stream.  When
> the stream is closed, I then restore the output buffer to what it
> was before.
> 
> I'd like more conventional 3GL behavior, where I am permitted
> multiple buffered streams via handles or stream objects.  I see
> no way to do this with PHP as it stands.  I also don't see anyway
> to emulate this without worsening the problem by creating a
> profusion of strings.
> 
> I'm mostly able to work around the performance inefficiences of
> this wrapper-class approach by making the application smart about
> when to use a new stream.  But I'd rather have native support.
> 

You may be seeking: http://php.net/stream-wrapper-register

With the example listed, you can have as many buffers as you
please. 


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
Yeah, actually, you were right.  I must have misunderstood the instructions
- probably because of the press for time, reading too quickly.  I wasn't
using "--with-jpeg-dir", etc.  Sorry for the mess, and thanks for all the
help.  At least some good came out of this -- I now have a working Slackware
installation (after the headaches, I decided to install Slackware 10 on my
unused server and compile everything from source to see if I could get it to
work).  Thanks for your time everybody.

Will

-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 02, 2004 10:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Upgrade PHP?

On Tuesday 03 August 2004 07:42, Will Collins wrote:
> Won't work:
>
> Fatal error: Call to undefined function: imagecreatefromjpeg()

> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--with-gd
> --with-zlib-dir=/usr/include

Read

  manual > Image Functions

to see how to get jpeg (and other) support.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
NOTICE:

-- THE ELEVATORS WILL BE OUT OF ORDER TODAY --

(The nearest working elevator is in the building across the street.)
*/

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

--- End Message ---
--- Begin Message ---
I'm using Linux.

It doesn't work regardless of whether I include any options or not.


On 2 Aug 2004, at 04:14, Support wrote:

Sounds like configure did not work ok after all. :-)

Did you include any options? What os? Any clues you could offer would help.


--- End Message ---
--- Begin Message ---
On Tuesday 03 August 2004 14:30, Andrew W wrote:

> It doesn't work regardless of whether I include any options or not.

"doesn't work" can include umpteen billions of things. Please try to narrow it 
down a bit.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
If you want your spouse to listen and pay strict attention to every
word you say, talk in your sleep.
*/

--- End Message ---
--- Begin Message ---
Anywhere I can get info on php web database design of inventory control, Manufacturing systems ( modules etc), discussion etc.
 
 
regards
 
 
Amimu Austin CAFCA
54 Lyton Rd
Workington
Harare
[EMAIL PROTECTED]
http://www.cafca.co.zw
tel:
tel2:
fax:
mobile:
263 4 754191
263 4 7863 2031
263 4 754086
011 610506
Signature powered by Plaxo Want a signature like this?
Add me to your address book...
 

___________________________________________________________
The information in this e-mail is confidential and intended solely for the
individual(s) to whom it is addressed. If you received this in error, you
are hereby notified that it is an offence to disclose, copy and/or
distribute the contents of this e-mail.
___________________________________________________________
This message has been scanned for viruses and dangerous content
and is believed to be clean.
_____________________________________________________________

--- End Message ---
--- Begin Message ---
Oliver John V. Tibi wrote:

in addition to brad's post, does anyone know of coding software that
supports team development environments and/or a versioning server for
windows?

I use Zend Studio wich provides CVS integration. But I'm sure you will find some others with CVS support. If not, I will recommend you to get WinCVS wich provides a nice and easy-to-use CVS interface. (And you can get CVSnt for a Windows based CVS server).

Regards.
Jordi Canals

--- End Message ---
--- Begin Message ---
Hmm.. I just did some more playing, and I solved the problem for me! It
seems that the program did not have write permission to the temp folder
because I was running in safe mode (I found this out by enabling all error
messages with 'error_reporting (E_ALL);'. After I redirected the temp folder
to a place that apache could write to, everything started working. Here's
the final working code:

$workbook = new Spreadsheet_Excel_Writer();
$workbook->setTempDir('/apache_tmp/');
$workbook->send('test.xls');
$worksheet =& $workbook->addWorksheet('Testsheet');
$worksheet->write(0, 0, 'Blah');
$workbook->close();

The Problem was solved by Ben Claar and I would like to thank him for his
help in this matter.

Alex
Adido Solutions Ltd

"Alex Othold" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I have a class the utilizes the excel writer package but I'm having a few
> problems with it on my production server.
>
> My development server is a Windows XP Pro box running PHP version 4.3.5.
On
> this box I dont get any problems and my class generates a valid excel
> document.
>
> My production server is a FreeBSD box running PHP version 4.3.4. With this
> box my class will create a excel document but when I go to open the file
up,
> it comes back and tells me the file is unreadable as it is 0 bytes in
size.
>
> I know the sql query I'm running is returning data as I can create a
tabbed
> delimited excel document from it.
>
> Can anyone help me with this or point me in the right direction, as its
> driving me mad.
>
> Thanks
>
> Alex

--- End Message ---
--- Begin Message ---
Morning guys.

I'm trying to destroy a session using "session_destroy();" and I get the
following error:

"Trying to destroy initialised session"

I simply want a user to click a logout button that destroys the session
cookie. Am I doing this the right way...?

-- 
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------

--- End Message ---
--- Begin Message ---
Sorted it.

for some reason it was holding the session because I had two browser windows
open which is the environment it will be used in by the users.

strange though...

-- 
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Morning guys.
>
> I'm trying to destroy a session using "session_destroy();" and I get the
> following error:
>
> "Trying to destroy initialised session"
>
> I simply want a user to click a logout button that destroys the session
> cookie. Am I doing this the right way...?
>
> -- 
> -----------------------------
>  Michael Mason
>  Arras People
>  www.arraspeople.co.uk
> -----------------------------

--- End Message ---
--- Begin Message ---
[snip]
for some reason it was holding the session because I had two browser
windows
open which is the environment it will be used in by the users.

strange though...
[/snip]

Strange how? Since the session is active in at least one stateless
browser window you would have to find a way to affect the state of that
browser window with the browser window you wish to log out from. Since
this is a client side issue you might be able to use JavaScript to
affect the state of the other browser window.

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

> > <td style="vertical-align: top;">1<input
> > name="grid[1][1]" value="1" type="checkbox"><br>
> >               </td>
> [snip]
> > <td style="vertical-align: top;">1<input
> > name="grid[2][1]" value="1" type="checkbox"><br>
> >               </td>
> 
> Is there a reason you're sending a 1, 2 or 3 value
> with the checkboxes? 
Well, I thought it was the good way to do.
It helps me to know which box has been checked (?).

Yes, because 
> You already know what was checked by the keys of the
> $grid array. I'd 
Yes, ok.

> <td style="vertical-align: top;">1<input
> name="grid[1][1]" value="1" 
> type="checkbox"<?php if(isset($grid[1][1])){echo '
> checked';}?>><br></td>
I let the value as it was because I would need to
rename a few hundreds checkboxes :-/ but I had used
your test in PHP if (isset($grid... and it works fine.
In fact it was very simple. When I think the time I
tried to find a solution. Shame on me.
Ok, my excuse is that I'm just learning.

Thank you very much.


        

        
                
Vous manquez d�espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Cr�ez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arriv� ! D�couvrez toutes les nouveaut�s pour 
dialoguer instantan�ment avec vos amis. A t�l�charger gratuitement sur 
http://fr.messenger.yahoo.com

--- End Message ---
--- Begin Message ---
I have the following code on my page:

$page = $_SERVER['SCRIPT_FILENAME']; // gets current url

this is part of a INSERT INTO mysql/php script.

when the table gets populated, the entire url string is there:
/home/com/sitename/html/secure/sales2.php

I would like it to read: sales2.php

How would I change the syntax to eliminate all the other information?

thanks!!!!

--- End Message ---
--- Begin Message ---
[snip]
I have the following code on my page:

$page = $_SERVER['SCRIPT_FILENAME']; // gets current url

this is part of a INSERT INTO mysql/php script.

when the table gets populated, the entire url string is there:
/home/com/sitename/html/secure/sales2.php

I would like it to read: sales2.php

How would I change the syntax to eliminate all the other information?
[/snip]

http://us2.php.net/basename

--- End Message ---
--- Begin Message ---
You need to do: 
<input type=checkbox name="checkBoxGroup1" value="first"/> 
<input type=checkbox name="checkBoxGroup2" value="second"/> 

Keeping the name the same makes them a RADIO button and you will only
get the last one.

Robert

--- End Message ---
--- Begin Message ---
> Keeping the name the same makes them a RADIO button and you will only
> get the last one.

this is not true

--- End Message ---
--- Begin Message ---
From: "Robert Sossomon" <[EMAIL PROTECTED]>

> You need to do:
> <input type=checkbox name="checkBoxGroup1" value="first"/>
> <input type=checkbox name="checkBoxGroup2" value="second"/>
>
> Keeping the name the same makes them a RADIO button and you will only
> get the last one.

This is a valid solution, but it's really just easier to make them into an
array like many others have suggested. Using this method, you would need to
loop through all of the possible "checkBoxGroupX" values to see which ones
were checked or get a list or count of them. Making them into an array makes
it as simple as count($_POST['checkBoxGroup']) or
implode(',',$_POST['checkBoxGroup']), etc...

---John Holmes...

--- End Message ---
--- Begin Message --- Robert Sossomon wrote:
You need to do: <input type=checkbox name="checkBoxGroup1" value="first"/> <input type=checkbox name="checkBoxGroup2" value="second"/>

Keeping the name the same makes them a RADIO button and you will only
get the last one.

This is not true. The only thing that will make these a radio button is setting the 'type' to 'radio'.


The answers put out to this yesterday were correct. Using square brackets ( [] ) after the name of the checkbox element will send them as an array (if any are checked).

--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Sorry, day late and a dollar short on that one...  Never once thought
about using an array, but after seeing John's and Curt's emails on it
(when I realized I was NOT at the top of my emails) I saw how brilliant
a solution that is...

Robert

--- End Message ---
--- Begin Message ---
Hello!

I need a solid foundation on using PEAR.  ANy books or websites you
would recommend?

Thanks,
Amanda

--- End Message ---

Reply via email to