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 21 Feb 2008 04:49:12 -0000 Issue 5305

php-general-digest-helplists.php.net
Date: Wed Feb 20 2008 - 22:49:12 CST


php-general Digest 21 Feb 2008 04:49:12 -0000 Issue 5305

Topics (messages 269730 through 269760):

Re: More than one values returned?
        269730 by: Nick Stinemates
        269734 by: Nick Stinemates
        269740 by: Jim Lucas

Re: Protected ZIP file with password
        269731 by: Daniel Brown

Re: www. not working
        269732 by: Stut
        269733 by: Jason Pruim
        269735 by: Daniel Brown
        269736 by: Nathan Rixham
        269737 by: Richard Heyes
        269738 by: Stut
        269739 by: Daniel Brown
        269743 by: Robert Cummings

Re: What community software package gets your vote? PHPfox etc...
        269741 by: Warren Vail
        269742 by: Nathan Nobbe

Php warning message
        269744 by: Yuval Schwartz
        269745 by: Jason Pruim
        269746 by: Greg Bowser
        269747 by: Andrés Robinet
        269751 by: Chris
        269753 by: Daniel Brown
        269754 by: tedd
        269755 by: Casey
        269756 by: Shawn McKenzie
        269758 by: Jochem Maas

Re: Help on running external command / Partially solved
        269748 by: Chris

Re: Converting tab delimited file to CSV
        269749 by: Chris
        269752 by: Graham Cossey

Re: unable to unset reference
        269750 by: Chris

Re: [PHP-DEV] string operators for assigning class constants
        269757 by: Jochem Maas

Re: Session destruction problem
        269759 by: Adil Drissi

Re: Sending SMS via PHP
        269760 by: johnlin

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:


Jim Lucas wrote:
> Nick Stinemates wrote:
>> Nathan Rixham wrote:
>>> Robert Cummings wrote:
>>>> On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote:
>>>>> On Monday 18 February 2008, Nick Stinemates wrote:
>>>>>
>>>>>>>> I have found, however, that if I ever need to return /multiple/
>>>>>>>> values,
>>>>>>>> it's usually because of bad design and/or the lack of proper
>>>>>>>> encapsulation.
>>>>>>> You mean you've never had a function like getCoordinates()? Or
>>>>>>> getUsers(), or any other of a zillion perfectly valid and
>>>>>>> reasonable
>>>>>>> functions that return multiple values as an array? Wow, how odd!
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Rob.
>>>>>> getCoordinates() would return a Point object
>>>>>> getUsers() would return a Group object...
>>>>>>
>>>>>> Not rocket science ;)
>>>>> I wouldn't consider an array of user objects to be "multiple
>>>>> things". I consider it a single aggregate thing, and return arrays
>>>>> all the time. That's conceptually different from wanting two
>>>>> separate return values from a function, which is indeed conceptually
>>>>> icky.
>>>> Yes, an aggregate is comprised of multiple things usually. Hence when
>>>> decomposing the concept you are indeed returning multiple values--
>>>> both
>>>> points of view are valid. If you receive a parcel of 100 pens. I can
>>>> say, "has the parcel arrived yet" (one entity) or "have the pens
>>>> arrived
>>>> yet" (multiple entities).
>>>>
>>>> At any rate, the O.P. wanted to return multiple values called $x
>>>> and $y.
>>>> It seems quite reasonable to assume he was returning something akin to
>>>> coordinates but didn't know how to do so by binding them in an
>>>> aggregating structure such as an array, or if you wish, an object.
>>>>
>>>> Cheers,
>>>> Rob.
>>> seriously, whats wrong with returning an array? half the standard php
>>> functions return array's, therefore at least half of php has been
>>> designed badly..?
>>>
>>> ps: when working with co-ordinates / GIS data you should really be
>>> using wkb data instead, it's much faster. [unpack]
>>>
>> What's wrong with it? Hmm..
>>
>> Half of PHP functions DO return arrays, I'll grant you that. The reason?
>> It's untyped. If PHP were a typed language, and it still returned arrays
>> for a lot, I definitely think it would be designed poorly.
>>
>> At any rate, returning an array from your Objects increases the burden
>> and shifts it to the client of your API. For instance, if we take an
>> example mentioned above *getUsers()* which returned an arbitrary number
>> of User objects you could potentially use it like this.
>>
>> userupdater.php
>>
>> <?php
>> $x = Users::getUsers($somefilter)
>> foreach ($x as $user) {
>> $user->update();
>> }
>> ?>
>>
>> Keep in mind. You'll have to rewrite that functionality in multiple
>> areas. As opposed to:
>>
>> <?php
>>
>> $x = Users::getGroup($somegroup); // returns a group of users
>> $x->update(); // can be reused wherever instead of having to loop
>> through every user on the client side.
>> ?>
>>
>> I hope you can see past my (basic) example to understand where I am
>> headed with this.
>>
>
> I would, and do, use this magic :)
>
> Users::GetGroup($somegroup)->update();
>
> Simple, Even less typing then yours :p
>
:P. I use that method, too.

It really sucks for debugging though, because what if
GetGroup($somegroup) returns a null or unexpected value?

