[Lilug-dev-sig] Lilug Dev-Sig Meeting Tonight (8/19) @ 8pm

Robert Wilkens robwilkens at gmail.com
Sat Aug 21 05:24:20 PDT 2010


Mark What I'm trying to illustrate is this...

While short circuiting may be the same, you might do a test like this

If ((something true) and (something false)){

	Do whatever();

}

Do Whatever(); will always be done.

However, if you do something like this

If ((something true) && (something false)){

  	Do Whatever();
}

Do Whatever(); will never be done..

It's a Boolean logic issue, not a short circuiting one.

It's also an issue of poor documentation.

Rob

-----Original Message-----
From: Robert Wilkens [mailto:RobWilkens at gmail.com] 
Sent: Saturday, August 21, 2010 8:06 AM
To: 'LILUG Developer SIG Mailing List'
Subject: RE: [Lilug-dev-sig] Lilug Dev-Sig Meeting Tonight (8/19) @ 8pm

Short circuiting may be the same, however, the returned value is different...

I wrote a quick test:

<html>
<body>
<?php
	$a=true and false;
	$b=true && false;
	if ($a){ echo "and bad"; } else {echo "and good";}
	if ($b) {echo "&& bad";} else {echo "&& good";}

?>
</body>
</html>


And the result is here:

http://robssoftwareprojects.com/test.php

You can see it for yourself running live.  It basically says "and bad&& good".

Rob

-----Original Message-----
From: lilug-dev-sig-bounces at lilug.org [mailto:lilug-dev-sig-bounces at lilug.org] On Behalf Of Mark Drago
Sent: Saturday, August 21, 2010 7:50 AM
To: LILUG Developer SIG Mailing List
Subject: Re: [Lilug-dev-sig] Lilug Dev-Sig Meeting Tonight (8/19) @ 8pm

Rob,

You're right in that the day of the week not showing up isn't a cache issue.  But I still think the wrong day showing up is a cache issue.

I'm also really sure that '&&' and 'and' are 100% equivalent.  I wrote this short program to test the short-circuiting of them and they are the same:

<?
function say($str, $bool) {
    echo "$str  ";
    return $bool;
}

echo "||: ";
say('goodbye', false) || say('hello', true); echo "\n";

echo "or: ";
say('goodbye', false) or say('hello', true); echo "\n";

echo "&&: ";
say('goodbye', false) && say('hello', true); echo "\n";

echo "and: ";
say('goodbye', false) and say('hello', true); echo "\n"; ?>

That produces this output:

||: goodbye  hello
or: goodbye  hello
&&: goodbye
and: goodbye

Mark.

