## How can create a simplified tool from this complex combination for data collection?

I am trying to create a tool on excel to collect data from different municipality to know their slum level. The values for the variables inside the first box (piped water…Bottled water) household data collected from surveys and are a percentage added up to form the Improved water(please have in mind that not all households/ area will have all the variables. e.g an area may have piped water but not public tap but a different area may have both. This will be the same for the improved sanitation, durable structure and sufficient living.

An area is considered a slum if it misses atleast one of the four main variables (improved water, improved sanitation, durable structure and sufficient living).

My calculation has been done on SPSS and thus the shelter deprevations figures. Basically, this table means that one shelter deprivation is a combination of all possible combinations with one variable missing. The same happens for two, three upto four where all are missing.

Finally all these combinations are brought together to get a non-slum area which is the value 44.5 in the yellow box. Taking from 100 we get 55.5% which is the slum percentage.

I am trying to see how best I can do the shelter deprivation part with excel to make a tool. The part in red shows what I got from multiplying the average (72.8) by the shelter deprivation values from spss. I got the value 54.10% as my slum which is not far off the real figure 55.5%.

Anyone know how I can tackle this. Below is the link with the image of my calculations

## Programmatically add field collection item (child) into a existing field collection item (parent)

I have a nested field collection item, `field_collection_parent` which contains one field_text and a field collection `field_collection_child` contains two text fields(`field_a` and `field_b`).

Now I’m trying to add more `field_collection_child` into an existing `field_collection_parent` (using its `entity_id`) but the new `field_collection_child` is not getting created.

Below are my codes:

``\$  entityId = 331  \$  field_collection_1 = entity_load('field_collection_item', array(\$  remId));  \$  field_collection_2 = entity_create('field_collection_item', array('field_name' => 'field_collection_child')); \$  field_collection_2->setHostEntity('field_collection_parent', \$  field_collection_1); \$  field_collection_2->field_a['und'][0]['value'] = 'http://www.google.com'; \$  field_collection_2->field_b['und'][0]['value'] = 'http://www.google.com'; \$  field_collection_2->save(); ``

Even I’ve tried https://www.drupal.org/node/2382811, but no luck.

## Magento 2 – How get extension attributes from product collection

I need to get the product collection with all extension attributes, specifically I need then to get the stockItem object with `\$ product->getExtensionAttributes()->getStockItem()`. So I have created a function like this:

``protected function getCollection(ProductInterface \$  product): Collection {     \$  collection = \$  this->productCollectionFactory->create();      \$  collection         ->addAttributeToSelect('*')         ->addAttributeToFilter('visibility', ['eq' => Visibility::VISIBILITY_BOTH])         ->addAttributeToFilter('status', ['eq' => Status::STATUS_ENABLED])         ->addFieldToFilter('entity_id', ['neq' => \$  product->getId()])         ->setPageSize(5);      return \$  collection; } ``

then I get all items from collection with `\$ collection->getItems()`, but in the loop of `getItems()` the extension attributes are `null`, why and how can I get them?

``protected function populateProductList(Collection \$  collection) {     \$  items = \$  collection->getItems();      \$  products = array_map(function (\$  product): ProductInterface {         \$  stockItem = \$  product->getExtensionAttributes()->getStockItem();         var_dump(\$  stockItem);die; // IS NULL          return \$  product;     }, \$  items);      return \$  products; } ``

If I get a Product from the get method of productRepository, that product has all extension attributes compiled, I don’t want to use productRepository to get another time the products for “only” the extension attributes, I want to avoid another call for performance reasons.

## Properties of the collection of maximal independent sets of a graph

Let $$G$$ be a graph and define

$$\mathscr{I}(G) = \{S \subset V(G)| S$$ is a maximal indepedent set of $$G\}$$

1. What is known about $$\mathscr{I}(G)$$?

2. What are some of the properties of $$\mathscr{I}(G)$$?

3. How does $$\mathscr{I}(G)$$ relates to other properties of $$G$$ for example chromatic number?

4. Is it possible to decide if a collection $$\mathscr{A}$$ is equal to $$\mathscr{I}(H)$$ for some graph $$H$$?

## Empty Collection :: CollectionFactory Approach and getCollection approach both give empty result

I have created a table in my database using db_schema.xml and then populated that table with sql insert commands directly in mysql workbench.

My model code is

``<?php  namespace Lmap\StarTrackShipping\Model;  use Magento\Framework\Model\AbstractModel;    class StarTrackRates extends AbstractModel {     protected \$  _eventPrefix = 'startrack_rates_event';      protected function _construct()     {          \$  this->_init(\Lmap\StarTrackShipping\Model\ResourceModel\StarTrackRates::class);      } } ``

ReosurceModel codes is

``<?php namespace Lmap\StarTrackShipping\Model\ResourceModel;  use Magento\Framework\Model\ResourceModel\Db\AbstractDb;  class StarTrackRates extends AbstractDb {     protected function _construct()     {         \$  this->_init('lmap_shipping_tablerate', 'id');     }  } ``

The collection Class is

``<?php  namespace Lmap\StartrackShipping\Model\ResourceModel\StarTrackRates;  use Lmap\StarTrackShipping\Model\StarTrackRates; use Lmap\StarTrackShipping\Model\ResourceModel\StarTrackRates as StarTrackRatesResource; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;  /**  * Start Track Shipping table rates collection  */ class Collection extends AbstractCollection {      protected \$  _idFieldName = 'id';      protected function _construct()     {         \$  this->_init(StarTrackRates ::class, StarTrackRatesResource::class);      }  } ``

My Helper Method to retrieve row from the table

``<?php  namespace Lmap\StarTrackShipping\Helper;  use Lmap\StarTrackShipping\Model\ResourceModel\StarTrackRates\CollectionFactory; use Lmap\StarTrackShipping\Model\StarTrackRatesFactory; use Lmap\StarTrackShipping\Model\StarTrackRates; use Psr\Log\LoggerInterface;  Class FetchShippingRate {      private \$  stRatesCollectionFactory;     private \$  stRatesFactory;     private \$  stRates;       /**      * @var \Psr\Log\LoggerInterface      */     private \$  logger;      /**      * @param \Psr\Log\LoggerInterface \$  logger      * This construct with double underscore is required to initialize other classes as LoggerInterface, CollectionFactory etc      * This concept is taken from Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate.php;      */     public function __construct(LoggerInterface \$  logger,CollectionFactory \$  CollectionFactory,StarTrackRatesFactory \$  StarTrackRatesFactory,StarTrackRates \$  StarTrackRates)     {         \$  this->logger = \$  logger;         \$  this->stRatesCollectionFactory = \$  CollectionFactory;         \$  this->stRatesFactory = \$  StarTrackRatesFactory;         \$  this->stRates = \$  StarTrackRates;      }      public function fetchRate()     {         \$  var =2600;         \$  postcode_rate_row = \$  this->stRatesCollectionFactory->create()->getItemsByColumnValue('postcode', '2600');         \$  collection = \$  this->stRatesFactory->create()->getCollection();         \$  collection->addFieldToSelect('*')->addFieldToFilter('postcode',array('eq'=>'2600'));          foreach (\$  collection as \$  rate){             \$  this->logger->debug('Rate is:');             \$  this->logger->debug(var_dump(\$  collection));             \$  this->logger->debug(var_dump(\$  rate->toarray(),'\$  rate'));         }           \$  this->logger->debug('Rates are: '.var_dump(\$  postcode_rate_row));         return \$  postcode_rate_row;      } ``

Invoking fetchRate() method gives an empty array. I have used both approaches of using collectionFactory and using modelFactory method getCollection() but to no avail and I get empty array. Here is the screen shot of the row I’m trying to retrieve. Please help this thing is bugging me for four days now and I’m not able to find some solid solution.

## Limit of unique permissions per site collection

How many items/documents/folders with unique permissions can you have per site collection?

I am aware of the boundaries of 5,000 scopes per list/library and 5,000 members per scope.

I assume it is acceptable to use a SharePoint site as a container for each 5,000 items/document with unique permissions (as Issue 2 in this article indicates: https://technet.microsoft.com/en-us/library/dn169566.aspx). Now, 250,000 sites are supported per site-collection – does this mean you can build structures that support 5,000 x 250,000 items/documents/folders with unique permissions?

## Magento 2 get Product Collection creates issue on preparecollection

I am using Magento 2.2.7. On custom product grid `_prepareCollection()` I tried to get all product collection by

``\$  collection = \$  this->_productFactory->create()->getCollection(); ``

but it gets only enabled product. If I get `count(\$ collection->getData())` it shows all product count. but If I tried with `\$ collection->count()` it get only enable product count. How I get all products(both enable & disable) in grid through `\$ this->setCollection(\$ collection);`

## Javascript to read site collection storage volume

It is possible to read the storage Volume of a site collection with JavaScript?

## Is it safe/supported operation to remove the Office 365 admin from being our root site collection administrator

Inside our office 365 tenant, our employees who work as exchnage admins or sharepoint admins have access to the Office 365 username/password `admin@ourtenant.com`. and when we got our root site collection, the Office 365 admin username is already defined as a site collection admin. so now using the Office 365 admin username, i have remove himself from the site collection admin group and i added my username (i am the sharepoint admin employee):-

``/**  * @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory  */ protected \$  productCollectionFactory;  public function __construct(     .....     \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory \$  productCollectionFactory     ..... ) {     .....     \$  this->productCollectionFactory = \$  productCollectionFactory;     ..... }   publi function yourfunction() {     \$  catalog_ids = ['14', '61', '62', '63'];     \$  productCollection = \$  this->productCollectionFactory->create();     \$  productCollection->addCategoryIds()->addCategoriesFilter(['in' => \$  catalog_ids])->addAttributeToSelect('*');     \$  productCollection->addAttributeToFilter('size_mm', ['eq' => 2650]);     \$  productCollection->setOrder('size_mm', 'DESC');     \$  productCollection->setOrder('entity_id', 'ASC');     return \$  productCollection; } ``