Posted on Leave a comment

Quicksort Algorithm – Cesar’s Tech Insights – Medium

“What is Quicksort?” This is another question you’ll face in almost every tech job interview. Quicksort it is probably the most used sorting algorithm because it’s easy to implement on average, gives high efficiency for large-data applications, it can be optimized for different needs and it’s relatively flexible on it’s input data.

Quicksort is a logarithmic-time algorithm, in other words, it has a Big O notation of O(log n)-(more about Big O Notation)- and depending on the way you implement it, it can be up to 2x or even 3x faster than Merge Sort or Heap Sort. Do note that the O(log n) speed is a best-case/average time, in worst case scenarios it can be O(n2) depending on the implementation.

Let’s explore one implementation of Quicksort using JavaScript (ECMA6):

const quickSort = list => {
  if (list.length < 2) 
    return list;  let pivot = list[0];
  let left  = []; 
  let right = [];  for (let i = 1, total = list.length; i < total; i++){
    if (list[i] < pivot)
      left.push(list[i]);
    else
      right.push(list[i]);
  }  return [
    ...quickSort(left), 
    pivot, 
    ...quickSort(right)
  ];
};

Quicksort uses recursiondivide-and-conquer and comparison-sort. It works by partitioning an array into two sub-arrays and then recursively sorting those arrays independently. To make it clear, let’s put this in 3 main steps:

  • Choose the pivot (reference value).
  • Divide the rest of the array in two, placing everything smaller than the pivot on the left and greater than the pivot on the right.
  • Recursively apply the previous steps to the sub-arrays if they have more than 1 element.

In the following chart you can see our example algorithm in action; pivots are green, left arrays are red, and right ones are blue.

quickSort( [6,3,8,4,5,2,9,33,12,64]) = [2, 3, 4, 5, 6, 8, 9, 12, 33, 64]

Another great advantage of Quicksort is that it can be implemented using task parallelism, so, with some tweaking of the code it can be used to get a great performance boost in multi-core processing or even better, GPU processing for extreme performance.

Although JavaScript is a single-threaded language, if your application requires a lot of power, you can enable parallel high-performance GPU processing via WebCL or use NodeJS and a library called node-cuda, the latter allows you to use NVIDIA CUDA™ -although you need an NVIDIA CUDA-enabled GPU-, but with hundreds of compatible models, you probably can get some science out of your current gaming computer!

Source: Quicksort Algorithm – Cesar’s Tech Insights – Medium

Posted on Leave a comment

.NET Design Patterns in C# and VB.NET – Gang of Four (GOF) – doFactory.com

Design patterns are solutions to software design problems you find again and again in real-world application development. Patterns are about reusable designs and interactions of objects.

The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral (for a complete list see below).

To give you a head start, the C# source code for each pattern is provided in 2 forms: structural and real-world. Structural code uses type names as defined in the pattern definition and UML diagrams. Real-world code provides real-world programming situations where you may use these patterns.

A third form, .NET optimized, demonstrates design patterns that fully exploit built-in .NET 4.5 features, such as, generics, attributes, delegates, reflection, and more. These and much more are available in our .NET Design Pattern Framework 4.5. You can see the Singleton page for a .NET 4.5 Optimized example.

Source: .NET Design Patterns in C# and VB.NET – Gang of Four (GOF) – doFactory.com

Posted on Leave a comment

Create SQL Server Database Project With Visual Studio

When we work on any project, a database plays an important role and after time when the number of tables, views and procedures increases – it becomes too difficult to manage the scripts. And even after that when we manage the scripts, then we still need to compare which script we had worked on and which are remaining on any particular database. There are many good tools available in the market for comparing databases but most of them are paid. So, in this article we’re going to learn about how to we can m

Source: Create SQL Server Database Project With Visual Studio

Posted on Leave a comment

c# – LDAP – Retrieve a list of all attributes/values? – Stack Overflow

foreach (string propName in props.PropertyNames) { if (entry.Properties[propName].Value != null) { Console.WriteLine(propName + ” = ” + entry.Properties[propName].Value.ToString()); } else { Console.WriteLine(propName + ” = NULL”); } }

Source: c# – LDAP – Retrieve a list of all attributes/values? – Stack Overflow

Posted on Leave a comment

Setting And Reading Values From “appsettings.json” In .NET Core

In this article, we are going to learn how to read values from  “appsettings.json” file. You will ask why we want to read values from “appsettings.json” and what is there in “appsettings.json” that we would want to read it. The “appsettings.json” file contains configuration settings. This file is similar to the Web.config file. In this file, we mostly store global values so that we can read those in the entire application. But Web.config file is in XML format and “appsettings.json” file is JSON format. We

Source: Setting And Reading Values From “appsettings.json” In .NET Core

Posted on Leave a comment

Scaffold Identity in ASP.NET Core projects | Microsoft Docs

Scaffold Identity in ASP.NET Core projects 10/23/2018 12 minutes to read +1 By Rick Anderson ASP.NET Core 2.1 and later provides ASP.NET Core Identity as a Razor Class Library. Applications that include Identity can apply the scaffolder to selectively add the source code contained in the Identity Razor Class Library (RCL). You might want to generate source code so you can modify the code and change the behavior. For example, you could instruct the scaffolder to generate the code used in registrati

Source: Scaffold Identity in ASP.NET Core projects | Microsoft Docs

Posted on Leave a comment

Set up a single-app kiosk (Windows 10) | Microsoft Docs

Set up a single-app kiosk

  • Windows 10 Pro, Enterprise, and Education
A single-app kiosk uses the Assigned Access feature to run a single app above the lockscreen.

When the kiosk account signs in, the app is launched automatically. The person using the kiosk cannot do anything on the device outside of the kiosk app.

Illustration of a single-app kiosk experience

 Important

User account control (UAC) must be turned on to enable kiosk mode.

Kiosk mode is not supported over a remote desktop connection. Your kiosk users must sign in on the physical device that is set up as a kiosk.

You have several options for configuring your single-app kiosk.

Method Description
Locally, in Settings The Set up a kiosk (previously named Set up assigned access) option in Settings is a quick and easy method to set up a single device as a kiosk for a local standard user account.

This method is supported on Windows 10 Pro, Enterprise, and Education.

PowerShell You can use Windows PowerShell cmdlets to set up a single-app kiosk. First, you need to create the user account on the device and install the kiosk app for that account.

This method is supported on Windows 10 Pro, Enterprise, and Education.

The kiosk wizard in Windows Configuration Designer Windows Configuration Designer is a tool that produces a provisioning package, which is a package of configuration settings that can be applied to one or more devices during the first-run experience (OOBE) or after OOBE is done (runtime). You can also create the kiosk user account and install the kiosk app, as well as other useful settings, using the kiosk wizard.

This method is supported on Windows 10 Pro (version 1709 and later), Enterprise, and Education.

Microsoft Intune or other mobile device management (MDM) provider For managed devices, you can use MDM to set up a kiosk configuration.

This method is supported on Windows 10 Pro (version 1709 and later), Enterprise, and Education.

Source: Set up a single-app kiosk (Windows 10) | Microsoft Docs