Tuesday, June 7, 2022

SQL Server Management Studio With SQL Server inside a docker container

Recently, I downloaded the docker image for SQL Server and wanted to connect to the server via the excellent SQL Server Management Studio. The docker container was run using the following commands

For downloading the SQL Server image:

docker pull mcr.microsoft.com/mssql/server:2019-latest

For setting up the SQL Server and running it:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" -p 6433:1433 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2019-latest

Note that the SQL Server port 1433 has been mapped to port 6433 on the host. This was done because   I already had a SQL server installed on my laptop running at port 1433 which I didn't want to disturb. All this stuff can be read in detail here.

What now remained was to point the SQL Server Management Studio to this SQL Server instance running inside a container. In the "Connect To Server" dialog, the server name was specified as localhost,6433. Authentication: SQL Server Authentication. Username: sa and Password: <YourStrong@Passw0rd>

Some more references:

1. Deploying and running queries on SQL Server in Docker.

2. Connecting Management Studio to SQL Server running on a non-standard port.

Saturday, June 4, 2022

DateTime format issues in ASP.NET

There was a prolonged ongoing problem resolution effort in our workplace. It was a mysterious problem that had us all stumped. The problem was DateTime parsing. Strings containing dates were not being parsed "properly" on the server. The same strings were being parsed perfectly when the server program ran on our local computers.

We first checked the date format on the server. The format was changed to match our local machines - "dd/MMM/yyyy". The country/region was set to "India" and the regional format was set to "English (India)". In spite of these changes, the web app behaved differently on the server machine when compared to how it behaved on our machines (laptops and desktops). Then we took a look at the "Current System Locale" setting - buried under Settings -> Region -> Additional date, time & regional settings -> Change date, time or number formats -> Administrative -> Change system locale. However, this was set to English(United States) on both our machines and the server. This meant that this setting was not the cause of the different behavior. The fact that the server OS was Windows 2016 Server edition might be making the difference. But, how do we fix the date-time issue?

Finally, after some googling, I found the following stackoverflow article. Inserting the following XML snippet in the <configuration><system.web> fixed the issue: 

 <globalization uiCulture="en-IN" culture="en-IN" />

Saturday, February 25, 2012

Fixing Windows 7 MBR overwritten by Grub2

Dear Readers,
All glories to Srila Prabhupada.
Recently I faced the problem of having the MBR of my IDE HDD being overwritten by Grub2. I found an article describing the recovery process: http://support.microsoft.com/kb/927392. Unfortunately when I tried that, the System Recovery Options window was not listing any OS! I figured out that I had to disable my other HDD (on which Linux - Debian was installed) and retry. This time I could see the Windows 7 installation listed in the recovery window. Startup Repair options didn't work and I had to resolve to opening the command prompt and using bootrec.exe. All I had to type at the command prompt was

C:
cd boot
bootrec /FixMbr


Maybe the first two lines are not even required!.
Done by the mercy of Sridharaswamy Maharaja.

Thursday, February 23, 2012

gjig errors revealing

Jai Srila Prabhupada

When I tried running gjig as root, I learned a few things about running graphical programs as root. The method of using 'su' to become root is only relevant if the program is non-graphical (doesn't use X11). The right way is to use gksu.

Om namo bhagavate sridharaya

Monday, February 6, 2012

Switching to a pseudo-terminal in Debian

Ctrl+Alt+F, where n >= 1 AND n <=8. Usually Gnome desktop runs at n=8 (tty8)

Om namo shridaraya

Resolving "Could not update ICEAuthority /var/lib/gdm3

Here is the error message that you might encounter before logging into gnome desktop:
Could not update .ICEauthority file  /var/lib/gdm3/.ICEauthority
I have resolved this problem by simply removing that file and let gdm3 daemon re-create it. The commands below must be executed with root privileges.
/etc/init.d/gdm3 stop rm /var/lib/gdm3/.ICEauthority* /etc/init.d/gdm3 start 
perform the above steps from another pseudo terminal (the terminal in which the gnome desktop runs is tty8)


Om namo shridharaya

Sunday, February 5, 2012

Enabling the ability to view Kannada on Linux

Need to install ttf-kannada-fonts package. This package enables us to view text displayed in kedage and mallige fonts. Additional packages may have to be installed for viewing text in other fonts.

Om namo sridharaya.