gists, vbscript comments edit

UPDATED 7/11/2007: Added handling for email subject line or first line of body to be the task subject; also added Outlook security information to get this to work.

I’m not lucky enough to have a Blackberry so I don’t have access to my task list via a mobile device.  I don’t generally carry my Pocket PC around and I don’t try to get the wonky synchronization to work on my crappy Motorola phone.  When I think of something and I’m out, I use the phone’s email capabilities to mail myself a one-liner that has the task information in it, then when I come back to the office I use those as tasks.

To that end, I wanted to set up a rule that would just take those one-liners and process the mail into a task automatically.  Since I use Outlook, I can do that with a rule that runs a script.  Here’s how to do this in Outlook 2003.  Not sure, but it might also work in 2007. Haven’t tried.

First, go to “Tools -> Macro -> Visual Basic Editor.” This gets you to the script editor.  In the “Project Explorer” open up “Project1” and you should see a folder called “Microsoft Office Outlook.”  Open that up and you’ll see “ThisOutlookSession.”  Double-click that to open it.

You should be looking at a VBA editor window.  If you’ve already got other scripts going, it might not be empty.  In that window, paste this:

Sub ProcessMailItemIntoTask(Item As Outlook.MailItem)
    Dim strTaskName As String
    strTaskName = Trim(Item.Subject)

    If Len(strTaskName) < 1 Then
        ' No subject - use the first line of the body
        strTaskName = Trim(Item.Body)
        Dim intCrLfPos As Integer
        intCrLfPos = InStr(1, strTaskName, Constants.vbCrLf, vbTextCompare)
        If intCrLfPos > 0 Then
            strTaskName = Trim(Left(strTaskName, intCrLfPos - 1))
        End If
    End If

    ' Trim TASK: off the line
    Dim intKeyWordPos As Integer
    intKeyWordPos = InStr(1, strTaskName, "TASK:", vbTextCompare)
    If intKeyWordPos = 1 Then
        strTaskName = Trim(Right(strTaskName, Len(strTaskName) - 5))
    End If

    ' Create the task
    Dim objTask As Outlook.TaskItem
    Set objTask = Application.CreateItem(olTaskItem)
    objTask.Subject = strTaskName
    objTask.StartDate = Item.ReceivedTime
    objTask.Save
    Set objTask = Nothing
End Sub

What that script does is process any message into a task. It uses the subject line of the mail (or the first line of the body if there is no subject) as the task subject and the time the mail was received as the start time for the task.  You’ll notice it also pulls off the word “TASK:” at the beginning of the line - this is going to be a keyword for our rule.

Now that you’ve got the script, save it and close the VB editor.  Now, back in Outlook, go to “Tools -> Rules and Alerts…”

Select the “New Rule…” option and start from a blank rule.  Select “Check messages when they arrive” and click Next.  Select the conditions “with specific words in the subject or body” and “sent only to me.”  For the “specific words” in the subject, use “TASK:” - this will be the magic flag that tells us that this needs to be turned into a task.  For the actions you want to take on the message, select “stop processing more rules,” “run a script,” “mark it as read,” and “delete it.”  This will handle the auto-processing feature of the message so it doesn’t hang around in your inbox after it’s been taskified.  Finally, for the script you want to run, select “Project1.ThisOutlookSession.ProcessMailItemIntoTask.”  That will call your script to create a task item out of the subject line of the message.

Once you hit Finish, you’re done.  Now when you mail yourself a message with the subject line like “TASK: Take shirts to cleaners” you’ll get a task added to your task list with the subject “Take shirts to cleaners.”  Pretty simple.  The only drawback is that it’s a client-side rule so you have to have Outlook running to process the rule.  That’s pretty simple, though - even if you don’t have Outlook running all the time, when the client starts up it runs rules and will process all of the appropriate emails next time you fire it up.

Note that if this script tries to read the body of the message, you’ll get that annoying “Something is trying to read email addresses in Outlook - allow for X minutes” dialog popping up.  Not sure why it thinks we’re looking at addresses if we’re only looking at the body, but oh well.

If you have trouble getting this to work, check two things:

First, make sure you’ve restarted Outlook once before trying it.  For some reason Outlook needs to shut down and restart to take macro changes into effect.

Second, you may need to change your macro security level.  Go to “Tools -> Macro -> Security…” to see your security level.  This will only run in “Medium” or “Low” setting because it’s not signed.  If you change your security level, you do so at your own peril.  I’m not responsible if you get hit by the next big Internet worm.  If you don’t want to change your security level, you can digitally sign your macro project. The digital signature route is the recommended way to go to stay safe, but it’s the biggest pain, too.

