Does site title have to be in order?

Hi All,

I have recently noticed that site title of my website is placed at front in google queries though
Yoast plugin says it has the last place.

My question is will this impact seo ranking going forward? Is there any chance to have it at the end?

Many thanks,

P.S. Can’t post screenshots so posted links to them

Are there systems or safeguards in place to prevent charges with no corresponding order?

Are there systems or safeguards in place to prevent charges with no corresponding order?

I tried placing an online order while using a gift card and received an error message.

I then tried to place the order again and noticed all the money missing off the gift card. I was told by the company that if I had not called in and informed then, they would have taken my money and never returned it. However they acted like it was the standard way that all businesses work however I have never had…

Are there systems or safeguards in place to prevent charges with no corresponding order?

Finding cyclic group $\mathbb{Z}^*_n$ of prime order

It can be proven that multiplicative group of integers modulo N defined as

$ \mathbb{Z}^*_N = \{ i∈Z : 1≤i≤N−1\; AND\; gcd(i,N)=1 \} $

is cyclic for a prime N and that if it is of prime order, then every non-identity element in the group is a generator of this group.

How can I find such N?

I wrote a simple program and brute-forced for i $ \mathbb ∈\; [1, 300 000]$ and found no group of prime order so far.

How to add a “pay later” option to the order fulfillment states in Commerce 2?

I have a checkout flow with two payment gateways, Credit Card (Stripe) and Pay Later (Manual Gateway).

The Stripe checkout flow works fine.

I overrode the fulfillment flow in mymodule.workflow.yml:

order_fulfillment:  id: order_fulfillment  group: commerce_order  label: 'Fulfillment'  states:    draft:      label: Draft    awaitingpayment:      label: Pay Later (Furikomi)    fulfillment:      label: Fulfillment    completed:      label: Completed    canceled:      label: Canceled  transitions:    place:      label: 'Place order'      from: [draft, awaitingpayment]      to:   fulfillment    paylater:      label: 'Pay later'      from: [draft]      to:   awaitingpayment    fulfill:      label: 'Fulfill order'      from: [fulfillment]      to: completed    cancel:      label: 'Cancel order'      from: [draft, fulfillment]      to:   canceled 

Now, when the payment method is “Pay Later”, I am trying to execute the “paylater” transition so that the order does not get marked as ready for fulfillment.