Yeah, it sucks. But, doesn't occur enough to be too annoying ;)

--
==================
Nick Stinemates (nickstinemates.org)
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: nickstinemateshotmail.com
Yahoo: nickstinematesyahoo.com
==================

attached mail follows:


Nathan Nobbe wrote:
> On Mon, Feb 18, 2008 at 9:06 PM, Nick Stinemates <nickstinemates.org
> <mailto:nickstinemates.org>> wrote:
>
> Thats a good example, and a good reason for passing values by
> Reference
> instead of by Value.
>
> I have found, however, that if I ever need to return /multiple/
> values,
> it's usually because of bad design and/or the lack of proper
> encapsulation.
>
>
> and this is what i was responding to earlier, nick, although you didnt
> criticize
> pass-by-reference directly you essentially said use of it indicates
> bad design,
> which i disagree with.
> check my post where i show a method with a boolean return value that has a
> pass-by-reference parameter to return data; that is a perfectly
> reasonable use
> case for pass-by-reference and it does not indicate bad design. nor
> would it, if
> there were more pass-by-reference parameters in that method.
If I said passing by reference was a bad design, C/C++ programmers all
over the world would call me an idiot. Coming from a C background, I
would definitely agree with them.
Passing by reference and returning an array of objects out of
convenience, I think, are completely separate.

As for that specific quote, I don't see how it criticizes by reference
arguments. If you took it that way, I can only assure you I will (try
to) speak more coherently ;)
>
> and here is another reason you might have to return more than on value
> from a
> method; a function needs to return data of different types. now php
> is loosely
> typed, so packaging these into an array is a joke, but in other
> languages, that
> are strongly typed, its not quite that simple. any way, when i think
> about a method
> returning a class, what if for whatever reason, a method were to
> return objects of
> 2 classes ? do you then create another class just for the purpose of
> packaging those
> 2 objects for this method to return a single value?
Of course, it _always_ depends. This is why in all of this argument i
said it was an *indication* not 100% of the time.

My only argument is, if you need 2 classes, or 2 sets of data, and
you'll need it in more than 1 place (ever) then it would be in your
interest to group them.

Let's take, for example, the getGroup method I've been using. If I make
a change to the update() method (in an extreme example, adding a
parameter to it that wasn't there before,) I am going to have to go back
through all of my code, and ensure it's being used properly. Instead, if
I had a Group object that managed bulk operations on Users, I would only
need to update 1 area, and the maintenance on the client code decreases
drastically.

> well ill let you be the judge of that, but i would probly toss them in
> a small array, or,
> depending on the scenario, use pass-by-reference, especially if i
> wanted to return
> a boolean value from the method ;)
>
> -nathan
If it calls for passing and object or 2 by reference, I think that's great.

--
==================
Nick Stinemates (nickstinemates.org)
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: nickstinemateshotmail.com
Yahoo: nickstinematesyahoo.com
==================

attached mail follows:


Nick Stinemates wrote:
> Jim Lucas wrote:
>> Nick Stinemates wrote:
>>> Nathan Rixham wrote:
>>>> Robert Cummings wrote:
>>>>> On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote:
>>>>>> On Monday 18 February 2008, Nick Stinemates wrote:
>>>>>>
>>>>>>>>> I have found, however, that if I ever need to return /multiple/
>>>>>>>>> values,
>>>>>>>>> it's usually because of bad design and/or the lack of proper
>>>>>>>>> encapsulation.
>>>>>>>> You mean you've never had a function like getCoordinates()? Or
>>>>>>>> getUsers(), or any other of a zillion perfectly valid and
>>>>>>>> reasonable
>>>>>>>> functions that return multiple values as an array? Wow, how odd!
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Rob.
>>>>>>> getCoordinates() would return a Point object
>>>>>>> getUsers() would return a Group object...
>>>>>>>
>>>>>>> Not rocket science ;)
>>>>>> I wouldn't consider an array of user objects to be "multiple
>>>>>> things". I consider it a single aggregate thing, and return arrays
>>>>>> all the time. That's conceptually different from wanting two
>>>>>> separate return values from a function, which is indeed conceptually
>>>>>> icky.
>>>>> Yes, an aggregate is comprised of multiple things usually. Hence when
>>>>> decomposing the concept you are indeed returning multiple values--
>>>>> both
>>>>> points of view are valid. If you receive a parcel of 100 pens. I can
>>>>> say, "has the parcel arrived yet" (one entity) or "have the pens
>>>>> arrived
>>>>> yet" (multiple entities).
>>>>>
>>>>> At any rate, the O.P. wanted to return multiple values called $x
>>>>> and $y.
>>>>> It seems quite reasonable to assume he was returning something akin to
>>>>> coordinates but didn't know how to do so by binding them in an
>>>>> aggregating structure such as an array, or if you wish, an object.
>>>>>
>>>>> Cheers,
>>>>> Rob.
>>>> seriously, whats wrong with returning an array? half the standard php
>>>> functions return array's, therefore at least half of php has been
>>>> designed badly..?
>>>>
>>>> ps: when working with co-ordinates / GIS data you should really be
>>>> using wkb data instead, it's much faster. [unpack]
>>>>
>>> What's wrong with it? Hmm..
>>>
>>> Half of PHP functions DO return arrays, I'll grant you that. The reason?
>>> It's untyped. If PHP were a typed language, and it still returned arrays
>>> for a lot, I definitely think it would be designed poorly.
>>>
>>> At any rate, returning an array from your Objects increases the burden
>>> and shifts it to the client of your API. For instance, if we take an
>>> example mentioned above *getUsers()* which returned an arbitrary number
>>> of User objects you could potentially use it like this.
>>>
>>> userupdater.php
>>>
>>> <?php
>>> $x = Users::getUsers($somefilter)
>>> foreach ($x as $user) {
>>> $user->update();
>>> }
>>> ?>
>>>
>>> Keep in mind. You'll have to rewrite that functionality in multiple
>>> areas. As opposed to:
>>>
>>> <?php
>>>
>>> $x = Users::getGroup($somegroup); // returns a group of users
>>> $x->update(); // can be reused wherever instead of having to loop
>>> through every user on the client side.
>>> ?>
>>>
>>> I hope you can see past my (basic) example to understand where I am
>>> headed with this.
>>>
>> I would, and do, use this magic :)
>>
>> Users::GetGroup($somegroup)->update();
>>
>> Simple, Even less typing then yours :p
>>
> :P. I use that method, too.
>
> It really sucks for debugging though, because what if
> GetGroup($somegroup) returns a null or unexpected value?
>
> Yeah, it sucks. But, doesn't occur enough to be too annoying ;)
>

