php-general Digest 5 Dec 2007 07:48:09 -0000 Issue 5164

Topics (messages 265451 through 265463):

Re: Banned from #php
        265451 by: Daniel Brown
        265452 by: Michael McGlothlin

References to a variable and scope
        265453 by: Cesar D. Rodas
        265455 by: Robert Cummings
        265456 by: Cesar D. Rodas

Re: Calendar
        265454 by: Børge Holen
        265458 by: Andrew Ballard

Re: howto get .tar.gz content's filenames
        265457 by: Cesar D. Rodas
        265463 by: Per Jessen

// ?>
        265459 by: Kevin Schmeichel
        265460 by: Cesar D. Rodas
        265461 by: Daniel Brown
        265462 by: Martin Alterisio

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 Dec 4, 2007 10:21 AM, tedd <[EMAIL PROTECTED]> wrote:
> I always like to see (have an example) of how it's done, but then I
> rewrite everything to fit with my view of the world.


    No wonder your code looks crooked.  ;-P

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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

That works for me, but I seldom use their code.

I always like to see (have an example) of how it's done, but then I rewrite everything to fit with my view of the world.
I seldom like other people's coding style. Most programmers seem to like their code tight and I like mine fluffy.

--
Michael McGlothlin
Southwest Plumbing Supply

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

I know that PHP doesn't support pointers to a variable, instead of that
there is references to a variable which are similar to pointers, right?

BTW, what I want to do is to save a references to a variable and read the
content when I need, similar to PDO "bindParam". I will try to explain
better in the following pseudo php code.

function foo($a) {
       $GLOBALS['references']['a'] = /*references to $a */
}

function bar() {
      echo $GLOBALS['references']['a'];
}

$var="hello"
foo($var);
$var = "hi";
bar(); /* it should print "hi" instead of "hello" */

-- 
Best Regards

Cesar D. Rodas
www.cesarodas.com
www.thyphp.com
www.phpajax.org
Phone: +595-961-974165

--- End Message ---
--- Begin Message ---
On Tue, 2007-12-04 at 16:58 -0400, Cesar D. Rodas wrote:
> Hello,
> 
> I know that PHP doesn't support pointers to a variable, instead of that
> there is references to a variable which are similar to pointers, right?
> 
> BTW, what I want to do is to save a references to a variable and read the
> content when I need, similar to PDO "bindParam". I will try to explain
> better in the following pseudo php code.
> 
> function foo($a) {
>        $GLOBALS['references']['a'] = /*references to $a */
> }
> 
> function bar() {
>       echo $GLOBALS['references']['a'];
> }
> 
> $var="hello"
> foo($var);
> $var = "hi";
> bar(); /* it should print "hi" instead of "hello" */

Your code is broken:

<?php

function foo( &$a )
{
    $GLOBALS['references']['a'] = &$a; /*references to $a */
}

function bar()
{
      echo $GLOBALS['references']['a'];
}

$var="hello"
foo($var);
$var = "hi";
bar(); /* it should print "hi" instead of "hello" */

?>

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
On 04/12/2007, Cesar D. Rodas <[EMAIL PROTECTED]> wrote:
>
> Robert,
>
> On 04/12/2007, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >
> > On Tue, 2007-12-04 at 16:58 -0400, Cesar D. Rodas wrote:
> > > Hello,
> > >
> > > I know that PHP doesn't support pointers to a variable, instead of
> > that
> > > there is references to a variable which are similar to pointers,
> > right?
> > >
> > > BTW, what I want to do is to save a references to a variable and read
> > the
> > > content when I need, similar to PDO "bindParam". I will try to explain
> > > better in the following pseudo php code.
> > >
> > > function foo($a) {
> > >        $GLOBALS['references']['a'] = /*references to $a */
> > > }
> > >
> > > function bar() {
> > >       echo $GLOBALS['references']['a'];
> > > }
> > >
> > > $var="hello"
> > > foo($var);
> > > $var = "hi";
> > > bar(); /* it should print "hi" instead of "hello" */
> >
> > Your code is broken:
>
>
> I knew that, that was a pseudo code. I've try something similar but
> doesn't work.
>
> <?php
> >
> > function foo( &$a )
> > {
> >     $GLOBALS['references']['a'] = &$a; /*references to $a */
> > }
> >
> > function bar()
> > {
> >       echo $GLOBALS['references']['a'];
> > }
> >
> > $var="hello"
> > foo($var);
> > $var = "hi";
> > bar(); /* it should print "hi" instead of "hello" */
> >
> > ?>
> >
> > Cheers,
> > Rob.
> > --
> > ...........................................................
> > SwarmBuy.com - http://www.swarmbuy.com
> >
> >     Leveraging the buying power of the masses!
> > ...........................................................
> >
>
>
> What you code is working, I am so happy for that... the references of a
> reference works,
> thank you! :-)
>
> --
> Best Regards
>
> Cesar D. Rodas
> http://www.cesarodas.com
> http://www.thyphp.com
> http://www.phpajax.org
> Phone: +595-961-974165




