Tutorial by Examples

Create a directory called ansible-helloworld-playbook mkdir ansible-helloworld-playbook Create a file hosts and add remote systems how want to manage. As ansible relies on ssh to connect the machines, you should make sure they are already accessible to you in ssh from your computer. 192.168.1.1...
public class Singleton { private static final Singleton INSTANCE = new Singleton(); private Singleton() {} public static Singleton getInstance() { return INSTANCE; } } It can be argued that this example is effectively lazy initialization. Section 12.4.1 of ...
To increment date objects in Javascript, we can usually do this: var checkoutDate = new Date(); // Thu Jul 21 2016 10:05:13 GMT-0400 (EDT) checkoutDate.setDate( checkoutDate.getDate() + 1 ); console.log(checkoutDate); // Fri Jul 22 2016 10:05:13 GMT-0400 (EDT) It is possible to use setD...
To implement an item click listener and/or an item long click listener, you can create an interface in your adapter: public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> { public interface OnItemClickListener { void onItemSeleted(int position, Vi...
countMatches method from org.apache.commons.lang3.StringUtils is typically used to count occurences of a substring or character in a String: import org.apache.commons.lang3.StringUtils; String text = "One fish, two fish, red fish, blue fish"; // count occurrences of a substring Str...
Method references allow predefined static or instance methods that adhere to a compatible functional interface to be passed as arguments instead of an anonymous lambda expression. Assume that we have a model: class Person { private final String name; private final String surname; ...
Start with an iterable which needs to be grouped lst = [("a", 5, 6), ("b", 2, 4), ("a", 2, 5), ("c", 2, 6)] Generate the grouped generator, grouping by the second element in each tuple: def testGroupBy(lst): groups = itertools.groupby(lst, key=lambda...
Scalars are Perl's most basic data type. They're marked with the sigil $ and hold a single value of one of three types: a number (3, 42, 3.141, etc.) a string ('hi', "abc", etc.) a reference to a variable (see other examples). my $integer = 3; # number my $str...
Arrays store an ordered sequence of values. You can access the contents by index, or iterate over them. The values will stay in the order you filled them in. my @numbers_to_ten = (1,2,3,4,5,6,7,8,9,10); # More conveniently: (1..10) my @chars_of_hello = ('h','e','l','l','o'); my @word_list = ('Hel...
Hashes can be understood as lookup-tables. You can access its contents by specifiying a key for each of them. Keys must be strings. If they're not, they will be converted to strings. If you give the hash simply a known key, it will serve you its value. # Elements are in (key, value, key, value) se...
HTML <p>My shadow always follows me.</p> CSS p { -webkit-filter: drop-shadow(10px 10px 1px green); filter: drop-shadow(10px 10px 1px green); } Result
To use multiple filters, separate each value with a space. HTML <img src='donald-duck.png' alt='Donald Duck' title='Donald Duck' /> CSS img { -webkit-filter: brightness(200%) grayscale(100%) sepia(100%) invert(100%); filter: brightness(200%) grayscale(100%) sepia(100%) invert(1...
HTML <img src='donald-duck.png' alt='Donald Duck' title='Donald Duck' /> CSS img { -webkit-filter: hue-rotate(120deg); filter: hue-rotate(120deg); } Result
HTML <div></div> CSS div { width: 100px; height: 100px; background-color: white; -webkit-filter: invert(100%); filter: invert(100%); } Result Turns from white to black.
HTML <img src='donald-duck.png' alt='Donald Duck' title='Donald Duck' /> CSS img { -webkit-filter: blur(1px); filter: blur(1px); } Result Makes you wanna rub your glasses.
A Bootstrap carousel is a Bootstrap component that creates a slideshow which cycles through elements within the carousel. Here is a basic HTML usage example: <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --...
Carousel components can be instantiated via jQuery with the function $('.carousel').carousel(options), where $('.carousel') is a top-level reference to the specific carousel and options is a Javascript object specifying the carousel's default attributes. The options object allows for multiple prope...
Schema store: { "title": "JSON schema for the ASP.NET global configuration files", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "additionalProperties": true, "required": [ &qu...

Any

Any is used to check if any element of a collection matches a condition or not. see also: .All, Any and FirstOrDefault: best practice 1. Empty parameter Any: Returns true if the collection has any elements and false if the collection is empty: var numbers = new List<int>(); bool result = ...
using System; using Xamarin.Forms; namespace NavigationApp { public class App : Application { public App() { MainPage = new NavigationPage(new FirstPage()); } } public class FirstPage : ContentPage { Label FirstPage...

Page 191 of 1336