## Drupal 8 Migration YAML files NOT Executing in Dependency Order

My Drupal migration yaml files are not being imported in the correct execution order.

I have 8 migration files, most that depend on another file being executed first. I’m
using a Google Spreadsheet as the source, and targeting Drupal 8.9+. I have tagged all my dependencies, and all was going well with my test imports (`using drush migrate:import --tag="Rooster Business"`) and the corresponding rollback commands. But at some point, after adding a few fields, the migrations began to fail because they were being executed out of order (particularly my business_locations and business_offers migrations).

Here’s the exact error:

``````(error)  Migration rooster_node_business_offers did not meet the requirements.
``````

The new fields themselves don’t fail, so it’s not that (I wouldn’t think). I think I have correctly set up the dependencies in all the files, but they are NOT being respected (at least not completely).

I have tried the following:

• Alphabetizing all the migration id’s and filenames (to order them by desired import execution order).
• Dropping all migration tables from the database and doing full cache refresh
• Changing the last file I want executed (`rooster_node_business_offers`) to use “optional” dependencies instead of “required.” (This causes the failure to go away, but then some of the desired field values are missing from the migration).
• Uninstalling and reinstalling the entire custom migration module.
• I’ve tried just migrating the “last” migration with `drush migrate:import rooster_node_business_offers --execute-dependencies` command which should in theory execute all the files in order as they all depend in a chain on each other. No dice. I get the same error: `(error) Migration rooster_node_business_offers did not meet the requirements...`

None of these attempts have solved the problem. I have a theory that it has something to do with the fields names of the sources (because I think I may have changed a few of them, and have definitely added quite a few). But that still doesn’t account for why the migrations are not respecting the dependency order.

Bottom line: I have two questions:

1. Why are the last two migration files (rooster_node_business_location & rooster_node_business_offers) not being executed in order by dependency (and how can I fix this)?
2. If that is not an easy to answer question, what is the logic of the “default” ordering, and how can I game that logic so I can still get my migration files to execute in the desired order?

Here is the order I’d LIKE to have the migrations to execute in:

``````rooster_file_bg_photo
rooster_file_logo
rooster_users
rooster_file_logo_to_media
rooster_file_bg_photo_to_media
``````

