Your leaking thatched hut during the restoration of a pre-Enlightenment state.

 

Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").



links

decay & ruin
Biosphere II
Chernobyl
dead malls
Detroit
Irving housing

got that wrong
Paleofuture.com

appropriate tech
Arduino μcontrollers
Backwoods Home
Fractal antenna

fun social media stuff


Like asecular.com
(nobody does!)

Like my brownhouse:
   complicated bulk emailer
Thursday, April 22 2010
Deborah called this morning to tell us she'd already been busted by her landlord for yesterday's dock sailing dinner party. It wasn't that we'd been observed directly, it was that I'd somehow screwed up when tying the dock back to the PVC pipes that allow it to rise and fall with the tides. The ropes had slid off the PVC and had gotten hung up as the tide was going out. Eventually the weight of the dock broke a board that holds the PVC pipes that slide up and down the stationary poles attached to the shoreline. In talking to her landlord, Deborah passed the buck to me, saying her friend had done the tying and untying and that she'd trusted him because, well, he makes his own greenhouses and what not. So then the landlord claimed he didn't have the right tools to fix the board and maybe she could get her friend (me) come over and fix it for him. And, to make a short story even shorter, now I have to drag my ass up to Saugerties to fix that stupid board.
Gretchen and I drove down to the prison today so both of us could work a "module" doing things suited to our skillsets. This placed me in a computer lab trying to get a printer to act local with respect to a fileserver that I hoped to use as a print server. But I had no such luck. I was, however, able to fix a dead workstation (it was a loose ethernet cable inside the server cage) and install Mathematica on a few workstations. (The only time I've ever used Mathematica myself was to calculate the shape of the hole of a vent pipe passing obliquely through the brownhouse wall.)

Back at the house, I put the finishing touches on a complicated bulk emailer that does the following things in interaction with four different servers on the internet.
  1. Every 17 hours, it runs a stored procedure to rebuild a table called active_users on a Microsoft SQL Server Database, calculating how active the users are by the timing and number of their purchases.
  2. There is a tool written in PHP running on a Windows Web Server allowing an administrator to initiate a mailing. When this is done, all the active users are sorted by their activity and their information is copied to a freshly-emptied mail_log table in a MySQL database. Information about the mailing that applies to everyone receiving it is put in a different table.
  3. Every minute, the Windows Server checks to see if there are any users for the latest mailing who lack a timestamp saying a email was sent to them. If there are any, it sends out an email (using an SMTP server) to any who need an email (but not more than ten), tagging each record in the table with a timestamp as it does so. If more mails need to go out, they'll be sent the next time this script executes a minute from now. Or perhaps the next time after that, or the next time after that. This sending out of emails in small bursts helps keep them from triggering anti-spam algorithms. It also cures some of the more vexing issues related to cheap hosting.

One further point about this emailing system is this: there are no cron-jobs (or automated tasks) driving it. Instead, I have a web bug (a one pixel by one pixel embedded image that is actually a script) on the home page that runs a script called "tasks.php." When this runs, it stores information about every task it does and looks to see if enough time has passed to do any task again. The timing of such a ghetto cron system can be a little unreliable, particularly on low-traffic sites. But I wouldn't even know how to set up a chron job on cheapo Godaddy.com Windows shared hosting.
Those wondering why I'm using so much Windows technology can breathe easy with the knowledge that this is a temporary state of affairs. In the end, the site will be running PHP on Linux and storing everything in a MySQL database. But first I have to migrate all the Cold Fusion code to PHP and all the Microsoft SQL crap to MySQL. I'm well on my way to achieving that second goal; I've already set up systems that (with some exceptions) mirror data in both directions when changes are made to either the MySQL or Microsoft SQL database.


For linking purposes this article's URL is:
http://asecular.com/blog.php?100422

feedback
previous | next