Thursday, November 6, 2008

What has happened since my last post? Part 3...

This is the final part of the series.

Melissa and I are looking for a place to hold the ceremony and reception and are currently looking for somewhere in the Alma/Mt. Pleasant region. We haven't set a date yet but are thinking it will be sometime in October or November of 2009.

My parents are coming up from Florida to visit on Sunday night and for the full day on Monday. They have talked to Melissa on the phone but haven't actually met her yet. We are going to celebrate my birthday (which was a couple weeks ago) and her birthday (which is in a couple weeks) and go out to dinner. In preparation for them to show up we have been cleaning up the place and trying to figure out the best way to arrange the furniture we have into something usable. The condo is on the market at the moment, but I expect little to no interest in it due to the crappy market. It sounds like we will be there for a while so we are just going to continue decorating the place to make it more of "our" place versus the way I had it as a bachelor pad before. (No more Miller Lite Red Wings mirror in the living room... sadness...)

So anyways, just a lot of wedding planning and whatnot going on lately. Melissa bought a dress last weekend already. Once we have a date finalized we will start mailing out some invites.

Friday, October 31, 2008

What has happened since my last post? Part 2...

The weekend after meeting Melissa my roommate was moving out. He got a job down south somewhere and let me know that he was leaving at the end of September. Dave (the roommate) packed up all of his stuff and wished me luck with Melissa and I wished him luck with the new job... he was pretty cool overall. It was kind of weird to be in the condo alone again though. The place is far too big for just me and I didn't really feel like looking for another roommate, so I just decided to put the place back on the market (crappy, crappy market).

I was also seeing Melissa pretty much every day at that point. Mostly she would come over to see me but I also took the trip a few times to see her at her apartment in Vicksburg. Her mom and step-dad  decided to come visit her at the beginning of October so they could take both of us out to lunch. They showed up on Saturday afternoon and we all rode down to Shipshewana, Indiana in Melissa's van (well its a Saturn VUE... technically a SUV heh). Shipshewana was actually pretty cool. I had never been there before. It is a small Amish town that has a lot of small shops with antiques, baked goods, furniture, etc. The food there was amazing. We ate at this huge house in the middle of town that offered "family style" dining, which is where they bring out plates full of chicken, potatoes, beans, etc that you split with the 4 people at your table and you can get unlimited refills on everything. I ate sooo much chicken as did Mel, her step-dad... but it was so freggin good. Yeah, I would go back there. Her parents and I got along really well too.

After eating and shopping we headed back to Portage and her family headed back to near Alma, which is where Melissa is originally from. It was after they left that we started having some serious discussions about our futures and even talked openly about getting engaged sometime soon and what the future held for us related to our goals within our careers, finances, families, and everything. It was all so fast but we both felt totally comfortable with it. We have some kind of bond where we literally feel like we've known each other for years, it is hard to explain so I won't do it here! :-)

Melissa really wanted to plan our first weekend trip together and loves going to the UP. I have never been there before so it sounded like a good opportunity to try something new (and to see if we could withstand 800 miles in a car without killing each other!). We both took off Friday and Monday of the following weekend and headed up north. We visited her mom and step-dad again and I also got to meet her dad and step-mom as well as her brother. We stayed the night at her dad's place in Alma on Friday night and headed up to the UP early Saturday morning. Meeting her whole family was interesting. Overall, I felt pretty comfortable around them and it was cool to see her hometown.

So in the morning we reached the Mackinac Bridge, which I had never seen in person before. We stopped off at a park and took some pictures here:

 IMG_0250

IMG_0253

IMG_0254

I also taped the 5 minute drive across the bridge. Why not right? Once we got to the UP we headed up to Tahquamenon Falls and to the Shipwreck Museum. The museum was ok, we actually didn't end up going into it but checked out the lighthouse and Lake Superior

IMG_0258

IMG_0259

IMG_0261

Then we got to the falls (amazing, by the way) and took some more pictures and talked some more about our futures. Things were getting very serious. I swear if I had a ring then I would have proposed at the falls... I do kind of regret that but its ok.