You built it, make sure it doesn't return anything other than what you want!

--
Jim Lucas

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

Twelfth Night, Act II, Scene V
     by William Shakespeare

attached mail follows:


On Feb 19, 2008 9:52 PM, Richard Lynch <ceol-i-e.com> wrote:
> For ultimate geekiness, you can install a custom PHP extension I wrote
> to print out the error message matching 127:
> http://l-i-e.com/perror
> :-)

    Hmm.... that could come in handy. I'm going to take advantage of
your generosity on this one, Lynch.

    Thanks!

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

attached mail follows:


Daniel Brown wrote:
> Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP),
> whereas the WorldWide Web was first "invented" in 1990. However, if

1989 actually.

> you remember ENQUIRE (on ARPANET), which was created by Tom
> Berners-Lee (I had to look up his name, I couldn't remember it), the

That would be Tim. In fact it's Sir Tim if you want to be pedantic.

> same guy who went on to create the Web, you may remember it existed
> before DNS. So essentially, even though it wasn't yet known as the
> WorldWide Web, a form of it did exist before the Domain Name System.

"A form" of the web existing long before that depending on your
definition of the web. To me it's a way for people to share information.
That would cover the BBS world which pre-dates LANs by some distance.

Anyhoo, back to work.

-Stut

--
http://stut.net/

attached mail follows:


On Feb 20, 2008, at 11:41 AM, Daniel Brown wrote:

> On Feb 19, 2008 10:42 PM, Larry Garfield <larrygarfieldtech.com>
> wrote:
>> On Tuesday 19 February 2008, Daniel Brown wrote:
>>> On Feb 19, 2008 4:43 AM, Christoph <christoph.bogetgmail.com>
>>> wrote:
>>>>> Don't do that.
>>>>> Some sites may or may not use www. for whatever reason...
>>>>> Usually screwed-up A-name records by incompetent sysadmins, but
>>>>> there
>>>>> it is...
>>>>
>>>> Really? So
>>>>
>>>> games.yahoo.com
>>>> blogreport.salon.com
>>>> mirror1.downloads.com
>>>>
>>>> are examples of screwed up records by incompetent sysadmins?
>>>
>>> No, they're properly-configured FQDNs. They're just irrelevant
>>> examples to the context in which Rich was relaying to the OP.
>>>
>>> Picture a server where the A records or CNAMEs don't exist for
>>> the
>>> www. alias. Or, conversely, where the only way to access the domain
>>> is by using the www. alias.
>>>
>>> Those, Christoph, are some of the things incompetent sysops
>>> do....
>>> and on a surprisingly frequent basis.
>>
>> I see, so because I have garfieldtech.com and www.garfieldtech.com
>> pointing to
>> two entirely different servers in different states because I want
>> them to do
>> different things, I'm an incompetent sysop. Thanks, good to know.
>
> Back off, Garfield, my answer couldn't cover everything! ;-P
>
> Besides, without fully-quoting the rest of my message, you're
> taking it all completely out of context.
>
>
>> DNS was used for a lot of things long before the web came around,
>> ya know.
>
> You're full of it. Al Gore never would've invented DNS if he
> didn't have plans to let people "get on the AOL" to go to eBay.
>
> Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP),
> whereas the WorldWide Web was first "invented" in 1990. However, if
> you remember ENQUIRE (on ARPANET), which was created by Tom
> Berners-Lee (I had to look up his name, I couldn't remember it), the
> same guy who went on to create the Web, you may remember it existed
> before DNS. So essentially, even though it wasn't yet known as the
> WorldWide Web, a form of it did exist before the Domain Name System.
>
> Just taking a trip down memory lane. ;-)

