Tutorial by Examples: sin

#lang racket (for ([path (in-directory)] #:when (regexp-match? #rx"[.]rkt$" path)) (printf "source file: ~a\n" path)) The #lang line specifies the programming language of this file. #lang racket we are using the baseline, battery-included Racket programming language. O...
Assuming you know the productID: First import StoreKit Then in your code let productID: Set = ["premium"] let request = SKProductsRequest(productIdentifiers: productID) request.delegate = self request.start() and in the SKProductsRequestDelegate: func productsRequest(request: ...
Python Code import numpy as np import cv2 #loading haarcascade classifiers for face and eye #You can find these cascade classifiers here #https://github.com/opencv/opencv/tree/master/data/haarcascades #or where you download opencv inside data/haarcascades face_cascade = cv2.CascadeClassi...
The simplest approach to parallel reduction in CUDA is to assign a single block to perform the task: static const int arraySize = 10000; static const int blockSize = 1024; __global__ void sumCommSingleBlock(const int *a, int *out) { int idx = threadIdx.x; int sum = 0; for (int i ...
Doing parallel reduction for a non-commutative operator is a bit more involved, compared to commutative version. In the example we still use a addition over integers for the simplicity sake. It could be replaced, for example, with matrix multiplication which really is non-commutative. Note, when ...
Sometimes the reduction has to be performed on a very small scale, as a part of a bigger CUDA kernel. Suppose for example, that the input data has exactly 32 elements - the number of threads in a warp. In such scenario a single warp can be assigned to perform the reduction. Given that warp execut...
Sometimes the reduction has to be performed on a very small scale, as a part of a bigger CUDA kernel. Suppose for example, that the input data has exactly 32 elements - the number of threads in a warp. In such scenario a single warp can be assigned to perform the reduction. Given that warp execut...
Typically, reduction is performed on global or shared array. However, when the reduction is performed on a very small scale, as a part of a bigger CUDA kernel, it can be performed with a single warp. When that happens, on Keppler or higher architectures (CC>=3.0), it is possible to use warp-shu...
Joins can also be used in a DELETE statement. Given a schema as follows: CREATE TABLE Users ( UserId int NOT NULL, AccountId int NOT NULL, RealName nvarchar(200) NOT NULL ) CREATE TABLE Preferences ( UserId int NOT NULL, SomeSetting bit NOT NULL ) We can delete rows...
<a data-bind="attr: { href: myUrl }">link with dynamic href</a> ko.applyBindings({ myUrl: ko.observable("http://www.stackoverflow.com") }); Since there is no native href binding in KnockoutJS, you need to use a different feature to get dynamic links. The abo...
> library(ggplot2) > ggplot(iris,aes(Sepal.Width)) + geom_density() + xlim(1,3.5) Using xlim or ylim the plot is not cutted, ggplot subsets the data before calling the stat function (stat_density in this case). You can see it in the warning message. Warning message: Removed 19 rows cont...
This example uses SqlConnection, but any IDbConnection is supported. Also any IDbTransaction is supported from the related IDbConnection. public void UpdateWidgetQuantity(int widgetId, int quantity) { using(var conn = new SqlConnection("{connection string}")) { conn.Open()...
Immutable is a great library that provides us with immutable versions of widely used types of collections, such as Lists, Stacks, Maps, and more. It simplifies the manipulation of the state and makes it easier to make pure calculations and avoid mutation. Let's see how the Basic reducer can be rew...
Objective: Use SignalR for notification between Web API, and TypeScript/JavaScript based Web App, where Web API and the Web App is hosted in different domain. Enabling SignalR and CORS on Web API: Create a standard Web API project, and install the following NuGet packages: Microsoft.Owin.Cors ...
If you want to check the existence of one file or do a couple of actions for every file in a folder you can use the Foreach Loop Container. You give the path and the file mask and it will run it for every file it finds
First step is create navigation interface which we will use on view model: public interface IViewNavigationService { void Initialize(INavigation navigation, SuperMapper navigationMapper); Task NavigateToAsync(object navigationSource, object parameter = null); Task GoBackAsync(); } ...
function lastRowForColumn(sheet, column){ // Get the last row with data for the whole sheet. var numRows = sheet.getLastRow(); // Get all data for the given column var data = sheet.getRange(1, column, numRows).getValues(); // Iterate backwards and find first non empty cell ...
The pyplot interface to matplotlib might be the simplest way to close a figure. import matplotlib.pyplot as plt plt.plot([0, 1], [0, 1]) plt.close()
A specific figure can be closed by keeping its handle import matplotlib.pyplot as plt fig1 = plt.figure() # create first figure plt.plot([0, 1], [0, 1]) fig2 = plt.figure() # create second figure plt.plot([0, 1], [0, 1]) plt.close(fig1) # close first figure although second one is active ...
Server side Meteor.methods({ getData() { return 'Hello, world!'; } }); Client side <template name="someData"> {{#if someData}} <p>{{someData}}</p> {{else}} <p>Loading...</p> {{/if}} </template> Template.someData.on...

Page 110 of 161