Attach to Process

Thoughts and Notes on Software Development

A number of people have been asking me about why the WriteAs Archive Page generators I made no longer work. They no longer work because of CORS restrictions on the API server. I'm trying to see if I can work around the restrictions on my Blazor WASM apps by going the Web API route.

Started working on an API for my websites

Tags: #Micro #ASPNETCore #WebAPI #WriteAs

Discuss... or leave a comment below.

I seem to have a need for this every 6 months or so. So I'm putting it up on this site to make it easier for me to lookup.

This SQL Server query allows you to search for specific text inside all stored procedures on a database. The query will return the name of the stored procedure.

SELECT name 
FROM   sys.procedures 
WHERE  Object_definition(object_id) LIKE '%Search-Text%' 

Source: Search text in stored procedure in SQL Server

Tags: #SqlServer #Scripts

Discuss... or leave a comment below.

Cache Implementations in C# .NET — good blog post on implementing caching with .NET.

You're using HttpClient wrong and it is destabilizing your software — great blog post that told me that we should avoid the use of the “using statement” when working with an HttpClient instance. And that's because disposing it after say a one time use, like doing one API call and then immediately disposing, will leave open/pending socket connections. Do this often enough and you'll accumulate a number of those open/pending socket connections and that will slow down your app. The better approach is to use a single static HttpClient instance in your app.

The always-recent guide to creating a development environment for Node and React (with Babel and Webpack) — good guide to setting up a full-stack JavaScript development environment on your local, with an eye toward ReactJS.


Disclaimer: I'm not an expert in Git. This post is me trying to understand how it works, by trying to explain it to someone else. If I've said something wrong in this post, please don't hesitate to correct me by leaving a comment below or getting in touch with me.

So, in the past, I got confused by how a git revert command affected the merges. Part of it is due to my TFS background. But anyway, as it turns out, it works exactly how it is supposed to work, once you have a better understanding of how Git works.

A git revert rolls back a specific commit made in the repo. In addition to that, it adds a new commit to indicate that the previous commit was rolled back.

To better explain how this affects merges, I'll try to go over a scenario where I merge branches, then revert a commit in one branch, then try to merge the branches again. So here goes.

Imagine that I have two branches, develop and master. The develop branch was created based off the master branch, so they should have the same code in them.


What is a react helmet?

  • React helmet is a helper component that allows you to add data to the <head> section of a document or HTML page. It basically allows you to add <link> tags, <scripts> and other tags that goes into the <head> section of an HTML page.

Source: What is react helmet?

So react-helmet library didn't work for me, but this one did.

The equivalent of the npm install command in yarn is yarn without any parameters.

Was trying to help out someone on get a logo to show up beside their blog title. I learned that you can actually set the size of the background image using something like background-size: 150px;. Cool stuff.

Reference: Resizing background images with background-size

So last time I decided to just not show a header image for my Now Listening to... website on mobile screens. It was because I didn't know how to handle it. Well my easy solution turned out to be getting a smaller sized image to use as a header image. Then I was able to just add a css media screen entry that uses the smaller sized image.

Co-worker was running into Gatsby/Kentico/Grahpql errors with one of our projects. We pretty much had the same .env file and code base. Deleting the folder and downloading again didn't fix it. What worked for him was running the command npm cache clean --force.

Note: This is probably a dangerous command to run. Please research what it does before you try it out. I'm only sharing what worked for me and my team. But this was a last resort type of attempt to fix our errors.

To create a repository from an existing folder or files using Github Desktop, first you have to create the repository on the app itself. This is so that the app can create and initialize the folder on your drive. Then you can copy over the files into the folder that the app created. And then you're set.

To copy the _redirects file (or any other file for that matter) to the Output folder in Wyam, you can use the pipeline code below:

    // Copy redirect file to the output folder

Tags: #DevNotes #CSS #Gatsby #Github #NodeJS #ReactJS #Wyam #Yarn

Discuss... or leave a comment below.

