Tutorial by Examples: au

The PrettyPrinter utility will 'pretty print' XML documents. The following code snippet pretty prints unformatted xml: import scala.xml.{PrettyPrinter, XML} val xml = XML.loadString("<a>Alana<b><c>Beth</c><d>Catie</d></b></a>") val formatt...
DELETE FROM `table_name` WHERE `field_one` = 'value_one' This will delete all rows from the table where the contents of the field_one for that row match 'value_one' The WHERE clause works in the same way as a select, so things like >, <, <> or LIKE can be used. Notice: It is necessa...
There are few approaches available there: You can subscribe for keyboard appearance events notifications and change offset manually: //Swift 2.0+ override func viewDidLoad() { super.viewDidLoad() NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(YourVCClas...
OPERATORS $postsGreaterThan = Post::find()->where(['>', 'created_at', '2016-01-25'])->all(); // SELECT * FROM post WHERE created_at > '2016-01-25' $postsLessThan = Post::find()->where(['<', 'created_at', '2016-01-25'])->all(); // SELECT * FROM post WHERE created_at < '2...
UDP is a connectionless protocol. Messages to other processes or computers are sent without establishing any sort of connection. There is no automatic confirmation if your message has been received. UDP is usually used in latency sensitive applications or in applications sending network wide broadca...
UDP is a connectionless protocol. This means that peers sending messages do not require establishing a connection before sending messages. socket.recvfromthus returns a tuple (msg [the message the socket received], addr [the address of the sender]) A UDP server using solely the socket module: from...
//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...
Generally you should avoid using the default database role (often postgres) in your application. You should instead create a user with lower levels of privileges. Here we make one called niceusername and give it a password very-strong-password CREATE ROLE niceusername with PASSWORD 'very-strong-pas...
Create an instance of UIScrollView with a CGRect as frame. Swift let scrollview = UIScrollView.init(frame: CGRect(x: 0, y: 0, width: 320, height: 400)) Objective-C UIScrollView *scrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
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;
Swift textField.autocapitalizationType = .None Objective-C textField.autocapitalizationType = UITextAutocapitalizationTypeNone; All options: .None \ UITextAutocapitalizationTypeNone : Don't autocapitalize anything .Words \ UITextAutocapitalizationTypeWords : Autocapitalize every word .S...
If the user authorizes your application, they will be redirected to the following URL: https://[your registered redirect URI]/#access_token=[an access token] &scope=[authorized scopes] Note that the access token is in the URL fragment and not the query string. This means the value w...
Glide includes two default transformations, fit center and center crop. Fit center: Glide.with(context) .load(yourUrl) .fitCenter() .into(yourView); Fit center performs the same transformation as Android's ScaleType.FIT_CENTER. Center crop: Glide.with(context) .load(yourUr...
The .GetValueOrDefault() method returns a value even if the .HasValue property is false (unlike the Value property, which throws an exception). class Program { static void Main() { int? nullableExample = null; int result = nullableExample.GetValueOrDefault(); C...
When filtering a URL filter_var() will return the filtered data, in this case the URL, or false if a valid URL cannot be found: URL: example.com var_dump(filter_var('example.com', FILTER_VALIDATE_URL)); var_dump(filter_var('example.com', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)); var_du...
The nodemon package makes it possible to automatically reload your program when you modify any file in the source code. Installing nodemon globally npm install -g nodemon (or npm i -g nodemon) Installing nodemon locally In case you don't want to install it globally npm install --save-dev nodemo...
A UDP server is easily created using the socketserver library. a simple time server: import time from socketserver import BaseRequestHandler, UDPServer class CtimeHandler(BaseRequestHandler): def handle(self): print('connection from: ', self.client_address) # Get message and cli...
You can use an initializer to set default property values: struct Example { var upvotes: Int init() { upvotes = 42 } } let myExample = Example() // call the initializer print(myExample.upvotes) // prints: 42 Or, specify default property values as a part of the property...

Page 6 of 37