Tutorial by Examples

import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; class test_webdriver{ public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://stackoverflow.com/"); driver.close(); } }...
class EventEmitter extends Subject { constructor(isAsync?: boolean) emit(value?: T) subscribe(generatorOrNext?: any, error?: any, complete?: any) : any }
@Component({ selector: 'zippy', template: ` <div class="zippy"> <div (click)="toggle()">Toggle</div> <div [hidden]="!visible"> <ng-content></ng-content> </div> </div>`}) export class Zippy...
<zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
Create a service- import {EventEmitter} from 'angular2/core'; export class NavService { navchange: EventEmitter<number> = new EventEmitter(); constructor() {} emitNavChangeEvent(number) { this.navchange.emit(number); } getNavChangeEmitter() { return...
A live example for this can be found here.
Objective-C NSMutableAttributedString *mutAttString = @"string goes here"; NSRange range = NSMakeRange(0, mutAttString.length); [mutAttString setAttributes:@{} range:originalRange]; As per Apple Documentation we use, setAttributes and not addAttribute. Swift mutAttString.setAttribu...
As of Jekyll 3.2, you can use the filter where_exp to filter a collection by any of its properties. Say you have the following collection item in an "albums" collection: --- title: My Amazing Album --- ... You can combine the where_exp and first filters to grab just that one item: ...
Given an 'albums' collection, you can loop through and output each item: {% for album in site.albums %} {{ album.content }} {% endfor %} Any custom front matter variables are also available within the loop. {% for album in site.albums %} {{ album.title }} {{ album.content }} {%...
Given an 'albums' collection, an item can be added by creating a file in the <source>/_albums directory. Note that files not including frontmatter will be ignored. For instance, adding a file called my_album.md to the _albums directory would add it to the collection: --- title: "My Alb...
# Define the txt which will be in the email body $Txt_File = "c:\file.txt" function Send_mail { #Define Email settings $EmailFrom = "[email protected]" $EmailTo = "[email protected]" $Txt_Body = Get-Content $Txt_File -RAW $Body = $Body_...
For this example, an Ordered Collection will be used to show the different messages that can be sent to an OrderedCollection object to loop over the elements.The code below will instantiate an empty OrderedCollection using the message new and then populate it with 4 numbers using the message add: a...
The jars for CXF JAX-RS are found in Maven: <!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-rs-client --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-client</artifactId> <version>3.1.10</version> ...
The code snippet below shows the various ways you can filter on an array of objects using lodash. let lodash = require('lodash'); var countries = [ {"key": "DE", "name": "Deutschland", "active": false}, {"key": "ZA&qu...
triples = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] triples.each { |(first, second, third)| puts second } # 2 # 5 # 8 triples.map { |(first, *rest)| rest.join(' ') } # => ["2 3", "5 6", "8 9"]
Inserting a row at the bottom of a spreadsheet is easy: var someSheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0]; someSheet.appendRow(["Frodo", "Baggins", "Hobbit", "The Shire", 33]); Note this will add the row after the last non-empty row. I...
A thread terminates if it reaches the end of its code block. The best way to terminate a thread early is to convince it to reach the end of its code block. This way, the thread can run cleanup code before dying. This thread runs a loop while the instance variable continue is true. Set this variable...
fs is the File System API in node. We can use the method readFile on our fs variable, pass it a data.csv file, format and function that reads and splits the csv for further processing. This assumes you have a file named data.csv in the same folder. 'use strict' const fs = require('fs'); fs.r...
Detailed instructions on getting rebol set up or installed. The most mature and stable version of Rebol is the official Rebol2, available from the downloads page for multiple platforms. There are 2 flavors: Rebol/View (version with gui, ~ 0.6 MB) Rebol/Core (no gui, for servers, ~ 0.3 MB) ...
For Example: echo Hello! pause >nul :Name echo What Is Your Name set /p Input=Name: echo so %Input% Is Your Name, right? echo Rename? echo 1 For Yes echo 2 For No set /p Input=Rename: if %Input%=1 goto Name Another Example: @echo off echo 1 or 2? set /p input=Choice: if %input...

Page 1152 of 1336