IMG_0264

IMG_0270

IMG_0276

IMG_0278

IMG_0279

IMG_0282

We then headed to Sault Ste Marie where our hotel was at and went out for a good dinner at an Irish pub there. Then afterwards we went to the casino where I played like 20 minutes of blackjack at the $3 table (yes, $3 blackjack tables... unheard of at the other casinos I have been to) where I turned $60 into $120. Then on the way out I threw $5 into a 25 cent slot machine fully anticipating to lose the money immediately. I have never won anything in a slot machine... in fact, I hate them with a passion. But I felt lucky because it had been an amazing couple weeks and a great trip so far. My luck played out and on my second to last pull I won $63! Bonus! I came in with $60 and turned it into over $180. That covered most of the trip outside of the hotel costs :-)

The next morning we saw the locks and called up my mom. Melissa and my mom get along great on the phone. After waiting there for a while, 3 boats showed up at the same time to go through the locks. It was pretty interesting to watch.

IMG_0288

IMG_0295

IMG_0299

IMG_0300

IMG_0302

Then we headed back to the lower peninsula to go to Traverse City for the night. Our hotel there was pretty amazing... it even had a Jacuzzi and overlooked the bay.

IMG_0303

IMG_0304

We visited her grandparents and some more of her family there in Traverse City that night, also good people. Then the next morning we went to the Grand Traverse Mall to go shopping and I also wanted to get some kind of ideas from her on what ring she may want. Yes, really... I told you it was serious. When we were there she found some ones she liked. I then "asked" her to go to Target because she loves that store (along with like every other girl ever... what is it about women and Target?). So she went there and I got the ring she liked the most and also headed to JC Penny to buy a few shirts, which really was to just get a few bags and have a good way to hide my ring purchase, which was fairly obvious really. We had lunch at the food court in the mall. I wasn't very hungry so I just got a couple things from Taco Bell and she got some Chinese food (yuck!). You know how Taco Bell has witty one-liners on their hot sauce packets like "Pick Me!" or "Heads" and "Tails"? Well one of my packets was this:

2714675231_885a74ba94

So I gave it to her as a joke and told her to read it... to which she replied "You're kidding?!?" and I said "Yes, yes I am kidding. But just you wait." Yes, I can be pretty cheesy... yet another slick move by me :-)

After eating lunch we were done with the mall and wanted to go wine tasting because it sounds like a grand ol' time for elitists like us! We tried some wine at the Chateau Traverse or whatever its called and bought a variety pack and headed back home to Portage.

Later that night as we were getting ready for bed I gave her the ring along with another hot sauce packet with the same message and asked her to marry me. I know it was cheesy, but she said yes.

More to come still...

Thursday, October 30, 2008

What has happened since my last post? Part 1...

Ok, I know it has been a while. Stop hounding me. I haven't given up on this whole blog thing yet... I've just been busy. With what, you ask? I hope you have enough time to read this post because a lot has happened since September 20th.

A month ago I could buy a Hot n' Ready pizza from Little Caesars for just $5. No longer is that the case. Just 2 days ago on my way home from work I was stuck at a light and saw this:

hotnready

I know its a crappy picture, but the sign now indicates that a Hot n' Ready pizza is now $5.55! I have claimed for a while now that you know the economy is totally in the dumpster when the Hot n' Ready pizza index passes $5. Look at the gloomy clouds in the picture above. That's foreshadowing of what is about to happen. We may lose the 99 cent double stack sooner than we think! Speaking of double stacks... I went through a phase during my last blog post where I was eating several of those a week. Lately I have been down to around 1 a week. I may need to ramp that up a bit now that my money is worth less.

In September I purchased an iPhone. It is amazing just like everyone said it was. I like that I can be on the road and check the scores of my teams, check my email, play games, listen to music, make calls, take pictures etc, etc, etc all on one device. Right after I got it I went on a road trip to visit my cousins in Indiana and listened to streaming podcasts on it through my car stereo. Pretty amazing how simple everything is to set up. I could go on about this for like 18,000 paragraphs, but just Google it and get your 1,000,000,000 results instead :-) 

