jump to navigation

fixing a moodle cron problem – lastcron not updating January 26, 2010

Posted by ficial in LMS, code fixes, moodle, techy.
add a comment

I recently finished a section of code that’s supposed to send reminder emails to users once per day. Moodle has an interesting approach for how this kind of thing is handled. In brief, there’s a DB table that tracks how often a process is supposed to run and the last time it ran, and the moodle system has a single central cron job that runs once every five minutes or so and calls the sub-processes based on the timing info stored in the DB. In principle that’s a reasonable approach. HOWEVER, it turns out that main cron code was failing to record when each sub-process ran, so the sub-process was running EVERY TIME the main process ran. In my case this meant it was sending out emails every 5 minutes instead of once a day – not good.

It’s a bit strange, since the main cron code looks like it’s supposed to do that update:

if ($blockobj->cron()) {
  if (!set_field('block','lastcron',$timenow,'id',$block->id)) {
    mtrace('Error: could not update timestamp for '.$block->name);
  }
}

but for whatever reason that lastcron field isn’t actually getting updated AND no error message is being generated.  Perhaps the cron process in the block needs to return true very explicitly? Perhaps set_field is silently failing? Whatever the cause, it’s a serious problem.

The work around I found (in a timetable import script bug fix) was to explicitly update that field as a part of the cron sub-process.  So, after the emailing code I added:

$susblock=get_record('block','name','signup_sheets');
$susblock->lastcron=mktime();
update_record('block',$susblock);

and now everything is working as it should. It’s not ideal – the main cron process should be doing that lastcron update – but it gets the job done, it’s easy, and it won’t interfere if/when the main problem is fixed.

Infrahyperia: The Quest for the Separated Socks January 10, 2010

Posted by ficial in RPG, games.
add a comment

I just finished running a one-shot and had a lot of fun with it.

—–

The realm of Infrahyperia is people by the fey folk.

Items from Mundaril have significant power in Infrahyperia, and so gates that allow retrieval of such items are important.

Gates can be opened into the Mundaril world (i.e. our world) only where there is a gate connector. There are two kinds of gates, natural and built. Natural gate connectors work if a believer (someone who believes fairies exist) has passed by and noticed them recently enough. These natural gate connectors are tied to specific locations in Infrahyperia, and those locations are hotly contested. Built gate connectors are quite ephemeral. They occur when someone in our world has built a gate connector, i.e. a fairy/spirit house. The person must be old enough to build a spirit house, and young enough to believe in fairies. The connector is active only from sundown of the day it is built until the immediately following sunrise. Most royal houses in Infrahyperia have a roving launch gate, which can connect to any built gate connector. However, there is no control as to where it connects – when used, it opens a gate to… somewhere.

The once-mighty empire of Canasta is these days sorely pressed. Over the last 20 years they have steadily lost ground to varoius neighbors: the Maosists and their Red-Cap army, the Pseudoscientalogicalistas, and the Smurfs. The Honored Queen Feisty Prettygoodniks Cactus Snickerdoodle Pajamarama-Hearts the IX recently managed to negotiate at least a temporary peace with the Pseudoscientalogicalistas, and the Smurfs, but the Red-Cap Army is still pressing hard. It’s been two years since Canasta last controlled a permanent gate, and some critical supplies are running low. The army of Canasta just successfully defended an important glitter pond, but at great cost. In the final moments of the battle an elite Red-Cap squad made a final charge at the command position, and Queen Feisty was gravely injured by a set of Mundaril nail-clippers. The high nobles of Canasta defeated the Red-Cap elites (and thus broke the enemy’s morale) and rushed the Queen back to the Hearts castle.

If Queen Feisty passes away the treaties with the Pseudoscientalogicalistas and the Smurfs are automatically dissolved, just at a time when Canasta is especially vulnerable. This presents a grave problem for Canasta, because the wound was inflicted by a weapon of cold-forged Mundaril iron, and the Queen has been infected by its poison. Normally a medicinnaman would be able to use a separated sock of Mundaril to draw the poison back to its own world, but Canasta hasn’t had a separated sock since shortly after it lost control of its last permanent gate.

In desperation, the chief Divinatrix designed and performed a long, complex ritual to see if she could find a way out of this problem. After several days of chanting, screams, and moans, the Divinatrix determined that exactly 4 nights hence the Pajamarama-Hearts roving gate launch would connect to a place where socks could be found, separated, and returned to Canasta. The court Astrologicians also determined that it would be be mid-summer night in Mundaril, and so anything retried at that time would be especially potent. However, the vision had a murkiness that indicated complication and probably interference from opposing Divinatrices.

So, a call went out across all of Canasta for heroes to volunteer for this dangerous mission to Mundaril. They’re job is to travel to Mundaril 4 nights hence, find as many pairs of fancy socks as they can (preferably fresh from a dryer), and bring one sock of each pair back to Infrahyperia.

