CsvHelper

•August 20, 2019 • Leave a Comment

The NuGET package (CsvHelper) is extremely powerful and incredibly easy to use:

Step 1: Create your .NET object

public class Contact
{
public int ContactId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Address { get; set; }
public string CityStateZipCode { get; set; }
public string PhoneNumber { get; set; }
public DateTime DateOfBirth { get; set; }
public decimal GrossPay { get; set; }
public decimal NetPay { get; set; }
}

Step 2: Get your CSV file

"ContactId","FirstName","LastName","Address","CityStateZipCode","PhoneNumber","DateOfBirth","GrossPay","NetPay"
"1","ERIK","ANDERSON","123 6TH AVE","TACOMA, WA 98406","(360) 337-4443","1/1/1970","125000.00","81250.00"
"2","THOMAS","RYAN","123 BAY ST","PORT ORCHARD, WA 98366","(360) 337-4711","1/1/1990","65000.00","42250.00"
"3","TERESA","IVES","123 OLD BELFAIR HWY","BELFAIR, WA 98528","(360) 337-4467","1/1/1980","82136.00","53388.40"
"4","JOSIAH","SAVAGE","5501 WERNER RD","BREMERTON, WA 98312","(360) 337-4413","1/1/2000","16384.00","10649.60"

Step 3: Read the CSV into a list of objects

public static List<Contact> GetContacts(string csvFileName)
{
using (TextReader txt = new StreamReader(csvFileName))
{
using (var csv = new CsvReader(txt))
{
var contacts = csv.GetRecords<Contact>();
return contacts.ToList();
}
}
}

Bonus: It handles dynamic and anonymous types!

// Dynamic
var records = csv.GetRecords<dynamic>();

// Using anonymous type for the class definition
var anonymousTypeDefinition = {
Id = default(int),
Name = string.Empty,
MyClass = new MyClass()
};

var records = csv.GetRecords(anonymousTypeDefinition);

ref: CSV Parsing In .NET Core – .NET Core Tutorials

Advertisements

Activate Windows Photo Viewer on Windows 10

•August 17, 2019 • Leave a Comment

As I much prefer the Windows Photo Viewer, here’s a guide to activating it on Windows 10 via the helpful folks at How To Geek. All credit goes to them; I’m simply saving it here for my reference.

Step One: Enable Photo Viewer in the Registry

You can use the registry files available from How To Geek or if you don’t trust outside sources, copy and save the following to a UTF-8 registry file (.reg):

Windows Registry Editor Version 5.00

; created by Walter Glenn
; for How-To Geek
; article: https://www.howtogeek.com/225844/how-to-make-windows-photo-viewer-your-default-image-viewer-on-windows-10/

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]
"MuiVerb"="@photoviewer.dll,-3043"

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
00,31,00,00,00

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget]
"Clsid"="{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}"

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print]

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
00,31,00,00,00

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget]
"Clsid"="{60fd46de-f830-4894-a628-6fa81bc0190d}"

With the registry file saved, find it in Windows Explorer, right-click, and select “Merge”.

Step Two: Set Windows Photo Viewer as Your Default Image Viewer

For any image file type (e.g. PNG, GIF, JPG, TIF, etc.), right-click on one of each type, select “Open With >” and pick “Choose Another App”.

In the “How do you want to open this file?” dialog, select “Windows Photo Viewer” and check the “”Always use this app to open files”.

Vintage Apple Software Repositories

•May 6, 2019 • 1 Comment

A summary from Where to Find & Download Old Mac OS Software

Boot PPC PowerMac from USB

•April 27, 2019 • Leave a Comment

First, familiarize yourself with the following articles:

Now for the fun part:

  1. Have a USB thumb drive handy (I successfully used 512MB, 1GB, 2GB drives)
  2. Download and unzip the 9.2.2 Boot Kit (the resulting file will have a .toast file extension)
  3. Download and unzip HDD Raw Copy Tool
  4. Use HDD Raw Copy Tool to write the Toast file to the USB thumb drive
  5. Turn on the Mac and immediately hold down <Command><Option><O><F> until you see the white Open Firmware screen
  6. Type “boot usb0/disk@1:,\\:tbxi” (without the double-quotes) and press <Enter>

(Be aware you may need to change the port number of the USB device depending on the Mac model and which port the USB thumb drive is plugged into.)

  1. Voila!

Installing Google Chrome for All Users

•December 26, 2018 • Leave a Comment

I find myself repeatedly looking this up so here’s my own link:

Google Chrome for All Users (Windows x64)

Or if you prefer the offline installer, look for “Chrome MSI for Windows 64‑bit” on the Enterprise page.

 

Mac OS X Software I Install

•October 3, 2018 • Leave a Comment

Mac OS X Lineage

•February 6, 2018 • Leave a Comment

 

Version Name Released Platform Kernel
10.14 Mojave September 24, 2018 x86-64 64-bit
10.13 High Sierra September 25, 2017 x86-64 64-bit
10.12 Sierra September 20, 2016 x86-64 64-bit
10.11 El Capitan September 30, 2015 x86-64 64-bit
10.10 Yosemite October 16, 2014 x86-64 64-bit
10.9 Mavericks October 22, 2013 x86-64 64-bit
10.8 Mountain Lion July 25, 2012 x86-64 64-bit
10.7 Lion July 20, 2011 x86-64 64-bit, 32-bit
10.6 Snow Leopard August 28, 2009 IA-32, x86-64 64-bit, 32-bit
10.5 Leopard October 26, 2007 IA-32, x86-64, PowerPC 64-bit, 32-bit
10.4 Tiger April 29, 2005 IA-32, x86-64, PowerPC 64-bit, 32-bit
10.3 Panther October 24, 2003 PowerPC 32-bit
10.2 Jaguar August 23, 2002 PowerPC 32-bit
10.1 Puma September 25, 2001 PowerPC 32-bit
10.0 Cheetah March 24, 2001 PowerPC 32-bit
9.0 Mac OS 9 October 23, 1999 PowerPC 32-bit
8.5 Mac OS 8.5 October 17, 1998 PowerPC 32-bit
8.0 Mac OS 8 July 26, 1997 Motorola 68K, PowerPC 32-bit
7.6 Mac OS 7.6 January 1997 Motorola 68K, PowerPC 32-bit
7.1.2 System 7 Motorola 68K, PowerPC 24-bit, 32-bit
7.0 System 7 May 13, 1991 Motorola 68K 24-bit, 32-bit
6.0 System Software 6 April 1988 Motorola 68K 24-bit
5.0 System Software 5 October 1987 Motorola 68K 24-bit
4.0 System Software 2.0 January 1987 Motorola 68K 24-bit
3.2 System Software 1.1 June 1986 Motorola 68K 24-bit
3.1 System Software 1.0 February 1986 Motorola 68K 24-bit
3.0 Macintosh System Software January 1986 Motorola 68K 24-bit
2.0 Macintosh System Software April 1985 Motorola 68K 24-bit
1.0 Macintosh System Software January 24, 1984 Motorola 68K 24-bit