At the beginning of September I also randomly got a $59.97 charge on my credit card. I had no clue what the heck the charge was until it finally posted, but I was very curious because I consistently owe nothing on my cards and watch them like a hawk if something appears. It turns out it was a renewal fee for an auto 6 month billing from Match.com. Yes, Match.com. I was on it for a while after Jen and I split up in January. I even went on a few dates and they were ok... nothing special... just ok. Oh and there are a lot of crazy people on that site, so be wary of that if you join. Anyways, I pretty much had given up on that site back in August and just decided to be more assertive in 'real' life. (Side note on the 'assertive' plan... it led to me asking out a bartender at a local pub that I used to frequent, from which we went on a couple dates... things were ok until I learned she is crazy. For some reason the topic of willow trees came up during a conversation at Shakespeares. She must have guided the conversation to willow trees because I could not even remotely care about them. Anyways, once I said "willow tree"... she started crying a little and said "I loooove willow trees" and proceeded to take off her shirt (yes, in the middle of the bar) revealing a large willow tree tattoo on her back. That was pretty crazy if you ask me. She did have about 7 Guiness pints and a couple shots in her at the time though... seems like a lot for a 2nd date hehe) Ok, back to the whole Match.com thing. I log into the site to basically cancel my account and get reimbursed for the $59.97 renewal fee and there is a message waiting for me from someone who actually sounds like she has a great personality, is smart, and is really cute in her pictures (a rare combination on there). So we start emailing back and forth over the next week or two. Her name is Melissa, by the way. We eventually talk on the phone and set up a first date at Main St on Thursday of the following week.

Shortly after getting the iPhone, I went to the Sigur Ros concert with Eric. The concert was on a Tuesday night, so I ended up going to his house on Sunday and just worked remotely on Monday and Tuesday that week. During that time I was fighting a losing battle to insomnia... so I was exhausted the entire time and kept trying to fall asleep over there without luck. My first date with Melissa was scheduled for Thursday that week, but I received an email about a divorce party for Kevin at work, which happens to take place at Main St. on Thursday afternoon... the exact place where Melissa and I were going to have our first date. So, I call her up and see if we can move the date up to Wednesday and change the restaurant because I didn't want to go to Main St on Wednesday and Thursday and I certainly did not want our first date to be associated with a divorce party! We agreed to meet at Olive Garden on Wednesday instead. I hope I can live through this insomnia long enough to survive those days...

On Tuesday before the concert we went to Hockeytown cafe, which was right next to the concert venue, to grab some food. I had some steak sandwich panini thingamajig... it was mediocre at best. Then we headed to the show. The concert was fantastic. We had special preorder tickets that let us enter the general admission area ahead of most other people. So we got front and center on the first tier above the main floor. It was a really good spot. They played pretty much everything I had hoped and even dumped a ludicrous amount of confetti on the crowd during the middle of one of their more upbeat songs.

IMG_0027 IMG_0021

