The window resize events can fire in response to the movement of the user's input device. When you resize a canvas it is automatically cleared and you are forced to re-render the content. For animations you do this every frame via the main loop function called by requestAnimationFrame which does its...
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
email = db.Column(db.String(120), unique=True)
posts = db.relationship('Post', backref='user')
class Post(db.Model):
id = db.Column(db.Integer,...
A typical example of the implementation of a Looper thread given by the official documentation uses Looper.prepare() and Looper.loop() and associates a Handler with the loop between these calls.
class LooperThread extends Thread {
public Handler mHandler;
public void run() {
Lo...
Numeric literals of more than a few digits are hard to read.
Pronounce 7237498123.
Compare 237498123 with 237499123 for equality.
Decide whether 237499123 or 20249472 is larger.
C++14 define Simple Quotation Mark ' as a digit separator, in numbers and user-defined literals. This can make it ...
There are many ways to use MaterializeCSS framework.
Few things to keep in mind before going to installation
It is not a CSS only framwork, though it has CSS name in it. We can use its SCSS too
It is not built for Angular
It is a component framework too built on jquery. Though we are not supp...
package com.streams;
import java.io.*;
public class DataStreamDemo {
public static void main(String[] args) throws IOException {
InputStream input = new FileInputStream("D:\\datastreamdemo.txt");
DataInputStream inst = new DataInputStream(input);
int count...
Locate and open your TIBCO BW bwengine.tra file typlically under TIBCO_HOME/bw/5.12/bin/bwengine.tra (Linux environment)
Look for the line that states:
*** Common variables. Modify these only. ***
Add the following line right after that section
tibco.deployment=%tibco.deployment%
...
A minimal setup for camera output preview (Swift 2, Swift 3)
import UIKit
import AVFoundation
class ViewController: UIViewController {
var session: AVCaptureSession?
var cameraPreviewLayer: AVCaptureVideoPreviewLayer?
override func viewDidLoad() {
super.viewDidLoad()
...
One can use the following methods in order to import a Mercurial Repo into Git:
Using fast export:
cd
git clone git://repo.or.cz/fast-export.git
git init git_repo
cd git_repo
~/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo
git checkout HEAD
Using Hg-Git:
A very deta...
Rowid : The row ID is a unique identifier that is generated by the cart code when an item is added to the cart. The reason a unique ID is created is so that identical products with different options can be managed by the cart.
Every item in cart has a rowid element and by rowid you can update cart ...
You can also add same custom created taxonomy into post type page using below code.
function add_taxonomies_to_pages() {
register_taxonomy_for_object_type( 'genre', 'page' );
}
add_action( 'init', 'add_taxonomies_to_pages' );
Add above code into your theme's functions.php file. Same way...
First of all you need to create AVAssetWriter
NSError *error = nil;
NSURL *outputURL = <#NSURL object representing the URL where you want to save the video#>;
AVAssetWriter *assetWriter = [AVAssetWriter assetWriterWithURL:outputURL fileType:AVFileTypeQuickTimeMovie error:&error];
if (!...
Given a multidimensional array:
my_array = [[1, 2], ['a', 'b']]
the operation of flattening is to decompose all array children into the root array:
my_array.flatten
# [1, 2, 'a', 'b']
import networkx as nx # importing networkx package
import matplotlib.pyplot as plt # importing matplotlib package and pyplot is for displaying the graph on canvas
b=nx.Graph()
b.add_node('helloworld')
b.add_node(1)
b.add_node(2)
'''Node can be called by any python-hashable obj like string,nu...
Detailed instructions on getting kinect set up or installed.Setting Up a Kinect Sensor
Kinect for Windows 1.5, 1.6, 1.7, 1.8
Here are some simple steps to get your Kinect sensor up and running.
Step 1: Mount the Sensor on a Stable Surface
Place the sensor on a stable surface in a location wh...