I actually read about that in some history books regarding DNS... Man
Brown... You must be old if you actually remember it rather then
reading it! :P

"DNS" as we know it used to be done by editing the hosts file on
individual computers. There was a central list that was published, and
people had to redownload it to get their system to resolve the
different and new domains.

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruimraoset.com

attached mail follows:


On Feb 20, 2008 11:47 AM, Stut <stuttlegmail.com> wrote:
> Daniel Brown wrote:
> > Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP),
> > whereas the WorldWide Web was first "invented" in 1990. However, if
>
> 1989 actually.

    Without putting too much issue into semantics, it wasn't called
the "WorldWide Web" until sometime around Christmas, 1990. There's
probably still an archived version of that first conversation on
USENET.

> > you remember ENQUIRE (on ARPANET), which was created by Tom
> > Berners-Lee (I had to look up his name, I couldn't remember it), the
>
> That would be Tim. In fact it's Sir Tim if you want to be pedantic.

    I believe the word I'm looking for is "D'oh!" And considering the
fact that I explained that I had to look his name up at that moment
makes it all the worse, so perhaps the word should be shouted at the
top of my lungs.

> > same guy who went on to create the Web, you may remember it existed
> > before DNS. So essentially, even though it wasn't yet known as the
> > WorldWide Web, a form of it did exist before the Domain Name System.
>
> "A form" of the web existing long before that depending on your
> definition of the web. To me it's a way for people to share information.
> That would cover the BBS world which pre-dates LANs by some distance.

    Again, it's all in semantics, but I completely agree.

> Anyhoo, back to work.

    Yup.... unfortunately....

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

attached mail follows:


Jason Pruim wrote:
>
> On Feb 20, 2008, at 11:41 AM, Daniel Brown wrote:
>
>> On Feb 19, 2008 10:42 PM, Larry Garfield <larrygarfieldtech.com> wrote:
>>> On Tuesday 19 February 2008, Daniel Brown wrote:
>>>> On Feb 19, 2008 4:43 AM, Christoph <christoph.bogetgmail.com> wrote:
>>>>>> Don't do that.
>>>>>> Some sites may or may not use www. for whatever reason...
>>>>>> Usually screwed-up A-name records by incompetent sysadmins, but there
>>>>>> it is...
>>>>>
>>>>> Really? So
>>>>>
>>>>> games.yahoo.com
>>>>> blogreport.salon.com
>>>>> mirror1.downloads.com
>>>>>
>>>>> are examples of screwed up records by incompetent sysadmins?
>>>>
>>>> No, they're properly-configured FQDNs. They're just irrelevant
>>>> examples to the context in which Rich was relaying to the OP.
>>>>
>>>> Picture a server where the A records or CNAMEs don't exist for the
>>>> www. alias. Or, conversely, where the only way to access the domain
>>>> is by using the www. alias.
>>>>
>>>> Those, Christoph, are some of the things incompetent sysops do....
>>>> and on a surprisingly frequent basis.
>>>
>>> I see, so because I have garfieldtech.com and www.garfieldtech.com
>>> pointing to
>>> two entirely different servers in different states because I want
>>> them to do
>>> different things, I'm an incompetent sysop. Thanks, good to know.
>>
>> Back off, Garfield, my answer couldn't cover everything! ;-P
>>
>> Besides, without fully-quoting the rest of my message, you're
>> taking it all completely out of context.
>>
>>
>>> DNS was used for a lot of things long before the web came around, ya
>>> know.
>>
>> You're full of it. Al Gore never would've invented DNS if he
>> didn't have plans to let people "get on the AOL" to go to eBay.
>>
>> Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP),
>> whereas the WorldWide Web was first "invented" in 1990. However, if
>> you remember ENQUIRE (on ARPANET), which was created by Tom
>> Berners-Lee (I had to look up his name, I couldn't remember it), the
>> same guy who went on to create the Web, you may remember it existed
>> before DNS. So essentially, even though it wasn't yet known as the
>> WorldWide Web, a form of it did exist before the Domain Name System.
>>
>> Just taking a trip down memory lane. ;-)
>
>
> I actually read about that in some history books regarding DNS... Man
> Brown... You must be old if you actually remember it rather then reading
> it! :P
>
> "DNS" as we know it used to be done by editing the hosts file on
> individual computers. There was a central list that was published, and
> people had to redownload it to get their system to resolve the different
> and new domains.
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> japruimraoset.com

so far off topic it's great :)

1: the garfieldtech and www. pointing to two different servers is in my
mind perfectly logical - but also not a great practise due to this www.
thing we all have, everybody (99.9%) "assume" domain.ext and
www.domain.ext have the same endpoint.

2: www is rediculous and so un-needed it's unreal - every body types in
a whole extra 3 letters (4 including the period) for no reason.

3: wants to find a way to ban www. (have done for years)

~idunno
can't wait for 14th March :D

Nath

attached mail follows:


> "A form" of the web existing long before that depending on your
> definition of the web. To me it's a way for people to share information.
> That would cover the BBS world which pre-dates LANs by some distance.

