Tutorial by Examples: custome

package org.bookmytickets.repository; import java.util.List; import org.bookmytickets.model.Customer; import org.springframework.data.mongodb.repository.MongoRepository; public interface CustomerRepository extends MongoRepository<Customer, String> { public Customer findByFirstNa...
The CustomEvent API allows developers to create custom events and trigger them on DOM nodes, passing data along the way. event = new CustomEvent(typeArg, customEventInit); typeArg - DOMString representing the name of the event. customEventInit - is optional parameters (that will be passed as e ...
Define Interface public interface ClickHandler { public void onButtonClick(User user); } Create Model class public class User { private String name; public User(String name) { this.name = name; } public String getName() { return name; } ...
Server Syntax var io = require('socket.io')(80); io.on('connection', function (mysocket) { //custom event called `private message` mysocket.on('private message', function (from, msg) { console.log('I received a private message by ', from, ' saying ', msg); }); //internal `di...
You can also fire your own events and then listen to them from either Polymer element of HTML page This Element fires the custom event <dom-module id="custom-event"> <template> <style> #inner{ width: 200px; height: 50px; bor...
Let's create an Enumerator for Fibonacci numbers. fibonacci = Enumerator.new do |yielder| a = b = 1 loop do yielder << a a, b = b, a + b end end We can now use any Enumerable method with fibonacci: fibonacci.take 10 # => [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
With the bind command it is possible to define custom key bindings. The next example bind an Alt + w to >/dev/null 2>&1: bind '"\ew"':"\" >/dev/null 2>&1\"" If you want to execute the line immediately add \C-m (Enter) to it: bind '"\ew&quo...
Step 1: Create events.xml file according to your requirement in frontend, Backend, or both YKM/Banner/etc/frontend/events.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=&q...
This will get all the orders for all customers: SELECT c.CustomerName, o.OrderID FROM Customers AS c INNER JOIN Orders AS o ON c.CustomerID = o.CustomerID ORDER BY c.CustomerName, o.OrderID; This will count the number of orders for each customer: SELECT c.CustomerName, C...
For live demo click.. App index ts import {bootstrap} from '@angular/platform-browser-dynamic'; import {MyForm} from './my-form.component.ts'; bootstrap(MyForm); Custom validator import {Control} from @'angular/common'; export class CustomValidators { static emailFormat(control: Cont...
url: /api/data/v8.0/contacts json: { "firstname" : "New", "lastname" : "Contact", "[email protected]" : "/accounts(c6da77b6-d53e-e611-80b9-0050568a6c2d)" } As the parentcustomerid can be an account or ...
public ActionResult Details( string product) { .... if (productNotFound) { // http://www.eidias.com/blog/2014/7/2/mvc-custom-error-pages Response.Clear(); Response.TrySkipIisCustomErrors = true; Response.Write(product + " product not exists"); ...
QML came with rich set of visual elements. Using only QML we can build complex applications with these elements. Also it's very easy to build your own element based on set of standard items like Rectangle, Button, Image etc. Moreover, we can use items like Canvas to build element with custom paint...
You can create a custom exception and throw them during the execution of your function. As a general practice you should only throw an exception when your function could not achieve its defined functionality. Private Function OpenDatabase(Byval Server as String, Byval User as String, Byval Pwd as S...
ASP.NET Core provides the status code pages middleware, that supports several different extension methods, but we are interesting in UseStatusCodePages and UseStatusCodePagesWithRedirects: UseStatusCodePages adds a StatusCodePages middleware with the given options that checks for responses with...
Server syntax: var io = require('socket.io')(80); io.on('connection', function (mysocket) { //emit to all but the one who started it mysocket.broadcast.emit('user connected'); //emit to all sockets io.emit('my event', { messg: 'for all'}); }); // a javascript client would listen ...
It is sometimes useful to integrate a custom error logging framework to ensure all exceptions are logged. [ServiceContract] [ErrorHandler] public interface IMyService { } [AttributeUsage(AttributeTargets.Interface)] public class CustomErrorHandler : Attribute, IContractBehavior, IE...
You shouldn't throw raw values as exceptions, instead use one of the standard exception classes or make your own. Having your own exception class inherited from std::exception is a good way to go about it. Here's a custom exception class which directly inherits from std::exception: #include <ex...
<link rel="import" href="../bower_components/iron-icon/iron-icon.html"> <link rel="import" href="../bower_components/iron-icons/iron-icons.html"> <link rel="import" href="../bower_components/iron-icons/social-icons.html"&gt...
On whichever page you want to display your product / project portfolio, invoke the custom element like so: <article id="project-neighbourhood"> <div class="row"> <div class="col-12 hero"> <img src="path-to-hero-image...

Page 2 of 4