php-general Digest 22 Oct 2008 08:05:55 -0000 Issue 5749

Topics (messages 282210 through 282227):

class and inheritance
        282210 by: Alain Roger
        282211 by: Maciek Sokolewicz
        282224 by: Alain Roger

Re: 2 successive commands in one shell_exec?
        282212 by: Oscar Gosdinski

Re: display_errors in DEV
        282213 by: Mike van Riel

Question about __destruct()
        282214 by: Dan Joseph
        282215 by: Mike van Riel
        282216 by: Jochem Maas
        282217 by: Stut
        282218 by: Jochem Maas

Re: How to Execute Exe File from PHP
        282219 by: Alice Wei

-help
        282220 by: devta singh

Re: ZendOptimizer + APC
        282221 by: Nathan Nobbe
        282227 by: Sancar Saran

Mysql search
        282222 by: Ryan S
        282223 by: Robert Cummings
        282225 by: Ryan S

Re: Mass email
        282226 by: Andrew Johnstone

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'm trying to create a class that has as public members some other class
object.
for that i use almost the same syntax as under C# or C++.

header class:

> <?php
> class CARMainHeader
> {
>     // title of the main table header
>     private $mTitle = null;
>
>     // holds the height of the table header
>     private $mHeight = null;
>
>     // constructor
>     public function __construct()
>     {
>         $this->mHeight = 15;
>         $this->mTitle = "Title";
>     }
>
>     // set the title of the main table
>     public function SetTitle($name)
>     {
>         $this->mTitle = $name;
>     }
>
>     // return the title of the main table
>     public function GetTitle()
>     {
>         return $this->mTitle;
>     }
>
>     // set the height of the header
>     public function SetHeight($height)
>     {
>         $this->mHeight = $height;
>     }
>
>     // return the height of the header
>     public function GetHeight()
>     {
>         return $this->mHeight;
>     }
> }
> ?>
>

main class code :

> <?php
> include_once 'CARMainHeader.php';
>
> class CARTable
> {
>     // holds the main table header object
>     public $mTableHeader = null;
>
>     // store the amount of columns in table
>     private $mColumnsCount = null;
>
>     // constructor
>     public function __construct()
>     {
>         $this->mTableHeader = new CARMainHeader();
>     }
>
>     // rendering of table
>     public function Render()
>     {
>         echo "<table>";
>         echo "<tr />";
>         echo "<td class=''>".$this->mTableHeader->;
>         echo "</td>";
>         echo "<td class=''>";
>         echo "</td>";
>         echo "</table>";
>     }
> }
> ?>
>

in the CARTable, i'm not able in the Render function to write
$this->mTableHeader->GetTitle();
why ?

-- 
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
Alain Roger wrote:
Hi,

I'm trying to create a class that has as public members some other class
object.
for that i use almost the same syntax as under C# or C++.

header class:

<?php
class CARMainHeader
{
    // title of the main table header
    private $mTitle = null;

    // holds the height of the table header
    private $mHeight = null;

    // constructor
    public function __construct()
    {
        $this->mHeight = 15;
        $this->mTitle = "Title";
    }

    // set the title of the main table
    public function SetTitle($name)
    {
        $this->mTitle = $name;
    }

    // return the title of the main table
    public function GetTitle()
    {
        return $this->mTitle;
    }

    // set the height of the header
    public function SetHeight($height)
    {
        $this->mHeight = $height;
    }

    // return the height of the header
    public function GetHeight()
    {
        return $this->mHeight;
    }
}
?>


main class code :

<?php
include_once 'CARMainHeader.php';

class CARTable
{
    // holds the main table header object
    public $mTableHeader = null;

    // store the amount of columns in table
    private $mColumnsCount = null;

    // constructor
    public function __construct()
    {
        $this->mTableHeader = new CARMainHeader();
    }

    // rendering of table
    public function Render()
    {
        echo "<table>";
        echo "<tr />";
        echo "<td class=''>".$this->mTableHeader->;
you're missing something here, don't you think? :)
        echo "</td>";
        echo "<td class=''>";
        echo "</td>";
        echo "</table>";
    }
}
?>


in the CARTable, i'm not able in the Render function to write
$this->mTableHeader->GetTitle();
why ?

