Raspberry Pi: Quick Setup

Raspberry Pi 3 Setup
(Targeted for MCM Starter Kit)

  1. There is a setup card in the box.  On one side, setup instructions are fairly clear.  On the other side, there is a link to download PDF instruction manual.  It might be a good idea to download the PDF on your regular PC so that you can refer to it during setup.  Mainly, chapters 1-5
  2. The SD card that comes with the MCM kit is pre-formatted with the operating system (OS). Place this pre-formatted SD micro card into RPi.  This must be in the RPi to boot it up.  
  3. Once everything is up and running, you should have a toolbar at the top of the screen.  On the toolbar, navigate to the Raspberry icon and go into “Preferences” to set time, country, etc.
  4. Next, you will want to get the latest updates:
    1. Click to open up the terminal window and then type the following to update the OS:
      1. sudo apt-get update
      2. sudo apt-get upgrade
    2. Reboot system by going into pi icon –> “Reboot”
  5. The most important part now is to explore and play!

NOTE:  The SD card can be kept in your RPi.  It is safe to update the Rasbian OS frequently as it tends to be stable.  You can also create other SD card variants for different operating systems, special projects, etc.

Installation Help:
https://www.raspberrypi.org/documentation/installation/

http://www.mcmelectronics.com/content/en-US/raspberry-pi-user-guide

.NET : Adding custom ASP.NET WebApi Help Page

1.  Add annotations to model, controller, etc. using System.ComponentModel.DataAnnotations
2.  Navigate to project “Properties” –> “Build” –> Output
3.  Check “XML Documentation file:”, then type in a name for the help document xml, and save
4.  In the solution, navigate to “Areas” –> “App_Start” –> “HelpPageConfig.cs”
5.  Uncomment the “config.SetDocumentationProvider…” line, add your created name for the help document xml, and save:
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath(“~/App_Data/DevOpsTaskHelp.XML”)));
6.  Build solution, navigate to help page “API”, and your annotations should be present.

Adding XML WebApi Comments To Swagger:
1.  Install-Package “Swashbuckle”
2.  Open the “SwaggerConfig.cs” file and uncomment the following line:
c.IncludeXmlComments(GetXmlCommentsPath());
3.  Generate method for “GetXmlCommentsPath()”
private static string GetXmlCommentsPath()
        {
            return System.String.Format(@”{0}binDevOpsTaskHelp.XML”, System.AppDomain.CurrentDomain.BaseDirectory);
        }

REFERENCE(S):
https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages
https://blogs.msdn.microsoft.com/yaohuang1/2012/09/30/asp-net-web-api-help-page-part-1-basic-help-page-customizations/

.NET: Customize Builds Per Environment

Two Options:
1.  Web.Config Transformations
https://msdn.microsoft.com/en-us/library/dd465326.aspx
2.  Deployment Parameters:  Useful when you have to create a package without knowing some of the values that will be needed when the package is installed.
https://msdn.microsoft.com/en-us/library/ff398068.aspx

Web.Config Transform:
1. Open Build –> Configuration Manager
2. Create new “Active solution configuration” for each version you need and then close.
3. Navigate to Solution Explorer and right-click on your web.config and select “Add Config Transform.”  This should generate the new config files you created in Configuration Manager.
4. Open the transform file for the build configuration that you want to work with.

Further Reference:
https://code.msdn.microsoft.com/ASPNET-Web-Deployment-c2d409f9

.NET: Debugging A Windows Service

1. Navigate to the windows service project.
2. From toolbar, select Project –> Properties
3. Set “Output type:” dropdown to “Console Application”
4. Open Program.cs, locate Main method, and add the following:

       static void Main(string[] args)
        {
            //to test and debug
            if (Environment.UserInteractive)
            {
                YourWinService serviceHb = new YourWinService(args);
                serviceHb.TestStartupAndStop(args);
            }
            else
            {
                var servicesToRun = new ServiceBase[]
            {
                new YourWinService(args)
            };
                ServiceBase.Run(servicesToRun);
            }
        }

5. Navigate to your service code and add the following method:

         internal void TestStartupAndStop(string[] args)
        {
            this.OnStart(args);
            Console.ReadLine();
            this.OnStop();
        }

6. Set breakpoints and run as console app.