navigator.mediaDevices is the common method adapted in Chrome and FF to getUserMedia as of now.
A promised based call back which returns local stream on success
navigator.mediaDevices.getUserMedia({ audio: true, video: true })
.then(stream => {
// attach this stream to window obje...
GTKWave is a fully feature graphical viewing package that supports several graphical data storage standards, but it also happens to support VCD, which is the format that vvp will output. So, to pick up GTKWave, you have a couple options
Goto http://gtkwave.sourceforge.net/gtkwave.zip and downloa...
This example uses Icarus and GTKWave. Installation instructions for those tools on OSx are provided elsewhere on this page.
Lets begin with the module design. This module is a BCD to 7 segment display. I have coded the design in an obtuse way simply to give us something that is easily broken and...
A Java 8 compatibility kit for Scala.
Most examples are copied from Readme
Converters between scala.FunctionN and java.util.function
import java.util.function._
import scala.compat.java8.FunctionConverters._
val foo: Int => Boolean = i => i > 7
def testBig(ip: IntPredicate) = ip.tes...
enum ReadResult{
case Successful
case Failed
case Pending
}
struct OutpuData {
var data = Data()
var result: ReadResult
var error: Error?
}
func readData(from url: String, completion: @escaping (OutpuData) -> Void) {
var _data = OutpuData(data: Data(), ...
IServiceCollection
To start building an IOC container with Microsoft's DI nuget package you start with creating an IServiceCollection. You can use the already provided Collection: ServiceCollection:
var services = new ServiceCollection();
This IServiceCollection is nothing more than an implemen...
The vertical layout set up the object inside it vertically.
#include "mainwindow.h"
#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication...
The QTimer::singleShot is used to call a slot/lambda asynchronously after n ms.
The basic syntax is :
QTimer::singleShot(myTime, myObject, SLOT(myMethodInMyObject()));
with myTime the time in ms, myObject the object which contain the method and myMethodInMyObject the slot to call
So for exampl...
tf.gather_nd is an extension of tf.gather in the sense that it allows you to not only access the 1st dimension of a tensor, but potentially all of them.
Arguments:
params: a Tensor of rank P representing the tensor we want to index into
indices: a Tensor of rank Q representing the indices into ...
Let's suppose we want raise x to a number y.
You'd write this as:
def raise_power(x, y):
return x**y
What if your y value can assume a finite set of values?
Let's suppose y can be one of [3,4,5] and let's say you don't want offer end user the possibility to use such function since it is v...
To set up a simple hibernate project using XML for the configurations you need 3 files, hibernate.cfg.xml, a POJO for each entity, and a EntityName.hbm.xml for each entity. Here is an example of each using MySQL:
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
&...
Eclipse can generate basic getters and setters for you. Right click in you class file and go to Source - Generate Getters and Setters (ALT+SHIFT+S). This will open a dialog where you can choose which fields you would like to have getters and setters generated for.
QtCreator is, at the moment, the best tool to create a Qt application. In this example, we will see how to create a simple Qt application which manage a button and write text.
To create a new application click on File->New File or Project:
Then choose the Projects->Application->Qt Widge...
Go will throw an error when there is a variable that is unused, in order to encourage you to write better code. However, there are some situations when you really don't need to use a value stored in a variable. In those cases, you use a "blank identifier" _ to assign and discard the assign...