Cake\Collection\
Collection
¶The collection classes provide a set of tools to manipulate arrays or
Traversable
objects. If you have ever used underscore.js,
you have an idea of what you can expect from the collection classes.
Collection instances are immutable; modifying a collection will instead generate a new collection. This makes working with collection objects more predictable as operations are side-effect free.
Collections can be created using an array or Traversable
object. You’ll also
interact with collections every time you interact with the ORM in CakePHP.
A simple use of a Collection would be:
use Cake\Collection\Collection;
$items = ['a' => 1, 'b' => 2, 'c' => 3];
$collection = new Collection($items);
// Create a new collection containing elements
// with a value greater than one.
$overOne = $collection->filter(function ($value, $key, $iterator) {
return $value > 1;
});
You can also use the collection()
helper function instead of new
Collection()
:
$items = ['a' => 1, 'b' => 2, 'c' => 3];
// These both make a Collection instance.
$collectionA = new Collection($items);
$collectionB = collection($items);
The benefit of the helper method is that it is easier to chain off of than
(new Collection($items))
.
The Collection\CollectionTrait
allows you to integrate
collection-like features into any Traversable
object you have in your
application as well.
Cake\Collection\Collection::
each
(callable $c)¶Collections can be iterated and/or transformed into new collections with the
each()
and map()
methods. The each()
method will not create a new
collection, but will allow you to modify any objects within the collection:
$collection = new Collection($items);
$collection = $collection->each(function ($value, $key) {
echo "Element $key: $value";
});
The return of each()
will be the collection object. Each will iterate the
collection immediately applying the callback to each value in the collection.
Cake\Collection\Collection::
map
(callable $c)¶The map()
method will create a new collection based on the output of the
callback being applied to each object in the original collection:
$items = ['a' => 1, 'b' => 2, 'c' => 3];
$collection = new Collection($items);
$new = $collection->map(function ($value, $key) {
return $value * 2;
});
// $result contains ['a' => 2, 'b' => 4, 'c' => 6];
$result = $new->toArray();
The map()
method will create a new iterator which lazily creates
the resulting items when iterated.
Cake\Collection\Collection::
extract
($matcher)¶One of the most common uses for a map()
function is to extract a single
column from a collection. If you are looking to build a list of elements
containing the values for a particular property, you can use the extract()
method:
$collection = new Collection($people);
$names = $collection->extract('name');
// $result contains ['mark', 'jose', 'barbara'];
$result = $names->toArray();
As with many other functions in the collection class, you are allowed to specify a dot-separated path for extracting columns. This example will return a collection containing the author names from a list of articles:
$collection = new Collection($articles);
$names = $collection->extract('author.name');
// $result contains ['Maria', 'Stacy', 'Larry'];
$result = $names->toArray();
Finally, if the property you are looking after cannot be expressed as a path, you can use a callback function to return it:
$collection = new Collection($articles);
$names = $collection->extract(function ($article) {
return $article->author->name . ', ' . $article->author->last_name;
});
Often, the properties you need to extract a common key present in multiple
arrays or objects that are deeply nested inside other structures. For those
cases you can use the {*}
matcher in the path key. This matcher is often
helpful when matching HasMany and BelongsToMany association data:
$data = [
[
'name' => 'James',
'phone_numbers' => [
['number' => 'number-1'],
['number' => 'number-2'],
['number' => 'number-3'],
]
],
[
'name' => 'James',
'phone_numbers' => [
['number' => 'number-4'],
['number' => 'number-5'],
]
]
];
$numbers = (new Collection($data))->extract('phone_numbers.{*}.number');
$numbers->toList();
// Returns ['number-1', 'number-2', 'number-3', 'number-4', 'number-5']
This last example uses toList()
unlike other examples, which is important
when we’re getting results with possibly duplicate keys. By using toList()
we’ll be guaranteed to get all values even if there are duplicate keys.
Unlike Cake\Utility\Hash::extract()
this method only supports the
{*}
wildcard. All other wildcard and attributes matchers are not supported.
Cake\Collection\Collection::
combine
($keyPath, $valuePath, $groupPath = null)¶Collections allow you to create a new collection made from keys and values in an existing collection. Both the key and value paths can be specified with dot notation paths:
$items = [
['id' => 1, 'name' => 'foo', 'parent' => 'a'],
['id' => 2, 'name' => 'bar', 'parent' => 'b'],
['id' => 3, 'name' => 'baz', 'parent' => 'a'],
];
$combined = (new Collection($items))->combine('id', 'name');
// Result will look like this when converted to array
[
1 => 'foo',
2 => 'bar',
3 => 'baz',
];
You can also optionally use a groupPath
to group results based on a path:
$combined = (new Collection($items))->combine('id', 'name', 'parent');
// Result will look like this when converted to array
[
'a' => [1 => 'foo', 3 => 'baz'],
'b' => [2 => 'bar']
];
Finally you can use closures to build keys/values/groups paths dynamically,
for example when working with entities and dates (converted to Cake/Time
instances by the ORM) you may want to group results by date:
$combined = (new Collection($entities))->combine(
'id',
function ($entity) { return $entity; },
function ($entity) { return $entity->date->toDateString(); }
);
// Result will look like this when converted to array
[
'date string like 2015-05-01' => ['entity1->id' => entity1, 'entity2->id' => entity2, ..., 'entityN->id' => entityN]
'date string like 2015-06-01' => ['entity1->id' => entity1, 'entity2->id' => entity2, ..., 'entityN->id' => entityN]
]
Cake\Collection\Collection::
stopWhen
(callable $c)¶You can stop the iteration at any point using the stopWhen()
method. Calling
it in a collection will create a new one that will stop yielding results if the
passed callable returns false for one of the elements:
$items = [10, 20, 50, 1, 2];
$collection = new Collection($items);
$new = $collection->stopWhen(function ($value, $key) {
// Stop on the first value bigger than 30
return $value > 30;
});
// $result contains [10, 20];
$result = $new->toArray();
Cake\Collection\Collection::
unfold
(callable $c)¶Sometimes the internal items of a collection will contain arrays or iterators
with more items. If you wish to flatten the internal structure to iterate once
over all elements you can use the unfold()
method. It will create a new
collection that will yield every single element nested in the collection:
$items = [[1, 2, 3], [4, 5]];
$collection = new Collection($items);
$new = $collection->unfold();
// $result contains [1, 2, 3, 4, 5];
$result = $new->toList();
When passing a callable to unfold()
you can control what elements will be
unfolded from each item in the original collection. This is useful for returning
data from paginated services:
$pages = [1, 2, 3, 4];
$collection = new Collection($pages);
$items = $collection->unfold(function ($page, $key) {
// An imaginary web service that returns a page of results
return MyService::fetchPage($page)->toArray();
});
$allPagesItems = $items->toList();
If you are using PHP 5.5+, you can use the yield
keyword inside unfold()
to return as many elements for each item in the collection as you may need:
$oddNumbers = [1, 3, 5, 7];
$collection = new Collection($oddNumbers);
$new = $collection->unfold(function ($oddNumber) {
yield $oddNumber;
yield $oddNumber + 1;
});
// $result contains [1, 2, 3, 4, 5, 6, 7, 8];
$result = $new->toList();
Cake\Collection\Collection::
chunk
($chunkSize)¶When dealing with large amounts of items in a collection, it may make sense to
process the elements in batches instead of one by one. For splitting
a collection into multiple arrays of a certain size, you can use the chunk()
function:
$items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
$collection = new Collection($items);
$chunked = $collection->chunk(2);
$chunked->toList(); // [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11]]
The chunk
function is particularly useful when doing batch processing, for
example with a database result:
$collection = new Collection($articles);
$collection->map(function ($article) {
// Change a property in the article
$article->property = 'changed';
})
->chunk(20)
->each(function ($batch) {
myBulkSave($batch); // This function will be called for each batch
});
Cake\Collection\Collection::
chunkWithKeys
($chunkSize)¶Much like chunk()
, chunkWithKeys()
allows you to slice up
a collection into smaller batches but with keys preserved. This is useful when
chunking associative arrays:
$collection = new Collection([
'a' => 1,
'b' => 2,
'c' => 3,
'd' => [4, 5]
]);
$chunked = $collection->chunkWithKeys(2)->toList();
// Creates
[
['a' => 1, 'b' => 2],
['c' => 3, 'd' => [4, 5]]
]
New in version 3.4.0: chunkWithKeys()
was added in 3.4.0
Cake\Collection\Collection::
filter
(callable $c)¶Collections make it easy to filter and create new collections based on
the result of callback functions. You can use filter()
to create a new
collection of elements matching a criteria callback:
$collection = new Collection($people);
$ladies = $collection->filter(function ($person, $key) {
return $person->gender === 'female';
});
$guys = $collection->filter(function ($person, $key) {
return $person->gender === 'male';
});
Cake\Collection\Collection::
reject
(callable $c)¶The inverse of filter()
is reject()
. This method does a negative filter,
removing elements that match the filter function:
$collection = new Collection($people);
$ladies = $collection->reject(function ($person, $key) {
return $person->gender === 'male';
});
Cake\Collection\Collection::
every
(callable $c)¶You can do truth tests with filter functions. To see if every element in
a collection matches a test you can use every()
:
$collection = new Collection($people);
$allYoungPeople = $collection->every(function ($person) {
return $person->age < 21;
});
Cake\Collection\Collection::
some
(callable $c)¶You can see if the collection contains at least one element matching a filter
function using the some()
method:
$collection = new Collection($people);
$hasYoungPeople = $collection->some(function ($person) {
return $person->age < 21;
});
Cake\Collection\Collection::
match
(array $conditions)¶If you need to extract a new collection containing only the elements that
contain a given set of properties, you should use the match()
method:
$collection = new Collection($comments);
$commentsFromMark = $collection->match(['user.name' => 'Mark']);
Cake\Collection\Collection::
firstMatch
(array $conditions)¶The property name can be a dot-separated path. You can traverse into nested
entities and match the values they contain. When you only need the first
matching element from a collection, you can use firstMatch()
:
$collection = new Collection($comments);
$comment = $collection->firstMatch([
'user.name' => 'Mark',
'active' => true
]);
As you can see from the above, both match()
and firstMatch()
allow you
to provide multiple conditions to match on. In addition, the conditions can be
for different paths, allowing you to express complex conditions to match
against.
Cake\Collection\Collection::
reduce
(callable $c)¶The counterpart of a map()
operation is usually a reduce
. This
function will help you build a single result out of all the elements in a
collection:
$totalPrice = $collection->reduce(function ($accumulated, $orderLine) {
return $accumulated + $orderLine->price;
}, 0);
In the above example, $totalPrice
will be the sum of all single prices
contained in the collection. Note the second argument for the reduce()
function takes the initial value for the reduce operation you are
performing:
$allTags = $collection->reduce(function ($accumulated, $article) {
return array_merge($accumulated, $article->tags);
}, []);
Cake\Collection\Collection::
min
(string|callable $callback, $type = SORT_NUMERIC)¶To extract the minimum value for a collection based on a property, just use the
min()
function. This will return the full element from the collection and
not just the smallest value found:
$collection = new Collection($people);
$youngest = $collection->min('age');
echo $youngest->name;
You are also able to express the property to compare by providing a path or a callback function:
$collection = new Collection($people);
$personYoungestChild = $collection->min(function ($person) {
return $person->child->age;
});
$personWithYoungestDad = $collection->min('dad.age');
Cake\Collection\Collection::
max
(string|callable $callback, $type = SORT_NUMERIC)¶The same can be applied to the max()
function, which will return a single
element from the collection having the highest property value:
$collection = new Collection($people);
$oldest = $collection->max('age');
$personOldestChild = $collection->max(function ($person) {
return $person->child->age;
});
$personWithOldestDad = $collection->min('dad.age');
Cake\Collection\Collection::
sumOf
(string|callable $callback)¶Finally, the sumOf()
method will return the sum of a property of all
elements:
$collection = new Collection($people);
$sumOfAges = $collection->sumOf('age');
$sumOfChildrenAges = $collection->sumOf(function ($person) {
return $person->child->age;
});
$sumOfDadAges = $collection->sumOf('dad.age');
Cake\Collection\Collection::
avg
($matcher = null)¶Calculate the average value of the elements in the collection. Optionally provide a matcher path, or function to extract values to generate the average for:
$items = [
['invoice' => ['total' => 100]],
['invoice' => ['total' => 200]],
];
// Average: 150
$average = (new Collection($items))->avg('invoice.total');
New in version 3.5.0.
Cake\Collection\Collection::
median
($matcher = null)¶Calculate the median value of a set of elements. Optionally provide a matcher path, or function to extract values to generate the median for:
$items = [
['invoice' => ['total' => 400]],
['invoice' => ['total' => 500]],
['invoice' => ['total' => 100]],
['invoice' => ['total' => 333]],
['invoice' => ['total' => 200]],
];
// Median: 333
$median = (new Collection($items))->median('invoice.total');
New in version 3.5.0.
Cake\Collection\Collection::
groupBy
($callback)¶Collection values can be grouped by different keys in a new collection when they share the same value for a property:
$students = [
['name' => 'Mark', 'grade' => 9],
['name' => 'Andrew', 'grade' => 10],
['name' => 'Stacy', 'grade' => 10],
['name' => 'Barbara', 'grade' => 9]
];
$collection = new Collection($students);
$studentsByGrade = $collection->groupBy('grade');
// Result will look like this when converted to array:
[
10 => [
['name' => 'Andrew', 'grade' => 10],
['name' => 'Stacy', 'grade' => 10]
],
9 => [
['name' => 'Mark', 'grade' => 9],
['name' => 'Barbara', 'grade' => 9]
]
]
As usual, it is possible to provide either a dot-separated path for nested properties or your own callback function to generate the groups dynamically:
$commentsByUserId = $comments->groupBy('user.id');
$classResults = $students->groupBy(function ($student) {
return $student->grade > 6 ? 'approved' : 'denied';
});
Cake\Collection\Collection::
countBy
($callback)¶If you only wish to know the number of occurrences per group, you can do so by
using the countBy()
method. It takes the same arguments as groupBy
so it
should be already familiar to you:
$classResults = $students->countBy(function ($student) {
return $student->grade > 6 ? 'approved' : 'denied';
});
// Result could look like this when converted to array:
['approved' => 70, 'denied' => 20]
Cake\Collection\Collection::
indexBy
($callback)¶There will be certain cases where you know an element is unique for the property
you want to group by. If you wish a single result per group, you can use the
function indexBy()
:
$usersById = $users->indexBy('id');
// When converted to array result could look like
[
1 => 'markstory',
3 => 'jose_zap',
4 => 'jrbasso'
]
As with the groupBy()
function you can also use a property path or
a callback:
$articlesByAuthorId = $articles->indexBy('author.id');
$filesByHash = $files->indexBy(function ($file) {
return md5($file);
});
Cake\Collection\Collection::
zip
($elements)¶The elements of different collections can be grouped together using the
zip()
method. It will return a new collection containing an array grouping
the elements from each collection that are placed at the same position:
$odds = new Collection([1, 3, 5]);
$pairs = new Collection([2, 4, 6]);
$combined = $odds->zip($pairs)->toList(); // [[1, 2], [3, 4], [5, 6]]
You can also zip multiple collections at once:
$years = new Collection([2013, 2014, 2015, 2016]);
$salaries = [1000, 1500, 2000, 2300];
$increments = [0, 500, 500, 300];
$rows = $years->zip($salaries, $increments)->toList();
// Returns:
[
[2013, 1000, 0],
[2014, 1500, 500],
[2015, 2000, 500],
[2016, 2300, 300]
]
As you can already see, the zip()
method is very useful for transposing
multidimensional arrays:
$data = [
2014 => ['jan' => 100, 'feb' => 200],
2015 => ['jan' => 300, 'feb' => 500],
2016 => ['jan' => 400, 'feb' => 600],
]
// Getting jan and feb data together
$firstYear = new Collection(array_shift($data));
$firstYear->zip($data[0], $data[1])->toList();
// Or $firstYear->zip(...$data) in PHP >= 5.6
// Returns
[
[100, 300, 400],
[200, 500, 600]
]
Cake\Collection\Collection::
sortBy
($callback)¶Collection values can be sorted in ascending or descending order based on
a column or custom function. To create a new sorted collection out of the values
of another one, you can use sortBy
:
$collection = new Collection($people);
$sorted = $collection->sortBy('age');
As seen above, you can sort by passing the name of a column or property that is present in the collection values. You are also able to specify a property path instead using the dot notation. The next example will sort articles by their author’s name:
$collection = new Collection($articles);
$sorted = $collection->sortBy('author.name');
The sortBy()
method is flexible enough to let you specify an extractor
function that will let you dynamically select the value to use for comparing two
different values in the collection:
$collection = new Collection($articles);
$sorted = $collection->sortBy(function ($article) {
return $article->author->name . '-' . $article->title;
});
In order to specify in which direction the collection should be sorted, you need
to provide either SORT_ASC
or SORT_DESC
as the second parameter for
sorting in ascending or descending direction respectively. By default,
collections are sorted in descending direction:
$collection = new Collection($people);
$sorted = $collection->sortBy('age', SORT_ASC);
Sometimes you will need to specify which type of data you are trying to compare
so that you get consistent results. For this purpose, you should supply a third
argument in the sortBy()
function with one of the following constants:
By default, SORT_NUMERIC
is used:
$collection = new Collection($articles);
$sorted = $collection->sortBy('title', SORT_ASC, SORT_NATURAL);
Warning
It is often expensive to iterate sorted collections more than once. If you
plan to do so, consider converting the collection to an array or simply use
the compile()
method on it.
Cake\Collection\Collection::
nest
($idPath, $parentPath)¶Not all data is meant to be represented in a linear way. Collections make it
easier to construct and flatten hierarchical or nested structures. Creating
a nested structure where children are grouped by a parent identifier property is
easy with the nest()
method.
Two parameters are required for this function. The first one is the property representing the item identifier. The second parameter is the name of the property representing the identifier for the parent item:
$collection = new Collection([
['id' => 1, 'parent_id' => null, 'name' => 'Birds'],
['id' => 2, 'parent_id' => 1, 'name' => 'Land Birds'],
['id' => 3, 'parent_id' => 1, 'name' => 'Eagle'],
['id' => 4, 'parent_id' => 1, 'name' => 'Seagull'],
['id' => 5, 'parent_id' => 6, 'name' => 'Clown Fish'],
['id' => 6, 'parent_id' => null, 'name' => 'Fish'],
]);
$collection->nest('id', 'parent_id')->toArray();
// Returns
[
[
'id' => 1,
'parent_id' => null,
'name' => 'Birds',
'children' => [
['id' => 2, 'parent_id' => 1, 'name' => 'Land Birds', 'children' => []],
['id' => 3, 'parent_id' => 1, 'name' => 'Eagle', 'children' => []],
['id' => 4, 'parent_id' => 1, 'name' => 'Seagull', 'children' => []],
]
],
[
'id' => 6,
'parent_id' => null,
'name' => 'Fish',
'children' => [
['id' => 5, 'parent_id' => 6, 'name' => 'Clown Fish', 'children' => []],
]
]
];
Children elements are nested inside the children
property inside each of the
items in the collection. This type of data representation is helpful for
rendering menus or traversing elements up to certain level in the tree.
Cake\Collection\Collection::
listNested
($dir = 'desc', $nestingKey = 'children')¶The inverse of nest()
is listNested()
. This method allows you to flatten
a tree structure back into a linear structure. It takes two parameters; the
first one is the traversing mode (asc, desc or leaves), and the second one is
the name of the property containing the children for each element in the
collection.
Taking the input the nested collection built in the previous example, we can flatten it:
$nested->listNested()->toList();
// Returns
[
['id' => 1, 'parent_id' => null, 'name' => 'Birds', 'children' => [...]],
['id' => 2, 'parent_id' => 1, 'name' => 'Land Birds'],
['id' => 3, 'parent_id' => 1, 'name' => 'Eagle'],
['id' => 4, 'parent_id' => 1, 'name' => 'Seagull'],
['id' => 6, 'parent_id' => null, 'name' => 'Fish', 'children' => [...]],
['id' => 5, 'parent_id' => 6, 'name' => 'Clown Fish']
]
By default, the tree is traversed from the root to the leaves. You can also instruct it to only return the leaf elements in the tree:
$nested->listNested()->toArray();
// Returns
[
['id' => 3, 'parent_id' => 1, 'name' => 'Eagle'],
['id' => 4, 'parent_id' => 1, 'name' => 'Seagull'],
['id' => 5, 'parent_id' => 6, 'name' => 'Clown Fish']
]
Once you have converted a tree into a nested list, you can use the printer()
method to configure how the list output should be formatted:
$nested->listNested()->printer('name', 'id', '--')->toArray();
// Returns
[
3 => 'Eagle',
4 => 'Seagull',
5 -> '--Clown Fish',
]
The printer()
method also lets you use a callback to generate the keys and
or values:
$nested->listNested()->printer(
function ($el) {
return $el->name;
},
function ($el) {
return $el->id;
}
);
Cake\Collection\Collection::
isEmpty
()¶Allows you to see if a collection contains any elements:
$collection = new Collection([]);
// Returns true
$collection->isEmpty();
$collection = new Collection([1]);
// Returns false
$collection->isEmpty();
Cake\Collection\Collection::
contains
($value)¶Collections allow you to quickly check if they contain one particular
value: by using the contains()
method:
$items = ['a' => 1, 'b' => 2, 'c' => 3];
$collection = new Collection($items);
$hasThree = $collection->contains(3);
Comparisons are performed using the ===
operator. If you wish to do looser
comparison types you can use the some()
method.
Cake\Collection\Collection::
shuffle
()¶Sometimes you may wish to show a collection of values in a random order. In
order to create a new collection that will return each value in a randomized
position, use the shuffle
:
$collection = new Collection(['a' => 1, 'b' => 2, 'c' => 3]);
// This could return [2, 3, 1]
$collection->shuffle()->toArray();
Cake\Collection\Collection::
transpose
()¶When you transpose a collection, you get a new collection containing a row made of the each of the original columns:
$items = [
['Products', '2012', '2013', '2014'],
['Product A', '200', '100', '50'],
['Product B', '300', '200', '100'],
['Product C', '400', '300', '200'],
]
$transpose = (new Collection($items))->transpose()->toList();
// Returns
[
['Products', 'Product A', 'Product B', 'Product C'],
['2012', '200', '300', '400'],
['2013', '100', '200', '300'],
['2014', '50', '100', '200'],
]
New in version 3.3.0: Collection::transpose()
was added in 3.3.0.
Cake\Collection\Collection::
sample
(int $size)¶Shuffling a collection is often useful when doing quick statistical analysis.
Another common operation when doing this sort of task is withdrawing a few
random values out of a collection so that more tests can be performed on those.
For example, if you wanted to select 5 random users to which you’d like to apply
some A/B tests to, you can use the sample()
function:
$collection = new Collection($people);
// Withdraw maximum 20 random users from this collection
$testSubjects = $collection->sample(20);
sample()
will take at most the number of values you specify in the first
argument. If there are not enough elements in the collection to satisfy the
sample, the full collection in a random order is returned.
Cake\Collection\Collection::
take
(int $size, int $from)¶Whenever you want to take a slice of a collection use the take()
function,
it will create a new collection with at most the number of values you specify in
the first argument, starting from the position passed in the second argument:
$topFive = $collection->sortBy('age')->take(5);
// Take 5 people from the collection starting from position 4
$nextTopFive = $collection->sortBy('age')->take(5, 4);
Positions are zero-based, therefore the first position number is 0
.
Cake\Collection\Collection::
skip
(int $positions)¶While the second argument of take()
can help you skip some elements before
getting them from the collection, you can also use skip()
for the same
purpose as a way to take the rest of the elements after a certain position:
$collection = new Collection([1, 2, 3, 4]);
$allExceptFirstTwo = $collection->skip(2)->toList(); // [3, 4]
Cake\Collection\Collection::
first
()¶One of the most common uses of take()
is getting the first element in the
collection. A shortcut method for achieving the same goal is using the
first()
method:
$collection = new Collection([5, 4, 3, 2]);
$collection->first(); // Returns 5
Cake\Collection\Collection::
last
()¶Similarly, you can get the last element of a collection using the last()
method:
$collection = new Collection([5, 4, 3, 2]);
$collection->last(); // Returns 2
Cake\Collection\Collection::
append
(array|Traversable $items)¶You can compose multiple collections into a single one. This enables you to
gather data from various sources, concatenate it, and apply other collection
functions to it very smoothly. The append()
method will return a new
collection containing the values from both sources:
$cakephpTweets = new Collection($tweets);
$myTimeline = $cakephpTweets->append($phpTweets);
// Tweets containing cakefest from both sources
$myTimeline->filter(function ($tweet) {
return strpos($tweet, 'cakefest');
});
Warning
When appending from different sources, you can expect some keys from both
collections to be the same. For example, when appending two simple arrays.
This can present a problem when converting a collection to an array using
toArray()
. If you do not want values from one collection to override
others in the previous one based on their key, make sure that you call
toList()
in order to drop the keys and preserve all values.
Cake\Collection\Collection::
insert
(string $path, array|Traversable $items)¶At times, you may have two separate sets of data that you would like to insert the elements of one set into each of the elements of the other set. This is a very common case when you fetch data from a data source that does not support data-merging or joins natively.
Collections offer an insert()
method that will allow you to insert each of
the elements in one collection into a property inside each of the elements of
another collection:
$users = [
['username' => 'mark'],
['username' => 'juan'],
['username' => 'jose']
];
$languages = [
['PHP', 'Python', 'Ruby'],
['Bash', 'PHP', 'Javascript'],
['Javascript', 'Prolog']
];
$merged = (new Collection($users))->insert('skills', $languages);
When converted to an array, the $merged
collection will look like this:
[
['username' => 'mark', 'skills' => ['PHP', 'Python', 'Ruby']],
['username' => 'juan', 'skills' => ['Bash', 'PHP', 'Javascript']],
['username' => 'jose', 'skills' => ['Javascript', 'Prolog']]
];
The first parameter for the insert()
method is a dot-separated path of
properties to follow so that the elements can be inserted at that position. The
second argument is anything that can be converted to a collection object.
Please observe that elements are inserted by the position they are found, thus, the first element of the second collection is merged into the first element of the first collection.
If there are not enough elements in the second collection to insert into the
first one, then the target property will be filled with null
values:
$languages = [
['PHP', 'Python', 'Ruby'],
['Bash', 'PHP', 'Javascript']
];
$merged = (new Collection($users))->insert('skills', $languages);
// Will yield
[
['username' => 'mark', 'skills' => ['PHP', 'Python', 'Ruby']],
['username' => 'juan', 'skills' => ['Bash', 'PHP', 'Javascript']],
['username' => 'jose', 'skills' => null]
];
The insert()
method can operate array elements or objects implementing the
ArrayAccess
interface.
Using closures for collection methods is great when the work to be done is small and focused, but it can get messy very quickly. This becomes more obvious when a lot of different methods need to be called or when the length of the closure methods is more than just a few lines.
There are also cases when the logic used for the collection methods can be reused in multiple parts of your application. It is recommended that you consider extracting complex collection logic to separate classes. For example, imagine a lengthy closure like this one:
$collection
->map(function ($row, $key) {
if (!empty($row['items'])) {
$row['total'] = collection($row['items'])->sumOf('price');
}
if (!empty($row['total'])) {
$row['tax_amount'] = $row['total'] * 0.25;
}
// More code here...
return $modifiedRow;
});
This can be refactored by creating another class:
class TotalOrderCalculator
{
public function __invoke($row, $key)
{
if (!empty($row['items'])) {
$row['total'] = collection($row['items'])->sumOf('price');
}
if (!empty($row['total'])) {
$row['tax_amount'] = $row['total'] * 0.25;
}
// More code here...
return $modifiedRow;
}
}
// Use the logic in your map() call
$collection->map(new TotalOrderCalculator)
Cake\Collection\Collection::
through
(callable $c)¶Sometimes a chain of collection method calls can become reusable in other parts
of your application, but only if they are called in that specific order. In
those cases you can use through()
in combination with a class implementing
__invoke
to distribute your handy data processing calls:
$collection
->map(new ShippingCostCalculator)
->map(new TotalOrderCalculator)
->map(new GiftCardPriceReducer)
->buffered()
...
The above method calls can be extracted into a new class so they don’t need to be repeated every time:
class FinalCheckOutRowProcessor
{
public function __invoke($collection)
{
return $collection
->map(new ShippingCostCalculator)
->map(new TotalOrderCalculator)
->map(new GiftCardPriceReducer)
->buffered()
...
}
}
// Now you can use the through() method to call all methods at once
$collection->through(new FinalCheckOutRowProcessor);
Cake\Collection\Collection::
buffered
()¶Collections often perform most operations that you create using its functions in a lazy way. This means that even though you can call a function, it does not mean it is executed right away. This is true for a great deal of functions in this class. Lazy evaluation allows you to save resources in situations where you don’t use all the values in a collection. You might not use all the values when iteration stops early, or when an exception/failure case is reached early.
 Consider the following example:
$collection = new Collection($oneMillionItems);
$collection = $collection->map(function ($item) {
return $item * 2;
});
$itemsToShow = $collection->take(30);
Had the collections not been lazy, we would have executed one million operations,
even though we only wanted to show 30 elements out of it. Instead, our map
operation was only applied to the 30 elements we used. We can also
derive benefits from this lazy evaluation for smaller collections when we
do more than one operation on them. For example: calling map()
twice and
then filter()
.
Lazy evaluation comes with its downside too. You could be doing the same operations more than once if you optimize a collection prematurely. Consider this example:
$ages = $collection->extract('age');
$youngerThan30 = $ages->filter(function ($item) {
return $item < 30;
});
$olderThan30 = $ages->filter(function ($item) {
return $item > 30;
});
If we iterate both youngerThan30
and olderThan30
, the collection would
unfortunately execute the extract()
operation twice. This is because
collections are immutable and the lazy-extracting operation would be done for
both filters.
Luckily we can overcome this issue with a single function. If you plan to reuse
the values from certain operations more than once, you can compile the results
into another collection using the buffered()
function:
$ages = $collection->extract('age')->buffered();
$youngerThan30 = ...
$olderThan30 = ...
Now, when both collections are iterated, they will only call the extracting operation once.
The buffered()
method is also useful for converting non-rewindable iterators
into collections that can be iterated more than once:
// In PHP 5.5+
public function results()
{
...
foreach ($transientElements as $e) {
yield $e;
}
}
$rewindable = (new Collection(results()))->buffered();
Cake\Collection\Collection::
compile
(bool $preserveKeys = true)¶Sometimes you need to get a clone of the elements from another
collection. This is useful when you need to iterate the same set from different
places at the same time. In order to clone a collection out of another use the
compile()
method:
$ages = $collection->extract('age')->compile();
foreach ($ages as $age) {
foreach ($collection as $element) {
echo h($element->name) . ' - ' . $age;
}
}


