Tutorial by Examples: content

Often people try to index some content and then find it. If they cannot see the expected result, they try to troubleshoot the whole end-to-end process. The better way is to see whether the content actually indexed in the expected fields. This way it splits the problem into two: indexing and searchin...
Use the HTML or <audio> element to embed video/audio content in a document. The video/audio element contains one or more video/audio sources. To specify a source, use either the src attribute or the <source> element; the browser will choose the most suitable one. Audio tag example: &...
Using filterUsingPredicate: This Evaluates a given predicate against the arrays content and return objects that match. Example: NSMutableArray *array = [NSMutableArray array]; [array setArray:@[@"iOS",@"macOS",@"tvOS"]]; NSPredicate *predicate = [N...
Creating and returning an image object by loading the image data from the file at the specified path. Example: UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[cellCountry objectForKey:@"Country_Flag"] ofType:nil]]; Using Array: Example NSM...
A content script is extension code that runs alongside a normal page. They have full access to the web page's DOM (and are, in fact, the only part of the extension that can access a page's DOM), but the JavaScript code is isolated, a concept called Isolated World. Each extension has its own content...
To read the contents to a file into a string variable: Dim fileContents As String = System.IO.File.ReadAllText("filename.txt") ReadAllText will open the specified file, read data to the end, then close the file. To read a file, separating it into an array element for each line: Dim f...
A simple static file server would look like this: package main import ( "net/http" ) func main() { muxer := http.NewServeMux() fileServerCss := http.FileServer(http.Dir("src/css")) fileServerJs := http.FileServer(http.Dir("src/js")) file...
The @ContentView annotation can be used to further alleviate development of activities and replace the setContentView statement : @ContentView(R.layout.myactivity_layout) public class MyActivity extends RoboActivity { @InjectView(R.id.text1) TextView textView; @Override protected ...
A large perceivable region that contains information about the parent document. <p role="contentinfo"> Author: Albert Einstein<br> Published: August 15, 1940 </p>
let sel = document.getSelection(); let myNode = document.getElementById('element-to-select'); let range = document.createRange(); range.selectNodeContents(myNode); sel.addRange(range); It may be necessary to first remove all the ranges of the previous selection, as most browsers don't s...
We will further extend our template and include title of the page and a content <?php /* Template Name: Example */ get_header(); the_title(); the_content(); get_footer(); And if you want you can wrap them with HTML elements like this <?php /* Template Name: Example *...
A reference to an option &Option<T> cannot be unwrapped if the type T is not copyable. The solution is to change the option to &Option<&T> using as_ref(). Rust forbids transferring of ownership of objects while the objects are borrowed. When the Option itself is borrowed (&a...
Content scripts can be declared in manifest.json to be always injected into pages that match a set of URL patterns. Minimal example "content_scripts" : [ { "js": ["content.js"], "css": ["content.css"] "matches": [&quot...
If, instead of always having a content script injected based on the URL, you want to directly control when a content script is injected, you can use Programmatic Injection. Minimal example JavaScript chrome.tabs.executeScript({file: "content.js"}); CSS chrome.tabs.insert...
Same conditions, multiple scripts If you need to inject multiple files with all other conditions being the same, for example to include a library, you can list all of them in the "js" array: "content_scripts" : [ { "js": ["library.js", "conten...
article.twig.html <article> <h1>{{ article.title }}</h1> {% block content %} <p>{{ article.content }}</p> {% endblock %} </article> articles.twig.html {# use default template for article #} {% for article in articles %} {% include &...
Fire after the initialization of the content of the component or directive has finished. (Right after OnInit) import { Component, AfterContentInit } from '@angular/core'; @Component({ selector: 'so-aftercontentinit-component', templateUrl: 'aftercontentinit-component.html', styl...
Fire after the view has been fully initialized. (Only available for components) import { Component, AfterContentChecked } from '@angular/core'; @Component({ selector: 'so-aftercontentchecked-component', templateUrl: 'aftercontentchecked-component.html', styleUrls: ['aftercontentc...
Example. It will be replacing the word email to a name in a text file index.txt with simple RegExp replace(/email/gim, 'name') var fs = require('fs'); fs.readFile('index.txt', 'utf-8', function(err, data) { if (err) throw err; var newValue = data.replace(/email/gim, 'name'); ...
Method stopLoading() stops the current loading process of the webview. Swift webview.stopLoading() Objective-C [webview stopLoading];

Page 2 of 6