Spider webs have existed for many a year...

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software hosted for you - no
installation, no maintenance, new features automatic and free

attached mail follows:


Richard Heyes wrote:
>> "A form" of the web existing long before that depending on your
>> definition of the web. To me it's a way for people to share
>> information. That would cover the BBS world which pre-dates LANs by
>> some distance.
>
> Spider webs have existed for many a year...

Yeah, but when was the last time you saw porn on one of them?!!

-Stut

--
http://stut.net/

attached mail follows:


On Feb 20, 2008 12:07 PM, Stut <stuttlegmail.com> wrote:
> Richard Heyes wrote:
> >> "A form" of the web existing long before that depending on your
> >> definition of the web. To me it's a way for people to share
> >> information. That would cover the BBS world which pre-dates LANs by
> >> some distance.
> >
> > Spider webs have existed for many a year...

    Not long before the eggs hatched.

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

attached mail follows:


On Wed, 2008-02-20 at 17:07 +0000, Stut wrote:
> Richard Heyes wrote:
> >> "A form" of the web existing long before that depending on your
> >> definition of the web. To me it's a way for people to share
> >> information. That would cover the BBS world which pre-dates LANs by
> >> some distance.
> >
> > Spider webs have existed for many a year...
>
> Yeah, but when was the last time you saw porn on one of them?!!

