Regular Expression Password Validation

^ The password string will start this way
(?=.*[a-z]) The string must contain at least 1 lowercase alphabetical character
(?=.*[A-Z]) The string must contain at least 1 uppercase alphabetical character
(?=.*[0-9]) The string must contain at least 1 numeric character
(?=.*[!@#\$%\^&\*]) The string must contain at least one special character, but we are escaping reserved RegEx characters to avoid conflict
(?=.{8,}) The string must be eight characters or longer

WPF Enforce Single Instance Application

protected override void OnStartup(StartupEventArgs e)
// Single instance application logic

// Get Reference to the current Process
Process thisProc = Process.GetCurrentProcess();
// Check how many total processes have the same name as the current one
if (Process.GetProcessesByName(thisProc.ProcessName).Length > 1)
// If ther is more than one, than it is already running.
MessageBox.Show(“Application is already running.”, “Error”, MessageBoxButton.OK, MessageBoxImage.Stop);

// End single instance application logic



Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException1;


Enforce SSL in Plesk

<!– Enforce SSL –>
<rule name=”HTTP to HTTPS redirect” stopProcessing=”true”>
<match url=”(.*)” />
<add input=”{HTTPS}” pattern=”off” ignoreCase=”true” />
<action type=”Redirect” redirectType=”Permanent” url=”https://{HTTP_HOST}/{R:1}” />
<!– End enforce SSL –>

WPF Multi Threading

What you want to do is run the long running processes off the UI thread then when it is finishedupdate the UI – which the Dispatcher helps you to:

  1. Start long process on another thread and return immediately.
  2. (long process still running, UI continues to update)
  3. Long process finishes, update the UI on the UI thread.


    private void UpdateButtonContent(string text)
        button.Content = text;

    private void SimLongRunningProcess()

    private void OnProcessFinished(Task task)
        string content;
        if(task.Exception != null)
            content = task.Exception.Message;
            content = "Success";

        Dispatcher.BeginInvoke(new Action<string>(UpdateButtonContent), DispatcherPriority.Normal, content);

    private void Button_Click(object sender, RoutedEventArgs e)
        // Start long running process and return immediatly
        var task = Task.Factory.StartNew(SimLongRunningProcess);

Youtube API get video url after video upload

You can have the video url like this :

You have the result :

     "kind": "youtube#searchResult",
"etag": "\"adasdasdasdasdas"",
"id": {
"kind": "youtube#video",
"videoId": "123123asdsad12"

Now you get the field "videoId": "123123asdsad12"

And you can acces to the video via the link:

And that’s it !

OPENJSON requires Compatibility Level 130

The OPENJSON function is available only under compatibility level 130. If your database compatibility level is lower than 130, SQL Server can’t find and run the OPENJSON function. Other built-in JSON functions are available at all compatibility levels.

You can check compatibility level in the sys.databases view or in database properties.

You can change the compatibility level of a database by using the following command: