//Example 1
int[] array = { 1, 5, 2, 10, 7 };
// Select squares of all odd numbers in the array sorted in descending order
IEnumerable<int> query = from x in array
where x % 2 == 1
orderby x descending
select x ...
To interact with WebElements in a webpage, first we need to identify the location of the element.
By is the keyword available in selenium.
You can locate the elements By..
By ID
By Class Name
By TagName
By Name
By Link Text
By Partial Link Text
By CSS Selector
By XPath
Using JavaScript
...
Option Compare Binary
Binary comparison makes all checks for string equality within a module/class case sensitive. Technically, with this option, string comparisons are performed using sort order of the binary representations of each character.
A < B < E < Z < a < b < e < z
...
Option Base is used to declare the default lower bound of array elements. It is declared at module level and is valid only for the current module.
By default (and thus if no Option Base is specified), the Base is 0. Which means that the first element of any array declared in the module has an index...
set can also be invoked with just one argument. When called with just one argument, it returns the contents of that argument.
% set x 235
235
% set x
235
List<Integer> nums = Arrays.asList(1, 2, 3);
List<String> strings = nums.stream()
.map(Object::toString)
.collect(Collectors.toList());
That is:
Create a stream from the list
Map each element using Object::toString
Collect the String values into a List using Collectors...
In general, UWP is used for making a single application that runs on Windows 10 across many different devices. However, it is also possible to make code tailored to specific devices. You can achieve this in several different ways.
Different XAML Layout
If you want to use a specific layout on for a...
The chan-signal crate provides a solution to handle OS signal using channels, altough this crate is experimental and should be used carefully.
Example taken from BurntSushi/chan-signal.
#[macro_use]
extern crate chan;
extern crate chan_signal;
use chan_signal::Signal;
fn main() {
// S...
The nix crate provides an UNIX Rust API to handle signals, however it requires using unsafe rust so you should be careful.
use nix::sys::signal;
extern fn handle_sigint(_:i32) {
// Be careful here...
}
fn main() {
let sig_action = signal::SigAction::new(handle_sigint,
...
Adding a footer is not natively possible. Luckily, we can make use of jQuery and CSS to add a footer to the slides of an ioslides presentation rendered with knitr.
First of all we have to include the jQuery plugin. This is done by the line
<script src="https://ajax.googleapis.com/ajax/libs...
A very basic docker-compose.yml looks like this:
version: '2'
services:
hello_world:
image: ubuntu
command: [/bin/echo, 'Hello world']
This file is making it so that there's a hello_world service, that's initialized from the ubuntu:latest image and that, when it's run, it just runs...
Below code is simple java program using selenium.
The journey of the below code is
Open Firefox browser
Open google page
Print title of Google page
Find the search box location
Pass the value as Selenium in the search box
Submit the form
Shutdown the browser
package org.openqa.selenium....
Sometimes one has to work with pages that are not using jQuery while most developers are used to have jQuery handy.
In such situations one can use Chrome Developer Tools console (F12) to manually add jQuery on a loaded page by running following:
var j = document.createElement('script');
j.onload ...
The first interesting thing to know is how to write comments.
In VB .NET, you write a comment by writing an apostrophe ' or writing REM. This means the rest of the line will not be taken into account by the compiler.
'This entire line is a comment
Dim x As Integer = 0 'This comment is here to say...
One interesting thing is the ability to add you own comments into Visual Studio Intellisense. So you can make your own written functions and classes self-explanatory. To do so, you must type the comment symbol three times the line above your function.
Once done, Visual Studio will automatically add...
Modifiers are a way to indicate how external objects can access an object's data.
Public
Means any object can access this without restriction
Private
Means only the declaring object can access and view this
Protected
Means only the declaring object and any object that inherits from...