Attach to Process

Thoughts and Notes on Software Development

Visual Studio, when used with TFS (Team Foundation Server), has this feature called “Annotate”. You get to it by right clicking somewhere in the code, then selecting Source, then Annotate.

Doing so shows you who made changes, when those changes were made, and what changeset those changes belong to, for the specific line of code you are looking at. It's pretty helpful especially when you're trying to understand the context or history of a specific line of code.

I've been looking for the same feature in Visual Studio Code. Unfortunately, this feature doesn't exist when using Git with Visual Studio Code. But, you can install an extension called Gitlens that does the same thing and then some.

And just to clarify, there is no “Annotate” command/feature in Git. But there is a corresponding one called git-blame.

Tags: #VisualStudioCode #Extensions #Git

In the past, I used Wyam to generate the website files for my software development blog. I chose Wyam because it is a .NET static site generator and I am a .NET software developer. With Wyam, I got to play around with Razor and C# while working on my blog. And I learned a lot about HTML, CSS, JavaScript and even Markdown. But now it's time to move on.

I've already made some changes at the start of this year. Namely, I decided to start publishing new software development posts onto my journal. As I mentioned in this post, I didn't really like how it turned out. I didn't like how the content was getting mixed in with other totally unrelated posts. So, after only a few months with that setup, I decided to move my dev blog out into a stand alone blog once more.

Instead of going back to a static site generator, I decided to spin up a new blog with write.as. There are two main reasons for this.

Ease of Publishing

First, I loved the ease of publishing new content with write.as. Their Markdown editor is superb. The writing experience is distraction free. And all I really need to write new posts is a web browser. Yes, even the web browser on my mobile phone will work. I can't exactly say the same thing about writing new posts with a static site generator.

Keeping it Simple

Second, I wanted to keep things simple by keeping most of my sites under one roof.

I've realized that it was hard to maintain websites that were on different platforms. To post to my dev blog, I had to do it with Wyam. To post to my microblog, I had to do it at micro.blog. To post to my journal or music blog or photo blog, I had to use write.as.

Keeping my sites under one roof, using the same method of publishing, would make things a lot simpler. At least, that's the idea. So, I'm trying that out.

Whether this new setup will work or not, only time will tell. But the one great thing about owning your domain and personal websites, is that you can do whatever you want. You want to experiment with a different way of publishing, go ahead. You want to try a new theme, give it a go. You want to write longer posts, or shorter posts, it's all up to you. Your websites, your rules.

Anyway, that's all for tonight. I just wanted to publish a formal migrated to write.as post for this blog. I feel better now with that out of the way. So, I'll catch y'all in the next post. Thanks for reading.

Tags: #SiteUpdates #Blog

Recently had need of a script that can tell me the time difference in seconds, between two DateTime values in SQL Server. Here is what worked for me:

SELECT DATEDIFF(S, StartDateTime, EndDateTime) AS DurationInSeconds;

Note the first parameter, S, tells the DATEDIFF function to return the difference in Seconds. You can pass in other values as well, like MS for milliseconds or HH for hours.

You can find out more about the DATEDIFF function here.

Tags: #Scripts #SqlServer

As part of learning React, I'm also trying to shore up my JavaScript skills. Thankfully, the React: Getting Started pluralsight course also offers a modern JavaScript crash course. These are my notes from when I tried to understand JavaScript's Destructuring feature.

Note that you can run the sample code on a JavaScript tester website, like say the JSComplete Playground.

So, the JavaScript destructuring assignment syntax allows you to get just the properties you want from an object. It seems to be like a shortcut for getting to the properties of an object. For example:

const customerInfo = {
	firstName: "Dino",
	lastName: "Bansigan",
	emailAddress: "myemail@email.com",
	website: "dinobansigan.com"
}

const getFullName = ({firstName, lastName}) => {
	return firstName + " " + lastName;
}

console.log(getFullName(customerInfo));

In the code above, you can see how I have created a customerInfo object. Then next is a function called getFullName that takes a firstName and lastName parameter. These parameters are destructured from the customerInfo object.

If you look at the last bit of code where I call console.log, you can see that instead of passing in parameters customerInfo.firstName and customerInfo.lastName, all I had to do, was pass in the customerInfo object. JavaScript through the destructuring feature is smart enough to know to use the firstName and lastName properties from the customerInfo object.

Read more...

Starting a new DevNotes series. This is a spin-off from my Weeknotes series. This one focuses on software development content only. This one won't exactly be a weekly thing. I'll only publish a DevNotes post when I have a number of notes to share. Otherwise I'll bundle them up into a bigger post and publish then. And with that out of the way, let's get started...

I'm starting to notice a trend with the Rust programming language. It seems to be the next big thing. Microsoft even joined the Rust Foundation. It probably should be the next language I should learn after React.


I just realized, after installing the React Browser Dev Tools Extension, that Microsoft's Azure DevOps site was built using React. If Microsoft, who created C# and ASP.NET, uses React on their core products, it is just one more reason for me to really dig into React.


React components can be thought of as building blocks for your website. Instead of creating a button then styling it with the primary-button CSS class, you create a PrimaryButton component then use it wherever you want.

Reference: Get to Know Gatsby Building Blocks


I was building a very basic Gatsby website, the one from their tutorial. It was taking too long to build the output for a static site. Too long compared to building sites using Wyam. I don't have anything against Gatsby. In fact I'm trying to learn Gatsby. I'm just pointing out that it seems slow compared to Wyam.


While going through the Gatsby tutorial, I found another alternative to Netlify for hosting static sites: Surge.

Tags: #DevNotes #Gatsby #React #Rust #StaticSiteGenerator

I am using the Lanyon theme on my micro.blog hosted photo-blog. I noticed that the Published Date was showing up on my about page. Here is how I managed to hide it using some JavaScript.

<script type="text/javascript">
var isAboutPage = /\/about\/$/i.test(window.location.href);
if (isAboutPage) {
  var x = document.getElementsByClassName("post-date");
  if (x) {
    x[0].remove();
  }
}
</script>

I added the script to the layouts/partials/default_foot.html file, just before the closing </body> tag.

This is a result of me playing around with Custom JavaScript on my write.as sites. I was able to carry over what I learned here and use it to fix something on another website. One of the best benefits of maintaining a personal website, is brushing up on your HTML, CSS and JavaScript skills.

Tags: #JavaScript #MicroBlog

My first attempt at learning the React JavaScript library was by reading the ASP.NET Core 3 and React book. I started reading that book a few months ago. I've gone through the first six chapters, which mostly covers how to build a web app front-end using React. While I did learn a lot reading those chapters, I was barely keeping up.

There's so many new concepts, new libraries, new methods, new syntax to learn. It felt overwhelming at times. It didn't help that I kept getting distracted at the JSX syntax — which looked insane to me at times.

I found myself simply typing what was in the book. But I actually couldn't tell you why the code worked. I was honestly struggling to keep up. But more importantly, I was confused and frustrated at it all. Why would you even want to go through all this trouble of writing a React app? I didn't get it. And consequently, I wasn't too excited to learn more. But I had to.

Read more...

If you're trying to publish a SQL Server database project using Visual Studio, but you're not seeing the Publish dialog box show up, check your other Desktop in Windows. I've noticed that every once in a while, the Publish dialog box shows up in another virtual desktop, instead of showing up on the one you're currently working on.

Tags: #SqlServer #VisualStudio

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

Enter your email to subscribe to updates.