Tutorial by Examples: al

For Each row As DataRow In FooDataTable.Rows Me.RowsToProcess.Add(row) Next Dim myOptions As ParallelOptions = New ParallelOptions() myOptions.MaxDegreeOfParallelism = environment.processorcount Parallel.ForEach(RowsToProcess, myOptions, Sub(currentRow, state) ...
curl -XGET http://www.example.com:9200/myIndexName/_search?pretty=true&q=*:* This uses the Search API and will return all the entries under index myIndexName. Reference Link: Here
Imagine you have all dates in all responses in some custom format, for instance /Date(1465935152)/ and you want apply general rule to deserialize all Json dates to java Date instances. In this case you need to implement custom Json Deserializer. Example of json: { "id": 1, "cr...
Of the LINQ methods which use deferred execution, some require a single value to be evaluated at a time. The following code: var lst = new List<int>() {3, 5, 1, 2}; var streamingQuery = lst.Select(x => { Console.WriteLine(x); return x; }); foreach (var i in streamingQuery) { ...
ChoiceDialog allows the user to pick one item from a list of options. List<String> options = new ArrayList<>(); options.add("42"); options.add("9"); options.add("467829"); options.add("Other"); ChoiceDialog<String> dialog = new Choice...
PDO is a universal database connection command in PHP, it support 12 different database type e.g MySQL, MongoDB, NoSQL. A big bonus about PDO is that it calculate your code to support the database type, so you don't need to make any chance when moving over to another database system. Summary PDO...
If you don't have permissions to install perl modules, you may still install them manually, indicating a custom path where you've got writing permissions. Fist, download and unzip module archive: wget module.tar.gz tar -xzf module.tar.gz cd module Then, if the module distribution contains a M...
Most of the questions around ownership come up when writing functions. When you specify the types of a function's arguments, you may choose how that value is passed in. If you only need read-only access, you can take an immutable reference: fn foo(x: &String) { // foo is only authorized to...
A shallow copy is a copy of a collection without performing a copy of its elements. >>> import copy >>> c = [[1,2]] >>> d = copy.copy(c) >>> c is d False >>> c[0] is d[0] True
You can create shallow copies of lists using slices. >>> l1 = [1,2,3] >>> l2 = l1[:] # Perform the shallow copy. >>> l2 [1,2,3] >>> l1 is l2 False
In functional programming languages like F# null values are considered potentially harmful and poor style (non-idiomatic). Consider this C# code: string x = SomeFunction (); int l = x.Length; x.Length will throw if x is null let's add protection: string x = SomeFunction (); int l = x ...
We have 2 way, we can install Universal app in windows 10 devices (OS/Phone). One app works for both mobile and OS 1 Install using Power Shell command Step 1: Make sure app not have any error and developed, then right click on Universal app project in solution explorer. Step 2: Select Store and C...
Let's say you need to check if an email address appears in a long list of email addresses. Use the MATCH function to return the row number on which the email address can be found. If there is no match, the function returns an #N/A error. =MATCH(F2,$D$2:$D$200,0) The value you're retrieving ...
Let's say we have type ENUM('fish','mammal','bird') An alternative is type TINYINT UNSIGNED plus CREATE TABLE AnimalTypes ( type TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(20) NOT NULL COMMENT "('fish','mammal','bird')", PRIMARY KEY(type), INDEX(na...
Let's say we have type ENUM('fish','mammal','bird') An alternative is type VARCHAR(20) COMENT "fish, bird, etc" This is quite open-ended in that new types are trivially added. Comparison, and whether better or worse than ENUM: (same) INSERT: simply provide the string (worse?)...
Changing an auto-increment value is useful when you don't want a gap in an AUTO_INCREMENT column after a massive deletion. For example, you got a lot of unwanted (advertisement) rows posted in your table, you deleted them, and you want to fix the gap in auto-increment values. Assume the MAX value o...
When a single parameter is passed to the .attr() function it returns the value of passed attribute on the selected element. Syntax: $([selector]).attr([attribute name]); Example: HTML: <a href="/home">Home</a> jQuery: $('a').attr('href'); Fetching data attributes: jQue...
If you want to add an attribute to some element you can use the attr(attributeName, attributeValue) function. For example: $('a').attr('title', 'Click me'); This example will add mouseover text "Click me" to all links on the page. The same function is used to change attributes' values...
#include <stdio.h> #include <threads.h> #include <stdlib.h> struct my_thread_data { double factor; }; int my_thread_func(void* a) { struct my_thread_data* d = a; // do something with d printf("we found %g\n", d->factor); // return an succes...
Mostly used under ng-repeat ngValue is useful when dynamically generating lists of radio buttons using ngRepeat <script> angular.module('valueExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.names = ['pizza', 'unicorns', 'robots']; ...

Page 115 of 269