The Month Without Trash

For the last 30 days, I have tried something new in my apartment. Not using the trash can. I know, some of you think my apartment probably looks like this right now. 




But actually it doesn’t. Here’s the results of my month without throwing things away. 


And the perishables part of the trash.

ImageThe thing I’ve noticed the most about this experiment is how much I pay attention to what my stuff comes packaged in. I have already been using re-usable grocery bags for quite some time. But reducing the amount of stuff that I throw away (instead of recycle or turn into compost) has been awesome for me. Try it some time. You may be surprised to realize how much waste you create! 




Faith is the Best Drug in the World That Isn’t a Drug at All

There was a time in my life when I saw the “hallelujah stand up and shake in church” people as odd. I never understood why just believing in something could make them so emotional. I think that part of it was my stubbornness rearing it’s ugly head. I’M THE ONE WHO MAKES MY LIFE GOOD. Then I realized how powerful faith can really be. Non-believers will say that faith is a coping mechanism for a world we didn’t understand. I feel like it’s a statement that we DONT HAVE TO UNDERSTAND EVERYTHING. That we can put trust in something science will never be able to prove. And that uncertainty (from that strict scientific perspective) is perfectly acceptable to me. It allows me to learn about the world, and also to learn about how to be a better person. 

A New Chapter

It’s been awhile since I’ve blogged. A lot has changed in my life since then, and I’d like to take some time to share whats been going on with me. Back in December, I came home one night after work. I was sitting by myself thinking about my life, and I realized how many things I’ve done that I’m not proud of. All the mistakes, and lies, and hatred that I’d accumulated over my 23 years of life. Sure, if you knew me, you’d probably be a little confused since most would probably say I’m a pretty laid back guy. Not one to want to be the center of attention, and usually nice to everyone. But behind that exterior, I had become someone totally full of selfishness and pride. I looked down upon people ,and not because I was about to help them up 😉 . I also basically wasted all of my free time either playing video games for hours on end, or just drifting on the internet. I was disgusted with the real me, not just the me according to others.

The following month or so was a pretty dark time for me. The holidays are the only extended family exposure I get now that I live 3+ hours away from home. Usually it’s refreshing and filled with happiness for me. But throughout all of it, all I could think about was how terrible I felt about my life. I went through it all, working hard at times, and being lazy and awful at other times. I felt a huge sense of disappointment and shame, and started really feeling like I didn’t deserve the life I had come to know. I had also gotten to the point over the last 3-4 years where I really questioned my faith and if I even believed in God anymore. 

I’d be lying to you if I followed that with a success story about how I changed it all and now am doing much better. Some days I literally have to go into a room by myself and cry. But I have a wonderful Fiance and family that supports me. Spending time with them helps me get outside of my own head. Without them I have no doubts I might have put myself in a much worse situation. I have also started going to church again. I really feel like the events I’ve went through the last couple months were God speaking to me to change my life. And finally, I have (re)dedicated myself to playing music. Since I quit the band I was in during my highschool and early college years, I’ve drifted away from playing my guitar. And I realized how much I missed it! Music has always been a happy part of me, and now I want   it back where it belongs. I hope this writing will also be a big part of my new chapter. The cathartic feeling of writing about your struggles is an excellent healing tool. Thanks for reading 🙂

Testing SendGrid Event API from local machine

My current work project involves integrating the application with SendGrid in order to track email delivery and bounces. One of the most frustrating parts of this integration involves setting up a callback url for sendgrid to notify once an “event” such as email delivered or email bounced occurs. This requires a publicly available url to hit, which means no developing on the local server. Or so I thought.

Once I was able to get a callback URL setup with the sendgrid apps page, I uploaded a simple web application to Appharbor that logged http requests whenever a particular url was POST’ed to. This allowed me to send an email and see just exactly what sendgrid was sending to my application. This is what I got.

POST /Home/HandleEvent/ HTTP/1.0



Content-Type:application/x-www-form-urlencoded; charset=utf-8



User-Agent:SendGrid Event API