Well after the money shot the big one ate the little one.

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. |
`------------------------------------------------------------'

attached mail follows:


There are lots out there and the free ones like PHP Nuke (perhaps the grand
daddy of em all) have all suffered from security issues. The price is free
(http://www.phpnuke.org), but the risk is that because hackers can get the
same free source, they can identify weeknesses and exploit them, making
themselves seem to be more clever than they really are (Hacking is an ego
trip I think, and what seems like a shortcut to coding fame, in a world
where hard work is considered for suckers).

Many of the original really bad exploits have been resolved, but a few
remain. Sites that allow anyone to register, and then post content, like
comments on articles or actual articles, is a gold mine to SEO mavins, and
you will find content being posted with comments containing site reference
pointers to porn sites designed to improve search engine rankings of these
same sites. If you don't want to deal with this, you want to stay away from
community sites, or find some way to make the communities very private.

My 2 cents,

Warren Vail

> -----Original Message-----
> From: TS [mailto:sunnrunnergmail.com]
> Sent: Tuesday, February 19, 2008 6:42 PM
> To: php-generallists.php.net
> Subject: [PHP] What community software package gets your vote? PHPfox
> etc...
>
> Hello everyone. I'm not sure what the budget is but, obviously inexpensive
> would be nice. Someone turned me on to PHPfox. Yet I don't have any others
> to compare it to. If you all would be so kind as to put a shout out and
> vote
> on your favorite, I'd be very grateful.
>
> Extendability would also be nice along with customization in terms of
> design.
>
> Much Appreciation,
>
> T
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


On Tue, Feb 19, 2008 at 9:41 PM, TS <sunnrunnergmail.com> wrote:

> Hello everyone. I'm not sure what the budget is but, obviously inexpensive
> would be nice. Someone turned me on to PHPfox. Yet I don't have any others
> to compare it to. If you all would be so kind as to put a shout out and
> vote
> on your favorite, I'd be very grateful.
>
> Extendability would also be nice along with customization in terms of
> design.
>
> Much Appreciation,

dude, you gotta scope this out;
http://cmsmatrix.org/

-nathan

attached mail follows:


Hello and thank you,

Another question, I get a message:

*Warning*: feof(): supplied argument is not a valid stream resource in *
/home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
**
And I've tried troubleshooting for a while; I'm pretty sure I'm opening the
file handle correctly and everything but I can't get feof or similar
functions like fgets to work.

Here is my code if you're interested (it's so that I color every 2nd line in
the text):

*$boardFile = "MessageBoard.txt";
$boardFileHandle = fopen($boardFile,"r");
for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
 $colorLine = fgets(boardFilehandle);
 if ($counter % 2 == 0) {
  echo "<font color='00ff00'>$colorline</font>";
 } else {
  echo $colorline;
 }
}
fclose($boardFileHandle);*

Thank you

attached mail follows:


On Feb 20, 2008, at 4:29 PM, Yuval Schwartz wrote:

> Hello and thank you,
>
> Another question, I get a message:
>
> *Warning*: feof(): supplied argument is not a valid stream resource
> in *
> /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
> **
> And I've tried troubleshooting for a while; I'm pretty sure I'm
> opening the
> file handle correctly and everything but I can't get feof or similar
> functions like fgets to work.
>
> Here is my code if you're interested (it's so that I color every 2nd
> line in
> the text):
>
> *$boardFile = "MessageBoard.txt";
> $boardFileHandle = fopen($boardFile,"r");
> for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
> $colorLine = fgets(boardFilehandle);
> if ($counter % 2 == 0) {

I may be showing my ignorance here... But on your if ($counter % 2
==0) line what does the "%" do? Was that possibly a typo?

Also, it might be good to point out what line 52 is :)

>
> echo "<font color='00ff00'>$colorline</font>";
> } else {
> echo $colorline;
> }
> }
> fclose($boardFileHandle);*
>
>
>
>
> Thank you

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
japruimraoset.com

attached mail follows:


>
> *$boardFile = "MessageBoard.txt";
> $boardFileHandle = fopen($boardFile,"r");
> for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
> $colorLine = fgets(boardFilehandle);
> if ($counter % 2 == 0) {
> echo "<font color='00ff00'>$colorline</font>";
> } else {
> echo $colorline;
> }
> }
> fclose($boardFileHandle);*

 Looks like you're missing a $ on line 4:
 $colorLine = fgets(boardFilehandle);

Should be
 $colorLine = fgets($boardFilehandle);

[snip]
I may be showing my ignorance here... But on your if ($counter % 2
==0) line what does the "%" do? Was that possibly a typo?
[/snip]

It's the modulus operator; he's trying to make every other line a different
color. :)

-- Greg

attached mail follows:


> -----Original Message-----
> From: Jason Pruim [mailto:japruimraoset.com]
> Sent: Wednesday, February 20, 2008 4:39 PM
> To: Yuval Schwartz
> Cc: php-generallists.php.net
> Subject: Re: [PHP] Php warning message
>
>
> On Feb 20, 2008, at 4:29 PM, Yuval Schwartz wrote:
>
> > Hello and thank you,
> >
> > Another question, I get a message:
> >
> > *Warning*: feof(): supplied argument is not a valid stream resource
> > in *
> > /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
> > **
> > And I've tried troubleshooting for a while; I'm pretty sure I'm
> > opening the
> > file handle correctly and everything but I can't get feof or similar
> > functions like fgets to work.
> >
> > Here is my code if you're interested (it's so that I color every 2nd
> > line in
> > the text):
> >
> > *$boardFile = "MessageBoard.txt";
> > $boardFileHandle = fopen($boardFile,"r");
> > for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
> > $colorLine = fgets(boardFilehandle);
> > if ($counter % 2 == 0) {
>
> I may be showing my ignorance here... But on your if ($counter % 2
> ==0) line what does the "%" do? Was that possibly a typo?
>
> Also, it might be good to point out what line 52 is :)
>
> >
> > echo "<font color='00ff00'>$colorline</font>";
> > } else {
> > echo $colorline;
> > }
> > }
> > fclose($boardFileHandle);*
> >
> >
> >
> >
> > Thank you
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> japruimraoset.com
>

% is the modulus (= remainder most of the time) operator. 8 % 2 == 0, 9 % 4 ==
1, etc

You are missing a $ at fgets(boardFilehandle); (should be
fgets($boardFilehandle);).

Are you sure the file handle is valid anyway?

//
$boardFileHandle = fopen($boardFile,"r");
If ($boardFileHandle) {
        die("very bad things happen these days");
}
//

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 |
Email: infobestplace.net  | MSN Chat: bestbestplace.net  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

attached mail follows:


> I may be showing my ignorance here... But on your if ($counter % 2 ==0)
> line what does the "%" do? Was that possibly a typo?

% is the modulus operator, so basically that will alternate between a
line having a font tag and not having a font tag.

http://www.php.net/operators.arithmetic

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

attached mail follows:


On Wed, Feb 20, 2008 at 4:38 PM, Jason Pruim <japruimraoset.com> wrote:
> I may be showing my ignorance here... But on your if ($counter % 2
> ==0) line what does the "%" do? Was that possibly a typo?

    "If the line is divisible by 2."

>
> Also, it might be good to point out what line 52 is :)

    He did.... it's the line on which you'll find foef(). ;-P

    Yuval,

    Change your code to:

<?
$filename = "./MessageBoard.txt";
$handle = fopen($filename,"r");
for($counter=1;!feof($handle);$counter++) {
        $colorline = fgets($handle);
        if ($counter % 2 == 0) {
                echo "<font color=\"#00ff00\" />".$colorline."</font>\n";
        } else {
                echo $colorline;
        }
}
fclose($handle);
?>

--
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

attached mail follows:


At 11:29 PM +0200 2/20/08, Yuval Schwartz wrote:
>Hello and thank you,
>
>Here is my code if you're interested (it's so that I color every 2nd line in
>the text):

Try something like this instead.

In your html:

<tr class="row<?php echo($j++ & 1 );?>">

In your css:

.row0
        {
          background-color: #B3C6FF; /* blue */
        }

.row1
        {
          background-color: #FFDD75; /* yellow */
        }

You're welcome and goodbye.

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


On Feb 20, 2008, at 1:29 PM, "Yuval Schwartz"
<yuval.schwartzgmail.com> wrote:

> Hello and thank you,
>
> Another question, I get a message:
>
> *Warning*: feof(): supplied argument is not a valid stream resource
> in *
> /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
> **
> And I've tried troubleshooting for a while; I'm pretty sure I'm
> opening the
> file handle correctly and everything but I can't get feof or similar
> functions like fgets to work.
>
> Here is my code if you're interested (it's so that I color every 2nd
> line in
> the text):
>
> *$boardFile = "MessageBoard.txt";
> $boardFileHandle = fopen($boardFile,"r");
> for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
> $colorLine = fgets(boardFilehandle);
> if ($counter % 2 == 0) {
> echo "<font color='00ff00'>$colorline</font>";
> } else {
> echo $colorline;
> }

The loop looks ugly :/
$colored = false;
while (!feof($boardFileHandle)) {
     $line = fgets($boardFileHandle);
     if ($colored)
         echo '<span class="colored">', $line, '</span><br />';
     else
         echo $line, '<br />';
     $colored = !$colored;
}

>
> }
> fclose($boardFileHandle);*
>
>
>
>
> Thank you

attached mail follows:


Yuval Schwartz wrote:
> Hello and thank you,
>
> Another question, I get a message:
>
> *Warning*: feof(): supplied argument is not a valid stream resource in *
> /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
> **
> And I've tried troubleshooting for a while; I'm pretty sure I'm opening the
> file handle correctly and everything but I can't get feof or similar
> functions like fgets to work.
>
> Here is my code if you're interested (it's so that I color every 2nd line in
> the text):
>
> *$boardFile = "MessageBoard.txt";
> $boardFileHandle = fopen($boardFile,"r");
> for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
> $colorLine = fgets(boardFilehandle);
> if ($counter % 2 == 0) {
> echo "<font color='00ff00'>$colorline</font>";
> } else {
> echo $colorline;
> }
> }
> fclose($boardFileHandle);*
>
>
>
>
> Thank you
>

I might do something like:

if(($lines = file("MessageBoard.txt"))) {
    foreach ($lines as $num => $line){
        if($num % 2 == 0) {
            echo "<font color='00ff00'>$line</font><br />";
        } else {
            echo "$line<br />";
        }
    }
}

attached mail follows:


Yuval Schwartz schreef:
> Hello and thank you,
>
> Another question, I get a message:
>
> *Warning*: feof(): supplied argument is not a valid stream resource in *
> /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
> **
> And I've tried troubleshooting for a while; I'm pretty sure I'm opening the
> file handle correctly and everything but I can't get feof or similar
> functions like fgets to work.

you pretty sure? your code doesn't check that the file handle is valid.

>
> Here is my code if you're interested (it's so that I color every 2nd line in
> the text):
>
> *$boardFile = "MessageBoard.txt";

do you know what the current working directory is? my guess
is that whatever it is the text file is not in that directory.
try setting an absolute path to the text file e.g.

$boardFile = "/path/to/my/MessageBoard.txt";

and then do something like ...

> $boardFileHandle = fopen($boardFile,"r");

if (!$boardFileHandle)
        die ('no messages, or something equally annoying!');

> for ($counter = 1; !feof($boardFileHandle); $counter += 1) {
> $colorLine = fgets(boardFilehandle);
> if ($counter % 2 == 0) {
> echo "<font color='00ff00'>$colorline</font>";

the font tag is evil - go read alistapart for the next 6 hours ;-)

> } else {
> echo $colorline;
> }
> }
> fclose($boardFileHandle);*
>
>
>
>
> Thank you
>

attached mail follows:


Daniel Brown wrote:
> On Feb 20, 2008 10:30 AM, Mário Gamito <gamitogmail.com> wrote:
>
> Please keep the replies on-list, Mario. It helps others out, and
> ensures that you'll get better advice from a larger group of talented
> people.
>
>>> <?
>>> $username = "lixo";
>>> exec('su -c - vpopmail "/var/qmail/bin/maildirmake
>>> /home/vpopmail/domains/wwlib.lan/'.$username.'"',$ret,$err);
>>> echo "<pre />\n";
>>> print_r($ret);
>>> echo "</pre>\n";
>>> echo isset($err) ? "Error: ".$err : null;
>>> ?>
>> No output at all and I have "display_errors = On" in php.ini
>>
>> Still no directory creation.
>>
>> If I run the file as user vpopmail it asks me for a password:
>>
>> # su - vpopmail
>> $ php /home/www/hash.php
>>
>> Output:"
>> [vpopmailcruzador ~]$ php /home/www/hash.php
>> Password:"
>
> It's because you can't automate su - without using an intermediary
> such as 'expect'.

You can use sudo to allow specific commands to be run.

http://www.sudo.ws/sudo/man/sudoers.html#examples

Though I highly recommend you just dump this stuff to a database or
something and have a cron job running every 5 minutes to check for new
accounts to create etc.

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

attached mail follows:


> Back to my 'original' problem/question, if I '$f = fopen("$file",
> "r")' and 'while ($data = fgets($f))' on the above first format and do
> a $data = str_replace("\t",",",$data); the resulting file looks like
> the second example above when opened into Textpad but will not open
> into separate columns when opened with Excel.

Look up http://www.php.net/fgetcsv

and pass "\t" as the field separator.

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

attached mail follows:


On Wed, Feb 20, 2008 at 9:50 PM, Chris <dmagickgmail.com> wrote:
>
> > Back to my 'original' problem/question, if I '$f = fopen("$file",
> > "r")' and 'while ($data = fgets($f))' on the above first format and do
> > a $data = str_replace("\t",",",$data); the resulting file looks like
> > the second example above when opened into Textpad but will not open
> > into separate columns when opened with Excel.
>
> Look up http://www.php.net/fgetcsv
>
> and pass "\t" as the field separator.
>

I give up :-(

My script was using fgetcsv() with ',' as delimiter quite happily for
3 years before the 3rd party changed to Cognos. I have a problem with
file encoding and I really don't understand enough about that.

The files are (I'm told) sent to me in UTF-8 multibyte. My PHP scripts
can't read them correctly so I tried using utf8_encode which made
slight progress (individual fields recognised in delimited file) but
then comparing a utf8_encoded string with one obtained from MySQL then
causes problems, such that utf8_encoded "PRIVATE" does not equal MySQL
sourced "PRIVATE".

The amount of time I'm 'wasting' with this problem will soon exceed
that required to manually convert my 100+ files so it's going on teh
"to do" list and maybe I'll revisit it at a later date.

--
Graham

attached mail follows:


>>> I don't mean unset($this) is the best wy to allow an object to destroy
>>> itself. I just say we miss something to auto destroy objects.
>>> We could also think about a magic method like __destroy().
>> An object that destroys itself is a really bad idea from an architectural
>> point of view. I, as a consumer of your class, need to have control over
>> the lifetime of any instances I create. In my opinion if you have a need
>> for a class to destroy itself then you have a fundamental design flaw.
>
> I want the object to be destroyed when a specific method of this object is
> called because when it has been called, the object has no reason to exist
> anymore.
>
> It's like a SQL resource, when you have freed it, you don't need it anymore.

$my_object = new Blah();
$my_object->DoStuff();
....
unset($my_object);

As long as you don't have any references (as in these sort:
http://www.php.net/manual/en/language.references.php) to $my_object then
the memory will be freed.

> I would like to implement it in order to delete automaticly from memory
> useless objects.
> It can be really useful for example to make schedulers in PHP in order to
> avoid "max memory usage exceeded" errors.

Sprinkle your code with memory_get_usage() calls and see where your
memory is being used and concentrate on the areas with big jumps first.

php can definitely support long running scripts with an even amount of
memory used (mine run for 3-4 hours on a prod machine and use no more
than 6-10meg depending on data).

Another approach would be to use xdebug and profile your scripts and
concentrate on the areas that use the most cpu time because they'll
probably be the most called code.

http://xdebug.org/docs/profiler

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

attached mail follows:


this is a php generals type of question.

Sebastian schreef:
> hi,
>
> why isn't it possible to assign class constants like this:
>
> class test
> {
> const
> DIR='dirname'.DIRECTORY_SEPARATOR.'anotherdirname'.DIRECTORY_SEPARATOR;
> }
>
> is there some performance issue?

classes are defined at compile time, so are their const declarations - it's
not possible to evaluate an expression at compile time.

with define('FOO', 'bar'.QUX); you can do it because the define occurs at run time.

> anyone ever tried this or was there a discussion about it? i would find this
> very useful.....

find another way to do 'it' :-)

>
> greetings
>

attached mail follows:


thank you tedd,

I understood what you explained to me last time. I was
wondering if there is another method to prevent that.

Thanks

--- tedd <tedd.sperlinggmail.com> wrote:

> At 2:45 PM -0800 2/19/08, Adil Drissi wrote:
> >Hi,
> >
> >Below you'll find my code. I think now that the
> >problem is in my algorithm, because the is created
> >anytime the page is refreshed. But i don't know how
> to
> >check if the client was logged out or it is a real
> new
> >connexion to the page. As you will see one can
> click
> >on logout, then press the back button of the
> browser,
> >and then refresh the page, but he is still
> connected.
> >I would like to help me fixe that. Here is the
> code:
>
> You received an answer, but fail to understand.
>
> Unless you use javascript to manipulate the
> browser's history you are
> going to continue to have "problems" with the user
> browser's back
> button.
>
> But, explain why the user using the back button is a
> problem. If he
> logs in, he's in. If he logs out, he's out. If he
> hits the back
> button after logging out and cancels his log out --
> so what? What
> problems does that present?
>
> Cheers,
>
> tedd
>
>
> --
> -------
> http://sperling.com http://ancientstones.com
> http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

attached mail follows:


Let me try and answer your questions.

Do you need to receive SMS? If you need to receive SMS, you will need to
host your own GSM device or modem so that people can send you SMS.

If not, you can just use internet SMS gateways like clickatell to do the
work, and post to them by HTTP, XML or email. The cost is about 6-8 cents
per SMS. There are cheaper services, but not always reliable. If you need to
host your own GSM device, you can use software like http://www.kannel.org
(GPL Open Source) or http://www.visualgsm.com.

Regards,
SMS Gateway Expert
http://www.visualtron.com

AmirBehzad Eslami-3 wrote:
>
> Hi,
>
> How can i send SMS messages via PHP? How can i set SMS-headers (UDH)?
> Does anyone know some article/class/package about this issue?
>
> Thank you in advance,
> -b
>
>

--
View this message in context: http://www.nabble.com/Sending-SMS-via-PHP-tp14475937p14681701.html
Sent from the PHP - General mailing list archive at Nabble.com.