php-general Digest 17 Nov 2008 06:44:18 -0000 Issue 5794

Topics (messages 283332 through 283338):

Re: Another question about Google maps
        283332 by: Michael Kubler
        283334 by: tedd

Re: Days until Easter and Christmas
        283333 by: tedd
        283335 by: tedd
        283336 by: Yeti

Re: mySQL query question
        283337 by: Chris
        283338 by: Jim Lucas

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 ---
Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work Offline' just as it displayed the flash of both boxes.

Using the Web Developer plugin for FFox I can tell you that the top box has a class of '.gsmsc-mapDiv' while the bottom div one is '.gsmsc-idleMapDiv', and both are wrapped in the '.gsmsc-appContainer' div, and also the '#mapsearch' div.

I've not played with google maps enough, but doubt the above helps, I just but know that it's not a PHP issue. It's almost like a flash of unstyled content <http://www.bluerobot.com/web/css/fouc.asp/>, but is being generated because of the javascript.

I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes appearing, and I could view the map, but caused the map to disappear after I tried searching for a different Google Maps location.

Michael Kubler
*G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>



tedd wrote:
Hi gang:

I posted this question on the Google Map Discussion group/list thingie, but got zip in replies. Maybe someone here might have an idea.

Here's the url:

http://masoncollision.com/contact.php

In both Safari and FireFox for the Mac (I have not tested it with other browsers) as the page loads the map border is momentary drawn twice. The map border is shown stacked one above the other making the page much longer than it actually is. But immediately thereafter, the map is drawn correctly and the page returns to the size it's supposed to be.

I just want to get rid of the momentary flash.

Anyone have any ideas?

Cheers and thanks,

tedd

--- End Message ---
--- Begin Message ---
At 1:29 AM +1030 11/17/08, Michael Kubler wrote:
Well, it shows up for FFox v2 and v3 on Windows XP as well.
I managed to replicate it by shift+refreshing the page.

I also managed to stop it mid load by setting Firefox to 'Work Offline' just as it displayed the flash of both boxes.

Using the Web Developer plugin for FFox I can tell you that the top box has a class of '.gsmsc-mapDiv' while the bottom div one is '.gsmsc-idleMapDiv', and both are wrapped in the '.gsmsc-appContainer' div, and also the '#mapsearch' div.

I've not played with google maps enough, but doubt the above helps, I just but know that it's not a PHP issue. It's almost like a flash of unstyled content <http://www.bluerobot.com/web/css/fouc.asp/>, but is being generated because of the javascript.

I hid the '.gsmsc-mapDiv' which stopped the flash of both box boxes appearing, and I could view the map, but caused the map to disappear after I tried searching for a different Google Maps location.

Michael Kubler
*G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>

Michael

Thanks very much for your time looking into this.

It IS very similar of FOUC and I looked into that as a possible problem/solution.

I think you can see why I didn't get a reply from my Google post -- it's one of those problems that Google has, but doesn't yet understand it well enough to fix it. Too busy with new stuff *.

I may have to hide the map via css and then change display after load -- I just didn't want to go that route IF there was a better way.

Thanks again,

tedd


PS: * I really like Google's Analytics, but hate all the javascript errors it generates in FF firebug.

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

--- End Message ---
--- Begin Message ---
At 6:51 PM -0500 11/15/08, Ron Piggott wrote:
Is there a way to modify this code so it will always be the *next*
Christmas and Easter?

<?php

$todays_date_seasonal_format = DATE("Y-m-d");
$next_Christmas = DATE("Y") . "-12-25";
$next_Easter = date("D d M Y", strtotime("2009-03-21
+".easter_days(2009)." days"));
$days_until_Christmas = ( strtotime($next_Christmas) -
strtotime($todays_date_seasonal_format) ) / 86400;
$days_until_Easter = round(( strtotime($next_Easter) -
strtotime($todays_date_seasonal_format) ) / 86400);

echo $days_until_Christmas . "<br>";
echo $days_until_Easter . "<br>";


Try this:

http://www.webbytedd.com/b2/easter/

It's just an organizational issue.

Cheers,

tedd


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

--- End Message ---
--- Begin Message ---
At 6:51 PM -0500 11/15/08, Ron Piggott wrote:
Is there a way to modify this code so it will always be the *next*
Christmas and Easter?

Also, I forgot to add.

Easter lands on different dates depending upon several different factors. For example in Canada it's the day after it is in the USA -- I guess Canadians are slower, eh? :-)

Also, in some religions the date is the full-moon after the Equinox and not a specific date. Furthermore, the Equinox does not always land on March 21, but sometimes it's March 20 (leap year).

As an example, next year Easter will be on April 9, 12, 13, and 19th -- the ten days of Easter. :-)

You can read more about it here:

http://en.wikipedia.org/wiki/Easter

So, my example here:

http://www.webbytedd.com/b2/easter/

would be more correct if it took into account leap year, location, and what religion it's for.

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
> I guess Canadians are slower, eh?  :-)
LOL

--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
[EMAIL PROTECTED] wrote:
Ok, so just that I am clear, you are SELECTing and pulling all the data that you are submitting in the above INSERT statement from the DB initially,
then you are only modifying the confirm_number value and then re-
submitting all the values, as they originally were,
Well, actually when all is said and done, a new record will be created with new information (Name, phone, email, etc) and the confirm_number is the previous+1

Seems like a perfect candidate for an auto-inc field, though mysql doesn't let you have multiple in the same table (afaik).

# Now prepare your statement
$SQL = "
SET @confirm_number=(SELECT (MAX(confirm_number)+1) FROM `contacts`);
INSERT INTO `contacts` (
                      `first_name`,
                      `last_name`,
                      `email`,
                      `phn_number`,
                      `address`,
                      `city`,
                      `state`,
                      `zip`,
                      `dates`,
                      `comments`,
                      `confirm_number`
                      ) VALUES (
                      '{$FirstName}',
                      '{$LastName}',
                      '{$Email}',
                      '{$Phone}',
                      '{$Address}',
                      '{$City}',
                      '{$selected_state}',
                      '{$Zip}',
                      '{$newdate}',
                      '{$Comments}',
                      @confirm_number
                      )
SELECT @confirm_number AS confirm_number;
";

You do have a race condition, you can end up with 2 of the same confirm_numbers (you'd have to be unlucky, but it can happen).

2 hits at the same time = 2 selects getting the same max(confirm_number), which results in 2 inserts with the same number.

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


--- End Message ---
--- Begin Message ---
Chris wrote:
Jim Lucas wrote:
[EMAIL PROTECTED] wrote:
Ok, so just that I am clear, you are SELECTing and pulling all the data that you are submitting in the above INSERT statement from the DB initially,
then you are only modifying the confirm_number value and then re-
submitting all the values, as they originally were,
Well, actually when all is said and done, a new record will be created with new information (Name, phone, email, etc) and the confirm_number is the previous+1

Seems like a perfect candidate for an auto-inc field, though mysql doesn't let you have multiple in the same table (afaik).


I would agree, but I'm not the OP.  He/She wanted it this way...


You do have a race condition, you can end up with 2 of the same confirm_numbers (you'd have to be unlucky, but it can happen).

2 hits at the same time = 2 selects getting the same max(confirm_number), which results in 2 inserts with the same number.


Granted that their is a possibility that it could happen. But the chance of it happening with the three statements running back-to-back in the same call is much lower then having three separate calls and doing the math in PHP.

--
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


--- End Message ---

Reply via email to