Fireworks in Walla Walla,
WAInstead of digging in crap this year, Greg hooked us up with a much bigger show (involving much less digging) in Walla Walla, WA.

Tuesday afternoon, Jenn got out of work at noon and I picked her up there and we headed straight for Walla Walla.  It’s about a five hour drive and we got there early that evening, just in time to check into the hotel and head over to the site to take a look around.  We measured out where we would need to place the fireworks so there wouldn’t be any fallout raining down on spectators and such.  That was interesting because the site, on the grounds of the Walla Walla VA, had some interesting features.  For example, we were right next to an elementary school that was built entirely underground (it was sort of a mound of earth, like a bunker).

After measuring things out, we headed out for some dinner.  Tuesday was the easiest day.

Wednesday morning we got to the site around 9:00a to start setting up. Greg was there much earlier to take the delivery of the fireworks.  Once the whole crew was there (seven of us), we got things moving.

Setting up for a fireworks show is a lot of hard work.  We had all sorts of things to shoot - shells ranging from 2.5” to 4”, multi-shot boxes with 1.5” and 2” shells, some candles (like the Roman candles you can get at stands, only way bigger) - and you have to secure all of the apparatus you’re firing them from so it doesn’t tip over and shoot, say, into the audience (or at you).  All of this apparatus gets unloaded off the truck, laid out, set up, and loaded.

Take, for example, a 4” mortar rack.  It’s a set of 10 lengths of 4” diameter PVC pipe.  Each pipe length is about, oh, 30” long or so.  Lay those pipes out side by side and secure them in a wood rack made of two-by-fours.  Space them out with two-by-fours as well.  The whole contraption weighs probably around 35 pounds, give or take.  (I’m poor with estimation, so the lengths and weights are rough, but you get the idea.)

Anyway, we had about 20 4” racks, 50 3” racks, and 5 2.5” racks to unload off a moving truck, position, and stake down (you hold them in position with wood stakes you hammer into the ground and then use baling wire to keep the rack-and-stake combo together and unmoving).

We also had like 20 or 30 multi-shot boxes.  A multi-shot box is like a big cardboard box that has a bunch of pre-loaded mortars in them.  A 2” multi-shot box is like a 30” cube that has 144 2” tubes in it in a 12 x 12 configuration.  (The number, size, and configuration of the boxes vary, but you get the idea - it’s a bunch of tubes that are jammed together and loaded with shells in a cardboard box.)  You basically just cut the top off the box and you’re set to go.  All of the multi-shot boxes have to be unloaded, opened, and positioned inside a wood trough (so if they break open during the show, it’s all contained).

Once it was all unloaded from the truck and set up, we loaded the shells into the mortar racks.

It was about this time that the 100°F heat out in the middle of this field really started to get to me.  I had a headache that was creeping up on me, but by this time (probably around 5:00p or so), I was dying. The shade wasn’t cool, the headache was pounding from my chest up, and every time I leaned over to drop a shell into a mortar tube, I felt like I was going to puke.  I ended up having to go sit in the car with the A/C on for quite some time, and Jenn busted out a prescription migraine pill she had to help me with the headache.  Meantime, everyone else was wiring things up so the show could be shot electronically.

When you shoot a show, there are basically three ways to do it. Hand-lit is where you actually manually go down the line of mortars and light them with a road flare.  That’s the sort of show we usually do. Electronically-lit is where you wire all of the fireworks to blasting caps (basically) and each cap gets wired to a master panel where you can hit a button to send current down the wire, blow the cap, and the firework goes up.  That’s what this show was.  Computer-controlled is an electronically-lit show where, rather than a person hitting the buttons to set off the blasting caps, a computer does it, usually synchronized to music or something.  The really big shows are computer-controlled.

So while I was laid out with a headache, the rest of the folks were wiring up blasting caps.  Jenn did some of that, then we both went to Taco Bell to pick up dinner for the crew.  Driving around with the A/C on was really good for me, and that with the migraine pill really got me back in the action.  I still feel bad for crapping out on the crew, but there wasn’t much I could do.  I have a desk job for a reason, right?

Around 10:00p, we started the show, cued by the local band playing a specific song.  Greg pushed buttons, I sat next to him with a road flare at the ready in case any shells didn’t go up, and a couple of the other guys on the crew waited at the ready with fire extinguishers.  The rest of the crew, including Jenn, sat on top of the underground elementary school and enjoyed the show.  The pictures we got are ones Jenn took from up there.

