Tutorial by Examples

A CLOS class is described by: a name a list of superclasses a list of slots further options like documentation Each slot has: a name an initialization form (optional) an initialization argument (optional) a type (optional) a documentation string (optional) accessor, reader and/or wr...
Go is a statically typed language, meaning you generally have to declare the type of the variables you are using. // Basic variable declaration. Declares a variable of type specified on the right. // The variable is initialized to the zero value of the respective type. var x int var s string va...
In Go, you can declare multiple variables at the same time. // You can declare multiple variables of the same type in one line var a, b, c string var d, e string = "Hello", "world!" // You can also use short declaration to assign multiple variables x, y, z := 1, 2, 3 ...
The ls command's -l option prints a specified directory's contents in a long listing format. If no directory is specified then, by default, the contents of the current directory are listed. ls -l /etc Example Output: total 1204 drwxr-xr-x 3 root root 4096 Apr 21 03:44 acpi -rw-r--r-- 1 r...
The basic format of C-style for loop is: for (( variable assignment; condition; iteration process )) Notes: The assignment of the variable inside C-style for loop can contain spaces unlike the usual assignment Variables inside C-style for loop aren't preceded with $. Example: for (( i = ...
Until loop executes until condition is true i=5 until [[ i -eq 10 ]]; do #Checks if i=10 echo "i=$i" #Print the value of i i=$((i+1)) #Increment i by 1 done Output: i=5 i=6 i=7 i=8 i=9 When i reaches 10 the condition in until loop becomes true and the loop ends.
It is tricky to remove items from a list while within a loop, this is due to the fact that the index and length of the list gets changed. Given the following list, here are some examples that will give an unexpected result and some that will give the correct result. List<String> fruits = new...
/* declare items of the enum */ #define FOREACH \ X(item1) \ X(item2) \ X(item3) \ /* end of list */ /* define the enum values */ #define X(id) MyEnum_ ## id, enum MyEnum { FOREACH }; #undef X /* convert an enum value to its identifier */ const char * enum2string(int...
To publish the changes you made in your working copy, run the svn commit command. IMPORTANT: Review your changes before committing them! Use svn status and svn diff to review the changes. Also, make sure you are in the correct path before performing a commit. If you updated many files across vari...
Using the Java-SDK 3.0.1 CountDownLatch lock = new CountDownLatch(1); SpeechToText service = new SpeechToText(); service.setUsernameAndPassword("<username>", "<password>"); FileInputStream audio = new FileInputStream("filename.wav"); RecognizeOpti...
This example shows how to use the IBM Watson Speech to Text service to recognize the type of an audio file and produce a transcription of the spoken text in that file. This example requires Speech to Text service credentials and Node.js Install the npm module for the Watson Developer Cloud N...
Performs an explicit conversion into the given type from the value resulting from evaluating the given expression. int x = 3; int y = 4; printf("%f\n", (double)x / y); /* Outputs "0.750000". */ Here the value of x is converted to a double, the division promotes the value of...
With a type as operand Evaluates into the size in bytes, of type size_t, of objects of the given type. Requires parentheses around the type. printf("%zu\n", sizeof(int)); /* Valid, outputs the size of an int object, which is platform-dependent. */ printf("%zu\n", sizeof int); ...
Pointer addition Given a pointer and a scalar type N, evaluates into a pointer to the Nth element of the pointed-to type that directly succeeds the pointed-to object in memory. int arr[] = {1, 2, 3, 4, 5}; printf("*(arr + 3) = %i\n", *(arr + 3)); /* Outputs "4", arr's fourth e...
The member access operators (dot . and arrow ->) are used to access a member of a struct. Member of object Evaluates into the lvalue denoting the object that is a member of the accessed object. struct MyStruct { int x; int y; }; struct MyStruct myObject; myObject.x = 42; myObj...
The first operand must be a function pointer (a function designator is also acceptable because it will be converted to a pointer to the function), identifying the function to call, and all other operands, if any, are collectively known as the function call's arguments. Evaluates into the return valu...
The X-macro approach can be generalized a bit by making the name of the "X" macro an argument of the master macro. This has the advantages of helping to avoid macro name collisions and of allowing use of a general-purpose macro as the "X" macro. As always with X macros, the mas...
The git check-ignore command reports on files ignored by Git. You can pass filenames on the command line, and git check-ignore will list the filenames that are ignored. For example: $ cat .gitignore *.o $ git check-ignore example.o Readme.md example.o Here, only *.o files are defined in .git...
There are three ways of creating a new branch feature which tracks the remote branch origin/feature: git checkout --track -b feature origin/feature, git checkout -t origin/feature, git checkout feature - assuming that there is no local feature branch and there is only one remote with the featur...
The class name selector select all elements with the targeted class name. For example, the class name .warning would select the following <div> element: <div class="warning"> <p>This would be some warning copy.</p> </div> You can also combine class n...

Page 81 of 1336