For awhile now, I was wondering if it was possible to use Markdown, to make an image clickable. By that I mean, display an image in a blog post, and allow the reader to click that image to view the image in a tab. You can see an example at the end of this post.

So anyway, I know what the Markdown syntax is for a link and for an image, but I've never been able to put the two together until today.

Thanks to this post for the idea on how to do it. This saved me from having to write JavaScript that would find all the images in a blog post, then wrap them in an <a></a> tag just to make the images clickable and open in a browser tab.

So just to recap, the Markdown syntax for a link is this: [Link text](Link URL)

And the Markdown syntax for an image is this: ![Alt Text for image](Image URL)

So, given the Markdown listed below for an image, how do you display the image and make it clickable at the same time? ![Mazda FC RX-7 - A little drifting action](


It's been awhile since I updated the contents of the Archive page on my journal. I stopped updating when my Blazor apps stopped working. Archive Page - Dino's Journal - 20220625

I remember working on some update to my Blazor apps, but the limitation of Blazor WASM as a client-side application, plus the CORS restrictions I kept running into, made it a headache and so I stopped. I eventually created a WPF app just for my own use.

This is what I used today to generate the contents for my archive page. Yes I know it is ugly. But I just need it to work, I don't need it to look pretty. And well, it does the job just fine, so I'm happy with it.

Since it is a WPF app, it will only run in Windows. So sorry folks, it's not something that everyone else can easily use. But if there's enough interest on it, I can share the source code in a public repo. Let me know in or in the comments below.

Tags: #WriteAs #WPF

Discuss... or leave a comment below.

I thought I'd share the Custom CSS and JavaScript I use on this blog. The design is inspired by this Hugo Hello Friend theme I saw on


How to check if array contains a specific item

To check if an object or item is contained in a JavaScript array, you can use the includes function, like so:

const customerIds = [1, 2, 3, 4, 5];
console.log('IsIncludedInArray', customerIds.includes(3));

To do the same thing in C#, you can use the Contains or Any LINQ method, like so:

var customerIds = new int[5] { 1, 2, 3, 4, 5};
Console.WriteLine("IsIncludedInArray " + customerIds.Contains(3));
Console.WriteLine("IsIncludedInArray " + customerIds.Any(n => n == 3));

How to filter out contents in an array

To filter out the contents of an array in JavaScript, you can use the filter function., like so:

const customerIds = [1, 2, 3, 4, 5];
const filteredCustomerIds = customerIds.filter(n => n <= 3);
console.log('Filtered CustomerIds', filteredCustomerIds);

To do the same thing in C#, you can use the Where LINQ method.

var customerIds = new int[5] { 1, 2, 3, 4, 5};
var filteredCustomerIds = customerIds.Where(n => n <= 3);

foreach (var n in filteredCustomerIds)

Tags: #JavaScript #CSharp #DotNet

Discuss... or leave a comment below.

This is sound advice. Using -- to comment out scripts in SQL is generally okay. But there is a risk of the script breaking, when all of a sudden your script is listed in just one line. So the better practice is to use /* comment goes here */ instead. Hats off to Brent Ozar's post for this tip.

Link: Never, Ever, Ever Start T-SQL Comments with Two Dashes

I figured I would add some sample script to illustrate the problem. So here goes.

Original Script

delete from dbo.Customers
--where createDate >= '20211201'
where customerId = 99

Take for example the script above. You originally wrote that script to delete all Customer records in the database that were created since the month of December. You then realize that it will delete more records than you wanted, so you comment out the createDate filter, and use a customerId filter instead.

Now in its current form, the above script would work just fine. You run it and it will delete the record where customerId is equal to 99. All is good.

But what happens if that script is somehow parsed by some other tool, and the resulting script displayed in just one line? Here is what that script looks like.

Broken Script

delete from dbo.Customers --where createDate >= '20211201' where customerId = 99

As you can see from the resulting broken script listed above, instead of just deleting the record where customerId is equal to 99, you will now be deleting all the records in the Customers table. Yikes!

Tags: #SQL #SqlServer

Discuss... or leave a comment below.

Enter your email to subscribe to updates.