The show lasted about 25 minutes and was definitely the biggest and best one we’ve done.  High-fives all around after it finished, and after a 15 minute cool-down period and a safety inspection, it was time to start cleaning up.

We didn’t get very far cleaning up before the sprinklers in the field kicked on (thanks, Walla Walla, for turning those off in anticipation that we might not be able to get everything picked up in 20 minutes) so we had to abandon the cleanup effort for the next day.

Thursday morning at 8:30 we were all back at the field, cleaning things up.  Pulling stakes out of the ground, raking up debris,  stacking racks back on the truck.  It was 102°F out there according to one of the clocks on a bank we saw.  Let me tell you - the cleanup never ended.  We just kept raking and picking up garbage.  Finally a bit after 1:00p we finished and headed out to get some lunch and start the five-hour-drive home.

Today I am exhausted, sunburned, and ridiculously sore from throwing mortar racks around.  I’m sure the exercise was good for me, but I’m not so sure the heat was.  I’m glad I took the day off from work; I’d be so unproductive.

I think if we end up doing this show again, we need a bigger crew. Seven people is about right for the smaller show we’re used to, but we need more folks, particularly for the cleanup effort.  Maybe twelve or so would be a better number.  That and some leaf blowers or something to move the debris around a little more efficiently than garden rakes.  I thought a riding lawnmower with a catcher on it would be ideal.

The crew we did have was awesome.  To Greg, Matt, Corey, Alex, Cassie, and Jenn - Good job, folks.  That was a damn fine show.

Check out the pictures. It’s good stuff.

subtext, process comments edit

I’ve been working on several different projects where I’m learning new stuff from scratch.  For example, I’m trying to write my own Subtext skin for my blog.  And as I read the documentation (or attend the meeting, or watch the presentation, etc.) that was created to convey the information to me, I realize that the creator of the material has always omitted the one thing that would suddenly allow the concept to click:

Context.

Picking on the Subtext skinning (since it’s fresh in my mind): It might be super important to tell me which lines in file XYZ need to be changed to show me how to make it do something interesting, but if you don’t tell me what file XYZ is and what its purpose is, the only thing I’m going to learn is that if you do this specific change, you’ll get this specific result.  I don’t have any context for why you made that change, so I can’t really infer any other changes that I could potentially make.  All I learned was the example.

I had a friend who would explain game rules this way.  If she was trying to explain, say, Monopoly, rather than starting out with explaining how the pieces move or what the object of the game is, she’d start out right in the middle with something like how you get sent to jail and how you get out, or what happens to you if you roll doubles.  If you already know how to play and need a refresher, that’s one thing, but for the new person you’re trying to explain the game to, you’re forgetting to provide context.

I see this happen a lot with folks who work on projects for a long time.  When it’s time to demo the end result of the project, they jump right in at the middle, forgetting to explain the overall value of the project, why the audience should care, or what the audience is about to see.  The problem there is that the audience will more than likely just nod their heads and tell you that they understand when the truth is they don’t.  Why didn’t they get it?  No context.

So here’s my public request to anyone trying to convey any information to anyone anywhere - provide context.  Your audience will thank you.

media, gaming, xbox comments edit

I haven’t gotten a chance to put my media center together yet, but I got a comment that points to a pretty decent article about using the Xbox 360 as a media center extender.  It may be easier than I thought.  Looks like the .VOB files you rip from DVDs are actually renamed .MPG files, which can be directly streamed.  I may have to try this out.

It would be easy enough to have the DVD backups on a drive and a virtual filesystem of symbolic links to all of the VOB files that have renamed targets (so “Cool Movie.mpg” would point to “Cool Movie/VIDEO_TS/VTS_01_1.VOB” and mask the whole rename issue). Wouldnt’ be hard to write a program that generates that filesystem. I’ll have to try it.

UPDATE: There seem to be two problems with the way Gizmocafe does things.  First, it’s not really a proper DVD backup solution - it only works if your sole goal is streaming the movie.  Half of the reason I’m doing this is as a backup solution.  Second, you may have a little bit of fudging to do in the DVD ripping software to get movies with multiple VOB files to work.  For example, the movie Borat seems to have three separate VOB files - those would have to be connected to so they could stream in one continuous movie.  The Gizmocafe tutorial doesn’t really address that.