had logo

September 15, 2020

Centralized Task Scheduling

Lucy Zhang

- (void)scheduleLife


xpc_object_t criteria = xpc_dictionary_create(nil, nil, 0);
xpc_dictionary_set_bool(criteria, XPC_ACTIVITY_REPEATING, true);
xpc_dictionary_set_int64(criteria, XPC_ACTIVITY_DELAY, XPC_ACTIVITY_INTERVAL_1_MIN);
xpc_dictionary_set_int64(criteria, XPC_ACTIVITY_INTERVAL, XPC_ACTIVITY_INTERVAL_1_DAY);
xpc_dictionary_set_string(criteria, XPC_ACTIVITY_PRIORITY, XPC_ACTIVITY_PRIORITY_UTILITY);
("checkInWithLife", criteria, ^(xpc_activity_t activity)


// Always in an unsafe area when working
if (![self inSafeArea])
// It is only a one time use bottle, and you
// haven't really practiced with it before so
// there's a chance of spraying yourself or at
// least getting it in your eyes, not sure if
// you should look away while sticking your
// hand out as far away from you as possible
// –google says don't do that because the
// assailant can knock it out of your hands.
// Still, you're supposed to observe the
// reactions of the assailant in case you need
// another shot. Even though it's a one time
// use bottle. Maybe just run away.

[self feelPocketForPepperSpray];

// This DoorDash thing doesn't seem very
// reliable but what other option is there?
// Just deliver the food. This function does
// not account for the time and effort it
// takes to get out of the car and walk up to
// the porch with a cleanly cut lawn and
// political signs stuck in the earth and a
// tiny US flag waving from the mailbox–and
// oh, you haven't eaten in 48 hours; you're
// a bit light-headed today. This method is
// also prone to crashing.

@try {
     [self deliverFood];
} @catch (NSException *exception) {
     ​// Just log. What else can you do?
     NSLog(@"Caught exception delivering food, %@", exception);

// An unnecessary task, but doesn't hurt to do this.
[self hopeForTip];

// Bail early



for (KnownPerson *member in self.familyMembers)

     if (member.proneToOverreact)

          if (member.livingDistanceAwayFromMeInMiles.intValue > 1000)

// Preferably the image with all the fruit trees
[member sendImageWithFilePath:@"RandomImageOfGardenedBackyard.jpg"];
[member sendTextWithMessage:@"^Just another day"];



// Can also use last last year's dinner, which
// might
 actually be better since you could
// afford seafood
 then, and you still had the
// birthday present sous-vide.
 It didn't sell
// for much. Actually, last last year's
// photo might've been deleted–ran out of
// space,
 didn't want to pay for cloud
// storage, figured food
 photography could be
// the first to go. Who needs to
 be reminded
// of last last year's dinner anyway,
 of the
// taste of steamed lobsters and buttered
 brussel sprouts. It's all about pinto beans
// and
 rice these days.
[member sendImageWithFilePath:@"LastYearsDinner.jpg"];
[member sendTextWithMessage:@"^made this for dinner"];



// Careful not to sound too enthusiastic. This
// is what happens when you are not a
// critical, irreplaceable asset to the
// company: you end up folding and unfolding a
// futon mattress on the ground of your
// friend's living room every morning careful
// to erase your existence before leaving to
// "work". This is what happens when you fail
// to climb the corporate ladder and instead
// fall on your ankle...make that both ankles
// if possible, but it's simpler now, only a
// few things to think about: shelter, food,
// the annoying wad of gum stuck to the bottom
// of this shoe–so thick you feel the uneven
// surface against your foot with every step.
// Maybe everyone is replaceable.

[member sendTextWithMessage:@"Do you have any friends who know about any job openings?"];




// TODO: if there's enough time before the next invocation of this xpc activity, try getting back into poetry, don't let all the angst go to waste