Set single element:
$dt->set( year => 2016 );
Set many elements:
$dt->set( year => 2016, 'month' => 8);
Add duration to datetime
$dt->add( hour => 1, month => 2)
Datetime subtraction:
my $dt1 = DateTime->new(
year => 2016,
month => 8,
...
IronPython enables to use generic classes and methods from the .net framework.
Generics can be used with the same syntax as accessing an index. For passing more than one type-parameter, they must be separated with a comma:
l = Dictionary[int, str]()
That way we create a dictionary where keys on...
Instead of attribute Image and Ada.Text_IO.Put on enumeration literals we can only use the generic package Ada.Text_IO.Enumeration_IO to print out the literals.
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type Fruit is (Banana, Pear, Orange, Melon);
package Fruit_IO is new Enume...
To print the contents of a file, we can use loadfile to read a file into a local property, and then use echo to print the value of it.
<loadfile property="contents" srcFile="example.txt" />
<echo message="${contents}" />
requests uses specific environment variables automatically for proxy detection.
HTTP_PROXY will define the proxy URL to use for HTTP connections
HTTPS_PROXY will define the proxy URL to use for HTTPS connections
Once these environment variables are set, the Python code does not need to pass a...
Elixir / Phoenix
Install Homebrew first:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then running brew install elixir will install both Elixir and it's dependency - Erlang.
Install mix with mix local.hex.
Install Phoenix as per ...
To send an event: vm.$emit('new-message');
To catch an event: vm.$on('new-message');
To send an event to all components down: vm.$broadcast('new-message');
To send an event to all components up: vm.$dispatch('new-message');
Note: $broadcast and $dispatch are deprecated in Vue2. (see Vue2 feature...
The following picture illustrates how component communication should work. The picture comes from The Progressive Framework slides of Evan You (Developer of VueJS).
Here is an example of how it works :
DEMO
HTML
<script type="x-template" id="message-box">
<inp...
You might have realized that $emit is scoped to the component that is emitting the event. That's a problem when you want to communicate between components far from one another in the component tree.
Note: In Vue1 you coud use $dispatch or $broadcast, but not in Vue2. The reason being that it doesn'...
<?php
// hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_book_taxonomies', 0 );
// create taxonomy genres for the post type "book"
function create_book_taxonomies() {
// Add new taxonomy, make it hierarchical (like categorie...
Given:
---
variable_name: True
Then, these tasks with always run.
- name: This is a conditional task
module: src=/example/ dest=/example
when: variable_name
- name: This is a conditional task
module: src=/example/ dest=/example
when: True
This task will never run.
- name: T...
In most cases, the range_lookup is used as FALSE (an exact match). The default for this parameter is TRUE - it is less commonly used in this form, but this example shows one usecase.
A supermarket gives a bonus based on the customers monthly spend.
If the customer spends 250 EUR or more in a mon...
By default, Jsoup will display only block-level elements with a trailing line break. Inline elements are displayed without a line break.
Given a body fragment, with inline elements:
<select name="menu">
<option value="foo">foo</option>
<option va...
Get last segment
echo end($this->uri->segment_array()); //it will print others
Get before last segment
echo $this->uri->segment(count($this->uri->segment_array())-1); //it will print how-can-i-do-this
More info: [http://stackoverflow.com/questions/9221164/code-igniter-get-b...
SELECT MAX(Id) FROM Employees -- Display the value of Id in the last row in Employees table.
GO
INSERT INTO Employees (FName, LName, PhoneNumber) -- Insert a new row
VALUES ('John', 'Smith', '25558696525')
GO
SELECT @@IDENTITY
GO
SELECT MAX(Id) FROM Employees -- Display the value of Id...
Consider a communication happening between a Employee and its HR Department.
Broadly these are explained in the following six steps when a message is passed to the actor:
Employee creates something called an ActorSystem.
It uses the ActorSystem to create something called as ActorRef. Th...
In this example we will implement a custom Checkbox for Android and iOS.
Creating the Custom Control
namespace CheckBoxCustomRendererExample
{
public class Checkbox : View
{
public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create<Checkbox, bool>...