Tutorial by Examples: ast

In order to run Elasticsearch, a Java Runtime Environment (JRE) is required on the machine. Elasticsearch requires Java 7 or higher and recommends Oracle JDK version 1.8.0_73. So, be sure if you have Java in your system. If not, then follow the procedure: # Install wget with yum yum -y install w...
Please note that this example uses OpenCV 3.1. import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; import org.opencv.o...
When testing with Google App Engine's testing library the challenges of eventual consistency are present in the same manner they will be in production. Therefore in order to write something into the datastore to test retrieval you have to create a context which is strongly consistent. type Foo str...
function lastRowForColumn(sheet, column){ // Get the last row with data for the whole sheet. var numRows = sheet.getLastRow(); // Get all data for the given column var data = sheet.getRange(1, column, numRows).getValues(); // Iterate backwards and find first non empty cell ...
T qobject_cast(QObject *object) A functionality which is added by deriving from QObject and using the Q_OBJECT macro is the ability to use the qobject_cast. Example: class myObject : public QObject { Q_OBJECT //... }; QObject* obj = new myObject(); To check whether obj is a my...
If you want to make a change that you want to merge with master, the best way is to first create a topic branch git checkout -b foo make a single commit with your feature git commit -m "Made the thing X finally work" and push that branch to review via git push origin foo:refs/for/...
String macros do not come with built-in interpolation facilities. However, it is possible to manually implement this functionality. Note that it is not possible to embed without escaping string literals that have the same delimiter as the surrounding string macro; that is, although ""&quot...
module main; auto getMemberNames(T)() @safe pure { string[] members; foreach (derived; __traits(derivedMembers, T)) { members ~= derived; } return members; } class Foo { int a; int b; } class Bar : Foo { int c; int d; int e...
This example illustrates how to read various-type struct entries from MATLAB, and pass it to C equivalent type variables. While it is possible and easy to figure out from the example how to load fields by numbers, it is here achieved via comparing the field names to strings. Thus the struct fields ...
For the current shell, this takes you to the previous directory that you were in, no matter where it was. cd - Doing it multiple times effectively "toggles" you being in the current directory or the previous one.
MATLAB R2016b featured a generalization of its scalar expansion1,2 mechanism, to also support certain element-wise operations between arrays of different sizes, as long as their dimension are compatible. The operators that support implicit expansion are1: Element-wise arithmetic operators: +, -,...
This example shows how to use fast enumeration in order to traverse through an NSArray. With this way you can also track current object's index while traversing. Suppose you have an array, NSArray *weekDays = @[@"Monday", @"Tuesday", @"Wednesday", @"Thursday&quot...
Generally, it's not a good idea to use a regular expression to parse a complex structure. But it can be done. For instance, you might want to load data into hive table and fields are separated by comma but complex types like array are separated by a "|". Files contain records with all fiel...
Sometimes we want to give extra information to our user with colors (for example red means something wrong has happened) We can change toast message background color using setting a color filter to the view which our toast give us (here I use a ColorMatrixColorFilter): Toast t = Toast.MakeText(con...
We can change our toast using SetGravity method. This method takes three parameters: first is gravity of toast on screen and two others set toast offset from the starting position (which is set by the first parameter): //Toast at bottom left corner of screen Toast t = Toast.MakeText(context, mess...
#include <ctype.h> #include <stdio.h> typedef struct { size_t space; size_t alnum; size_t punct; } chartypes; chartypes classify(FILE *f) { chartypes types = { 0, 0, 0 }; int ch; while ((ch = fgetc(f)) != EOF) { types.space += !!isspace(ch); types.al...
#include <ctype.h> #include <stddef.h> typedef struct { size_t space; size_t alnum; size_t punct; } chartypes; chartypes classify(const char *s) { chartypes types = { 0, 0, 0 }; const char *p; for (p= s; p != '\0'; p++) { types.space += !!isspace((unsigned ...
Specifies that the query is optimized for fast retrieval of the first number_rows. This is a nonnegative integer. After the first number_rows are returned, the query continues execution and produces its full result set. select OrderID, AVG(Quantity) from Sales.OrderLines group by OrderID OPTION ...
// main.cpp : Defines the entry point for the console application. // #include "opencv2/highgui/highgui.hpp" #include <iostream> using namespace cv; using namespace std; int main(int argc, const char** argv) { Mat img = imread("lena30.jpg", CV_LOAD_IMAGE...
s/foo/bar/; # replace "foo" with "bar" in $_ my $foo = "foo"; $foo =~ s/foo/bar/; # do the above on a different variable using the binding operator =~ s~ foo ~ bar ~; # using ~ as a delimiter $foo = s/foo/bar/r; # non-destructive r flag: returns the repl...

Page 21 of 26