13 Mayıs 2020 Çarşamba

SINGLE USER modundan veritabanını MULTI USER olarak ayarlama

use master
GO

select 
    d.name, 
    d.dbid, 
    spid, 
    login_time, 
    nt_domain, 
    nt_username, 
    loginame
from sysprocesses p 
    inner join sysdatabases d 
        on p.dbid = d.dbid
where d.name = 'dbname'
GO

kill 56 --=> kill the number in spid field
GO

exec sp_dboption 'dbname', 'single user', 'FALSE'
GO
 
 
 
 
https://stackoverflow.com/questions/14652923/set-database-from-single-user-mode-to-multi-user 

Is there any way to get a list of open/allocated cursors in SQL server?

USE MASTER
GO
select s.session_id, s.host_name, s.program_name, s.client_interface_name, s.login_name
, c.cursor_id, c.properties, c.creation_time, c.is_open, con.text,
l.resource_type, d.name, l.request_type, l.request_Status, l.request_reference_count, l.request_lifetime, l.request_owner_type
from sys.dm_exec_cursors(0) c
left outer join (select * from sys.dm_exec_connections c cross apply sys.dm_exec_sql_text(c.most_recent_sql_handle) mr) con on c.session_id = con.session_id
left outer join sys.dm_exec_sessions s on s.session_id = c.session_id
left outer join sys.dm_tran_locks l on l.request_session_id = c.session_id
left outer join sys.databases d on d.database_id = l.resource_database_id


Açık kalan Cursorları listeleme


Kaynak: https://stackoverflow.com/questions/265605/is-there-any-way-to-get-a-list-of-open-allocated-cursors-in-sql-server

6 Kasım 2019 Çarşamba

why we use moduleId:module.id in angular2


relative assets for components, like templateUrl and styleUrls in the @Component decorator.
moduleId is used to resolve relative paths for your stylesheets and templates as it says in the documentation.
Without Module ID
@Component({
  selector: 'my-component',
  templateUrl: 'app/components/my.component.html',
  styleUrls:  ['app/components/my.component.css'] 
})
With Module ID
@Component({
  moduleId: module.id,
  selector: 'my-component',
  templateUrl: 'my.component.html', 
  styleUrls:  ['my.component.css'] 
})

21 Mart 2019 Perşembe

Json Data verilen navigasyon içeriğini getirme

getDataByNav(dataNav: string, response: any) {
const navs = dataNav.split('.');
let lastObj = Object.assign([], response);
if (navs && navs.length > 0) {
for (let i = 0; i < navs.length; i++) {
lastObj = lastObj[navs[i].toString()]
}
}
return lastObj;
}

9 Ocak 2019 Çarşamba

ng build

ng build --prod --env=env_name --app=appname --base-href /app_name_path/ 

25 Aralık 2018 Salı

Copy Paste Trim and Only Numeric

import { OnInit, Directive, HostListener, EventEmitter, Output } from "@angular/core";

@Directive({
selector: "[copyPasteTrimAndOnlyNumeric]",
providers: []
})
export class CopyPasteTrimAndOnlyNumericDirective {

@Output() ngModelChange: EventEmitter<any> = new EventEmitter();
value: any;

constructor() { }

ngOnInit(): void { }

@HostListener('paste', ['$event']) onPaste(e: ClipboardEvent) {
debugger
e.preventDefault();
let pastedText = e.clipboardData.getData('text');
if (pastedText) {
pastedText = pastedText.replace(/[^0-9]+/g, '')
if (pastedText && pastedText.length > 11)
pastedText = pastedText.substring(0, 11);
this.ngModelChange.emit(pastedText);
}
}
}

3 Aralık 2018 Pazartesi

Enum Display Name'ini çekme

using System;
using System.ComponentModel.DataAnnotations;
using System.Reflection;

public static class EnumExtensions
{
    public static string GetDisplayName(this Enum enu)
    {
        var attr = GetDisplayAttribute(enu);
        return attr != null ? attr.Name : enu.ToString();
    }

    public static string GetDescription(this Enum enu)
    {
        var attr = GetDisplayAttribute(enu);
        return attr != null ? attr.Description : enu.ToString();
    }

    private static DisplayAttribute GetDisplayAttribute(object value)
    {
        Type type = value.GetType();
        if (!type.IsEnum)
        {
            throw new ArgumentException(string.Format("Type {0} is not an enum", type));
        }

        // Get the enum field.
        var field = type.GetField(value.ToString());
        return field == null ? null : field.GetCustomAttribute<DisplayAttribute>();
    }
}

.net 6 mapget kullanımı

 app.UseEndpoints(endpoints => {     endpoints.MapGet("/", async context =>     {         var response = JsonConvert.Seriali...