php-general Digest 3 Dec 2007 11:36:09 -0000 Issue 5161

Topics (messages 265393 through 265407):

Re: checkbox unchecked
        265393 by: tedd

Re: Join question
        265394 by: Crayon Shin Chan
        265397 by: Crayon Shin Chan
        265398 by: tedd

Re: Structured Code vs. Performance
        265395 by: tedd
        265402 by: Martin Alterisio
        265403 by: tedd

5.2.5 failed 7 tests
        265396 by: Bill
        265407 by: Peter Smit

Re: including parenthesis, space and dashes in a phone number
        265399 by: Daevid Vincent
        265400 by: Daevid Vincent

Re: sprintf() oddness
        265401 by: Martin Alterisio

Issue with STRFTIME and Daylight Savings
        265404 by: Malcolm Green
        265405 by: Robert Cummings

Re: problems accesing an object via globals
        265406 by: julian

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 ---
At 1:23 PM -0800 12/2/07, Casey wrote:
On Dec 2, 2007 1:08 PM, tedd <[EMAIL PROTECTED]> wrote:

You don't need to do anything.
<input type="checkbox" name="likes_pie" />

When it's submitted:
<?php
 if ($_GET['likes_pie']) // checked
else // not

That's true unless you're pulling data in from somewhere else (i.e., a dB).

Cheers,

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

--- End Message ---
--- Begin Message ---
On Saturday 01 December 2007, chris smith wrote:
> Considering the rest of the off-topic questions that regularly get
> asked on this list it's a bit much to single out this one particular
> post.

I didn't single it out, it just happened to be at the top of the pile at 
the the time. It was also helped by the fact that the OP, who is 
apparently, renowned for programming in rocks since the time before 
binary was invented, ought to know list etiquette better than most.

> javascript, css, html - none is directly related to php but all still
> get asked here (and 99% of the time answered) - I don't know why
> you're making such a big deal about this particular post and haven't
> kicked up a fuss about the rest in the past.

Exactly how big a deal did I make out of this one? I simply said "ask on a 
database list". It is the responses to that which seems to be kicking up 
all the fuss.

-- 
Crayon

--- End Message ---
--- Begin Message ---
On Sunday 02 December 2007, Daniel Brown wrote:

> There are a great deal of highly-intelligent people on this list, so why
> not take advantage of that resource? 

I do, that's why I'm on the list.

>     So until you've been around enough to truly earn your right to
> tell someone far more accomplished than yourself to seek help
> elsewhere, do us all a favor and keep your God damned mouth shut.

AFAIK no list has the clause "once you have made X number of posts feel 
free to do what you want".

-- 
Crayon

--- End Message ---
--- Begin Message ---
At 6:24 AM +0800 12/3/07, Crayon Shin Chan wrote:
 It was also helped by the fact that the OP, who is
apparently, renowned for programming in rocks since the time before
binary was invented, ought to know list etiquette better than most.

That's "world renowned", if you please. :-)

But just to set the record straight, binary had been invented long before I came along. The programmers before then had to program in just rocks (1's). It wasn't until much later that the absent of rock was invented (0's).

Now, you may not think that one can do anything programming with just rocks, but that's the way the pyramids were built. Those old programmers were an accomplished lot.

As for me, with my vast experience, I think that "list etiquette" on an unmoderated list is what we make it. If you want to correct people as to "list etiquette", it's probably best for you to join a list with people who care what you think. Unfortunately, I think you'll probably have difficulty with that as well.

It's unfortunate that you can't take your talents and help someone instead of being so critical. To me, it would be a pretty sad life if I had nothing positive to say.

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
At 8:56 AM +0100 11/29/07, <[EMAIL PROTECTED]> wrote:
Looks for me a bit like a philosophical question, but maybe you have
something to say about it nevertheless. A good thing for me would be
something like: up to 125 lines of code you get an adequate performance with
simply parsing it every time, with more than 125 lines you would get a
better performance with using separate files - just kidding, surely the
number of lines in this case is 42 ;-).

Looking forward to your answers
Thomas

Thomas:

I seldom find that performance is adversely affected by good structure. So, I strive for good structure.

To me, good structure starts at the function level. Like the lattice of a crystal, coding grows and reflects the most basic element. Keep that element consistent and you'll find that it will be reflected in everything you do.

How's that for philosophical?

Cheers,

tedd


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

--- End Message ---
--- Begin Message ---
2007/12/2, tedd <[EMAIL PROTECTED]>:
>
>
> To me, good structure starts at the function level. Like the lattice
> of a crystal, coding grows and reflects the most basic element. Keep
> that element consistent and you'll find that it will be reflected in
> everything you do.
>
> How's that for philosophical?
>

I even have a name for your philosophical doctrine: fractalism

--- End Message ---
--- Begin Message ---
At 8:56 PM -0300 12/2/07, Martin Alterisio wrote:
2007/12/2, tedd <<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]>:


To me, good structure starts at the function level. Like the lattice
of a crystal, coding grows and reflects the most basic element. Keep
that element consistent and you'll find that it will be reflected in
everything you do.

How's that for philosophical?


I even have a name for your philosophical doctrine: fractalism

Oh yes, it's very much like fractals, but the term "fractalism" is usually reserved for art forms based on fractals.

However, one could conclude that all crystalline forms are a "real-world" examples of fractals. In similar vein, all repetitive processes (including programming) could be though of as a fractal dependant functions. Interesting food for thought, which also could be fractal dependant. :-)

Cheers,

tedd

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

