Attach to Process

Thoughts and Notes on Software Development

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

Discuss... or leave a comment below.

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

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.

Enter your email to subscribe to updates.