Saturday, September 11, 2021

DIY Emergency Meals

DIY Emergency Meals

Once you have collected your emergency meal items, place them in a quart size zip lock bag, date, and store in a cool dry place.

Sunday, April 28, 2019

Get Home Bag

Get Home Bag

This is a bag you may want to keep in your car when commuting to work to give you the best chance of getting home in case of bad weather or other incident that may hinder your normal commute home. 

Always keep enough gas in your car to get home x 2.  Gas stations may not have power to run the gas pumps and you might have to take alternate routes or back track if roads are closed/blocked.

  1. Map with optional routes to get home.   Look for alternate driving routes and hiking routes.
  2. Car Emergency Kit
  3. Extra money/cash.  If you need to get gas and credit card machines are down, cash will get you enough gas to get home. 
  4. Water bottle with water filter.
  5. Backpack with First Aid Kit, Hiking Essentials, and Emergency Meals.  
  6. Hiking shoes.  These should already be broken in to prevent blisters.
  7. Weather appropriate hiking clothing.   Layers are always best.
  8. Self defense items.

Wednesday, December 13, 2017

First Aid Kit Essentials

First Aid Kit Essentials

Wound and Blood Management

Ointments and Wipes

  • Antiseptic wipes to clean wounds before dressing
  • Antibiotic Ointment to prevent bacterial infections
  • Alcohol wipes to disinfect surfaces, tweezers, knives, and scissors
  • Hydrocortisone cream for bug bites
  • Rash cream for chafing
  • Burn cream for minor burns

Medicine

  • Acetaminophen (Tylenol) for pain management
  • Diphenhydramine (Benadryl) to treat pain and itching caused by bug bytes and allergies to animals and poison oak
  • Lip balm for dry or cracked lips
  • Extra medication prescribed by your doctor

Tools

  • Nonlatex gloves
  • Thermometer to check temperature
  • Finger Nail Clippers
  • Tweezers to remove splinters and other objects from skin
  • Knife to cut bandages
  • Scissors to cut bandages
  • Instant cold compress to reduce swelling
  • Emergency Blanket to keep warm
  • 100 feet of paracord
  • Bic lighter to start a fire

Other


Monday, April 10, 2017

Angular CLI - Commands to create an application

 Example Angular CLI commands to create an application.

This example will create a Angular project with a home/landing page and components to list, view, add, and edit contacts.

Example project can be viewed here https://github.com/bespencer1/angular-contacts 


Tuesday, February 7, 2017

What is JSON?

JSON - JavaScript Object Notation

JSON is a lightweight data-interchange format created as an alternative to XML for asynchronous communication between a client and the server providing data.

Benefits of JSON vs. XML

  • lightweight
  • self describing
  • fairly easy to read

How is JSON data structured?

  • Data is stored as key / value pairs
  • Pairs are separated by commas (,)
  • Curly braces ({}) hold objects, set of key / value pairs
  • Square brackets ([]) hold arrays, an ordered collection of values
  • Keys must be a string written with double quotes
  • Values can be any of the following data types
    • String
    • Number
    • Boolean (true/false)
    • Null
    • Date
    • Object
    • Array

Data Type Examples:

String:

{“name”:”Brian Spencer”}

Number:

{“age”: 21}

Boolean:

{“hasKids”:true}

Null:

{“ssn”:null}

Date (ISO 8601 format):

{“dob”:”1996-01-01T04:45:14”}

Object:

{“name”:”Brian Spencer”,”dob”:”1996-01-01T04:45:14”,”age”:21,”ssn”:null}

Array:

{“kids”:[“Lili”,”Alex”,”Ana”]}


What languages can Serialize and Deserialize JSON?

Here are a few languages that either include or have libraries or packages that can be used to serialize and deserialize JSON.

Code example:  Serialize and deserialize JSON using C# and DataContractJsonSerializer

[DataContract(Name="parent")]
public class Parent
{
    //DataMember Name and Order properties allow you to indicate what the name 
    //should be when the property or variable is serialized and what order 
    //the key/values should be in
    [DataMember(Name="name", Order=1)]
    public string Name { get; set; }

    [DataMember(Name = "age", Order=2)]
    public int Age { get; set; }

    [DataMember(Name = "hasKids", Order=4)]
    public bool HasKids { get; set; }

    //Do not serialize this property
    [IgnoreDataMember]
    public DateTime DOB { get; set; }

    [DataMember(Name = "dob", Order=3)]
    private string DOBISO;

    [DataMember(Order=10)]
    public string SSN;

    //Optional:  Do some work when serializing the object
    [OnSerializing]
    public void OnSerializing(StreamingContext context)
    {
        this.DOBISO = this.DOB.ToString("o"); //Convert date string to ISO 8601
    }

    //Optional: Do some work when deserializing the object
    [OnDeserialized]
    public void OnDeserialized(StreamingContext content)
    {
        this.DOB = DateTime.Parse(this.DOBISO);
    }
}
//Create the parent object and populate it's properties
Parent parent = new Parent();
parent.Name = "Brian Spencer";
parent.Age = 21;
parent.DOB = new DateTime(1996, 1, 1);
parent.HasKids = true;

string jsonString = string.Empty; //variable to hold the JSON string

//Create an instances of the DataContractJsonSerializer class
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Parent));

//Create an instance of the MemorySteam class to write the serialized object to
using (MemoryStream mem = new MemoryStream())
{
    //Serialize the parent object to memory
    ser.WriteObject(mem, parent);
    //write the JSON string in memory to the jsonString variable using UTF8 encoding
    jsonString = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
    //Close the memory stream
    mem.Close();
}
Console.WriteLine(jsonString);
//{"name":"Brian Spencer","age":21,"dob":"1996-01-01T00:00:00.0000000","hasKids":true,"SSN":null}

//Convering the JSON back to an object
Parent parentFromJson = (Parent)ser.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(jsonString)));

Monday, February 6, 2017

Return ISO 8601 dates when converting object to JSON using DataContractJsonSerializer

Below is an example of how to return a DataTime value in the ISO 8601 format when serializing an object using DataContractJsonSerializer.

[DataContract]
public class MyObjectWithDate
{
    [IgnoreDataMember]
    public DateTime MyDate { get; set; }

    [DataMember(Name = "mydate")]
    private string MyDateISO;

    [OnSerializing]
    public void OnSerializing(StreamingContext context)
    {
        this.MyDateISO = this.MyDate.ToString("o"); //Convert date string to ISO 8601
    }
}