php-general Digest 29 May 2005 08:01:21 -0000 Issue 3481

Topics (messages 215947 through 215957):

[EMAIL PROTECTED]
        215947 by: Ryan A

Re: cybercash as a shared object
        215948 by: Bill Shupp

Questionary Development
        215949 by: ...helmut
        215950 by: ...helmut
        215951 by: ...helmut
        215953 by: ...helmut

Re: browse childnodes but not recursively
        215952 by: Jared Williams

Re: Sorting Objects in an array by object properties
        215954 by: Jared Williams

Re: unable to exec shell commands
        215955 by: Andy Pieters

Regex question: replacing incidences of character when not enclosed within HTML 
tags?
        215956 by: Murray . PlanetThoughtful

Dummy question about knowing marked checkboes
        215957 by: Mário Gamito

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Everytime I write to the list or reply to the list I get an email from this
#%#"¤&! saying:

-------------------
 We are currently away on holiday, until 16th June.  I will respond with
 your email on my return.


 Thanks
 James Nunnerley
-------------------

Can someone unsub him please? Its realllly starting to tick me off.
The autoresponder seems to be firing from this addres:
[EMAIL PROTECTED]

Cheers,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.2.0 - Release Date: 5/27/2005

--- End Message ---
--- Begin Message ---
Bill Shupp wrote:
I need to install the cybercash module on a Debian Sarge system. I really want to keep Debian's PHP packages, and just build this as a shared module. At least one post in the archives indicates that this is possible, as does one changelog entry. However, no specifics were offered.

Here's what I've tried:

I can build the module fine statically.

I can build the shared module cybercash.so by modifying the ext/cybercash/config.m4 and Makefile files, modeling them after the mcrypt.so entries. While modules/cybercash.so does get built, I get this error when trying to load it:

PHP Warning: Unknown(): Invalid library (maybe not a PHP library) 'cybercash.so' in Unknown on line 0

I'm building with PHP 4.3.10, and the latest cybercash from PECL. I've also tried the cybercash module from 4.2.3, as suggested in one of the online manual comments.

Any guidance would be greatly appreciated!

Regards,

Bill Shupp

I was able to get it compiled by re-writing the config.m4 file, modeling it after the pfpro config.m4 file. Here's what I posted on the online manual comments, just so that it makes it to the mail archives as well:



##################################

Here's how to install cybercash dynamically into PHP
----------------------------------------------------

1. Make sure you have the php dev tools installed, like pear and phpize.

2. Download the cybercash module:

pear download cybercash

3. Untar the module:

tar -xzf cybercash-<version>.tgz

4. Download and install my updated config.m4 file, the current one (as of version 1.18p1) doesn't work:

wget http://shupp.org/patches/cybercash.config.m4
cd cybercash-<version>
mv ../cybercash.config.m4 config.m4

5. Setup/compile module

phpize
./configure --with-cybercash=/path/to/cybercash-mck-library-source/c-api
make

6. Install module. For Debian Sarge, the modules directory is /usr/lib/php4/20020429/:

cp modules/cybercash.so /usr/lib/php4/20020429/
(make install may work also)

7. Enable the module in php.ini, restart apache.


##################################


Incidentally, when I tried to compile the pfpro module from within the PHP source using buildconf, I got setting mismatch errors when trying to load it into Debian's PHP binaries. However, by moving the extension out of the PHP source, and using phpize to setup it up, it loaded perfectly.

Hope this helps someone else save some time!


Regards,

Bill Shupp

--- End Message ---
--- Begin Message ---
I have a form that contains 100 questions. To make it easier on the user, I 
will divide it into 5 sections (20 questions per section), then all the 
information will be written to a db. What is the best way to carry along 
through the pages the information that has already been submitted? Cookies? 
Writing to a DB after each section? Session Variables?

I read that writing to a database as i go along could be too much of a 
hazzle for the db, specially if I have multiple people filling out the form 
at the same time.

TIA

-- 
....helmut
helmutgranda.com

--- End Message ---
--- Begin Message ---
I have a form that contains 100 questions. To make it easier on the user, I 
will divide it into 5 sections (20 questions per section), then all the 
information will be written to a db. What is the best way to carry along 
through the pages the information that has already been submitted? Cookies? 
Writing to a DB after each section? Session Variables?

I read that writing to a database as i go along could be too much of a 
hazzle for the db, specially if I have multiple people filling out the form 
at the same time.

TIA

-- 
....helmut
helmutgranda.com

