logo
  • Home
  • Home
  • Projects
    • 1000 Miles
  • Blog
    • Pragmatic Programming
    • DC Dining
  • Privacy Policy

Monthly Archives: July 2012

Formatting PHP Date() Time Strings with AP Style

Posted on July 18, 2012 by Curtis O. Posted in Blog, Pragmatic Programming Leave a comment

While developing an event management application, I ran into an interesting challenge: we use Associated Press (AP) Style for our Web publications, but PHP’s date() function only support time suffixes “am / pm” or “AM / PM”. AP Style calls for times to be formatted with “a.m. / p.m.”

To solve the problem, I came up with the following function:

CODE

<?php

function APtime($timestring){

$APstyleTime = (str_replace(array(“am”,”pm”,”AM”,”PM”), array(“a.m.”, “p.m.”,”a.m.”, “p.m.”), $timestring));
return $APstyleTime;
}

$myTime = ’12:04 pm’;

echo APtime(date(“g:i a”, strtotime(“$myTime”)));

?>

 

OUTPUT

12:04 p.m.

I’m not a big fan of PHP’s support of date/time formats and masks, but at least this is a simple (and reusable) solution to an annoying problem.

 

Too Much of a Good Thing

Posted on July 17, 2012 by Curtis O. Posted in 1000 Miles, Blog Leave a comment

It’s been a while since my last post, but I want to assure everyone that I haven’t given up on my effort to walk 1000 miles. As it turns out, five miles a day on the elliptical is apparently a bit aggressive, and I wound up hurting my lower back pretty badly. Walking, bending, sitting, and even laying on my back caused serious paid (let’s say seven out of ten on the pain scale). My legs would crap and go weak with certain movements, and ibuprofen stopped working.

After a relaxing, yet uncomfortable vacation in Myrtle Bead, I decided I could put off the pain any longer, and when I got back to Alexandria, I set up an appointment with an orthopedist. After a physical evaluation and X-rays, my doctor confirmed that my back was in the best shape: the disks in my lower back were being compressed and interfering with the nerves there. Fortunately, I didn’t have to have surgery, steroid epidurals, or highly addictive pain killers, but my orthopedist did send me to physical therapy.

When I started physical therapy last month, I could barely walk due to the pain in my lower back and legs. Filling out the evaluation form in the physical therapist office made me realize just how much this pain was limiting me: I couldn’t stand in one place for more than two minutes; I couldn’t sit in a chair for five minutes; I wasn’t sleeping through the night; I was avoiding household chores (even more than usual); and I was no longer able to walk the distances I needed to walk to make real progress towards my 1000 mile goal.

Krista (whom I affectionately call “Mistress Krista”), Anthony, and the rest of the physical therapy team at the Jackson Clinic in Alexandria have done a great job getting me back on my feet and moving again. They put me through the gauntlet twice a week, but after every session, I feel stronger and have greater mobility. More importantly, they are giving me valuable knowledge to help understand how my body moves an works, and they’re giving me exercises I can do on my own to help strengthen my “core” and better support my back.

For anyone having difficulty moving, I strongly recommend an orthopedic evaluation followed by physical therapy. Ant-inflammatories and pain killers may mask symptoms enough to allow a person to keep exercising, but   as I discovered, sometimes this just allows more damage to occur.

I still have at least another month of physical therapy to go, but I’ve made enough progress to begin walking again. Despite the heat in DC, I’m even trying to get out an walk the city during lunch (I managed about a mile and a half last week). When I’m finally released from physical therapy, I expect to be substantially more fit than when I started.

This evening I’m working through the exercises Mistress Krista and Anthony have taught me, and tomorrow, I’m getting back on the elliptical for the first time in more than a month. I know I won’t do five miles; I may not be able to do three; but I’m getting back on it, and by the end of the day, I’ll be a few steps closer to 1000 miles.

 

Pages

  • 1000 Miles
    • GOAL: 100 Miles
    • GOAL: 200 Miles
    • GOAL: 300 Miles
    • GOAL: 400 Miles
    • GOAL: 500 Miles
    • GOAL: 600 Miles
    • GOAL: 700 Miles
    • GOAL: 800 Miles
    • GOAL: 900 Miles
    • GOAL: 1000 Miles
  • Privacy Policy

Archives

  • May 2013
  • April 2013
  • February 2013
  • December 2012
  • November 2012
  • September 2012
  • August 2012
  • July 2012
  • May 2012
  • April 2012

Categories

  • Blog (13)
    • DC Dining (1)
    • Pragmatic Programming (7)
  • Projects (16)
    • 1000 Miles (16)

WordPress

  • Log in
  • WordPress

Subscribe

  • Entries (RSS)
  • Comments (RSS)

Pages

  • 1000 Miles
    • GOAL: 100 Miles
    • GOAL: 200 Miles
    • GOAL: 300 Miles
    • GOAL: 400 Miles
    • GOAL: 500 Miles
    • GOAL: 600 Miles
    • GOAL: 700 Miles
    • GOAL: 800 Miles
    • GOAL: 900 Miles
    • GOAL: 1000 Miles
  • Privacy Policy

Archives

  • May 2013
  • April 2013
  • February 2013
  • December 2012
  • November 2012
  • September 2012
  • August 2012
  • July 2012
  • May 2012
  • April 2012

Categories

  • Blog (13)
    • DC Dining (1)
    • Pragmatic Programming (7)
  • Projects (16)
    • 1000 Miles (16)

WordPress

  • Log in
  • WordPress

Subscribe

  • Entries (RSS)
  • Comments (RSS)

Recent Comments

  • Curtis O. on GOAL: 100 Miles
  • Mandy on GOAL: 100 Miles
  • Curtis O. on Hitting My Stride
  • cindy burgess on Hitting My Stride
  • Bravo Zulu - Hitting My Stride on GOAL: 100 Miles

Categories

  • 1000 Miles
  • Blog
  • DC Dining
  • Pragmatic Programming
  • Projects
© Bravo Zulu