Monday, July 8, 2019

Docker inspect image content tricks

Sometimes one might wonder what exactly the image looks like once run as a container. This is particularly useful for debugging. 

Docker run command help us solve this problem. 

docker run -it --rm to do two things, first, automatically use the current terminal to connect to the container, and then when the container finishes, remove it.  Now we change the entry point to use bash (or cmd.exe for windows containers).

c:\Docker>docker run -it --rm --entrypoint "bash" reposit:v4
root@35b518b7b518:/home/reposit# ls
data  node_modules  package-lock.json  package.json  repositConnector.js
root@35b518b7b518:/home/reposit#

Sunday, June 9, 2019

Export Azure DevOps TFVC repo to Github

Step 1:
Azure TFVC Repo -> Azure Git Repo 
https://docs.microsoft.com/en-us/azure/devops/learn/git/migrate-from-tfvc-to-git

Step 2:
Azure Git Repo -> GitHub

  1. Enable alternate authentication credentials and specify user name and password
  2. Go to a repository of your project (Code=>Files), click Clone to get the HTTPS URL.
  3. Go to Github=>Import repository
  4. Type repository URL (step 2)
  5. Type alternate authentication credentials (step 1) when it asks for credential
https://developercommunity.visualstudio.com/content/problem/449985/export-devops-repos-to-github.html

Wednesday, February 26, 2014

Microsoft.SqlServer.Management.SMO

Hi All,

I’ve been using SMO heavily in my OSR data migration piece of work, and I’d like to share that with you.  To put SMO into context, I consider it as a programmatic way to interact with SSMS.
For CRUD actions, SqlClient is still very good. Very flexible compared to entity framework.
However, when we need extra flexibility, e.g., create/backup database, create/alter tables, especially running SQL with GO statement, SMO is the way to go.   

I’ve attached a Util class that demonstrates how it can be wrapped, and the dynamic SQL that gets generated by my program and executed via the Util class.

If you would like to know more, plenty of articles on MSND:
SQL Server Management Objects (SMO) is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server


Sqlserver nvarchar ntext difference

Thanks to Graeme for asking an interesting question about the difference between nvarchar and varchar. Since my first language can’t be stored in ACSII, I know nvarchar is the way to go.
Further reading on nvarchar(max) prompted us to think the differences between nvarchar and ntext, and we found the following in MSDN. 

ntext , text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead.

Don’t panic, further version doesn’t include SQLServer 2012.  Read more here:

.Net Entity Framework and DAL

This old post demonstrates some very interesting thoughts about DAL and Entity Framework, and discussed the design pattern (pros and cons) in an architecture point of view. At the last of this post, a ppt is embedded. http://www.wadewegner.com/2009/06/architecting-your-data-access-layer-with-the-entity-framework/
Here are some highlights and my understanding:
·         Use EF as DAL  This is still a good option to replace the CRUD. See my OpsLog comments below about EF.
·         Full Encapsulation of the Entity Framework.  This is the ideal solution but we probably won’t get to the complexity. It reduces coupling and make application testable.
·         Partial Encapsulation of the Entity Framework.  The author didn’t give an example, but I have some in EGMAN.  EGMAN uses MVC and MVVM (MVVM Model-View ViewModel is similar to MVC, Model-View Controller).  I used EF to map db to model (M in MVC), but sometimes lost the flexibility to add custom attribute and data access logic. I adopted MVVM, which use VM to replace C, and VM is the encapsulation of EF that extract data from the Model.