class: center, middle # Тopic 3. Python Syntax --- # Lines, Explicit and Implicit Line joining - Logical lines - Physical lines ```python x = 1 z = a + 1000 \ + 2000 + 3000 s = '''This is a long line of text''' y = ( 100, 200, ) ``` 9 physical lines, 4 logical lines ```python x = 100; y = 200 ``` 1 physical, 1 logical --- # Python Syntax Elements - Encoding declaration - Comments - Docstrings (special case of string literal) - Blank lines - Indentation - Whitespace between tokens - **Keywords** - **Identifiers** - Reserved classes of identifiers - **Literals** - **Operators** - **Delimiters** --- # Encoding declaration First or second line in file: ```python # -*- coding:
-*- ``` ```python # -*- coding: utf-8 -*- ``` --- # Comments - No block comments - Everything after `#` ```python # single line comment ``` ```python x = 100 # inline comment, 2 spaces after the code by convention ``` --- # Docstrings - Introduced in [PEP-257](https://www.python.org/dev/peps/pep-0257/) - Special case of string literal used for documentation. - Becomes part of function/class declaration. ```python def fibonacci(n): """Generate n-th Fibonacci number.""" ``` ```python def func(): """ Multiline docstring. """ ``` ```python class Point: """Base point class in N-dimensional Euclidean space.""" ``` ```python fibonacci.__doc__ func.__doc__ Point.__doc__ ``` --- # Indentation - Indentation consists of spaces and tabs (not recommended); mixing is not recommended - Indentation starts at the beginning of the line and can't be split over multipe physical lines with `\` - Recommended: 4 spaces - Wrong indentation raises error --- # Indentation, Correct Example of correct (but strange) indentation: ```python def perm(l): # Compute the list of all permutations of l if len(l) <= 1: return [l] r = [] for i in range(len(l)): s = l[:i] + l[i+1:] p = perm(s) for x in p: r.append(l[i:i+1] + x) return r ``` --- # Indentation, Incorrect Example of incorrect indentation: ```python def perm(l): # error: first line indented for i in range(len(l)): # error: not indented s = l[:i] + l[i+1:] p = perm(l[:i] + l[i+1:]) # error: unexpected indent for x in p: r.append(l[i:i+1] + x) return r # error: inconsistent dedent ``` --- # Whitespaces Between Tokens - Whitespaces are used to separate tokens - Whitespace is needed between two tokens only if their concatenation could otherwise be interpreted as a different token: `ab` vs. `a b`. - Whitespace characters can be used interchangeably: space, tab formfeed - except at the beginning of a logical line or in string literals --- # 35 Keywords (Python 3.7.4) .pull-left[ - True, False, None - and, or, not, is, in - as - assert - async, await - class, def, lambda - del - for, while, break, continue ] .pull-right[ - global, nonlocal - if, elif, else - import, from - pass - raise, try, except, finally - return, yield - with ] --- # Identifiers - **Case sensitive** - ASCII characters: `a`-`z`, `A`-`Z`, `_`, and `0`-`9` (except the first character) - Unicode characters: [PEP-3131](https://www.python.org/dev/peps/pep-3131/), full list [see here](https://www.dcl.hpi.uni-potsdam.de/home/loewis/table-3131.html) Examples: ```python >>> name = 1 >>> Name = 2 >>> name, Name (1, 2) >>> 䜃 = 1 >>> я_плакал = 987 >>> _ = 100500 ``` ```python >>> 1Name File "
", line 1 1Name ^ SyntaxError: invalid syntax ``` --- # Identifiers: Naming Conventions - Mostly lowercase - Keep names as short as possible, but preserve readability and make self-descriptive names - `snake_case` over `camelCase` - Functions, variables, class members: `lowercase_snake_case` - Class names: `FirstLetterUppercaseCamelCase` - Constants: `UPPERCASE_SNAKE_CASE` --- # Identifiers: Reserved - `_` - in the interactive interpreter, the result of last evaluation - `_*` - hidden names: not imported by `from module import *` - protected class members (convention) - `__*` - implementation of "protected" methods in Python - `__*__` - [special method names](https://docs.python.org/3/reference/datamodel.html#specialnames) - special module variables (convention): `__author__`, `__copyright__`, `__license__`, `__version__`, etc. --- # Literals - String, bytes - Number: - Integer - Floating-point - Imaginary - See [Python documentation](https://docs.python.org/3/reference/lexical_analysis.html#literals) **Note:** `True`, `False`, `None` – are **keywords**, although they are used like literals. --- # Operators - Arithmetic: `+` `-` `*` `**` `/` `//` `%` `@` - Bitwise: `<<` `>>` `&` `|` `^` `~` - Logical: `<` `>` `<=` `>=` `==` `!=` **Note:** `and`, `or`, `not` – are **keywords**, although they act like logical operators. Python supports operators overloading. --- # Delimiters - `(` `)` `[` `]` `{` `}` - `.` - `,` `:` `;` - `@` - `->` - `=` - `+=`, `-=`, `*=`, `/=`, `//=`, `%=`, `@=`, `&=`, `|=`, `^=`, `>>=`, `<<=`, `**=` --- # Assignments - Continue to work on Assignments 1-A, 1-B - Make your commits and pushes


