Tutorial by Examples: c

A namespace is a URI, but to avoid verbosity, prefixes are used as a proxy. In the following example, the prefix my-prefix is bound to the namespace http://www.example.com/my-namespace by using the special attribute xmlns:my-prefix (my-prefix can be replaced with any other prefix): <?xml versio...
In XML, element and attribute names live in namespaces. By default, they are in no namespace: <?xml version="1.0"?> <foo attr="value"> <!-- the foo element is in no namespace, neither is the attr attribute --> </foo>
These two documents are semantically equivalement, as namespaces matter, not prefixes. <?xml version="1.0"?> <myns:foo xmlns:myns="http://www.example.com/my-namespace"> </myns:foo> <?xml version="1.0"?> <ns:foo xmlns:ns="http://www...
import pandas as pd Create a DataFrame from a dictionary, containing two columns: numbers and colors. Each key represent a column name and the value is a series of data, the content of the column: df = pd.DataFrame({'numbers': [1, 2, 3], 'colors': ['red', 'white', 'blue']}) Show contents of d...
Create a DataFrame of random numbers: import numpy as np import pandas as pd # Set the seed for a reproducible sample np.random.seed(0) df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC')) print(df) # Output: # A B C # 0 1.764052 0.400157 0.9787...
Single line comments are preceded by --, and go until the end of the line: SELECT * FROM Employees -- this is a comment WHERE FName = 'John'
Multi-line code comments are wrapped in /* ... */: /* This query returns all employees */ SELECT * FROM Employees It is also possible to insert such a comment into the middle of a line: SELECT /* all columns: */ * FROM Employees
Imports System.Reflection Public Class PropertyExample Public Function GetMyProperties() As PropertyInfo() Dim objProperties As PropertyInfo() objProperties = Me.GetType.GetProperties(BindingFlags.Public Or BindingFlags.Instance) Return objProperties End Fun...
As Handlers are used to send Messages and Runnables to a Thread's message queue it's easy to implement event based communication between multiple Threads. Every Thread that has a Looper is able to receive and process messages. A HandlerThread is a Thread that implements such a Looper, for example th...
Swift NSNotificationCenter.defaultCenter().postNotificationName("TestNotification", object: self) Objective-C [[NSNotificationCenter defaultCenter] postNotificationName:@"TestNotification" object:nil];
Swift let userInfo: [String: AnyObject] = ["someKey": myObject] NSNotificationCenter.defaultCenter().postNotificationName("TestNotification", object: self, userInfo: userInfo) Objective-C NSDictionary *userInfo = [NSDictionary dictionaryWithObject:myObject forKey:@"som...
Swift func testNotification(notification: NSNotification) { let userInfo = notification.userInfo let myObject: MyObject = userInfo["someKey"] } Objective-C - (void)testNotification:(NSNotification *)notification { NSDictionary *userInfo = notification.userInfo; My...
Use Ctrl + C, Ctrl + C to exit iex(1)> BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution Use Ctrl+ \ to immediately exit
#You can use pattern matching to run different #functions based on which parameters you pass #This example uses pattern matching to start, #run, and end a recursive function defmodule Counter do def count_to do count_to(100, 0) #No argument, init with 100 end def ...
Syntax: REPLACE( String to search , String to search for and replace , String to place into the original string ) Example: SELECT REPLACE( 'Peter Steve Tom', 'Steve', 'Billy' ) --Return Values: Peter Billy Tom
p { margin:1px; /* 1px margin in all directions */ /*equals to:*/ margin:1px 1px; /*equals to:*/ margin:1px 1px 1px; /*equals to:*/ margin:1px 1px 1px 1px; } Another exapmle: p{ margin:10px 15px; /...
g$ The above matches one letter (the letter g) at the end of a string in most regex engines (not in Oniguruma, where the $ anchor matches the end of a line by default, and the m (MULTILINE) modifier is used to make a . match any characters including line break characters, as a DOTALL modifier in ...
You can use subqueries to define a temporary table and use it in the FROM clause of an "outer" query. SELECT * FROM (SELECT city, temp_hi - temp_lo AS temp_var FROM weather) AS w WHERE temp_var > 20; The above finds cities from the weather table whose daily temperature variation i...
The following example finds cities (from the cities example) whose population is below the average temperature (obtained via a sub-qquery): SELECT name, pop2000 FROM cities WHERE pop2000 < (SELECT avg(pop2000) FROM cities); Here: the subquery (SELECT avg(pop2000) FROM cities) is used to s...
Subqueries can also be used in the SELECT part of the outer query. The following query shows all weather table columns with the corresponding states from the cities table. SELECT w.*, (SELECT c.state FROM cities AS c WHERE c.name = w.city ) AS state FROM weather AS w;

Page 121 of 826