Tutorial by Examples: c

Channel uses a Buffer to read/write data. A buffer is a fixed sized container where we can write a block of data at once. Channel is a quite faster than stream-based I/O. To read data from a file using Channel we need to have the following steps- We need an instance of FileInputStream. FileInput...
Swift: if let url = URL(string: "mailto://[email protected]") { if UIApplication.shared.canOpenURL(url) { UIApplication.shared.openURL(url) } else { print("Cannot open URL") } } Objective-C: NSURL *url = [NSURL URLWithString:@"mailto://az...
While implementing one of the standard hashing algorithm in awk is probably a tedious task, defining a hash function that can be used as a handle to text documents is much more tractable. A practical situation where such a function is useful is to assign short ids to items given their description, ...
This variable is used to set input record separator, by default a newline. awk 'BEGIN{RS=","} {print $0}' file
This variable is used to set output record separator, by default a newline. awk 'BEGIN{ORS=","} {print $0}' file
let let num=1+2 let num="1+2" let 'num= 1 + 2' let num=1 num+=2 You need quotes if there are spaces or globbing characters. So those will get error: let num = 1 + 2 #wrong let 'num = 1 + 2' #right let a[1] = 1 + 1 #wrong let 'a[1] = 1 + 1' ...
mpicc -o my_prog my_prog.c
Setup your test environment Download Espresso Set the instrumentation runner Example build.gradle file Analytics Add the first test Running tests This guide covers installing Espresso using the SDK Manager and building it using Gradle. Android Studio is recommended. Setup your test envir...
#!/bin/bash echo $(( 1 + 2 )) Output: 3 # Using variables #!/bin/bash var1=4 var2=5 ((output=$var1 * $var2)) printf "%d\n" "$output" Output: 20
#!/bin/bash expr 1 + 2 Output: 3
To turn on the vim spell checker run :set spell. To turn it off run :set nospell. If you always want the spell checker to be on, add set spell to your vimrc. You can turn spelling on only for certain filetypes using an auto command. Once the spell checker is on, misspelled words will be highligh...
Simple steps to use scrollview with autolayout. Create a new project with single view application Select the default viewcontroller and change its screen size to iPhone-4inch from attributes inspector. Add a scrollview to your viewcontroller's view as follows and set background color to blue ...
Use "-x" to enable debug output of executed lines. It can be run on an entire session or script, or enabled programmatically within a script. Run a script with debug output enabled: $ bash -x myscript.sh Or $ bash --debug myscript.sh Turn on debugging within a bash script. It may ...
Whitespace matters when assigning variables. foo = 'bar' # incorrect foo= 'bar' # incorrect foo='bar' # correct The first two will result in syntax errors (or worse, executing an incorrect command). The last example will correctly set the variable $foo to the text "bar".
To execute a script file with the bash interpreter, the first line of a script file must indicate the absolute path to the bash executable to use: #!/bin/bash The bash path in the shebang is resolved and used only if a script is directly launch like this: ./script.sh The script must have exe...
Exit status 0: success Exit status other than 0: failure To test on the exit status of a command: if command;then echo 'success' else echo 'failure' fi
Will provide the total number of records processed in the current awk instance. cat > file1 suicidesquad harley quinn joker deadshot cat > file2 avengers ironman captainamerica hulk awk '{print NR}' file1 file2 1 2 3 4 5 6 7 8 A total on 8 records were processed in th...
Provides the total number of records processed by the awk instance relative to the files awk is processing cat > file1 suicidesquad harley quinn joker deadshot cat > file2 avengers ironman captainamerica hulk awk '{print FNR}' file1 file2 1 2 3 4 1 2 3 4 Each file had...
See :help packages.
Press controlr and type a pattern. For example, if you recently executed man 5 crontab, you can find it quickly by starting to type "crontab". The prompt will change like this: (reverse-i-search)`cr': man 5 crontab The `cr' there is the string I typed so far. This is an incremental s...

Page 300 of 826