--- End Message ---
--- Begin Message --- Do failed tests mean I absolutely should NOT install. Or is it normal to have a few fails? Try two different versions, all have some failure.
--- End Message ---
--- Begin Message ---
On Dec 3, 2007 12:18 AM, Bill <[EMAIL PROTECTED]> wrote:
> Do failed tests mean I absolutely should NOT install. Or is it normal to
> have a few fails? Try two different versions, all have some failure.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Which tests do you mean? On the end of the configure command you'll
see if there is a critical error. If not, you can make it.

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

> -----Original Message-----
> From: Warren Vail [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 30, 2007 2:17 PM
> To: 'Jochem Maas'
> Cc: 'afan pasalic'; 'Daevid Vincent'; 'php-general'
> Subject: RE: [PHP] including parenthesis, space and dashes in 
> a phone number
> 
> I did not know that about Windows Letter formatting, well, 
> not all Americans
> think everything revolves around the way Americans do things. 
>  Knowing a
> little about Microsoft marketing strategy, they probably feel 
> they should
> charge extra for providing more flexible formatting.
> 
> I do believe a good site designer, will plan for a global 
> market, instead of
> a local US one, even if others fail to share his vision.

My product/service is currently only a US/domestic one. 

When the day comes that we need to make it international, we'll have a lot more 
to worry about than simple phone number display. There will be "gettext()" 
involved and .po/.mo files and all that other hassle (I know, I've done it 
before with other companies). Also date formats will change from m/d/y to y-m-d 
too. 

So I would counter and say, a good site designer, designs for their target 
audience... ;-)

--- End Message ---
--- Begin Message ---
I should have been more clear. I do *store* the numbers sans punctuation, but 
that's trivial to accomplish as we've seen. I do like to display it however 
with the nice parens and hyphens. Hence "opposite". :)

> -----Original Message-----
> From: afan pasalic [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 30, 2007 12:03 PM
> To: Daevid Vincent
> Cc: 'php-general'
> Subject: Re: [PHP] including parenthesis, space and dashes in 
> a phone number
> 
> It's ok to store it this way, but it could be a little PITA 
> when search.
> E.g., you store (123) 456-7890 and somebody search for 
> 123-456-7890? Right?
> 
> -afan
> 
> 
> 
> Daevid Vincent wrote:
> > The kind of OPPOSITE of this, is what I use, in that it 
> ADDs the () and -
> > 
> > if ((strlen($phone)) <= 14) $phone = 
> > 
> preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]
> {4}).*/",
> >               "(\\1) \\2-\\3", $phone); 

--- End Message ---
--- Begin Message ---
2007/12/1, Christoph Boget <[EMAIL PROTECTED]>:
>
> Why does
>
> sprintf( '%.03f', 0.15250000 )
>
> return 0.152 while
>
> sprintf( '%.03f', 0.15750000 )
>
> return 0.158?
>


Welcome to the world of f**** floating point numbers. Discrete mathematics,
leave all hope, ye that enter.

It's the way floating point number behave (a computational error that's more
problematic that one may suspect). You'll have to live with it, or use an
extension for arbitrary sized numbers (or fixed point numbers).

Why we have to accept this kind of behavior?

Long story short: they are excellent for computations required in 3d
graphics, they are lousy for business applications...
...and we all know that computers are for playing 3d games, don't we?

XD

Sorry about the noise.

--- End Message ---
--- Begin Message ---
Hi Support:

I've moved into a new role and inherited a system which uses the 'STRFTIME'
function to create a filename in the form 'strftime("%Y%m%d")'; the
filename is supposed to be "today's date". (Note I've left out the file
extension for clarity.)

I've noticed that system creates the wrong filename when the process runs
between midnight and 12:59am, during Daylight Savings time. That is, it
creates a filename equal to "yesterday's date". When run at 1:00am or
later, everything OK.

I've checked the Date/Time and 'Locale' settings in Windows, and everything
is ok. My initial thought was that STRFTIME was looking a the system clock
rather than Windows (?).

Can you help?

(PS ... please be gentle, I'm a novice at PHP!)


Thanks & Regards,
Malcolm.

Malcolm Green
Voice Consultant, Managed Network Services
CSC Australia Pty Limited
M: 0401-002-569
T: (02) 9034-3114
E: [EMAIL PROTECTED]

"Vision without action is a dream; action without vision is a nightmare." -
Chinese Proverb


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

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--- End Message ---
--- Begin Message ---
On Mon, 2007-12-03 at 15:14 +1000, Malcolm Green wrote:
> Hi Support:
> 
> I've moved into a new role and inherited a system which uses the 'STRFTIME'
> function to create a filename in the form 'strftime("%Y%m%d")'; the
> filename is supposed to be "today's date". (Note I've left out the file
> extension for clarity.)
> 
> I've noticed that system creates the wrong filename when the process runs
> between midnight and 12:59am, during Daylight Savings time. That is, it
> creates a filename equal to "yesterday's date". When run at 1:00am or
> later, everything OK.
> 
> I've checked the Date/Time and 'Locale' settings in Windows, and everything
> is ok. My initial thought was that STRFTIME was looking a the system clock
> rather than Windows (?).
> 
> Can you help?
> 
> (PS ... please be gentle, I'm a novice at PHP!)

Check your timezone settings in php.ini

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

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

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

however this will work...

p1.inc

 1 <?php
  2
  3 class dbb{
  4
  5 var $var=10;
  6
  7    function fun2(){
  8       return $this->var;;
  9    }
 10 }
 11
 12 class obj {
 13    var $obj2=20;
 14
 15    function f1(){
 16       global $db;
 17
 18       echo "\n".$db->fun2()*$this->obj2."\n";
 19    }
 20 }
 21 ?>


 1 #!/usr/bin/php -q
  2
  3 <?php
  4
  5 require_once('p1.inc');
  6
  7 $db= new dbb();
  8
  9
 10 $obj = new obj();
 11
 12 $obj->f1();
 13
 14 ?>

--- End Message ---

Reply via email to