This is a full http post request that SendGrid sent to my callback url. Everything but the bottom line is the http headers, and the bottom line is the http post body. This is the key, because your callback application will need to parse this data out to handle the messages. Luckily, mvc has model binding. So all I had to do was create an action method that represented my callback url, and then create a class that encapsulated all the parameters as properties of the class.

The final stage is to start up the application locally, and then use a tool like Fiddler or cURL to make a “fake” http post request to your application and put the above data in. 

Tweak until you get it right. And be done 🙂

Good luck.

Enough with the Developer Drinking Drama

Over the past couple of months, there have been several articles and discussions I’ve seen regarding developers and drinking. Most of the articles have been pretty benign about condemning it, but there’s always people in the comments claiming they are being excluded if they don’t participate. I really fail to see  how being a developer is different than any other career. If I was a doctor and I went out with my peers, should I really expect them not to drink just because I’m there? 

If drinking is a sanctioned direct part of a conference, maybe I’d object to it then. But there always have been and always will be people who do X as a career and drink beer. And when they are out on the town, it’s nobody else’s prerogative to tell them not to. 

Install Adventure Works Database Sql Server 2008 R2

This is the simplest way to install the OLTP database Adventure Works from Microsoft on your local machine.

Download the data file from the link above


Then open up Sql Server Management Studio. Right click on the Databases folder under your sql server instance and click Attach 


Click add and find the mdf file you just downloaded. I put mine into %System32%\Program Files\Microsoft SQL Server\INSTANCE\MSSQL\DATA\AdventureWorks2008R2.mdf so it was with the other data files already attached to my instance.


The final step is to go right below the add button and remove the “log file” that it tries to add as well. The download doesn’t come with a log file, so if you don’t remove it, then you will get an error message.


Hopefully this works for you!

— Matt

UI threads and WPF

Here’s my pesky solution to getting a spinner to show while an operation is executing in WPF.

        private void Execute_Click(object sender, RoutedEventArgs e)
            Spinner.Visibility = Visibility.Visible;

            var request = new Request
                Endpoint = Endpoint.Text,
                Username = Username.Text,
                Password = Password.Text,
                Input = Input.Text

            var task = new Task<string>(()=> GetResult(request));
            Action<Task<string>> after = t =>
                                                 Output.Text = t.Result;
                                                 Spinner.Visibility = Visibility.Collapsed;
            task.ContinueWith(after, TaskScheduler.FromCurrentSynchronizationContext());

Why linq is awesome

For anyone experienced with linq, this will be a mundane post for you. But I was talking to a friend on twitter today about programming. I wanted

a short explanation of a problem and why linq is an awesome tool for dealing with lists/collections of data in the .NET framework.

So Imagine we have a list of objects called Stocks.

public class Stock
    public string Ticker { get; set; }
    public float Bid { get; set; }
    public float Ask { get; set; }
    public string Exchange { get; set; }

And let’s say we want to loop through them and do something special with stocks that are traded on the Nasdaq. The traditional way with an array to do this is the following:

for (int i = 0; i < stockList.Length - 1; i++)

            Stock s = stockList[i];
            if (s.Exchange.Equals("Nasdaq"))

The foreach keyword in c# makes this slightly easier to do away with the for loop. So then we can right it like this.

        foreach (Stock stock in stockList)
            if (stock.Exchange.Equals("Nasdaq"))

This is definitely better, because you don’t have to worry about knowing how long the list is and only iterating that many times. The foreach operator takes care of that for you.

But now, behold the power of LINQ.

                   .ForEach(stock => CalculateFancyStatistic(stock));

That single statement replaces all of the above code, and does the exact same thing. If you really want to be concise you could also use something called a  method group.


And that my friends, is why c# is my all-time favorite language to program in. Gets the point across and lets you move on with your task!

Source Code Test

Let’s see how well this works

using System;
using KissMessaging.SampleMessages;

namespace KissMessaging.SampleSubscriber
   public class Program
     private const string queueName = @".\private$\test";
     public static void Main(string[] args)
       var b = KissBus.Initializer(conf =>
                                    conf.Subscribe<User>(queueName, o => Console.WriteLine(o));