Tutorial by Examples: a

You can add new extensions to require() by extending require.extensions. For a XML example: // Add .xml for require() require.extensions['.xml'] = (module, filename) => { const fs = require('fs') const xml2js = require('xml2js') module.exports = (callback) => { // ...
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 ...
- Initially check your E-Mail Settings In Odoo go to Settings --> Email . Enter the field values in "Incoming Mail Servers" & "Outgoing Mail Servers" Options.
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...
It's quite common to want to check the status of the various partitions/drives on your server/computer to see how full they are. The following command is the one you'll want to run: df -h This will produce output similar to the following: [root@mail ~]# df -h Filesystem Size Used A...
<stock> <add> <item> <name>Milk</name> <quantity>2</quantity> </item> </add> </stock> Putting this body to an resource like /stocks/123 violates the idea behind REST. While this bod...
Sample property file : nexus.properties Sample property file content: nexus.user=admin nexus.pass=admin nexus.rest.uri=http://xxx.xxx.xxx.xxx:xxxx/nexus/service/local/artifact/maven/content Sample Context File xml configuration <context:property-placeholder location="classpath:Releas...
$color-purple-bg: #AF6EC4; $color-purple-border: #5D0C66; $color-yellow-bg: #E8CB48; $color-yellow-border: #757526; .tooltip { position: relative; &--arrow-down { @include pointer('bottom', 30px, ($color-purple-border, $color-purple-bg), 15px); } ...
// GET: Student/Edit/5 // It is receives a get http request for the controller Student and Action Edit with the id of 5 public ActionResult Edit(int? id) { // it good practice to consider that things could go wrong so,it is wise to have a validation in the controller ...
The void generator class: public class VoidGenerator extends ChunkGenerator { @SuppressWarnings("deprecation") public byte[] generate(World w, Random rand, int x, int z) { byte[] result = new byte[32768]; //chunksized array filled with 0 - Air //Build a...
A frequent reason why your read operation may not work is because your security rules reject the operation, for example because you're not authenticated (by default a database can only be accessed by an authenticated user). You can see these security rule violations in the logcat output. But it's e...
(ns so-doc.events (:require [goog.dom :as dom] [goog.events :as events])) (defn handle-click [event] ;an event object is passed to all events (js/alert "button pressed")) (events/listen (dom/getElement "button"); This is the dom element the event comes fro...
(ns so-doc.events) (enable-console-print!) (defn click-event [] (println "Button clicked")) (defn load-event [] (println "Page loaded!") (.addEventListener (.getElementById js/document "btn") "click" click-event false)) (.addEventListener ...
Large scale applications often need different properties when running on different environments. we can achieve this by passing arguments to NodeJs application and using same argument in node process to load specific environment property file. Suppose we have two property files for different enviro...
Separate the construction of a complex object from its representation so that the same construction process can create different representations and and provides a high level of control over the assembly of the objects. In this example demonstrates the Builder pattern in which different vehicles ar...
Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype. In this example demonstrates the Prototype pattern in which new Color objects are created by copying pre-existing, user-defined Colors of the same type. using System; using Syste...
Provide an interface for creating families of related or dependent objects without specifying their concrete classes. In this example demonstrates the creation of different animal worlds for a computer game using different factories. Although the animals created by the Continent factories are diffe...

Page 739 of 1099