Tutorial by Examples

StackLayout organizes views in a one-dimensional line ("stack"), either horizontally or vertically. Views in a StackLayout can be sized based on the space in the layout using layout options. Positioning is determined by the order views were added to the layout and the layout options of the...
Small Core, Small Module :- Build small and single purpose modules not in term of code size only, but also in term of scope that serves a single purpose a - "Small is beautiful" b - "Make each program do one thing well." The Reactor Pattern The Reactor Pattern is t...
Open "Database Tool Window" if you don't have it opened: This what it looks like: Create new data source: By clicking on "+" icon: Or by opening "Data Sources and Drivers" dialog And adding new data source by clicking "+" there If you ...
Authentication in Django REST Framework can be configured globally as a subkey of the REST_FRAMEWORK variable in settings.py, just like the rest of the default framework configurations. REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthen...
Authentication can be set for an specific APIView endpoint, by using the authentication_classes variable: from rest_framework.authentication import SessionAuthentication, BasicAuthentication from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response ...
Django REST Framework provides a basic token-based authentication mechanism which needs to be configured as an application in Django before being usable, so that tokens are created in the database, and their lifecycle handled. Add Token-based authentication to settings.py INSTALLED_APPS = ( ...
OAuth is not handled by Django REST Framework, but there are a couple of pip modules that implement an OAuth client. The REST Framework documentation suggests one of the following modules: Django OAuth Toolkit Django REST Framework OAuth Django OAuth Toolkit pip install django-oauth-toolkit ...
The most interesting package for managing real tokens is django-rest-knox which supports multiple tokens per user (and cancelling each token independently), as well as having support for token expiration and several other security mechanisms. django-rest-knox depends on cryptography. You can find m...
A simple example of Vehicle hierarchy can be taken for single table inheritance strategy. Abstract Vehicle class: package com.thejavageek.jpa.entities; import javax.persistence.DiscriminatorColumn; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persi...
Simplicity Probably the best part of CoffeeScript is its simplicity. CoffeeScript allows for a more concise and simplistic syntax than plain JavaScript. One simple but surprisingly time-saving feature is that CoffeeScript has no need for ; or {}, eliminating the need to spend hours finding out the ...
This sample uses a ToDataReader method described here Creating a Generic List DataReader for SqlBulkCopy. This can also be done using non-async methods. public class Widget { public int WidgetId {get;set;} public string Name {get;set;} public int Quantity {get;set;} } public as...
This sample uses a ToDataReader method described here Creating a Generic List DataReader for SqlBulkCopy. This can also be done using async methods. public class Widget { public int WidgetId {get;set;} public string Name {get;set;} public int Quantity {get;set;} } public void A...
Play contains several tasks, which can be tagged: - name: Install applications hosts: all become: true tasks: - name: Install vim apt: name=vim state=present tags: - vim - name: Install screen apt: name=screen state=present tags: - s...
Static initialization is suitable for most situations. When your application must delay the instantiation, use a non-default constructor or perform other tasks before the instantiation, and work in a multithreaded environment, you need a different solution. Cases do exist, however, in which you cann...
MongoDB.connect('mongodb://localhost:27017/databaseName', function(error, database) { if(error) return console.log(error); const collection = database.collection('collectionName'); collection.insert({key: 'value'}, function(error, result) { console.log(error, result); }); }...
const MongoDB = require('mongodb'); MongoDB.connect('mongodb://localhost:27017/databaseName') .then(function(database) { const collection = database.collection('collectionName'); return collection.insert({key: 'value'}); }) .then(function(result) { co...
You must always unregister scopes other then your current scope as shown below: //always deregister these $rootScope.$on(...); $scope.$parent.$on(...); You don't have to deregister listners on current scope as angular would take care of it: //no need to deregister this $scope.$on(...); $r...
Font Awesome is an extremely simple yet powerful library to use, with 634 icons available in just a few words. How does it work? Font Awesome uses Unicode characters stored in a ../fonts directory to change any i.fa elements to the respective unicode character, as such displaying the icon as text....
<div class="container content"> <div class="row"> <!--Main Content--> <div class="col-lg-9 col-lg-push-3"> Main Content </div> <!--Sidebar--> <div class=&quot...
Rewrite Class File: Namespace/ModuleName/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Ma...

Page 863 of 1336