Posts

Implementing retry pattern in ASP.Net application

We have moved to cloud to leverage the benefits of Agile infrastructure​. We can scale our infrastructure​ based on current load they are serving. It gives us ability to meet the hardware need during peak hours and also to save on cost during off-peak hours. But often we do not know in advance when ​​​​will our resource be overwhelmed by user requests. Take the example of a database in cloud. We can scale it, but scaling during a business hour will disconnect the users, at least for a fraction of a moment. Assume our database was already on high usage, which automatically triggered the scale activity, means many users are connected and all of their connections are impacted due to scale up (or down). Some users might retry, but some might not and contact the support to look into the issue. We do not want to give a bad user experience to our customers, hence avoiding scaling activities during business hours. But this does not allow us to fully utilize the scaling capabilities of cloud

RDP Issue: The Function requested is not supported

Image
Recently I started facing following error while trying to connect to one of my Windows server using RDP. An authentication error has occurred. The function requested is not supported. This was because of the recent patch related to security "Security Update for Microsoft Windows (KB4093112)" installed on the client but related equivalent patch not installed on server. The server was not patched with updates but the client was and hence the issue. So I uninstalled the patch from the client, then when tried to RDP the server and I was able to. I then patched the server with necessary updates and later applied the updates the client as well.

RaspberryPi headless setup

Hardware requirements: RaspberryPi SD Card (Usually included when you buy RaspberryPi) SD Card Reader (Required if your PC does not have one) WiFi Router to get your RaspberryPi connected to PC (optionally with SD Card Reader) Software requirements: Raspbian SD Card Formatter Win32DiskImager Angry IP Scanner PuTTY VNC Viewer Steps to setup RaspberryPi in headless mode: Format SD Card using SD Card Formatter Copy the OS iso image to SD card using Win32DiskImager Create below files on root folder in SD Card Blank file named "ssh" without any extension in the root folder of SD card "wpa_supplicant.conf" with following lines of code in the root folder of SD card: Make sure to replace the country, ssid and psk values correctly in the above file. Remove the card and insert it into RaspberryPi and boot it up. Run Angry IP Scanner and scan for ip range for ip addresses of WiFi. If your router IP is 192.168.0.1 then scan for the range 192.168.0.0 to 192.168.0

You must have a user with the same password in master or target server

While creating the build of a SQL server database project you could face following error: Error Deploy72002: Unable to connect to master or target server 'DatabaseName'. You must have a user with the same password in master or target server 'DatabaseName'. This error could be caused by the user account used in publish profile with could have sysadmin privileges. Since sysadmin users on server are mapped with user "dbo" in database hence this error. You can create or use another user with db_owner permission on the database. This could resolve this issue.

Deadlocks of an Azure Database

If your Azure database is experiencing deadlocks or below error Transaction (Process ID) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction then you can see them by executing following query in the master database:

Schema.Object has an unresolved reference to Schema

If while building a database project face this error: Severity Code Description Project File Line Suppression State Error SQL71501: Function: [schema].[object] has an unresolved reference to Schema [schema]. DBProject.Database D:\TFS\path\DBProject.Database\schema\Functions\schema.object.sql Then this error might be because you have object definition referring to the schema under which they are supposed to be created but there is not script to create that schema. Suppose your schema name is empschema then you should add file smpschema.sql to the project with following code: CREATE SCHEMA empschema AUTHORIZATION dbo;

Assigning values to variables from same table but different rows

Image
I often see developers assigning values to variables from the same table but different rows based on the row ID. The values are mostly from the same column. What I see is the table is queries multiple times and could impact performance. Below is the sample query and its execution plan. DECLARE @Method1 nvarchar(50); DECLARE @Method2 nvarchar(50); SET @Method1=(SELECT DeliveryMethodName FROM [Application].[DeliveryMethods] WHERE DeliveryMethodID=1); SET @Method2=(SELECT DeliveryMethodName FROM [Application].[DeliveryMethods] WHERE DeliveryMethodID=2); Instead, we can do it as in below query: This can also be used while fetching values from an XML column or variable based on a node.

Make Money from Surveys