Wednesday, July 18, 2012

Date Conversion With Perl

Recently I've started to keep a personal log as I'm coding.  This has already started to be a big help in terms of not-resolving problems while I'm working on a project.  At the same time, a number of my friends have started learning to code.

Since my logs are already pretty close to blog-post sized, I'll start posting a few of the more interesting ones, in hopes that they'll help people who are working on similar projects.

Recently, I've been working on a project where I want to use SQLite to work on some data files.  The data were initially stored in CSV files.  In the last couple days, I've gotten them converted to tab-delimited files, which will work better for the specific application.

The latest challenge came about when I was trying to use some date and time information in my data files.  It turns out that I'd downloaded them with the dates in a slightly wrong format.

In my files, the dates look like this:

29-Jun-04 13:04:40

SQLite wants dates that look like this:


2004-06-29 13:04:40

Sunday, January 16, 2011

10 Mi Run


Yesterday was supposed to be my first major run. But due to family visiting, I actually made it out today. But, today would have been a rest day, so it all balances out.

A- came out with me for the first 6 miles. So I came up with a loop that was easy to split into 2 loops. Also, I still can't find my waterbottle, so I ended up doing this without any water. I was surprised by how I didn't seem to miss it.

At first I was pretty disappointed with the pace. But then, I haven't run this long since the last half marathon. I also felt like I could have kept going at the end.

Mile 1: 11.12 HR 157
Mile 2: 11.01 HR 159
Mile 3: 11.22 (combined w/ 3 due to road blockage)
Mile 4: 11.22 HR 153
Mile 5: 10.58 HR 160
Mile 6: 11.19 HR 164
Mile 7: 11.21 HR 161
Mile 8: 12.08 HR 161
Mile 9: 11.57 HR 158
Mile 10: 12.00 HR 160

Total 1:54:44.

Thursday, January 13, 2011

Week 3, Day 4

Today was a 5mi run at an easy to moderate pace. I followed the loop I've been using, and felt better than I did on my last couple runs.

My times were:
Mile 1: 9.44.70 - HR163
Mile 2: 9.48.68 - HR169
Mile 3: 9.56.68 - HR166
Mile 4: 13.12.23 - HR166 (Had to stop for a traffic light near a school)
Mile 5: 10:48.60

Total: 53.30.89

So, still slow, but there seems to be some improvement. Also, it's good to see that my heart rate is in a reasonable zone.

The weather is 20F, 14F with windchill. I'm also not sure that I've been eating enough over the last few days, and will try to up my caloric intake and see if that helps, particularly just before the run.

Monday, January 10, 2011

Running: Day 2

Today was the second run in my training program. The training schedule called for an easy 5 miles. So, I shortened my loop from Saturday and went for it.

Today's run actually felt a good bit more difficult than the last one, even though I wasn't trying to go as fast.

Times:
Mile 1: [Stopwatch Error]
Mile 2: 10:24
Mile 3: 11:28
Mile 4: 14:21 (With some recovery)
Mile 5: 9:34

Total (4mi) 45:53

So, this was a lot slower than last time. I didn't eat breakfast before my run, and that might have had some impact. Or it could have been me recovering. Or maybe I just had an off day. I'll make an effort to eat more next time, and see if that changes anything.

Saturday, January 8, 2011

First Day of Marathon Training

Today, I started my marathon training. I'm starting the cool runnings schedule a few weeks late. After working it out on a calender, today would be Day 7, Week 4. So, it's a 6 mile run.

The run felt pretty good and my cold weather gear was great. Running tights are way more comfortable than my warm-ups, and my running vest and hoodie kept me warm when the wind picked up. (The weather report was 21 degrees, feels like 6).

Also, Rockbox has a stopwatch. So, I broke my run into mile times.

Mile Times:
9:42
9:32
10:53
10:37
10:31
10:17
Total:
1:01:35.34

So, on average I was running 10:16 miles, which would give me a marathon time of around 4:30. Hopefully I'll see some improvement.

Saturday, January 2, 2010

England (Days 6&7 Week 8/24)

No luck on the mini-trains, unfortunately. Caroline, Gigi and I headed out to the place where we'd expected to see them, and found nothing.



So, we continued our drive towards the south-west, crossing the ferry across the mouth of Pool's harbor. Corfe Castle was our next landmark, a really impressive ruin high on a goat-inhabited hill. The area was fenced off to keep tourists out of the area.



Next, we visited the Tynham village, a ghost-town near the coast. The British army needed a place to do live-fire exercises so they evacuated the little farming village and fenced in the area. After the war, they decided to keep the land, but allow visitors into the former-town center. It's amazing how quickly nature seemed to overtake these villages. There wasn't even a trace of thatch on the roofs.

