Posts

United States Postal Code to State Map

Image
I had a need to determine the State code given a zip code/postal code and could not find a concise list I could use as the base of the map. There is a PDF available on irs.gov, but that doesn't lend itself well to automation.

Using that PDF, I generated this CSV file: https://gist.github.com/aaronhoffman/d7a598efb593e3acf5e0a39c0dd8b52a

There are two different formats depending on your use case. I hope you find it useful!
-Aaron




Newtonsoft Json BaseJsonConverter

Image
I've recently had a need for a custom JsonConverter to read and write data to CosmosDb in a way that utilizes a CosmosDb document's `id` property. (more on that in a later post)

My first step was to investigate a custom Newtonsoft.JsonJsonConverter. I thought that there might be a BaseJsonConverter implementation somewhere in the docs, but I was wrong.

After digging through many different custom converters, I think I've discovered what the most trivial custom converter might look like.

You can find the example here, and customize it further to fit your needs:

https://gist.github.com/aaronhoffman/de40ac508de95101fa41859195728e39


Hope this helps,
Aaron





Complete Project Gutenberg Catalog in JSON

Image
Project Gutenberg is an amazing site containing over 57,000 free ebooks at the time of this writing.



Recently I've been working on a project to create a database of book bibliographies. A database of book references from within other books. You'd be able to answer the query: Show me all the books that reference "Thinking Fast and Slow". I plan to use Project Gutenberg as the repository that I use to create the first version of this database.

Project Gutenberg currently makes their complete project catalog available as a collection of RDF files found here: http://www.gutenberg.org/wiki/Gutenberg:Feeds

RDF is not something I've worked with in the past, so I converted them to JSON files. You can download that set of files from here:

https://sfp.blob.core.windows.net/public/gutenberg_catalog.zip


Hope this helps,
Aaron





ASP.NET Core 2.1 Identity

Image
I thought I'd compile some resources on ASP.NET Core 2.1 Identity. Hope you find these useful:

Database schema of tables that are generated after the first EF Migration:

https://gist.github.com/aaronhoffman/74f4c072afaa0459dcd6595b6380f67d


You can override password rules in the Startup.cs class:

            services.AddDefaultIdentity()
                .AddEntityFrameworkStores();

            services.Configure(options =>
            {
                options.Password.RequireDigit = false;
                options.Password.RequireLowercase = false;
                options.Password.RequireUppercase = false;
                options.Password.RequireNonAlphanumeric = false;
            });


If you are wondering where the AccountController or login pages are (because they do not appear in the solution explorer by default) more info can be found here: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-2.1&tabs=visual-studio



That's it fo…

Programmatically add Other Search Engines to Google Chrome for VSTS Shortcuts

Image
When I'm working with a new repo/project in VSTS, I like to set up shortcuts in Google Chrome to be able to quickly jump to a specific Work Item, PR, Build, or Release based on the ID.

To do this, I take advantage of Chrome's "other search engines" settings.

You can manually add these by specifying a Short Name, a Keyword, and the URL to navigate to when that keyword is typed into the browser's address bar.

Until now, I would manually add these URLs one at a time, but being a lazy developer, I wanted a way to automate this process. I discovered that Chrome uses a SQLite database to store these values, and you can side-load new entries by simply performing a SQL Insert into the `keywords` table of that SQLite database!



You can use the following SQL Script to insert the default set of shortcuts I usually add for each new VSTS project/repo:

https://gist.github.com/aaronhoffman/60660365310b7ff462b547fea9eb605b



Steps to Add:

 1. Ensure all instances of Google Chrome are…