Microsoft Excel – Try Sorting a Datasheet – We have two columns from two different sources. We have to align the corresponding values.

The goal is to align the values ​​in column 1 with column 2 and add additional rows in which a value is present only in one column and not in the other. However, after trying code on the Internet:

Dim LC as long
Dim Col As Long
Dim LR as long
Application.ScreenUpdating = False

& # 39; Spot last column of data
LC = Cells (1, Columns.count) .End (xlToLeft) .Column

Add a new key column to collect unique values
Cells (1, LC + 1) = "key"
For Col = 1 to LC
Range (Cells (2, Col), Cells (Rows.count, Col)). SpecialCells (xlConstants) .Copy _
Cells (Rows.count, LC + 1) .End (xlUp) .Offset (1)
Next pass

Columns (LC + 1). Advanced filter action: = xlFilterCopy, CopyToRange: = Cells (1, LC + 2), Unique: = True
Columns (LC + 2) .Sort Key1: = Cells (2, LC + 2), Order1: = xlAscending, Header: = xlYes

Fill in new table headers with formatting
Range ("A1", Cells (1, LC)). Copy cells (1, LC + 3)

& # 39; Fill in the new values ​​in the table
LR = Cells (Rows.count, LC + 2) .End (xlUp) .Row
With range (cells (2, LC + 3), cells (LR, LC + 2 + LC))
.FormulaR1C1 = "= IF (ISNUMBER (MATCH) (RC" & LC + 2 & ", C[-” & LC + 2 _
& “], 0)), RC "& LC + 2 &", "" "") "
.Value = .Value
Finish by

We encounter the following problem: The code removes duplicates and can only preserve one value. We need each value (all references are different), regardless of duplicates. Please send help

Price sorting does not work on magento 2

This is a link to a website
https://magento-202257-609939.cloudwaysapps.com/catalogsearch/result/index/?product_list_dir=asc&q=wera

I develop for my client and after a search for any product when we choose the sort option by price, it does not work.

Can any one give me a solution for this?

Expect

sorting – Randomized Quick Select – depends on the time complexity of k – the index to select

I analyzed the time complexity of random quick selections, according to n – the size of the input and k – the index of the element to select.
The time dependence of n on temporal complexity was linear, as expected, but it was based on an inverted parabola – that is, the time complexity was greatest when you tried to select the median and the weakest when you tried to select the first or last element of the array.

Is there an explanation for this?

Magento 2 Product Collection adds a table as a column for sorting

I have the requirement as follows.

The price of the products is calculated on the fly and I wish that the sorting of the prices is correct.

I have extended the block Magento Catalog Block Product ProductList

The following is the code

