Tutorial by Examples: c

The Common Lisp Quick Reference is a document which can be printed and bound as a booklet in various layouts to have a printed quick reference for Common Lisp.
You can remove all the elements in a set using the .clear() method: mySet.clear();
Unlike many other languages, Perl does not have constructors that allocate memory for your objects. Instead, one should write a class method that both create a data structure and populate it with data (you may know it as the Factory Method design pattern). package Point; use strict; sub new { ...
In general, classes in Perl are just packages. They can contain data and methods, as usual packages. package Point; use strict; my $CANVAS_SIZE = [1000, 1000]; sub new { ... } sub polar_coordinates { ... } 1; It is important to note that the variables declared in a packa...
To make a class a subclass of another class, use parent pragma: package Point; use strict; ... 1; package Point2D; use strict; use parent qw(Point); ... 1; package Point3D; use strict; use parent qw(Point); ... 1; Perl allows for multiple inheritance: package Point2D; use stri...
In Perl, the difference between class (static) and object (instance) methods is not so strong as in some other languages, but it still exists. The left operand of the arrow operator -> becomes the first argument of the method to be called. It may be either a string: # the first argument of new ...
To filter a selection you can use the .filter() method. The method is called on a selection and returns a new selection. If the filter matches an element then it is added to the returned selection, otherwise it is ignored. If no element is matched then an empty selection is returned. The HTML Thi...
This will create a composite index of both keys, mystring and mydatetime and speed up queries with both columns in the WHERE clause. CREATE INDEX idx_mycol_myothercol ON my_table(mycol, myothercol) Note: The order is important! If the search query does not include both columns in the WHERE claus...
Most developers encounter backpressure when their application fails with MissingBackpressureException and the exception usually points to the observeOn operator. The actual cause is usually the non-backpressured use of PublishSubject, timer() or interval() or custom operators created via create(). ...
article.twig.html <article> <h1>{{ article.title }}</h1> {% block content %} <p>{{ article.content }}</p> {% endblock %} </article> articles.twig.html {# use default template for article #} {% for article in articles %} {% include &...
In this case, "monkey patching" means adding a new variable or method to a class after it's been defined. For instance, say we defined class A as class A(object): def __init__(self, num): self.num = num def __add__(self, other): return A(self.num + other.num)...
Collections in Java only work for objects. I.e. there is no Map<int, int> in Java. Instead, primitive values need to be boxed into objects, as in Map<Integer, Integer>. Java auto-boxing will enable transparent use of these collections: Map<Integer, Integer> map = new HashMap<&g...
public static class ArrayHelpers { public static bool Contains<T>(this T[] array, T[] candidate) { if (IsEmptyLocate(array, candidate)) return false; if (candidate.Length > array.Length) return false; for (int a = 0; a <...
redis-cli is the Redis command line interface program that allows to send commands to Redis and read the replies sent by the server, directly from the terminal. Basic command line usage is below: Access to redis: $ redis-cli 127.0.0.1:6379> Access to redis with authentication: $ redis-cli ...
The dir() function can be used to get a list of the members of a class: dir(Class) For example: >>> dir(list) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__...
Notice that packages can be installedThis command installs the newest available version of the named packages: both locally or globally. Local installation means that npm installs your package in the current working directory. Node modules go in ./node_modules, executables go in ./node_modules/.bi...
The trim() method returns a new String with the leading and trailing whitespace removed. String s = new String(" Hello World!! "); String t = s.trim(); // t = "Hello World!!" If you trim a String that doesn't have any whitespace to remove, you will be returned the same S...
If efficiency is important, a fast way to iterate over pixels in a cv::Mat object is to use its ptr<T>(int r) method to obtain a pointer to the beginning of row r (0-based index). According to the matrix type, the pointer will have a different template. For CV_8UC1: uchar* ptr = image.ptr&...
To use Cython two things are needed.The Cython package itself, which contains the cython source-to-source compiler and Cython interfaces to several C and Python libraries (for example numpy). To compile the C code generated by the cython compiler, a C compiler is needed. Step 1: Installing Cython ...
By default, most of the information is hidden from the user. You can use -v switches to get a verbose log of the connection attempt, which will usually pinpoint the problem by showing why the behavior is different than you expect. Let's assume you are connecting to the server example.com using ssh ...

Page 230 of 826