Tutorial by Examples

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
- 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...
Here we create a basic hello world server using Express. Routes: '/' '/wiki' And for rest will give "404" , i.e. page not found. 'use strict'; const port = process.env.PORT || 3000; var app = require('express')(); app.listen(port); app.get('/',(req,res)=>res.send(...
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...
Defining an element with no content. <dom-module id="empty-element"> <template> <style> </style> </template> <script> Polymer({ is: 'empty-element', }); </script> </dom-module> And then you can ...
$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 ...
$collection = Mage::getModel('catalog/product') ->getCollection() ->setPageSize(20) ->setCurPage(1);
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...

Page 906 of 1336