Tutorial by Examples

// sort by creation date $orders->setOrder('created_at', 'asc'); $orders->setOrder('created_at', 'desc'); $orders->setOrder('created_at'); // default direction is 'desc'
// iterating over items in collection foreach ($orders as $singleOrder) { // do something with individual objects var_dump($singleOrder->getData()); } // get first/last item in collection $first = $orders->getFirstItem(); $last = $orders->getLastItem();
To get the raw value of a field on the Context Item: Sitecore.Context.Item["Field Name"]; To get the raw value of a field on a given item, item: item["Field Name"];
The background script is like any other JavaScript code. You can debug it using same tools you debug other JavaScript code in Chrome. To open the Chrome Developer Tools, go to chrome://extensions, and turn on Developer mode: Now you can debug any extension that have a background page or script. ...
You have 2 ways to debug the popup window. Both ways are by using the Chrome DevTools. Option 1: Right click the extension's action button, and choose Inspect popup Option 2: Open the popup window, directly in your browser as a tab. For example, if you extension id is abcdefghijkmnop, and your ...
To make the table more readable, following are the ways to color it: Rows Columns Lines Cells Coloring Rows Use \rowcolor (provided by colortbl; also loaded by xcolor under the [table] package option). Example: \documentclass{article} \usepackage[table]{xcolor} \begin{document} \be...
Break regular string literals with the \ character let a = "foobar"; let b = "foo\ bar"; // `a` and `b` are equal. assert_eq!(a,b); Break raw-string literals to separate strings, and join them with the concat! macro let c = r"foo\bar"; let d = conca...
The pattern can be illustrated by the following pseudocode: product = new Product() product.name = "Some Book" product.price = 123.45 product.save() The following SQL would be a result: INSERT INTO products (name, price) VALUES ('Some Book', 123.45);
Elixir / Phoenix Install Homebrew first: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Then running brew install elixir will install both Elixir and it's dependency - Erlang. Install mix with mix local.hex. Install Phoenix as per ...
Writing and executing a simple TestNG program is mainly 3 step process. Code - write business logic of your test and annotate it with TestNG annotations Configure - add information of your test in testng.xml or in build.xml Run TestNG - it can be invoked from command line, ANT, IDE like Eclipse...
Let's say you've got a table of loans, and another related table of parcels, where each loan can have one or more parcels associated with it. If you want a query to show each loan and a list of all its associated parcels, but you only want each loan to show up once, then you could use something lik...
To send an event: vm.$emit('new-message'); To catch an event: vm.$on('new-message'); To send an event to all components down: vm.$broadcast('new-message'); To send an event to all components up: vm.$dispatch('new-message'); Note: $broadcast and $dispatch are deprecated in Vue2. (see Vue2 feature...
The following picture illustrates how component communication should work. The picture comes from The Progressive Framework slides of Evan You (Developer of VueJS). Here is an example of how it works : DEMO HTML <script type="x-template" id="message-box"> <inp...
You might have realized that $emit is scoped to the component that is emitting the event. That's a problem when you want to communicate between components far from one another in the component tree. Note: In Vue1 you coud use $dispatch or $broadcast, but not in Vue2. The reason being that it doesn'...
This code places the hint text at form load and manipulates it as follows: C# private void Form_load(object sender, EventArgs e) { textBox.Text = "Place Holder text..."; } private void textBox_Enter(object sender, EventArgs e) { if(textBox.Text == "Place Holder text....
Project is following the structure from the Angular2 Quickstart guide here. RootOfProject | +-- app | |-- app.component.ts | |-- main.ts | |-- pipeUser.component.ts | \-- sanitize.pipe.ts | |-- index.html |-- main.html |-- pipe.html main.ts import { bootstrap } from '@angu...
<?php // hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'create_book_taxonomies', 0 ); // create taxonomy genres for the post type "book" function create_book_taxonomies() { // Add new taxonomy, make it hierarchical (like categorie...
UWP applications can easily store simple settings in a key/value store locally or even in the cloud so your application or a game can share settings between different user's devices. Following data types can be used for settings: UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, Double...
Given: --- variable_name: True Then, these tasks with always run. - name: This is a conditional task module: src=/example/ dest=/example when: variable_name - name: This is a conditional task module: src=/example/ dest=/example when: True This task will never run. - name: T...
Real life use cases for Singleton pattern; If you are developing a client-server application, you need single instrance of ConnectionManager, which manages the life cycle of client connections. The basic APIs in ConnectionManager : registerConnection: Add new connection to existing list of connec...

Page 824 of 1336