Subscribe to EventStore catch-up subscription from the start with C# example

EventStore is an open-source database technology designed for storing, retrieving, and querying event data using a stream-based approach. In EventStore, a catch-up subscription is used to read events from a given point in a stream and catch up to the most recent events. When starting a catch-up subscription, you can specify the starting position using an event number or position. However, in some cases, you might want to start from the beginning or the very first event. Here’s how you can achieve that:

Continue reading “Subscribe to EventStore catch-up subscription from the start with C# example”

Entity Framework (EF) Core FluentApi Relationships without Navigation Properties

Entity Framework (EF) Core allows you to define relationships between entities using Fluent API, even without explicitly creating navigation properties. This can be useful when you want to define relationships between entities but don’t want to create navigation properties in your entity classes. Here’s how you can achieve this:

Continue reading “Entity Framework (EF) Core FluentApi Relationships without Navigation Properties”

Case-insensitive “LIKE” search with EF Core and PostgreSQL

When using EF Core with PostgreSQL for a case-insensitive “LIKE” search, you can leverage PostgreSQL-specific features to achieve the desired behavior. PostgreSQL supports the ILIKE operator, which performs a case-insensitive pattern matching operation. Here’s an example of how to perform a case-insensitive “LIKE” search using EF Core and PostgreSQL:

Continue reading “Case-insensitive “LIKE” search with EF Core and PostgreSQL”

How to truncate text in an Angular Material UI table cell

Working on a recent project using Angular and Material UI, I needed to be able to truncate the text in one of the cells of a Material table. Here is the simplest way I have found to accomplish that.

//Add this to your css
mat-cell > span.truncate-text {
    text-overflow: ellipsis; 
    overflow: hidden; 
    white-space: nowrap;
}
//Wrap the long text in a span with a class of truncate-text

<ng-container matColumnDef="longtext">
  <mat-header-cell *matHeaderCellDef> LongText </mat-header-cell>
  <mat-cell *matCellDef="let element">
    <span class="truncate-text">{{element.longtext}}</span>
  </mat-cell>
</ng-container>

Workaround – Google Sign-In without Google+ API with MVC .NET and Owin

A few years back I created a small custom application for a client that utilized their Google logins for authentication.  The web application was written with ASP.NET MVC and utilized Katana/Owin pipeline.  The common practice to setup that application with Google sign in was to also enable the Google+ API.  If you have done this then like me you have received an email recently that explains, as of March 2019 the Google+ API’s will be shut down.  I have spent the last few days trying to read through the documentation to understand what needs to be done to fix this, without completely switching up the current login flow, however they don’t seem to make this transition easy for .NET applications.  Thankfully I finally found the answer I was looking for, a workaround posted in GitHub comments, to address this exact issue.  For those of you who are in the same boat as me have a look at this comment .  I have made the changes recommended here and I can verify that my Google Sign-In is now working again without the Google+ API enabled.

Advent of Code 2018 – Day 1

In an effort to learn python I am working my way through the Advent of Code challenges.  Advent of Code is a coding challenge done during the holiday season every year, its a fun way to keep your skills sharp.  It is also a great way to try and learn a new language because it gives you some focused challenges to figure out how the new language works to solve the problem. Check it out here https://adventofcode.com/2018

Continue reading “Advent of Code 2018 – Day 1”