Add Tracing To WCF Messages

It sometimes becomes useful to trace messages coming into and out of a WCF service for debugging.  I find when I am doing soap integration's it is especially useful to be able to trace the soap messages for debugging.  The message isn't obviously stored, however there is a trace that you can attach to to get it though the system.diagnostics library.
<system.diagnostics>
  <sources>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
                 <add name="messages"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="c:\logs\messages.svclog" />
          </listeners>
      </source>
    </sources>
</system.diagnostics>

<system.serviceModel>
  <diagnostics>
    <messageLogging 
         logEntireMessage="true" 
         logMalformedMessages="false"
         logMessagesAtServiceLevel="true" 
         logMessagesAtTransportLevel="false"
         maxMessagesToLog="3000"
         maxSizeOfMessageToLog="2000"/>
  </diagnostics>
</system.serviceModel>
Simple enough and now you will have a log file with your requests.

Re-doing a paver path

So I wanted to redo the paver path behind my house.  After I tore the old one out, I only had a few good pavers left and couldn't find matching ones.  Being that my budget was tight on the redo before a family picnic, I decided to rip some 2x4 s into 2x2 and create a frame for the existing pavers to elevate them above the ground and fill the rest in with a washed stone.  I also put the new planter in on the left, but that's a job for another post. 
So first the final product in case you don't want to look any further.  Now how I did it.
I started by laying out the blocks I had and figuring out the gap I needed between each to make my distance.

Once I had this, I started making a frame for the blocks.
I put a little strip of wood under each one to make sure the paver wouldn't work its way through and the wood become elevated around them.  
It was about 20 feet so I made 2 of them that fit together.  I then stained them up to match the deck stain on the house.  It took a few coats, I realize they won't last forever, but it should get me a decade or so, at which point it will probably need to be freshened up again anyways, so a quick fix that I think turned out good.  One last pic after install before the gravel.

Tree House Build

So the kids wanted a tree house, this is what they got.
I know, not exactly a tree house, but its sitting around 200+ year old oaks, and I really didn't feel confident in injuring them at all.  So perhaps elevated playhouse is a better name.  In any effect, here is my build.

I started by clearing the area with my tractor and digging 4 foot post holes, one was only 3 foot when I hit bed rock.  
I put in 8 inch tubes and filled them with cement.  I put a 3/4 lag in the top of each to tie to.

Next I put a post plate on each for a 6x6.
Everything went together good here and the measuring and cross corner checking when I dug the holes really paid off, the entire thing was very square.  Next, I set 2x12 beams (2 on each) on the top of the posts.  I notched the posts to make it super solid and used 3/4 inch lags to hold them together.
From there I was able to build the joists that would be the floor of the playhouse.  I used 14 foot 2x8 with a 3 foot cantilever on all sides.
The top of the deck is now 6 foot off the ground for scale.  Next I decked the front 4 feet for porch and put sheeting down in the back half for the house.  I used all green treated lumber to this point I should mention.  Even the sheeting, which is extremely heavy (3/4 inch 4x8 green treated).
So then I framed up my walls all the way around with openings for the door only.  I didn't have windows to begin so didn't bother framing them in at this point.  I will cut and frame them in as I get them so I have more options for finding used windows.

So next I framed up a loft on the back 60 inches of the house using 2x6 boards.  I doubled up the 2x6 on the front to make a beam that could support the loft.  I used joist hangers to put them all in.  After that I swung joists.

So at this point we have the skeleton and I started sheeting it.  I just used A11 grade siding plywood in 4x8 sheets with galvanized #8 nails.  The walls were all 6 foot 3 so I can walk in without hitting my head so the sheets hang down a bit.

Once that was all in place, I started sheeting the roof with half inch OSB.

This picture has the drip edge on already.  So the final step was putting the metal roof on.  We also put a railing up by pocket screwing 2x4 on the posts that hold the roof up and putting spindles in.  We had created a 2 level playset the year before and moved that to the other side of the tree and build a bridge with some short 2x8.  The entire thing is 14 x 12 with a 10 x 12 playhouse 4x12 deck, and 5x12 loft.  I still need to make a door, frame in windows, fur the edges, and stain the whole thing.  But I will follow that up later.

Pentaho Salesforce Foreign Key Loading

I was tasked with loading data into SalesForce from Pentaho.  There is a built in upsert command to do this, so it should be easy.  And for the most part it was, however, one issue that I came across is using external keys for linking objects in salesforce.  You can simply load values with the upsert, but if you are referencing another object by a key, it isn't straight forward or built well into the UI.  What needs to be done is almost an xslt type reference to the key of the other object.  

In my case, I had loaded all the accounts and needed to load orders.  The orders referenced the account by Account Number, which was a key on our custom account object in Sales Force.  After much trial and error, I was forced to do the following to tie the two together.


In the Module Field (Sales Force Field) I had to reference the object (Account) followed by a colon and then Acct_Number_C/Client_Account_R which the first half is the field on account and after the / is the field on the order object.  Once you do that, the objects are inserted and tied together correctly.

Enjoy!

Simple use of the JQuery TableSorter

I have had quite a few web pages recently that could use a little love in the display of large tables of data.  For one, we wanted paging and sorting of the columns.  This is a common problem, and the JQuery TableSorter makes easy work of doing this on your front end.  Here is what you need to do to make it work.

1. The first thing to do is include the correct JQuery files.  I did this using the Scripts.Render function in MVC.


@Scripts.Render("~/Scripts/jquery.js")
@Scripts.Render("~/Scripts/jquery.tablesorter.js")
@Scripts.Render("~/Scripts/jquery.tablesorter.pager.js")
2. Next, you must give the table containing your results a good name, I used tablesorter as the class name of the table to index from.

<table class="tablesorter" width="100%">

3. Next, make sure the header row is wrapped in a thead tag and each of the header row cells is a th, not a td.

4. Finally, after the table, put the following code in place.  Its a new div that will be the pager for paging and some javascript to set up the table and render it correctly.  I also added a section that does mouse over highlighting of rows since alternating row text isn't available through this technique, or at least that I could find.

<div id="pager">
        <form>
            <img src="@Url.Content("~/Content/images/first.png")" class="first" />
            <img src="@Url.Content("~/Content/images/prev.png")" class="prev" />
            <input type="text" class="pagedisplay" />
            <img src="@Url.Content("~/Content/images/next.png")" class="next" />
            <img src="@Url.Content("~/Content/images/last.png")" class="last" />
            <select class="pagesize">
                <option selected="selected" value="20">20</option>
                <option value="40">40</option>
                <option value="80">80</option>
                <option value="160">160</option>
            </select>
        </form>
    </div>
    </div>
<script type="text/javascript">
    $(function () {
        $("table.tablesorter").tablesorter({ widthFixed: true, sortList: [[0, 0]] })
        .tablesorterPager({ container: $("#pager"), size: $(".pagesize option:selected").val() });
    });
    $('td').mouseover(function () {
        $(this).siblings().css('background-color', '#EAD575');
        $(this).css('background-color', '#EAD575');
    });
    $('td').mouseleave(function () {
        $(this).siblings().css('background-color', '');
        $(this).css('background-color', '');
    });
</script>