Tutorial by Examples: a

If you have an attribute that needs to be saved and retrieved to database as an object, then specify the name of that attribute using the serialize method and it will be handled automatically. The attribute must be declared as a text field. In the model you must declare the type of the field (Hash...
Here's a program which might benefit from refactoring. It's a simple program using C++11 which is intended to calculate and print all prime numbers from 1 to 100 and is based on a program that was posted on CodeReview for review. #include <iostream> #include <vector> #include <cma...
You need to get some details from your OAuth provider of choice. We'll be looking at Google, but ASP.NET is also set up to allow out-the-box use of Twitter, Facebook and Microsoft (obviously). You'll want to go to the Google developer console (https://console.developers.google.com/) and create a pr...
When someone registers with your application, a new ApplicationUser object will be stored in the database. By default the class is very barebones, but it can be customised - you can find it in Models > IdentityModels.cs. This is mine: public class ApplicationUser : IdentityUser { public ...
Go to Providers > ApplicationOAuthProvider.cs and edit the ValidateClientRedirectUri function. This was a big gotcha to me, as if you don't do this there'll be a fantastically unhelpful error message. By default, this code will make any callbacks to your site invalid unless they're to the site's ...
Here is the default flow of registering a user in Web API. All of these routes can be found in the AccountController: The user requests a list of the login providers using the GetExternalLogins route, passing a return URL as a parameter. This returns an array of provider objects, containing t...
I have found that the Web API template is broken - the default implementation relies on cookies in the final step, which you probably don't want to be using in a Rest API. Without a cookie, GetExternalLoginInfoAsync in RegisterExternal always returns null. I removed RegisterExternal entirely, inste...
The Shortest Common Super Sequence is a problem closely related to the longest common subsequence, which you can use as an external function for this task. The shortest common super sequence problem is a problem closely related to the longest common subsequence problem. A shortest common superseque...
public class ShortestCommonSupersequence { private static int Max(int a, int b) { return a > b ? a : b; } private static int Lcs(string x, string y, int m, int n) { var l = new int[m + 1, n + 1]; for (var i = 0; i <= m; i++) {...
Detailed instructions on getting systemjs set up or installed.
In this example, we will compile functions that computes sum and difference given two real number. from __future__ import print_function import theano import theano.tensor as T #define two symbolic scalar s_x = T.fscalar() s_y = T.fscalar() #compute something s_sum = s_x + s_y s_diff = ...
The most important part of your RMD file is the YAML header. For writing an academic paper, I suggest to use PDF output, numbered sections and a table of content (toc). --- title: "Writing an academic paper in R" author: "Author" date: "Date" output: pdf_documen...
By default, pandoc will use a Chicago author-date format for citations and references. To use another style, you will need to specify a CSL 1.0 style file in the csl metadata field. In the following a often used citation style, the elsevier style, is presented (download at https://github.com/citatio...
app.module.ts Add these into your app.module.ts file to use reactive forms import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AppComponent } from './app.comp...
Unary operators can be defined by prepending the operator with unary_. Unary operators are limited to unary_+, unary_-, unary_! and unary_~: class Matrix(rows: Int, cols: Int, val data: Seq[Seq[Int]]){ def +(that: Matrix) = { val newData = for (r <- 0 until rows) yield for (c <...
Detailed instructions on getting swig set up or installed.
scan is used for calling function multiple times over a list of values, the function may contain state. scan syntax (as of theano 0.9): scan( fn, sequences=None, outputs_info=None, non_sequences=None, n_steps=None, truncate_gradient=-1, go_backwards=False, m...
theano.map and theano.scan_module.reduce are wrappers of theano_scan. They can be seen as handicapped version of scan. You can view Basic scan usage section for reference. import theano import theano.tensor as T s_x = T.ivector() s_sqr, _ = theano.map( fn = lambda x:x*x, sequences = [s...
As of theano 0.9, while loops can be done via theano.scan_module.scan_utils.until. To use, you should return until object in fn of scan. In the following example, we build a function that checks whether a complex number is inside Mandelbrot set. A complex number z_0 is inside mandelbrot set if ser...
Unlike gets.chomp this will not wait for a newline. First part of the stdlib must be included require 'io/console' Then a helper method can be written: def get_char input = STDIN.getch control_c_code = "\u0003" exit(1) if input == control_c_code input end Its' imporan...

Page 821 of 1099