Tutorial by Examples: c

To create a Behavior just extend the CoordinatorLayout.Behavior class. Extend the CoordinatorLayout.Behavior Example: public class MyBehavior<V extends View> extends CoordinatorLayout.Behavior<V> { /** * Default constructor. */ public MyBehavior() { ...
You can use the CoordinatorLayout.Behavior to create dependencies between views. You can anchor a View to another View by: using the layout_anchor attribute. creating a custom Behavior and implementing the layoutDependsOn method returning true. For example, in order to create a Behavior for m...
Using a list object you can create a fully functional generic Stack with helper methods such as peeking and checking if the stack is Empty. Check out the official python docs for using list as Stack here. #define a stack class class Stack: def __init__(self): self.items = [] ...
Smack (Java) Using Smack 4.1 It is recommended to include Smack as Maven dependency in your project (e.g. by using gradle or Maven). Otherwhise the following Smack artifacts/jars have to be added manually to the classpath: smack-core, smack-extensions, smack-experimental, smack-im, smnack-tcp,...
When you really need to script ssh connection, piping the password into the ssh command does not work (echo passw0rd | ssh host). It is because the password is not read from standard input, but directly from TTY (teleprinter, teletypewriter, Teletype for historical reasons). But there is sshpass to...
#include <iostream> #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/mean.hpp> #include <boost/accumulators/statistics/variance.hpp> int main() { using namespace boost...
Generic arrays in Kotlin are represented by Array<T>. To create an empty array, use emptyArray<T>() factory function: val empty = emptyArray<String>() To create an array with given size and initial values, use the constructor: var strings = Array<String>(size = 5, init ...
# creates a function with no arguments, which returns 3 get_three = () -> return 3 # same as above get_three = -> 3 # creates a function with arguments add_three = (num) -> num + 3 # multiple arguments, etc. add = (a, b) -> a + b
We can define a function to perform function composition using anonymous function syntax: f ∘ g = x -> f(g(x)) Note that this definition is equivalent to each of the following definitions: ∘(f, g) = x -> f(g(x)) or function ∘(f, g) x -> f(g(x)) end recalling that in Julia,...
One application of closures is to partially apply a function; that is, provide some arguments now and create a function that takes the remaining arguments. Currying is a specific form of partial application. Let's start with the simple function curry(f, x) that will provide the first argument to a ...
This method works by incrementing an integer from 0 to the greatest index in the array. $colors = ['red', 'yellow', 'blue', 'green']; for ($i = 0; $i < count($colors); $i++) { echo 'I am the color ' . $colors[$i] . '<br>'; } This also allows iterating an array in reverse order wi...
Direct loop foreach ($colors as $color) { echo "I am the color $color<br>"; } Loop with keys $foods = ['healthy' => 'Apples', 'bad' => 'Ice Cream']; foreach ($foods as $key => $food) { echo "Eating $food is $key"; } Loop by reference In the fo...
See also Common Lisp Learning Resources. Online Books Practical Common Lisp, Peter Seibel. Good for experienced programmers. Common Lisp: A Gentle Introduction to Symbolic Computation Good for people new to programming. Common Lisp, the Language On Lisp, Paul Graham The Common Lisp Cookbook ...
Profiles permit the programmer to organize maps into classes, enhancing code readability and maintainability. Any number of profiles can be created, and added to one or more configurations as needed. Profiles can be used with both the static and instance-based APIs. public class User { public...
If there is no need for frontend in your next project, you can run sails new with additional flag --no-frontend. sails new NameOfProject --no-frontend This will generate everything needed for backend and will omit view, assets and grunt files. More about command line and sails-new: http://sails...
In the extension code you can use any chrome.* API if you decalared the required permissions. In addition, some API's works only from background pages, and some API's works only from content scripts. You can use most of chrome.tabs methods declaring any permissions. Now we focus on chrome.tabs.crea...
The following configuration options should be called on a Rails::Railtie object config.after_initialize: Takes a block which will be run after rails has initialized the application. config.asset_host: This sets the host for the assets. This is useful when using a Content Delivery Network. This i...
The following configuration options can be used for configuring assets config.assets.enabled: Determines whether the asset pipeline is enabled. This defaults to true config.assets.raise_runtime_errors: This enables runtime error checking. It's useful for development mode config.assets.compress:...
Rails allows you to configure what generators are used when running rails generate commands. This method, config.generators takes a block config.generators do |g| g.orm :active_record g.test_framework :test_unit end Here are some of the options OptionDescriptionDefaultassetsCreates asset...
Merge Sort is a divide-and-conquer algorithm. It divides the input list of length n in half successively until there are n lists of size 1. Then, pairs of lists are merged together with the smaller first element among the pair of lists being added in each step. Through successive merging and through...

Page 493 of 826