[§328-12.4] Food establishments; use of latex gloves prohibited. The use of latex gloves by personnel in a food establishment permitted under title 11, chapter 50 of the Hawaii administrative rules, shall be prohibited. [L 2016, c 180, §4]


Form Validation Examples
First Form
Validation On Dynamic Dom
Dynamic: Add input field
Validate Not Empty
Name
Validate Form
Validate Positive If Any Radio Clicked
private
business
Validate Form
Validation Ajax With Manipulating Message ({ name }}
Zip
Validate Form
Validate EMail
E-Mail
Validate Form
Validate A Checkbox
Newsletter
Validate Form
Validate Group With Needing Single Choice
accept legal terms
do NOT accept legal terms
Validate Form
Validate A Select Field
Language
make your choice
Germany
England
Validate Form
Validate An Textarea
Textarea
Validate Form
Validate A Phone Field
phone
phone main number
Validate Form
Validate A Phone Field With Customized Group Validation Display Using Events
phone
phone number main
Validate Form
Second Form
Validation With Message In Customized Col Left/Right Responsive Layout Container
Name
Second Name
Validate Form
Validate Not Empty With Minimum Config
Name
Validate Form
Do Not Validate Name Unvisible
Name unvisible
Validate Form


The first European settlers found the shoreline near where Michigan Avenue is now. Expansion into the lake began in the late 1800s, when debris from the Great Chicago Fire was used to create land that eventually grew to become Grant Park, just west of here. Over roughly 50 years, eastern Chicago grew by about 2,000 acres with the help of landfill, ash, and dirt. Much of this work, including the expansion of Grant Park, was inspired by the famous 1909 Plan of Chicago, which introduced ideas for converting the lakefront into public land.
The city has historically struggled to control erosion along its entirely man-made shoreline. Changing water levels and winter storms have chipped away at beaches, filled in navigation channels and harbors, and damaged breakwaters and other structures designed to prevent coastal erosion. Ironically, these structures have sped up erosion in places by moving sand and exposing finer lakebed sediments to waves they cannot withstand. The battle with erosion has led to several redevelopment projects over the decades, including one in 1996 when more landfill was added near here to create a larger buffer between Lake Shore Drive and the lake.


Aaron Judge attends ex-teammate’s wedding with girlfriend Samantha Bracksieck
by Jaclyn HendricksWedding bells were ringing this weekend, but not for Aaron Judge and girlfriend Samantha Bracksieck.
The Yankees superstar attended the nuptials of minor league player Eric Jagielo, according to SportsGossip.com.
Jagielo, a third baseman, was drafted by the Yankees in 2013 and was traded to the Reds two years later. He was acquired by the Marlins last year and released from the team in March.
As for Judge, the 27-year-old outfielder has been spending time with Bracksieck after the Yankees fell to the Astros in Game 6 of the ALCS. The couple reportedly hit a Suns game earlier this month.
Bracksieck was Judge’s No. 1 fan throughout the MLB playoffs. In October, she and model Chase Carter, who has been linked to fellow Yankees star Giancarlo Stanton, supported the Bombers during the ALDS.
Carter and Stanton have reportedly split since.


Should Old Acquaintance be forgot
Should Old Acquaintance be forgot
Should Old Acquaintance be forgot
Should Old Acquaintance be forgot
markdown:
*Should Old Acquaintance be forgot*
_Should Old Acquaintance be forgot_
**Should Old Acquaintance be forgot**
__Should Old Acquaintance be forgot__
This is a text with light and strong emphasis.
This is emphasized as well.
This does _not_ work.
This does __not__ work either.
markdown:
This is a ***text with light and strong emphasis***.
This **is _emphasized_ as well**.
This *does _not_ work*.
This **does __not__ work either**.


Directive are single line statements which are pre-processed and affect the entire script regardless of where they are placed.
Conditional blocks such as if-statements do not affect directives and with a few exceptions variables may not be used.
Reads the specified file path and behaves as though the contents are present at this exact position.
If path is a directory all future include directives will use this as the parent folder.
The only variables which may be used are A_ScriptDir, A_AppData and A_AppDataCommon.
#Include
ensures path is included only once, #IncludeAgain
allows multiple inclusions of the same file.
The path parameter may optionally be preceded by *i
and a single space, which causes the program to ignore any failure to load the included file.
Disables the showing of the default tray (notification) icon.
Determines whether a script is allowed to run again when it is already running.
Friendly name for the program.
Short description of the program.
Company shipping the program.
Version number of the program e.g. <IP_ADDRESS>15
.


Qualifications
This section is always up to date with current skills and technologies
Programming/Markup Languages:
- JavaScript (ES 6)
- PHP
- Python
- Typescript
- HTML5
- CSS3/SASS
- MySQL
- Markdown
- Assembly Language x86 Intel
Libraries & Frameworks:
- Laravel
- NodeJS
- Express.js
- Vue.js (2 & 3)
- Inertia.js
- React
- Redux
- Alphine.js
- Livewire
- Tailwind
- SASS
- Cyress (Front-end testing library)
- PestPHP (Back-end testing Library)
- Webpack
Operating Systems:
- Unix (Experience with: Arch, Debian)
- Windows
Languages:
- English: bilingual proficiency (speaking, reading, writing)
- Fluent native Spanish speaker
Portfolio
Profecional projects I have worked on
Lalapoint
Real State Marketing
- Laravel Framework
- MySQL
- Inertia.js
- Vue.js (2 & 3)
- Typescript
- Tailwind & Quasar
- Testing using PestPHP, Cypress and Laravel Dusk
- Livewire
- Alphine.js
Topshelf Design App
Design Management Portal Developed
from Scratch for topshelfdesign.co
- Node.js
- Express.js
- MongoDB
- React.js
- Redux
- Stripe Integration
- MailGun Integration
- Chat system created with Socket.io
- File Upload Functionality to S3 Buckets
- Deployed Using AWS
Raines Market Place
Multistep Form Created for rainesinternational.com
- Wordpress API
- React.js
- File Upload Functionality to S3 Buckets
- Regular Expresions
- Object Oriented Programming
- Form Authentication
- CSS3
- Fully Responsive
Work History
Full Stack Developer
Lalapoint | Real Data Strategies, Newport Beach, CA - https://lalapoint.com/
January 2021 - September 2022
- Rewrite from html to single page application using Vue.js 3, Typescript, Inertia.js and Tailwind
- Updating old Vue 2 components into Vue.js 3 and Typescript components
- Backend Development using Laravel, PHP, MySQL, REST API
- Converting Figma designs to pixel perfect html and css templates
- Testing main application using Unit/Feature Testing and automated browser testing.
- Single page websites using Vue.js 3 to use as promotional sites
Jr Full Stack Developer
UCoast, Hawthorne CA - https://ucoastweb.com/
June 2020 - March 2021
- WordPress API development using React.js
- Website QA and Accessibility Audits
- MERN stack development project from start to finish using Socket.io, Stripe, MailGun, and AWS
About Me
How and why I got started with computer programming.
How I got started with programming.
A few years ago, I began testing the waters in programming, mostly being curious about Cybersecurity, but at the time, that world seemed obfuscated and with no clear path.
I decided to start with computer programming, more specifically Python and C++. I took a college course in Computer Science 101 where the language that was primarily used was C++. Additionally, I took the initiative of learning on my own by enrolling in a Microsoft course that focused on Python.
My Cybersecurity journey
After months of learning Python, I had the basic knowledge, therefore, started to dabble in Cybersecurity. At this point I discovered that there were many paths to choose from in this subject. After speaking with a close friend familiar with this area, I decided to learn Malware Analysis. I found that I really enjoy the aspect of investigating and playing a cat and mouse game.
Discovering Web Development
After noticing that most of the courses are about Web Development, I decided to give it a try. I always thought it would be interesting to be able to sit and create something with basic lines of code. It was clear that Web Development was for me, I learned everything on own with the help of Udemy, Udacity, and books.
The Web Development world is full of different packages and frameworks that make it really hard for someone to pick the exact path to take and that may be a little discouraging, but with my current skills, I feel very confident that I can become a valuable asset in any development team.