--- End Message ---
--- Begin Message ---
I have a form that contains 100 questions. To make it easier on the user, I
will divide it into 5 sections (20 questions per section), then all the
information will be written to a db. What is the best way to carry along
through the pages the information that has already been submitted? Cookies?
Writing to a DB after each section? Session Variables?

I read that writing to a database as i go along could be too much of a
hazzle for the db, specially if I have multiple people filling out the form
at the same time.

TIA

-- 
...helmut
helmutgranda.com

--- End Message ---
--- Begin Message ---
I have a form that contains 100 questions. To make it easier on the user, I 
will divide it into 5 sections (20 questions per section), then all the 
information will be written to a db. What is the best way to carry along 
through the pages the information that has already been submitted? Cookies? 
Writing to a DB after each section? Session Variables?

I read that writing to a database as i go along could be too much of a 
hazzle for the db, specially if I have multiple people filling out the form 
at the same time.

TIA

-- 
....helmut
helmutgranda.com

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

> -----Original Message-----
> From: Victor Spĺng Arthursson [mailto:[EMAIL PROTECTED] 
> Sent: 27 May 2005 17:25
> To: php-general@lists.php.net
> Subject: [PHP] DOM: browse childnodes but not recursively
> 
> Ciao!
> 
> I really hope someone can help me on this, since I have been 
> putting in to much time in it now, and I have to show off 
> some results ;)
> 
> The problem is that I can't browse nodelists in only one 
> dimension, that is, whitout getting the sub-nodes of the nodes.
> 
> My XML reads:
> 
> <element id="5">
>      <element id="51">Still got the blues</element>
>      <element id="52">Gary Moore</element>
>      <element id="53">
>          <element id="9">
>              <element id="531">Maggie May</element>
>              <element id="532">Rod Stewart</element>
>              <element id="533">UK</element>
>              <element id="534">Pickwick</element>
>              <element id="535">8.50</element>
>              <element id="536">1990</element>
>          </element>
>         </element>
>      <element id="54">Virgin records</element>
>      <element id="55">10.20</element>
>      <element id="56">1990</element>
> </element>
> 
> I get this as a DOMNodeList in the variable $elements. I will 
> write some examples, to describe my problem.
> 
> echo $elements->length;
> // outputs 1
> 
> var_dump($elements);
> // outputs object(DOMNodeList)#5 (0) { }
> 
> var_dump($elements->item(0)); // contents of element with id="5"
> // outputs object(DOMElement)#4 (0) { }
> 
> Here I come to the problem. What I want is to get a list of 
> the 6 elements inside element id="5", but not with child-childs.
> 
> echo $elements->item(0)->childNodes->length;
> // Outputs 13!!!!!

childNodes contains the textnodes too, in this case the whitespace between each 
of <element>.

> So, to put it in short words; how do I do to browse the 
> content of the element id="5" withuot doing it recursively? I 
> want to receive a list when I call childNodes (or equivalent) 
> that gives me the elements with id 51-56, and a length of 6.
> 

for($child = $elements->item(0)->firstChild; $child; $child = 
$child->nextSibling)
        if ($child->nodeType == XML_ELEMENT_NODE)
                echo $child->getAttribute('id'), "\n";

Jared 

--- End Message ---
--- Begin Message ---
> Hello list,
> 
> I have an array which holds some objects. Each object 
> represent elements from an email header in a given mailbox. 
> Each object has properties like "from", "sendtime", "subject" etc.
> 
> I want to sort the order of the objects in the array by their 
> attribute "sendtime" in order to get a list of email header 
> sorted by their arrival time.
> 
> Has anyone an idea how to solve this? I tried various of the 
> array sorting functions but without success.
> 

http://php.net/usort 

function compare($h1, $h2)
{
        return strcmp($h1->sendtime, $h2->sendtime);
}
usort($array, 'compare'); 

Jared

--- End Message ---
--- Begin Message ---
Hi all

I have several scripts that stoped working.  All those scripts have in common 
that they call shell commands.

To find out what was going on, I did a little test
cat << "?>" | php
 <?php
 echo "exec test\n";
 exec("dir",$output,$errs);
?>
exec test
sh: /usr/local/php/bin/dir: No such file or directory

As you can see it is trying to call sh with a weird path.  It should 
use /usr/bin/dir instead

Also when I try it with 'type' (which is an internal command) it has the same 
result.

I recently switched from FC3 to FC4 for my development.  The PHP binary I'm 
using was compiled from sources with the following charasteristics:


PHP Version => 4.3.10

