Tutorial by Examples: a

@* Adds AJAX functions support to a form. * The innerHTML of "target-element" is replaced by the result of SomeAction. *@ @using ( Ajax.BeginForm("SomeAction", "SomeController", new AjaxOptions { UpdateTargetI...
Create an F# console application. Change the Output type of the application to Windows Application. Add the FsXaml NuGet package. Add these four source files, in the order listed here. MainWindow.xaml <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...
It's a good idea to keep all icons and images in one or more folders. Right click on the project, and use F# Power Tools / New Folder to create a folder named Images. On disk, place your icon in the new Images folder. Back in Visual Studio, right click on Images, and use Add / Existing Item, then...
Create a text file named AppIcon.rc, with the following content. 1 ICON "AppIcon.ico" You will need an icon file named AppIcon.ico for this to work, but of course you can adjust the names to your liking. Run the following command. "C:\Program Files (x86)\Windows Kits\10\bin\x64\...
Add these two files in this order above the files for the main window. MyControl.xaml <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc=&quo...
This iteration changes a value from a starting point to an end, optionally by a specified value for each step. The default change is 1. DEFINE VARIABLE i AS INTEGER NO-UNDO. DO i = 10 TO 15: DISPLAY i WITH FRAME x1 6 DOWN . DOWN WITH FRAME x1. END. Result: ---------------i ...
Imagine you're testing code that makes a call to this interface, and you want to make sure your retry code is working. public interface DataStore { void save(Data data) throws IOException; } You could do something like this: public void saveChanges_Retries_WhenDataStoreCallFails() { ...
Adding dependcy To use a gruntplugin, you first need to add it as a dependency to your project. Let's use the jshint plugin as an example. npm install grunt-contrib-jshint --save-dev The --save-dev option is used to add the plugin in the package.json, this way the plugin is always installed aft...
import numpy as np import matplotlib.pyplot as plt # create some data x = np.arange(-2, 20, 0.5) # values of x y1 = map(lambda x: -4.0/3.0*x + 16, x) # values of y1(x) y2 = map(lambda x: 0.2*x**2 -5*x + 32, x) # svalues of y2(x) fig = plt.figure() ax1 = fig.add_subplo...
Import ReactiveFormsModule, and then import { Component, OnInit, OnDestroy } from '@angular/core'; import { FormControl } from '@angular/forms'; import { Subscription } from 'rxjs'; @Component({ selector: 'component', template: ` <input [formControl]="control" /> ...
For those of you that are new to programming in Swift and those of you coming from different programming bases, such as Python or Java, this article should be quite helpful. In this post, we will discuss a simple solution for implementing swift algorithms. Fizz Buzz You may have seen Fizz Buzz wri...
REPEAT, will repeat itself forever unless you explicitly exit the loop: //Runs forever REPEAT: // Do stuff END. To exit the loop you can use the LEAVE keyword. With or without a label. Without a label LEAVE will always effect the current loop. With a name you can specify what loop to LEAV...
Let's explore an example Transaction search where we define a filter for a single transaction's internal ID: We've specified a filter to only show us results for the Transaction with the internal ID of 875; here is that Transaction: We can see it is a Sales Order with a single line item. Beca...
When we only want one result per transaction, that means we only want the Body, or Main Line, of each transaction. To accomplish this, there is a filter named "Main Line". By setting the Main Line filter to Yes in our search criteria, we are essentially saying "Only show me body-leve...
Recoding missing values Regularly, missing data isn't coded as NA in datasets. In SPSS for example, missing values are often represented by the value 99. num.vec <- c(1, 2, 3, 99, 5) num.vec ## [1] 1 2 3 99 5 It is possible to directly assign NA using subsetting num.vec[num.vec == 99]...
See Missing values for details. > TRUE & NA [1] NA > FALSE & NA [1] FALSE > TRUE || NA [1] TRUE > FALSE || NA [1] NA
Lambdas are a useful shortcut for hooking up behaviors to GUI elements. b = cmds.button("make a cube", command = lambda _: cmds.polyCube()) However, due to the way Python captures variables inside of lambdas, you can get unexpected results if you bind commands using lambdas inside a lo...
npm install --save mongodb npm install --save mongoose //A simple wrapper for ease of development In your server file (normally named index.js or server.js) const express = require('express'); const mongodb = require('mongodb'); const mongoose = require('mongoose'); const mongoConnectString...
const Schema = mongoose.Schema; const ObjectId = Schema.Types.ObjectId; const Article = new Schema({ title: { type: String, unique: true, required: [true, 'Article must have title'] }, author: { type: ObjectId, ref: 'User' } }); module.exports = mongoose....
A simple GET request. Let's assume the Model from the example above is in the file ./db/models/Article.js. const express = require('express'); const Articles = require('./db/models/Article'); module.exports = function (app) { const routes = express.Router(); routes.get('/articles', (r...

Page 928 of 1099