I made sure to snatch a photo of some of the books that were left in the (maintained) single-room school house. I'll see if the university library has any of them in our stacks.



Around lunch time we came by a neat little pub, the New Inn at Church Knowle. This happened to be the first place we came across that seemed likely to serve a Steak and Ale pie. It turned out great. The food was excellent, and the pub has a big reputation. Almost all of the tables were reserved (impressive for a pub that's so far from any major town), and we were lucky to get a seat.

Finally, we went to see Lulworth cove. It seems that the British like to go walking on New Years Day as the area was packed. There's some nice scenery and a wonderful natural harbor.

Saturday morning started with a long run. I made it out along Forest Road and onto the trail in the woods. All in all, I think I did about 40 minutes of actual running. I can feel a definite improvement, and plan on going out tomorrow.

Saturday afternoon was spent having lunch with Gigi's friend Jan. We drove down to the sea and stopped at a nice little restaurant where I got a burger, and Gigi had a Thai-themed pizza.

Friday, January 1, 2010

England (Day 6 Week 8/24)

I left the US on Tuesday and had one of the smoothest trips I've ever taken. Before my flight left, United called me up to the gate sand said that they'd given me an upgrade to business class. On an international flight, business class meant I had a personal TV, a seat that could fully recline and some nice meals. We landed on time (Wed morning) in England and I found my bus with no problems.

Gigi and Lidia were waiting in Ringwood and saw me easily because of my bright yellow hat (though, they expected it to be pink). We drove into Burley and arrived at the gate house to have tea. The main house is coming along nicely and the new floors look great.

Wednesday afternoon we went to the Burly Inn for a late lunch with Lidia and Steve. Gigi had a shrimp cocktail, I had a curry, and we both had 'real ales' made by Ringwood brewery.

That night, we went to bed early as I hadn't gotten much sleep on the plane and was very tired.

On Thursday morning I showed off my culinary skills and made a breakfast of scrambled eggs. Gigi even had Creme Fresh in her refrigerator, exactly what I needed for the Gordon Ramsey scrambled eggs recipe. I love cooking on the Aga.

That afternoon, we called a taxi to take us into Burley to do some shopping. Gigi got a driver who she really likes, but says treats her like she's made of glass. We stocked up on food and then walked around the downtown.

After we got back, I went out for a 30 minute run along Forest Road. So, my half-marathon training is not totally being neglected.

New Years eve dinner was pasta with a meat sauce. I was very happy to see that my homemade spaghetti came out correctly, as did the red sauce. For dessert we had cider and chocolate.

Today, we're planning on going out with Caroline (Gigi's hair dresser) for a drive, and hope to encounter the society of people who make very small steam powered locomotives. Think something very much like a steampunk lawnmower!

Monday, December 28, 2009

Day 2 - Week 8/24

Today's run was another 3.5 miles as I went to River-woods and back. There hasn't been too much new snow, so the streets were a lot clearer.

I also made a trip to IKEA with Mark and Lily. I got a floor lamp, a new cutting board, and a bread knife.

I wanted to get some shelving, but I need to measure out the space in my apartment a little better, to make sure that everything will fit right.

At home, I'm packing for my trip to England, and really looking forward to it. Also, I took this picture. See if you can spot the thing that's out of place.

Saturday, December 26, 2009

Day 6 - Week 7/24

I've been really bad about writing lately. Fortunately, I've been less bad about exercising.

Two days ago (thursday) I ran 3.8 miles with my dad. Yesterday, I did 3.5. Today, I woke up to about three inches of snow on the ground, and so did 30 minutes on the recumbent bike.

My cardio fitness seems to be getting better. During these runs, I feel like I'm being held back my my legs, rather than my lungs, which is a nice change.

--- Part 2 ---
My dad convinced me that the weather wasn't that bad. So I ran another 3.5 miles today. I'm still needing to walk a bit during these runs, but it's definitely getting easier.

His advice is to focus on my breathing. He says that it makes the little aches less noticeable.

As far as personal stuff, Christmas went really well. My cats got a great haul, and are more or less making peace with the dogs. Somehow, Tobin's Chihuaha has realized that it can chase the cats around. It's pretty funny watching a toothless 4-pound dog chasing 25 pounds of cat.

Tuesday, December 15, 2009

Day 3 - Week 6/24

I put in another three miles tonight. My stopwatch somehow turned off about 10 minutes into the run, so I don't have a time.

Adding in a few extra days of running should smooth my transition into the half marathon program.

Monday, December 14, 2009

Day 2 - Week 6/24

I didn't record the two runs from last week. Neither was especially long, partly due to weather, and partly due to finals.

