Tutorial by Examples: c

Python multithreading performance can often suffer due to the Global Interpreter Lock. In short, even though you can have multiple threads in a Python program, only one bytecode instruction can execute in parallel at any one time, regardless of the number of CPUs. As such, multithreading in cases w...
Use multiprocessing.Process to run a function in another process. The interface is similar to threading.Thread: import multiprocessing import os def process(): print("Pid is %s" % (os.getpid(),)) processes = [multiprocessing.Process(target=process) for _ in range(4)] for p in...
Code running in different processes do not, by default, share the same data. However, the multiprocessing module contains primitives to help share values across multiple processes. import multiprocessing plain_num = 0 shared_num = multiprocessing.Value('d', 0) lock = multiprocessing.Lock() ...
Place Picker is a really simple UI widget provided by Places API. It provides a built-in map, current location, nearby places, search abilities and autocomplete. This is a sample usage of Place Picker UI widget. private static int PLACE_PICKER_REQUEST = 1; private TextView txtPlaceName; @Ove...
You can get the current location and local places of user by using the Google Places API. Ar first, you should call the PlaceDetectionApi.getCurrentPlace() method in order to retrieve local business or other places. This method returns a PlaceLikelihoodBuffer object which contains a list of PlaceLi...
Returns an int value representing the ASCII code of the leftmost character of a string. SELECT ASCII('t') -- Returns 116 SELECT ASCII('T') -- Returns 84 SELECT ASCII('This') -- Returns 84 If the string is Unicode and the leftmost character is not ASCII but representable in the current collatio...
Returns the start index of a the first occurrence of string expression inside another string expression. Parameters list: String to find (up to 8000 chars) String to search (any valid character data type and length, including binary) (Optional) index to start. A number of type int or big int. ...
Returns a char represented by an int ASCII code. SELECT CHAR(116) -- Returns 't' SELECT CHAR(84) -- Returns 'T' This can be used to introduce new line/line feed CHAR(10), carriage returns CHAR(13), etc. See AsciiTable.com for reference. If the argument value is not between 0 and 255, the CHAR...
SQL Server 2012 Returns a string that is the result of two or more strings joined together. CONCAT accepts two or more arguments. SELECT CONCAT('This', ' is', ' my', ' string') -- returns 'This is my string' Note: Unlike concatenating strings using the string concatenation operator (+), when ...
Returns the integer value representing the Unicode value of the first character of the input expression. Parameters: Unicode character expression. Any valid nchar or nvarchar expression. SELECT UNICODE(N'Ɛ') -- Returns 400 DECLARE @Unicode nvarchar(11) = N'Ɛ is a char' SELECT UNICODE(@Uni...
Returns the Unicode character(s) (nchar(1) or nvarchar(2)) corresponding to the integer argument it receives, as defined by the Unicode standard. Parameters: integer expression. Any integer expression that is a positive number between 0 and 65535, or if the collation of the database supports sup...
The switch statement is a control statement that selects a switch section to execute from a list of candidates. A switch statement includes one or more switch sections. Each switch section contains one or more case labels followed by one or more statements. If no case label contains a matching value...
An interface contains the signatures of methods, properties and events. The derived classes defines the members as the interface contains only the declaration of the members. An interface is declared using the interface keyword. interface IProduct { decimal Price { get; } } class Product...
List comprehensions are a syntactic construct to create a list based on existing lists. In erlang a list comprehension has the form [Expr || Qualifier1, ..., QualifierN]. Where qualifiers are either generators Pattern <- ListExpr or filter like integer(X) evaluating to either true or false. Th...
ScopedTypeVariables let you refer to universally quantified types inside of a declaration. To be more explicit: import Data.Monoid foo :: forall a b c. (Monoid b, Monoid c) => (a, b, c) -> (b, c) -> (a, b, c) foo (a, b, c) (b', c') = (a :: a, b'', c'') where (b'', c'') = (b <&g...
If an array happens to have one or more nil elements and these need to be removed, the Array#compact or Array#compact! methods can be used, as below. array = [ 1, nil, 'hello', nil, '5', 33] array.compact # => [ 1, 'hello', '5', 33] #notice that the method returns a new copy of the array w...
The code sample below shows one way to retrieve records from an MSSql Server in a background thread using FireDAC. Tested for Delphi 10 Seattle As written: The thread retrieves data using its own TFDConnection and TFDQuery and transfers the data to the form's FDQuery in a call to Sychronize...
In this example, a model will learn to classify fruits given certain features, using the Labels for training. WeightColorLabel0.5greenapple0.6purpleplum3greenwatermelon0.1redcherry0.5redapple Here the a model will take Weight and Color as features to predict the Label. For instance [0.15, 'red'] s...
PHP's source code is hosted on GitHub. To build from source you will first need to check out a working copy of the code. mkdir /usr/local/src/php-7.0/ cd /usr/local/src/php-7.0/ git clone -b PHP-7.0 https://github.com/php/php-src . If you want to add a feature, it's best to create your own bra...
To create a libary , you should use File -> New -> New Module -> Android Library. This will create a basic library project. When that's done, you must have a project that is set up the following manner: [project root directory] [library root directory] [gradle] build.gradle...

Page 344 of 826