Sunday, September 17, 2006

Broken and Beautiful

Mark Schultz has a great new song called "Broken and Beautiful", which has been making its rounds on Christian radio in these few weeks before the CD release. Why do I think it's so great? Because it echoes the reality of so many different people from so many different walks of life:

"There's a business man
There's a widowed wife
A smiling face with a shattered life
A teenage girl with a choice to make
It's crowded here in church today"

When I step into church, I know all too well the worries and stresses that I'm facing in my own life, but I often forget that everyone is coming weighed down with their own burdens, too. Everyone has struggles, everyone has pain, and everyone comes in need of healing. Which is why the next part of the first verse is so applicable:

"And the preacher says as the sermon ends
Please close your eyes
Bow your heads
Is there anyone in need of prayer?
Oh Jesus wants to meet you here"

To me that's just really powerful, to be reminded that no matter what we're going through, God still loves us and wants to help. Hearing those words above really touches me, because I know how important it has always been to me to have that prayer time in church. But then, sadly, Mark's song becomes less good, and by that I mean he completely misses the point, ruining everything he had just built up:

"'Cuz we all fall short, and we all have sinned
But where you left, God's grace begins"

That first line is beyond appalling in its simplicity, ignorance, and condemnation, all of which are too commonplace in the Christian Church today. Mark just finished talking about four people who have come to church in need of prayer and love and support [at least two of whom are not themselves guilty of nor responsible for their situation, the first and fourth, I think, are being deliberately left to individual interpretation], but now the blame has been placed back onto these distraught souls, anyway. It's appalling to me because this game of blaming the victim is, sadly, the most common refrain I hear coming from the ultra vocal, ultra conservative Christian right, and I'm dismayed to see this attitude has now creeped its way into my favorite music genre. These people Mark describes to us came to church seeking renewal and relief, not pulpit-imposed guilt for crimes not their own.

