Tutorial by Examples

It is always recommend to go to the LLVM official website and follow the installation guides depending on your OS. If you are working on posix then in short you have to add one of the official LLVM package repositories. For example if you work on Ubuntu Xenial (16.04) you add a deb and deb-src entr...
There are currently three YouTube APIs available to the public: YouTube Data API YouTube Analytics API YouTube Reporting API Each of these offer different functionality and are treated as separate, individual APIs. Since YouTube is a subsidiary of Google, the various YouTube APIs are provid...
Macros are simple string replacements. (Strictly speaking, they work with preprocessing tokens, not arbitrary strings.) #include <stdio.h> #define SQUARE(x) x*x int main(void) { printf("%d\n", SQUARE(1+2)); return 0; } You may expect this code to print 9 (3*3), ...
DatePickerDialog is the simplest way to use DatePicker, because you can show dialog anywhere in your app. You don't have to implement your own layout with DatePicker widget. How to show dialog: DatePickerDialog datePickerDialog = new DatePickerDialog(context, listener, year, month, day); datePick...
DatePicker allows user to pick date. When we create new instance of DatePicker, we can set initial date. If we don't set initial date, current date will be set by default. We can show DatePicker to user by using DatePickerDialog or by creating our own layout with DatePicker widget. Also we can ...
Below are the PHP5 SuperGlobals $GLOBALS $_REQUEST $_GET $_POST $_FILES $_SERVER $_ENV $_COOKIE $_SESSION $GLOBALS: This SuperGlobal Variable is used for accessing globals variables. <?php $a = 10; function foo(){ echo $GLOBALS['a']; } //Which will print 10 Glo...
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=client_credentials&client_id=[APP_KEY]&client_secret=[APP_SECRET] Source
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=password&username=[USERNAME]&password=[PASSWORD] &client_id=[APP_KEY]&client_secret=[APP_SECRET] Source
Step 1 GET /authorize?response_type=code&client_id=[APP_KEY]&state=[RANDOM_STRING] &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb &scope=[OPTIONAL_SCOPES] HTTP/1.1 Host: server.example.com Step 2 POST /token HTTP/1.1 Host: server.example.com Content-Type: a...
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=refresh_token&refresh_token=[REFRESH_TOKEN] &client_id=[APP_KEY]&client_secret=[APP_SECRET] Source
The function chomp will remove one newline character, if present, from each scalar passed to it. chomp will mutate the original string and will return the number of characters removed my $str = "Hello World\n\n"; my $removed = chomp($str); print $str; # "Hello World\n" pr...
To use multiple databases in Django, just specify each one in settings.py: DATABASES = { 'default': { 'NAME': 'app_data', 'ENGINE': 'django.db.backends.postgresql', 'USER': 'django_db_user', 'PASSWORD': os.environ['LOCAL_DB_PASSWORD'] }, 'users': {...
The normal obj.save() method will use the default database, or if a database router is used, it will use the database as specified in db_for_write. You can override it by using: obj.save(using='other_db') obj.delete(using='other_db') Similarly, for reading: MyModel.objects.using('other_db').al...
Ansible uses the concept of roles to better allow modular code and avoid repeating yourself. A role is simply a folder structure that Ansible knows where to load vars files, tasks and handlers from. An example might look something like this: apache/ ├── defaults │   └── main.yml ├── files │   ...
Roles also enable you to define other roles as a dependency by creating a meta/main.yml file with a dependencies block: dependencies: - role: common It's also possible to pass a value to a parameter/variable in the dependent role: dependencies: - { role: common, some_parameter: 3 } Or ...
It's also possible to easily share roles with the community or download roles that have been created by other members of the community with Ansible Galaxy. Ansible ships with a command line tool called ansible-galaxy that can be used to install roles in the role directory defined in the ansible.cfg...
class Digit { public Digit(double d) { val = d; } public double val; // User-defined conversion from Digit to double public static implicit operator double(Digit d) { Console.WriteLine("Digit to double implict conversion called"); return d.val;...
Above I noticed an example to remove items from a List within a Loop and I thought of another example that may come in handy this time using the Iterator interface. This is a demonstration of a trick that might come in handy when dealing with duplicate items in lists that you want to get rid of. N...
Use a singular name for most Enums public enum Volume { Low, Medium, High } Use a plural name for Enum types that are bit fields [Flags] public enum MyColors { Yellow = 1, Green = 2, Red = 4, Blue = 8 } Note: Always add the FlagsAttribute to a bit field E...
The left-shift operator (<<) can be used in flag enum declarations to ensure that each flag has exactly one 1 in binary representation, as flags should. This also helps to improve readability of large enums with plenty of flags in them. [Flags] public enum MyEnum { None = 0, Fl...

Page 449 of 1336