Attach to Process

Thoughts and Notes on Software Development

I was looking for the shortest tutorial on the basics of using Git from the command line. This one, Git Tutorial 4: Basic Commands: add, commit, push from YouTube was pretty good.

Here are some notes I made from watching that video:

  • The git status command will show you files and folders that have changes. It also shows you files that you've already committed into your local repository, but haven't pushed yet into a remote server.
  • The git add command adds files that have changes into a staging area on your local computer.
  • The git commit command will commit those changes into your local repository. Emphasis on local. At this point your changes are not saved to a remote server like Github just yet. The committed changes are still on your local Git repository.
  • The git push command is the one that will send your changes up to your remote Github repository.

This next tip is not something I learned from the video, but from someplace else that I don't remember.

  • To get out of a long results screen from using the git log command, you can type q.

Tags: #Git

Update 4/21/2021: I've decided to keep my software development posts separate from my personal posts. I've tried having them both on my journal and I didn't really like how they turned out. So, I've created this new dev blog on write.as to house my posts on software development.

I started this dev blog back in December 2018. It initially started out as a Jekyll Now blog hosted on Github Pages. After about two weeks I made the switch to a Wyam powered blog. And it's been that way since then.

This was my first real website. The first one that I bought a domain name for. Fast forward to 2021 and I now have 4 websites. There's this dev blog, my personal journal, my music blog and a photo-blog. At one point in 2020, I also had a micro-blog that has since been discontinued. So, in total, I had five websites.

After my second digital declutter, I've come to the realization that five websites is one too many. I felt like I couldn't keep maintaining all five at once. Since then, I've been thinking about reducing the number of websites I maintained.

I've thought about combining this dev blog with my personal journal a few times in the past. What was holding me back every time, was that I wasn't sure it was a good idea to have one site that contained both professional and personal content. However, I was also keenly aware of the creeping exhaustion of maintaining multiple websites at once.

There's also the fact that to publish content on this dev blog, I needed to do it on a machine that had .NET Core, Git and Visual Studio Code installed on it. On the other hand, to publish content on my personal journal, all I needed was a web browser.

So, in the interest of simplifying things for 2021, I've decided to stop publishing software development posts on this blog. I'm keeping the existing content on this blog for now. But new software development posts will now be published on my personal journal.

I'm not sure if there are a lot of people who read this dev blog. If you are one of them though, I would like to invite you to check out my personal journal. And if that's something you don't want to do, that's okay too. In any case, thank you for reading this post and I hope you have a nice day!

Tags: #SiteUpdates #Blog

Most of the time, using display: none; is all you need to hide an HTML element. But every once in awhile, doing so will hide the element, but would not reclaim the space the element would have been occupying.

To hide an HTML element and not have it take up space, you can do something like this:

#post-signature-hidden {
    max-height: 0;
    margin-top: -3em;
    visibility: hidden;
}

In case you're wondering, that's the CSS I use to stop my Post Signatures from showing up on the pinned pages on my journal.

Tags: #HTML #CSS

When working with a Windows Forms TextBox, yes I was working with a Windows Forms TextBox 😀, and you want to display updates periodically while a long task is running, you can make use of the Application.DoEvents() method.

I think a better solution is to use a BackgroundWorker class for this. But, if you're working on an unimportant utility tool or a throwaway app, using Application.DoEvents() should be good enough.

Tags: #DotNet #WindowsForms

There are two ways that I know of to customize the footer on a Write.as website. The first one is through CSS and the second one is through JavaScript. I'll go through those two options in this post.

Option 1: CSS

I got this idea of customizing the footer via CSS after looking at Robert Xu's Write.as powered site. It puzzled me that I could not highlight the text in the footer. After viewing the page source, I finally figured out that it was CSS trickery.

So, anyway here we are. To customize the footer using CSS, all you need to do is modify the following CSS script, then add it to the Custom CSS settings for your website.

footer nav::before {
    content: "Copyright © 2020 - 2021 by Your Name \A";
    white-space: pre-wrap;
}
Read more...

Recently had need of a SQL Server script that can tell me if there are open transactions on the database. The script below worked for me:

USE MASTER
GO
SELECT spid,
       PROGRAM_NAME,
       nt_userName,
       loginame,
       DB_NAME(s.dbid) AS DatabaseName,
       CR.TEXT AS Query
FROM   sysprocesses s
       CROSS apply sys.Dm_exec_sql_text(sql_handle) CR
WHERE  open_tran = 1

Source: Welcome To TechBrothersIT: DBA – How To Find Open Transactions In SQL Server

Tags: #Database #Scripts #SqlServer

Finished work on the WriteFreely Archive Page Generator Blazor app. While it does say WriteFreely, you can still pass in Write.as as the instance name and your Write.as alias, and it will work just the same.

Tags: #AspDotNet #Blazor #WriteAs

While working on a Blazor WASM project last week, I noticed that no matter what changes I make to the index.html and app.css files, they were not reflected whenever I open up the site on IIS Express. It turns out to be a caching issue. All I needed to do, was hit CTRL + F5 after the site loads, and it will pull in my changes.

Tags: #AspDotNet #Blazor

A WriteFreely user recently got in touch with me, asking if I could modify the Write.as Archive Page Generator app, to make it work with WriteFreely instances. I spent some time with it last week and I ran into a snag. I'm getting this TypeError: Failed to fetch JavaScript error whenever it tries to fetch data from the WriteFreely instance I'm testing.

When I try getting posts from a Write.as blog using a Blazor WASM app, it works. When I try getting posts from a WriteFreely instance blog, using the Blazor WASM app, it won't work. But when I try getting posts from a WriteFreely instance blog, using a .NET Core console app that uses the WriteAs.NET library I wrote, the same library that the Blazor WASM app uses, it works. Something weird is going on.

My research into the issue indicates a possible limitation with WebAssembly apps. There must be some security setting on the WriteFreely instance I'm testing, that's blocking my Blazor WASM requests. The Write.as API is obviously not blocking my requests, so something is going on with that WriteFreely instance.

I dug into it some more and found that it is a CORS related issue. But at this point, there's nothing else I could on my end to fix it. I created a thread on discuss.write.as to talk about it.

Tags: #Blazor #JavaScript #WebAssembly

Update 4/23/2021: The write.as team has introduced some rate-limiting features on their API to combat spam bots. That stopped this Glitch app and my other Blazor WASM apps from working.

Was supposed to create an “Unpopular Posts” Blazor WASM app, but ended up creating the opposite. Anyway, I managed to make the app flexible by having it use query string parameters. That means that you can use the app and embed it into your own Write.as page/site. Just follow the instructions in the readme.

Link: Write.as Popular Posts – Blazor WASM App

Tags: #AspDotNet #Blazor

Enter your email to subscribe to updates.