Tutorial by Examples: f

sqlite> SELECT TYPEOF(NULL); null sqlite> SELECT TYPEOF(42); integer sqlite> SELECT TYPEOF(3.141592653589793); real sqlite> SELECT TYPEOF('Hello, world!'); text sqlite> SELECT TYPEOF(X'0123456789ABCDEF'); blob
SQLite uses dynamic typing and ignores declared column types: > CREATE TABLE Test ( Col1 INTEGER, Col2 VARCHAR(2), -- length is ignored, too Col3 BLOB, Col4, -- no type required Col5 FLUFFY BUNNIES -- use whatever you want ); > ...
Using Alternatives Many Linux distributions use the alternatives command for switching between different versions of a command. You can use this for switching between different versions of Java installed on a machine. In a command shell, set $JDK to the pathname of a newly installed JDK; e.g....
Dependencies can be added for specific product flavors in a similar fashion as build configurations. android { ... productFlavors { flavor1 { //... } flavor2 { //... } } } dependencies { flavor1Compile 'com.and...
If you need to copy a database from one server to another, you have two options: Option 1: Store the dump file in the source server Copy the dump file to your destination server Load the dump file into your destination server On the source server: mysqldump [options] > dump.sql On th...
Below is example of service decorator, overriding null date returned by service. angular.module('app', []) .config(function($provide) { $provide.decorator('myService', function($delegate) { $delegate.getDate = function() { // override with actual date object return new Date(...
To remove an element from a map use the .delete() method. map.delete(key); Example: const map = new Map([[1, 2], [3, 4]]); console.log(map.get(3)); // 4 map.delete(3); console.log(map.get(3)); // undefined This method returns true if the element existed and has been removed, otherwise fal...
To check if a key exists in a Map, use the .has() method: map.has(key); Example: const map = new Map([[1, 2], [3, 4]]); console.log(map.has(1)); // true console.log(map.has(2)); // false
To get the numbers of elements of a Map, use the .size property: const map = new Map([[1, 2], [3, 4]]); console.log(map.size); // 2
EntityState.Added can be set in two fully equivalent ways: By setting the state of its entry in the context: context.Entry(entity).State = EntityState.Added; By adding it to a DbSet of the context: context.Entities.Add(entity); When calling SaveChanges, the entity will be inse...
Setting the state of an object graph (a collection of related entities) to Added is different than setting a single entity as Added (see this example). In the example, we store planets and their moons: Class model public class Planet { public Planet() { Moons = new HashSet<...
Using requestAnimationFrame may on some systems update at more frames per second than the 60fps. 60fps is the default rate if the rendering can keep up. Some systems will run at 120fps maybe more. If you use the following method you should only use frame rates that are integer divisions of 60 so th...
Building project dependencies can sometimes be a tedious task. Instead of publishing a package version to NPM and installing the dependency to test the changes, use npm link. npm link creates a symlink so the latest code can be tested in a local environment. This makes testing global tools and proje...
First, let's see three different ways of extracting data from a file. string fileText = File.ReadAllText(file); string[] fileLines = File.ReadAllLines(file); byte[] fileBytes = File.ReadAllBytes(file); On the first line, we read all the data in the file as a string. On the second line, we r...
This example is about replacing a List element while ensuring that the replacement element is at the same position as the element that is replaced. This can be done using these methods: set(int index, T type) int indexOf(T type) Consider an ArrayList containing the elements "Program sta...
A conversion that involves calling an explicit constructor or conversion function can't be done implicitly. We can request that the conversion be done explicitly using static_cast. The meaning is the same as that of a direct initialization, except that the result is a temporary. class C { std:...
You can use built-in functions to run PHP processes as forks. This is the most simple way to achieve parallel work if you don't need your threads to talk to each other. This allows you to put time intensive tasks (like uploading a file to another server or sending an email) to another thread so you...
C++17 Whenever a case is ended in a switch, the code of the next case will get executed. This last one can be prevented by using the ´break` statement. As this so-called fallthrough behavior can introduce bugs when not intended, several compilers and static analyzers give a warning on this. From ...
1. A Simple Complete Example We could use this sample code to upload the files selected by the user every time a new file selection is made. <input type="file" id="file-input" multiple>   var files; var fdata = new FormData(); $("#file-input").on("cha...
A pointer to member of derived class can be converted to a pointer to member of base class using static_cast. The types pointed to must match. If the operand is a null pointer to member value, the result is also a null pointer to member value. Otherwise, the conversion is only valid if the member ...

Page 244 of 457