Configure Command =>  './configure' '--prefix=/usr/local/bin' 
'--bindir=/usr/bin' '--with-mysql' '--with-config-file-path=/etc' 
'--enable-mbstring' '--enable-mbregex' '--with-gd' '--enable-gd-native-ttf' 
'--with-ttf-dir=/usr/bin' '--with-freetype-dir=/usr/lib' 
'--with-png-dir=/usr/lib' '--with-xpm-dir=/usr/X11R6' '--enable-ftp' 
'--enable-memory-limit' '--enable-safe-mode' '--enable-bcmath' 
'--enable-calendar' '--enable-ctype' '--enable-inline-optimization' 
'--with-bz2' '--with-iconv' '--with-zlib-dir=/usr/lib' '--disable-cgi' 
'--with-cli'
Server API => Command Line Interface

Any ideas?


With kind regards


Andy

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
L+++>++++$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>++++$@ h++(*) r-->++ y--()>++++
-- ---END GEEK CODE BLOCK------
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

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

I have content that contains several lengthy hyphenated sentences, such as:

This-is-a-sentence-in-which-all-the-words-are-hyphenated.

I've noticed that some (maybe all?) browsers, particularly Firefox, will not
wrap long strings of hyphenated words when they are contained in a DIV tag
-- instead, the sentence simply runs out across the right border of the DIV
and overlaps any content to the right.

After some experimentation, I discovered that a hack that seems to behave
well in Firefox, Opera, and IE6 is to replace all incidences of the hyphen
("-") character with "-<span style='font-size:0px;'> </span>". This
effectively creates a zero-width space character after each hyphen and
allows the sentence to wrap as desired.

My dilemma is that while I want to replace any hyphens with the above hack
when and where they appear within normal sentences, I don't want to replace
them when and where they appear within HTML tags.

So, imagine I have a string that contains:

<div style='text-decoration: none;
font-size:11px;'>This-is-a-sentence-that-contains-hyphenation. This is a
sentence that doesn't contain hyphenation. This is a <a
href='http://www.nowhere.com/-4484784/index.html'>link</a> that will take
you <span style='font-weight: bold;'>nowhere</span>.</div>

I managed to build a replacement regular expression that would ignore any
hyphenated strings that were terminated by a colon (":") character (which
effectively leaves inline style attributes in DIV and SPAN blocks
untouched).

<?
$thingy = preg_replace("/(-)(?![\w-]+?:)/i", "\$1<span
style='font-size:0px;'> </span>", $whatever); ?>

This seemed to work well in most circumstances, however, in testing I
discovered several incidences of <a href=> urls that also contain hyphens
(in particular, some that lead to Amazon.com).

So, thinking about it a little more, I decided what I was looking for was a
regular expression that would allow me to replace any incidences of hyphens
when not contained within tags (i.e., when not contained between "<" and
">"). 

And this is where things have ground to a halt.

I'm wondering if anyone can give me some help with this? I've tried to find
a solution via google, but most regex examples dealing with HTML tags are
concerned with finding tags and their contents, not with finding specific
instances of characters not contained within tags.

Any help appreciated!

Much warmth,

Murray

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

First of all, my apologies to all list members for this dummy question.
I've made my home work before posting here, but the truth is that i
didn't found an answer for such a simple question.
Only examples of more sophisticated related things.

I have this piece of code that produces various checkboxes inside a form:
-------------------------------------------------------------------
// select interesses names and values to build the chekboxes
$recordSet = &$conn->Execute('SELECT interesses FROM interesses ORDER BY
interesses ASC');

// build the checkboxe's list
if (!$recordSet)
 print $conn->ErrorMsg();
else {
 while (!$recordSet->EOF) {
  print($recordSet->fields[0] . '<input name=\'interesses\'
type=\'checkbox\' id=\'interesses\' value=' . $recordSet->fields[0] .
'\'>');
echo"<br />";
$recordSet->MoveNext();
}
$recordSet->Close();
$conn->Close();
}
---------------------------------------------------------------------


Here's the correspondent HTML output:
---------------------------------------------------------------------
Alojamento<input name='interesses' type='checkbox' id='interesses'
value=Alojamento'><br />
Artesanato<input name='interesses' type='checkbox' id='interesses'
value=Artesanato'><br />
Eventos<input name='interesses' type='checkbox' id='interesses'
value=Eventos'>

(etc.)

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

My dummy question, for which i apologise once more is: after submitting
the form, how can i know which chekboxes were checked ?

Thanking you in advance.

Warm Regards,
Mário Gamito

--- End Message ---

Reply via email to