On Fri, Aug 20, 2010 at 17:00, Robert Wilkens <robwilkens at gmail.com> wrote:
> The reason, btw, I suspected it wasn't the cache is because it would still have _some_ day of the week and not a blank one..   It would've cached one of the dates.
>
> Can't always blame the cache.
>
> Thanks, btw, for throwing a php cureball my way.  I used to love programming in C, still like C# a little, and am still somewhat sharp on those skills even if I haven't worked full time in nearly ten years now.
>
> -Rob
>
> -----Original Message-----
> From: lilug-dev-sig-bounces at lilug.org 
> [mailto:lilug-dev-sig-bounces at lilug.org] On Behalf Of Mark Drago
> Sent: Friday, August 20, 2010 4:20 PM
> To: LILUG Developer SIG Mailing List
> Subject: Re: [Lilug-dev-sig] Lilug Dev-Sig Meeting Tonight (8/19) @ 
> 8pm
>
> Rob,
>
> I'm pretty sure 'and' and '&&' are equivalent in PHP.  I just checked here:
>
> http://php.net/operators.logical
>
> I'm pretty sure it's more of a mediawiki cache problem than a coding 
> problem in the extension.  Of course, I may very well be mistaken.
>
> Mark.
>
> On Fri, Aug 20, 2010 at 16:08, Robert Wilkens <robwilkens at gmail.com> wrote:
>> I found one 'potential' problem.. I notice you used the word 'and' in the if conditional.  As I understand it, for what you are doing you want to use, like in c, the 2-character ampersand or && to do what you want to do there.  i.e. if ((this)&&(that)){dothis}; as opposed to if ((this)and(that)){dothis};.. I'm not sure how it interprets the word 'and' but I googled around and confirmed with some basic self-reaffirmation that && is perhaps the more accurate symbol there.  Please correct me if I'm wrong, and if that still doesn't fix it, get back to me either way because I didn't go much further than that in my reading over.
>>
>> Rob
>>
>> -----Original Message-----
>> From: lilug-dev-sig-bounces at lilug.org 
>> [mailto:lilug-dev-sig-bounces at lilug.org] On Behalf Of Mark Drago
>> Sent: Friday, August 20, 2010 9:44 AM
>> To: LILUG Developer SIG Mailing List
>> Subject: Re: [Lilug-dev-sig] Lilug Dev-Sig Meeting Tonight (8/19) @ 
>> 8pm
>>
>> Rob,
>>
>> I saw the same bug today.  I wrote the code which calculates the date and time of the meetings and prints it to the wiki page.  It's a mediawiki extension.  The code is here:
>>
>> http://git.markdrago.com/git/?p=lilug;a=tree;f=wiki;hb=HEAD
>> The particular file is called 'lilug_ext.php'.
>>
>> With that said, I think the problem is more likely a caching problem.
>> I remember when I first wrote the extension that mediawiki's caching was getting in the way.  I took steps to disable caching in certain circumstances, but that was a few versions of mediawiki ago.  So, who knows if that is still working correctly.  I suspect that mediawiki had a cached version of the page from August 18th, when it would have correctly said "tomorrow, august 19th" and then incorrectly served that same page out of the cache on August 19th.  I saw this problem first-hand today.  When I first went to the page it said "today, august 19th", even though it is the 20th today.  After logging in to the wiki it changed to say "september 16th" which is when the next dev-sig meeting is.  With that said, for some reason I'm now seeing that the day of the week isn't being shown when it should.  It says 'september 16th' instead of 'thursday, september 16th'.  Very weird.
>> The code that converts the unix time to the pretty text version is at the very end of lilug_ext.php.  I just gave it a quick glance and it looks fine to me.
>>
>> Mark.
>>
>>
>> On Thu, Aug 19, 2010 at 14:44, Robert Wilkens <robwilkens at gmail.com> wrote:
>>> I won't be there, but one topic to consider...
>>>
>>> I believe the devsig directions page is misleading on the date of 
>>> the meeting.  It has today's date, but it says "Tomorrow" before it.
>>> That is perhaps a php or similar scripting error.
>>>
>>> I have PHP5 Zend Certification and would love to contribute towards 
>>> fixing that as a volunteer, but tonight I am otherwise occupied with another event.
>>>
>>> Rob
>>>
>>> -----Original Message-----
>>> From: lilug-dev-sig-bounces at lilug.org 
>>> [mailto:lilug-dev-sig-bounces at lilug.org] On Behalf Of Chris McNamara
>>> Sent: Thursday, August 19, 2010 2:19 PM
>>> To: lilug-dev-sig at lilug.org; lilug at lilug.org
>>> Subject: [Lilug-dev-sig] Lilug Dev-Sig Meeting Tonight (8/19) @ 8pm
>>>
>>> Hello,
>>>
>>> There will be a Developer-SIG meeting tonight, August 19th, at 8pm 
>>> at the Panera Bread in West Babylon.  There is no set topic for tonight's meeting.
>>> We'll talk about whatever the group is most interested in.
>>> Come on down and join the conversation.
>>>
>>> Directions are here:
>>> http://lilug.org/wiki/DEVSIG_Directions
>>>
>>> See you there,
>>> Chris
>>>
>>> _______________________________________________
>>> Lilug-dev-sig mailing list
>>> Lilug-dev-sig at lilug.org
>>> http://lists.lilug.org/listinfo.cgi/lilug-dev-sig-lilug.org
>>>
>>> _______________________________________________
>>> Lilug-dev-sig mailing list
>>> Lilug-dev-sig at lilug.org
>>> http://lists.lilug.org/listinfo.cgi/lilug-dev-sig-lilug.org
>>>
>> _______________________________________________
>> Lilug-dev-sig mailing list
>> Lilug-dev-sig at lilug.org
>> http://lists.lilug.org/listinfo.cgi/lilug-dev-sig-lilug.org
>>
>> _______________________________________________
>> Lilug-dev-sig mailing list
>> Lilug-dev-sig at lilug.org
>> http://lists.lilug.org/listinfo.cgi/lilug-dev-sig-lilug.org
>>
> _______________________________________________
> Lilug-dev-sig mailing list
> Lilug-dev-sig at lilug.org
> http://lists.lilug.org/listinfo.cgi/lilug-dev-sig-lilug.org
>
> _______________________________________________
> Lilug-dev-sig mailing list
> Lilug-dev-sig at lilug.org
> http://lists.lilug.org/listinfo.cgi/lilug-dev-sig-lilug.org
>
_______________________________________________
Lilug-dev-sig mailing list
Lilug-dev-sig at lilug.org
http://lists.lilug.org/listinfo.cgi/lilug-dev-sig-lilug.org




More information about the Lilug-dev-sig mailing list