Saturday, 23 September 2023

rrt

 https://javarevisited.blogspot.com/2018/09/10-devops-courses-for-experienced-java-developers.html#axzz8EC2suLTt

Thursday, 21 September 2023

Convert table into typescript model

  declare @TableName sysname = '[tbl_AppsInfo]'

declare @Result varchar(max) = 'export class ' + @TableName + '{'

select @Result = @Result + '

     ' + ColumnName   + '! :' +ColumnType  + ' ;'

from(    select 

        replace(col.name, ' ', '_') ColumnName,

        column_id ColumnId,

        case typ.name 

            when 'bigint' then 'number'

            when 'binary' then 'boolean'

            when 'bit' then 'boolean'

            when 'char' then 'string'

            when 'date' then 'Date'

            when 'datetime' then 'Date'

            when 'datetime2' then 'Date'

            when 'datetimeoffset' then 'Date'

            when 'decimal' then 'number'

            when 'float' then 'number'

            when 'image' then 'string'

            when 'int' then 'number'

            when 'money' then 'number'

            when 'nchar' then 'string'

            when 'ntext' then 'string'

            when 'numeric' then 'number'

            when 'nvarchar' then 'string'

            when 'real' then 'number'

            when 'smalldatetime' then 'Date'


            when 'smallint' then 'number'


            when 'smallmoney' then 'number'


            when 'text' then 'string'

            when 'time' then 'TimeSpan'

            when 'timestamp' then 'long'

            when 'tinyint' then 'byte'

            when 'uniqueidentifier' then 'Guid'

            when 'varbinary' then 'byte[]'

            when 'varchar' then 'string'

            else 'UNKNOWN_' + typ.name

        end ColumnType,

        case 

            when col.is_nullable = 1 and typ.name in ('bigint', 'bit', 'date', 'datetime', 'datetime2', 'datetimeoffset', 'decimal', 'float', 'int', 'money', 'numeric', 'real', 'smalldatetime', 'smallint', 'smallmoney', 'time', 'tinyint', 'uniqueidentifier') 

            then '?' 
            else '' 

        end NullableSign

    from sys.columns col

        join sys.types typ on

            col.system_type_id = typ.system_type_id AND col.user_type_id = typ.user_type_id

    where object_id = object_id(@TableName)

) t

order by ColumnId

set @Result = @Result  + '}'

print @Result

Tuesday, 19 September 2023

SQL server get latest excuted querires list

 SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.*

FROM sys.dm_exec_query_stats AS deqs

CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest

WHERE dest.dbid = DB_ID('dbname')

ORDER BY deqs.last_execution_time DESC

Wednesday, 13 September 2023

Dapper Use cases

 

  1. var sql = "select * from products";
  2. var products = new List<Product>();
  3. using (var connection = new SqlConnection(connString))
  4. {
  5. connection.Open();
  6. using (var command = new SqlCommand(sql, connection))
  7. {
  8. using (var reader = command.ExecuteReader())
  9. {
  10. var product = new Product
  11. {
  12. ProductId = reader.GetInt32(reader.GetOrdinal("ProductId")),
  13. ProductName = reader.GetString(reader.GetOrdinal("ProductName")),
  14. SupplierId = reader.GetInt32(reader.GetOrdinal("SupplierId")),
  15. CategoryId = reader.GetInt32(reader.GetOrdinal("CategoryId")),
  16. QuantityPerUnit = reader.GetString(reader.GetOrdinal("QuantityPerUnit")),
  17. UnitPrice = reader.GetDecimal(reader.GetOrdinal("UnitPrice")),
  18. UnitsInStock = reader.GetInt16(reader.GetOrdinal("UnitsInStock")),
  19. UnitsOnOrder = reader.GetInt16(reader.GetOrdinal("UnitsOnOrder")),
  20. ReorderLevel = reader.GetInt16(reader.GetOrdinal("ReorderLevel")),
  21. Discontinued = reader.GetBoolean(reader.GetOrdinal("Discontinued")),
  22. DiscontinuedDate = reader.GetDateTime(reader.GetOrdinal("DiscontinuedDate"))
  23. };
  24. products.Add(product);
  25. }
  26. }
  27. }
At its most basic level, Dapper replaces the highlighted block of assignment code in the example above with the following:

  1. products = connection.Query<Product>(sql).ToList();

Excute Stored Procedure
  1. using(var connection = new SqlConnection(connectionString))
  2. {
  3. // Execute the stored procedure
  4. var result = connection.Query<Customer>(
  5. "MyStoredProcedure",
  6. commandType: CommandType.StoredProcedure
  7. ).ToList();
  8. }

Thursday, 7 September 2023

How to connect android to mobile phone

 1.In mobile goto settings click on about phone.

2. Then select About Phone option and tap on MIUI version several times.

3After a few taps you will gain Developer permissions

4.Now choose Additional Settings and Developer options

5.now in android studio click on pair device


4If paring taking more time then managed to find the solution. You have to follow the following steps:
  1. In your smartphone (Go to Settings->Developer options-> Wireless Debugging->Pair device with pairing code).
  2. Copy the ipaddress & port. For example: 192.168.1.2:42123 and wifi pairing code: 234321.
  3. Open your terminal and go to the following path: cd %LOCALAPPDATA%/Android/sdk/platform-tools
  4. Paste the following command following this order: adb pair (ipaddress & port that you saw when you clicked on "Pair device with pairing code") abd pair 192.168.1.2:42123
  5. Paste the access code to the wifi connection. Enter pairing code: 41107.
  6. check in phone the port number write the following command: adb connect 192.168.1.2:41107

If you see a message like this in your mobile "connected to 192.168.1.2:41107", you did it you will be able to connect your phone with android studio without any problem.


to install apk in mobile follow few setting in mobile



c#

 https://github.com/dcyuksel/Result