Tutorial by Examples: al

You must always unregister scopes other then your current scope as shown below: //always deregister these $rootScope.$on(...); $scope.$parent.$on(...); You don't have to deregister listners on current scope as angular would take care of it: //no need to deregister this $scope.$on(...); $r...
Angular 2 has two kinds of custom validators. Synchronous validators as in the first example that will run directly on the client and asynchronous validators (the second example) that you can use to call a remote service to do the validation for you. In this example the validator should call the ser...
constructor(fb: FormBuilder) { this.form = fb.group({ firstInput: ['', Validators.compose([Validators.required, CustomValidators.cannotContainSpace]), CustomValidators.shouldBeUnique], secondInput: ['', Validators.required] }); } Here we use the FormBuilder to crea...
$skuList = array('SKU-1', 'SKU-2',...,'SKU-n); $_productCollection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('sku', array('in' => $skuList)); OR $_productCollection = Mage::getResourceModel('catalog/product_collection') ->addAttributeToFilter('s...
This program will draw some shapes on the display, draw "hello world!" in the middle of the screen and let an image go to every corner of the window. You can use every image you want, but you will need to place the image file in the same directory as your program. the entire code: import...
These APIs are used to query for video and channel analytics, like views/clicks and votes.
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var foo = new ClassWithDependency(); foo.DoSomething(); var bar = new InjectedDependency(); foo.Dependency = bar; ...
When it comes to validate some rules which are not generic data validation e.g ensuring a field is required or some range of values but they are specific to your business logic then you can create your own Custom Validator. To create a custom validation attribute, you just need to inherit Validation...
It is possible to send a message or data to all avaible connections. This can be achieved by first initializing the server and then using the socket.io object to find all sockets and then emit as you normally would emit to a single socket var io = require('socket.io')(80) // 80 is the HTTP port io...
It is possible to emit a message or data to all users except the one making the request: var io = require('socket.io')(80); io.on('connection', function (socket) { socket.broadcast.emit('user connected'); });
class My_Plugin() { function __construct() { add_action( 'wp_enqueue_scripts', array( $this, 'init_fe_assets' ) ); } public function init_fe_assests() { wp_enqueue_style( 'my-plugin', plugin_dir_url( __FILE__ ) . 'assets/css/frontend/plugin.css', array(), '0.0.1', true ); ...
When using instances of QML files by directly declaring them, every property creates a binding. This is explained in the above examples. This is how you dynamically create components: var component = Qt.createComponent("Popup.qml"); var popup = component.createObject(parent, {"widt...
Note: The singleton is a design pattern. But it also considered an anti-pattern. The use of a singleton should be considered carefully before use. There are usually better alternatives. The main problem with a singleton is the same as the problem with global variables. They introduce external glo...
val and var scala> val a = 123 a: Int = 123 scala> a = 456 <console>:8: error: reassignment to val a = 456 scala> var b = 123 b: Int = 123 scala> b = 321 b: Int = 321 val references are unchangeable: like a final variable in Java, once it has been initial...
Sparse indexes: These can be particularly useful for fields that are optional but which should also be unique. { "_id" : "[email protected]", "nickname" : "Johnnie" } { "_id" : "[email protected]" } { "_id" : "julia@example...
Lets start with creating our first app Open visual studio and > create new project Enter Name and Location Enter your developer site url created in previous step and select Provider-hosted Popup will open which will as for login Next step it will as for type of applicatio...
Quick installation guide: Download and unzip the PrestaShop package to a directory in you web hosting. Create a database for PrestaShop. Open a browser to the url where are PrestaShop files. Follow the screen istructions. Delete the /install directory and rename /admin directory. Official ...
You can place action filters at three possible levels: Global Controller Action Placing a filter globally means it will execute on requests to any route. Placing one on a controller makes it execute on requests to any action in that controller. Placing one on an action means it runs with the...
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.goog...

Page 170 of 269