Tutorial by Examples: sin

Processing tabular data with awk is very easy, provided that the input is correctly formatted. Most software producing tabular data use specific features of this family of formats, and awk programs processing tabular data are often specific to a data produced by a specific software. If a more gener...
Given a file using ; as a column delimiter. Permuting the first and the second column is accomplished by awk -F';' -v 'OFS=;' '{ swap = $2; $2 = $1; $1 = swap; print }'
Given a file using ; as a column delimiter. We compute the mean of the values in the second column with the following program, the provided input is the list of grades of a student group: awk -F';' '{ sum += $2 } END { print(sum / NR) }' <<EOF Alice;2 Victor;1 Barbara;1 Casper;4 Deborah;...
We assume a file using ; as a column delimiter. Selecting a specific set of columns only requires a print statement. For instance, the following program selects the columns 3, 4 and 7 from its input: awk -F';' -v 'OFS=;' '{ print $3, $4, $7 }' It is as usual possible to more carefully choose lin...
Given a file using ; as a column delimiter. We compute the median of the values in the second column with the following program, written for GNU awk. The provided input is the list of grades of a student group: gawk -F';' '{ sample[NR] = $2 } END { asort(sample); if(NR % 2 == 1) { p...
Use import to specify how a namespace from one library is used in the scope of another library. import 'dart:html'; The only required argument to import is a URI specifying the library. For built-in libraries, the URI has the special dart: scheme. For other libraries, you can use a file system p...
C99 Using the system header file stdbool.h allows you to use bool as a Boolean data type. true evaluates to 1 and false evaluates to 0. #include <stdio.h> #include <stdbool.h> int main(void) { bool x = true; /* equivalent to bool x = 1; */ bool y = false; /* equivalent t...
C of all versions, will effectively treat any integer value other than 0 as true for comparison operators and the integer value 0 as false. If you don't have _Bool or bool as of C99 available, you could simulate a Boolean data type in C using #define macros, and you might still find such things in...
C99 Added in the C standard version C99, _Bool is also a native C data type. It is capable of holding the values 0 (for false) and 1 (for true). #include <stdio.h> int main(void) { _Bool x = 1; _Bool y = 0; if(x) /* Equivalent to if (x == 1) */ { puts("T...
You can use gradle to have BuildConfig constants and res values on a per flavor basis. Just add the value to the flavor you want to support. android { defaultConfig { resValue "string", "app_name", "Full App" buildConfigField "boolean",...
Matlab supports synchronous and asynchronous communication with a serial port. It is important to chose the right communication mode. The choice will depend on: how the instrument you are communicating with behave. what other functions your main program (or GUI) will have to do aside from managi...
#include <stdio.h> int main(void) { /* define a small bit-field that can hold values from 0 .. 7 */ struct { unsigned int uint3: 3; } small; /* extract the right 3 bits from a value */ unsigned int value = 255 - 2; /* Binary 11111101 */ small.u...
Pass each variable to view at a time $this->set('color', 'pink'); $this->set('color', $color); Pass multiple variables to view together via compact() function $color1 = 'pink'; $color2 = 'red'; $this->set(compact('color1', 'color2'));
JSON is a cross language, widely used method to serialize data Supported data types : int, float, boolean, string, list and dict. See -> JSON Wiki for more Here is an example demonstrating the basic usage of JSON :- import json families = (['John'], ['Mark', 'David', {'name': 'Avraham'}]) ...
Here is an example demonstrating the basic usage of pickle:- # Importing pickle try: import cPickle as pickle # Python 2 except ImportError: import pickle # Python 3 # Creating Pythonic object: class Family(object): def __init__(self, names): self.sons = names ...
You can save your code snippets for use later simply by drag and drop. For eg: if you have an NSLog statement that used for so many places somewhere else in the project, then you can save the NSLog statements to code snippets library. Drag the NSLog statement to code snippet library. Now you c...
With Vault you can also encrypt non-structured data, such as private key files and still be able to decrypt them in your play with the lookup module. --- - name: Copy private key to destination copy: dest=/home/user/.ssh/id_rsa mode=0600 content=lookup('pipe', 'ANSIBLE_VAULT_PA...
You can run a play which relies on vault-encrypted templates by using the local_action module. --- - name: Decrypt template local_action: "shell {{ view_encrypted_file_cmd }} {{ role_path }}/templates/template.enc > {{ role_path }}/templates/template" changed_when: False - ...
public void setFont(TextView textView) { textView.setTypeface(myFont); }
Protocol oriented programing can be used as a core Swift design pattern. Different types are able to conform to the same protocol, value types can even conform to multiple protocols and even provide default method implementation. Initially protocols are defined that can represent commonly used pro...

Page 50 of 161