Tutorial by Examples: 2

Before creating any extension, always check if it has already been implemented. The first thing one would have to do is define the extension class which will house the twig filters and/or functions. <?php namespace AppBundle\Twig; class DemoExtension extends \Twig_Extension { /** ...
It depends on kind of hosting that you have: If you have SSH console, then you can do it on hosting after step 2, if you haven't then do it locally: run command php app/console cache:clear --env=prod'. Suppose you have on you hosting folders youdomain/public_html, so in public_html m...
Guice is the default dependency injection (further DI) framework of Play. Other frameworks may be used as well, but using Guice makes development efforts easier, since Play takes care for things under the veil. Injection of Play API-s Starting from Play 2.5 several API-s, which were static in the ...
require(['N/search'], function(SEARCHMODULE){ var type = 'transaction'; var columns = []; columns.push(SEARCHMODULE.createColumn({ name: 'internalid' })); columns.push(SEARCHMODULE.createColumn({ name: 'formulanumeric', formula: '{quantity}-{...
require(['N/search'], function(SEARCHMODULE){ var savedSearchId = 'customsearch_mySavedSearch'; var mySearch = SEARCHMODULE.load(savedSearchId); var resultset = mySearch.run(); var results = resultset.getRange(0, 1000); for(var i in results){ var result = results[i]...
Here we will be creating a Groovy pipeline in Jenkins 2 to do the following steps : Verify every 5 minutes if new code has been commited to our project Checkout code from SCM repo Maven compile of our Java code Run our integration tests and publish the results Here are the steps we will : ...
Use the analytical function row_number(): with t as ( select col1 , col2 , row_number() over (order by col1, col2) rn from table ) select col1 , col2 from t where rn between N and M; -- N and M are both inclusive Oracle 12c handles this more easily with OFFSET and FETCH.
Here's a layout that renders two, four, or six cells across depending on screen size. <div class="container-fluid"> <div class="row"> <div class="col-xs-6 col-md-3 col-lg-2">1</div> <div class="col-xs-6 col-md-3 co...
PM2 is a production process manager for Node.js applications, that allows you to keep applications alive forever and reload them without downtime. PM2 also enables you to manage application logging, monitoring, and clustering. Install pm2 globally. npm install -g pm2 Then, run the node.js app u...
Helpers and fakeApplication Class Helpers is used a lot for unit tests. It imitates a Play application, fakes HTTP requests and responses, session, cookies - all whatever may be needed for tests. A controller under the test should be executed in a context of a Play application. The Helpers method f...
$ ispow2() { return $((!($1!=0&&($1&$1-1)==0))); } $ i=0 $ while [ $i -lt 100 ]; do > if ispow2 $((i=i+1)); then > echo $i > fi > done 1 2 4 8 16 32 64 $1!=0 0 is not a power of 2. ($1&$1-1)==0 Unset the lowest bit. If it was the only bit...
Controller: In the Controller you have to add the RequestHandler component. This Enables CakePHP to automatically detect Ajax requests(see: http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html for more info): class YourController extends AppController { public $compo...
The child themes are meant to be a safe way to keep customizations of the main template without fearing to lose them on a theme update. Basically, whenever you want to edit a file inside the active template from your website you have to ask yourself "What is going to happen when I will update ...
OAuth is not handled by Django REST Framework, but there are a couple of pip modules that implement an OAuth client. The REST Framework documentation suggests one of the following modules: Django OAuth Toolkit Django REST Framework OAuth Django OAuth Toolkit pip install django-oauth-toolkit ...
Rewrite Class File: Namespace/ModuleName/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Ma...
Data Access Object(DAO) design pattern is a standard J2EE design pattern. In this design pattern data is accessed through classes containing methods to access data from databases or other sources, which are called data access objects. Standard practice assumes that there are POJO classes. DAO can b...
require(['N/search'], function(SEARCHMODULE){ var savedSearchId = 'customsearch_mySavedSearch'; var mySearch = SEARCHMODULE.load(savedSearchId); var resultset = mySearch.run(); var results = resultset.getRange(0, 1000); for(var i in results){ var result = results[i]...
require(['N/search'], function(SEARCHMODULE){ var type = 'transaction'; var columns = []; columns.push(SEARCHMODULE.createColumn({ name: 'internalid' })); columns.push(SEARCHMODULE.createColumn({ name: 'formulanumeric', formula: '{quantity}-{...
This relies on the official consul docker image to run consul in clustered mode in a docker swarm with new swarm mode in Docker 1.12. This example is based on http://qnib.org/2016/08/11/consul-service/. Briefly the idea is to use two docker swarm services that talk to each other. This solves the pro...
What and Why ? Asp.Net’s Web API2 is the latest version of Web API. It is an easy way to implement a RESTful web service using all of the goodness that the Asp.Net framework provides. Once you understand the basic principles of REST, then a Asp.net Web API2 will be very easy to implement. Web API2...

Page 10 of 21