Tuesday, July 23, 2013

How to find the most referenced methods using NDepend 4 Professional Edition

For a while I've been writing unit tests for a framework of code we develop and maintain. For the main shared assembly I have about 40% code coverage but for the whole solution the code coverage is under 10%. My thoughts were that if I knew which methods and areas of the code we referenced the most, then I could start writing unit tests for that code now and ensure I got the largest bang for my time.

Today I posted a question on StackOverflow with the very idea and I got a response to use NDepend. As soon as I figured out how to use NDepend to get the results I want and posted it, others wanted to know how I did it.

I began by downloading a trial of NDepend 4.1.0 Professional Edition. Extract the program to a folder from the zip file you downloaded.

After a few trial and errors attempts, I found it easiest to copy the assemblies that you want to scan to a temporary directory so that it doesn't scan other non-essential assemblies. I copied my compiled assemblies with debug symbols from my solution to "C:\Temp\dump" for reference in the post.

Open VisualNDepend and I selected ".NET assemblies in folder" under the Recent Projects section.

This will bring up a dialog box for you to browse to the folder where you copied the .NET assemblies to and then press OK.

After you press OK, another dialog box will pop up. Just press OK to analyze the assemblies you've selected.

Now you should be displayed the UI Metrics Window as shown below.

In the Metrics window you will see a drop down menu in the middle of the form. You want to click the selection arrow on the right and select "# Methods calling me: 1 method - XX.X pixels" Note that XX.X will be different based on your screen resolution.

Now select the icon to the right of the drop down selection arrow that looks like some colored vertical bars and select however many methods you want to see. I selected the Top 1000 records.

On the left side of the NDepend form a Query and Rules Edit window will be displayed. At the bottom of the window are the results for the methods with the most references. At this point you can export the results however you want. I personally chose to export the results to Excel so that I could manipulate the results a little more. This isn't a perfect query just because it also lists the references to methods in the .NET Framework so I cleaned some of that stuff up in Excel.

At this point you have a complete report of the Top XX number of methods in you project with the number of times that specific method is called. I hope others found this to be useful as I did.

If you know the CQL syntax for NDepend, you could take this farther by importing your current code coverage results into NDepend and then modifying the query to exclude methods that already have code coverage but for now this works good for me.

Tuesday, July 16, 2013

How to make StyleCop ReSharper Plugin load in VS 2012 with ReSharper 7.1.3

It seems that when everyone upgraded to ReSharper 7.1.3 that the StyleCop plugin for ReSharper no longer worked or got an error. I've gone some time without the StyleCop plugin integration with ReSharper but I like the development cues it gives you. This morning I decided to get the plugin to work.

1. Download the StyleCop msi from here.

2. Extract the contents of the MSI downloaded above. You should see the extracted contents like below. If you don't know how to extract the contents of an MSI, see this link.

3. Navigate to the "[RESHARPER71_INSTALLDIR]\Plugins" directory.

4. You should see a folder named "StyleCop 4.7". Copy this folder to the clipboard.

5. Navigate to the following folder and paste the folder on the clipboard to the directory.


6. If you have Visual Studio 2012 open, you'll have to close it to get ReSharper to locate the new plugin.

7. After opening Visual Studio you can go to ReSharper -> Options -> Plugins and see all the plugins loaded. See example image below.

This should now allow you to use the StyleCop plugin with ReSharper 7.1.3.

Tuesday, March 5, 2013

Day 2–Dynamic Effort Upper Body

Second day of programming. Pretty sore in the glutes and quads with the hamstrings being really tight. Below is the workout for today:
  • 9 x 3 Close Grip Bench Press @ ~50%
    • 30 to 60 second rest
  1. 3 x 12 Rear DB Deltoid Raises (shoulder)
  2. 3 x 12 Knelling Cable Rope Pulls (tris)
  3. 3 x 12 Wide Grip Pull Downs (lats)
  4. 3 x 12 Cable Rows (back)
  5. 3 x 10 Floor Presses (chest)
Worked out with my buddy Mark Brewer. I definitely perform a lot better when I work out with a partner.
I also got the pleasure of trying out a Sling Shot today. Put my raw 1 rep max of 225# on the bar. Performed the bench press with the sling shot for a double and could have done more. Was very impressed with how much the sling shot helps launch the weight out of the bottom, which is my weak spot.

Monday, March 4, 2013

Day 1 - Max Effort Lower Body

Today is the first day of writing my own programming so we'll see how it goes. Below is today's workout:

  • 1 Rep Max Sumo Deadlift (Approximately 5 sets)
    • 3 to 5 minute rest between sets


  1. 3 x 12 DB Weighted Lunges (Glutes)
  2. 3 x 12 Leg Press (Quads)
    • Slow down (1 to 2 seconds), explode on the way up!
  3. 3 x 15 Heavy Ab Sit-ups
  4. 3 x 12 Cable Pull Thrus (Hips)
  5. 3 x 12 Good Mornings (Back and Hamstrings)
Update: By the end I was toasted. The good mornings I cut short to 3 sets of 8 reps. I should have dropped the weight more but I was ready to get out of there after being at the gym for an hour.

Sunday, January 13, 2013

Josh’s Paleo Banana Nut Bread Recipe

This is based on a Paleo banana bread recipe I came across when I started eating a Paleo diet a couple years ago. I’ve modified it and tweaked it for my liking. Everybody in my family loves this. Even when I made other popular banana bread recipes, they still pick mine over the others.


  • 3 eggs
  • 5 tbsp honey, tip: Honey is a mess when you try to measure it so either measure it by weight or squeeze it in the bowl and count 1-1000, 2-1000, 3-1000, 4-1000, 5-1000 (85g carbs)
  • 4 tbsp olive oil
  • 3 to 3 1/2 brown spotted bananas mashed, tip: Don’t use green or bright yellow bananas. Wait till they've sat on the counter for a few days. (72g usable carbs)
  • 1 tsp vanilla extract (1g carbs)
  • 1 tsp baking powder, dual acting aluminum free (1g carbs)
  • 2 cups of pre-packaged almond flour or 2 1/4 cups of freshly ground almonds, The reason we use an extra 1/4 cup when making your own almond meal is because you get multiple textures from the food processor. (18g usable carbs)


  1. Preheat oven to 350F.
  2. Add all the ingredients into a large mixing bowl. Ensure you mash the bananas in a plate first with a fork or a masher.
  3. Mix the ingredients in the bowl with a mixer till thoroughly mixed together.
  4. Coat the inside of loaf pan with coconut or olive oil so the bread doesn’t stick to the inside of the pan.
  5. Pour the banana mixture into the loaf pan.
  6. Place in oven on the middle rack and cook for 1 hour to 1 hour and 15 minutes.
I prefer to use a silicone loaf pan. A silicone loaf pan makes it easier to get the bread out if you by chance forget to grease the inside of the pan. Now just enjoy your banana bread.

UPDATE: After posting this recipe I was wondering how many carbohydrates were in a single loaf. From my calculations of all ingredients the total usable carbohydrate count is 177 grams. Because of the carbohydrate count, I recommend eating this over an extended period of time. I'm going to play with the recipe in the future to find an alternative to the honey.