NOTES ON THE FEY OF CANASTA

  • Boys are green, girls are blue. They, like all fey of Inf. are about 2″ high. Average move is 12″.
  • All have wings, though they only have limited flying ability – typically they can fly (at 18″) up to 6 rounds (up to 4 continuous) in any given hour long period.
  • All have low-light vision
  • Boys get +2 str, +1 int. Girls get +1 cha, +1 wis, +1 con, +1 dex.
  • Boys can cause Fog Cloud, Glitter Dust, and Stinking Cloud (CL 5) each 1/day
  • Girls can cause Grease and Confusion (CL 7) each 1/day
  • All distances and area effects convert to fey-scale at 5′ = 2″
  • Canastan fey find milk and cream to be powerful drugs; they’re simultaneously euphoric, aphrodisiac, mildly hallucinogenic, and moderately addictive

THE HEROES

  • Grand Mocha-Latte Frappachino – Level 7 Cleric of Titania (Trickery and Luck domains) – Boy
    Grand is his title
    Special Powers – each 1/day (CL = char level): Cure Minor Wound, Guidance, Resistance, Bless
  • Jaemi Jollybell McSchrodinger – Level 6 Paladin of Oberon – ?
    Wears a skilt – part skirt, part kilt
    Is aqua – looks more blue in some lights, and more green in others
    Currently is the bearer of the Blessed Curse of the McSchrodingers – while its gender is unknown it has the powers of both boys and girls, but if ever anyone observes it to be one gender of the other it loses about half its power and simulataneously the mighty McSchrodinger’s Beast appears and attacks. The Jollybells acquired the Blessed Curse, and their current surname, ages ago as a result of playing a prank on a powerful Mundaril being.
    Its mount is a persistent, smoky zephyr named Patchouli. When riding Patchouli, Jaemi can fly indefinitely.
  • Rose Audobuir – Level 7 Ranger – Girl
    Bow ranger
    Bow is +1 and can cast Magic Missile (CL = character) 1/hour
    Special Power – Expeditious Retreat (CL 1) 1/hour
  • Lymphorya Needlewell – Level 7 Rogue – Girl
    Dresses largely in form-fitting black
    Darkvision
    Special Power – Invisibility up to 40 rounds a day, divided as desired (standard action to activate)
  • Hawkingstein Vosavont Wiles – Level 6 Wizard: Illusionist (no necromancy, no evocation) – Boy
    Special Power – Daze Monster (CL 5) 1/hour
    Special Power – Suggestion (CL 5) 1/day

House Building Saga, Part the Twelfth December 25, 2009

Posted by ficial in house building.
add a comment

It’s now been two full days since we were last on site, so this is feeling like a real vacation now.

Last Wednesday morning I headed up for 1/2 day of work before we left for NH for Christmas with my folks. In Williamstown there was a light dusting of snow when I headed out. In Stamford there was already 1/2 inch on the ground and it was accumulating quickly. Despite that, Craig and three of the crew were there (one had already left for Christmas on Long Island) working hard. We got a couple of panels ready to go, then the crew put them on the roof while Craig and I put the upper porch rafters into place (or at least, most of them – one really should be left until after the wall SIPs for that section are in, since it goes hard against them).

Working in the snow is definitely harder and more dangerous. For one thing, snow flakes have a tendency to blow in one’s eyes, meaning there’s a lot more blinking and distraction. For a second, the surface condition is very dynamic. One can have great footing, but five minutes later a step in the same place is slippery. This wasn’t too much of an issue for the rafters, and in fact it even helped a it in some ways – the rafters were easier to slide around on the staging. However, the roof work was getting downright dangerous.

Around mid morning someone broke out the radio. Just about at a time when he snow was so think one couldn’t quite see the road from the house the weather report came on, and told us there was a chance of flurries in the morning. By lunch time it had snowed 2-3 inches and only one set of roof panels had gone up because people had to work much more slowly and carefully. At that point we called off roof work and focused on ground-level jobs. Each roof panel has various prep work it needs – splines set, marks made, screw positions counter-sunk, panels sorted, cut, and positioned, and various other such things. All this prep work means that once the weather clears up sufficiently the rest of the roof panels should go up pretty quickly.

Around noon the crew broke for lunch and I left for the day, to get a few things done (e.g. packing) for the Christmas trip. I don’t know what exactly they got done in the afternoon – the snow was letting up so they might have started work on the roof again, or they might have continued ground work. The wall panels are scheduled to arrive the morning of the 28th, so there were a few things that had to be moved around to make room for them.

Getting down the driveway was a bit scary – the truck (borrowed from my dad for a few weeks) was sliding around more than a little bit. The experience reinforces my desire to move the driveway to make it a bit longer and slightly less of an elevation change once construction is complete.

And now, we’re off for Christmas actual-vacation, with about 5 days of not working on the house!

House Building Saga, Part the Eleventh December 21, 2009

Posted by ficial in house building.
1 comment so far

After two days off and a lovely party the last night, 6:30 AM was especially early today.