After the concert I drive home and get back around 2am. I manage to get a few hours of sleep and end up calling in to take the morning off so I can at least try to sleep some more. Melissa and I meet over at Olive Garden and continue our conversations from the emails and phone calls. We get along great and she is just as cute as she is in her pictures (also doesn't happen frequently with online dates, by the way). After dinner I didn't want the date to end yet and neither did she so we end up settling on mini-golf. About 2 or 3 holes into mini-golf we are both dying. Mosquitos are everywhere! I say "forget this, chalk this up as a bad idea... let's get a rain check" and we get a couple rain checks and decide to watch a movie instead. No good movies are out... so I ask her if she would be comfortable coming over and watching a DVD. She is ok with that and we watch Juno. It was a good first date overall, we talked through the whole movie and dinner and seemed to really be a good match (no pun intended). Good thing they didn't cancel my account on Match.com when my subscription ran out, otherwise I would have never met her.

The next day was Kevin's party. I asked Melissa on our first date if she would be interested in meeting me at Main St around 7pm after most of the party should be cleared out and she shouldn't feel too overwhelmed by meeting so many of "the guys" right away. She agrees and shows up at 7 and even brings Kevin a gift! Kudos to her for that gesture! A few people were still left and she got along with everyone. She came back to my place again after the party and watched some football with me and my roommate for a while before heading out for the night. It was a really good second date... we were totally comfortable with each other and that is when I started to realize quickly where this was going. Here is a picture of her at Main St. A lot more happened over the past month. It will take several posts to go over everything, so stay tuned!

 IMG_0028

Saturday, September 20, 2008

Double Stack Attack!

image

See that juicy burger above? I bet you are thinking to yourself... "There is no way that costs 99 cents!" Well, you are wrong! And guess what? The burger is amazing. I could eat these for breakfast, lunch, and dinner... seriously... amazing.  Wendy's burgers are decent for fast food burgers (actually I don't eat other fast food burgers) and this is no exception and is worthy of a blog post. I would not trade my double stack back for the $1 I paid, ever. So they are right! If the entire US economy was based in  double stacks instead of $1 bills a barrel of oil would cost $40 instead of $100. Wendy's, get the word out! (Vegetarians, ignore this message)

Friday, September 5, 2008

A Question...

Has anyone ever purchased a Where's Waldo book for themselves?

Monday, September 1, 2008

100 Push Ups

As many of you know, I am on a difficult journey to lose some weight and get back into shape. Working in a cubicle all day can make it extremely difficult, but I am trying nonetheless.

The past month I have biked and lifted more weights than I have in any previous month in my life. Not much progress has been made yet though. I think my body is still questioning my commitment! Anyways, I have lost 6 pounds during the month of August and hope to lose 10 in September... a reasonable goal I think.

One interesting site that I came across was hundredpushups.com. The site has one simple goal: to put you on a 6 week plan where you can do 100 consecutive push ups at the end. I just completed the initial test where you try to do as many as possible in a row to see where you are at. I managed only 25... but it could be worse. Tomorrow begins week 1. I really hope that trying this, biking even more, and not drinking beer at all during the month of September will get me to my goal!

Tuesday, August 19, 2008

Michael Phelps and his 12,000 Calorie Diet

So today I read an article that Michael Phelps eats 12,000 calories a day, which generally consists of the following:

Breakfast: Three fried-egg sandwiches loaded with cheese, lettuce, tomatoes, fried onions and mayonnaise. Two cups of coffee. One five-egg omelet. One bowl of grits. Three slices of French toast topped with powdered sugar. Three chocolate-chip pancakes.

Lunch: One pound of enriched pasta. Two large ham and cheese sandwiches with mayo on white bread. Energy drinks packing 1,000 calories.

Dinner: One pound of pasta. An entire pizza. More energy drinks.

I am totally jealous. Don't get me wrong... I have eaten a hot n' ready pizza all by myself for dinner many-a-time (always... always feel like garbage afterwards by the way), but if I did it every day I would look like this:

image

After he wins a ridiculous amount of medals in the 2012 games in London he should retire and take up competitive eating, which should become an Olympic event in the 2016 games. Imagine being the Gold medal winner for most hot dogs, grilled cheeses, ice cream, butter... whatever, you name it. How American is that? Kobayashi is going down!

phelpseating

My MS Paint skills are unbelievably awesome.

Sunday, August 17, 2008

Dependency Injection and Inversion of Control Explained

Dependency injection (also called inversion of control) is an interesting design pattern that I am now utilizing in the code I write.  The purpose of this pattern is to achieve a loose-coupling across relationships within classes, which also leads to much cleaner code and eases the ability to write unit tests.  The name may sound rather intimidating but the concept is fairly simple. Say you have a class 'walrus' that needs a 'walrusService'  instance in order to do its work.  Traditionally, I would code up the class like this:

