How to display categories in menu in the same order as in admin category tree?

I wonder if there way to have same sort order of categories in frontend menu as in admin panel category tree.

enter image description here

I thought position attribute should be used for this goal, but I’ve found that categories from level 3 and deeper have same position value as a parent, number on the screenshot is a position value

enter image description here

variable outputs and errors from NIntegrate with same values

I’m using NIntegrate to perform numerous integrations with the value L. L is utilized in multiple functions, all of which are called by NIntegrate to run.

b = 100;  diffusivity = 8.3*10^4; a = 1; L = 10000; kbT = 1.38*10^(-23)*300;  eps = 23.5; sig = 1.3 (*nm *)  Ra[R_] := Sqrt[(R - a)^2 + a^2 - 2 a (R - a)]  greenGaussian[R_] := ((2*Pi*L*b^2)/3)^(-3/2)*Exp[-3 R^2/(2 L b^2)];  \[Beta]FBind[R_] := (-2*eps/kbT)/(1 + Exp[Ra[R]/sig])  \[Beta]FConf[R_] := -Log[R^2*greenGaussian[R]]  \[Beta]FTotal[R_] := \[Beta]FConf[R] + \[Beta]FBind[R] 

The problem arises when I try and take the following numerical integral with NIntegrate:

QLooped = NIntegrate[Exp[-\[Beta]FTotal[R]], {R, 2, 150}]    tauLooped = NIntegrate[   Exp[-\[Beta]FTotal[R] + \[Beta]FTotal[R1]  - \[Beta]FTotal[R2]],   {R, 2, 150},   {R1, R, 150},   {R2, 2, 150}   ] 

Originally, I was getting NIntegrate to yield values for L=10000, and then it stopped working, giving me errors:

NIntegrate::inumri: The integrand (3  Sqrt[3/2]  E^(1.13527*10^22/(1+E^Times[<<2>>])-(3  R^2)/200000000) R^2)/(2000000000000 \ .  [Pi]^(3/2)) has evaluated to Overflow,  Indeterminate, or Infinity for all sampling  points in the region with boundaries  {{2,20.5}}. 

Another one was an error with Catch and Throw.

Another one was that the convergence was too slow.

I’ve searched the errors I’ve gotten, and have been unsuccessful with other people’s attempts.

The weird part is that I’m getting convergence for the unlooped function, not the tauLooped function.

QUnlooped = NIntegrate[Exp[-\  [Beta]FTotal[R]], {R, 150, L}]    tauUnlooped = (1/(diffusivity*QUnlooped))  NIntegrate[    Exp[-\[Beta]FTotal[R] + \     [Beta]FTotal[R1] - \[Beta]FTotal[R2]],    {R, 150, L},    {R1, 150, R},    {R2, R1, L}    ] 

