Tutorial by Examples: alexa

To write the traditional Hello World program in Rust, create a text file called hello.rs containing the following source code: fn main() { println!("Hello World!"); } This defines a new function called main, which takes no parameters and returns no data. This is where your progra...
views.py: from django.http import HttpResponse from django.views.generic import View class MyView(View): def get(self, request): # <view logic> return HttpResponse('result') urls.py: from django.conf.urls import url from myapp.views import MyView urlpatterns...
User input Imagine you want a user to enter a number via input. You want to ensure that the input is a number. You can use try/except for this: Python 3.x3.0 while True: try: nb = int(input('Enter a number: ')) break except ValueError: print('This is not a num...
Given a simple PHP class: class Car { private $speed = 0; public getSpeed() { return $this->speed; } public function accelerate($howMuch) { $this->speed += $howMuch; } } You can write a PHPUnit test which tests the behavior of the class unde...
I'll demonstrate the basic usage of using functions vs using labels+gosub. In this example we'll implement simple functionality to add two numbers and store them in a variable. With functions: c := Add(3, 2) ; function call MsgBox, Result: %c% Add(a, b) { ; This is a function. Put it wherever...
#include <stdio.h> #include <math.h> #include <omp.h> #define N 1000000 int main() { double sum = 0; double tbegin = omp_get_wtime(); #pragma omp parallel for reduction( +: sum ) for ( int i = 0; i < N; i++ ) { sum += cos( i ); } ...
Real life use cases for Singleton pattern; If you are developing a client-server application, you need single instrance of ConnectionManager, which manages the life cycle of client connections. The basic APIs in ConnectionManager : registerConnection: Add new connection to existing list of connec...
Log in to the AWS Management Console and navigate to AWS Lambda. Click create new function then you will see this window. Select Runtime environment but blueprint (sample code) only for node.js and python There are two example conation for alexa skills kit. You can filter those thing. By s...
In Coq, destruct more or less corresponds to a case analysis. It is similar to induction except that there's no induction hypothesis. Here is a (admittedly rather trivial) example of this tactic: Require Import Coq.Arith.Lt. Theorem atLeastZero : forall a, 0 <= a. Proof. intros. destr...
In your activity layout activity_main.xml specify WebView component as following: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" ...
See this example here. import React, { Component } from 'react'; import { Text, View, StyleSheet, Button, Modal } from 'react-native'; import { Constants } from 'expo'; export default class App extends Component { state = { modalVisible: false, }; _handleButtonPress = () =&gt...
Generic example in a form of $a <=> $b matrix. 0 <=> 1; // -1 (left operand less than right, right is greater) 0 <=> 0; // 0 (operands are equal) 1 <=> 0; // 1 (left operand greater than right, left is greater) 1 <=> 1; // 0 (operands are equal) ╔═══════╦════╦═...
Q-learning is a variant of model-free reinforcement learning. In Q-learning we want the agent to estimate how good a (state, action) pair is so that it can choose good actions in each state. This is done by approximating an action-value function (Q) that fits in equation below: Where s and a are ...
{$DEFINE MyRuntimeCheck} // Comment out this directive when the check is no-longer required! // You can also put MyRuntimeCheck in the project defines instead. function MyRuntimeCheck: Boolean; {$IFNDEF MyRuntimeCheck} inline; {$ENDIF} begin result := TRU...
Installation pip install Flask-SQLAlchemy Simple Model 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) The code example above shows a simple Flask-SQLAlchemy model, we can add an ...

Page 1 of 1