Wrox Programmer Forums
|
BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9
This is the forum to discuss the Wrox book PHP and MySQL: Create-Modify-Reuse by Timothy Boronczyk, Martin E. Psinas; ISBN: 9780470192429
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 16th, 2009, 03:30 PM
Authorized User
 
Join Date: Jul 2009
Posts: 77
Thanks: 4
Thanked 6 Times in 6 Posts
Default Chap 5 Calendar - issues/comments

In general I found chapter 5 to be pretty good.
I got it up and running without too much
trouble.

Now, there are some errors and I have some
comments.

ISSUE #1

notify.php - page 129

The section "Sending Reminders"
The notify.php code in the gray box

The 7th line down is missing ending single quote on
the actual email address.
This is wrong in the book and in the download code.
(note the download code has different email address,
but they still forgot the single quote at the end).

in the book
Code:
define('EMAIL_ADDR', '[email protected]);
and in the download code
Code:
define('EMAIL_ADDR', '[email protected]);
It should be like
Code:
define('EMAIL_ADDR', '[email protected]');
ISSUE #2

notify.php - page 130

notify.php, in the first gray box where it says mail,

mgs should be msg. This is wrong in both the book and download code

The book has it like this.
Code:
mail(EMAIL_ADDR, "Reminders for $month/$day/$year $hour:$minute $am", $mgs);
It should be like this, (msg instead of mgs)
Code:
mail(EMAIL_ADDR, "Reminders for $month/$day/$year $hour:$minute $am", $msg);
ISSUE#3

notify.php - comments on time iterval

I have some comments regarding the time interval given
in the retrieve upcoming events query
(page 129, gray box, about 19th line down)
Code:
     $year, $month, $day, $hour, $minute,
     $year, $month, $day + 5, $hour, $minute + 15);
It checks events between right now and 15 minutes from now.
That does not give you much time to get to your appointment! :)
I guess it depends on what you are doing.
It also makes testing difficult.
I changed it to day + 1 to make my testing easier
Code:
     $year, $month, $day, $hour, $minute,
     $year, $month, $day + 1, $hour, $minute);
A couple of things about the cron job.
1. Your cron job would have to be run less than 15 minutes apart otherwise
you would miss some of the events.
2. Your cron job would have to run as far away from the start time as
possible, like 9:01. If you ran it at 9:13 lets say, you'd only have
2 minutes to get to your appointment!

There is nothing wrong with the code. It's up
to us to set the time interval and make sure the
cron jobs are run at the proper times.


ISSUE # 4

calendar.php - boundary issues concerning DAY_HR_END

