Tutorial by Examples

├───models │ ├───user.model.js ├───routes │ ├───user.route.js ├───services │ ├───user.service.js ├───controllers │ ├───user.controller.js For modular code structure the logic should be divided into these directories and files. Models - The schema definition of the Model Rou...
user.model.js var mongoose = require('mongoose') const UserSchema = new mongoose.Schema({ name: String }) const User = mongoose.model('User', UserSchema) module.exports = User; user.routes.js var express = require('express'); var router = express.Router(); var UserController...
If the promise doesn't return anything, the async task can be completed using await. try{ await User.findByIdAndUpdate(user._id, { $push: { tokens: token } }).exec() }catch(e){ handleError(e) }
1. For Loop: CountriesName = ["India", "Canada", "America", "Iraq"] for country in CountriesName puts country end 2. Each Iterator: Same set of work can be done with each loop which we did with for loop. CountriesName = ["India", "C...
The RelayCommand implements the ICommand interface and can therefore be used to bind to Commands in XAML (as the Command property of the Button element) The constructor takes two arguments; the first is an Action which will be executed if ICommand.Execute is called (e.g. the user clicks on the butt...
The RelayCommand<T> is similar to the RelayCommand, but allows to directly pass an object to the command. It implements the ICommand interface and can therefore be used to bind to Commands in XAML (e.g. as the Command property of the Button element). You can then use the CommandParameter prope...
The ObservableObject class contains some helpful methods to help with the MVVM pattern. The RaisePropertyChanged provides a compile safe method to raise property changed events. It can be called with RaisePropertyChanged(() => MyProperty); The Set method can be used in the property setter t...
ViewModelBase extends ObservableObject and adds some methods useful for viewmodels. The property IsInDesignMode or IsInDesignModeStatic allows to determine if the code is executed in the design mode (in Visual Studio Design View) or not. The two properties are exactly the same.
Tables are most easily included with the DT package, which is an R interface to the JavaScript library DataTables. library(shiny) library(DT) ui <- fluidPage( dataTableOutput('myTable') ) server <- function(input, output, session){ output$myTable <- renderDataTable({ dat...
A reactive can be used to make output depend on another expression. In the example below, the output$text element is dependent on text_reactive, which in turn is dependent on input$user_text. Whenever input$user_text changes, output$text element and text_reactive become invalidated. They are recalcu...
eventReactives are similar to reactives, they are constructed as follows: eventReactive( event { code to run }) eventReactives are not dependent on all reactive expressions in their body ('code to run' in the snippet above). Instead, they are only dependent on the expressions specified in the ...
reactiveValues can be used to store objects, to which other expressions can take a dependency. In the example below, a reactiveValues object is initialized with value "No text has been submitted yet.". A separate observer is created to update the reactiveValues object whenever the submit ...
An observeEvent object can be used to trigger a piece of code when a certain event occurs. It is constructed as: observeEvent( event { code to run }) The observeEvent will only be dependent on the 'event' section in the small piece of code above. It will not be dependent on anything in the 'co...
CMocka is an elegant unit testing framework for C with support for mock objects. It only requires the standard C library, works on a range of computing platforms (including embedded) and with different compilers. It has a tutorial on testing with mocks, API documentation, and a variety of examples. ...
Valgrind is GPLv2-licensed collection of dynamic analysis tools, which uses binary instrumentation (dynamic recompilation). Six tools are included to detect memory management (Memcheck) and threading errors (Helgrind and DRD), to generate call-graph and profile programs (with optional cache and bran...
One can use the command-line launching facility is when one wants to customize some aspects of the way MySQL Workbench operates. MySQL Workbench has the following common command line options: --admin instance - Launch MySQL Workbench and load the server instance specified. --query connection - ...
/app/i18n/<Vendor Namespace>/<language package directory>/composer.json { "name": "<vendor namespance>/<language package directory>", "description": "<language package description>", "version": "100....
An observe expression is triggered every time one of its inputs changes. The major difference with regards to a reactive expression is that it yields no output, and it should only be used for its side effects (such as modifying a reactiveValues object, or triggering a pop-up). Also, note that obser...
Here i will show you how to fetch All parent(configuarble products) A parent product and all of its children.
We will start by making a simple class that gets all our parent(Configurable products) <?php namespace Test\Test\Controller\Test; use Magento\Framework\App\Action\Context; class Products extends \Magento\Framework\App\Action\Action { public function __construct( \...

Page 1315 of 1336