And here is the order that they are actually being migrated in (same as the order displayed after entering the `drush ms` command:

``````  Rooster (Rooster)   rooster_file_bg_photo            Idle
Rooster (Rooster)   rooster_file_logo                Idle
Rooster (Rooster)   rooster_users                    Idle
Rooster (Rooster)   rooster_file_logo_to_media       Idle
Rooster (Rooster)   rooster_file_bg_photo_to_media   Idle
Rooster (Rooster)   rooster_node_parent_business     Idle
Rooster (Rooster)   rooster_node_business_offers     Idle
Rooster (Rooster)   rooster_node_business_location   Idle
``````

I’ve made a repository of my exact migration files (and I’ve only redacted the Google Spreadsheet URLs). Here are all the migration files on Github.

## sums of squares – estimate for Mobius function of order k

Let $$mu_{k}(n)$$ be the MOBIUS function of order $$k$$, defined by
$$mu_{k}(n)= begin{cases} 1 quad if quad n=1\ 0 quad if quad p^{k+1}|n \ (-1)^r quad if n = p^k_1· · · p^k_rprod_{i>r} p_i^{α_i}, 0

Under this definition, what is $$sum_{nleq x}mu_k(n)^2.$$

## SharePoint 2019 ON PREMISE – Cant order news items

I have an ON PREMISE installation with a modern experience Communication Site as the root. I am unable to sort news items. When I go to the Manage Posts location and make any change it is not reflected in the news webpart which is sitting on the root communication page.

Is there a way to sort these items in the order I would choose – not order by date or author. They need to be sorted by relevance to our communication.

## Diagonalize matrix but keep the order of basis

I have a unitary matrix $$U$$ `UMatrix`. It looks like

``````{{0.822075, 0.548446, -0.113679 + 0.102357 I,
0}, {-0.353904 + 0.0562876 I, 0.665882 + 0.0375522 I, 0.65328,
0}, {0.437829 + 0.063889 I, -0.502575 + 0.0426234 I, 0.741502,
0}, {0. + 0. I, 0. + 0. I, 0., 1}}
``````

I also have a matrix $$M$$`massMatrix`. It looks like

``````{{0, 0, 0, 0}, {0, 0.0000754, 0, 0}, {0, 0, 0.00244, 0}, {0, 0, 0,
0}}
``````

Now if I do $$U M U^dagger$$. I should be able to be able to diagonalize $$U M U^dagger$$ and get back $$U$$ (or $$U^dagger$$).

However, I found `JordanDecomposition(UMatrix .massMatrix.ConjugateTranspose(UMatrix))((1))` as

``````{{0.0314079 + 0.821475 I, 0. + 0. I, -0.529795 + 0.141809 I,
0.152284 - 0.0144812 I}, {-0.0697676 - 0.351495 I,
0. + 0. I, -0.652948 + 0.135899 I, -0.524682 -
0.389208 I}, {-0.0471148 + 0.43995 I, 0. + 0. I,
0.474463 - 0.171123 I, -0.595539 - 0.441768 I}, {0. + 0. I,
1. + 0. I, 0. + 0. I, 0. + 0. I}}
``````

and `Transpose(Eigensystem(UMatrix .massMatrix.ConjugateTranspose(UMatrix)((2)))` is

``````{{-0.113679 + 0.102357 I, 0.547576 - 0.0308803 I, 0.822075 + 0. I,
0. + 0. I}, {0.65328 + 1.28954*10^-16 I,
0.66694 + 0. I, -0.353904 + 0.0562876 I,
0. + 0. I}, {0.741502 + 0. I, -0.499377 + 0.0708533 I,
0.437829 + 0.063889 I, 0. + 0. I}, {0. + 0. I, 0. + 0. I, 0. + 0. I,
1. + 0. I}}
``````

Looks like `JordanDecomposition` does not really give what I want (but I don’t know why), but `Eigensystem` do. The problem is the order of basis is different. We see each column the order is correct but each row is not. This is expected as there is no way for mathematica to know the order of eigenvlaue I want. Is there is a way to tell Mathematica which order I want? Later I will do a perturbation on $$U M U^dagger$$ I also need to fix the order for that.

## magento2 – Properly add new columns to sales order grid in Magento 2

I created a module to add 2 columns in sales grid, shipping_information and tracking number.
The columns appears but when I tried to filter by Order ID in admin order page, example with 973, I got this error

``````main.CRITICAL: Item (MagentoFrameworkViewElementUiComponentDataProviderDocumentInterceptor) with the same ID "6245" already exists. {"exception":"(object) (Exception(code: 0): Item (Magento\Framework\View\Element\UiComponent\DataProvider\Document\Interceptor) with the same ID "6245" already exists. at /home/xxxx/public_html/vendor/magento/framework/Data/Collection.php:404)"}
``````

Also this error

``````Integrity constraint violation: 1052 Column 'created_at' in order clause is ambiguous
``````

But when I tried with another ID, the error disappear

In Vendor/Module/Model/ResourceModel/Order/Grid/Collection.php

``````namespace WetagAdditionalOrderFieldsModelResourceModelOrderGrid;

use MagentoFrameworkDataCollectionDbFetchStrategyInterface as FetchStrategy;
use MagentoFrameworkDataCollectionEntityFactoryInterface as EntityFactory;
use MagentoFrameworkEventManagerInterface as EventManager;
use MagentoSalesModelResourceModelOrderGridCollection as OriginalCollection;
use PsrLogLoggerInterface as Logger;

/**
* Order grid extended collection
*/
class Collection extends OriginalCollection
{
protected \$helper;

public function __construct(
EntityFactory \$entityFactory,
Logger \$logger,
FetchStrategy \$fetchStrategy,
EventManager \$eventManager,
\$mainTable = 'sales_order_grid',
\$resourceModel = MagentoSalesModelResourceModelOrder::class
)
{
parent::__construct(\$entityFactory, \$logger, \$fetchStrategy, \$eventManager, \$mainTable, \$resourceModel);
}

protected function _renderFiltersBefore()
{
\$joinTable = \$this->getTable('sales_order');
\$joinTable_track = \$this->getTable('sales_shipment_track');

\$this->getSelect()->joinLeft(\$joinTable, 'main_table.entity_id = sales_order.entity_id', ('shipping_information'))->distinct();
\$this->getSelect()->joinLeft(\$joinTable_track, 'sales_order.entity_id = sales_shipment_track.order_id', ('track_number'))->distinct();
parent::_renderFiltersBefore();
}
protected function _initSelect()  {

parent::_initSelect();

return \$this;

}
}
``````

In Vendor/Module/etc/di.xml

``````<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="sales_order_grid_data_source" xsi:type="string">VendorModuleModelResourceModelOrderGridCollection</item>
</argument>
</arguments>
</type>
<type name="VendorModuleModelResourceModelOrderGridCollection">
<arguments>
<argument name="mainTable" xsi:type="string">sales_order_grid</argument>
<argument name="resourceModel" xsi:type="string">MagentoSalesModelResourceModelOrder</argument>
</arguments>
</type>
</config>
``````

In etc/module.xml

``````<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Vendor_Module" setup_version="1.0.0">
<sequence>
<module name="Magento_sales" />
</sequence>
</module>
</config>
``````

``````<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="sales_order_columns">

<column name="shipping_information">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Shipping method</item>
</item>
</argument>
</column>
<column name="track_number">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Tracking number</item>
</item>
</argument>
</column>
</columns>
</listing>
``````

I like to use the field shipping_information in order_sales_grid table, I didn’t get it without making a left join, I like to select this field without join

## magento2 – Cannot update order state and status programatically

This is my first attempt:

``````\$orderId = 57;

\$objectManager = MagentoFrameworkAppObjectManager::getInstance();
\$order->setState(MagentoSalesModelOrder::STATE_PROCESSING, true);
\$order->setStatus(MagentoSalesModelOrder::STATE_PROCESSING);
var_dump(\$order->getStatus()); // here i can see that it is processing
\$order->save(); // if i put this in a try and catch, no exception is thrown
``````

another attempt:

``````//using OrderRepositoryInterface
\$order = \$this->orderRepositoryInterface->get(57);
\$order->setState('processing')->setStatus('processing');
\$this->orderRepositoryInterface->save(\$order); // if i put this in a try and catch, no exception is thrown
``````

Are they other approaches to try to change the order state and status ? Or am i doing something wrong with my attempts? since they are not working 🙁

Thank you

## javascript – how to reorder arrays in a particular order -using jquery/js

I have an array like this below:-

Code below

``````var animal= ("Tiger","Cat","Elephant");

//order array not being used below but thinking of maybe i could use it to order the arrays above
var order =("1","2","3");
\$.each(animal, function (key, items) {

if (items !== null) {

//i can get keys here ..0,1,2,3
console.log(key);
//i can get item values here ..Tiger, Cat Elephant
console.log(items);

//appending it to a h2 element here but i would like it to go in a particular order(Not asc or desc)
// I want Elephant to be first and then Tiger and then Cat..
//In this order Elephant,Tiger and then Cat

\$('#contacts').prepend(\$('<h2 class="disabled" id="tabheader">' + items + '</h2>'));

//}

}
}
``````

What i want to achieve is :-
append it to a h2 element as above but i would like it to go in a particular order(Not asc or desc)
I want Elephant to be first and then Tiger and then Cat..
In this order Elephant,Tiger and then Cat etc..

Any ideas how this can be achieved?

## azure – Service bus and strict message order – how can I handle failed messages?

I am considering using `Azure Service Bus`, however my question applies to queues in general.

I have a requirement to send messages in a certain order. Say that the publisher sends a message to the queue, and the subscriber receives the message, but it fails to process the message for some reason (e.g. some business rule is broken or the subscriber calls a downstream service that is down.) In that case, I cannot send subsequent messages because it would be out of order and the downstream service will return an error.

So in other words, if the subscriber fails to process message 2, I must not send message 3.

My question is – what sort of pattern can I implement to address this scenario?

## bitcoind – How do I open bx-linux-x64-qrcode via the command line on Ubuntu 20.0 in order to get access to the BX command tool

I have tried for three days now to get access to the BX commands, via the libbitcoin-explorer library. I have gone through various tutorials and have tried the install process and i do have a build-boost file where its supposed to be. While it appears that everything has worked, I still cannot use the bx command tools.

I then tried to download the simple executable file from https://github.com/libbitcoin/libbitcoin-explorer/wiki/Download-BX but I have no idea how to open the file. It is bx-linux-x64-qrcode. My system cant open it via the files app or ubuntu software and I cant figure out how to interact with this file via the command line either.

## Evaluation order of `If` and `Sum`

Where in the manual are the specifications for the order of evaluation that produce the following result?

``````Sum(If(OddQ(n), 1, 0)/n!, {n, 0, ∞})
(*0*)
``````

Original question

Can you confirm the following is a bug?

``````Sum(If(OddQ(n), 1, 0)/n!, {n, 0, ∞})
(*0*)
``````

Adding up positive numbers should not result in zero! The answer should be

``````1/2 (E - 1/E)
``````

I have MMA "11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"

Is `Sum` reliable?