Amy headed to Williams for a day at the office while I headed out to the construction site today. For the first 45 minutes of the day I tried to make myself useful, but mainly stood around watching people work. A couple of guys were tackling the bottom three rows of the roof boards, another was dealing with the last row on top (it required a wider board, which had to be purchased between Friday and this morning), and another was prepping some of the roof for the eventual roof panels.

Around 8:45 the panels arrived. They came on a big truck, which luckily had its own unloading machine (a moffett – i.e. a truck-mounted fork lift) so we didn’t have to ask for or hire outside help on that task. The roof panels are really big – 4 feet by 16 to 22 feet, and a foot thick. They are also very light for their size (2 people can carry a 16 footer without problem), being made largely of styrofoam. Normally this is a great feature, but it was a bit problematic with all the wind today. Generally it went well, but one bundle got blown off the lift. Thankfully it seems only a minor ding to one piece resulted. Writing a check for the delivery fee was certainly the most useful thing I did in the first hour.

After the morning hot-liquid-break (hot chocolate for me, coffee for others) we contemplated the panels. Amy and I had thought they were all going to be pre-cut, but it turns out that a number of them have to be cut in half in the field. Three of us worked on figuring out how to cut them (ans: measure and mark, then a skil saw for the wood side, then cut the styrofoam with a hand saw from the other side, using the first cut to keep sawing square). The other two began laying out lines to place the panels on the roof. Before lunch we’d gotten several panels cut, the layout done, and the first panel in place.

After lunch we managed to get three more panels done and generally to work out a few kinks in our process. Earlier we’d discussed getting a crane to lift the panels into place, but it turned out that, though awkward, we could lift and maneuver them ourselves. The most time consuming part of the process was precisely positioning them once they were up, and screwing them in place.

Over all we didn’t get quite as much done as I’d hoped today, but we figured out a lot of things and I expect tomorrow to go much more smoothly and quickly since we can just dive in to the work instead of stopping to figure things out every step of the way.

House Building Saga, Part the Tenth December 20, 2009

Posted by ficial in house building.
add a comment

Thursday morning work began on the roof. While Craig and the crew put the last three of the main house rafters in place Amy and I uncovered the roof boards and began surveying and studying them, then put together a few measuring jigs. We’d originally ordered tongue-in-groove boards, which make a very solid, stable decking surface because all the boards lock together. Instead we got shiplap, which is weaker but creates a smoother surface. Since the decking isn’t structural anyway the lower strength isn’t a big deal. Ideally we’d have gotten it all finished before putting it up, but since it wasn’t even delivered until December and the finish is supposed to be applied only at 50 F or warmer, that didn’t happen.

One of the nice things about the roof work is the size of the lumber. The individual pieces are small enough for one person easily to handle one or several at a time. This allows for much greater parallelization of work. A couple of the crew worked on pinning the rafters (tightening the span with a strap, and then fixing the top and bottom with 8″ screws). Meanwhile, Amy measured and marked the roof boards. We wanted all the boards to be multiples of 4′, since that’s what our rafter span is. We could have dealt with some floating joins if the boards were T&G, but with shiplap we didn’t really have that option. So, we cut firring strips to lengths of 4, 8, 12, and 16 feet and put a block at one end to hook over the board to be measured. This made the measuring process very quick. I then took the measured wood and cut it using a chop saw (a.k.a. compound miter saw in a basic 90-90 configuration). Chop saws are fantastic tools, by the way. While we were cutting wood two more crew were actually nailing them in place on the roof. Amy and I had to leave at noon because we’d promised our day-jobs that we’d make it in for at least a 1/2 day during this multi-week time off. The crew continued the roof while we were gone.

Friday was all roof all day. The day was cold enough that the nail gun wasn’t working (the gun itself was fine, but the plastic that hold sets of nails together was too brittle – it was shattering and the last 3-5 nails in each clip would jam). This meant a bit more work with hand tools, but that kept us all warm. We all basically picked up where we’d left off the previous day, with the two who were doing rafters now switching to roof work. Amy and I sorted and measured and cut, and the other four fitted and fastened. By about 2:45 the roof deck was mostly done – all but the bottom three rows which had been left off so people could have decent footing at the bottom by walking along the rear beams.

Amy and I then switched to site cleanup while the crew worked on laying roofing felt over the boards to protect them a bit from the elements. By about 3:30 the site was as clean as we felt was necessary and the crew was just finishing with the roof work. Amy and I left a bit early since we were feeling pretty unnecessary at that point.

We spent a while Friday evening discussing what we wanted to and could do next, and eventually decided to cancel the work day for Saturday. There are only a few more timbers to put in place (the porch), and we need to talk about longer term plans with Craig before actually doing that work. Other than that, we’re largely waiting on the arrival of various things – roof panels on Monday, wall panels sometime later, then the window openings (some of them, anyway) have to be cut, then the floor has to be heated then poured, THEN there will be a big chunk more work for us and for volunteers. So, we’re in a bit of a holding pattern at the moment.