Today's run went significantly better. I'm on week 8 of the couch-to-5k program, which calls for a 28 minute run. I traced out a 3-mile route, and went for 36 minutes, including my warmup.

My heartrate was between 158 and 167 for most of my run, and my pace felt comfortable. I'll see if I can add some extra distance onto the next run.

Thursday, December 3, 2009

Running. Day 2 & 5 Week 4/24

I extended monday's run to be 6 minutes, 9 minutes and 6 minutes (with three minutes of cool down between the running). Monday felt pretty good and was comfortable through the first two runs. The third felt a bit slow.

Today was two sets of 10 minutes. Unfortunately, I put the run off a bit too long, and as a result, and the weather had gotten quite cold.

But, the good news is that I've gotten my pace up to 9-minute miles on the first 10 minute run. So, that's some improvement. Also, I'm still on-schedule.

Friday, November 27, 2009

Running. Day 6 - Week 3/24

Today's run was supposed to be 20 minutes, with 5 minutes each of warm-up and cool-down.

I set out and my heart rate monitor was not registering quite right. And, after the warmup (and getting stopped a minute into the jog by a traffic light), I set off. The run felt pretty good at first.

About 6 minutes in, my calves started to feel pretty heavy. I kept going, and they didn't get better, but they didn't get any worse, either. At around the 18 minute mark, I realized that I'd picked a somewhat too-long route. So, I decided to add on an extra minute and a half to compensate for the pause at the traffic light, and eat up some of the extra distance.

The extension felt good enough that I just kept going, and increased my run-time to 25 minutes. At the end, my heart rate was holding at 166bpm.

So, I'm feeling pretty good after the last run of my third week.

Wednesday, November 25, 2009

Running. Day 4 - Week 3/24

Today's run was:

Warmup
Run 8 min
Walk 5 min
Run 8 min
Cooldown

I ran outside, and had a heart rate monitor with me. This time, my heart rate stayed between about 165 and 175 when I was jogging, so that seems much better. It also drops off really quickly during the cooldowns, so that's also a good sign.

The running has been mostly ok, though I'm unsure how well friday's 20 minute run will go. But, we'll see.

Current Weight: 186

Monday, November 23, 2009

Running. Day 2 - Week 3/24

Today was Day 1 of Week 5 of the couch-to-5k program. This week is interesting because each day is different.

Today was 5 min warm up, and then 3x(5 min jog + 3 minute run) with an extra 2 minutes of cool down at the end.

My dad came out, and the jog felt pretty good.

Current Weight: 183lbs

Saturday, November 21, 2009

Running. Day 7 - Week 2/24

I missed my second workout this week, and decided to just continue on with the couch to 5-k program. So, today was the last day of Week 4.

My dad invited me along to the gym, so I did the workout on a treadmill. It was interesting to see both my speed and my heart-rate. There's still a lot of room for improvement.

I think that my jogging speed on the previous runs has been about 6-7 mph. And, I was surprised to see that my heart-rate was getting above 180 during the 5-min runs. So, my cardiovascular fitness really has some room to improve.

But, the run generally felt good, and after, I went up and lifted some weights.

Current Weight: 183

Monday, November 16, 2009

Running. Day 2 - Week 2/24

This was week 4 of the couch to 5k plan.

This week will be:
5 minute warmup

2x of
3 minute jog
90 second walk
5 minute jog
2.5 minute walk

And a 5 minute cooldown.

I was expecting tonight to be really unpleasant from the cold and the two days of rain. But, it actually went nicely. The cold felt good while I was jogging, and most of the water was off the ground. The increased time felt pretty easy, too. I think I'll try for a faster pace next time.

Current Weight: 186

Friday, November 13, 2009

Running. Day 6 - Week 1/24

I missed my run last night, so I went this morning. It's getting quite a bit easier. And, the podcast is still helping.

So, I've completed week 3 of the couch-to-5k program, and will go onto week 4 on sunday.

Current weight: 181.4

Tuesday, November 10, 2009

Running. Day 3 - Week 1/24

Tonight I continued my couch-to-5k program.

The routine was:
5 min warmup
90 second jog
90 second walk
3 min jog
3 min walk
90 second jog
90 second walk
3 min jog
3 min walk

I found a podcast that had all the timings in it. It was nice to not need to keep checking a watch.

Current Weight: 186.0

Sunday, November 8, 2009

Running. Day 1 - Week 1/24

Alyssa convinced me to join her in the Illinois (Half) Marathon that's happening on May 1st.

I've got 24 weeks to get ready. It's a lot of time, but I really haven't been good about exercising this weekend.

So, tonight I did day 1, week 3 of the couch to 5k plan. It wasn't too bad, but I can definitely tell that I haven't been exercising much. Still, it's a start. Hopefully I'll be ready.