Tutorial by Examples

Another common use of HTTP APIs is to delete an existing resource. This should usually be done using DELETE requests. If the deletion was successful, the server should return 200 OK; an appropriate error code if it was not. If our employee Charlie Smith has left the company and we now want to dele...
The last common use of HTTP APIs is to obtain a list of existing resources on the server. Lists like this should be obtained using GET requests, since they only retrieve data. The server should return 200 OK if it can supply the list, or an appropriate error code if not. Listing our employees, the...
A cross-origin request must be sent including the Origin header. This indicates from where the request originated. For example, a cross-origin request from http://example.com to http://example.org would look like this: GET /cors HTTP/1.1 Host: example.org Origin: example.com The server will us...
The response to a CORS request must include an Access-Control-Allow-Origin header, which dictates what origins are allowed to use the CORS resource. This header can take one of three values: An origin. Doing this permits requests from that origin only. The character *. This permits requests from...
Allowing user credentials or the user's session to be sent with a CORS request allows the server to persist user data across CORS requests. This is useful if the server needs to check if the user is logged in before providing data (for example, only performing an action if a user is logged in - this...
A basic CORS request is allowed to use one of only two methods: GET POST and only a few select headers. POST CORS requests can additionally choose from only three content types. To avoid this issue, requests that wish to use other methods, headers, or content types must first issue a preflig...
When a server receives a preflight request, it must check if it supports the requested method and headers, and send back a response that indicates its ability to support the request, as well as any other permitted data (such as credentials). These are indicated in access-control Allow headers. The ...
var app = {}; app.signUp = function(){ app.userName = $('#userName').val(); app.password = $('#password').val(); app.email = $('#form-email').val(); app.phoneNumber = $('#form-phone').val(); app.emailRegex = ...
Mostly you will use "normal variables": set(VAR TRUE) set(VAR "main.cpp") set(VAR1 ${VAR2}) But CMake does also know global "cached variables" (persisted in CMakeCache.txt). And if normal and cached variables of the same name exist in the current scope, normal var...
To update CocoaPods by simply installing the gem again [sudo] gem install cocoapods Or for a pre-release version [sudo] gem install cocoapods --pre
The scope outside of any function or class is the global scope. When a PHP script includes another (using include or require) the scope remains the same. If a script is included outside of any function or class, it's global variables are included in the same global scope, but if a script is include...
The most important use of ranges is to express a sequence Syntax: (begin..end) => this construct will include end value (begin...end) => this construct will exclude end value or Range.new(begin,end,exclude_end) => exclude_end is by default false Most important end value must be gr...
A Regexp can be created in three different ways in Ruby. using slashes: / / using %r{} using Regex.new #The following forms are equivalent regexp_slash = /hello/ regexp_bracket = %r{hello} regexp_new = Regexp.new('hello') string_to_match = "hello world!" #All of th...
Sometimes you want to convert your enum to a String, there are two ways to do that. Assume we have: public enum Fruit { APPLE, ORANGE, STRAWBERRY, BANANA, LEMON, GRAPE_FRUIT; } So how do we convert something like Fruit.APPLE to "APPLE"? Convert using name() name() is an inte...
integer: 25 string: "25" float: 25.0 boolean: true null type: null
Same list level: - Cat - Dog - Goldfish Nested List: - - Cat - Dog - Goldfish
Superglobal variables are defined by PHP and can always be used from anywhere without the global keyword. <?php function getPostValue($key, $default = NULL) { // $_POST is a superglobal and can be used without // having to specify 'global $_POST;' if (isset($_POST[$key])) { ...
Static class properties that are defined with the public visibility are functionally the same as global variables. They can be accessed from anywhere the class is defined. class SomeClass { public static int $counter = 0; } // The static $counter variable can be read/written from anywhere...
When we want to count the number of items in an iterable, that meet some condition, we can use comprehension to produce an idiomatic syntax: # Count the numbers in `range(1000)` that are even and contain the digit `9`: print (sum( 1 for x in range(1000) if x % 2 == 0 and '9' in str...
let someValue : String = "Something the user entered" let text = NSMutableAttributedString(string: "The value is: ") text.appendAttributedString(NSAttributedString(string: someValue, attributes: [NSFontAttributeName:UIFont.boldSystemFontOfSize(UIFont.systemFontSize())])) ...

Page 455 of 1336