Skip to content

Instantly share code, notes, and snippets.

View boubkhaled's full-sized avatar
🗨️
الحمد لله على نعمة الإسلام

Khaled boubkhaled

🗨️
الحمد لله على نعمة الإسلام
View GitHub Profile
@boubkhaled
boubkhaled / ملخص كتاب الوسائل المفيدة للحياة السعيدة.md
Created March 17, 2024 08:43
ملخص كتاب الوسائل المفيدة للحياة السعيدة

image

@boubkhaled
boubkhaled / PostgreSQL Updating sequence values from table.sql
Created February 1, 2024 09:49
PostgreSQL Updating sequence values from table
-- Tested with PostgreSQL 16
-- Source: https://wiki.postgresql.org/wiki/Fixing_Sequences
SELECT
'SELECT SETVAL(' ||
quote_literal(quote_ident(sequence_namespace.nspname) || '.' || quote_ident(class_sequence.relname)) ||
', COALESCE(MAX(' ||quote_ident(pg_attribute.attname)|| '), 1) ) FROM ' ||
quote_ident(table_namespace.nspname)|| '.'||quote_ident(class_table.relname)|| ';'
FROM pg_depend
INNER JOIN pg_class AS class_sequence
ON class_sequence.oid = pg_depend.objid
@boubkhaled
boubkhaled / Implement Notification System with MediatR.md
Created January 9, 2024 13:24
Implement Notification System with MediatR

1704792963724

@boubkhaled
boubkhaled / Allow_CORS_Asp.net_Framework_Global.asax.cs
Created November 28, 2023 10:16
Allow CORS Asp.net Framework in Global.asax.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Http;
namespace App
{

Starting Postgresql in Windows without Install

Problem

This is a question that comes up quite often by windows users, so thought we would share how we normally do it. The question is

Can you run a PostgreSQL server on your windows desktop/server box without having to install anything?

The answer is

@boubkhaled
boubkhaled / iis_503_error_2.md
Created June 4, 2023 12:59
HTTP response 503 Service Unavailable from IIS: one common generic cause - Microsoft Community Hub

HTTP response 503 Service Unavailable from IIS: one common generic cause - Microsoft Community Hub

Published Sep 28 2020 06:07 AM 178K Views

TL;DR:

The 503 response from the IIS machine, Service Unavailable, is the result of repeated application crashes. Since the w3wp.exe worker process, created by IIS to execute a web application, is crashing frequently, the respective IIS application pool is turned off. This is a feature of IIS, at Application Pool level, called Rapid-Fail Protection. It helps prevent consuming valuable system resources creating a worker process that crashes anyway, soon after spawning.

@boubkhaled
boubkhaled / #15 Stefan's Newsletter: Global Error Handling in .NET.md
Last active May 29, 2023 08:52
#15 Stefan's Newsletter: Global Error Handling in .NET

Global Error Handling in .NET

Today we will show in a quick and simple way how we can handle errors at the global level of the application within just one file.

Global error handling in .NET allows developers to centralize error or exception handling in a single location rather than scattering error handling code across the application.

In .NET 5+, the recommended approach to implement global error handling is using middleware.

This is absolutely the simplest and most effective way, the implementation of which takes only 5 minutes. Now I will show you how to do it.

@boubkhaled
boubkhaled / ZZZ_Countries.sql
Last active February 9, 2023 10:58
الدول | Countries | Pays
CREATE TABLE [dbo].[ZZZ_Countries](
[Name] [nvarchar](max) NULL,
[Code] [nvarchar](max) NULL,
[Dialing] [nvarchar](max) NULL,
[Nom] [nvarchar](max) NULL,
[Code1] [nvarchar](max) NULL,
[Code2] [nvarchar](max) NULL,
[Nombre] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO