Saturday, July 13, 2019

Self referencing loop detected for property 'Object' with type 'Castle.Proxies.IServiceContextProxy

When writing unit tests using Moq objects I occasionally get this error:
 Message="Self referencing loop detected for property 'Object' with type 'Castle.Proxies.IServiceContextProxy..."

It happens when JSON is trying to serialize an object that it thinks has a pointer to itself and could create an infinite loop - although in your code it may not be infinite, but JSON doesn't know that.  It's just trying to protect you.

 One way to fix this is to replace the Mock object with real fake object.


Saturday, June 29, 2019

The Most Underrated Wonder of the Ancient World - Obelisks

My daughter and me under Cleopatra's Needle at the Met in New York

  1. Twenty Eight Egyptian obelisks remain standing today.
  2. They are built from a single piece of rock.
  3. The Egyptians did not have iron tools, so it is thought they pounded the granite with heavy dolerate rocks - one of the few things harder than granite.
  4. An army of workers would have had to labor "an infinity of hours" to create one. If a crack were found in the rock during work, the monolith would be abandoned and work started on another site.
  5. Obelisks could be 100 feet tall and weigh 400 tons.
  6. Moving them was tricky, because the granite would crack easily if not properly supported. Stone is great in compression, but weak in tension.
  7. In 37 AD Gaius Caligula ordered an Egyptian obelisk that was already 1800 years old to be moved to Rome. It was 25 meters tall with a base of 8 meters and weighed one million pounds and made of pink granite. It remained standing in Rome for 1500 years.
  8. The end of the Middle Ages.
    The pope ordered the obelisk moved to the center of St. Peter's square. On September 10, 1586 the obelisk was moved by 907 men, 75 horses and 40 cranes.

    No obelisk had been moved for over a thousand years, and the people of 1586 thought they had at last equalled their Roman ancestors . The fact that they had moved the obelisk only a few hundred meters, instead of from across the Mediterranean did not matter - a new age of technology and engineering was dawning. Some historians mark this engineering marvel as the end of the Middle Ages and the beginning of the Renaissance.

    As it looks now:

Tuesday, May 21, 2019

Interview Questions for Older Relatives for Genealogy Research

My Great Grandfather, Pickens Steele Fincher
During my recent Sabbatical from work I have been researching my family tree. I've interviewed some relatives about their lives which has been enlightening. I found a few sites on the web that have questions to ask older relatives. Here's some of my favorite ones:

 https://www.deseretnews.com/article/865595932/Genealogy-150-questions-to-ask-family-members-about-their-lives.html

http://sites.rootsweb.com/~ohlths/interview2.htm

 https://www.thoughtco.com/fifty-questions-for-family-history-interviews-1420705

 If your parents, or grandparents, are still alive ask them some of these questions and record your conversation on your phone. They will be gone before you know it.

You can see more photos about the Fincher clan at https://www.fincher.org/fincher/index.shtml

Tuesday, April 16, 2019

Agile Austin - Why 76% Of Organizations Are Failing At Agile

Why 76% Of Organizations Are Failing At Agile

David Hawks from AgileVelocity.com gave a great presentation to 50 Agilists at Agile Austin this week.

He used an interactive poll from PollEveryWhere.com which was a nice touch, so the audience could vote in real time on a question and we could see the results in a bar chart.

Four phases of change:

1. "Status Quo"

2. "Chaos and Resistance" When we introduce change the process always get worse.

3. "Integration and Practice" is next in which things slowly get better.

4. "New Status Quo" where things are genuinely better.

Four Agile Steps:

  1. Align

    Why are we going to Agile? It's not just to "do" Agile. Goal should be something like improve time to market, improve productivity, make happier customers, and have better quality.

  2. Learn

    Everyone needs to understand Agile.

  3. Predict

    We need to make things predictable before going faster.

  4. Accelerate

    This is where we actually start getting better.

  5. Adapt

    Try new things like Experiment Based Development

David had us do a small task in groups.

Why do so many companies struggle?

Most company think of Agile as a team level problem. Upper management just wants the team level to change, but not anything else. We need to change the System. We need to change the Organization, the leadership needs to understand Agility.

