Tutorial by Examples: a

Given a simple sitecore item: Item item; The item itself does not contain it's url. To obtain a url for an item you need to make a call to the static class Sitecore.Links.LinkManager string url = LinkManager.GetItemUrl(item); an overload of this accepts a UrlOptions class: UrlOptions option...
You can load Magento model using the following code: Mage::getModel('modulename/modelname') Example: Mage::getModel('catalog/product') This will load Mage_Catalog_Model_product
To create a new model in your module Add a folder Model in your module root folder and create a file Modelname.php in this folder. for example Rick/Demo/Model/Modelname.php The class name of your model does matter call it like this: <?php class Rick_Demo_Model_Modelname { } make sure y...
First we must edit the SSH daemon config file. Though under different Linux distributions this may be located in different directories, usually it is stored under /etc/ssh/sshd_config Use your text editor to change the values set in this file, all lines starting with # are commented out and must ha...
Example from www.phptherightway.com <?php interface OutputInterface { public function load(); } class SerializedArrayOutput implements OutputInterface { public function load() { return serialize($arrayOfData); } } class JsonStringOutput implements Output...
Passport must be initialized using passport.initialize() middleware. To use login sessions, passport.session() middleware is required. Note that passport.serialize() and passport.deserializeUser() methods must be defined. Passport will serialize and deserialize user instances to and from the sessi...
The passport-local module is used to implement a local authentication. This module lets you authenticate using a username and password in your Node.js applications. Registering the user : const passport = require('passport'); const LocalStrategy = require('passport-local').Strategy; // A ...
The passport-facebook module is used to implement a Facebook authentication. In this example, if the user does not exist on sign-in, he is created. Implementing strategy : const passport = require('passport'); const FacebookStrategy = require('passport-facebook').Strategy; // Strategy is name...
Since ls() finds objects by names, it's a handy way to find out if an object is present in the scene. ls() with a list of objects will only return the ones which are in the scene. available_characters = cmds.ls('fred', 'barney', 'wilma', 'dino') # available_characters will contain only the named...
GDAL is available in the default repositories of most popular Linux distributions and can be installed in the same way that packages in a Linux distribution are usually installed. apt-get install libgdal-dev CPLUS_INCLUDE_PATH and C_INCLUDE_PATH are necessary in order to include these correspondin...
template<class ... Types> struct Tuple {}; A parameter pack is a template parameter accepting zero or more template arguments. If a template has at least one parameter pack is a variadic template.
The pattern parameter_pack ... is expanded into a list of comma-separated substitutions of parameter_pack with each one of its parameters template<class T> // Base of recursion void variadic_printer(T last_argument) { std::cout << last_argument; } template<class T, class .....
Maya commands come in a very small range of forms. Recognizing the form that a command takes is useful for working with new commands. Simple commands The most basic form is simply <command>(<object>) where is the function you're calling and is the string name of an object you are ...
Introduction Consider the following problem: L is a sorted list containing n signed integers (n being big enough), for example [-5, -2, -1, 0, 1, 2, 4] (here, n has a value of 7). If L is known to contain the integer 0, how can you find the index of 0 ? Naïve approach The first thing that comes ...
Entity entity; //The entity you want to teleport Entity teleportTo; //The entity where you want <entity> to be teleported to boolean success = entity.teleport(teleportTo); //Attempting to teleport. if(success) { //Teleport was successful }else { //Teleport wasn't successful } ...
Entity toBeTeleported; //The entity you want to teleport Location teleportTo = new Location(world,x,y,z,yaw,pitch); //The location to teleport to boolean success = toBeTeleported.teleport(teleportTo); if(success) { //Teleport was successful }else { //Teleport wasn't success...
Java's checked exception mechanism requires the programmer to declare that certain methods could throw specifed checked exceptions. This is done using the throws clause. For example: public class OddNumberException extends Exception { // a checked exception } public void checkEven(int number) ...
Install from npm chai, chai-immutable, and ts-node npm install --save-dev chai chai-immutable ts-node Install types for mocha and chai npm install --save-dev @types/mocha @types/chai Write simple test file: import {List, Set} from 'immutable'; import * as chai from 'cha...
Functions and procedures in packages can be overloaded. The following package TEST has two procedures called print_number, which behave differently depending on parameters they are called with. create or replace package TEST is procedure print_number(p_number in integer); procedure print_numb...
MediaTypeFormatter is an abstract class from which JsonMediaTypeFormatter and XmlMediaTypeFormatter classes inherit from. Here, JsonMediaTypeFormatter class handles JSON objects and XmlMediaTypeFormatter class handles XML objects. Return only JSON irrespective of the Accept Header value: To return...

Page 827 of 1099