Thursday, March 22, 2007

Day 23: I'm Back in the Game

For about 1.5 hours last night, I worked on my site while watching Futurama and Family Guy. While I don't work at peak productivity while watching TV (obviously), I had already seen the three episodes, and so they didn't distract me as much. I worked mostly in CSS for the layout. I got a basic column layout setup with some decent colors. This was so important for me because now my test pages don't look like ass. Booya.

Date: 3/21/07
Status: Success
Project: Website
Time: 90 minutes with TV, so likely 30-45 minutes actual

Wednesday, March 21, 2007

Handling DBNull in .NET

The following is an email I sent to my development department. I found the basis for this code somewhere else on the interweb, but I can't find the link. I do not claim this as my own invention, especially since the functionality is built into .NET.
If you're like me, you've come across the issue of being unable to cast System.DBNull to any datatype. To get around this, I would check for DBNull, then conditionally do the cast:
' assuming "row" is  a datarow with data from the SQL Server
Dim office_code As Integer
If Not row("office_code") Is System.DBNull.Value Then
office_code = CInt(row("office_code"))
End If
This gets quite verbose, especially if you have many columns. Instead, using the "Of" keyword, we can create a generic-typed function that works just like TryCast works but works for reference and value types and handles DBNull:
Private Function SafelyConvertFromDBNull(Of thisType)(ByVal item As Object) As thisType
If item Is System.DBNull.Value Then
item = Nothing
End If
Return CType(item, thisType)
End Function
Which is called like so:
Dim office_code As Integer = SafelyConvertFromDBNull(Of  Integer)(row("office_code"))
Dim partner_name As String = SafelyConvertFromDBNull(Of String)(row("partner_name"))
Dim start_date As Date = SafelyConvertFromDBNull(Of Date)(row("start_date"))
Dim monthly_revenue As Decimal = SafelyConvertFromDBNull(Of Decimal)(row("monthly_revenue"))
This function saved me many lines of code, so I thought I'd share it with you all.

Cincinnati, the City of Kings

This past weekend I was in Cincinnati at a wedding, so I gave myself a pass there. Monday and Tuesday though... wark! Monday I was still too tired from the trip, and Tuesday I was over at Eric's until 11:30 or so.

Also, I'm adding a "reason" field to all failed days. Should make the data more meaningful.

Date: 3/19/07 (Day 21)
Status: Failed
Reason: tired

Date: 3/20/07 (Day 22)
Status: Failed
Reason: social

Thursday, March 15, 2007

Teacher, May I Be Excused?

I had a little run in with my car yesterday... at the mall at 8:30PM, it didn't start. AAA shows up 1.5 hours later, but the car doesn't need a jump (I figured that, something else was broken), and the driver can't fit his flatbed into the garage. 1.5 hours after that, a tow truck arrives. The driver, Artie, asks me to start it so he can hear what it sounds like. Of course, it starts right up. It looks like either the solenoid is corroded and needs to be replaced, or some other wire is loose or corroded.

End result: I left the house at 7:30PM, didn't return until 12:30AM. I am excused from being productive.

Wednesday, March 14, 2007

Day 20: Booya

With a little help from Eric, I got a serious good start on my Rails website. I pretty much forgot everything I knew about Rails, so Eric had to basically hold my hand through some excruciatingly basic stuff. However, now I have a basic working app! Wahoo! Eric's kickstart should be enough to get me going.

Go on over and give him some love; he's at the Mill Industries link over on the left.

Date: 3/13/07
Status: Success
Project: Website
Time: ~120 minutes

Tuesday, March 13, 2007

Day 19: A Conundrum

Last night I did several errands with Annie. We went to Petco, Stop & Shop, and CVS, three stores in pretty much exactly opposite directions from each other (spare me your geometric diatribes!). It took us about two hours, maybe two point five. So does this count as meeting my goal?

I'm going to take a step back. My original purpose for the goals was to get me to do web development (and some other projects I might not otherwise do) on my own time. I think I've somewhat fallen from that, given that my last three or four successful days were not web dev.

So where do errands fit? I don't know. I'm still in trial mode here, so I'm not going to refine my parameters for success yet. Maybe around day 30 or 45.