In my event subscriber, I have this:

  public function onPlaceTransition(WorkflowTransitionEvent $  event) {     $  order = $  event->getEntity();      $  order_type = $  order->bundle();      $  payment_method = NULL;     $  payment_gateway = NULL;     if (!$  order->get('payment_method')->isEmpty()) {       $  payment_method = $  order->get('payment_method')->first()->entity->id();     }     if (!$  order->get('payment_gateway')->isEmpty()) {       $  payment_gateway = $  order->get('payment_gateway')->first()->entity->label();     }      if ($  order_type === 'ABC') {       //       if ($  payment_gateway === "Pay Later") {         //         // Set order status to "payment pending"         $  order_state = $  order->getState();         // Get the allowed transitions for the current state.         $  transitions = $  order_state->getTransitions();         $  order_state->applyTransition($  transitions['paylater']);         $  order->save(); 

However, this gives an error:

The website encountered an unexpected error. Please try again later. TypeError: Argument 1 passed to Drupal\state_machine\Plugin\Field\FieldType\StateItem::applyTransition() must be an instance of Drupal\state_machine\Plugin\Workflow\WorkflowTransition, null given, called in

I think the problem may be that I am trying to execute one state transition (paylater) inside the “onPlace” transition. Where can I modify the checkout flow so that I can move any order that chooses the “Pay Later” payment method to go through the “paylater” transition?

Multi column order by kills postgresql performance, any way to fix?

I have a really simple query I’m running on a large table (500k rows) to page results.

Originally I was using this query, which is really fast:

 select * from deck      order by         deck.sas_rating desc         limit 10 

Its explain analyze estimates a 0.2 ms execution time. Cool.

But the sas_rating column has duplicate integer values, and I realized when paging through the results (using offset for other pages) that I was getting duplicate results. No problem, add the primary key as a secondary order by. But the performance is terrible.

 select * from deck      order by         deck.sas_rating desc, asc          limit 10 

That takes 685ms with an explain analyze of:

Limit  (cost=164593.15..164593.17 rows=10 width=1496) (actual time=685.138..685.139 rows=10 loops=1)   ->  Sort  (cost=164593.15..165866.51 rows=509343 width=1496) (actual time=685.137..685.137 rows=10 loops=1)         Sort Key: sas_rating DESC, id         Sort Method: top-N heapsort  Memory: 59kB         ->  Seq Scan on deck  (cost=0.00..153586.43 rows=509343 width=1496) (actual time=0.009..593.444 rows=509355 loops=1) Planning time: 0.143 ms Execution time: 685.171 ms 

It’s even worse on my weaker production server. My search went from 125ms total to 35 seconds!

I tried adding a multi-column index, but that didn’t improve performance. Is there any way to prevent duplicate results when using limit + offset without destroying the performance of the query?

Linking webform submission with Commerce 2 order

I’m trying to implement a way for people to register and pay for an event on a D8 site. I am using Commerce 2 and the Commerce Webform Order module and have a webform set up that collects information and then redirects to the checkout page.

What I need to make this fully functional is a way to link the webform submission with the Commerce order so that a report can be generated showing registration data with payment data. I haven’t been able to find any location where that information is associated.

Order in quaternion algebra for Fuchsian group

It may be that I am missing something very simple. In S. Katok’s book “Fuchsian Groups”, Lemma 5.3.3, we have the following.

Lemma: Let $ \Gamma$ be a Fuchsian group of finite covolume, $ k_0=\mathbb{Q}(\mathrm{tr}(\Gamma))$ . Assume that $ [k_0:\mathbb{Q}]<\infty$ and $ \mathrm{tr}(\Gamma)\subset \mathcal{O}_{k_0}$ (the ring of integers of $ k_0$ ). Then, $ $ \mathcal{O}_{k_0}[\Gamma]=\left\{\sum_i a_i \gamma_i\,:\, a_i\in\mathcal{O}_{k_0},\,\gamma_0\in\Gamma\right\}$ $ is an order of the quaternion algebra $ $ k_0[\Gamma]=\left\{\sum_i a_i\gamma_i\,:\, a_i\in k_0,\,\gamma_0\in\Gamma\right\}. $ $

In the proof, we have the following argument.

We may assume that $ \gamma_0=\begin{pmatrix}\lambda\&\lambda^{-1}\end{pmatrix}$ , $ \lambda\neq 1$ and $ \Gamma\subseteq \mathrm{PSL}(2,K_0)$ where $ K_0=k_0(\lambda)$ . If $ \gamma=\begin{pmatrix}a&b\c&d\end{pmatrix}\in\mathcal{O}_{k_0}[\Gamma]$ , then $ a+d$ and $ \lambda a+\lambda^{-1}d$ are in $ \mathcal{O}_{k_0}$ . Notice that $ \lambda$ and $ \lambda^{-1}$ are units in $ K_0$ and $ \mathcal{O}_{k_0}$ is a subring of the ring of integers of $ K_0$ , so $ a$ and $ d$ are in the fractional ideal $ \frac{1}{\lambda^2-1} \mathcal{O}_{k_0}$ of $ K_0$ .

I don’t understand why $ a$ is in that fractional ideal. It seemed to me that $ $ (\lambda^2-1)a=\lambda(\lambda a+\lambda^{-1}d)-(a+d)\in (\lambda-1)\mathcal{O}_{k_0}-\mathcal{O}_{k_0}. $ $ But I don’t see why that should lie in $ \mathcal{O}_{k_0}$ . Also, why is that ideal fractional? Wouldn’t that imply that $ (\lambda^2-1)\in \mathcal{O}_{k_0}$ ?

On the author’s website, there is a mention of this Lemma in the errata: but it just says: “The end of the proof of Lemma 5.3.3 was modified according to M.Katz’s suggestion.”

Thanks for any clarification!

Python 2: Most efficient way to find spatial order from a list of tuples

I have a circle-growth algorithm (line-growth with closed links) where new points are added between existing points at each iteration.

The linkage information of each point is stored as a tuple in a list. That list is updated iteratively.

enter image description here


  • What would be the most efficient way to return the spatial order of these points as a list ?

  • Do I need to compute the whole order at each iteration or is there a way to cumulatively insert the new points in a orderly manner into that list ?

enter image description here

All I could come up with is the following:

tuples = [(1, 4), (2, 5), (3, 6), (1, 6), (0, 7), (3, 7), (0, 8), (2, 8), (5, 9), (4, 9)]  starting_tuple = [e for e in tuples if e[0] == 0][0] ## note: 'starting_tuple' could be either (0, 7) or (0, 8), starting direction doesn't matter  order = [starting_tuple[0], starting_tuple[1]] ## order will always start from point 0  idx = tuples.index(starting_tuple) ## index of the starting tuple   def findNext():     global idx     for i, e in enumerate(tuples):         if order[-1] in e and i != idx:             ind = e.index(order[-1])             c = 0 if ind == 1 else 1             order.append(e[c])             idx = tuples.index(e)   for i in range(len(tuples)/2):     findNext()  print order 

It is working but it is neither elegant (non pythonic) nor efficient. It seems to me that a recursive algorithm may be more suitable but unfortunately I don’t know how to implement such solution.

Also, please note that I’m using Python 2 and can only have access to full python packages (no numpy).

This question has also been posted on SO.