<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jamie Nordmeyer on Medium]]></title>
        <description><![CDATA[Stories by Jamie Nordmeyer on Medium]]></description>
        <link>https://medium.com/@jamienordmeyer?source=rss-f67b92f8be4e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*_4nizaVyHtBHCjmQeKSYZA.jpeg</url>
            <title>Stories by Jamie Nordmeyer on Medium</title>
            <link>https://medium.com/@jamienordmeyer?source=rss-f67b92f8be4e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:38:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jamienordmeyer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Moved Blog to Astro]]></title>
            <link>https://jamienordmeyer.medium.com/moved-blog-to-astro-76e81882e190?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/76e81882e190</guid>
            <category><![CDATA[general]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Sun, 05 Apr 2026 23:53:35 GMT</pubDate>
            <atom:updated>2026-04-05T23:53:35.484Z</atom:updated>
            <content:encoded><![CDATA[<p>Published April 5, 2026 by Jamie Nordmeyer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jITOoKuEYi0kCfID9GeO3A.jpeg" /></figure><p>After years of running my blog on WordPress, I finally decided that I’ve had enough of the constant maintenance of the WordPress backend. There were constant updates, and the supposedly “one-click” updates never worked. I was constantly having to connect to the backend with an FTP client to manually backup the site and database, apply the updates downloaded in a zip file, then verify that I hadn’t messed anything up. This is “just” a blog, not an e-commerce site pushing through millions of dollars in transactions, so using WordPress was just not worth the hassle. In addition, my hosting provider for hosting my blog was quite expensive for just a blog.</p><p>I started looking for alternatives to how I might move my blog out of WordPress, and host it somewhere cheaper. After chatting with a coworker about this, he mentioned both Astro and Github Pages as potential options. I’ve heard of both of these before, but I hadn’t really looked into them. I’m glad that I finally did! Astro is a static site generator (by default), so it creates static files that can be hosted from S3, Azure Blob Storage, or Github Pages. You write content using Markdown files that are then compiled into static HTML. No backend is required since everything is compiled and shipped with the site when deployed. This DOES mean that, at least for now, there won’t be a comment system in the blog. When I have time later on, I’ll look into adding a 3rd party comment system, which will allow me to continue to using static files while offloading the comment system to a 3rd party provider.</p><p>Since I already have a longtime Github account, and they make it really easy to push a site into Pages, I decided to go with that for hosting. Deployment is simple; you just use a Github Action file to tell Github how to build and deploy the site. The Astro documentation even provides a great sample Action file to get you started <a href="https://docs.astro.build/en/guides/deploy/github/">here</a>.</p><p>This was also a really awesome use case for AI. I was able to use Github Copilot to point at my original blog location, and starting with an empty Astro project, migrate all of my styles and content into Astro. Astro is very new to me, with my own web development experience being with React, Vue, Angular, and vanilla JavaScript, so letting Copilot work through most of the conversion made this migration ridiculously easy.</p><p>Also, being a total space nerd, I was beyond stoked watching the launch of Artemis II, and I can’t wait to see the pictures that they send back when they reach their slingshot around the moon! Considering that this post will be about my moving my blog to Astro… it seemed like the perfect image to use for this post! Good luck Artemis crew! Make it home safe!!!</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2026/04/05/moved-blog-to-astro/"><em>https://jamienordmeyer.net</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76e81882e190" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open Source Project Updates]]></title>
            <link>https://jamienordmeyer.medium.com/open-source-project-updates-39aa5914f4ed?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/39aa5914f4ed</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 23:13:12 GMT</pubDate>
            <atom:updated>2024-03-03T23:18:57.584Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*agiTGPiCysrzoN8-.png" /></figure><p>I’ve updated two of my open-source projects for those who might care, moving them both up to .NET 8.</p><p>The first is the dotnet GUID tool, which is documented <a href="https://dev.to/nordyj/net-global-clis-1ef4">here</a> and found <a href="https://github.com/StaticSphere/guid-cli">here</a> on Github. There were no changes made to this project other than to update it to .NET 8.</p><p>The second is the Clean Architecture solution template for dotnet new. This is documented <a href="https://dev.to/nordyj/clean-architecture-solution-template-4i6k">here</a> and found <a href="https://github.com/StaticSphere/clean-architecture-dotnet-template">here</a> on Github.</p><p>Neither release changed functionality, and the code was only changed in the Clean Architecture solution to remove a couple warnings related to the move to .NET 8. Both projects also had their Nuget package dependencies updated to latest and greatest at the time of their most recent commits.</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/"><em>https://jamienordmeyer.net</em></a><em> on March 3, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39aa5914f4ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Angular Signals for Global State]]></title>
            <link>https://jamienordmeyer.medium.com/using-angular-signals-for-global-state-2eb51463fab2?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2eb51463fab2</guid>
            <category><![CDATA[angular-signals]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Sat, 29 Jul 2023 00:00:30 GMT</pubDate>
            <atom:updated>2023-07-29T21:22:41.962Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wiluuDXmOLKZ8OA3.jpg" /></figure><p>With the release of Angular 16 we got access to the new <a href="https://angular.io/guide/signals">Signals API</a>, along with a host of other features. They are currently in developer preview meaning that they could technically change between now and the next release of Angular. However, you can use them now, and they provide a much cleaner way to have reactive code in your web application. They DO not replace RxJS Observables; Angular services like <a href="https://angular.io/api/common/http/HttpClient">HttpClient</a> and <a href="https://angular.io/api/router/ResolveFn">resolvers</a> still rely on RxJS. However, they do provide another tool in the box for responding to changes in your application that are often easier to understand than the RxJS alternative.</p><h3>Code With RxJS</h3><p>In an application that I’m working on, before Angular 16 shipped, I was using a custom StoreService to hold global application state. I&#39;ve tried libraries like <a href="https://ngrx.io/">NgRx</a> and Akita to manage global state, but found them to be way too heavy-handed for what I wanted (not saying ANYTHING negative towards these libraries; not every tool is right for every job, and the authors of these libraries would probably be the first to tell you that). This custom StoreService was created using RxJS, and looked like this:</p><pre>import { Injectable } from &#39;@angular/core&#39;;<br>import { ApplicationState } from &#39;@shared/models&#39;;<br>import { UserCard } from &#39;@shared/models&#39;;<br>import { BehaviorSubject, map } from &#39;rxjs&#39;;<br><br>const initialState: ApplicationState = {<br>  userCard: null,<br>};<br><br>@Injectable({<br>  providedIn: &#39;root&#39;,<br>})<br>export class StoreService {<br>  private readonly store$ = new BehaviorSubject&lt;ApplicationState&gt;(initialState);<br>  readonly userCard$ = this.store$.pipe(map((state) =&gt; state.userCard));<br><br>  setUserCard(userCard: UserCard | null) {<br>    this.store$.next({<br>      ...this.store$.value,<br>      userCard: userCard,<br>    });<br>  }<br>}</pre><p>Here, the UserCard interface represents the basic details of the logged-in user, things like name and data points for putting together a URL to their Avatar image. When I wanted to retrieve the user card for the logged-in user, a service would be used:</p><pre>import { Inject, Injectable } from &#39;@angular/core&#39;;<br>import { HttpClient } from &#39;@angular/common/http&#39;;<br>import { catchError, mergeMap, Observable, of, tap } from &#39;rxjs&#39;;<br>import { StoreService } from &#39;@shared/services&#39;;<br>import { UserCard } from &#39;@shared/models&#39;;<br><br>@Injectable({<br>  providedIn: &#39;root&#39;,<br>})<br>export class UserCardService {<br>  constructor(<br>    private http: HttpClient,<br>    private storeService: StoreService,<br>    @Inject(&#39;API_BASE_URL&#39;) private baseUrl: string<br>  ) {}<br><br>  getUserCard(): Observable&lt;UserCard | null&gt; {<br>    return this.storeService.userCard$.pipe(<br>      mergeMap((existingUserCard) =&gt;<br>        existingUserCard<br>          ? of(existingUserCard)<br>          : this.http.get&lt;UserCard&gt;(`${this.baseUrl}v1/users/user-card`).pipe(<br>              tap((userCard) =&gt; this.storeService.setUserCard(userCard)),<br>              catchError(() =&gt; {<br>                this.storeService.setUserCard(null);<br>                return of(null);<br>              })<br>            )<br>      )<br>    );<br>  }<br>}</pre><p>In the getUserCard method on this service, I first check to see if the StoreService has a previously loaded UserCard instance. If it does, I just return that. However, if the StoreService does not, it will make an HTPP call to retrieve the user card from the server, store that in the StoreService, and then return the user card.</p><p>For the component that displays the user card data, I would expose properties like this as public properties on the component:</p><pre>  get avatarUrl$(): Observable&lt;string | null&gt; {<br>    return this.storeService.userCard$.pipe(<br>      map((uc) =&gt;<br>        uc?.avatarVersionKey &amp;&amp; uc.avatarVersionKey !== 0<br>          ? `${this.apiBaseUrl}v1/users/${uc?.uniqueKey}/avatar?size=64&amp;v=${uc?.avatarVersionKey}`<br>          : `/assets/images/avatar_small.png`<br>      )<br>    );<br>  }<br><br>  get userFullName$(): Observable&lt;string | null&gt; {<br>    return this.storeService.userCard$.pipe(<br>      map((siu) =&gt; (siu ? `${siu.givenName} ${siu.surName}` : &#39;&#39;))<br>    );<br>  }</pre><p>Then in the HTML I need to use the async pipe to get the values out:</p><pre>&lt;span class=&quot;name&quot;&gt;{{ userFullName$ | async }}&lt;/span&gt;</pre><h3>Coding With Signals</h3><p>This of course works, and it’s what we’ve been doing for years in Angular. However, now that Signals have arrived, this code can be greatly simplified. Let’s start with the Signals-based implementation of the StoreService class.</p><pre>import { Injectable, computed, signal } from &#39;@angular/core&#39;;<br>import { ApplicationState } from &#39;@shared/models&#39;;<br>import { UserCard } from &#39;@shared/models&#39;;<br><br>const initialState: ApplicationState = {<br>  userCard: null,<br>};<br><br>@Injectable({<br>  providedIn: &#39;root&#39;,<br>})<br>export class StoreService {<br>  private readonly _store = signal(initialState);<br>  readonly userCard = computed(() =&gt; this._store().userCard);<br><br>  setUserCard(userCard: UserCard | null) {<br>    this._store.update((s) =&gt; ({ ...s, userCard: userCard }));<br>  }<br>}</pre><p>So far, it’s not a ton smaller or simplified from the RxJS version. Instead of a BehaviorSubject instance, I&#39;m using a signal. The initial state is still being passed in to initialize the signal. I then define the userCard value to be a computed value. This creates a new signal, based on the _store signal in this case, that will automatically notify all of its listeners whenever the _store signal is updated, and return just the UserCard instance.</p><p>When calling setUserCard, I don&#39;t need to call a next$ method. Calling next$ is an RxJS thing, and at least for me, it&#39;s counter-intuitive. You have to remember that Observable is a stream of events and then next$ makes sense. However, with signals, I&#39;m calling update, which feels more natural. The update method passes the current value of the signal to an arrow function, which I&#39;m then spreading into a new object, and replacing the userCard value with the new UserCard. Currently, my state ONLY has the UserCard field, but as it starts to expand to hold other global state, then this becomes more useful.</p><p>The real “Oh…” moment for the cleanliness of the code for me comes in the new implementation of the UserCardService class:</p><pre>import { Inject, Injectable } from &#39;@angular/core&#39;;<br>import { HttpClient } from &#39;@angular/common/http&#39;;<br>import { catchError, Observable, of, tap } from &#39;rxjs&#39;;<br>import { StoreService } from &#39;@shared/services&#39;;<br>import { UserCard } from &#39;@shared/models&#39;;<br><br>@Injectable({<br>  providedIn: &#39;root&#39;,<br>})<br>export class UserCardService {<br>  constructor(<br>    private http: HttpClient,<br>    private storeService: StoreService,<br>    @Inject(&#39;API_BASE_URL&#39;) private baseUrl: string<br>  ) {}<br><br>  getUserCard(): Observable&lt;UserCard | null&gt; {<br>    const uc = this.storeService.userCard();<br>    if (uc) return of(uc);<br><br>    return this.http.get&lt;UserCard&gt;(`${this.baseUrl}v1/users/user-card`).pipe(<br>      tap((userCard) =&gt; this.storeService.setUserCard(userCard)),<br>      catchError(() =&gt; {<br>        this.storeService.setUserCard(null);<br>        return of(null);<br>      })<br>    );<br>  }<br>}</pre><p>The getUserCard method still returns an Observable, as the resolver consuming it wants an observable. However, the implementation is much easier to understand in my opinion. I can execute the userCard method off the StoreService to get the current user card if there is one, and because it&#39;s just a method, not an RxJS Observable, I can just return it straight away if I already have it; no need for mergeMap. I then call the HTTP endpoint like before, and add the user card to the StoreService.</p><p>The component fields are also greatly simplified (it’s really nice not having to use the RxJS pipe function):</p><pre>  avatarUrl = computed(() =&gt; {<br>    const uc = this.storeService.userCard();<br>    return uc?.avatarVersionKey &amp;&amp; uc.avatarVersionKey !== 0<br>      ? `${this.apiBaseUrl}v1/users/${uc?.uniqueKey}/avatar?size=64&amp;v=${uc?.avatarVersionKey}`<br>      : `/assets/images/avatar_small.png`;<br>  });<br><br>  userFullName = computed(() =&gt; {<br>    const uc = this.storeService.userCard();<br>    return uc ? `${uc.givenName} ${uc.surName}` : &#39;&#39;;<br>  });</pre><p>And now, in the HTML, we no longer need the async pipe. Instead, since each of these properties are signals, we access them like methods in the HTML:</p><pre>&lt;span class=&quot;name&quot;&gt;{{ userFullName() }}&lt;/span&gt;</pre><h3>Final Thoughts</h3><p>I really like the new Signals API, and am looking forward to seeing where else the Angular team takes it. Will the HttpClient class eventually use Signals (maybe via a new class called HttpSignalsClient to maintain backward compatibility)? Will there be new constructs for our HTML templates that are Signals aware? Only time will tell. But so far, I really like what I&#39;m seeing.</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2023/07/29/using-angular-signals-for-global-state/"><em>https://jamienordmeyer.net</em></a><em> on July 29, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2eb51463fab2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Developer — Associate]]></title>
            <link>https://jamienordmeyer.medium.com/aws-certified-developer-associate-12dc1090d169?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/12dc1090d169</guid>
            <category><![CDATA[aws-certification]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Sat, 13 May 2023 00:00:08 GMT</pubDate>
            <atom:updated>2023-05-13T21:12:07.731Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Certified Developer — Associate</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/0*NiBiexc9uremrNJq.png" /></figure><p>And that’s two down! Last September (2022), I received my AWS Certified Solutions Architect — Associate certification. This last Wednesday, (5/10/2023), I received my AWS Certified Developer — Associate certification. Humorously, I thought that this exam was actually harder than the Solutions Architect exam… yet I scored higher on this exam than the first one. I’m guessing that it’s because going into the Developer exam, I already had the experience, and knew what to expect, whereas my exam for the Solutions Architect certification was the first AWS exam that I’d ever taken. Alas. It’s out of the way now. 🙂</p><p>I don’t currently care about getting any additional certifications at this point. So, I have a good 2 years or so before I need to start worrying about studying again. Woot!</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2023/05/13/aws-certified-developer-associate/"><em>https://jamienordmeyer.net</em></a><em> on May 13, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12dc1090d169" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unit Testing a Custom Angular Title Strategy]]></title>
            <link>https://jamienordmeyer.medium.com/unit-testing-a-custom-angular-title-strategy-64d05f3d401f?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/64d05f3d401f</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[unit-testing]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Sun, 05 Mar 2023 00:00:37 GMT</pubDate>
            <atom:updated>2023-03-06T00:30:10.638Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BG8EzDAbAfv7MQUj1cfSSQ.jpeg" /></figure><p>I’ve been trying to figure this out for a while but couldn’t find any good resources online on how to unit test a custom Angular Title Strategy (the TitleStrategy abstract base class was introduced in Angular 14). As a result, I left it largely untested in my project for a while. Fortunately, the implementation is simple, but I still felt “naked” not having it tested. I finally managed to find the time to dig through the Angular source code and found the documentation on how the Angular team themselves are doing this. You can the Github link here: <a href="https://github.com/angular/angular/blob/c0c7efaf7c8a53c1a6f137aac960757cc804f263/packages/router/test/page_title_strategy_spec.ts">angular/page_title_strategy_spec.ts at c0c7efaf7c8a53c1a6f137aac960757cc804f263 · angular/angular (github.com)</a></p><p>Again, the implementation for my title strategy is extremely simple:</p><pre>import { Injectable } from &quot;@angular/core&quot;;<br>import { Title } from &quot;@angular/platform-browser&quot;;<br>import { RouterStateSnapshot, TitleStrategy } from &quot;@angular/router&quot;;<br><br>@Injectable()<br>export class AppTitleStrategy extends TitleStrategy {<br>  constructor(private readonly title: Title) {<br>    super();<br>  }<br><br>  updateTitle(routerState: RouterStateSnapshot): void {<br>    const title = this.buildTitle(routerState);<br>    this.title.setTitle(`My Application${ !!title ? &#39; - &#39; + title : &#39;&#39; }`);<br>  }<br>}</pre><p>All this does is set the page title to “My Application” (name changed to protect my work…), or to “My Application — Route Title” as the user navigates around the application. Simple. But how do I test it? Trying to mock up the RouterStateSnapshot wasn’t getting me anywhere.</p><p>After digging through the Github site for Angular itself, I realized that the trick was to NOT try mocking the RouterStateSnapshop, but instead, get a reference to the injected Router and Document instances, emulate a routing event, then check the document title. To do this, you need to pass the result of both the providerLocationMocks and providerRouter methods from the @angular/common/testing and @angular/router modules respectively during the configureTestingModulecall, then in each test, call router.resetConfig to emulate a route event. Here is my testing implementation:</p><pre>import { fakeAsync, TestBed, tick } from &#39;@angular/core/testing&#39;;<br>import { provideLocationMocks } from &#39;@angular/common/testing&#39;;<br>import { provideRouter, Router, TitleStrategy } from &#39;@angular/router&#39;;<br>import { DOCUMENT } from &#39;@angular/common&#39;;<br>import { Component } from &#39;@angular/core&#39;;<br>import { AppTitleStrategy } from &#39;./app-title-strategy.service&#39;;<br><br>describe(&#39;AppTitleStrategyService&#39;, () =&gt; {<br>  let router: Router;<br>  let document: Document;<br><br>  beforeEach(() =&gt; {<br>    TestBed.configureTestingModule({<br>      providers: [<br>        provideLocationMocks(),<br>        provideRouter([]),<br>        {<br>          provide: TitleStrategy,<br>          useClass: AppTitleStrategy,<br>        },<br>      ],<br>    });<br><br>    router = TestBed.inject(Router);<br>    document = TestBed.inject(DOCUMENT);<br>  });<br><br>  it(&#39;should set page title correctly when title is not provided&#39;, fakeAsync(() =&gt; {<br>    router.resetConfig([<br>      {<br>        path: &#39;home&#39;,<br>        component: TestComponent<br>      }<br>    ]);<br><br>    router.navigateByUrl(&#39;/home&#39;);<br>    tick();<br>    expect(document.title).toBe(&#39;My Application&#39;);<br>  }));<br><br>  it(&#39;should set page title correctly when title is empty string&#39;, fakeAsync(() =&gt; {<br>    router.resetConfig([<br>      {<br>        path: &#39;home&#39;,<br>        title: &#39;&#39;,<br>        component: TestComponent<br>      }<br>    ]);<br><br>    router.navigateByUrl(&#39;/home&#39;);<br>    tick();<br>    expect(document.title).toBe(&#39;My Application&#39;);<br>  }));<br><br>  it(&#39;should set page title correctly when title is provided&#39;, fakeAsync(() =&gt; {<br>    router.resetConfig([<br>      {<br>        path: &#39;home&#39;,<br>        title: &#39;Home&#39;,<br>        component: TestComponent<br>      }<br>    ]);<br><br>    router.navigateByUrl(&#39;/home&#39;);<br>    tick();<br>    expect(document.title).toBe(&#39;My Application - Home&#39;);<br>  }));<br>});<br><br>@Component({template: &#39;&#39;})<br>export class TestComponent {<br>}</pre><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2023/03/05/unit-testing-a-custom-angular-title-strategy/"><em>https://jamienordmeyer.net</em></a><em> on March 5, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64d05f3d401f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Little WSL Things]]></title>
            <link>https://jamienordmeyer.medium.com/little-wsl-things-b4d3395c5d8?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4d3395c5d8</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[vscode]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Mon, 26 Sep 2022 00:00:04 GMT</pubDate>
            <atom:updated>2022-09-27T01:32:23.418Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lvrdg_Eb1jgxc8c5.jpg" /></figure><p>I just rebuilt my personal laptop and was trying to remember how I’d set up WSL the last time so that I could develop within WSL. However, there were a couple of items that I had NOT done last time, and I was determined to figure out how to make them work this time around.</p><h3>Setting up the ASP.NET Developer Certificate</h3><p>First, I wanted to have a valid development certificate set up so that when I run my ASP.NET 6 API, it would show as a valid certificate in the browser. Before my rebuild, this wasn’t working; the API was working fine. However, the browser always showed the site as being insecure.</p><p>It looks like .NET 6 automatically sets up the ASP.NET developer certificate when it installs. When I ran the dotnet dev-certs commands to create the certificate, it said that the certificate already existed. And sure enough, when I navigate to /usr/local/share/ca-certificates/aspnet (I&#39;m using the Ubuntu WSL install), I can see the https.crt and https.pfx files. However, when I launch the API and get the Swagger page, the site still shows as unsecured.</p><p>What I ended up doing is opening the Windows Certificate Manager outside of WSL and installed the certificate from there. You can open the Start Menu, then search for Manage User Certificates. Once that&#39;s open, navigate to Trusted Root Certification Authorities / Certificates. You will then want to right-click on the Certificates node, select All Tasks from the menu, then Import.... On the screen asking you where the certificate is that you want to import, navigate to \\wsl.localhost\Ubuntu\usr\local\share\ca-certificates\aspnet, and import the https.crt file.</p><p>In my case, I had to reboot my computer at this point. I’m not sure if there’s a way to refresh everything without rebooting the machine, but whatever. This worked for me, and launching the API now shows that the site is secured.</p><h3>Ensuring That the Postgres Service is Running on WSL Startup</h3><p>I didn’t want to have to keep manually starting the Postgres service every time I restarted my computer, so I went looking to see if there was a way to have it launch automatically at least when I first open a WSL terminal so that it’s up and running before I type code .. I found the answer <a href="https://www.wanzul.net/2021/07/03/making-postgresql-run-on-first-start-of-wsl-2-terminal/">here</a>, by Wan Zulkarnain, and give full credit to the original poster. I replicate it here for my own use, and just in case that site is ever shut down.</p><p>First, I added this code to my ~/.bashrc file:</p><pre>if ! pgrep -x &quot;postgres&quot; &gt;/dev/null; then sudo pg_ctlcluster 12 main start echo &quot;postgres service started using: sudo pg_ctlcluster 12 main start&quot; fi</pre><p>I then created an sudoers file called skip_sudo_pg to make it so I didn&#39;t need to enter the password on each start-up of WSL. In that file, I added the following one-liner:</p><pre>%sudo ALL=(ALL) NOPASSWD:/usr/bin/pg_ctlcluster</pre><p>After stopping WSL and reopening a new terminal window, it successfully started up Postgres for me without me needing to manually do it.</p><p>It’s the little things that you come to appreciate… 😉</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2022/09/26/little-wsl-things/"><em>https://jamienordmeyer.net</em></a><em> on September 26, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4d3395c5d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Certified Solution Architect — Associate]]></title>
            <link>https://jamienordmeyer.medium.com/aws-certified-solution-architect-associate-4af3a0e1da35?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4af3a0e1da35</guid>
            <category><![CDATA[certification]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Fri, 16 Sep 2022 00:00:55 GMT</pubDate>
            <atom:updated>2022-09-17T00:20:34.596Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Certified Solution Architect — Associate</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/0*fJ-zEQQal8TuMlDe.png" /></figure><p>Woot! This last Wednesday, September 14th, 2022, I finally picked up the first of two AWS certifications that I plan on getting, which is the Certified Solution Architect — Associate certification. It was a fairly difficult 2-hour exam. I know the material pretty well, but for anyone that has taken the SAT tests here in the U.S., the questions were very similar to those on an SAT. Many of the questions would have 2 answers that were both TECHNICALLY correct, but one was, naturally, MORE correct.</p><p>For anyone studying to take this exam or any of the other AWS exams, you owe it to yourself to take AT LEAST 2 practice exams prior to taking the actual exam. Running through these practice exams ABSOLUTELY helped me prepare for the real thing. Even then, I honestly wasn’t completely prepared. There were a couple questions that were about topics that my training material did not cover, and as much as I hate to admit to it, I had to make an educated guess on. So definitely… take those practice exams!</p><p>Next up for me will be 2 or 3 weeks of a break from studying, then moving on to studying for the Certified Developer — Associate exam. The recommendation that I’ve heard from both my training site and other folks that already have these certifications is to get one shortly after the other since there is a lot of overlap. I’ll target spring of 2023 for getting the Developer cert.</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2022/09/16/aws-certified-solution-architect-associate/"><em>https://jamienordmeyer.net</em></a><em> on September 16, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4af3a0e1da35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Whaddaya Mean “System.Object” Is Not Defined?!?]]></title>
            <link>https://jamienordmeyer.medium.com/whaddaya-mean-system-object-is-not-defined-1bcf11c0987a?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bcf11c0987a</guid>
            <category><![CDATA[visual-studio]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Sun, 31 Jul 2022 00:00:18 GMT</pubDate>
            <atom:updated>2022-08-01T03:35:47.756Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HO_NM_VUZiwNZy7seUPRIA.jpeg" /></figure><p>Every once in a blue moon or two, Visual Studio can get itself into a bizarre state where it’s not resolving the most basic types, like System.Object. You&#39;ve confirmed that you&#39;re referencing the latest version of .NET or .NET Core, you&#39;ve cleaned and rebuilt your solution, and you&#39;ve even rebooted your computer... all to no avail. What gives?!? Visual Studio ends up looking something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*Ib6tqktaL2CkhArz.png" /></figure><p>Wait… what? “Predefined type ‘System.Object’ is not defined or imported”?!? This is purely a designer thing. If you try to build and/or run the solution, everything works (so long as you don’t have any genuine compiler errors, naturally…)</p><p>Well, I’m not entirely sure what is getting copied into the obj and/or bin folders that would specifically cause this, but when you do a Clean (either with dotnet clean, or via the Clean Solution menu command), there are things that aren&#39;t removed that are apparently causing this issue. If someone knows exactly what is doing this, I&#39;d love to know! Either way, the fix is to delete both the obj and bin folders for each project in the solution that is affected by this issue.</p><p>Once you do that, you’ll notice that they get dropped back in almost immediately IF you have the solution open in Visual Studio when you delete them. Once the new obj and bin folders are created, Visual Studio should visually clean up, and the System.Object errors will go away. Woot!</p><p>Just one of many of Visual Studio’s idiosyncrasies…</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2022/07/31/whaddaya-mean-system-object-is-not-defined/"><em>https://jamienordmeyer.net</em></a><em> on July 31, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bcf11c0987a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enable Access to http://localhost For Development]]></title>
            <link>https://jamienordmeyer.medium.com/enable-access-to-http-localhost-for-development-8d536e572a14?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d536e572a14</guid>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Mon, 23 May 2022 00:00:00 GMT</pubDate>
            <atom:updated>2022-05-24T13:13:52.857Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kzs_Fb3mdSCaMCQ_.jpg" /></figure><p>I will forget this if I don’t get it written down, and I’m hoping that someone else will find this useful as well. If you’re having trouble accessing <a href="http://localhost/">http://localhost</a> from your development machine (for instance, <a href="http://locahost:4200/">http://locahost:4200</a> when starting an Angular application), you can do the following, at least for the Edge and Chrome browsers.</p><p>Open your Edge or Chrome browser, and go to edge://net-internals/#hsts or chrome://net-internals/#hsts, as applicable. At the very bottom (at least at the time of this writing), you’ll find a section called Delete domain security policies. Here, enter localhost into the Domain box, then click on the Delete button. You should now be able to access localhost from http on your development machine.</p><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2022/05/23/enable-access-to-http-localhost-for-development/"><em>https://jamienordmeyer.net</em></a><em> on May 23, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d536e572a14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Single Data Pipeline Pattern]]></title>
            <link>https://jamienordmeyer.medium.com/the-single-data-pipeline-pattern-17fe29d41fa3?source=rss-f67b92f8be4e------2</link>
            <guid isPermaLink="false">https://medium.com/p/17fe29d41fa3</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Jamie Nordmeyer]]></dc:creator>
            <pubDate>Sun, 24 Apr 2022 00:00:00 GMT</pubDate>
            <atom:updated>2022-04-24T21:25:53.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tn_vrq5BDduPEX0L.jpg" /></figure><p>In a previous <a href="https://jamienordmeyer.net/2021/11/25/clean-architecture-solution-template/">post</a>, I talked about the Clean Architecture Pattern, and I presented a .NET 6 solution template that can be used to bootstrap a .NET 6 API solution using this beautiful pattern. One of the patterns used in this template, if you opt into Entity Framework with the -includeEF parameter, is what I&#39;m calling the Single Data Pipeline Pattern. I&#39;m not sure if there&#39;s an official name for this pattern, as I couldn&#39;t find one when I went looking for it, so I&#39;ll call it this until someone corrects me. 🙂</p><p>I’m a huge fan of sticking as much as possible to the SOLID Programming Principles when you can. This includes the S part of solid, or Single Responsibility Principle. The Single Data Pipeline Pattern, unlike the more traditional repository pattern, strives to ensure that each class in the pattern is only responsible for one and one only data pipeline to the database. It’s not concerned with the full CRUD for an entity. It cares only about reading a single form of the data. Or only about updating it. Or deleting it. But never a combination. This keeps these classes modular, and also satisfies the O of SOLID, or the Open/Closed Principle.</p><p>As an example, if I want to get a user’s avatar from the application, I might have an interface and implementation that looks like this:</p><pre>// Interface definition<br>public interface IGetUserAvatarDataService<br>{<br>    Task&lt;StoredFile?&gt; ExecuteAsync(Guid userUniqueKey, CancellationToken cancellationToken = default);<br>}</pre><pre>// Implementation<br>public class GetUserAvatarDataService : IGetUserAvatarDataService<br>{<br>    private readonly IApplicationDbContext _dbContext;</pre><pre>public GetUserAvatarDataService(IApplicationDbContext dbContext)<br>    {<br>        _dbContext = dbContext;<br>    }</pre><pre>public async Task&lt;StoredFile?&gt; ExecuteAsync(Guid userUniqueKey, CancellationToken cancellationToken = default)<br>    {<br>        return await _dbContext.Users<br>            .Include(x =&gt; x.AvatarStoredFile)<br>            .Where(x =&gt; x.UniqueKey == userUniqueKey)<br>            .Select(x =&gt; x.AvatarStoredFile)<br>            .FirstOrDefaultAsync(cancellationToken);<br>    }<br>}</pre><p>The data service, by convention, exposes an ExecuteAsync method, which is the services ONLY public method. Note that this class has no ability to update or delete the user&#39;s avatar. It only knows how to retrieve it. If my consuming code needs to also do some other work in the DB aside from retrieving the user&#39;s avatar, then it would inject a data service for each of those additional operations as well.</p><p>For example, the endpoint for deleting a user’s avatar might look something like this:</p><pre>public class DeleteUserAvatarCommand : EndpointBaseAsync<br>    .WithRequest&lt;DeleteUserAvatarViewModel&gt;<br>    .WithActionResult<br>{<br>    private readonly IRequestValidator&lt;DeleteUserAvatarViewModel&gt; _requestValidator;<br>    private readonly IGetUserWithAvatarDataService _getUserWithAvatarDataService;<br>    private readonly IDeleteUserAvatarDataService _deleteUserAvatarDataService;<br>    private readonly IFileService _fileService;</pre><pre>public DeleteUserAvatarCommand(<br>        IRequestValidator&lt;DeleteUserAvatarViewModel&gt; requestValidator,<br>        IGetUserWithAvatarDataService getUserWithAvatarDataService,<br>        IDeleteUserAvatarDataService deleteUserAvatarDataService,<br>        IFileService fileService)<br>    {<br>        _requestValidator = requestValidator;<br>        _getUserWithAvatarDataService = getUserWithAvatarDataService;<br>        _deleteUserAvatarDataService = deleteUserAvatarDataService;<br>        _fileService = fileService;<br>    }</pre><pre>[HttpDelete(&quot;api/v{version:apiVersion}/user/{uniqueKey:guid}/avatar&quot;)]<br>    [Authorize]<br>    public override async Task&lt;ActionResult&gt; HandleAsync([FromRoute] DeleteUserAvatarViewModel request, CancellationToken cancellationToken = default)<br>    {<br>        var validationErrors = _requestValidator.ValidateRequest(request);<br>        if (validationErrors.Any())<br>            return UnprocessableEntity(validationErrors.ToArray());</pre><pre>var user = await _getUserWithAvatarDataService.ExecuteAsync(request.UniqueKey, cancellationToken);<br>        if (user is null)<br>            return NotFound();</pre><pre>var fileUniqueKey = user.AvatarStoredFile?.UniqueKey;<br>        await _deleteUserAvatarDataService.ExecuteAsync(user, cancellationToken);<br>        _fileService.DeleteAvatarByKey(fileUniqueKey);</pre><pre>return NoContent();<br>    }<br>}</pre><p>Notice that this endpoint uses TWO data services to do is work; one to get the user’s record along with their avatar, and another to affect the avatars deletion. The individual calls to the database are not controlled from the same class as a repository might be. Each is independently injected and maintained. They’re also easy to mock when unit testing the classes that consume the endpoints.</p><p>Now that said, a data service using the Single Data Pipeline Pattern CAN interact with the DB more than once, if necessary, inside the ExecuteAsync method. The key is that these operations be part of the same data flow. For example, here&#39;s the ExecuteAsync method on the DeleteUserAvatarDataService:</p><pre>public async ValueTask ExecuteAsync(ApplicationUser user, CancellationToken cancellationToken = default)<br>{<br>    if (user?.AvatarStoredFile is not null)<br>    {<br>        _dbContext.StoredFiles.Remove(user.AvatarStoredFile);<br>        user.AvatarStoredFile = null;</pre><pre>await _dbContext.SaveChangesAsync(cancellationToken);<br>    }<br>}</pre><p>There’s actually TWO distinct database operations going on in this code. When the _dbContext.SaveChangesAsync method is called, it will first issue a DELETE statement to remove the StoredFile record (metadata for the avatar, or any other file that&#39;s been uploaded by the user in my application), followed by an UPDATE statement on the User record (to set the AvatarStoredFileId column, which the AvatarStoredFile property is tied to via foreign key, to null).</p><p>As a side note, the reason that I use the naming scheme for these data services like I do is to allow me to create some bootstrapping code that will automatically add them to the dependency injection container at startup. This code exists in the .NET 6 solution template referenced at the beginning of this post. Each of my data service contracts will be called ISomethingDataService, and its implementation class will be called SomethingDataService. Then in my application start up, I can use reflection to pull them all into the DI container:</p><pre>private static readonly Regex InterfacePattern = new Regex(&quot;I(?:.+)DataService&quot;, RegexOptions.Compiled);<br>// ...<br>(from c in typeof(Application.DependencyInjection).Assembly.GetTypes()<br> where c.IsInterface &amp;&amp; InterfacePattern.IsMatch(c.Name)<br> from i in typeof(Infrastructure.DependencyInjection).Assembly.GetTypes()<br> where c.IsAssignableFrom(i)<br> select new<br> {<br>     Contract = c,<br>     Implementation = i<br> }).ToList()<br> .ForEach(x =&gt; services.AddScoped(x.Contract, x.Implementation));</pre><p><em>Originally published at </em><a href="https://jamienordmeyer.net/2022/04/24/the-single-data-pipeline-pattern/"><em>https://jamienordmeyer.net</em></a><em> on April 24, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17fe29d41fa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>