Tutorial by Examples: f

Dim aList as New List(Of String) aList.Add("Hello, World") aList.Add("Test") Dim output As String = aList(0) output: Hello, World If you do not know the index of the item or only know part of the string then use the Find or FindAll method Dim aList as New List(Of S...
Now you have aws cli installed, you'll have to configure it access your AWS resources. You can have multiple profiles like test, dev, prod, etc profiles. So let's assume you want to configure it for your test environment. aws configure --profile=test It will ask for following information: AWS A...
Write formatted data to string int sprintf ( char * str, const char * format, ... ); use sprintf function to write float data to string. #include <stdio.h> int main () { char buffer [50]; double PI = 3.1415926; sprintf (buffer, "PI = %.7f", PI); printf ("%s\n&...
Take a close look at these two property files which are seemingly completely identical: except they are really not identical: (screenshots are from Notepad++) Since trailing whitespace is preserved the value of lastName would be "Smith" in the first case and "Smith " in th...
In order to use icon fonts, just follow the steps below: Add the font file to your project You may create your font icon file from online websites such as icomoon, where you can upload SVG files of the required icons and then download the created icon font. Then, place the .ttf font file into ...
First you have to set up a new Scrapy project. Enter a directory where you’d like to store your code and run: scrapy startproject projectName To scrape we need a spider. Spiders define how a certain site will be scraped. Here’s the code for a spider that follows the links to the top voted questi...
Imagine you are on the master branch and something is not working as expected (a regression was introduced), but you don't know where. All you know is, that is was working in the last release (which was e.g., tagged or you know the commit hash, lets take old-rel here). Git has help for you, finding...
We can directly copy data from a source to a data sink using a loop. In this example, we are reading data from an InputStream and at the same time, writing to an OutputStream. Once we are done reading and writing, we have to close the resource. public void copy(InputStream source, OutputStream dest...
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...
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, ...
The variable FS is used to set the input field separator. In awk, space and tab act as default field separators. The corresponding field value can be accessed through $1, $2, $3... and so on. awk -F'=' '{print $1}' file -F - command-line option for setting input field separator. awk 'BEGIN ...
This variable is used to set the output field separator which is a space by default. awk -F'=' 'BEGIN { OFS=":" } { print $1 }' file Example: $ cat file.csv col1,col2,col3,col4 col1,col2,col3 col1,col2 col1 col1,col2,col3,col4,col5 $ awk -F',' 'BEGIN { OFS="|" } { $...
This variable will give you a total number of fields in the current input record. awk -F',' '{print NF}' file.csv Example: $ cat file.csv col1,col2,col3,col4 col1,col2,col3 col1,col2 col1 col1,col2,col3,col4,col5 $ awk -F',' '{print NF}' file.csv 4 3 2 1 5
The C standard says that files should end with a new line, so if EOF comes at the end of a line, that line may not be missed by some commands. As an example: $ echo 'one\ntwo\nthree\c' > file.txt $ cat file.txt one two three $ while read line ; do echo "line $line" ; done <...
Popular within many open source projects but not only. Master branch of a specific location (Github, Gitlab, Bitbucket, local server) contains the latest shippable version. For each new feature/bug fix/architectural change each developer creates a branch. Changes happen on that branch and can be d...
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...
Provides the number of columns or fields in each record (record corresponds to each line). Each line is demarcated by RS which defaults to newline. cat > file1 Harley Quinn Loves Joker Batman Loves Wonder Woman Superman is not dead Why is everything I type four fielded!? awk '{print NF}' ...

Page 157 of 457