This isn't to say that the church should be all feel-good, all lovey-dovey, without any talk of culpability and responsibility for one's actions, but when sin is invalidly assigned as the root cause of suffering when it is clearly not (as was the case for the lives talked about in Mark's first verse), I am forlorned. It's really just that one line that's a kick in the pants. The rest of the song works. The rest of the song, in my opinion, paints a beautiful portrait of what can happen when we come to God, hearts opened, begging for healing and restoration, and the end result truly is beautiful.

An Exciting Afternoon!

This afternoon, as I was driving back to campus from Minneapolis, I was preparing to exit from Highway 77 (Cedar) onto 35E, when all of a sudden I felt a very noticeable jerk and noticed my speedometer begin to drop. At the very outset I assumed it was the cruise control inelegantly readjusting me down a mile or two, but then the engine started to make a lot of noise: a very loud and unnatural clicking noise, along with the painful sounds of going much faster on the inside. "Hmm", I thought. "That's probably not a good sound. I'm already committed to take this entrance ramp onto 35E, but I'll take the first exit once I'm on that freeway." I turned off the cruise control. "Hmm", I thought again. "I'm pressing the gas pedal, I should be speeding up to about 70mph, but I'm slowing down. That's odd." Meanwhile, the engine is still making the loud clicking noise. I was down to about 50 on my speed and I realised I probably wasn't going to make it to the next exit. I put on my hazards to warn the car behind me and started to slow down. The real excitement came when I started to pull onto the shoulder, though, because that's when the SMOKE started coming out from under the hood! Yikes! I finally stop about 200 yards back from the merge to 35E, park, turn off, and get out as quickly as I can, convinced the car is going to catch on fire, an assumption not helped by the fact that more and more smoke kept coming out of the hood in greater and greater quantities. I had two thoughts, and two thoughts only: my computer is in the trunk, and that's more or less my life, so I really hope the car doesn't become engulfed in flames; and, more importantly: I have too much to live for to be caught in an explosion, so I must get away quickly. I prayed along the way, too.

Now, good for me, I had my mobile with, so I called my parent's house where I thought my dad was. No answer. I call again. No answer. I call my mom's cell, planning my first words to be something like "Get in the car now and I'll explain on the way". No answer. Distraught, and in a huge panic, I call the AAA emergency number and give them the details. They send a tow-truck on its way to rescue me, and I eventually get a hold of mom and dad, both of whom come on their way. (My real first words to my mom were "The important thing to know is that I'm okay").

While I waited (half an hour), two other cars stopped on their way to offer help. Knowing both my parents and the tow truck are now on the way, and seeing that the car was no longer smoking, I graciously sent the good samaritans on their way, my faith in humanity's potential for goodness restored.

The tow-truck arrived first and starts making preparations to load the car onto the flatbed. Dad arrives a few minutes after, we load all of the video equipment I was carrying in my trunk into the van, and wait for the truck driver to finish loading my car. I call mom to let her know how it's going and that we'll meet her at the car dealer (Freeway Dodge, where we were having the car towed to).

And then we're on our way. We all met up again at Dodge, glance around at some of the used car stickers in case we find ourselves needing to buy a replacement instead of repairing, and then mom brought me back to school, several hours and a good deal much more excitement later than I had originally planned.

Things could have been a lot worse. If I'd driven any farther, I'm fairly certain the car would have actually caught on fire. I could have not had a cell phone to call for help. We could have not had AAA coverage. And I could have been much less composed than I was. Now, admittedly, on the inside, I was very very nervous, but I still managed to evaluate, process and react to the situation in a very orderly and outwardly calm manner. I pulled off the road so I wouldn't block traffic, I attempted to call my parentals, I successfully called AAA and coherently gave them the information they needed, and even before that phone call I had very consciously thought through the situation: do I need to call 911? Do I call AAA? Do I just call my parents? Who else can I call if they can't come rescue me? In short, in the end, I feel that I did quite well, which gives me a realistic confidence that I'll be able to remain clear-headed if I'm ever in a worse situation in the future.

Friday, September 15, 2006

PHP Email Validation using Regular Expressions

This is a very geeky post, but I spent a good three hours making this code work perfectly, and I'm kind of proud of it, so there.

The idea is this: I needed a function that would validate the email address entered by a user on a new Tech Request System that I'm writing for Minnehaha, but I also wanted the user to be able to enter comma separated email addresses in the form and have those parsed correctly. Google didn't seem to have a ready-made function available for me to use, so I knew I had to take on the challenge and write my own. It was fun, too, so I can't really complain. The code may not be the most efficient it could be, but it works, and for a small scale application like this that's really the only requirement.


The following PHP function, validateEmail($email), checks the input ($email) to see if it contains valid email addresses. This is done first by parsing the input string into an array, each location in which will contain an individual email address to be parsed (this is assuming the original input was a comma separated list of emails; if only one email address was entered, this array will only have value associated with it). I then create a variable to return (cleverly named $return) and initialise it to be the returned value from calling validateSingleEmail on the first item in the aforementioned array. If there are more items in the array, the for loop goes through and checks them by calling validateSingleEmail on each. If the item is a valid email, that text is returned and appended (with a comma and space) to the $return variable. If the item is a blank email (pure whitespace, that is), validateSingleEmail returns an empty string and nothing is appended to $return (this is useful to catch any trailing commas and spaces in the original input so that they don't cause an error). Otherwise, if the item is an invalid email address (not matching the format abc@def.ghi), a validateSingleEmail returns false, thus causing validateEmail to also return false, which, in my application, causes an error message to appear on the user's screen when they press submit.

If all goes well, though, the function returns $return, and also sets the POST variable $_POST["Email"] to be this return value (that way everything is entered into the database correctly when the rest of the data is sent).

That's it. Very exciting for the non-computer people, I know. Actually, I'm sure it's not all that terribly exciting for the computer types, either, but maybe it will be useful to someone else someday.


function validateEmail($email) {
  $emails = preg_split("/,/", $email);
  if($return = validateSingleEmail($emails[0])) {
    $count = count($emails);
    for($i = 1; $i < $count; $i++) {
      $addition = validateSingleEmail($emails[$i]);
      if($addition !== false) {
        $return .= ($addition == '' ? '' : (', ' . $addition));
      } else {
        return false;
      }
    }
    $_POST["Email"] = $return;
    return true;
  } else {
    return false;
  }
}

function validateSingleEmail($email) {
  if(!preg_match('/[^ ]+\@[^@ ]+\.[^@ ]+/', $email, $matches)) {
    if(preg_match('/[\S]+/', $email, $matches)) {
      return false;
    } else {
      return '';
    }
  } else {
    return $matches[0];
  }
}

Sunday, September 10, 2006

That's a wrap! And let school begin

Finally, my long overdue post announcing that, *drumroll*, Harry Putter has wrapped! Our last day of shooting was on August 26th, starting from a 6:00 am call and running until about 7:30 pm that night - a long but absolutely wonderful day! We had an awesome crew, an awesome cast, and an awesome time all around - huge thanks are owed to Matthew Feeney for making it all possible; without his time, effort, and connections, the whole project would have sunk months ago.

So what's next? Everyone I've talked to asks me when the premiere is going to be. The answer is I don't know; we need to get a rough cut done first, and then it has to have the music score added, and then we'll be putting together the bonus features for the DVD, and then we will think about what premiere we can have, if we can have one at all (renting out a real theatre is expensive, and as I discovered would probably cost more than the entire budget of the film). Summary: a premiere, if there is one, is many months away.

In the while, I dropped off all the tapes with Tony Peltier (he ran sound during the HP production), who will be editing the film. Now it's in his hands - I just sit back and wait patiently. Which means Ben Latz, Matthew, and I can start looking toward other projects for the future, such as writing HP2 (this is, of course, based on the assumption that HP1 will turn out well - prayers are appreciated).

And it also means that I can start to focus more on school, now that St Olaf is back in session. I'm taking my final semester (third) of Norwegian, after which I will be done with my foreign language requirement! And I'm taking an Intro Astronomy course, which, aside from being of interest to me on general principle, will also be the last of my science GE requirements. Lastly, I'm taking two courses in the Computer Science area: Algorithms & Data Structures and Client Server Applications, both of which are highly project and programming intensive (C++ and Java, respectively), and thus both of which may very well be the kind of classes I've been waiting for out of the CS department here, thus, I'm excited.