Tutorial by Examples

Here we first fetch our parent product and the we will get all children products that this parent have. <?php namespace Test\Test\Controller\Test; use Magento\Framework\App\Action\Context; class Products extends \Magento\Framework\App\Action\Action { public function __cons...
Arrays values should be accessed using a number specifying the location of the desired value in the array. This number is called Index. Indexes starts at 0 and finish at array length -1. To access a value, you have to do something like this: arrayName[index], replacing "index" by the num...
EPPlus also supports the ability to insert text in a cell using the Insert() method. For example: var file = new FileInfo(filePath); using (var p = new ExcelPackage(file)) { var wb = p.Workbook; var ws = wb.Worksheets.FirstOrDefault() ?? wb.Worksheets.Add("Sheet1"); var...
Variables inside functions is inside a local scope like this $number = 5 function foo(){ $number = 10 return $number } foo(); //Will print 10 because text defined inside function is a local variable
val re = """\((.*?)\)""".r val str = "(The)(example)(of)(repeating)(pattern)(in)(a)(single)(string)(I)(had)(some)(trouble)(with)(once)" re.findAllMatchIn(str).map(_.group(1)).toList res2: List[String] = List(The, example, of, repeating, pattern, in, a, ...
Using DOSKEY, we can create macros to simplify typing many commands in command prompt. Take a look at the following example. DOSKEY macro=echo Hello World Now if you type macro in the command prompt, it would return Hello World.
Unfortunately, DOSKEY macro doesn't support comment, but there's a workaround. ;= Comment ;= Comment ;= Remember to end your comment with ;= ;=
There are 3 usages of the $ character in a DOSKEY macro. Command separator $T is the equivalent of & in a batch script. One can join commands together like so. DOSKEY test=echo hello $T echo world Command-line arguments Like bash(not batch), we use $ to indicate command-line argument....
class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var firstTabNavigationController : UINavigationController! var secondTabNavigationControoller : UINavigationController! var thirdTabNavigationController : UINavigationController! var fourth...
For this, we will use the function aggregate, which can be used as follows: aggregate(formula,function,data) The following code shows various ways of using the aggregate function. CODE: df = data.frame(group=c("Group 1","Group 1","Group 2","Group 2",&quo...
Aggregating with dplyr is easy! You can use the group_by() and the summarize() functions for this. Some examples are given below. CODE: # Aggregating with dplyr library(dplyr) df = data.frame(group=c("Group 1","Group 1","Group 2","Group 2","Group 2&...
The most simple way to create this is to use Alamofire and its UIImageViewExtension. What we need is a tableview with a cell that has an imageView in it and lets call it imageView. In the cellForRowAt: function of the tableView we would download the image and set in the following way: let url = UR...
Sometimes the download takes longer than the cell is being displayed. In this case it can happen, that the downloaded image is shown in the wrong cell. To fix this we can not use the UIImageView Extension. We still will be using Alamofire however we will use the completion handler to display the im...
Use .outerHTML to get the HTML Here is a code sample to get the entire HTML of the website private async void GetHTMLAsync() { var siteHtML = await webView.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" }); }
Use .innerText to set the value Here is a code sample to enter text in Search Box on Bing website private async void EnterTextAsync(string enterText) { var functionString = string.Format(@"document.getElementsByClassName('b_searchbox')[0].innerText = '{0}';", enterText); await...
Use .click() to simulate click Here is a code sample to click search button on Bing website private async void SimulateClickAsync() { var functionString = string.Format(@"document.getElementsByClassName('b_searchboxSubmit')[0].click();"); await webView.InvokeScriptAsync("...
var assert = require('assert'); describe('String', function() { describe('#split', function() { it('should return an array', function() { assert(Array.isArray('a,b,c'.split(','))) }); }); });
I have read and watched a lot of different Dagger2 tutorials but most of them are too long or hard to understand so I decided to write a new simple and short tutorial for Dagger2, I hope you like it. Why we need it? Simplifies access to shared instances: It provides a simple way to obtain refere...
This example shows how mouse event is used in QML. import QtQuick 2.7 import QtQuick.Window 2.2 Window { visible: true Rectangle { anchors.fill: parent width: 120; height: 240 color: "#4B7A4A" MouseArea { anchors.fill: paren...
var myVariable = "This is a variable!"; This is an example of defining variables. This variable is called a "string" because it has ASCII characters (A-Z, 0-9, !@#$, etc.)

Page 1316 of 1336