public class Walrus
{
private readonly WalrusService walrusService =
new WalrusService();

public void DoSomeWork()
{
walrusService.DoSomeWork();
}

public void DoLotsOfWork()
{
walrusService.DoLotsOfWork();
}

public int SomeIntProperty
{
get;
set;
}
}


public class WalrusService
{
public void DoSomeWork()
{
Console.WriteLine("Doing some work...");
}

public void DoLotsOfWork()
{
Console.WriteLine("Doing lots of work...");
}
}

Notice how the Walrus class above manages its dependency on the WalrusService  to do some work. The class is tightly-coupled to the service class and there is no easy way to swap the service out for a different one.  The Walrus class also needs to know how to create an instance of the Walrus service internally.


Using dependency injection combined with interface-based programming methodologies will allow us to loosely-couple this dependency and will make the Walrus class no longer care about managing the dependency on the Walrus service.


The first thing I am going to do is make the WalrusService implement an interface. ReSharper is awesome for this, just right click on the Walrus class, go to the Refactor section and click Extract interface...


public interface IWalrusService
{
void DoSomeWork();
void DoLotsOfWork();
}
public class WalrusService : IWalrusService
{
public void DoSomeWork()
{
Console.WriteLine("Doing some work...");
}
public void DoLotsOfWork()
{
Console.WriteLine("Doing lots of work...");
}
}

Now I will create a constructor on the Walrus class that takes an instance of the IWalrusService class. This is where the injection/inversion concepts are taking place. Here is the new Walrus class:

public class Walrus
{
private readonly IWalrusService walrusService;

public Walrus(IWalrusService walrusService)
{
this.walrusService = walrusService;
}

public void DoSomeWork()
{
walrusService.DoSomeWork();
}

public void DoLotsOfWork()
{
walrusService.DoLotsOfWork();
}

public int SomeIntProperty
{
get;
set;
}
}

Performing this small change allows the Walrus class to no longer care about what service is being handed to it... as long as it is an IWalrusService then life is good. This is a good way to refactor code that is calling a service that hits the database because now that service can be mocked in a unit test scenario. If all classes are written to take its dependencies in the constructor, then relationships are always very clear and become easier to manage. I will write about Inversion of Control containers soon. These containers (such as the Castle Windsor IoC container) make these relationships even easier to manage from the caller's standpoint.

Sunday, August 10, 2008

Weekend Ramblings (some rants too...)

