Tutorial by Examples: er

CKContainer.defaultContainer().accountStatusWithCompletionHandler { accountStatus, error in if accountStatus == .NoAccount { let alert = UIAlertController(title: "Sign in to iCloud", message: "Sign in to your iCloud account to write records. On the Home screen, l...
This example shows how to use fast enumeration in order to traverse through an NSArray. When you have an array, such as NSArray *collection = @[@"fast", @"enumeration", @"in objc"]; You can use the for ... in syntax to go through each item of the array, automatical...
identification division. program-id. altering. date-written. 2015-10-28/06:36-0400. remarks. Demonstrate ALTER. procedure division. main section. *> And now for some altering. contrived. ALTER story TO PROCEED TO beginning GO TO story . *> Jump to a part of the story...
Error messages are generally included in a script for debugging purposes or for providing rich user experience. Simply writing error message like this: cmd || echo 'cmd failed' may work for simple cases but it's not the usual way. In this example, the error message will pollute the actual output...
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <dirent.h> #include <ctype.h> int main(int argc, char **argv) { const char *dname = (argc > 1 ? argv[1] : "."); DI...
Open Android Studio Open Your Project Click on Gradle (From Right Side Panel, you will see Gradle Bar) Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project) Click on Your Project (Your Project Name form List (root)) Click on Tasks Click on andr...
There is a signal WINCH ( WINdowCHange), which is fired when one resizes a terminal window. declare -x rows cols update_size(){ rows=$(tput lines) # get actual lines of term cols=$(tput cols) # get actual columns of term echo DEBUG terminal window has no $rows lines and is $cols chara...
Using a pipe makes the output of a command be the input of the next one. ls -1 | grep -c ".conf" In this case the ouput of the ls command is used as the input of the grep command. The result will be the number of files that include ".conf" in their name. This can be used to ...
This will get all the orders for all customers: SELECT c.CustomerName, o.OrderID FROM Customers AS c INNER JOIN Orders AS o ON c.CustomerID = o.CustomerID ORDER BY c.CustomerName, o.OrderID; This will count the number of orders for each customer: SELECT c.CustomerName, C...
<svg width="600px" height="600px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <polyline points="10,10,50,40,80,30,120,90,130,10,180,50,250,100,300,10" fill="none" stroke="red" s...
<svg width="600px" height="400px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <line x1="10" y1="20" x2="300" y2="20" stroke="red" stroke-width="20"...
SVG Patterns behave significantly differently than CSS background images when filling equivalent shapes. This can lead to significant surprises for new-comers to SVG. Below are examples of a pattern defined in all possible combinations of patternUnits and patternContentUnits - showing how these sett...
<svg width="800px" height="800px"> <defs> <pattern id="pattern1" x="0" y="0" width="0.2" height="0.2" > <circle cx="10" cy="10" r="10" fill="blue" /> <...
In this example, we are going to create an image picker that previews your picture before uploading. The previewer also supports drag and dropping files into the input. In this example, I am only going to cover uploading single files, but you can tinker a bit to get multi file upload working. image...
Downloading the Bundle: The easiest way to download the required GTK Bundle is to search and download it using this link: https://git.gnome.org/browse/gtk+ (GNOME GIT Repository) GNOME GIT Repository provides the bundles for different versions and you can easily find the desired version by scrolli...
Vim has its own built-in Python interpreter. Thus it could use a different version of the default interpreter for the operating system. To check with which version of Python Vim was compiled, type the following command: :python import sys; print(sys.version) This imports the sys module and prin...
In order to make a RelativeSizeSpan align to the top, a custom class can be derived from the class SuperscriptSpan. In the following example, the derived class is named TopAlignSuperscriptSpan: activity_main.xml: <TextView android:id="@+id/txtView" android:layout_width=&quot...
Create drawable file named with custom_rectangle.xml in drawable folder: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color=&quo...
Add code in your Activity. This would work for Fragment also, no need to add this code in Fragment. @Override public boolean dispatchTouchEvent(MotionEvent ev) { View view = getCurrentFocus(); if (view != null && (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == Moti...
DP to Pixel: private int dpToPx(int dp) { return (int) (dp * Resources.getSystem().getDisplayMetrics().density); } Pixel to DP: private int pxToDp(int px) { return (int) (px / Resources.getSystem().getDisplayMetrics().density); }

Page 246 of 417