Tutorial by Examples

Android O changes the way to work with fonts. Android O introduces a new feature, called Fonts in XML, which allows you to use fonts as resources. This means, that there is no need to bundle fonts as assets. Fonts are now compiled in an R file and are automatically available in the system as a reso...
The keyword function can be used to initiate pattern-matching on the the last argument of a function. For example, we can write a function called sum, which computes the sum of a list of integers, this way let rec sum = function | [] -> 0 | h::t -> h + sum t ;; val sum : int list -&...
Drop/Delete your database If you are using SQLite for your database, just delete this file. If you are using MySQL/Postgres or any other database system, you will have to drop the database and then recreate a fresh database. You will now need to delete all the migrations file except "init.py...
To access complete schema of server db instead of single table. Follow below steps: Create EXTENSION : CREATE EXTENSION postgres_fdw; Create SERVER : CREATE SERVER server_name FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'host_ip', dbname 'db_name', port 'port_numb...
For this example, we will used 4 bodies and will show only the last 8 bits of the bit masks for simplicity. The 4 bodies are 3 SKSpriteNodes, each with a physics body and a boundary: let edge = frame.insetBy(dx: 0, dy: 0) physicsBody = SKPhysicsBody(edgeLoopFrom: edge) Note that the 'ed...
If you have an Arduino connected to a computer or a Raspberry Pi, and want to send data from the Arduino to the PC you can do the following: Arduino: void setup() { // Opens serial port, sets data rate to 9600 bps: Serial.begin(9600); } void loop() { // Sends a line over serial: Se...
One of the tools for writing proper benchmark tests is JMH. Let's say we want to compare performance of searching an element in HashSet vs TreeSet. The easiest way to get JHM into your project - is to use maven and shade plugin. Also you can see pom.xml from JHM examples. <build> <pl...
You can include/install Select2 in one of the two ways Directly using CDN's in your project under the head section of your project. link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet"/> <script src="https://cdnjs...
╔═══════════╦════════════╦═══════════════════════════════════════════════════════════════════╗ ║ From ║ To ║ Example ║ ╠═══════════╬════════════╬═══════════════════════════════════════════════════════════════════╣ ║String ...
Ffmpeg is a swiss knife for streaming project. For any kind of device streaming you only need to get the specification of device. To list the device ffmpeg -f dshow -list_devices true -i dummy Command prompt will list all the aviable device on machine. [dshow @ 0000000004052420] DirectShow vid...
In Rx Subjects have internal states that can control their behavior. A common use-case form Subject is subscribing it to multiple Observables. The following example creates two different Observables and subscribes a Subject to both of them. Then it tries to print all values that went through: let ...
Let's implement a basic protocol that converts Kelvin and Fahrenheit temperatures to Celsius. defmodule Kelvin do defstruct name: "Kelvin", symbol: "K", degree: 0 end defmodule Fahrenheit do defstruct name: "Fahrenheit", symbol: "°F", degree: 0 en...
The basic unit of code used by JShell is the snippet, or source entry. Every time you declare a local variable or define a local method or class, you create a snippet whose name is the identifier of the variable/method/class. At any time, you can edit a snippet you have created with the /edit comman...
import SpriteKit import UIKit protocol StackViewDelegate: class { func didTapOnView(at index: Int) } class GameMenuView: UIStackView { weak var delegate: StackViewDelegate? override init(frame: CGRect) { super.init(frame: frame) self.axis = .vertical sel...
1) IP based vhosts <VirtualHost 192.168.13.37> ServerName example.com DocumentRoot /var/www/domains/example.com/html ErrorLog /var/log/example.com/error.log CustomLog /var/log/example.com/access.log common </VirtualHost> <VirtualHost 192.168.47.11> ...
Redis allow you to use the String data type to store floating point numbers. A user can set the float value of a key using the command: SET floatkey 2.0 The set command will create the key if necessary or update it if it already exists. The value of the key can be updated on the server using e...
In the JNDI declaration you may want to encrypt the username and password. You have to implement a custom datasource factory in order to be able to decrypt the credentials. In server.xml replace factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" by factory="cypher.MyCustomDataS...
Interceptors are a good tool for implementing cross-cutting concerns such as logging or authentication. Let's say we have a following service: public interface IService { string CreateOrder(NetworkCredential credentials, Order orderToCreate); string DeleteOrder(NetworkCredential credenti...
For registration like this: var container = new WindsorContainer(); container.Register( Component.For<FirstInterceptor>(), Component.For<SecondInterceptor>(), Component.For<ThirdInterceptor>(), Component.For<IService>() .ImplementedBy<Servi...
Providing your microsoft account credentials you can authenticate and receive subscription keys to start with the services. This document describes the various flows in the tool to create your own knowledge base. QnA Maker works in three steps: extraction, training and publishing. To start, feed ...

Page 1196 of 1336