Non-technical ramblings:
  • I thought Pineapple Express was a mediocre movie (literally just got back from seeing it)
  • Got my scale I ordered from Amazon... I am trying to lose weight and am recording the daily results on a dry erase board in my nerd cave. Hopefully the cat won't erase it... stupid cat. If I can create a trend where I sustain a loss of a pound a week then that is perfect.
  • The book 'When You Are Engulfed in Flames' isn't very good. I guess that is why I should maybe check out this thing called the library... because now I am stuck with a crappy book from which I've only read the first few chapters.
  • I am almost caught up on watching the show Weeds. (What is it with all these pot-themed movies and shows that I have seen recently???) I was streaming them online through my Netflix account and then realized they didn't have season 3 available to stream... so I rented season 3, disc one from the video store down the road and watched it late Friday night only to want to see more episodes on Saturday afternoon. I went back to the video store and they did not have the 2nd disc in stock (crap!). I go to another video store  (I was not a member there and would have had to sign up...) and it is out there as well (double crap!). Then I remember this wonderful thing called the Internet. It is where I was watching the first 2 seasons after all... so I Google Weeds streaming episodes and sure enough I find all of them all the way up to the current episode (like season 4, episode 8). Needless to say, I watched way too much TV this weekend.
  • The new Ours cd (an indie rock band from Chicago) is not very good. Unfortunately, it seems they tried real hard to make most of the songs radio-friendly and they just end up sounding forced. A couple songs are good, but they are no Sigur Ros :-) (Sept 23rd can't come soon enough!)
  • The Olympics have started and have been fun to watch. It was good to see the USA beat China in basketball this morning.

Technical ramblings:

  • Learned some good things about how to implement a LINQ data access layer on the program at work. It is just a start, but patterns are beginning to take shape... especially the fact that timestamp columns are a great was to handle concurrency and that we need to get on board with it. Timestamp columns also give you a way of moving entities over the fence to attach to a separate LINQ DataContext. Having a way to create real foreign-keys in the system now is also extremely useful for generating automatic relationships within the dbml file and across the entities.
  • I am also finally beginning to understand domain-driven design concepts. I am still only through the first couple chapters in the book I mentioned before, but I revisited those chapters and compared the patterns to the ones used on the LINQ data access layer above and was pleasantly surprised to see that many of the practices tried this week were also in the book. (Google 'LINQ Repository Pattern') Unfortunately, the book does not deal with LINQ at all despite saying it is a .NET 3.5 book, which sucks honestly because as I am viewing the code the author wrote I can already see better ways to do the job with much less code. For instance, he still uses dynamic SQL strings built up in code to perform updates and inserts. Also there are several cases where auto-implemented properties and lambda expressions would have yielded much less code. Most of the concepts are still good, but it is hard to ignore the LINQ DataContext and generated entities when reading through the book.
  • Here is a good rant... why the heck can't I alter a column in SQL server that is numeric to set it as an Identity column. I swear I had to jump through way too many hoops at work last week to switch all of my Id fields over within my data model. At least give some way to do an update against an Identity column as well. It sucks that I had to temporarily move the data around in order to drop the table and re-create is as I wanted. I first went through creating this huge dynamic SQL script that handled updating all of my tables in one shot, which ended up working. But it was annoying because it placed all of the Id columns at the end of the table because I was forced to drop the original Id column. I know column order should never matter, but querying those tables in management studio (with select * syntax) and scrolling over to see the primary key would have drove me insane pretty quickly.
  • The 'vote of no confidence' against the still unreleased entity framework is now big news. Listen to the podcast about it from the ALT.NET guys below (really, really interesting concepts come from this website by the way). I found it funny how one of the guys wants to invent a time machine to go back and force Anders (the lead developer of C#) to create all methods as virtual by default. http://altnetpodcast.com/episodes/8-vote-of-no-confidence
  • I emailed John-Paul Boodhoo last week to see if he plans on instructing one of his 'Nothing But .NET' bootcamps sometime soon in Chicago or Detroit. He is one of the developers that quickly gained notoriety a year or two ago for pressing the subjects of TDD, IoC, DDD, and all that good stuff on .NET rocks and DNR TV. He does these bootcamps where he has a very small class, like less than 20 people, and does a hands on project with you for 5 days straight, with most days lasting up to 14 hours. The material is very, very good... and he is really good at presenting the concepts. He replied back to me today and says he has on his schedule to present in Chicago during the 2nd quarter of next year. I really want to go, but this stuff is not cheap because of the very small class sizes ($3,000 total, which includes the 5 days, food for the week, a ReSharper license, $70 amazon gift card, and a 'I survived .NET bootcamp' shirt)  Check out his webpage at http://jpboodhoo.com/Home.oo

Sunday, August 3, 2008

Nerd Cave and New Books

I spent most of the week setting up my new computer and rearranging the basement.

Here are some pictures of how I decided to lay out a study area/exercise/media room. My basement is unfinished for the most part but does have a rather large old dining room table in it, which makes a really good computer desk that gives me space for books and whatnot.

IMG_0178

IMG_0179

IMG_0180

IMG_0181

The new computer has been working really well.  I know all the techies will want the specs on it so here they are:

HP PAVILION M9200T ELITE SERIES

PROCESSOR
Intel Core 2 Quad Q6600 (2.40GHz/64KB L1/8MB L2 Cache)
MEMORY
4GB (4x1024) DDR2 SDRAM (PC2 6400 / 800 MHz)
Total memory slots: 4 DIMM
HARD DRIVE
750GB SATA-3G 7200RPM Drive with 8MB Cache
PRIMARY MULTIMEDIA DRIVE
Lightscribe 16x/8x -DL DVD+/-RW 12x RAM SATA
SECONDARY MULTIMEDIA DRIVE
N/A
GRAPHICS CARD
512MB NVIDIA GeForce 8600GT, TV-out, DVI-I, HDMI
TV TUNER
ViXS PureTVU 48B0 (NTSC/ATSC Combo)
SOUND CARD
Sound Blaster XFi Xtreme Audio (Vista) Sound Card
NETWORKING
Intel 82566DC 10/100/1000 Mb/s

I have an extra 250GB hard drive laying around that I would like to install in it when I have some ambition. I like the fact that this would bring up the total space available to a terabyte... pretty ridiculous. 10 years from now if I look back on this post I will laugh because they will have 10 Terabyte micro-SD cards and cell phones with 80 processors :-)

So far the media center aspects of Vista are pretty good. The computer came with a spiffy remote that lets me record and watch TV and control DVD menus and go through an included media guide for my cable service. All in all I was impressed with how seamless it just worked right out of the box... all I had to do was hook up the coax cable and go through a really simple wizard. It is nice to ride the exercise bike and be able to watch some TV or DVD.

Right now I am watching the show Weeds based on a recommendation. It is pretty good so far, but yeah it is a strange concept for a show to have a pot dealing mom living in a "stepford wives" kind of neighborhood (McMansion Communism, anyone?) where everyone seems to need to get a fix in order to deal with their incredibly boring lives.

Oh and speaking of fixes... I just my latest shipment from Amazon this week, which consisted of 3 books and 2 boxes of protein bars. The protein bars are really good, I guess I could talk more on those later... but here are the 3 books I ordered:

So far I have only delved into the first 2 chapters of the .NET book. I like the concepts so far, but I think the author did a pretty poor job at writing the book in a manner suited to the reader (me) who is trying to follow the code and type is out as it is presented. He never explicitly states to add files to your solution in location "X"... fortunately he does use consistent namespace conventions. Sometimes the concepts are barely glossed over too and I don't fully understand what he is talking about. But overall, so far I do like the code concepts as a whole. All of the classes and interfaces are definitely geared towards being concise by existing to do one job and to do it well.  The author is a strong believer in  established patterns and principals like these:

  • Factory
  • Decorator
  • Dependency Inversion through Interface-based programming
  • Separation of Concern and the DRY principal (Don't Repeat Yourself)
  • Model-View-ViewModel (apparently a spin-off of the classic Model-View-Presenter where I don't know the differences yet...)
  • Layered Supertype
  • Many more I am sure, I just finished chapter 2!

I would like to do a series of posts about most of these concepts in detail down the line as I get further along into this book. I am very interested in the whole "Inversion of Control" concept. It is a very unique approach to breaking down dependencies... 

For now, Walrus out!

Friday, August 1, 2008

Walrusize your LINQ!

This is a very short blog post... If selecting the same result data type as my element type within a collection I like to shorthand my code by using the Where() function instead of the more verbose LINQ syntax, which turns this:
var evenNumbers = from number in numbers
where number%2 == 0
select number;

Into this:
var evenNumbers = numbers.Where(
number => number%2 == 0 );

Am I being picky here?

Sunday, July 27, 2008

Sigur Ros

So who are Sigur Ros?

Well if you just clicked on their name you can read all about them on Wikipedia.  The overall description given to them on the site is this:

Sigur Rós (['sɪːɣʏr rouːs] (help·info)) are an Icelandic post-rock band with melodic, classical and minimalist elements. The band is known for its ethereal sound and lead singer Jónsi Birgisson's falsetto voice.

Basically, they are a band that does not sing in english, but that doesn't even matter... the music is that good. Another interesting thing is the lead singer often plays the guitar with a violin bow like this:

image

They are, without a doubt, my favorite band. Radiohead had top billing in my mind for a while, but a new favorite has emerged. I've been to 2 Radiohead concerts... both were amazing. However, they both pale when compared to the first time I saw Sigur Ros 2 years ago in Detroit.

The just released a new album and I heard it for the first time today. It is unbelievably good. I can't give it justice through words... so here is what I felt like when hearing it for the first time:

happywalrus

Ok, enough of me giving them praise. Check them out at their official website. I think they have most, if not all, of their new album on the main page with free streaming.  They are also playing again in Detroit on September 23rd. I believe the show is sold out already, but I am sure they can be found on eBay! I will be there!

Weekend Ramblings

  • Stepbrothers is a funny movie.
  • Crunchy's once again proves to be a fun bar in East Lansing. Good luck to my cousin Steve on his new job and move to Fort Wayne!
  • The new Magic: The Gathering set 'Eventide' was fun to draft on Friday night.
  • My new computer shows up on Monday, I got my place all set up for it in the basement.
  • The new Sigur Ros album 'Med Sud I Eyrum Vid Spilum Endalaust' is the cats pajamas
  • Cleaning the bathroom is not the cats pajamas.
  • The term 'cats pajamas' is the cats pajamas.
  • TCBY in downtown Kalamazoo (the only TCBY left here that I know of) has good and bad days for their vanilla/fudge swirl. Saturday was a bad day.
  • I got my place measured for new carpet. We'll see if I can actually afford it.
  • Jen visited on Saturday afternoon. It was fun, but fairly ackward.
  • Combining genoa salami, ham, pepperoni, and mozzerella on pita bread then baking it and putting italian dressing and lettuce on it creates an awesome meal.

Thursday, July 24, 2008

Reusing runtime compiled LINQ queries

Sometimes I want to execute the same LINQ generated SQL statement multiple times with different parameters, but don't want the overhead of conversion from an expression tree to the actual SQL statement to occur each time. I did some research and found that you can cache the compiled query using the CompiledQuery.Compile method which allows you to store the compiled method into a Func variable.
In the example below I am caching a query to get Employees by City in the Northwind database. The GetByCity method exposes the stored function to the caller and will only compile the query the first time it is executed.
using System;
using System.Data.Linq;
using System.Linq;

namespace NorthwindSandbox
{
public static class Class1
{
public static void Main()
{
var db = new NorthwindDataContext();

DisplayEmployeesByCity( db, "London" );
DisplayEmployeesByCity( db, "Seattle" );
DisplayEmployeesByCity( db, "Walrus" );

Console.ReadKey();
}

private static void DisplayEmployeesByCity (
NorthwindDataContext db, string city )
{
Console.WriteLine(
string.Concat( city, " Employees: " ) );

IQueryable< Employee > employees =
Employee.GetByCity( db, city );

foreach ( Employee e in employees )
{
string name = string.Concat(
e.FirstName, " ", e.LastName );

Console.WriteLine( name );
}

Console.WriteLine();
}
}

partial class Employee
{
private static Func< NorthwindDataContext,
string, IQueryable< Employee > > byCity_;

public static IQueryable< Employee > GetByCity(
NorthwindDataContext dbContext,
string cityName )
{
if ( byCity_ == null )
{
byCity_ = CompiledQuery.Compile(
( NorthwindDataContext db, string city )
=> from employee in db.Employees
where employee.City == city
select employee );
}

return byCity_( dbContext, cityName );
}
}
}

Wednesday, July 23, 2008

First attempt at code formatting in my blog

return from number in Enumerable.Range( 
1, products.Max( p => p.UnitsInStock ) ?? 0 )
select new Walrus
{
UnitsInStock = number,
ProductNames = (
from product in products
where product.UnitsInStock == number
select product.ProductName )
} as IWalrus;

Sunday, July 20, 2008

Why Walrus?

So why is this blog walrus themed? Let me explain...

I was trying to think of some kind of theme to use that is rather silly and recalled a project in my BIS 380 class during my junior year at WMU. For this project I needed to do some basic image transformations using Fireworks. I came up with the really dumb picture below. Roar.

Tuesday, July 15, 2008

First blog!

This is my first blog. WOOHOOOOOO!