you can, and it works. Once you actually call that method.

- Tul

--- End Message ---
--- Begin Message ---
basically i did this but Zend studio for eclipse does not show me the data
or methods members after one -> :-(

On Tue, Oct 21, 2008 at 9:11 PM, Maciek Sokolewicz <[EMAIL PROTECTED]>wrote:

> Alain Roger wrote:
>
>> Hi,
>>
>> I'm trying to create a class that has as public members some other class
>> object.
>> for that i use almost the same syntax as under C# or C++.
>>
>> header class:
>>
>>  <?php
>>> class CARMainHeader
>>> {
>>>    // title of the main table header
>>>    private $mTitle = null;
>>>
>>>    // holds the height of the table header
>>>    private $mHeight = null;
>>>
>>>    // constructor
>>>    public function __construct()
>>>    {
>>>        $this->mHeight = 15;
>>>        $this->mTitle = "Title";
>>>    }
>>>
>>>    // set the title of the main table
>>>    public function SetTitle($name)
>>>    {
>>>        $this->mTitle = $name;
>>>    }
>>>
>>>    // return the title of the main table
>>>    public function GetTitle()
>>>    {
>>>        return $this->mTitle;
>>>    }
>>>
>>>    // set the height of the header
>>>    public function SetHeight($height)
>>>    {
>>>        $this->mHeight = $height;
>>>    }
>>>
>>>    // return the height of the header
>>>    public function GetHeight()
>>>    {
>>>        return $this->mHeight;
>>>    }
>>> }
>>> ?>
>>>
>>>
>> main class code :
>>
>>  <?php
>>> include_once 'CARMainHeader.php';
>>>
>>> class CARTable
>>> {
>>>    // holds the main table header object
>>>    public $mTableHeader = null;
>>>
>>>    // store the amount of columns in table
>>>    private $mColumnsCount = null;
>>>
>>>    // constructor
>>>    public function __construct()
>>>    {
>>>        $this->mTableHeader = new CARMainHeader();
>>>    }
>>>
>>>    // rendering of table
>>>    public function Render()
>>>    {
>>>        echo "<table>";
>>>        echo "<tr />";
>>>        echo "<td class=''>".$this->mTableHeader->;
>>>
>> you're missing something here, don't you think? :)
>
>>        echo "</td>";
>>>        echo "<td class=''>";
>>>        echo "</td>";
>>>        echo "</table>";
>>>    }
>>> }
>>> ?>
>>>
>>>
>> in the CARTable, i'm not able in the Render function to write
>> $this->mTableHeader->GetTitle();
>> why ?
>>
>>  you can, and it works. Once you actually call that method.
>
> - Tul
>



-- 
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
On Mon, Oct 20, 2008 at 9:16 PM, Govinda <[EMAIL PROTECTED]> wrote:
> I mean I need to do that, and so with my very newbie level of understanding
> I think I need to have that shell_exec essentially do 2 things at once:
> -goto the right dir, and then
> -fire the script in that dir.
> like these 2 successive commands in terminal:
> cd $MyPath
> ./MyOtherCGI.cgi

cd $MyPath && ./MyOtherCGI.cgi

or you maybe using full path:

$MyPath/MyOtherCGI.cgi

-- 
Saludos
Oscar

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Until recently, I've thought that display_errors in DEV was "good"

But as soon as you move into Ajax Web 2.0 world, it really doesn't cut it.

You'll never see the E_NOTICE and E_WARNING errors for Ajax, probably, and the whole 
thing might "just work" but you'll have plenty of buggy code.

I think it's time for the PHP team to recommend log_errors across the board.

What do you think?


You can also write a custom errorhandler which writes to a log file or to the syslog. I use a custom errorhandling class which registers itself and sends all errors (even fatals) there. Thsi way you can have easy and quick access to errors but not the hassle of disruptive output.
--- End Message ---
--- Begin Message ---
Hi,

I want to make sure I completely understand __destruct() and when its hit...

Understand that it will run if all references to a particular object are
removed, but is that also true when a page ends its execution?

Example, I call a database class.  It constructs, connects, then my page
pulls some stuff out of the database, and then the php script ends.  Does
this also cause the deconstruct to execute?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