-- 
Best Regards

Cesar D. Rodas
http://www.cesarodas.com
http://www.thyphp.com
http://www.phpajax.org
Phone: +595-961-974165

--- End Message ---
--- Begin Message ---
On Monday 03 December 2007 13:37:45 Emil Edeholt wrote:
> Hi,
>

was this a mathematical question? Yes, someone on this list, can probably help 
you to do some finesse, but I like it mathematical and clean code

> I'm about to add some simple calendar functions to my application, and
> I'm thinking of how I should implement recurring events. Are there one 
> standard way most people use that works well? 

a timestamp

> I guess you have some kind 
> of emitter event that creates the recurring events and a group id that
> holds the events together.

a timestamp + a year ahead as an example, a week, a day, a week + two days, 
it's all very simple to add up with php.

> How long forward does one usually create the 
> events. Two-three years...?

chaa... What event except birthdays weddings  and maby elections are we 
talking about here? I cannot tell what I'm supposed to do next week and it 
seems kind'a hard to grasp at what youre thinkin of

>
> Sorry if I'm a bit blury. But any ideas on recurring events are welcome.
> I guess I could just hack something together, but it would be fun to do
> it right.

wee bit blurry.

>
> Regards Emil



-- 
---
Børge Holen
http://www.arivene.net

--- End Message ---
--- Begin Message ---
On Dec 3, 2007 7:37 AM, Emil Edeholt <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm about to add some simple calendar functions to my application, and
> I'm thinking of how I should implement recurring events. Are there one
> standard way most people use that works well? I guess you have some kind
> of emitter event that creates the recurring events and a group id that
> holds the events together. How long forward does one usually create the
> events. Two-three years...?
>
> Sorry if I'm a bit blury. But any ideas on recurring events are welcome.
> I guess I could just hack something together, but it would be fun to do
> it right.
>
> Regards Emil
>

Emil,

There is not much "simple" about a calendar, especially when you start
dealing with recurring events. How far into the future your calendar
allow events to recur will depend at least in part on how you intend
to store them. For instance, you can store them in a database where
you create a separate event row for each occurrence (though still be
linked by a common ID as you said), but you'll probably set your
limits based on storage to prevent adding a daily event for the next
10 years. You could also store a single event record that includes the
rules for recurrence and then calculate the dates of each instance as
needed, but that could get pretty CPU intensive. (I'm assuming you
want to stick with "simple" periodic recursion, not more complex
things like the date for Easter or events that don't have any set
pattern.)  Your decision will also be affected by whether you want to
be able to modify a specific instance of a recurring event -- say to
move your monthly meeting from 1:00 to 2:30 for next month only or to
cancel your weekly card game 3 weeks from now without altering other
instances of the same events -- will impact how you approach your
design.

And none of this takes into account the fun you get if you have to
deal with multiple time zones and/or daylight saving time. For
instance, if you store events in local time, you have to store the
time zone with the record so you can convert from one time zone to
another. If you store events in UTC, you usually have to account for
shifts in daylight saving time so that your weekly 2:00 staff meetings
don't suddenly change to 1:00. Then there are the occasional changes
to the beginning/ending dates for DST like happened this year for the
US.

