Tutorial by Examples

CAShapeLayer *circle = [CAShapeLayer layer]; [circle setPath:[[UIBezierPath bezierPathWithOvalInRect:CGRectMake(100, 100, 150, 150)] CGPath]]; [circle setStrokeColor:[[UIColor blueColor] CGColor]]; [circle setFillColor:[[UIColor clearColor] CGColor]]; [[self.view layer] addSublayer:circl...
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...
In your Storyboard, add a UITableView object on your UIViewController and let it cover the entire view. Setup the UITableviewDataSource and UITableviewDelegate connections. Objective-C In your .h file NSMutableArray *arrayForBool; NSMutableArray *sectionTitleArray; In your .m file - (void)vi...
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...
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, ...
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 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
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
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...
To set the word list that vim will use for spell checking set the spelllang option. For example :set spelllang=en # set to English, usually this is the default :set spelllang=en_us # set to U.S. English :set spelllang=en_uk # set to U.K. English spellings :set spelllang=es ...
#!/bin/bash # Script name : pingnmap # Scenario : The systems admin in company X is tired of the monotonous job # of pinging and nmapping, so he decided to simplify the job using a script. # The tasks he wish to achieve is # 1. Ping - with a max count of 5 -the given IP address/domain. AND/OR ...

Page 484 of 1336