--- End Message ---
--- Begin Message ---
Dan Joseph wrote:
Hi,

I want to make sure I completely understand __destruct() and when its hit...

Understand that it will run if all references to a particular object are
removed, but is that also true when a page ends its execution?

Example, I call a database class.  It constructs, connects, then my page
pulls some stuff out of the database, and then the php script ends.  Does
this also cause the deconstruct to execute?


When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution.


--- End Message ---
--- Begin Message ---
Mike van Riel schreef:
> Dan Joseph wrote:
>> Hi,
>>
>> I want to make sure I completely understand __destruct() and when its
>> hit...
>>
>> Understand that it will run if all references to a particular object are
>> removed, but is that also true when a page ends its execution?
>>
>> Example, I call a database class.  It constructs, connects, then my page
>> pulls some stuff out of the database, and then the php script ends.  Does
>> this also cause the deconstruct to execute?
>>
> 
> When a script ends everything is released (with some small exceptions),
> thus also all references to instances of classes.
> Thus AFAIK a deconstructor will always be called at the end of script
> execution.
> 

but you have no control over what order dtors are called and you can't make
any assumptions about state of file handles to STDIN/STDOUT and things like
that ... personally I find dtors run at end of script to be nigh on
useless.

> 


--- End Message ---
--- Begin Message ---
On 21 Oct 2008, at 22:08, Jochem Maas wrote:
Mike van Riel schreef:
Dan Joseph wrote:
Hi,

I want to make sure I completely understand __destruct() and when its
hit...

Understand that it will run if all references to a particular object are
removed, but is that also true when a page ends its execution?

Example, I call a database class. It constructs, connects, then my page pulls some stuff out of the database, and then the php script ends. Does
this also cause the deconstruct to execute?


When a script ends everything is released (with some small exceptions),
thus also all references to instances of classes.
Thus AFAIK a deconstructor will always be called at the end of script
execution.


but you have no control over what order dtors are called and you can't make any assumptions about state of file handles to STDIN/STDOUT and things like
that ... personally I find dtors run at end of script to be nigh on
useless.

I use destructors to update dirty objects in memcache. I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page.

They're far from useless.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Stut schreef:
> On 21 Oct 2008, at 22:08, Jochem Maas wrote:
>> Mike van Riel schreef:
>>> Dan Joseph wrote:
>>>> Hi,
>>>>
>>>> I want to make sure I completely understand __destruct() and when its
>>>> hit...
>>>>
>>>> Understand that it will run if all references to a particular object
>>>> are
>>>> removed, but is that also true when a page ends its execution?
>>>>
>>>> Example, I call a database class.  It constructs, connects, then my
>>>> page
>>>> pulls some stuff out of the database, and then the php script ends. 
>>>> Does
>>>> this also cause the deconstruct to execute?
>>>>
>>>
>>> When a script ends everything is released (with some small exceptions),
>>> thus also all references to instances of classes.
>>> Thus AFAIK a deconstructor will always be called at the end of script
>>> execution.
>>>
>>
>> but you have no control over what order dtors are called and you can't
>> make
>> any assumptions about state of file handles to STDIN/STDOUT and things
>> like
>> that ... personally I find dtors run at end of script to be nigh on
>> useless.
> 
> I use destructors to update dirty objects in memcache. 

care to eloborate ... sounds interesting.

I also use them
> in my template class to optionally automagically output the footer
> without needing an explicit call on each page.

not sure if I find that of much use, I see the validity but 1 LOC to
eplicitly output a page footer seems to me to be less of a wtf than
an(other) bit of auto-magic to save what is probably a very short simple
method call.

> They're far from useless.

true. but they are limited, there is no garantee any other object
will still exist when a particular dtor is run [at shutdown] which means a 
heavy OO
codebase cannot have object automated object interaction at shutdown ... there
are other gotchas (e.g. closed file descriptors to STDIN/STDOUT)

interaction with memcache though is a really good example. and I'd like to
learn a little more :-D

> -Stut
> 


--- End Message ---
--- Begin Message ---
HI, 

  To answer your questions, I run this on Windows. What is so weird is that 
when I do 

