php-general Digest 15 Jul 2012 10:50:10 -0000 Issue 7889
Topics (messages 318477 through 318481):
Re: Seeking a scheduling algorithm
318477 by: Bill Guion
318479 by: tamouse mailing lists
Re: extend or encapsulate?
318478 by: Marco Behnke
318481 by: shiplu
Re: database hell
318480 by: Nick Edwards
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On Jul 14, 2012, at 4:53 PM, php-general-digest-h...@lists.php.net wrote:
> From: Tedd Sperling <t...@sperling.com>
> Subject: Seeking a scheduling algorithm
> Date: July 14, 2012 4:53:15 PM EDT
> To: php-gene...@lists.php.net
>
>
> Hi gang:
>
> Does anyone have a resource, or better yet code, to solve the scheduling
> problem described below?
>
> Let's say you have a week calendar that has openings between 8:00am to 5:00pm
> for Monday through Friday (40 hours).
>
> Then you have an assortment of appointments that must be scheduled into the
> week calendar. Some of the appointments are simply a one hour per week, while
> others may be two, three, four, or five times per week and each appointment
> for an hour or more (up to eight hours).
>
> The problem is, knowing what appointments (i.e., twice a week for 2 hours,
> three times a week for one hour, etc.) must be scheduled for the week, what
> is the most efficient way to schedule these appointments into that week?
>
> The most efficient way is defined as scheduling appointments with little, or
> no, gaps in between appointments. For example, four one-hour appointments on
> Monday between 8:00am to 12:00pm is better than four one-hour appointments
> spread out between 8:00am to 5:00pm.
>
> Anyone have any solutions, ideas, resources, code?
>
> Thanks,
>
> tedd
>
> _____________________
> t...@sperling.com
> http://sperling.com
>
Tedd,
There is an old general rule that the most time efficient way to schedule is to
put the "big" time requests on the schedule first. In this case, that would
mean schedule all five times a week requests first, then the four times a week,
then the three times a week. The two hour requests should be scheduled next:
three times a week and twice a week can be scheduled at the same time. Then
fill in the rest with the one hour requests.
Hope that makes sense.
-----===== Bill =====-----
--
A closed mouth gathers no feet.
--- End Message ---
--- Begin Message ---
On Jul 14, 2012 5:34 PM, "Bill Guion" <bgu...@comcast.net> wrote:
>
> On Jul 14, 2012, at 4:53 PM, php-general-digest-h...@lists.php.net wrote:
>
> > From: Tedd Sperling <t...@sperling.com>
> > Subject: Seeking a scheduling algorithm
> > Date: July 14, 2012 4:53:15 PM EDT
> > To: php-gene...@lists.php.net
> >
> >
> > Hi gang:
> >
> > Does anyone have a resource, or better yet code, to solve the
scheduling problem described below?
> >
> > Let's say you have a week calendar that has openings between 8:00am to
5:00pm for Monday through Friday (40 hours).
> >
> > Then you have an assortment of appointments that must be scheduled into
the week calendar. Some of the appointments are simply a one hour per week,
while others may be two, three, four, or five times per week and each
appointment for an hour or more (up to eight hours).
> >
> > The problem is, knowing what appointments (i.e., twice a week for 2
hours, three times a week for one hour, etc.) must be scheduled for the
week, what is the most efficient way to schedule these appointments into
that week?
> >
> > The most efficient way is defined as scheduling appointments with
little, or no, gaps in between appointments. For example, four one-hour
appointments on Monday between 8:00am to 12:00pm is better than four
one-hour appointments spread out between 8:00am to 5:00pm.
> >
> > Anyone have any solutions, ideas, resources, code?
> >
> > Thanks,
> >
> > tedd
> >
> > _____________________
> > t...@sperling.com
> > http://sperling.com
> >
>
>
> Tedd,
>
> There is an old general rule that the most time efficient way to schedule
is to put the "big" time requests on the schedule first. In this case, that
would mean schedule all five times a week requests first, then the four
times a week, then the three times a week. The two hour requests should be
scheduled next: three times a week and twice a week can be scheduled at the
same time. Then fill in the rest with the one hour requests.
>
> Hope that makes sense.
>
> -----===== Bill =====-----
> --
>
> A closed mouth gathers no feet.
>
What this sounds like, to me, is quite similar to either a memory
allocation scheme or a disc defragmenting scheme. I haven't worked either
of those since I went to Jurassic United, though...
--- End Message ---
--- Begin Message ---
Am 14.07.12 10:09, schrieb Tony Marston:
> wrote in message
> news:1535031289.371987.1342162338279.javamail.open-xcha...@email.1und1.de...
>>
>>
>>
>>
>> tamouse mailing lists <tamouse.li...@gmail.com> hat am 13. Juli 2012
>> um 07:06
>> geschrieben:
>>
>>> It's Friday, so...
>>>
>>> Yes, it's true, I have just started looking at using PDO instead of
>>> mysqli -- a bit behind the times...
>>>
>>> My question at this stage, is do people tend to extend the PDO class
>>> for their own use, or encapsulate it in a class (or do most people use
>>> it mostly in procedural code?)
>>
>> I stick to use it as components as it is said "Do not use inheritance
>> for code
>> re-use" :)
>>
>
> The idea that you shouldn't use inheritance for code reuse is absolute
> nonsense as it makes a mockery of one of the fundamental principles of
> object oriented programming. If you make a mess of inheritance it's
> because your implementation is flawed, not that the concept is flawed.
> Next you'll be saying "don't use encapsulation"or "don't use
> polymorphism". What a bunch of idiots!
No, I disagree with you.
Don't use inheritance for code re-use, use it for class extension!
If you have a class and want to add something extra to it but what does
stays in the same topic, then extend from it.
If you simply extend PDO to use the PDO methods and add your own stuff,
then inheritance is a bad idea. If you think of what you are doing here:
You USE Pdo. So it is a component.
This way you get the following benefits:
- You can extend your class in your system from another class AND use PDO
- You can easily exchange PDO with another abstraction layer if you
like, without changing the interface, just changing the implmentation
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
>From OOP point of view.
Use encapsulation:
When a class has a "has-a" relation-ship with other class you should use
encapsulation. For example, If MyDB is a class that "has-a" pdo driver in
it, then PDO will be encapsulated inside MyDB class. This is also called
containment. MyDB should contain PDO.
Use inheritance:
When a class has a "is-a" relation ship with other class use inheritance.
For example, Dog is an Animal. so Dog should extend Animal class. MyPHPDb
is-a PHP Database Object (aka PDO). So it'll be inheritance. MyPHPDb should
extend PDO.
Think about the relation have. Then implement it.
--
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader
--- End Message ---
--- Begin Message ---
On 7/12/12, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:
>
>
> "ma...@behnke.biz" <ma...@behnke.biz> wrote:
>
>>
>>
>>
>>Nick Edwards <nick.z.edwa...@gmail.com> hat am 12. Juli 2012 um 14:00
>>geschrieben:
>>
>>> On 7/12/12, Gibbs <li...@danielgibbs.net> wrote:
>>>
>>> > mysql_query("DELETE from userprefs where clientr='$User'",
>>$connmy);
>>
>>
>>Sidenote: And don't forget to validate user input and make use of mysql
>>escape
>>and prepared statements ;)
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>
> Another way if the access credentials are the same would be to specify the
> full 'path' to the table in the query:
>
> DELETE FROM database.table WHERE clause
>
Umm I wouldn't be doing that if using mysql replication, I only now (2
days later) discovered that broke it! but your suggestion was the only
one that allowed it to work without crashing out for unauthed access
to (wrong) database when using db1 and db2 (worked until it needed to
return to db1, strill tried to use db2 method, hrmm at least perl
knows to return to use the original, not php though)
thanks to all suggestions, looks like we just need to close db1 con
db2, close db2 and recon to db1 *sigh*
--- End Message ---