Skip to content

Instantly share code, notes, and snippets.

View kad1r's full-sized avatar

Kadir Avcı kad1r

View GitHub Profile
@kad1r
kad1r / dotnetcore_.md
Last active September 21, 2022 13:03
An error occurred attempting to determine the process id of application.exe which is hosting your application

If you try to run your dotnetcore application and get one of these errors:

  1. Failed to register URL "http://localhost:55977/" for site "ApplicationName" application "/". Error description: Access is denied. (0x80070005)
  2. An error occurred attempting to determine the process id of application.exe which is hosting your application. An error occurred while sending the request.

Solution

Do not forget to change your port number. It will be your project url port.

netsh http show urlacl
netsh http add urlacl url=http://*:56183/ user=everyone
netsh http delete urlacl http://*:56183/

@kad1r
kad1r / code_review.md
Created September 19, 2022 09:06
Code Review

Code Review

  • Check if there are any conflicts
  • Check naming and self documentation
  • Boolean values should begin with is, can, must, will etc
  • Check usage of pascal and camelcase
  • Check if, switch, while conditions
  • Commented codes should be deleted
  • Check unused variables and functions
  • Check line spacing
  • Check if all errors are handled
@kad1r
kad1r / docker_commands.md
Last active October 28, 2022 10:21
Docker Commands on Local Development

DOCKER COMMANDS

Run docker:

docker run --name DockerPostgreSQL -p 5455:5432 -e POSTGRES_USER=sa -e POSTGRES_PASSWORD=sa -e POSGRES_DB=postgresDB -d postgres

  1. docker run is the command used to create and run a new container based on an already downloaded image.
  2. --name DockerPostgreSQL is the name we assign to the container that we are creating.
  3. -p 5432:5432 is the port mapping. Postgres natively exposes the port 5432, and we have to map that port (that lives within Docker) to a local port. In this case, the local 5455 port maps to Docker's 5432 port.
  4. -e POSTGRES_USER=sa, -e POSTGRES_PASSWORD=sa, and -e POSTGRES_DB=postgresDB set some environment variables. Of course, we're defining the username and password of the admin user, as well as the name of the database.
  5. -d indicates that the container run in a detached mode. This means that the container runs in a background process.
    postgres is the name of the image we are using to create the container.
  6. postgres indicate
@kad1r
kad1r / postgres_partition_on_existing_table.sql
Last active February 6, 2025 11:32
PostgreSQL partition existing table
select integration_type, count(*) from integration_logs group by integration_type order by 2 desc;
select time_stamp from integration_logs order by time_stamp asc limit 1;
select time_stamp from integration_logs order by time_stamp desc limit 1;
insert into integration_logs (id, time_stamp, utc_time_stamp, integration_data, post_data_list, status, idoc_number, document_number, log_type, integration_data_type, integration_type, integration_message_type, message, ref_code, request_data, update_logs, "user", ref_number, re_execute)
select id, time_stamp, utc_time_stamp, integration_data, post_data_list, status, idoc_number, document_number, log_type, integration_data_type, integration_type, integration_message_type, message, ref_code, request_data, update_logs, "user", ref_number, re_execute
from integration_logs_old where time_stamp between '2020-01-01' and '2021-06-01';
select * from integration_logs_202102 limit 1000;
select * from integration_logs_202201 limit 100;
declare @from int
declare @leap int
declare @to int
declare @datafile varchar(128)
declare @cmd varchar (512)
/*settings*/
set @from = 200000 /*Current size in MB*/
set @to = 180000 /*Goal size in MB*/
set @datafile = 'TESTDB' /*Datafile name*/
set @leap = 500 /*Size of leaps in MB*/
@kad1r
kad1r / backup_all.sql
Created February 15, 2022 09:37
Backup all databases in SQL SERVER
DECLARE @name NVARCHAR(256) -- database name
DECLARE @path NVARCHAR(512) -- path for backup files
DECLARE @fileName NVARCHAR(512) -- filename for backup
DECLARE @fileDate NVARCHAR(40) -- used for file name
-- specify database backup directory
SET @path = 'C:\SQLBACKUP\'
-- specify filename format
SELECT @fileDate = CONVERT(NVARCHAR(20),GETDATE(),112) + '_' + REPLACE(CONVERT(NVARCHAR(20),GETDATE(),108),':','')
@kad1r
kad1r / code_review.md
Last active January 11, 2022 09:46
Code Review [Turkish]

Code Review Yaparken Dikkat Edilmesi Gerekenler

  • Merge/Pull Request açıklaması yeterli mi?
  • Performans etkileyen ve mantık hataları olan kısımları tespit edildi mi?
  • Unit test'ler yeterli mi?
  • Kod standartlarına uyuyor mu?

Code Review
Kaynak

@kad1r
kad1r / clean_code.md
Created November 9, 2021 05:24 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
module.exports = {
root: true,
env: {
node: true
},
extends: ["plugin:vue/essential", "@vue/prettier"],
rules: {
"prettier/prettier": "error",
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",