John Liu Blog

Every drop counts

Docker notes

Get help docker --help List all existing containers (without truncating result string) docker ps -a --no-trunc Start a container (containner name is case sensitive) docker start <container name> Show current downloaded images docker images To download an image from a registry (use :latest or :1.2.3 tag for specific version) docker pull <docker_image>:latest To create and run a containner (use create instead of run to just create a containner) docker run -it --name DataApiBuilder -v "c:\DataAPIBuilder\Samples:/App/Samples" -p 5004:5000 mcr.

SQL Server with minimal configuration

There are time that the SQL Server instance might not be able to start up due to tempdb files are not accessable. To change the tempdb file location, you can start up the instance with minimal configuration, using parameter -f net start mssql$NamedInstance -f You can also use trace flag 3608 that tells SQL Server not to start up/recover any database but master. Once the instance is start up, you can then connect using either SQLCMD for SSMS to change the tempdb file location.

Azure OpenAI Troubleshooting

Access denied due to Virtual Network/Firewall rules When making calls to your OpenAI deployed model, you may receive following error: “Access denied due to Virtual Network/Firewall rules.” As the error message suggested, check the “Firewalls and virtual networks” setting for you Azure OpenAI in Azure Portal under “Resource Management” –> “Networking”. If the firewalls are configured for “Selected Networks and Private Endpoints”, make sure the IP address of you current computer is allowed to access the network.

SSMS Default Query Template

Within SSMS, by default when click on New Query, we get a blank query window. If we want to add something to the window each time a new query window is opened, we can achieve this by editing the default template. The template file SQLFile.sql, (for example, for SSMS19) is located under: C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE\SqlWorkbenchProjectItems\Sql\ Whatever we put in this file, will then appear when open a new query window.

How to convert a single-client database to multi-client database

Consider you have a database (with single dbo schema) that’s design to be used by a single client. How can you turn the database to be multi-client database with minimal impact to your existing application? Row Level Security (RLS) could provide a considerably easily solution. Some assumptions: Your application code or database object (trigger, SP, function etc.) code doesn’t hard code schema name (as we will using schema to separate each client) Your application needs to be able to using different login for different client when connect to the database Same login will not be access more than one client data Following are the steps to convert the database.