Attach to Process

Thoughts and Notes on Software Development

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

Discuss... or leave a comment below.

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

Discuss... or leave a comment below.

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

Discuss... or leave a comment below.

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

Discuss... or leave a comment below.

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

Discuss... or leave a comment below.

I purchased a new domain, nowlisteningto.com for my Now Listening to... music blog. Prior to buying the new domain name, I didn't realize how big of a pain it was going to be to set up redirection. Turns out, you can't setup a 301 redirect using just DNS records. It has to be done on a web server level, or via your domain registrar. My issue is that I can't use my domain registrar for redirects, because I use Netlify to manage the DNS records for my domains. And from what I can see, Netlify doesn't have a menu option for redirecting from one domain to another.

So, I ended up doing a redirect via HTML and JavaScript, by hosting a static site on Netlify. This static site's purpose is to simply redirect from nowlisteningto.dinobansigan.com to nowlisteningto.com. It is not ideal, but this will do for now until I figure out a better solution. Thanks to this answer on StackOverflow for the idea.

Tags: #CustomDomain #DomainRedirect #HTML #JavaScript

Discuss... or leave a comment below.

First of all, just wanted to point out that this is not a sponsored post. Nor do I use an affiliate link. I'm just sharing my experience with a tool that has helped me a number of times with my work. So, let's get to it then. What is Telerik JustDecompile?

Telerik JustDecompile is a tool that can help you de-compile .NET DLLs. What that means is that it will let you see the compiled code inside a DLL file. The compiled code won't exactly match the source code, but it is close enough that you'll have no trouble understanding it. It's very easy to use too. You simply right click a DLL file and choose open with “Telerik JustDecompile”. And the best thing about it, is that it's free.

In my experience, the Telerik JustDecompile tool is great for helping troubleshoot build issues. I was assisting someone who was running into a WCF service error. The service method reported in the error, was nowhere to be found in the code base. And I was able to verify that, by opening up the service DLL file on the test server, using JustDecompile. This allowed me to look at the compiled code inside that DLL. And it proved that the service method mentioned in the error, is not in the DLL. It turns out that the client app he was running, was a newer version from a different branch. That explains why the service method it was trying to call, didn't exist.

Tags: #Tools

Discuss... or leave a comment below.

Ran into an issue where I could not open rptproj files with Visual Studio 2019. Since these were old SSRS reports, I thought I’d try opening them with Visual Studio 2013. Didn’t work either. Visual Studio 2012? Nope.

Did some more research and eventually found out that this is not a Visual Studio issue. Apparently, to open rptproj files with Visual Studio, you need to install the corresponding Microsoft SQL Server Data Tools – Business Intelligence package. Would not have figured that out had it not been for this post.

So I went here to download the SQL Server Data Tools BI package. Installed it. And now I can open the SSRS solution/project in Visual Studio 2012.

Tags: #VisualStudio

Discuss... or leave a comment below.

For some reason, maybe because I accidentally pressed something on my keyboard, Visual Studio 2019 started comparing code in inline mode. By inline mode, I mean I only got one code comparison window, and the changes were stacked on top of each other. This made it hard for me since I was so used to the side by side code comparison mode, where I had two windows and I can clearly see what's different between files.

It took awhile for me to figure out how to set it back. I spent some time looking through the options in Visual Studio but couldn't figure it out. I even had a hard time searching the internet for answers, because I wasn't sure what to search for. The search key that finally worked for me was “vs 2019 diff inline mode”. That led me to the Stack Overflow post I linked below.

Side-note: I find it hilarious that the question in Stack Overflow was for Visual Studio 2012. Here I am with Visual Studio 2019 and the answer still works. Amazing. And what a gem Stack Overflow is for software developers.

Anyway, there are two ways to set it back to side-by-side mode. You can use the shortcut button for it in the menu bar. Or, you can use the shortcut CTRL + \, CTRL + 2.

Visual Studio Diff View Modes Shortcut

Reference:

How to switch view modes in built-in Diff viewer of Visual Studio 2012 and 2013?

Tags: #VisualStudio

Discuss... or leave a comment below.

When you just want to do a simple WCF service test, you don't need to download third party tools. You can use the WCF Test Client app that usually comes as part of a Visual Studio installation. I keep forgetting where to find it, so I'm writing it down on here to remind myself.

I had Visual Studio 2017 installed on my PC. Here is where I found the WCF Test Client app (WcfTestClient.exe):

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE

Tags: #WCF #DotNet #VisualStudio

Discuss... or leave a comment below.

Enter your email to subscribe to updates.