The basic usage is:
mysql> CREATE USER 'my_new_user'@'localhost' IDENTIFIED BY 'test_password';
However for situations where is not advisable to hard-code the password in cleartext it is also possible to specify directly, using the directive PASSWORD, the hashed value as returned by the PASS...
Bucket Sort is a sorting algorithm in which elements of input array are distributed in buckets. After distributing all the elements, buckets are sorted individually by another sorting algorithm. Sometimes it is also sorted by recursive method.
Pseudo code for Bucket Sort
Let n be the length of t...
Counting sort is an integer sorting algorithm for a collection of objects that sorts according to the keys of the objects.
Steps
Construct a working array C that has size equal to the range of the input array A.
Iterate through A, assigning C[x] based on the number of times x appeared in A.
Tr...
Cycle Sort is sorting algorithm which uses comparison sort that is theoretically optimal in terms of the total number of writes to original array, unlike any other in-place sorting algorithm. Cycle sort is unstable sorting algorithm. It is based on idea of permutation in which permutations are facto...
ASP.NET identity is a membership management system which allows a user to register and login into a web application. ASP.NET identity system can be used in entire ASP.NET framework, like ASP.NET MVC, Web Forms, Web Pages, Web API and SignalR. ASP.NET identity can be used when people are building a w...
Just like in C, Rust raw pointers can point to other raw pointers (which in turn may point to further raw pointers).
// Take a regular string slice
let planet: &str = "Earth";
// Create a constant pointer pointing to our string slice
let planet_ptr: *const &str = &planet ...
Heap sort is a comparison based sorting technique on binary heap data structure. It is similar to selection sort in which we first find the maximum element and put it at the end of the data structure. Then repeat the same process for the remaining items.
Pseudo code for Heap Sort:
function heapsor...
Note: at is not installed by default on most of modern distributions.
To execute a job once at some other time than now, in this example 5pm, you can use
echo "somecommand &" | at 5pm
If you want to catch the output, you can do that in the usual way:
echo "somecommand > o...
Pigeonhole Sort is a sorting algorithm that is suitable for sorting lists of elements where the number of elements (n) and the number of possible key values (N) are approximately the same. It requires O(n + Range) time where n is number of elements in input array and ‘Range’ is number of possible va...
Radix Sort is lower bound comparison based algorithm. It is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by individual digits which share some significant position and value. Radix sort is a linear time sorting algorithm that sort in O(n+k) time whe...
DBCC commands can show information about database objects.
DBCC PROCCACHE
Displays information in a table format about the procedure cache.
DBCC OUTPUTBUFFER ( session_id [ , request_id ])
Returns the current output buffer in hexadecimal and ASCII format for the specified session_id (and o...
Since defining all of the authorization logic in the AuthServiceProvider could become cumbersome in large applications, Laravel allows you to split your authorization logic into "Policy" classes. Policies are plain PHP classes that group authorization logic based on the resource they autho...
a = [1, 2, 3, 4, 5]
# steps through the list backwards (step=-1)
b = a[::-1]
# built-in list method to reverse 'a'
a.reverse()
if a = b:
print(True)
print(b)
# Output:
# True
# [5, 4, 3, 2, 1]
def shift_list(array, s):
"""Shifts the elements of a list to the left or right.
Args:
array - the list to shift
s - the amount to shift the list ('+': right-shift, '-': left-shift)
Returns:
shifted_array - the shifted list
"&quo...
SQL Query optimizer will choose the baes possible plan that he can find for some query. If you can find some plan that works optimally for some query, you can force QO to always use that plan using the following stored procedure:
EXEC sp_query_store_unforce_plan @query_id, @plan_id
From this poi...
This document details the steps to obtain the facebook access tokens and the using the tokens to fetch FB feeds.
Example:
A live example is available in
https://newtonjoshua.com
Introduction to Graph API:
The Graph API is the primary way to get data in and out of Facebook's platform. It's a...
An Odd-Even Sort or brick sort is a simple sorting algorithm, which is developed for use on parallel processors with local interconnection. It works by comparing all odd/even indexed pairs of adjacent elements in the list and, if a pair is in the wrong order the elements are switched. The next step ...
Catalan numbers algorithm is Dynamic Programming algorithm.
In combinatorial mathematics, the Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects. The Catalan numbers on nonnegative integers n are a set of numbers t...
When defining a new trait it is possible to enforce that types wishing to implement this trait verify a number of constraints or bounds.
Taking an example from the standard library, the DerefMut trait requires that a type first implement its sibling Deref trait:
pub trait DerefMut: Deref {
fn...
import pygame
file = 'some.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play(-1) # If the loops is -1 then the music will repeat indefinitely.