Three Impediments to Successful Agile Transformation

  1. Implementing solutions without clarity in desired results

    This produces:
    Lots of resistance and frustration
    Silo Optimization
    No clear measure of success

    We did another exercise on how the importance of different tasks to transform a culture.

    Steps to Organizational Change

    a. Create Urgency - "We have to get better,
        or our company may go bust."  (Comes for the top level)
    b. Form a powerful coalition
    c. Create a vision for change
    d. Communicate the vision
    e. Empower action
    f. Create quick wins
    g. Build on the change
    h. Anchor wins in culture
    
  2. No mechanism to resolve organizational level cross department impediments
        
    a. Impediments not resolved quickly
    b. Resistance is empowered
    c. Teams hit a ceiling and become disenfranchised
    

    Executives: We totally support agile, but what's the date, and what's the features?

  3. Leaders Not Creating Focus

    If the leaders say all projects are equally important - the teams have no priorities.

    So, the people with the least knowledge of corporate urgency, select the tasks that are coolest, easiest, and whose sponsor screams the loudest.

    Impact:
    a. lots of interruptions
    b. No time to improve
    c. no flow
    d. no ability to forecast
    e. slow time to value
    

David showed us how Agile Velocity evaluates how an Agile transformation is going.

Approach Agile by asking why, get buy in, break into smaller things.

Note to Self: How to Use NUnit with C# .Net in Visual Studio for the Mac

I always forget the three libraries to use NUnit with Visual Studio.
Note to self: Download these from NuGet:
  1. NUnit
  2. Microsoft.NET.Test.Sdk
  3. NUnit3TestAdapter

Then select "Run/Run Unit Tests" and VS will create a runner in the bottom pane.


PS: Latest endpoint to connect Visual Studio to the Nuget.org repository is

https://api.nuget.org/v3/index.json

You can put these directly in the csproj:

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
    <PackageReference Include="NUnit" Version="3.11.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
  </ItemGroup>

Friday, April 12, 2019

Smallest example I could think of using C# Async/Await and HttpClient.GetAsync() with Generics

Smallest example I could think of using HttpClient.GetAsync() with Generics.


using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace AsyncHttpClient
{
    /// <summary>
    /// Tiny example of using HttpClient.GetAsync() with Generics.
    /// Uses the REST API calls from the most excellent mysafeinfo.com for presidents and Beatles albums
    /// This prints:
    /// Requesting presidents
    /// Requesting Beatles albums
    /// ... waiting ...
    /// first president = number: '1','', party: '', term: ''
    /// first Beatles album = album name: 'Please Please Me (Mono)', date: '1963-03-22T00:00:00'
    /// </summary>
    public class President
    {
        public int president;
        public string name, party, term;
        public override string ToString() { return $"number: '{president}','{name}', party: '{party}', term: '{term}'"; }
    }
    public class BeatlesAlbum
    {
        public string album, date;
        public override string ToString() { return $"album name: '{album}', date: '{date}'"; }
    }

    class AsyncHttpClientExample
    {
         private static void Main()
        {
            string presidentsUrl = "https://mysafeinfo.com/api/data?list=presidents&format=json";
            string beatlesUrl = "https://mysafeinfo.com/api/data?list=beatlesalbums&format=json&select=ent,typ,rd&alias=ent=artist,typ=album,rd=date";
            var asyncHttpClientExample = new AsyncHttpClientExample();
            Console.Out.WriteLine("Requesting presidents");
            var presidents = asyncHttpClientExample.GetAsync<List<President>>(presidentsUrl);
            Console.Out.WriteLine("Requesting Beatles albums");
            var albums = asyncHttpClientExample.GetAsync<List<BeatlesAlbum>>(beatlesUrl);
            Console.Out.WriteLine("... waiting ...");
            Console.Out.WriteLine("first president = {0}", presidents.Result[0]);
            Console.Out.WriteLine("first Beatles album = {0}", albums.Result[0]);
        }
        private async Task<T> GetAsync<T>(string url)
        {
            HttpClient client = new HttpClient(new HttpClientHandler());
            HttpResponseMessage response = await client.GetAsync(url).ConfigureAwait(false);
            var jsonString = response.Content.ReadAsStringAsync().Result;
            T result = JsonConvert.DeserializeObject<T>(jsonString);

            return result;
        }
    }
}

Thursday, February 21, 2019

Where to Find Your Tesla "Motor Vehicle Purchase Agreement"

So, you just bought a shiny new Tesla, but where is your "Motor Vehicle Purchase Agreement" (aka "Motor Vehicle Purchase Agreement (MVPA)")?

The FAQ  at Tesla is out of date as of Feb 21, 2019.

You can print it from your Tesla account.
1. Login to www.Tesla.com
2. In the top right-hand corner select "TESLA ACCOUNT" (what's with this ALL-CAPS trend?)
3. Select "Manage"
4. Under the car's picture select "View Details".
5. On the right side, near the bottom by "Motor Vehicle Purchase Agreement" select "View".
6. Your pdf of the "Motor Vehicle Purchase Agreement" will be displayed.

By the way, the tax form to get your $7,500 federal tax rebate is 8936.