Entity Vehicle
Vehicle is the Entity definition for a vehicle.
Subclass of Entity.
Functions
| GetAttribute (attrib) | GetAttribute returns the value of the given attribute for the vehicle. |
| GetHP () | GetHP returns the current HP of the vehicle. |
| GetDriver () | GetDriver returns the current driver of the vehicle. |
| GetGunner () | GetGunner returns the current gunner of the vehicle. |
| GetController () | GetController returns the @{VehicleController) object for the vehicle. |
| GetPassenger (num) | GetPassenger returns the given numbered passenger of the vehicle. |
| GetRepairObject () | GetRepairObject returns the repair object for this vehicle. |
| GetVehicleWeapon () | GetVehicleWeapon returns the weapon on this vehicle. |
| GetDriverLeftHandItem () | GetDriverLeftHandItem returns the saved left hand item for the driver. |
| GetGunnerLeftHandItem () | GetGunnerLeftHandItem returns the saved left hand item for the gunner. |
| GetInventory () | GetInventory returns the inventory of the vehicle. |
| GetNumPassengers () | GetNumPassengers returns the number of non-driving and non-gunning passengers in the vehicle. |
| GetTotalOccupants () | GetTotalOccupants returns the total number of occupants of the vehicle (driver, gunner, and passengers). |
| GetMaxPassengers () | GetMaxPassengers returns the maximum number of non-driving and non-gunning passengers in the vehicle. |
| GetMaxTotalOccupants () | GetMaxTotalOccupants returns the maximum number of total occupants of the vehicle (driver, gunner, and passengers). |
| GetTurnRate () | GetTurnRate returns the turn rate of the vehicle. |
| GetCriticalChance () | GetCriticalChance returns the critical hit chance if the vehicle rams a target. |
| GetDamageMultiplier () | GetDamageMultiplier returns the damage multiplier if the vehicle rams a target. |
| GetAcceleration () | GetAcceleration returns the acceleration of the vehicle. |
| GetMaxSlowSpeed () | GetMaxSlowSpeed returns the maximum "slow" speed of the vehicle. |
| GetMaxHighSpeed () | GetMaxHighSpeed returns the maximum speed of the vehicle. |
| GetEndTurnTime () | GetEndTurnTime returns the animation clock time of the end of the vehicle's change in direction. |
| NeedsRepairObject () | NeedsRepairObject returns true if the vehicle needs repair. |
| HasWeapon () | HasWeapon returns true if the vehicle has a weapon. |
| IsRunSpeed () | IsRunSpeed returns true if the vehicle is at high speed. |
| IsReverse () | IsReverse returns true if the vehicle is in reverse. |
| IsDestinationReached () | IsDestinationReached returns true if the vehicle is at its destination. |
| IsTurnReached () | IsTurnReached returns true if the vehicle has finished changing direction. |
| IsHavingTurn () | IsHavingTurn returns true if the vehicle is turning. |
| GetCurrentAction () | GetCurrentAction returns the current animation action for the vehicle. |
| GetButtonSprite () | GetButtonSprite returns the sprite to use for the vehicle controller. |
| GetButtonSprite () | GetExitPoint returns the exit point of actors in the vehicle. |
| GetDestination () | GetDestination returns the destination of the vehicle. |
| GetVelocity () | GetVelocity returns the directional velocity of the vehicle. |
| GetDimensions () | GetDimensions returns the linear dimensions of the vehicle. |
Functions
- GetAttribute (attrib)
-
GetAttribute returns the value of the given attribute for the vehicle.
Parameters:
- attrib The attribute to check, as a string. Should match attribute strings from the editor.
Returns:
-
An integer indicating the vehicle's attribute value.
- GetHP ()
-
GetHP returns the current HP of the vehicle.
Returns:
-
An integer indicating the current HP.
- GetDriver ()
-
GetDriver returns the current driver of the vehicle.
Returns:
-
An Actor object indicating the current driver, or nil if no driver.
- GetGunner ()
-
GetGunner returns the current gunner of the vehicle.
Returns:
-
An Actor object indicating the current gunner, or nil if no gunner.
- GetController ()
-
GetController returns the @{VehicleController) object for the vehicle.
Returns:
-
A VehicleController object for the vehicle.
- GetPassenger (num)
-
GetPassenger returns the given numbered passenger of the vehicle.
Parameters:
- num Which numbered passenger to retrieve.
Returns:
-
An Actor object for the passenger if there is one, else nil.
- GetRepairObject ()
-
GetRepairObject returns the repair object for this vehicle.
Returns:
-
A Collectable object for the repair object.
- GetVehicleWeapon ()
-
GetVehicleWeapon returns the weapon on this vehicle.
Returns:
-
A VehicleWeapon object if the vehicle has a weapon, else nil.
- GetDriverLeftHandItem ()
-
GetDriverLeftHandItem returns the saved left hand item for the driver.
Returns:
-
An Entity object for the driver's left hand object.
- GetGunnerLeftHandItem ()
-
GetGunnerLeftHandItem returns the saved left hand item for the gunner.
Returns:
-
An Entity object for the gunner's left hand object.
- GetInventory ()
-
GetInventory returns the inventory of the vehicle.
Returns:
-
An array of Collectable objects indicating the vehicle inventory.
- GetNumPassengers ()
-
GetNumPassengers returns the number of non-driving and non-gunning passengers in the vehicle.
Returns:
-
An integer indicating the number of passengers.
- GetTotalOccupants ()
-
GetTotalOccupants returns the total number of occupants of the vehicle (driver, gunner, and passengers).
Returns:
-
An integer indicating the number of occupants.
- GetMaxPassengers ()
-
GetMaxPassengers returns the maximum number of non-driving and non-gunning passengers in the vehicle.
Returns:
-
An integer indicating the maximum number of passengers.
- GetMaxTotalOccupants ()
-
GetMaxTotalOccupants returns the maximum number of total occupants of the vehicle (driver, gunner, and passengers).
Returns:
-
An integer indicating the maximum number of occupants.
- GetTurnRate ()
-
GetTurnRate returns the turn rate of the vehicle.
Returns:
-
An integer indicating the turn rate.
- GetCriticalChance ()
-
GetCriticalChance returns the critical hit chance if the vehicle rams a target.
Returns:
-
An integer indicating the critical hit chance on ramming.
- GetDamageMultiplier ()
-
GetDamageMultiplier returns the damage multiplier if the vehicle rams a target.
Returns:
-
A numeric value indicating the damage multiplier on ramming.
- GetAcceleration ()
-
GetAcceleration returns the acceleration of the vehicle.
Returns:
-
A numeric value indicating the acceleration.
- GetMaxSlowSpeed ()
-
GetMaxSlowSpeed returns the maximum "slow" speed of the vehicle.
Returns:
-
A numeric value indicating the slow speed.
- GetMaxHighSpeed ()
-
GetMaxHighSpeed returns the maximum speed of the vehicle.
Returns:
-
A numeric value indicating the maximum speed.
- GetEndTurnTime ()
-
GetEndTurnTime returns the animation clock time of the end of the vehicle's change in direction.
Returns:
-
A numeric value indicating the time of finishing a requested change of direction.
- NeedsRepairObject ()
-
NeedsRepairObject returns true if the vehicle needs repair.
Returns:
-
A boolean value indicating repair is needed.
- HasWeapon ()
-
HasWeapon returns true if the vehicle has a weapon.
Returns:
-
A boolean value indicating the vehicle has a weapon.
- IsRunSpeed ()
-
IsRunSpeed returns true if the vehicle is at high speed.
Returns:
-
A boolean value indicating the vehicle is at high speed.
- IsReverse ()
-
IsReverse returns true if the vehicle is in reverse.
Returns:
-
A boolean value indicating the vehicle is in reverse.
- IsDestinationReached ()
-
IsDestinationReached returns true if the vehicle is at its destination.
Returns:
-
A boolean value indicating the vehicle is at its destination.
- IsTurnReached ()
-
IsTurnReached returns true if the vehicle has finished changing direction.
Returns:
-
A boolean value indicating the vehicle has finished changing direction.
- IsHavingTurn ()
-
IsHavingTurn returns true if the vehicle is turning.
Returns:
-
A boolean value indicating the vehicle is turning.
- GetCurrentAction ()
-
GetCurrentAction returns the current animation action for the vehicle.
Returns:
-
A string indicating the current action animation.
- GetButtonSprite ()
-
GetButtonSprite returns the sprite to use for the vehicle controller.
Returns:
-
A string indicating the vehicle control sprite.
- GetButtonSprite ()
-
GetExitPoint returns the exit point of actors in the vehicle.
Returns:
-
A table containing numeric values "x", "y", and "z" indicating the exit point.
- GetDestination ()
-
GetDestination returns the destination of the vehicle.
Returns:
-
A table containing numeric values "x", "y", and "z" indicating the destination.
- GetVelocity ()
-
GetVelocity returns the directional velocity of the vehicle.
Returns:
-
A table containing numeric values "x", "y", and "z" indicating the velocity.
- GetDimensions ()
-
GetDimensions returns the linear dimensions of the vehicle.
Returns:
-
A table containing numeric values "x", "y", and "z" indicating the vehicle dimensions.