Date: 3/12/07
Status: Failure

Monday, March 12, 2007

It's Been A Long Time, Getting From There to Here

So I missed a few posts. No excuse for Wednesday or Thursday. I spent this weekend in New Jersey with my family, so I excused myself for Friday, Saturday, and Sunday.

So on Thursday I called my cell phone company back. The rep managed to give me a $20 credit towards a phone purchase, which finally tipped the deal. The rep told me I couldn't order the phone over the phone, but he would call the local stores to see if they had one. They did, so I went to the store that night to buy the phone. Booya!

Then on Friday I called back to get all the features activated. Now, all of a sudden, the rep is having trouble giving me the $3/month texting for free. So I escalate. The supervisor says he's never heard of this 'code' (they call all their plans codes, because they just put a code in their application). He says he'll file a ticket for his engineering team (think me, but working at a cell-phone company) and call me back on Tuesday (tomorrow). He also mentions a "buyer's remorse" program, which says that I can go back on everything within 14 days of purchase. If they can't give me the $3/month plan for nothing, then I'm out.

Date: 3/7/07 (Day 17)
Status: Failure

Date: 3/8/07 (Day 18)
Status: Success
Project: Cell-phone negotiations
Time: ~45 minutes

Dates: 3/9/07-3/11/07
Status: In NJ

Wednesday, March 7, 2007

Day 16: Boxing a Glacier

I dueled with the my cell phone company's retention department again yesterday for close to an hour. We're finally starting to get some progress. They won't budge on the price of the phone, and they've been offering me "unadvertised" data and text message plans. While these deals are attractive to me because they're cheaper, they remove certain features. For example, they offered a cheaper text message plan that did not include picture messages. Now, my Sidekick II can't send picture messages, so I've never felt their absence. However, I don't like being restricted. Also, it's clear from the conversations I've had that the rep is just looking through a list of plans and telling me about them.

The dynamic changed last night when the rep put my on hold. He came back and was prepared to offer me the $3/month text messaging plan for free. This offer was in response to my saying "If you could just knock $5/month off the total cost, I'd sign on the dotted line." Now we're actually starting to negotiate.

Date: 3/6/07
Status: Success
Project: Cell phone negotiation
Time: about 1 hour

Tuesday, March 6, 2007

Batch Update

Whoa, I got pretty behind in posting here. Here's the rundown:

Date: 3/2/07 (Day 12)
Status: Failed

Date: 3/3/07 (Day 13)
Status: Failed

Date 3/4/07 (Day 14)
Status: Success
Project: Haggling with T-Mobile
Time: ~45 minutes

Date: 3/5/07 (Day 15)
Status: Failure

I want to keep up logging my work, even if I fail a lot, because this is basically a beta test of my goals. We'll see how realistic they are.

Friday, March 2, 2007

Day 11: Tired

I did not meet my goal yesterday. I got home from work and was just exhausted. This may have not been a particularly wise decision, as tonight I'm going out with a friend for his birthday and likely will not be able to get anything done. We'll see.

I've got all my plans for my website in a Basecamp, and I set a milestone for myself. By this Tuesday, I need to have ten items done for my website, specifically for the user-account-system (UAS) and/or the blog. I'm currently at zero items.

Date: 3/1/07
Status: Failed.

Thursday, March 1, 2007

Day 10: Booya

Last night I kicked ass. I called T-Mobile when I got home and spoke with a rep for about 15 minutes about my options. My plan is to collect competitors' offers, then come back to T-Mo with the offers and try to get them to flinch. Wish me luck.

Then I spent about 45 minutes working on my dev environment. I know this is taking way longer than it should, but I want to get it right. I have sqlite3 installed and working properly now (with a meaningful "create.sql" script); I just need to verify that RoR can connect to it and I'm ready to roll.

I credit my massive success to lack of distraction; rather than play FFVI on the subway home, I read my book. Once at home, I left the TV off (though I did blast FFVI music on my laptop). Without distractions, I rocked.

Date: 2/28/07
Status: Success
Project 1: Cell Phone dance
Time: 15 minutes
Project 2: Website
Time: 45 minutes
All rights reserved. Take that!