Category: .NET

Dealing with SQL Server Space - Part 1

Recently, I have been building a large database for the new House-Buddy project. The site uses a huge collection of data to identify the sweet-spots around a particular location. The site is hosted on a shared hosting which in theory had unlimited DB storage, but after they noticed the size of the database has grown

Continue Reading

Adding Quartz to your ASP.NET Core

This is a ready made example of how to add a scheduled job to your ASP.NET core web application:

In your Program.cs

Continue Reading

How to regain space after dropping columns in SQL Server

I hit an annoying issue today. I wanted to regain space after I dropped several columns in a table. When I run the famous query from StackOverflow:

I got a set of numbers which were the same before and after the removal has

There is, however, a potential issue with this approach if

Continue Reading

Transaction log is full due to LOG_BACKUP

Yesterday, when I was building a large DB from scratch I got an error saying:

Running this simple query solved the issue:

Continue Reading

The ALTER TABLE statement conflicted with the FOREIGN KEY constrain

I've been trying to apply a new migration and I was getting the following error: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.Parent_dbo.Childs_ChildId". The conflict occurred in database "parents_db", table "dbo.Childs", column 'ChildId'. In my case, the table contained data. Therefore, either you have to assign a default value, set it as

Continue Reading

MediaElement Not Firing Events

Today, we encountered quite an interesting problem. MediaElement wasn't firing events. Using simple speech synthesis on Windows 8.1 using the speech synthesiser we tried:

None of the variations worked. The speech worked just the event wasn't getting fired. After a bit of digging it turned out that in order to fire events MediaElement must

Continue Reading

Databindings - small values treated as 0s

Today, I encountered an interesting problem with WinForms. In the application, NumericUpDowns (shown below) were used with small values e.g. 0.00001 etc. However, after we refreshed the panel, the value was being set to the default value. Digging further into the problem it turned out that the default Microsoft DataBinding converter was unable to convert

Continue Reading

How to use - (dash) in the ASP.NET MVC call?

ActionName attribute can be used:


Continue Reading

How to override MongoDB connection details in appsettings.json on Azure

It is actually pretty simple to override the connection settings in Azure. If you manage your connection inside the appsettings.json:

Then in Azure you should define these in Application Settings -> App settings. Seperate the layers by ":" (semi-colon). For example: Key: MongoConnection:ConnectionString Value: mongodb://admin:abc123!@localhost. Similarly, the database (key) MongoConnection:Database value: YourDb

Continue Reading

Extracting Username and Password from Basic Authentication

Basic authentication is one of the most fundamental ways in which authentication can be performed. It does not require multiple calls and is very easy to learn. In this article, I will present how to use C# (usually with WCF) to extract basic authentication credentials from the request. Step 1 - Understanding Basic Authentication Whenever

Continue Reading