DAY_HR_END is set to 17
page 124, lower gray box, about line 9
Code:
define('DAY_HR_END', 17);
The code loops through and gets events all the
way up to 5:59 PM
page 126, gray box, lines 1-4
Code:
// output cells
for ($i = DAY_HR_START; $i <= DAY_HR_END; $i++)
{
    for ($j = 0; $j < 60; $j += 15)
    {
I guess this is okay if you want to include the last
hour. If you did not want to include the last hour all
you would have to do is change $i <= DAY_HR_END to
$i < DAY_HOUR_END

One of the reasons I bring this up is because there is an inconsistency
with figures 5-3 on page 134, and figure 5-4 on page 135.
These figures are showing calendars after import.
(Microsoft Windows Calendar and Mozilla Thunderbird)
In both these figures the time slots are grayed out after 5:00 PM.
They also show it starting at 8:00 am. This is inconsistent
with our other calendar.


ISSUE # 5

calendar.php - The "Also Scheduled" section.

The query gets events outside the DAY_HR_START and DAY_HR_END,
by using the clause WHERE EVENT_TSTAMP NOT BETWEEN.

This is fine, but it goes too far as it gets events outside the
current day. An event five months before the DAY_HR_START will
get listed here; same for events after DAY_HR_END.

Perhaps it would be better to get events between midnight
and DAY_HR_START and between DAY_HR_END and midnight for
the day chosen.
I changed my code to do it this way.
(note: concerning the boundary issues stated above.
I am doing like the book does it here and including
events in the 5:00 o'clock hour, that is, events all
the way up to 6:00pm).
Code:
$query = sprintf('SELECT EVENT_NAME, UNIX_TIMESTAMP(EVENT_TSTAMP) AS ' .
    'EVENT_TSTAMP FROM CALENDAR WHERE EVENT_TSTAMP ' .
    'BETWEEN "%4d-%02d-%02d 00:00:00" AND "%4d-%02d-%02d %02d:59:59"  OR ' .
    'EVENT_TSTAMP BETWEEN  "%4d-%02d-%02d %02d:59:59" AND "%4d-%02d-%02d 23:59:5
9" ' .
    ' ORDER BY ' .
    'EVENT_TSTAMP ASC, EVENT_NAME ASC',
     $year, $month, $day,
     $year, $month, $day, DAY_HR_START -1,
     $year, $month, $day, DAY_HR_END,
     $year, $month, $day );
 
Old May 16th, 2011, 01:53 PM
Authorized User
 
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am trying to get a copy of the style sheets that go with this chapter to make the pages display properly. They are no longer available on the WROX site for download. If you have them, I would appreciate it if you would email them to me.
Thanks.
 
Old May 17th, 2011, 01:49 AM
Authorized User
 
Join Date: Jul 2009
Posts: 77
Thanks: 4
Thanked 6 Times in 6 Posts
Default

Hi Boboneil,

There are two special css files for chapter 5: calendar.css and monthly_calendar.css
When I got them, monthly_calendar.css was named month.css, so I
had to change the name.

Here are the files.

calendar.css
Code:
a
{
    text-decoration: none;
}

a:hover
{
    text-decoration: underline;
}

ul
{
    list-style-position: inside;
}

ul li 
{
    padding-bottom: 1ex;
}

#calendar,
#day_calendar
{
    margin: 5px;
    border: 1px solid #000;
    border-collapse: collapse;
}

#calendar
{
    font-size: 75%;
}

#day_calendar
{
    width: 5.5in;
    float: left;
}

#calendar_header,
#day_calendar_header
{
    background-color: #FC9;
    border-bottom: 1px solid #000;
    font-size: 150%;
    font-weight: bold;
}

#calendar td
{
    border: 1px solid #000;
    text-align: center;
}

#day_calendar td
{
    border: 1px solid #000;
    padding: 0 4px;
}

#calendar td.empty
{
    background-color: #DDD;
}

#day_calendar td.time
{
    text-align: right;
    width: 4.5em;
}
monthly_calendar.css

Code:
#calendar
{
    border: 1px solid #000;
    border-collapse: collapse;
}

#calendar a
{
    text-decoration: none;
}

#calendar a:hover
{
    text-decoration: underline;
}

#calendar_header
{
    background-color: #FC9;
    border-bottom: 1px solid #000;
    font-size: 150%;
    font-weight: bold;
}

#calendar td
{
    border: 1px solid #000;
    text-align: center;
}


#calendar tr.calendar_dates td
{
    width: 1in;
    height: 1in;
    text-align: right;
    vertical-align: top;
}

#calendar td.empty
{
    background-color: #DDD;
}
I hope this helps.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 3 - some minor issues and comments kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 20 January 8th, 2010 08:31 PM
Chap 2 forums, pagination issues page 55-56 kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 19th, 2009 09:28 PM
Chap 2 - Avatars and uploading files, (would apply to Chap 6 too) kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 18th, 2009 03:14 PM
Logging Changes in Issues Comments Column leslieinva BOOK: Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 ISBN: 978-0-470-12449-9 0 August 19th, 2008 10:36 AM
Calendar like calendar in AJAX in ASP.NET h@ckerz ASP.NET 2.0 Professional 0 February 19th, 2008 12:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.