Tutorial by Examples: c

In this example we have an existing table, SuperHeros. This table contains a primary key ID. We will add a new table in order to store the powers of each super hero: CREATE TABLE HeroPowers ( ID int NOT NULL PRIMARY KEY, Name nvarchar(MAX) NOT NULL, HeroId int REFERENCES SuperHero...
NSDictionary *myDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil]; NSArray *copiedArray = myDictionary.copy; Get keys: NSArray *keys = [myDictionary allKeys]; Get values: NSArray *values = [myDic...
NSDictionary *myDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil]; NSData *myData = [NSKeyedArchiver archivedDataWithRootObject:myDictionary]; Reserve path: NSDictionary *myDictionary = (NSDictionary*...
NSDictionary *myDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil]; NSMutableDictionary *mutableDictionary = [myDictionary mutableCopy]; NSData *data = [NSJSONSerialization dataWithJSONObject:myDiction...
Swift import SystemConfiguration /// Class helps to code reuse in handling internet network connections. class NetworkHelper { /** Verify if the device is connected to internet network. - returns: true if is connected to any internet network, false if is not co...
Although D3 is not specific for handling SVG elements, it is widely used for creating and manipulating complex SVG based data visualizations. D3 provides many powerful methods which helps to create various geometrical SVG structures with ease. It is recommended to understand basic concepts of SVG s...
\bfoo\b will match the complete word with no alphanumeric and _ preceding or following by it. Taking from regularexpression.info There are three different positions that qualify as word boundaries: Before the first character in the string, if the first character is a word character. After...
//Swift let barButtonItem = UIBarButtonItem(title: "Greetings!", style: .Plain, target: self, action: #selector(barButtonTapped)) self.navigationItem.rightBarButtonItem = barButtonItem //Objective-C UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Greeti...
[a-b] where a and b are digits in the range 0 to 9 [3-7] will match a single digit in the range 3 to 7. Matching multiple digits \d\d will match 2 consecutive digits \d+ will match 1 or more consecutive digits \d* will match 0 or more consecutive digits \d{3} will ma...
Define a new type Person using namedtuple like this: Person = namedtuple('Person', ['age', 'height', 'name']) The second argument is the list of attributes that the tuple will have. You can list these attributes also as either space or comma separated string: Person = namedtuple('Person', 'age,...
By default, Interface Builder doesn't accept the CGColor datatype, so to allow adding a CGColor using user defined attributes in interface builder; one may want to use an extension like this: Swift Extension : extension CALayer { func borderUIColor() -> UIColor? { return borderCol...
Exceptions are errors which occur when a program is executing. Consider the Java program below which divides two integers. class Division { public static void main(String[] args) { int a, b, result; Scanner input = new Scanner(System.in); System.out.println(&qu...
NSSet *set = [NSSet set]; NSArray *array = [NSArray array]; NSArray *fromSet = [set allObjects]; NSSet *fromArray = [NSSet setWithArray:array];
IMPORTANT: This delegate method is only called in the foreground. Swift func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) { } Objective-C - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotifi...
Function DisableShift() 'This function disable the shift at startup. This action causes 'the Autoexec macro and Startup properties to always be executed. On Error GoTo errDisableShift Dim db As DAO.Database Dim prop As DAO.Property Const conPropNotFound = 3270 Set db = C...
Function EnableShift() 'This function enables the SHIFT key at startup. This action causes 'the Autoexec macro and the Startup properties to be bypassed 'if the user holds down the SHIFT key when the user opens the database. On Error GoTo errEnableShift Dim db As DAO.Database Dim p...
Tuples can be compared based on their elements. As an example, an enumerable whose elements are of type Tuple can be sorted based on comparisons operators defined on a specified element: List<Tuple<int, string>> list = new List<Tuple<int, string>>(); list.Add(new Tuple<...
References behaves similarly, but not entirely like const pointers. A reference is defined by suffixing an ampersand & to a type name. int i = 10; int &refi = i; Here, refi is a reference bound to i. References abstracts the semantics of pointers, acting like an alias to the underlying...
The strchr and strrchr functions find a character in a string, that is in a NUL-terminated character array. strchr return a pointer to the first occurrence and strrchr to the last one. #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char toSe...
To use the IronPython command line, open ipy.exe or ipy64.exe. Both files are located in the path that was selected during installation. By default they will be located at C:\Program Files\IronPython 2.7\. Then start writing your statements directly in the IronPython command line. For example: pr...

Page 117 of 826