It's possible to clear complex shaped regions by changing the globalCompositeOperation property.
// All pixels being drawn will be transparent
ctx.globalCompositeOperation = 'destination-out';
// Clear a triangular section
ctx.globalAlpha = 1; // ensure alpha is 1
ctx.fillStyle = '#000'; /...
5.6
PHP 5.6 introduced variable-length argument lists (a.k.a. varargs, variadic arguments), using the ... token before the argument name to indicate that the parameter is variadic, i.e. it is an array including all supplied parameters from that one onward.
function variadic_func($nonVariadic, ...$...
#include <stdio.h>
#define SIZE (10)
int main()
{
size_t i = 0;
int *p = NULL;
int a[SIZE];
/* Setting up the values to be i*i */
for(i = 0; i < SIZE; ++i)
{
a[i] = i * i;
}
/* Reading the values using pointers */
for(p =...
The Repeat command, executed with the dot or period key (.), is more useful than it first appears. Once learned, you will find yourself using it often.
Command:Description.Repeat the last change10.Repeat the last change 10 times
So then, for a very simple example, if you make a change to line 1 by...
Given a DataFrame with MultiIndex columns
# build an example DataFrame
midx = pd.MultiIndex(levels=[['zero', 'one'], ['x','y']], labels=[[1,1,0,],[1,0,1,]])
df = pd.DataFrame(np.random.randn(2,3), columns=midx)
In [2]: df
Out[2]:
one zero
y x ...
Start with a standard DataFrame
df = pd.DataFrame(np.random.randn(2,3), columns=['a','b','c'])
In [91]: df
Out[91]:
a b c
0 -0.911752 -1.405419 -0.978419
1 0.603888 -1.187064 -0.035883
Now to change to MultiIndex, create a MultiIndex object and assign it to df....
You can use the archivesBaseName to set the name of apk.
For example:
defaultConfig {
....
project.ext.set("archivesBaseName", "MyName-" + defaultConfig.versionName);
}
You will obtain this output.
MyName-X.X.X-release.apk
For a class Person like:
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public string Clothes { get; set; }
}
var person1 = new Person { Name = "Jon", Age = 20, Clothes = "some clothes" };
var person2 = new Person { Name ...
For given type Person:
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public string Clothes { get; set; }
}
List<Person> persons = new List<Person>
{
new Person{ Name = "Jon", Age = 20, Clothes = "some clothes...
Generally execute() command is used for fire and forget calls (without need of analyzing the result) and submit() command is used for analyzing the result of Future object.
We should be aware of key difference of Exception Handling mechanisms between these two commands.
Exceptions from submit() ar...
The hash package offers a hash structure in R. However, it terms of timing for both inserts and reads it compares unfavorably to using environments as a hash. This documentation simply acknowledges its existence and provides sample timing code below for the above stated reasons. There is no ident...
$params = @{
Uri = "https://your.hipchat.com/v2/room/934419/notification?auth_token=???"
Method = "POST"
Body = @{
color = 'yellow'
message = "This is a test message!"
notify = $false
message_format = "text"
...
#include <iostream>
#include <string>
int main()
{
const char * C_String = "This is a line of text w";
const char * C_Problem_String = "This is a line of text ኚ";
std::string Std_String("This is a second line of text w");
std::string...
What are events?
VBA is event-driven: VBA code runs in response to events raised by the host application or the host document - understanding events is fundamental to understanding VBA.
APIs often expose objects that raise a number of events in response to various states. For example an Excel.Appl...
CREATE TYPE MyUniqueNamesType as TABLE
(
FirstName varchar(10),
LastName varchar(10),
UNIQUE (FirstName,LastName)
)
Note: constraints in user defined table types can not be named.
Perl interpolates variable names:
my $name = 'Paul';
print "Hello, $name!\n"; # Hello, Paul!
my @char = ('a', 'b', 'c');
print "$char[1]\n"; # b
my %map = (a => 125, b => 1080, c => 11);
print "$map{a}\n"; # 125
Arrays may be interpolated as a whol...