I’ve tried changing the bounds of integration for tauLooped (e.g. 50 to 150), but the results that I get are pure nonsense (massive orders of magnitude 10^(454337)

I’m unable to rationally diagnose this problem based on the ranging errors I’m getting.

I want to vary L from Table[x,{x,10000,100000,10000}] and then evaluate TLooped and TUnlooped.

What happens if two pages have the same WebPartId ?

I have to programatically create new Sharepoint pages (~50). To do so, I’ve created a template page and I simply copy the information I want inside this template using a macro made in Visual Studio. Then I copy all the files to the library with SharePoint Designer. The template was create with the Sharepoint Icon (new document) and copied to my hard drive.

However, I noticed that it has a HTML field “WebParID” which changes each time a create a page inside sharepoint.

When I generate all my pages from my macro, they obviously all have the same WebPartID since it is based from my static template..

So My question is “What happens if all my pages have the same webpartID ?”

As a side question, I’ll be eager to know how I could get a WebPartID using Visual Studio.

Thank you all.

Calculate Power Consumption of 40 PCs of same build

We have a school computer lab with 40 PCs. All these PCs have same specs:

Specs:

  • Lenovo H530
  • Intel® Pentium™ G3220 (3.00 GHz Dual-Core) processor
  • 2 GB RAM
  • 500 GB HDD (7200 rpm)
  • 15.6 inch TFT
  • Standard Mouse and Keyboard

more detailed specs: https://www.cnet.com/products/lenovo-h530s-57323270-black-weekly-deal-intel-pentium-g3220-3-00ghz-1100mhz-3mb/specs/

How much is the power consumption of one PC?

I need to install an Online UPS for the lab and don’t know if I should go for a 6KVa UPS or a more expensive 10KVa UPS. Any help would be appreciated.

How to use element validation and form validation on the same form?

I have a custom form I am validating with a custom validation function like this:

… $  form['submit'] = array(     '#type' => 'submit',     '#value' => t('Submit'),     '#validate' => array('custom_misc_form_validate'),   ); 

This works as expected, my custom validation function is called, etc. But I would like to add an further form element to the form, which defines an element validation callback function, like this:

$  form['email'] = array(       '#type' => 'textfield',       '#title' => t('Email'),       '#description' => 'Bitte geben Sie eine gültige E-Mail-Adresse an: An diese Adresse werden Ihnen die Zugangsdaten zu unserem Intranet zugesandt.',       '#required' => TRUE,       '#element_validate' => array('custom_misc_email_validate'),       '#weight' => -998,     ); 

The validation callback looks like this:

function custom_misc_email_validate($  element, &$  form_state, $  form) {   $  value = $  element['#value'];    // Check if email has a valid format.   if (!valid_email_address($  value)) {     form_error($  element, t('The e-mail address %mail is not valid.', array('%mail' => $  value)));    // Check if email address is already registered.   } elseif (user_load_by_mail($  value)) {     form_error($  element, t('The e-mail address %email is already registered. <a href="@password">Have you forgotten your password?</a>', array('%email' => $  value, '@password' => url('user/password'))));   } } 

But the callback for the element validation is not called, as long as there is an callback in #validate of the submit button. As soon as the latter is commented out, the callback for the element validation is actually called, but $ element['#value'] is always empty.

Is this a bug, or am I doing something wrong?

Same Page with two different URLs

Hello, there,

I’m currently new to SEO and came across the following: a website renders the exactly same page in two differente ways:

www.example.com/folder1/subfolder1 with canonical set to www.example.com/folder1/subfolder1
www.example.com/folder1?cat=902 with canonical set to www.example.com/folder1

This is probably hurting the SEO since it’s sending link juice to different pages even though they render the same page, right ?
The thing is, how bad can it hurt the SEO ?
I believe the best would be for both pages to render with the same URLs and with the same canonical, but it’d take us a reasonable amount of time in order to reconfigurate the site’s architecture.

With best regards,
Lucas

Quantity discount for same category

I would like to have a sale where if you buy 3 items from category ‘widgets’ you get 25% off.

I setup the following rule. It works fine if you add 3+ products from category ‘widgets(118)’, however it also activates if there is 2 items from category ‘widgets(118)’ and 1 item from category ‘flyers(120)’. It doesn’t apply the discount to the item from category ‘flyers(120)’, only the 2 products from ‘category’ widgets however it is counting the quantity as 3 even though there is only 2 products from category ‘widget’. Not sure what I am doing wrong here,

Conditions Apply the rule only if the following conditions are met (leave blank for all products).  If ALL  of these conditions are TRUE :  If total quantity  equals or greater than  3  for a subselection of items in cart matching ALL  of these conditions:     Category  is  118    Percent of produce price discount 25  Apply the rule only to cart items matching the following conditions (leave blank for all items).  If ALL  of these conditions are TRUE :  Category  is  118  

Strongly consistent backup of Mongo with Aurora at the exact same time

At my employer we use AWS Aurora DB & MongoDB Atlas hosted databases together on one application.

So we have nail biting scenarios where records are created on both and typically MongoDB points to records on Aurora that it needs. If there is some sync issue, like the data is on Mongo, but not Aurora and vice versa, this translates to terrible UXes with permission issues.

So my question is to do with backups. These systems must be snapshot at the exact same point of time. I am thinking ideally without any client usage at an early hour like 2AM, i.e. it’s brought down for a few minutes whilst snapshots are being made.

Actually I am not sure how to limit client access whilst still being able to run mongodump or an RDS snapshot. Am I missing a better approach to backup these two data stores together?

Perhaps I can take a strongly consistent backup at a certain point in time?

You might be thinking, what happens if you take a snapshot at 2AM and you lose everything at 10AM. This is acceptable RPO.

How to batch generate preview for multiple versions of filters/layers applied for the same image in Photoshop?

Recently I’m experimenting a lot with postproduction, to look for some new style. I find it very tedious to check out various combinations of adjustment layers (also with various opacity), blending modes, LUT’s etc.

I even prepared a special .psd with a big number of layers which I just toggle on and off but I still find it ineffective.

I would like to be able to batch generate a whole series of the same image with different effects, to the different degree applied. I haven’t found anything suitable for this, just ‘batch’ options but for different image files. Have I overlooked something or the only way is to record a loooong action, which will apply various adjustments and save the images during the process? I thought it would be a natural option to generate previews of the image with different LUTs for instance but haven’t found anything..

How to handle multiple objects on the same day in my timeline?

I am making an app where a series of posts are shown side by side chronologically. Then on the same page, there is a timeline at the bottom where each post is represented by a colored tick. You can see it here

Animated GIF - Find & Share on GIPHY

As you see, there is a track pin at the bottom in the exact middle showing you where the post you are currently viewing shows up at the timeline. When you scroll through the posts, the timeline adjusts to always show that corresponding tick under the pin.

Also, when you scroll the timeline every time a tick passes under the tracker pin, the post updates to that corresponding post.

Right now its done on a day by day basis. Each tick is a single day and if there is more than 1 post in a day like in that gif, they are drawn in the exact same spot. The problem is that now, when they scroll to that day using the timeline, they only see 1 post and don’t understand that there is more than 1 post in that day – even though they can scroll to it in the upper posts section.

I am not sure how to handle this case. Should I alter the appearance of the tick to show 2 somehow? Or should I add a page control (those multiple horizontal dots that show the active “page”?

What would be the most intuitive for the user?

PS. This will eventually be a fitness app. The purpose of this view is to show progress over time in a particular exercise. One reason the posts are broken down by day is that there is not much chance for progress over the course of a single day – most people work out at most once a day.