protected function _getProductCollection ()
{
$ sortingOrder = $ this-> getToolbarBlock () -> getCurrentOrder ();
$ sortingDirection = $ this-> getToolbarBlock () -> getCurrentDirection ();
$ collection = parent :: _ getProductCollection ();

if ($ collection! = null && $ sortingOrder == & # 39;) {
$ list = array ();
$ templist = array ();
foreach ($ collection as $ k => $ product) {
$ newPrice = $ product-> getPrice ();
$ list[] = array (& # 39; sku => $ product-> getSku (), & # 39; newprice & # 39; => $ newPrice);
}
foreach ($ list as $ v) {
$ templist[] = "SELECT {$ v['sku']} as newsku, {$ v['newprice']} as new price ";
}
$ newsql = implode (& # 39; UNION & # 39 ;, $ templist);
$ selectTwoSql = $ collection-> getSelect () -> __ toString ();

$ collection-> getSelect () -> reset ();
$ collection-> getSelect () -> union (array (
new  Zend_Db_Expr ($ selectTwoSql),
new  Zend_Db_Expr ($ newsql),
));

echo $ collection-> getSelect ();
die;
}

return $ collection;
}

In the code above, I tried to create columns in the collection.

My request o / p is as follows

SELECT `e`. *, `Cat_index`.`position` AS` cat_index_position`, `stock_status_index`..`stock_status` AS` is_salable`, `price_index`.`price`,` price_index`.`tax_class_idass_id`, `price_index` .`final_price` , IF (price_index.tier_price) IS NOT NULL, LESS (price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`,` price_index`.`min_price`, `price_index`.`max_price` , `price_index`.`tier_price` FROM catalog_product_entity` AS` `INNER JOIN` catalog_category_product_index_store1` AS` cat_index` ON cat_index.product_id = e.entity_id and cat_index.store_id_id = 1 .category_id = & # 39; 38 & # 39; INNER JOIN `cataloginventory_stock_status` AS & # 39; stock_status_index ON ON e.entity_id = stock_status_index.product_id AND stock_stild .entity_id AND price_index.website_id = 1 & # 39; AND price_index.customer_group_id = 0 I NNER JOIN & # 39; search_tmp_5cf5a6d29872b5_06618402` AS `search_result` ON e.entity_id = search_result.entity_id WHERE ((stock_status_index.stock_status = 1)) AND (e.created_in <= '1552348800') AND (e.updated_in > & # 39;) 1552348800 & # 39;) ORDER BY `price_index`.`min_price` asc,` e`.`entity_id` DESC. LIMIT 12 UNION SELECT 10304703 as newsku, 66,0000 as new price UNION SELECT 10212044 as newsku, 66,0000 as new price UNION SELECT 10212016 as newsku, 76,00 as new price UNION SELECT 10212014 as newsku, 76,0000 as new price UNION SELECT 10212013 as newsku, 76,0000 as new price UNION SELECT 10304694 as newsku, 104,0000 as new price UNION SELECT 10362088 as newsku, 90,0000 as new price UNION SELECT 10382742 as newsku as newsku, 99.0000 as new UNION SELECT price 10362089 as newsku, 90.0000 as new UNION SELECT price 10269385 as newsku, 227.0000 as new UNION SELECT price 10383265 in as newsku, 204,0000 as a new price

After running the query in phpmyadmin, I no longer receive the newsku or newprice column.

I want the collection to be sorted according to new price which is created on the fly.

Maybe I'm in the wrong direction, but these price data are not saved anywhere else, so I have no choice but to calculate it that way.

Can any one guide me please?

lightroom – Automation of the sorting process

Today, I was browsing your website to significantly reduce the time required for the crawling process in Lightroom and to find your website.

Basically, we are working on wedding images where we are doing a regular slaughter process and selecting about 60 to 70% of good bridal and groom postures, while avoiding repeating the same pictures.

Please confirm if I can achieve something like this with the help of a plugin or a technology.

Thank you.

Advanced Sorting in Google Sheets

I have a random list of students in different rooms, different genres and different categories. A dynamic solution would be useful as the list could expand and students could be added to new rooms or existing ones.

The list should be sorted so as to return 2 students per room, preferably a woman and a man, unless the room has only one sex. The list should also sort the categories and rooms available. The order is not important as long as there are 2 students per room and it alternates between genre, categories and available rooms.

Below is a screenshot of the manual sort and a link to Google Sheet to display the desired result. Any help would be greatly appreciated!

advanced alternative sorting

enter the description of the image here

magento2 – Magento 2 REST API: sorting with a custom attribute

I have created a custom product attribute Bestseller and I want to use it to sort the response of the API.

I use the following API:

V1 / products? RechercheCritères[filter_groups][0][filters][0][field]= category_id & searchCriteria[filter_groups][0][filters][0][value]= 118 & search criteria[sortOrders][0][field]= best_seller & searchCriteria[sortOrders][0][direction]= DESC

And each product has a Bestseller value of 0 or 1

Products entering the API are not sorted. I want products with value = 1 to come first, followed by products with value = 0.

No suggestion?

Minimum depth of a leaf in a tree that corresponds to a comparison-based sorting algorithm

The lower limit is for the worst case number of comparisons. Each sorting algorithm based on the comparison performs $ Omega (n log n) $ comparisons in the worst case. It means that the tree has depth $ Omega (n log n) $.

If you do not like the tree argument, here is an opponent argument that is essentially a rewording of the tree argument. We will maintain the whole $ Pi $ of all the permutations compatible with the answers up to now. When the algorithm compares $ i $ at $ j, we respond to the result that reduces $ Pi $ by at most half (one of the two answers must have this property). After $ log_2 (n! / 2) $ steps there will always be at least two permutations consistent with the responses up to now, so the algorithm has to do at least $ log_2 n! = Omega (n log n) $ comparisons on this branch.

In fact, we can reinforce this result (going back to the tree argument): each sorting algorithm based on the comparison makes $ Omega (n log n) $ comparisons on average (when the input is a random permutation of $ 1, ldots, n $). As proof, note that there may be at most $ 2 ^ k $ deep leaves $ k. In particular, the number of leaves in depth $ ( log n!) / $ 2 is at most $ sqrt {n!} $. So for at least $ n! – sqrt {n!} $ permutations, all the leaves are in depth more than $ ( log n!) / $ 2and that's why $ 1 (1) $ fraction of permutations, the algorithm will do at least $ ( log n!) / 2 = Omega (n log n) $ comparison.

Finally, let's show that it is impossible to know the correct permutation if you perform less $ n-1 $ comparison. Construct a graph whose vertices are the elements of the array, and $ (i, j) $ are connected if you compared the elements to these positions. If you do less $ n-1 $ comparisons, then the graph will not be connected. In particular, you can partition the vertex in two non-empty parts. $ A, B $ such as no element of $ A $ has been compared to any element of $ B $. In particular, there is a permutation compatible with the comparisons made in which all the elements of $ A $ are smaller than all elements of $ B $and another in which all the elements of $ A $ are larger than all elements of $ B $.

Minimum number of comparisons in sorting algorithms based on comparison

I've seen that every sorting algorithm based on the comparison has to perform at least $ log_ {2} (n!) = Omega (nlog (n)) $ comparisons on some entries (not being the size of the entrance).

Why is the minimum number of comparisons $ log_ {2} (n!) $, and how is the linked omega rating calculated?

wp query – sorting custom attributes does not work on the search page

I am using aws pro search plugin and I have sorted by custom attributes, it works fine on the product page but on the search result, it does not show the correct order; alphabetical order, I found code on the Internet, I tried to change, but it shows nothing

function custom_woocommerce_get_catalog_ordering_args ($ args) {
global $ wp_query;
// changed the $ _SESSION to $ _GET
if (isset ($ _GET['orderby'])) {
switch ($ _GET['orderby']):
case-author-asc:
$ args['order'] = & # 39; ASC & # 39 ;;
$ args['meta_key'] = & # 39; pa_auteur & # 39 ;;
$ args['orderby'] = & # 39; meta_value & # 39 ;;
Pause;
end switch;
}
return $ args;

}

function custom_woocommerce_catalog_orderby ($ sortby) {
$ triby['auteur-asc'] = & # 39; Sort by Author: A to Z & # 39 ;;
return $ sortby;

}

function wh_save_product_custom_meta ($ post_id, $ post, $ update) {
$ post_type = get_post_type ($ post_id);
// If it is not an article "product", do not update it.
if ($ post_type! = & # 39; product & # 39;)
return;

if (! empty ($ _ POST['attribute_names']) &&! empty ($ _ POST['attribute_values'])) {
$ attribute_name = $ _POST['attribute_names'];
$ attribute_value = $ _POST['attribute_values'];
foreach ($ attribute_name as $ key => $ attribute_name) {
switch ($ attribute_name) {
// for color (string)
case & # 39; pa_auteur & # 39 ;:
// it can have several colors (for example, black, brown, brown, white) but we will only take the first color.
if (! empty ($ attribute_values[$key][0])) {
update_post_meta ($ post_id, & # 39; pa_auteur & # 39 ;, $ attribute_values[$key][0])
}
Pause;
default:
Pause;
}
}
}

}
add_action (& # 39; save_post & # 39; wh_save_product_custom_meta & # 39 ;, 10, 3);