Tutorial by Examples: a

A palindrome is a word that can be read both ways, like 'kayak'. This example will show how to find if a given word is a palindrome using Python3. First, we need to turn a string into a stack (we will use arrays as stacks). str = "string" stk = [c for c in str] #this makes an array: [&...
Viewchild offers one way interaction from parent to child. There is no feedback or output from child when ViewChild is used. We have a DataListComponent that shows some information. DataListComponent has PagerComponent as it's child. When user makes a search on DataListComponent, it gets a data fro...
To retrieve information about dplyr package and its functions' descriptions: help(package = "dplyr") No need to load the package first.
To see built-in data sets from package dplyr data(package = "dplyr") No need to load the package first.
To get the list of functions within package dplyr, we first must load the package: library(dplyr) ls("package:dplyr")
If you want to create a custom validation rule, you can do so for instance in the boot method of a service provider, via the Validator facade. <?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Validator; class AppServiceProvider extends ServiceProvider { ...
You can COPY table and paste it into a file. postgres=# select * from my_table; c1 | c2 | c3 ----+----+---- 1 | 1 | 1 2 | 2 | 2 3 | 3 | 3 4 | 4 | 4 5 | 5 | (5 rows) postgres=# copy my_table to '/home/postgres/my_table.txt' using delimiters '|' with null as 'null_s...
Suppose, that we have three users : The Administrator of the database > admin The application with a full access for her data > read_write The read only access > read_only With below queries, you can set access privileges on objects created in the future in specified schema. ALTER ...
If you're Using VueJS2 and like to use JSX along with it. In this case,to use the slot, the solution with example is below.We have to use this.$slots.default It's almost like this.props.children in React JS. Component.js : export default { render(h) { //eslint-disable-line return ( ...
Schema changes: You will need to define a new field type in your solr schema file and then you can create fields of that type. Example schema snippet: <!-- Source: solr/example/.../conf/schema.xml --> <?xml version="1.0" encoding="UTF-8" ?> <schema name="a...
Let's get some theoretical knowledge before moving to the example. There are three important terms being used here Analyzers, Tokenizers, and Filters. To create such custom field you will need to create an analyzer with one tokenizer and one or more filters. As mentioned here, you can have only one ...
You can parse XML from a string or from a XML file 1. From a string $xml_obj = simplexml_load_string($string); 2. From a file $xml_obj = simplexml_load_file('books.xml'); Example of parsing Considering the following XML: <?xml version="1.0" encoding="UTF-8"?> &l...
You need to change price scope 'Global' to 'website' (Sysytem->Configuration->Catalog->Catalog->Price) $client = new SoapClient('http://your-web-site/api/soap/?wsdl'); $API_USER = 'your-api-user'; $API_KEY = 'your-api-key'; $session = $client->login($API_USER, $API_KEY); $result...
var x = 5; var str = "if (x == 5) {console.log('z is 42'); z = 42;} else z = 0; "; console.log("z is ", eval(str)); The use of eval is strongly discouraged. See the Remarks section for details.
Objective-C First go the Target->Capabilities and enable HealthKit. This would setup the info.plist entry. Make a new CocoaClass of type NSObject The filename I gave is GSHealthKitManager and the header file is as shown below GSHealthKitManager.h #import <Foundation/Foundation.h> #imp...
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { CommonModule } from '@angular/common'; import { AboutComponent } from './about.component'; @NgModule({ imports: [ CommonModule ], declarations: [ AboutComponent ], exports: [ AboutComponent ], schemas...
import { Component } from '@angular/core'; @Component({ selector: 'myapp-about', template: `<my-webcomponent></my-webcomponent>` }) export class AboutComponent { }
Installation $ npm install gulp-jslint --save-dev Usage In gulpfile.js add: var gulp = require('gulp'); var jslint = require('gulp-jslint'); gulp.task('lint', function(){ return gulp.src(['source.js']) .pipe(jslint({ /* this object represents the JSLint directives being passe...
Aggregation is used to perform complex data search operations in the mongo query which can't be done in normal "find" query. Create some dummy data: db.employees.insert({"name":"Adma","dept":"Admin","languages":["german","f...
This is an example code to create and execute the aggregate query in MongoDB using Spring Data. try { MongoClient mongo = new MongoClient(); DB db = mongo.getDB("so"); DBCollection coll = db.getCollection("employees"); //Equivalent to $m...

Page 804 of 1099