$a= shell_exec("C:\Inetpub\wwwroot\/test.exe -m$market -d$length");
echo $a;

It works, and echoes everything as it is supposed to, and the file is also 
generated like I expected. However, the PHP file where I execute this from is 
in the same folder (which is why I thought using a . would work) 

Could anyone please tell me if this is only way Ito do this on a Windows 
machine? 

Thanks in advance, I think I am getting a little confused.

Alice



_________________________________________________________________
Search from any Web page with powerful protection. Get the FREE Windows Live 
Toolbar Today!
http://get.live.com/toolbar/overview

--- End Message ---
--- Begin Message ---
-- 
---------------------
Devta Singh
http://yogakundalini.com/
http://devta.wordpress.com/
Nada hay como ver despertar a otros y verles expandir su conciencia, salvo
hacerlo uno mismo.

--- End Message ---
--- Begin Message ---
On Tue, Oct 21, 2008 at 10:35 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:

> anyone know whether running ZendOptimizer + APC simultaneously still causes
> allsorts
> of problems ... I know it did in the past but I can't find any very recent
> stuff about the
> issues online.


never tried it, but 2 small things worth a mention;

1. supposedly eacellerator has some sort of optimizer
2. apc is getting optimization support, but im not sure when it will usable

-nathan

--- End Message ---
--- Begin Message ---
On Tuesday 21 October 2008 19:35:53 Jochem Maas wrote:
> anyone know whether running ZendOptimizer + APC simultaneously still causes
> allsorts of problems ... I know it did in the past but I can't find any
> very recent stuff about the issues online.

You have to buy Zend Performance platform. Thats why ZendOptimizer + APC 
doesn't work together.

Regards

Sancar

--- End Message ---
--- Begin Message ---
Hey all,
I have two columns in my DB 
title varchar(254)
 and 
jtext text

which I would like to search, as the user might enter two or more words I am 
opting not to use LIKE %search_term% so started searching google, I came across 
this very promising class:
http://code.activestate.com/recipes/125901/

but when i tried to run it I am just getting a blank page, no errors or 
anything.

Am hoping someone out there can recommend a better script or maybe share some 
of your own code?

Any help would be appreciated.

Thanks,
Ryan

 ------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



      

--- End Message ---
--- Begin Message ---
On Tue, 2008-10-21 at 21:48 -0700, Ryan S wrote:
> Hey all,
> I have two columns in my DB 
> title varchar(254)
>  and 
> jtext text
> 
> which I would like to search, as the user might enter two or more words I am 
> opting not to use LIKE %search_term% so started searching google, I came 
> across this very promising class:
> http://code.activestate.com/recipes/125901/
> 
> but when i tried to run it I am just getting a blank page, no errors or 
> anything.
> 
> Am hoping someone out there can recommend a better script or maybe share some 
> of your own code?
> 
> Any help would be appreciated.

Do it right... read up on MySQL's fulltext matching.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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

 
<clipp>
> Am hoping someone out there can recommend a better script or maybe share some 
> of your own code?
> 
> Any help would be appreciated.

Do it right... read up on MySQL's fulltext matching.

Cheers,
Rob.
</clipp>

Did some searching based on your tip, got what i was looking for, just didnt 
know where to start.. and now feeling like the man who was taught how to fish :D

Thanks!
R



      

--- End Message ---
--- Begin Message ---
Before considering outsourcing this you should consider the following.

1. Frequency of emails, I.e daily, weekly, monthly etc.
2. Hosting, are you on dedicated servers, shared hosting.
  a) do you control the domain name, enough to enable rDNS.
b) does your hosting company restrict out going emails? I had issues with and1 doing this
3. Do you expect to increase the number of emails being sent?

If your expecting to send out frequently, and have close control over what each recipient is sent you will most likely have to work with an Api or look at creating an email system yourself.

I spent a couple of days writing an email system for a client and ourselves,

Sent from my iPhone

On 21 Oct 2008, at 08:54, "Richard Heyes" <[EMAIL PROTECTED]> wrote:

I have a client who wants to send out mass emails to 37,000+ opt-in members
(i.e., not spam).

Any suggestions as to the best way to do this?

Outsource it.

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org

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


--- End Message ---

Reply via email to