I know this probably muddies your original question even further, but
I'll say again -- there is not much "simple" when it comes to
calendars.

Andrew

--- End Message ---
--- Begin Message ---
Call exec is not good, because you are executing other program, instead of
that you should use some PHP program, take a look here

http://www.phpclasses.org/search.html?words=tar&x=0&y=0&go_search=1


On 04/12/2007, Daniel Brown < [EMAIL PROTECTED]> wrote:
>
> On Dec 3, 2007 10:05 PM, Shelley Shyan < [EMAIL PROTECTED]>
> wrote:
> > Hi all,
> >
> > It may not be a php question, but I want to get the filename lists that
> a .tar.gz file contains and give it to an array.
> > How can I manage that?
> >
> > Thank you very much for your consideration.
> >
> > Regards,
> > Shelley
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>     If you're on Linux/BSD/Unix/MacOS or Cygwin on Windows, this should
> work:
>
> <?php
> $tar_gz_file = " filename.tar.gz"; // Replace this with the actual
> filename.
> exec('tar -ztf '.$tar_gz_file,$ret);
> print_r($ret);
> ?>
>
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.
>
> --
> PHP General Mailing List (http://www.php.net/ )
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards

Cesar D. Rodas
www.cesarodas.com
www.thyphp.com
www.phpajax.org
Phone: +595-961-974165

-- 
Best Regards

Cesar D. Rodas
http://www.cesarodas.com
http://www.thyphp.com
http://www.phpajax.org
Phone: +595-961-974165

--- End Message ---
--- Begin Message ---
Cesar D. Rodas wrote:

> Call exec is not good, because you are executing other program,
> instead of that you should use some PHP program, take a look here
> 
> http://www.phpclasses.org/search.html?words=tar&x=0&y=0&go_search=1
> 

"The access to the internal site search engine is restricted to premium
users."


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Here's some unexpected behavior:

<?php
// ?> what?
?>

This will output "what?" - I expected no output, as is the case if the
inline comment was a /* */ comment.  Is this a bug?

Kevin

--- End Message ---
--- Begin Message ---
On 04/12/2007, Kevin Schmeichel <[EMAIL PROTECTED]> wrote:
>
> Here's some unexpected behavior:
>
> <?php
> // ?> what?
> ?>
>
> This will output "what?" - I expected no output, as is the case if the
> inline comment was a /* */ comment.  Is this a bug?


That is because the PHP parser stops the comment on the end of a php tag
("?>") or new line, that is not a bug.

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


-- 
Best Regards

Cesar D. Rodas
http://www.cesarodas.com
http://www.thyphp.com
http://www.phpajax.org
Phone: +595-961-974165

--- End Message ---
--- Begin Message ---
On Dec 4, 2007 8:41 PM, Kevin Schmeichel <[EMAIL PROTECTED]> wrote:
> Here's some unexpected behavior:
>
> <?php
> // ?> what?
> ?>
>
> This will output "what?" - I expected no output, as is the case if the
> inline comment was a /* */ comment.  Is this a bug?
>
> Kevin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    No, that is expected behavior.  Try this:

<? // blah, blah, blah ?> This will display

    .... versus this:

<? /* blah, blah, blah ?> This will be hidden */ ?>

    Comments with //double-slashes and #hashmarks terminate when the
code container terminates, because the ending ?> indicates that it's
time for the parser to stop interpreting code.  However,
/*slash-starred comments do not terminate, as the parser expects a
closing comment tag*/.

    For all intents and purposes, you could consider the /* as a
sleeping pill, and the */ as the alarm clock.  ANYTHING that happens
between those will have no attention paid to it by PHP.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
2007/12/4, Kevin Schmeichel <[EMAIL PROTECTED]>:
>
> Here's some unexpected behavior:
>
> <?php
> // ?> what?
> ?>
>
> This will output "what?" - I expected no output, as is the case if the
> inline comment was a /* */ comment.  Is this a bug?
>

Expected behavior. Read the manual:

http://php.net/manual/en/language.basic-syntax.comments.php

--- End Message ---

Reply via email to