Tutorial by Examples: er

db.collection.createIndex() method is used to create a 2dsphere index. The blueprint of a 2dsphere index : db.collection.createIndex( { <location field> : "2dsphere" } ) Here, the location field is the key and 2dsphere is the type of the index. In the following example we are goi...
NOTE: for best results, make sure your project was created using the Angular-CLI. npm install angular/{core,common,compiler,platform-browser,platform-browser-dynamic,http,router,forms,compiler-cli,tsc-wrapped,platform-server} You don't have to do this step if you project already has angular 2 an...
... "angularCompilerOptions": { "genDir": "./ngfactory" } ... This is the output folder of the compiler.
from the root of your project ./node_modules/.bin/ngc -p src where src is where all your angular 2 code lives. This will generate a folder called ngfactory where all your compiled code will live. "node_modules/.bin/ngc" -p src for windows
// this is the static platform browser, the usual counterpart is @angular/platform-browser-dynamic. import { platformBrowser } from '@angular/platform-browser'; // this is generated by the angular compiler import { AppModuleNgFactory } from './ngfactory/app/app.module.ngfactory'; // note the...
Once you've installed react and react-router, Its time to use both of them together. The syntax is very simple, you specify the url and the component you want to render when that url is opened <Route path="hello" component={ HelloComponent } /> This means when the url path is hell...
If there would be another value in the URL like: /Example/ProcessInput/2, the routing rules will threat the last number as a parameter passed into the action ProcessInput of controller Example. public ActionResult ProcessInput(int number) { ViewData["OutputMessage"] = string.format(...
Using a small transparent image called empty.png public class MyPage : ContentPage { public Page() { if (Device.OS == TargetPlatform.Android) NavigationPage.SetTitleIcon(this, "empty.png"); } }
Label label = new Label { Text = "text" }; if(Device.OS == TargetPlatform.iOS) { label.FontSize = label.FontSize - 2; }
At its core a perceptron model is one of the simplest supervised learning algorithms for binary classification. It is a type of linear classifier, i.e. a classification algorithm that makes its predictions based on a linear predictor function combining a set of weights with the feature vector. A ...
In this example I will go through the implementation of the perceptron model in C++ so that you can get a better idea of how it works. First things first it is a good practice to write down a simple algorithm of what we want to do. Algorithm: Make a the vector for the weights and initialize it ...
Classes may be defined using a .classname syntax: Code: a.button Result: <a class="button"></a> Since div's are such a common choice of tag, it is the default if you omit the tag name: Code: .content Result: <div class="content"></div>
IDs may be defined using a #idname syntax: Code: a#main-link Result: <a id="main-link"></a> Since div's are such a common choice of tag, it is the default if you omit the tag name: Code: #content Result: <div id="content"></div>
LaraDock is a Laravel Homestead like development environment but for Docker instead of Vagrant. https://github.com/LaraDock/laradock Installation *Requires Git and Docker Clone the LaraDock repository: A. If you already have a Laravel project, clone this repository on your Laravel root director...
This is an example of Serial Document Middleware In this example, We will write a middleware that will convert the plain text password into a hashed password before saving it in database. This middleware will automatically kick in when creating new user or updating existing user details. FILENA...
Use Ember CLI to generate a new helper in your app: ember generate helper format-currency Then edit helpers/format-currency.js to contain the following: import Ember from 'ember'; export function formatCurrency([value, ...rest]) { const dollars = Math.floor(value / 100); const cents = va...
In Oracle 12g+ SELECT Id, Col1 FROM TableName ORDER BY Id OFFSET 20 ROWS FETCH NEXT 20 ROWS ONLY; In earlier Versions SELECT Id, Col1 FROM (SELECT Id, Col1, row_number() over (order by Id) RowNumber FROM TableName) WHERE RowNumber BETWEEN 21 AND 40 ...
In Oracle 12g+ SELECT Id, Col1 FROM TableName ORDER BY Id OFFSET 5 ROWS; In earlier Versions SELECT Id, Col1 FROM (SELECT Id, Col1, row_number() over (order by Id) RowNumber FROM TableName) WHERE RowNumber > 20
This example shows how to find number of days between two dates. A date is specified by year/month/day of month, and additionally hour/minute/second. Program calculates number of days in years since 2000. #include <iostream> #include <string> #include <chrono> #include <cti...
Retrieves the information pertaining to the currently logged in user, and places it in the global variable $current_user This function does not accept any parameters. Usage: <?php wp_get_current_user(); ?> Example: <?php $current_user = wp_get_current_user(); echo 'Usernam...

Page 284 of 417