Grid system
Types of grid implementations
SQ-Grid offers three types of grids:
- CSS Grid-based
- Flexbox-based
- Float-based
The grid which the browser should use is determined by @supports queries. In case the browser supports either native CSS grids or flexbox, the UI kit exposes class rules which the developer can use to manipulate the grid according to either grid or flexbox rules. In case the browser doesn't support either of those two features, the UI kit defaults to using floats to establish the grid rules.
Usage
The grid uses a maximum of 12 columns per row. All the width calculations and corresponding classes are based on the 12-column layout.
The grid consists of the following classes:
- .sq-grid - The parent which wraps the grid columns. By default, it does not contain any CSS rules.
- (.sq-grid).css-grid - This is an additional class to .sq-grid which enables the usage of the native CSS grid feature.
- (.sq-grid).css-flexbox - An additional class to .sq-grid. It enables the flexbox implementation of the grid system.
- (.sq-grid).auto-col-width - An additional class to .sq-grid. When this class is added, the columns width is calculated automatically (based on 12-column layout).
- .col - The class for every child of the .sq-grid container. Represents a single column of the grid.
- (.col).span-{<number>, where <number> can be an integer between 1 and 12} - An additional class to .col. It can be used to manually set the width of box. For example, .col.span-4 would mean that the box would span 4 columns.
1. Basic usage
Default CSS grid implementation:
- the grid container is split into 12 columns, 1fr each
- every column spans exactly 1fr and doesn't expand to fill in the remaining space
And, respectively, the code:

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Blanditiis dolore facere laboriosam nam reiciendis repellat tempora!
Architecto at dolores excepturi iure magni necessitatibus nisi nulla quam rerum sunt voluptate, voluptatum!

...

Default flexbox implementation:
The default flexbox implementation formats the content according to the following rules:
- every column has an ideal width of 100%/12 and expands when needed
- every column expands to fill in the remaining space if the maximum of 12 columns isn't reached
The code for which would be:

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Blanditiis dolore facere laboriosam nam reiciendis repellat tempora!
Architecto at dolores excepturi iure magni necessitatibus nisi nulla quam rerum sunt voluptate, voluptatum!

...

2. Automatic column calculation
Automatic column calculation is enforced on the grid container by adding the .auto-col-width class. The content is formatted differently, according to the implementation of the grid layout.
CSS grid implementation with automatic column calculation:
Adding the .auto-col-width class to the grid container will split it into 12 columns, each one with a varying width between a minimum of (100/12 * 1em) and 1fr. This will force every column to expand to fill in the remaining space inside the grid container.

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Blanditiis dolore facere laboriosam nam reiciendis repellat tempora!
Architecto at dolores excepturi iure magni necessitatibus nisi nulla quam rerum sunt voluptate, voluptatum!

...

Flexbox implementation with automatic column calculation:
Adding the .auto-col-width class to the grid container will split it into 12 columns and the width of one column is calculated according to the total number of columns present inside the grid container.

Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Blanditiis dolore facere laboriosam nam reiciendis repellat tempora!
Architecto at dolores excepturi iure magni necessitatibus nisi nulla quam rerum sunt voluptate, voluptatum!

...

3. Giving specific width to columns
Whenever we need to have unevenly split columns, we can manually set their width by adding the
.span-<number> class.
<number> can be an integer between 1 and 12.
Let's say we want our content to be split into 3 boxes. We want the first box to span 6 columns, the
second - 2 columns, and the third one - 4 columns.
CSS-grid columns with manually set width:

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis dolore facere laboriosam nam reiciendis repellat tempora!
Architecto at dolores excepturi iure magni necessitatibus nisi nulla quam rerum sunt voluptate, voluptatum!

...

...

Flexbox columns with manually set width:

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis dolore facere laboriosam nam reiciendis repellat tempora!
Architecto at dolores excepturi iure magni necessitatibus nisi nulla quam rerum sunt voluptate, voluptatum!

...

...


When you have approved changes, new updated model sent to all xreRedirector hosts. If you still want trigger manual push - Click on this button now.
Trigger Model Update Download Core Backup


--- layout: archive title: Zulip Chat Archive permalink: /stream/113489-new-members/topic/Theorem-searching.20mechanism.20in.20Lean.3F.html ---
In Coq, when I wish to invoke a theorem that I believe should already be in the stdlib, I can use the Search
vernacular as follows:
Search ({?P} + {~ ?P}). (* Searches for all results of decidable propositions in the stdlib *)
Is there a similar mechanism in Lean by chance?
by library_search
is probably the most reliable tool for this right now
Mario Carneiro said:
by library_search
is probably the most reliable tool for this right now
Thanks! I suppose this is just an ordinary tactic which tries to apply a lemma from the stdlib? And where can I learn more about it?
https://github.com/leanprover-community/mathlib/blob/master/docs/tactics.md#library_search
There's now a fancier link to the tactics doc isn't there?
https://leanprover-community.github.io/mathlib_docs/tactics.html#library_search
Kevin Buzzard said:
https://leanprover-community.github.io/mathlib_docs/tactics.html#library_search
This is very useful, I did not realize there was a dedicated webpage for mathlib documentation.
Bookmarked for future reference
It's quite new. Rob Lewis and others put quite a lot of effort into it. Other goodies are available here. I find that page quite useful.
Can tactics ask Lean in which file (+ line number?) a certain statement is?
Yes.
So library_search
could print a link to the docs in the message window?
leancrawler is doing that for instance.
I'm not familiar with Coq's Search
, but it kind of looks like #find
.
Bryan Gin-ge Chen said:
I'm not familiar with Coq's
Search
, but it kind of looks like#find
.
Yes, that looks like what I am looking for. Thank you!
Coq's search is much better than find
, in that it's far faster and (I think) can find declarations that are outside the current environment.
I agree with the replies above that usually library_search
(or its parent suggest
) are much more useful in practice.
Last updated: Apr 24 2020 at 19:02 UTC


Deal ON: Man Utd ready to back Solskjaer in bid to sign £75m-rated starlet
by Ron CarneMan Utd boss Ole Gunnar Solskjaer is reportedly set to receive the support of the hierarchy in his bid to sign RB Salzburg striker Erling Haaland.
The 19-year-old is currently enjoying a stellar campaign having bagged 26 goals and six assists in 18 appearances so far this season.
SEE MORE: Nemanja Matic drops HUGE hint at possible reunion with Jose Mourinho at Tottenham
Unsurprisingly, that type of form has led to interest building in signing him from around Europe, and Man Utd have been heavily touted as a possible destination.
According to The Daily Mail, there could be a major transfer boost for Solskjaer as it’s suggested that the Red Devils are prepared to back him on this move and will green light a swoop for the Norwegian youngster, although he is said to have a £75m price-tag which could yet prove to be problematic.
It’s added that Arsenal, Real Madrid, Juventus and Bayern Munich are all said to hold an interest in Haaland too, and so perhaps Man Utd would be well advised to not wait too long to make their decision on whether or not they will submit a bid for the talented starlet.
After allowing both Romelu Lukaku and Alexis Sanchez to leave this past summer, Solskjaer has arguably left himself short up top to compete on multiple fronts.
That has led to an over-reliance on the likes of Marcus Rashford and Anthony Martial, and although they are two highly-talented individuals, perhaps Solskjaer could do with an out-and-out goalscorer to lead the line and Haaland has shown signs this year that he’s capable of doing that exact job.
Time will tell if Man Utd can reach an agreement with Salzburg on a transfer fee, but it appears as though the Premier League giants are ready to support Solskjaer and will enter talks next year with a summer move said to be the more likely deal if a switch materialises, as per the Mail.


APK
Version
Diff Against
Show all Canary versions
Open Size Report (Googlers only)
To upload your own .size file, use the upload button within the viewer.


