Erich Peterson

Bio and Blog

Upcoming China Trip

Horray! I’m going to China in December for 3 weeks! Hope to gave a great time, I’ll try to post plenty of photos and some of what I did after I return. Until then….check out Mao.

Mao ZaDong

  • 0 Comments
  • Filed under: Ramblings
  • Honeymoon

    Well, we are back from our honeymoon to Alaska, and rather than trying to explain everything we did (possibly boring you to death), I’ll just give you guys a link to some of the photos: Click Here.

    Highlights of the trip were:

    • Hiking Flattop Peak Trail.
    • Taking a cruise within the Kenia Fjords National Park:
      • Seeing killer whales, a humpback whale, sea otters, puffins, porpoise, sea lions.
      • Aialik glacier and other glaciers.
    • Hiking to Exit Glacier.
    • Biking the Tony Knowles Coastal Trail by bicycle and taking a self-guided walking tour of Anchorage.
    • Seeing the beautiful town of Seward and Homer.
    • Taking a tour from the Alaskan Center for Coastal Studies:
      • Went tide-pooling and saw a bunch of cool creatures like: star fish, clams, octapus, sea cucumbers, sea urchins, etc.
    • Driving from Anchorage to Seward along the Cook Inlet (one of the most beautiful drives in all the world).

  • 0 Comments
  • Filed under: Ramblings
  • A Simple ‘I do’

    That’s right, I’m getting married! This Sunday (July 22nd) is the day. After being romantically involved with my now fiance since Febuary of 2004, we will be tying the knot. It will be a very intimate and small wedding at a friends house, which will include only close friends and family.

    Of course, there have been hard times in our relationship, however, the fact that we have made it through them has in fact made me more optimistic and less scared of married life.

    I will post pictures on Flickr and here of the actual wedding soon after the event. We plan on having some more semi-professional photos taken sometime after the wedding as well (which I will share). We are going to Alaska for our honeymoon, and are looking forward to seeing a part of the U.S. we have never seen before.

    UPDATE: Click here to see some pictures from the ceremony:

    That’s all for now….stay tuned.

    I love you very much Siqing!

  • 0 Comments
  • Filed under: Ramblings
  • Blanchard Springs: Wild Cave Tour

    Jiang, Siqing, and I went to Blanchard Springs a while back and took the “Wild Cave Tour”. It was a 3 1/2 hr. crawling, squeezing, and off-the-beaten-path unique tour. I’m sure Jiang will kill me for showing this picture, but I need a good beating.

    Have you ever seen a happier miner?

    img_1273_a.jpgimg_1274_a.jpg

    Calculating Next Invoice Date

    Have you have every needed to calculate the date of the next invoice for a customer given their frequency of payment (e.g. monthly or yearly), the day of the month the first invoice was sent out (e.g. 29th, 30th, etc…), and the date of their last invoice? This can be a little complicated. For example, let’s say your invoice for a customer who pays monthly, and signed up for service on the 30th of January. Well you cannot simply take their last invoice 1/30/2007 and add one month using LastInvoice.AddMonths(1) (which will give you 2/28/2007), for instance, becuase when you do the same the following month it will be 3/28/2007 instead of 3/30/2007 like it should be.

    Other issues arise when it comes to leap years. The following code takes care of all the problems mentioned above:

    VB .NET

    Public Enum LicensePaymentType As Integer
      Monthly = 1
      Annual = 2
    End Enum   
    
    Private Function determineNextInvoice(ByVal LicType As LicensePaymentType, _
              ByVal InvoiceDay As Integer, ByVal LastInvoice As DateTime) As DateTime
      If LicType = LicensePaymentType.Monthly Then
         If LastInvoice.Day < InvoiceDay Then
            Dim Temp As Integer = InvoiceDay - LastInvoice.Day
            Dim NewInvDate As DateTime = LastInvoice.AddMonths(1)
            Return NewInvDate.AddDays(Temp)
         Else
            Return LastInvoice.AddMonths(1)
         End If
      ElseIf LicType = LicensePaymentType.Annual Then
         Dim NumDaysNextYearsMonth As Integer = _
               DateTime.DaysInMonth(LastInvoice.AddYears(1).Year, LastInvoice.AddYears(1).Month)
         If LastInvoice.Day < InvoiceDay AndAlso NumDaysNextYearsMonth >= InvoiceDay Then
            Dim Temp As Integer = InvoiceDay - LastInvoice.Day
            Dim NewInvDate As DateTime = LastInvoice.AddYears(1)
            Return NewInvDate.AddDays(Temp)
         Else
         Return LastInvoice.AddYears(1)
         End If
      End If
    End Function

  • 0 Comments
  • Filed under: .Net General, Tech
  • Personalizing Feeds RSS with ASP .NET 2.0

    I just wanted to invite everyone to go over to 4GuysFromRolla and read my latest article entitled, “Personalizing RSS Feeds with ASP .NET 2.0“.

  • 0 Comments
  • Filed under: ASP .Net 2.0, Tech
  • Want to get replace those “smart quotes” that MS Word uses in your .NET code? This will do it:

    VB .NET

    Dim newstr As String
    newstr = oldstr.Replace(Chr(147), "& quot;") ' take out extra space b/w & and quot;
    newstr = newstr.Replace(Chr(148), "& quot;") ' take out extra space b/w & and quot;

    C#

    string newstr;
    newstr = oldstr.Replace((char)147, "& quot;") // take out extra space b/w & and quot;
    newstr = newstr.Replace((char)148, "& quot;") // take out extra space b/w & and quot;

  • 1 Comment
  • Filed under: .Net General, Tech
  • Fiddles of Fear

    Too often leaders sound their fiddles of fear, in an attempt to make their decisions seem more righteous.

  • 0 Comments
  • Filed under: Ramblings
  • Word 2007 Personal Favorability Status: Waning

    OK, let me tell you it is extremely frustrating to spend 30 mins. drawing an awesome diagram with Word 2007’s new drawing canvas tools, saving the file, closing the file, re-opening the file, and finding all your drawings are gone–being replaced by blank picture elements! This has happened two or three times now, and I’m about to give up trying to draw with Word 2007.

    Anyone had this same thing happen? All my searching Google turns up nothing…

  • 0 Comments
  • Filed under: Ramblings
  • For the Cat Lover in Your Life

    It’s rare that I see something that both makes me laugh and gage at the same time….so with out further a-do I present to you the “Kitty Liter Cake“.

  • 0 Comments
  • Filed under: Funny