Tutorial by Examples: ant

You have a local vagrant box that you want to upload to Amazon AWS. First, you need to create a .box file: vagrant package --base my-virtual-machine This step should take a while depending on the size of your image. Then, you need to get the .vmdk image from the .box file: gunzip -S .box packag...
Vagrant.configure("2") do |config| # ... other config up here config.vm.provider "vmware_fusion" end
C++17 Normally, elision is an optimization. While virtually every compiler support copy elision in the simplest of cases, having elision still places a particular burden on users. Namely, the type who's copy/move is being elided must still have the copy/move operation that was elided. For example:...
An instant is a specific moment in time. Any date-time object that refers to a moment of time is recognized as an instant. To test if an object is an instant, use is.instant. library(lubridate) today_start <- dmy_hms("22.07.2016 12:00:00", tz = "IST") # default tz="UT...
Quantifier operations return a Boolean value if some or all of the elements in a sequence satisfy a condition. In this article, we will see some common LINQ to Objects scenarios where we can use these operators. There are 3 Quantifiers operations that can be used in LINQ: All – used to determine w...
Quantifier operations return a Boolean value that indicates whether some or all of the elements in a sequence satisfy a condition. All Determines whether all the elements in a sequence satisfy a condition. Method Syntax // All var numbers = new int[] { 1, 2, 3, 4, 5 }; bool areLessThan...
C++11 NOTE: std::auto_ptr has been deprecated in C++11 and will be removed in C++17. You should only use this if you are forced to use C++03 or earlier and are willing to be careful. It is recommended to move to unique_ptr in combination with std::move to replace std::auto_ptr behavior. Before we ...
def gen(): yield 1 iterable = gen() for a in iterable: print a # What was the first item of iterable? No way to get it now. # Only to get a new iterator gen()
Three methods are provided that offer the ability to strip leading and trailing characters from a string: str.strip, str.rstrip and str.lstrip. All three methods have the same signature and all three return a new string object with unwanted characters removed. str.strip([chars]) str.strip acts o...
Quantifiers allows to specify count of repeated strings. Zero or one: /a?/ Zero or many: /a*/ One or many: /a+/ Exact number: /a{2,4}/ # Two, three or four /a{2,}/ # Two or more /a{,4}/ # Less than four (including zero) By default, quantifiers are greedy, whi...
Properties can be set when an object is instantiated. var redCar = new Car { Wheels = 2, Year = 2016, Color = Color.Red };
Func also supports Covariant & Contravariant // Simple hierarchy of classes. public class Person { } public class Employee : Person { } class Program { static Employee FindByTitle(String title) { // This is a stub for a method that returns // an employee that h...
You can declare multiple constants within the same const block: const ( Alpha = "alpha" Beta = "beta" Gamma = "gamma" ) And automatically increment constants with the iota keyword: const ( Zero = iota // Zero == 0 One // One == 1...
Instantiating a socket can be done in various ways. by 2 line declaration & instantiation: First we need to define a variable which will hold a Socket class object: Socket socket; then we can create a Socket class object: socket = new Socket(); We can also make a one line defin...
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; With an Identifier: Give the scene a Storyboard ID within the identity inspector of the storyboard. Instantiate in code: UIViewController *controller = [storyboard instantiateViewControllerWithIdentifi...
Python's string module provides constants for string related operations. To use them, import the string module: >>> import string string.ascii_letters: Concatenation of ascii_lowercase and ascii_uppercase: >>> string.ascii_letters 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ...
User is an ActiveRecord or Mongoid class. Replace User with any Rails class in your project (even something like Integer or Array) my_string = "User" # Capitalized string # => 'User' my_constant = my_string.safe_constantize # => User my_constant.all.count # => 18 my...
This example will not work because the string passed in isn't recognized as a constant in the project. Even if you pass in "array", it won't work as it isn't capitalized. my_string = "not_a_constant" # => 'not_a_constant' my_string.safe_constantize # => nil my_s...
Object obj = new Object(); // Note the 'new' keyword Where: Object is a reference type. obj is the variable in which to store the new reference. Object() is the call to a constructor of Object. What happens: Space in memory is allocated for the object. The constructor Object() is call...
Due to type erasure the following will not work: public <T> void genericMethod() { T t = new T(); // Can not instantiate the type T. } The type T is erased. Since, at runtime, the JVM does not know what T originally was, it does not know which constructor to call. Workarounds ...

Page 4 of 11