The LC_CTYPE environment variable specifies character classification. GCC uses it to determine the character boundaries in a string; this is needed for some multibyte encodings that contain quote and escape characters that would otherwise be interpreted as a string end or escape.
The LC_MESSAGES environment variable specifies the language to use in diagnostic messages.
If the LC_ALL environment variable is set, it overrides the value of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES default to the value of the LANG environment variable. If none of these variables are set, GCC defaults to traditional C English behavior.
- TMPDIR
- If TMPDIR is set, it specifies the directory to use for temporary files. GCC uses temporary files to hold the output of one stage of compilation which is to be used as input to the next stage: for example, the output of the preprocessor, which is the input to the compiler proper.
- GCC_EXEC_PREFIX
-
If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
names of the subprograms executed by the compiler. No slash is added
when this prefix is combined with the name of a subprogram, but you can
specify a prefix that ends with a slash if you wish.
If GCC_EXEC_PREFIX is not set, GCC will attempt to figure out an appropriate prefix to use based on the pathname it was invoked with.
If GCC cannot find the subprogram using the specified prefix, it tries looking in the usual places for the subprogram.
The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where prefix is the prefix to the installed compiler. In many cases prefix is the value of "prefix" when you ran the configure script.
Other prefixes specified with -B take precedence over this prefix.
This prefix is also used for finding files such as crt0.o that are used for linking.
In addition, the prefix is used in an unusual way in finding the directories to search for header files. For each of the standard directories whose name normally begins with /usr/local/lib/gcc (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries replacing that beginning with the specified prefix to produce an alternate directory name. Thus, with -Bfoo/, GCC will search foo/bar where it would normally search /usr/local/lib/bar. These alternate directories are searched first; the standard directories come next. If a standard directory begins with the configured prefix then the value of prefix is replaced by GCC_EXEC_PREFIX when looking for header files.
- COMPILER_PATH
- The value of COMPILER_PATH is a colon-separated list of directories, much like PATH. GCC tries the directories thus specified when searching for subprograms, if it can't find the subprograms using GCC_EXEC_PREFIX.
- LIBRARY_PATH
- The value of LIBRARY_PATH is a colon-separated list of directories, much like PATH. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it can't find them using GCC_EXEC_PREFIX. Linking using GCC also uses these directories when searching for ordinary libraries for the -l option (but directories specified with -L come first).
- LANG
-
This variable is used to pass locale information to the compiler. One way in
which this information is used is to determine the character set to be used
when character literals, string literals and comments are parsed in C and C++.
When the compiler is configured to allow multibyte characters,
the following values for LANG are recognized:
-
If LANG is not defined, or if it has some other value, then the compiler will use mblen and mbtowc as defined by the default locale to recognize and translate multibyte characters.
Some additional environments variables affect the behavior of the preprocessor.
- CPATH
- C_INCLUDE_PATH
- CPLUS_INCLUDE_PATH
- OBJC_INCLUDE_PATH
-
Each variable's value is a list of directories separated by a special
character, much like PATH, in which to look for header files.
The special character, "PATH_SEPARATOR", is target-dependent and
determined at GCC build time. For Microsoft Windows-based targets it is a
semicolon, and for almost all other targets it is a colon.
CPATH specifies a list of directories to be searched as if specified with -I, but after any paths given with -I options on the command line. This environment variable is used regardless of which language is being preprocessed.
The remaining environment variables apply only when preprocessing the particular language indicated. Each specifies a list of directories to be searched as if specified with -isystem, but after any paths given with -isystem options on the command line.
In all these variables, an empty element instructs the compiler to search its current working directory. Empty elements can appear at the beginning or end of a path. For instance, if the value of CPATH is ":/special/include", that has the same effect as -I. -I/special/include.
- DEPENDENCIES_OUTPUT
-
If this variable is set, its value specifies how to output
dependencies for Make based on the non-system header files processed
by the compiler. System header files are ignored in the dependency
output.
The value of DEPENDENCIES_OUTPUT can be just a file name, in which case the Make rules are written to that file, guessing the target name from the source file name. Or the value can have the form file target, in which case the rules are written to file file using target as the target name.
In other words, this environment variable is equivalent to combining the options -MM and -MF, with an optional -MT switch too.
- SUNPRO_DEPENDENCIES
- This variable is the same as DEPENDENCIES_OUTPUT (see above), except that system header files are not ignored, so it implies -M rather than -MM. However, the dependence on the main input file is omitted.
BUGS
For instructions on reporting bugs, see <http://bugzilla.redhat.com/bugzilla>.FOOTNOTES
- 1.
- On some systems, gcc -shared needs to build supplementary stub code for constructors to work. On multi-libbed systems, gcc -shared must select the correct support libraries to link against. Failing to supply the correct flags may lead to subtle defects. Supplying them in cases where they are not necessary is innocuous.
SEE ALSO
gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.AUTHOR
See the Info entry for gcc, or <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors to GCC.COPYRIGHT
Copyright (c) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being ``GNU General Public License'' and ``Funding Free Software'', the Front-Cover texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the gfdl(7) man page.
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- OPTIONS
-
- Option Summary
- Options Controlling the Kind of Output
- Compiling C++ Programs
- Options Controlling C Dialect
- Options Controlling C++ Dialect
- Options Controlling Objective-C and Objective-C++ Dialects
- Options to Control Diagnostic Messages Formatting
- Options to Request or Suppress Warnings
- Options for Debugging Your Program or GCC
- Options That Control Optimization
- Options Controlling the Preprocessor
- Passing Options to the Assembler
- Options for Linking
- Options for Directory Search
- Specifying Target Machine and Compiler Version
- Hardware Models and Configurations
- ARC Options
- ARM Options
- AVR Options
- Blackfin Options
- CRIS Options
- CRX Options
- Darwin Options
- DEC Alpha Options
- DEC Alpha/VMS Options
- FR30 Options
- FRV Options
- GNU/Linux Options
- H8/300 Options
- HPPA Options
- Intel 386 and AMD x86-64 Options
- i386 and x86-64 Windows Options
- IA-64 Options
- M32C Options
- M32R/D Options
- M680x0 Options
- M68hc1x Options
- MCore Options
- MIPS Options
- MMIX Options
- MN10300 Options
- PDP-11 Options
- picoChip Options
- PowerPC Options
- IBM RS/6000 and PowerPC Options
- S/390 and zSeries Options
- Score Options
- SH Options
- SPARC Options
- SPU Options
- Options for System V
- V850 Options
- VAX Options
- VxWorks Options
- x86-64 Options
- Xstormy16 Options
- Xtensa Options
- zSeries Options
- Options for Code Generation Conventions
- ENVIRONMENT
- BUGS
- FOOTNOTES
- SEE ALSO
- AUTHOR
- COPYRIGHT
This document was created by man2html, using the manual pages.
Time: 05:29:03 GMT, December 24, 2015


‘Give me my car’ — Mr Eazi shades Headies over 2016 ‘Next Rated’ award gift
by James OjoOluwatosin Ajibade, Nigerian Afrobeats singer better known as Mr Eazi, has aimed a dig at organisers of the Headies Awards for allegedly not giving him a car he won at the 2016 edition of its annual event.
The award-winning singer took to his Twitter page to express his annoyance while reacting to a post by HipTv, a media partner and major organiser of the Headies.
The post ordinarily seemed to be an appreciation of Mr Eazi’s outfit and that of Temi Otedola, his girlfriend.
“@jtofashion x @mreazi Feeling like Tony Montana and Elvira both in that new #JTOxOC collection,” HipTv wrote.
But rather than reciprocate the gesture, the singer disclosed a shocking revelation in his response.
His reaction suggests he might not have received the car he won in 2016 where he emerged the ‘Next Rated’ artiste — beating the likes of Humblesmith, Aramide, and Ycee to clinch the coveted award.
“Instead make u gimme my car u dey here dey tweet couple goals,” the singer replied.
His response has since left tongues wagging on the social media platform, with many trying to dig deep into what actually informed the singer’s response.
Established in 2006, the Headies — formerly known as Hip Hop World Awards — celebrates outstanding individuals in the Nigerian music industry over a period of time under review.
While HipTv is yet to officially respond to the tweet — as of the time this report was filed — there appears to be a video on the Yotube page of the cable television channel where Mr Eazi can be seen “receiving a car”.
Copyright 2019 TheCable. All rights reserved. This material, and other digital content on this website, may not be reproduced, published, broadcast, rewritten or redistributed in whole or in part without prior express written permission from TheCable.
Follow us on twitter @Thecablestyle


A constraint is something that describes how two bodies interact with each other. (how they constrain each other). Constraints can be simple joints that allow bodies to pivot around each other like the bones in your body, or they can be more abstract like the gear joint or motors.
This submodule contain all the constraints that are supported by pymunk.
Chipmunk has a good overview of the different constraint on youtube which works fine to showcase them in pymunk as well. http://www.youtube.com/watch?v=ZgJJZTS0aMM
Bases: object
Base class of all constraints.
You usually don’t want to create instances of this class directly, but instead use one of the specific constraints such as the PinJoint.
The first of the two bodies constrained
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
Bases: pymunk.constraint.Constraint
Like a damped spring, but works in an angular fashion
Like a damped spring, but works in an angular fashion.
| Parameters : |
|
|---|
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
How soft to make the damping of the spring.
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
The relative angle in radians that the bodies want to have
The spring constant (Young’s modulus).
Set the torque function
func(self, relative_angle) -> torque
Bases: pymunk.constraint.Constraint
A damped spring
Defined much like a slide joint.
| Parameters : |
|
|---|
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
How soft to make the damping of the spring.
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
The distance the spring wants to be.
The spring constant (Young’s modulus).
Bases: pymunk.constraint.Constraint
Keeps the angular velocity ratio of a pair of bodies constant.
Keeps the angular velocity ratio of a pair of bodies constant. ratio is always measured in absolute terms. It is currently not possible to set the ratio in relation to a third body’s angular velocity. phase is the initial angular offset of the two bodies.
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
Bases: pymunk.constraint.Constraint
Similar to a pivot joint, but one of the anchors is on a linear slide instead of being fixed.
The groove goes from groove_a to groove_b on body a, and the pivot is attached to anchr2 on body b. All coordinates are body local.
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
Bases: pymunk.constraint.Constraint
Keeps the anchor points at a set distance from one another.
a and b are the two bodies to connect, and anchr1 and anchr2 are the anchor points on those bodies.
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
Bases: pymunk.constraint.Constraint
Simply allow two objects to pivot about a single point.
a and b are the two bodies to connect, and pivot is the point in world coordinates of the pivot. Because the pivot location is given in world coordinates, you must have the bodies moved into the correct positions already. Alternatively you can specify the joint based on a pair of anchor points, but make sure you have the bodies in the right place as the joint will fix itself as soon as you start simulating the space.
That is, either create the joint with PivotJoint(a, b, pivot) or PivotJoint(a, b, anchr1, anchr2).
- a : Body
- The first of the two bodies
- b : Body
- The second of the two bodies
- args : [Vec2d] or [Vec2d,Vec2d]
- Either one pivot point, or two anchor points
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
Bases: pymunk.constraint.Constraint
Works like a socket wrench.
Works like a socket wrench. ratchet is the distance between “clicks”, phase is the initial offset to use when deciding where the ratchet angles are.
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
Bases: pymunk.constraint.Constraint
Constrains the relative rotations of two bodies.
Constrains the relative rotations of two bodies. min and max are the angular limits in radians. It is implemented so that it’s possible to for the range to be greater than a full revolution.
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
Bases: pymunk.constraint.Constraint
Keeps the relative angular velocity of a pair of bodies constant.
Keeps the relative angular velocity of a pair of bodies constant. rate is the desired relative angular velocity. You will usually want to set an force (torque) maximum for motors as otherwise they will be able to apply a nearly infinite torque to keep the bodies moving.
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity
The desired relative angular velocity
Bases: pymunk.constraint.Constraint
Like pin joints, but have a minimum and maximum distance. A chain could be modeled using this joint. It keeps the anchor points from getting to far apart, but will allow them to get closer together.
a and b are the two bodies to connect, anchr1 and anchr2 are the anchor points on those bodies, and min and max define the allowed distances of the anchor points.
The first of the two bodies constrained
Activate the bodies this constraint is attached to
The second of the two bodies constrained
The rate at which joint error is corrected.
Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
Get the last impulse applied by this constraint.
The maximum rate at which joint error is corrected. Defaults to infinity
The maximum force that the constraint can use to act on the two bodies. Defaults to infinity


How well do you know the best 5 lightweight kickboxers in the world? Do you know who is the tallest? …or the oldest? Who would you say is the scariest in terms of knock-out power? Let’s check it out!
Who are the best? This June, the lightweight kickboxing ranking by Combat Press was the following:
- Marat Grigorian
- Sitthichai Sitsongpeenong
- Superbon Banchamek
- Giorgio Petrosyan
- Chingiz Allazov
- Tayfun Ozcan
- Endy Semeleer
- Jonay Risco
- Samy Sana
- Yodsanklai Fairtex
Let’s compare the data of the top 5 fighters.
In the charts, fighters will be arranged from left to right by their ranking.
Height and Age
The tallest fighter is Allazov (5 ft 11 in), whereas the shortest is Sitthichai (5 ft 8 1⁄2 in). The top 2 ranked fighters are also the shortest.
The top 5 fighters are between 26 (Allazov) and 34 (Petrosyan) years old. Grigorian and Sitthichai are both 28 years old (but Grigorian is few months younger).
Wins and KOs
All of the top 5 kickboxers have phenomenal records, with ~75% (Superbon) to ~95% (Petrosyan and Allazov) of victories.
Petrosyan and Allazov are close to perfection with about 19 victories every 20 fights. Let’s suppose that we toss a coin 4 times and we get every single time head… Would you bet on that? Well, for those 2 fighters, the probability of not winning a fight is very close to that (actually a little bit less for Petrosyan)…we can say that is extremely unlikely!
Who is more likely to end up a fight with a KO win?
The KO machine is Allazov. He finished more than half of his fights with his opponent lying on the canvas.
Also Petrosyan and Grigorian have impressive KO power: about ~45% of their fights ending with a win by KO.
The 2 Thai fighters, Sitthichai and Superbon have the lowest percent of KOs victories but on the other hand also the highest number of fights (159 and 143, respectively).
Winning Streak
Among the 5 top kickboxer, Petrosyan has the longest winning streak (14) and has not lost or draw a fight since 2013 (against Andy Ristie).
Superbon is currently in 8 winning streak. His last defeat was in a fight against the number 1 Grigorian and came by a tremendous KO stoppage.
Grigorian, Sitthichai, Allazov, they have all recently lost a fight in bouts against each other or Petrosyan.
Summary and Table
Here some few facts about the top 5 lightweight kickboxers:
- The taller fighter is Allazov. The 2 shortest fighters, Grigorian and Sitthichai are also the top 2 in the current ranking.
- Petrosyan is the oldest fighter (34) whereas Allazov the youngest (26).
- With 95% of their fight won, Petrosyan and Allazov have the highest percentage of victories (the others are all above 75%).
- Allazov is the KO machine with more than half of his fights finished by KO. Grigorian and Petrosyan have ~45%, whereas Sitthichai and Superbon ~20% of their fights won by KO.
- Petrosyan is currently in a 14-fight winning streak.
Check the table below if you want to make more comparisons by your own! scroll to the left to see all the columns and the arrows to order them
Buonanotte e buone botte.
all the data was scraped from en.wikipedia


Themes
Hashedit was built from the ground-up to be modular. So, you can use the whole stack, just the editor, or the static website API.
Hashedit Spark
The goal of the Hashedit Spark repository is to provide you with a full stack starting point for your Hashedit website. It contains the Express JS parts and brings in the other two Hashedit repos as dependencies.
Static Kit
The goal of the Static Kit repository is to provide you with a REST API for authenticating a user via a Local or Google login and access to static resources for your website. Static Kit also provides a UI for managing pages in your site. It is specifically built around the needs of Hashedit but is generic enough that it could be used independently of the editor.
Hashedit
The Hashedit repository is the client library that implements the visual editor. It can be used in conjunction with Hashedit Spark, but you can also modify it for your own needs.
Hashedit.io
The Hashedit-io repository mirrors this site so that you can submit documentation additions or corrections via a pull request.


{short}
Is this the correct Wikipedia page for referring to ?
If nothing shows up below, please press no


With less than two weeks of twitter queries, this data set shows us important infomation concerning Hollywood Feed's locations of interest, keywords of interest, and online presence.
Below are some interesting conclusions we have made so far about our locations of interest.
Tennessee
The vast majority of tweets from Tennessee were from the Memphis area and contained the phrase Hollywood Feed. Nashville and Knoxville did not have any notable data (less than ten tweets in each metropolitan area).
Alabama
Birmingham and Huntsville returned close to 75 tweets. In Birmingham area, the top three keywords used were Hollywood Feed, @petsuppliesplus, and @chewy - each only separated by one or two tweets. Since there are two Pet Supplies Plus stores in this area, engaging with our Birmingham customers should definitely be a priority.
Mississippi
Oxford and Ridgeland(a suburb of Jackson) were the only two cities with relatively noteable data (around 25 collective tweets). Almost all of these tweets contained the phrase Hollywood Feed. Since there are five Hollywood Feed locations in Mississippi, we were slightly surprised to see such little data, but then again, we are talking about Mississippi.
Arkansas
The entire state of Arkansas only returned 11 data points. This suggests that either we did not include enough keywords in our queries or that people from Arkansas don't know how to use the internet.
Texas
Around 20 of the 100 tweets located in Dallas contained the phrase Hollywood Feed. 15 of those 20 tweets came from the suburb of McKinney. Since there are 18 stores in the greater Dallas area, we expected to see more tweets about Hollywood Feed. Austin and Houston both returned data that was surprisingly uniformly distributed across the keywords we selected. There were no keywords that stood out in either Austin or Houston.
Georgia
The city of Atlanta returned over 40 tweets, while the rest of the state returned around ten additional tweets. 25% of the Atlanta tweets contained the phrase rescue dog. This could be an indicator of a potentially good store location because Hollywood Feed customers generally love rescues.
More than anything, this data set shows us that Hollywood Feed effectively has no twitter presence compared to three of our biggest competitors. The term "Hollywood Feed" is only lagging the third ranked phrase "Petsmart" by less than 100 tweets. For a brick and mortar retailer with just over 40 stores, that is actually pretty impressive. However, the term "@hwfeed" did not rank in the top 19, and when we searched for "from:hwfeed" in our queries, we got zero results - this means that people do not tag Hollywood Feed in tweets very much and more importantly, that Hollywood Feed did not tweet at all during the two weeks we ran queries. In our opinion, there is probably a causal relationship here. If you never tweet, why would someone tag you in their tweet, right?
During the period from which we pulled data, the phrase "Hollywood Feed" was mentioned over 230 times, while "@hwfeed" was only tagged 70 times. This is definitely not good news. Every time a twitter user mentions Hollywood Feed without tagging "@hwfeed", this is a missed opportunity to connect with a potential customer. This may have not been a concern when new stores were relatively close to older, more established stores. However, now that stores are opening in new cities, engaging with new customers through twitter should absolutely be a priority.
Although Hollywood Feed doesn't have much of a presence on twitter, we did find that Hollywood Feed has a great opportunity to create genuine, shareable content online without using black hat SEO phrases. The phrases dog park, rescue dog, dog food, and dog treats were included in over 20% of the tweets with location data. People actually tweet about these things, and we know where we can find them! The only problem is that Hollywood Feed isn't a part of the conversation on twitter yet.


{% extends "_skel/skeleton.html" %} {% block "title" %}Include tag{% end %} {% block "content" %}
{\% include "foo.html" %}
The include
tag is a simple means for including one template into the current output. Useful for
pieces of common functionality and the like.
To use include
is very simple:
foo.html
{% set someHtml %}Hello World
{% end %}{{ someHtml }}
content.html
{% set someHtml %}Blah blah blah
{\% include "foo.html" %}Yada yada yada
{% end %}{{ someHtml }}
It would output the following:
{% set someHtml %}Blah blah blah
Hello World
Yada yada yada
{% end %}{{ someHtml }}
You can also pass values into the included template, like so:
foo.html
{% set someHtml %}Hello, {\{ name }}
{% end %}{{ someHtml }}
content.html
{% set someHtml %}Blah blah blah
{\% include "foo.html" name = "Dean" %}Yada yada yada
{% end %}{{ someHtml }}
It would output the following:
{% set someHtml %}Blah blah blah
Hello, Dean
Yada yada yada
{% end %}{{ someHtml }}


Please wait, we deal with your response, please wait...
All questions were answered
No duplicate input was found
You're 100% qualified.
Congratulations!
You have been qualified to get your 2 Reward tickets.
To receive there tickets, follow the steps below:
1. Share this page by clicking on the "Share" button and write
"Thank you!" in the comments field!
2. Click on "Receive the Tickets" and enter your data.
Receive the Tickets


HackCoin doesn't have many users yet. To encourage users we're offering a HackMIT answer
for a humble price of {{ price }}
.
Please donate to the following address:
{{ us['public'] }}
So Far: {{ us['donated'] }}
{% if us['donated'] >= price %}
Thanks for the donation, here is the answer as promised:{{ answer }}


first half
second half
Tour Date
Tour Date
first half
second half
first half
second half
first half
second half


FOUNTAIN TECHNOLOGIES
SKY ONE 1ST FLOOR,
OPP GOLD ADLABS,
CLOVER WATER GARDEN,
KALYANI NAGAR,
PUNE, 411006
SALARY SLIP
  NAME
{{current_employee.emp_name}}
  DATE
{{dt | date}}
  DESIGNATION
{{current_employee.emp_designation}}
  DEPARTMENT
{{current_employee.emp_department}}
  DATE OF JOINING
{{current_employee.emp_doj | date}}

EARNINGS

DEDUCTIONS
SALARY HEAD
AMOUNT ({{selectedcurrency}})
SALARY HEAD
AMOUNT ({{selectedcurrency}})
Basic
{{new_salary.salary_record_basic}}   {{selectedcurrency}}
PF Employee
{{new_salary.salary_record_pf}}   {{selectedcurrency}}
H R A
{{new_salary.salary_record_hr}}   {{selectedcurrency}}
Education Cess
{{new_salary.salary_record_edu}}   {{selectedcurrency}}
Conv. ALL
{{new_salary.salary_record_conv}}   {{selectedcurrency}}
Income Tax
{{new_salary.salary_record_incometax}}   {{selectedcurrency}}
Medical Allowance
{{new_salary.salary_record_medical}}   {{selectedcurrency}}
Professional Tax
{{new_salary.salary_record_pt}}   {{selectedcurrency}}
Personal Allowance
{{new_salary.salary_record_personal}}   {{selectedcurrency}}
Phone & Internet
{{new_salary.salary_record_phone}}   {{selectedcurrency}}
SALARY (GROSS) / PM
{{ new_salary.salary_record_gross }}   {{selectedcurrency}}
Medical (Reimb)
-
Conv (Reimb)
-
SALARY (CTC) / PM
{{new_salary.salary_record_gross}}   {{selectedcurrency}}
TOTAL DEDUCTION
{{deduction}}   {{selectedcurrency}}
Cash in Hand (PM)
{{new_salary.salary_record_gross}}   {{selectedcurrency}}
SALARY (CTC) / PA
{{cash_in_hand * 12}}   {{selectedcurrency}}


Welcome to Beacon, {{email}}. Would you like to
leave
?
List of System Reports
{{#each incidentList}}
| Title: {{title}} | Description: {{description}} |
| Severity: {{severity}} | Date: {{creationDate}} |
{{/each}}


| Table 1 |
Estimated parameters for national-level models of moderate a ... |
| Table 2 |
Estimated parameters for the area-level models of moderate a ... |
| Table 3 |
Estimated numbers of children (means, 5 th and 95 th percent ... |
| Table 4 |
Projected average income of the bottom 20%, deflated food-pr ... |


M
M
T
Email
Verification
We've sent a Verification code to
your email address
Didn't receive the code?
RESEND
CANCEL