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...
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
{
...
public class KnapsackProblem
{
private static int Knapsack(int w, int[] weight, int[] value, int n)
{
int i;
int[,] k = new int[n + 1, w + 1];
for (i = 0; i <= n; i++)
{
int b;
for (b = 0; b <= w; b++)
{
...
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 ...
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...
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...
When defining a new trait it is possible to enforce that types wishing to implement this trait verify a number of constraints or bounds.
Taking an example from the standard library, the DerefMut trait requires that a type first implement its sibling Deref trait:
pub trait DerefMut: Deref {
fn...
In this Example we are going to take a sqaure shaped line plotted using line and perform transformations on it. Then we are going to use the same tranformations but in different order and see how it influences the results.
First we open a figure and set some initial parameters (square point coordin...
An easy way to get an input from a user is by using the prompt() method.
Syntax
prompt(text, [default]);
text: The text displayed in the prompt box.
default: A default value for the input field (optional).
Examples
var age = prompt("How old are you?");
console.log(age); // Pri...
import pygame
file = 'some.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play(-1) # If the loops is -1 then the music will repeat indefinitely.
By default, PHP Curl supports GET and POST requests. It is possible to also send custom requests, such as DELETE, PUT or PATCH (or even non-standard methods) using the CURLOPT_CUSTOMREQUEST parameter.
$method = 'DELETE'; // Create a DELETE request
$ch = curl_init($url);
curl_setopt($ch, CURLOPT...