Also known as the Knuth shuffle and the Durstenfeld-Fisher-Yates shuffle. This shuffle takes an array of n elements and shuffles it. The algorithm is truly random in that, after shuffling, each permutation of the array is equally likely.
In java:
public static void shuffle(E[] deck) {
//Fro...
using only the for <timeout> clause, it is possible to get an unconditional wait that lasts for a specific duration. This is not synthesizable (no real hardware can perform this behaviour so simply), but is frequently used for scheduling events and generating clocks within a testbench.
This e...
How to: CALL ANGULAR 2 HTML/JS COMPONENT FROM ASP.NET Core CONTROLLER:
We call the HTML instead return View()
return File("~/html/About.html", "text/html");
And load angular component in the html. Here we can decide if we want to work with same or diferent module. Depends o...
Latest Android Studio will create & integrate a Basic Widget to your Application in 2 steps.
Right on your Application ==> New ==> Widget ==> App Widget
.
It will show a Screen like below & fill the fields
Its Done.
It will create & integrate a basic HelloWorld Widget(I...
A single instance of Node.js runs in a single thread. To take advantage of multi-core systems the user will sometimes want to launch a cluster of Node.js processes to handle the load.
var cluster = require('cluster');
var numCPUs = require('os').cpus().length;
if (cluster...
Alfresco Share is one of the one part of the Alfresco as product- it's user interface on the Alfresco repository (platform), by default it is avaiable on <host>:<port>/share.
It is built on the Surf framework. The Surf framework was developed by Alfresco, but in
2009 Alfresco began wor...
public function createCustomer($data , $token)//pass form data and token id
{
$customer=Customer::create(array(
"email"=>$data['email'],
"description" => $data['name'],
"source" => $token // obtained with Stripe.js
));
return $cus...
doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) bar(1 + 5)
body
h1 Pug - node template engine
#container.col
if youAreUsingPug
p You are amazing
else
p Get on it!
p.
...
all errors and exceptions, both custom and default, are handled by the Handler class in app/Exceptions/Handler.php with the help of two methods.
report()
render()
public function render($request, Exception $e)
{
//check if exception is an instance of ModelNotFoundException.
if ($e in...
First of all: operator << (leftShift) is equivalent of doLast {closure}. From gradle 3.2 it is deprecated. All the task code are writing in a build.gradle.
A task represents some atomic piece of work which a build performs.
This might be compiling some classes, creating a JAR, generating
...
To run WordPress on your computer you need to configurate a database first.
Be sure that Apache and MySQL are running (see Installing XAMPP step 3)
Start a web browser of your choice and enter "localhost" in the address.
Choose your preferred language and select in the category "...
After you installed XAMPP and setup the MySQL database you can install WordPress.
Download the latest version of WordPress.
Unzip the file and insert the folder in the root directory of your webserver (if you used the suggested path during the setup of XAMPP it is "c:\xampp\htdocs").
...
An anonymous, inlined function defined with lambda. The parameters of the lambda are defined to the left of the colon. The function body is defined to the right of the colon. The result of running the function body is (implicitly) returned.
s=lambda x:x*x
s(2) =>4
Map takes a function and a collection of items. It makes a new, empty collection, runs the function on each item in the original collection and inserts each return value into the new collection. It returns the new collection.
This is a simple map that takes a list of names and returns a list of the...
Reduce takes a function and a collection of items. It returns a value that is created by combining the items.
This is a simple reduce. It returns the sum of all the items in the collection.
total = reduce(lambda a, x: a + x, [0, 1, 2, 3, 4])
print(total) =>10
Filter takes a function and a collection. It returns a collection of every item for which the function returned True.
arr=[1,2,3,4,5,6]
[i for i in filter(lambda x:x>4,arr)] # outputs[5,6]