Tutorial by Examples: c

Building project dependencies can sometimes be a tedious task. Instead of publishing a package version to NPM and installing the dependency to test the changes, use npm link. npm link creates a symlink so the latest code can be tested in a local environment. This makes testing global tools and proje...
To locate comments in BeautifulSoup, use the text (or string in the recent versions) argument checking the type to be Comment: from bs4 import BeautifulSoup from bs4 import Comment data = """ <html> <body> <div> <!-- desired text --&gt...
The %timeit magic runs the given code many times, then returns the speed of the fastest result. In [1]: %timeit sum(range(100000)) 100 loops, best of 3: 2.91 ms per loop The %%timeit cell magic can be used to time blocks of code. In [2]: %%timeit ...: a = 0 ...: for i in range(100000):...
R provides two additional looping constructs, while and repeat, which are typically used in situations where the number of iterations required is indeterminate. The while loop The general form of a while loop is as follows, while (condition) { ## do something ## in loop body } whe...
This example is about replacing a List element while ensuring that the replacement element is at the same position as the element that is replaced. This can be done using these methods: set(int index, T type) int indexOf(T type) Consider an ArrayList containing the elements "Program sta...
A conversion that involves calling an explicit constructor or conversion function can't be done implicitly. We can request that the conversion be done explicitly using static_cast. The meaning is the same as that of a direct initialization, except that the result is a temporary. class C { std:...
static_cast can perform any implicit conversion. This use of static_cast can occasionally be useful, such as in the following examples: When passing arguments to an ellipsis, the "expected" argument type is not statically known, so no implicit conversion will occur. const double x = ...
For a class Person like: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } var person1 = new Person { Name = "Jon", Age = 20, Clothes = "some clothes" }; var person2 = new Person { Name ...
For given type Person: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } List<Person> persons = new List<Person> { new Person{ Name = "Jon", Age = 20, Clothes = "some clothes...
There are two basic classes of exact numeric data types - Integer, and Fixed Precision and Scale. Integer Data Types bit tinyint smallint int bigint Integers are numeric values that never contain a fractional portion, and always use a fixed amount of storage. The range and storage sizes o...
float [(n)] real These data types are used to store floating point numbers. Since these types are intended to hold approximate numeric values only, these should not be used in cases where any rounding error is unacceptable. However, if you need to handle very large numbers, or numbers with an ...
This example shows how to render text along an arc. It includes how you can add functionality to the CanvasRenderingContext2D by extending its prototype. This examples is derived from the stackoverflow answer Circular Text. Example rendering Example code The example adds 3 new text renderi...
All modern JavaScript JIT compilers trying to optimize code based on expected object structures. Some tip from mdn. Fortunately, the objects and properties are often "predictable", and in such cases their underlying structure can also be predictable. JITs can rely on this to make pred...
You can use built-in functions to run PHP processes as forks. This is the most simple way to achieve parallel work if you don't need your threads to talk to each other. This allows you to put time intensive tasks (like uploading a file to another server or sending an email) to another thread so you...
One of the most common operations in erlang is pattern matching. It is used when assigning a value to a variable, in function declarations and in control-flow structures like case and receive statements. A pattern matching operation needs at least 2 parts: a pattern, and a term against wich the patt...
static_cast can convert from an integer or floating point type to an enumeration type (whether scoped or unscoped), and vice versa. It can also convert between enumeration types. The conversion from an unscoped enumeration type to an arithmetic type is an implicit conversion; it is possible, but ...
A pointer to member of derived class can be converted to a pointer to member of base class using static_cast. The types pointed to must match. If the operand is a null pointer to member value, the result is also a null pointer to member value. Otherwise, the conversion is only valid if the member ...
Generally execute() command is used for fire and forget calls (without need of analyzing the result) and submit() command is used for analyzing the result of Future object. We should be aware of key difference of Exception Handling mechanisms between these two commands. Exceptions from submit() ar...

Page 452 of 826