Attach to Process

Thoughts and Notes on Software Development

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

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

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

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

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

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

A week ago I was running a test and kept running into a WCF BindingConfiguration Error. I would not allow myself to check-in my code unless my tests passed. So, I battled with this error for over an hour.

The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named ‘BasicHttpBinding_IXXXXXX’. This is an invalid value for bindingConfiguration.

It's your basic, run of the mill, WCF BasicHttpBinding configuration error.

I double-checked my test project's app.config file and the relevant client.config files – everything looked right. I know it was a configuration issue. The error message itself made it obvious that it was a configuration issue. But everything looked right. I didn't see any issues with the config files I was looking at.

It must be noted that it was already close to midnight at this point. I was working late that day and decided to push myself by resolving to check-in my changes before the night ends. I have no doubt that being tired and sleepy didn't help.

Anyway, after awhile I realized that the service method that I was trying to test, was running inside another service. So, in addition to the test project’s app.config file, I also needed to double-check that other service’s Web.config file. When I ran into this error earlier that night, I actually updated that other Web.config file. I added the entry it needed just to cover my bases. I didn't know then that it was the Web.config file that was causing the error.

For some reason, possibly due to fatigue and needing sleep, I didn't think about checking that Web.config file again. Out of frustration, I decided to take a break and headed to the kitchen to drink a glass of water. After hanging out in the kitchen for a bit, then listening to some good music, I finally had the bright idea to check this other Web.config file again. And there it was, a typo on the BasicHttpBinding entry I added. Can't believe I didn't check on it sooner.

Lesson learned here is to take a break whenever you're stuck with a problem. Give your mind time to rest. Chances are, your subconscious will kick in and tell you what to try next. And if the problem points to a configuration issue, with WCF, it most likely is. So, check all the config files, again.

Tags: #WCF #CSharp #DotNet

Was running into a build error in Visual Studio 2017. The Output window says 1 project failed, but the Error List window was empty. The only way I managed to figure out what project was failing, was to copy the contents of the Output window, paste it into Notepad++ and search for the word “FAILED”.

Anyway, I finally figured out that it was the SQL database project that was failing to build. And it turns out, it was getting an “Out of Memory Exception”. Not sure if this specific error causes the Error List window to come up empty. In any case, at least now I have an idea of what to look for whenever this happens again.

Tags: #VisualStudio

Update 04/26/2021: I have since taken down my Journal Entries, so the links on this post won't work anymore. However, the idea and logic described in this post, is still applicable for posts that you wanted to add a Previous or Next link to.

In Part 1, I covered how I generated links to the Previous and Next post for my “indexed” journal entries. In this post, I'll talk about how I generated the links for non-indexed journal entries.

Handling Old Journal Entries

So, now that I have navigation working for my “indexed” entries. I turned my attention to my precursor journal entries. These entries don't use base 10 numbers as indexes in their slugs/URLs. For example, the post slug for Journal Entry – I ends in “I”, which is a roman numeral. Same goes for Journal Entry – II, III, IV and so on. To further complicate things, I decided to leave the post slugs unchanged for other precursor journal entries. The post slug for Journal Entry – XV for instance is still “decisions-decisions”. I thought about writing JavaScript that would convert roman numerals to base 10 numbers. But then that won't work for non-indexed entries like Journal Entry – XV.

Shot myself in the foot right there, huh? >_<

Read more...

Enter your email to subscribe to updates.