Tutorial by Examples: amp

In case your activities, fragments and UI require some background processing a good thing to use is a MockWebServer which runs localy on an android device which brings a closed and testable enviroment for your UI. https://github.com/square/okhttp/tree/master/mockwebserver First step is including t...
This is the basic HTML file that can be used as a boilerplate when starting a project. This boilerplate uses orbit controls with damping (camera that can move around an object with deceleration effect) and creates a spinning cube. <!DOCTYPE html> <html> <head> <t...
I like to wrap my OkHttp into a class called HttpClient for example, and in this class I have methods for each of the major HTTP verbs, post, get, put and delete, most commonly. (I usually include an interface, in order to keep for it to implement, in order to be able to easily change to a different...
getTimeStemp is a unix representation of a datetime object. $date = new DateTime(); echo $date->getTimestamp(); this will out put an integer indication the seconds that have elapsed since 00:00:00 UTC, Thursday, 1 January 1970.
The & character appears first in entity references and must be escaped in element content or in attribute content. <?xml version="1.0"?> <document attribute="An ampersand is escaped as &"> An ampersand can also be escaped as & in element conte...
Suppose we want to query the "cheapest products" from the "top categories". Here is an example of query using Common Table Expressions -- all_sales: just a simple SELECT with all the needed JOINS WITH all_sales AS ( SELECT product.price as product_price, category.id a...
db.posts.find().forEach(function(doc){ if(doc._id){ db.posts.update({_id: doc._id}, {$set:{ timestamp: new Date(parseInt(doc._id.str.slice(0,8), 16) *1000) }}, false, true); } });
Purpose Use the CREATE SEQUENCE statement to create a sequence, which is a database object from which multiple users may generate unique integers. You can use sequences to automatically generate primary key values. When a sequence number is generated, the sequence is incremented, independent of th...
Backbone.js is made up of four separate components: Collections, Models, Routers, and Views. Each of these serve different purposes: Model - represents a single data object, but adds additional functionalities not provided by native JavaScript objects, such as an event system and a more conveni...
Create a new project It can be just a Single View Application. Add the code Create a new Cocoa Touch Class file (File > New > File... > iOS > Cocoa Touch Class). Name it MyCollectionViewCell. This class will hold the outlets for the views that you add to your cell in the storyboard. ...
import scala.util.parsing.combinator._ class SimpleParser extends RegexParsers { // Define a grammar rule, turn it into a regex, and apply it the input. def word: Parser[String] = """[A-Z][a-z]+""".r ^^ { _.toString } } object SimpleParser extends SimplePar...
Below code showcases multiple Producer/Consumer program. Both Producer and Consumer threads share same global queue. import java.util.concurrent.*; import java.util.Random; public class ProducerConsumerWithES { public static void main(String args[]) { BlockingQueue<Integer> ...
xml_import_example.info.yml type: module name: XML import example package: Examples description: "This module helps understanding the Batch API and Queue API with an XML import example" core: 8.x xml_import_example.permissions.yml import content from xml: title: 'Import content...
public partial class Form1 : Form { Timer myTimer = new Timer(); int timeLeft = 10; public Form1() { InitializeComponent(); //set properties for the Timer myTimer.Interval = 1000; myTimer.Enabled = tru...
Given a simple DataObject like this: class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar(255)' ); } To provide full Create-Read-Update-Delete for the objects then this is the ModelAdmin code required: class MyModelAdmin extends ModelAd...
The Timeline object allows you to get the execution time for each node in the graph: you use a classic sess.run() but also specify the optional arguments options and run_metadata you then create a Timeline object with the run_metadata.step_stats data Here is an example program that measures...
The NVIDIA installation guide ends with running the sample programs to verify your installation of the CUDA Toolkit, but doesn't explicitly state how. First check all the prerequisites. Check the default CUDA directory for the sample programs. If it is not present, it can be downloaded from the offi...
The tf.py_func(func, inp, Tout) operator creates a TensorFlow operation that calls a Python function, func on a list of tensors inp. See the documentation for tf.py_func(func, inp, Tout). Warning: The tf.py_func() operation will only run on CPU. If you are using distributed TensorFlow, the tf.py_f...
main.component.ts import {Component} from "@angular/core"; @Component({ selector: "main", template: ` <StackLayout> <TextField hint="some text"></TextField> <Button text="Click me" class="btn">...
installing npm install web-component-tester --save-dev setting up wct.conf.js module.exports = { verbose: true, plugins: { local: { browsers: ['chrome'] } } }; running node node_modules/web-component-tester/bin/wct test/index.html <html...

Page 10 of 46