coding style – Python import order, mixing from … import … and import … (and import … as …)

This is the mess of imports currently at the top of my file:

import argparse
from copy import deepcopy
from functools import cmp_to_key, partial
from itertools import chain
import math
from multiprocessing import Pool
import os
import re
from typing import Dict, List, Set, Tuple
import xml.etree.ElementTree as ET

from third_party import Tool

I organised them alphabetically, by package (?) name.

I think it looks extremely ugly.

What are the standard ways to organise this section?

PEP8 (which I have read) is not helpful in this case:

Imports should be grouped in the following order:

Standard library imports.
Related third party imports.
Local application/library specific imports.
You should put a blank line between each group of imports.

Show order with status complete in performance analytics woocommerce

Hi i need to display orders with status completed in performance section of analytics, any hook to do this. I want to have completed order in dispay stats and to show in performance analytics. screenshot is attached for clarification.

How can I redirect my URL to rearrange the order of subdirectories in .htaccess?

My current URL is

example.com/example/{dynamic_id}/{dynamic_name}/static/1.html

I want to redirect it to this,

example.com/{dynamic_name}/example/{dynamic_id}/static/1.html

I tried but failed.

Portugal order a new passport from the embassy

I am not a civilian but have citizenship.
What is the process and its duration?

Also which place is better to go to pick up? Lisbon or Porto?

price – how to set order total $0 if below $1 after applying discount code or wallet?

I have removed decimal point using this extension. But after applying coupon code order total is in decimal but using this extension decimal value is not showing on frontend.

In this case, If customer using his wallet for the order so he will pay only order total which is showing. So it is creating issue for decimal value which is not showing.

How can I set order total $0(Zero) if decimal value below $1(Like: $0.2, $0.5 etc.)

sql – Is deterministic SELECT possible without specifying an ORDER BY?

When we show a table with many thousands of records, we only show a small part of the total result set so as not to send too much data to the client at once. Clients can request more parts of the result set through pagination.

This is how a typical query for such a table looks:

SELECT `expression1`, `expression2` FROM table (JOINS) ORDER BY table.id LIMIT 0,100

The LIMIT clause restricts the result set so that the table does not become too big. The ORDER BY clause enforces a deterministic order.

I have noticed that these queries can become very slow when several database tables are joined and at least one of them contains a large number of rows. Leaving out the ORDER BY clause greatly improves the speed, up to 10000%. Apart from not having to sort, I assume the query optimizes by executing the LIMIT clause before the SELECT clause.

Ironically, it is not necessary that the result set is ordered by id. We just need a deterministic order to facilitate reliable pagination, for example one that follows the order of the primary key or a predetermined index.

Is there an instruction to achieve deterministic order without the ORDER BY clause?

Magento 2 Admin Page Remove Cc_savedcard_id field from payment information on sales order page?

I want to remove Cc_savedcard_id from the page.

enter image description here

What’s the best way to achieve this?

Thank you in advance!

time complexity – Examples of higher order algorithms ($mathcal{O}(n^4)$ or larger)

In most computer science cirriculums, students only get to see algorithms that run in very lower time complexities. For example these generally are

  1. Constant time $mathcal{O}(1)$: Ex sum of first $n$ numbers
  2. Logarithmic time $mathcal{O}(log n)$: Ex binary searching a sorted list
  3. Linear time $mathcal{O}(n)$: Ex Searching an unsorted list
  4. LogLinear time $mathcal{O}(nlog n)$: Ex Merge Sort
  5. Quadratic time $mathcal{O}(n^2)$: Ex Bubble/Insertion/Selection Sort
  6. (Rarely) Cubic time $mathcal{O}(n^3)$: Ex Gaussian Elimination of a Matrix

However it can be shown that
$$
mathcal{O}(1)subset mathcal{O}(log n)subset ldots subset mathcal{O}(n^3)subset mathcal{O}(n^4)subsetmathcal{O}(n^5)subsetldotssubset mathcal{O}(n^k)subsetldots
$$

so it would be expected that there would be more well known problems that are in higher order time complexity classes, such as $mathcal{O}(n^8)$.

What are some examples of algorithms that fall into these classes $mathcal{O}(n^k)$ where $kgeq 4$?

magento2 – How can I update a custom addres field from quote addres to sales order address when creating a multishipping order

I have inserted custom address fields in quote address trough fielset.xml successfully but it is not working for sales order address, it is not filling custom fields on database. This is when using multishipping process

 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:DataObject/etc/fieldset.xsd">
    <scope id="global">    
        <fieldset id="customer_address">
            
            <field name="descripcion_sucursal">
                <aspect name="to_quote_address" />
            </field>
           
        </fieldset>
        <fieldset id="sales_convert_quote_address">
            <field name="descripcion_sucursal">
                <aspect name="to_order_address" />
            </field>
            
        </fieldset>
    </scope>
</config>

magento2 – Magento 2: How to show custom customer attribute value in an order report in the admin

I am trying to create a custom order report to show some customer information along with the order details. I have created few custom attributes for Customer. The report is very similar to the default Magento report Magento/Sales/Model/ResourceModel/Report/Invoiced/Collection/Order.php. But I need to join the custom customer attributes to this report.

I have an attribute named my_custom_customer_attribute and it has got some value for a particular customer. When I generate an order report, I need to show this value along with the order number, customer name, order total and “my_custom_customer_attribute`. I am extending the above Order report. So I need a way to join the custom attribute to the Collection.

Please could someone point me in the right direction.

Thanks