Create Azure SQL User and add a sql role

I wanted to add a new sql user "sqluser" in Azure SQL server to access a database "sanjeeb".

Steps to create a new SQL user. 

1) Connect to the Azure sql server with existing user using Microsoft SQL Server Management studio

2) Open new query window under Master database

3) Run the below script

CREATE LOGIN [sqllogin] WITH PASSWORD = 'verystrongpassword#1' 

4) Open new query window under database "sanjeeb"
5) Run the below script
-- Add user to the database owner role EXEC sp_addrolemember N'db_owner', N'sqluser' GO
6) You've now created a user login "sqllogin", user account "sqluser" and added the user to "db_owner role"

7) Connect to the database using the new user login account. 
login: sqllogin password:verystrongpassword#1

Scrollable readonly EditView in Kotlin

In the view xml file: <EditTextandroid:id="@+id/etResult" android:layout_width="match_parent" android:layout_height="343dp" android:background="@color/backgroundColor" android:backgroundTint="#00000000" android:ems="10"android:enabled="true"android:fontFamily="sans-serif-condensed"android:gravity="start|top"android:hint="@string/blankfoldermessage"android:importantForAutofill="no"android:inputType="none"android:paddingTop="2dp"android:singleLine="false"tools:targetApi="o" />in the kotlin file (init function): etResult.keyListener = nullthis will allow the edit text to be multiline, not editable but scrollable.

Simple use of Timer in Kotlin

the code below will set the button to clickable after 30 sec:btnOk.isClickable=falseTimer().schedule(timerTask {     btnOk.isClickable=true }, 1000*30)the above code runs in a separate thread, so the UI is responsive while running this code.

Working with UI controls from Non main thread in Kotlin

import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread

fun anyFunction(){ doAsync {// Normal code inside Async threadI=I+1If(I=100){uiThread { tvResult.setText =”I is now 100!!”}}//More codeIf(x==0){uiThread { tvResult.setText =”there’s some problem!”}} }}
Note: - you can include multiple uiThread inside same doAsync           - you can include multiple doAsync inside any function

Permission request pop up in android

Request user to give permission to read external storage in Android - (Kotlin)if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { // Permission is not granted // Should we show an explanation?if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_EXTERNAL_STORAGE)) { } else { // No explanation needed, we can request the permission.ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), READ_STORAGE_CODE); } } else { // Permission has already been granted}NOTE: READ_STORAGE_CODE is just an int constant with fix value like 1001, or 2023and is a variable in class level.

TFS -GIT CertGetCertificateChain trust error CERT_TRUST_IS_UNTRUSTED_ROOT

Problem 1)
2019-07-02T14:19:12.5157398Z fatal: unable to access '': SSL certificate problem: unable to get local issuer certificate 2019-07-02T14:19:12.9764145Z ##[error]Git fetch failed with exit code: 128 2019-07-02T14:19:12.9861630Z ##[section]Finishing: Get Sources

In the TFS_Build Server or App server(if build and app server is in the same machine) >

run the script from this url:

Once this is done, you should get another problem:

Problem 2)  CertGetCertificateChain trust error CERT_TRUST_IS_UNTRUSTED_ROOT

2019-07-02T14:24:57.1800199Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ***" fetch --tags --prune --progress --no-recurse-submodules origin 2019-07-02T14:24:57.4540146Z fatal: unable to access '…

Insert Identity Column in a table

insert an identity column in that table by using the following code: