javascript – How do I add a div to a parent element in a navigation menu?

I have a navigation menu with class name: “custom-menu-class”. It’s in WordPress.

I want to make an active class meaning that when a link is active (url matches), and/or mouse hovers a link, a div is inserted in the parent element (a white circle on top of the text).

enter image description here

Playing around with inspect element, I found that adding:

<div style="
    border: 6px solid white;
    border-radius: 50px;
    width: 12px;
    position: absolute;
    top: -15%;
    left: 33%;

to the parent element gives me what I need.

I also need it for the active menu item only.

Can someone help me? Trying to achieve this:

enter image description here

W3C validator: Bad value for attribute href on element a: Missing scheme

I have the piece of code from below, but I get the error which says "Bad value for attribute href on element a: Missing scheme." when I validate the code.
How can I fix this?

<a class="contact_mobile_link" href="tel:0511-87989280" >0511-87989280",

finite element method – Problem with NDSolveValue : “The function value {$Failed} is not a list of numbers with dimensions…”

I was having fun modifying a code given to me as an answer to a previous problem here, courtesy of user Alex Trounev (Thank you again), when I encountered a certain error which I had never seen before.

Here is the aforesaid code :

r0 = 0.5;
h = 1;
(Alpha) = 0.8;

(*region definition*)
reg = Cuboid({.5, 0., 0.}, {1., 2 Pi, 1.});

reg3D = ImplicitRegion(
   r0^2 <= x^2 + y^2 <= 1 && 0 <= z <= 1, {x, y, z});

(*equation + conditions*)
eq1 = D(u(t, r, (Theta), z), 
    t) - (D(u(t, r, (Theta), z), r, r) + 
     1/r*D(u(t, r, (Theta), z), r) - 
     1/((Alpha)^2 r^2) D(u(t, r, (Theta), z), (Theta), (Theta)) + 
     D(u(t, r, (Theta), z), z, z));

ic = u(0, r, (Theta), z) == 1;

bc = DirichletCondition(u(t, r, (Theta), z) == Exp(-5 t), r == r0);
nV = NeumannValue(1, r == 1);
pbc = PeriodicBoundaryCondition(u(t, r, (Theta), z), (Theta) == 0, 
   TranslationTransform({0, 2 (Pi)*(Alpha), 0}));

(*solution computation*)
sol = NDSolveValue({eq1 == nV, ic, bc, pbc}, 
   u, {t, 0, 2}, {r, (Theta), z} (Element) reg);

PlotPoints(Rule)50,PlotLabel(Rule)Row({"t = 

When I run the code, after some time, I get greeted with the following error :

NDSolveValue::nlnum: The function value {$Failed} is not a list of numbers with dimensions {39639} at {t,u(t,r,(Theta),z),(u^(1,0,0,0))(t,r,(Theta),z)} = {0.0138161,{<<1>>},{-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,<<15>>,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,<<39589>>}}.

When I click on the three dots next to the error, I don’t find any information on the error like it’s usually the case. I then decide to google some answers.
I found some answers here while also trying to comprehend the error by looking at this and finally that answer here.

So if I did understand it correctly, such error arises when you use NDSolve (or NDSolveValue) to get a symbolical solution to your equation, but problems come up when you try to numerically evaluate it for plotting purpose, or when trying to get a symbolical result with a function that requires numerical values ?

In any case, I do not really understand why I get such error as my plot part is currently between (* … *) so it shouldn’t matter. As for the rest of the code, I do not really see an error but I am just a beginner so…

Anyway, can a kind fellow enlighten me please ?

algorithms – Check for common element in two arrays using FFT

My task ask me to check whether there is a common element in two arrays $(x_1,x_2,…,x_n)$, $(y_1,y_2,…,y_n)$ with $x_i,y_iinmathbb{N}$ using the Fast Fourier Transform(FFT).
(I’m aware that there is a simple $O(nlog(n))$ algorithm to solve this problem using sorting and binary search.)
The tasks hints that we should consider the following product to solve the problem:
prod_{i+j=n} (x_i-y_j)

The product is obviously zero if there is a common element, but I am still not sure how I could compute it faster via FFT.
… I know how to use FFT to multiply polynoms efficiently, but somehow I seem to overlook something.

How to find the size of gaps between entries in an array so that the first and last element of the array is filled and the gaps are all of equal size?

I have an array a of n entries. I need to place a token on the first and last position of that array, so a(0) = 1 and a(n-1) = 1.

I now want to place additional tokens into that array with a distance inbetween each index i where a(i) = 1 that is greater than 2 (so placing a token on every index is invalid as well as alternating using and not using an entry is invalid). Phrazed differently: I want that sum(a) < n/2 . The gap inbetween each token should be the same, so say with an array of size 16,

a(0) = 1, a(3) = 1, a(6) = 1, a(9) = 1, a(12) = 1, a(15) = 1

would be a solution with a gap size of 2 (distance of 3).

How do I find all gap sizes that are possible to fill said array with the given constraints?

Imagine a street inbetween two crossroads where a lamppost should be placed on each crossroad and then additional lampposts should be placed equidistant to each other and for some reason only natural number distances are allowed.

(The actual problem I want to solve is where to place Sea Lanterns in my Minecraft Project so do not disregard this problem as an assignment question I want a solution for.)

mobile – What element to focus after user input on a chatbot?

This is similar to What element should have the focus after a search?, but not the same case.

I’m building a chatbot with Flutter (mobile). This is the flow:

  1. Bot asks a question.
  2. User is presented with several fixed options (like radio buttons)
  3. User chooses one of them
  4. String equivalent answer is added to the chat log
  5. Options disappear, since they made sense only for question in point 1
  6. Bot asks new question
  7. User is presented with new options.

I want to make this accessible. I’ve taken a look at role log and it fits great. I’m using a similar equivalent in Flutter and it handles new messages perfectly. The problem is that, since options disappear with each answer, focus disappears too: when the user “tabs” to the next element, focus goes back to the top of the app, and she’d need to scroll back all the list of messages (or find her way with an equivalent but also suboptimal manner) to get to the end, every time.

I can force the focus moving to the last message, but that would clash with the message reading, since that won’t be “polite” (ARIA sense).

For now, I’m not using the aria-live feature (so the app doesn’t read new messages) and I’m moving the focus manually, only after the user submits the info and only to the first unread message. It works, but I find that solution kind of hacky.

What should be the best way to handle this?

sublist – How can I add or remove the element in the sub-lists, whose length are different?

If there are lists with different lengths of sublists like below,

list1 = {{{1, 2, 3, 4}, {11, 12, 13, 14}, {22, 23, 24, 25}}, {{-1, -2, -3, -4}, {-11,-12,-13, -14}, {-22, -23, -24, -25}, {-41, -42, -43,-44}}, {{100, 200, 300, 400}, {-100, -200, -300, -400}}}

How can I combine or delite each element from sublists?Question 1.
I have another data of

list2 = {a1, a2, a3}, 

correspond to list1.So I want to combine list2 to each sub element of

newlist = {{{1, 2, 3, 4, a1}, {11, 12, 13, 14, a1}, {22, 23, 24, 25, a1}}, {{-1, -2, -3, -4, a2}, {-11, -12, -13, -14, a2}, {-22, -23, -24, -25, a2}, {-41, -42, -43, -44, a2}},{{100, 200, 300, 400, a3}, {-100, -200, -300, -400, a3}}}

How can I get newlist?
I know I can append a1 to lsmall,

lsmall = {{1, 2, 3, 4}, {11, 12, 13, 14}, {22, 23, 24, 25}} 


Append(lsmall((#)), {a1}) & /@ Range(Length(lsmall))

However newlist cannot get by

Append(lsmall((#1, #2)), {list2((#1))}) & /@ (Range(Length(lsmall)), (Range(Length(lsmall((#1))))) 

… I’ m in trouble.

Question2 After I get

newlist = {{{1, 2, 3, 4, a1}, {11, 12, 13, 14, a1}, {22, 23, 24, 25, a1}}, {{-1, -2, -3,-4, a2}, {-11, -12, -13, -14, a2}, {-22, -23, -24, -25, a2}, {-41, -42, -43, -44, a2}},{{100, 200, 300, 400, a3}, {-100, -200, -300, -400, a3}}}

in Question 1,
I also want to extract 2 dimensional sub lists,
such as

ext1 = {{{1, a1}, {11, a1}, {22, a1}}, {{-1, a2}, {-11, a2}, {-22, a2}, {-41, a2}},{{100, a3}, {-100, a3}}}

… (combination of 1 st and last element) or

ext2 ={{{2, 3}, {12, 13}, {23, 24}}, {{-2, -3}, {-12, -13}, {-23, -24}, {-42, -43}},{{200, 300}, {-200, -300}}} 

… (combination of 2 nd and 3 rd element)

I thought

For(i = 1, i <= Length(newlist), i++, 
  For(j = 1, j <= Length(newlist((i))), j++, 
   ext1 = Transpose({newlist((i))((j))((All, 1)), 
       newlist((i))((j))((All, 1))});)) Return(ext1) 

But it didn’t work at all.

finite element method – Deformation following loads in AceGen

I have a simple 2D finite element problem comprising a unit domain that is fully constrained on the left, vertically constrained on the bottom and subject to a uniformly distributed load at the top. See below

enter image description here

At present the load remains vertical throughout the deformation.
How can I modify this problem so that the load follows the deformation and stays perpendicular to the top surface of the body?

My current code is shown below

(* Open AceFEM *)
<< AceFEM`;
(* Domain and load *)
DensityX = 10;
DensityY = 10;
Height = 1;
Width = 1;
Load = -50;
SMTInputData("Threads" -> 4);
(* Create domain *)
  "CornerDomain", {"ML:", "SE", "PE", "Q1", "DF", "HY", "Q1", 
   "D", {{"NeoHooke", "WA"}}}, {"E *" -> 200});
  "Q1", {DensityX, 
   DensityY}, {{{0, 0}, {Width, 0}}, {{0, Height}, {Width, Height}}});
(* Boundary conditions *)
SMTAddEssentialBoundary("X" == 0 &, 1 -> 0, 2 -> 0);
SMTAddEssentialBoundary("Y" == 0 &, 2 -> 0);
SMTAddNaturalBoundary(Line({{0, Height}, {Width, Height}}), 
  2 -> Line({Load}));
(* Begin analysis *)
SMTShowMesh("BoundaryConditions" -> True)
(* Solution procedure *)
tolNR = 10^-5; maxNR = 500; targetNR = 100;
(Lambda)Max = 1; (Lambda)0 = (Lambda)Max/1000; (CapitalDelta)
(Lambda)Min = (Lambda)Max/10000; (CapitalDelta)(Lambda)Max = 
SMTNextStep("(Lambda)" -> (Lambda)0);
   step = 
     maxNR, {"Adaptive BC", 
      targetNR, (CapitalDelta)(Lambda)Min, 
(CapitalDelta)(Lambda)Max, (Lambda)Max})
   , SMTNewtonIteration();
  If(step((4)) === "MinBound", SMTStatusReport("Analyze"); 
  , If(step((1)), SMTStepBack(););
  SMTNextStep("(CapitalDelta)(Lambda)" -> step((2)))

Which yields the deformed body

enter image description here

Any help would be appreciated!

ui automation – Katalon Studio : Stale Element Exception while handling a web drop down

I am automating a use case using katalon studio and in the process, I need to write my automation to select an option from a dropdown. when I execute my automation script I see that option is getting select properly on the UI but in the console, I see an exception as below
“Caused by: org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document”

I tried adding some wait time before the action is taken but it did not work. Is there anything I can do to resolve this apart from handling the exception explicitly.

please do let me know if I can provide additional information for this issue.


finite element method – Mesh Refinement for interpolation of f[x,y] fails for all but the simplest f

I would like to interpolate a function, f(x,y,z), on a mesh of the unit cube, starting with a coarse tetrahedral mesh and refining tetrahedra as needed to reduce the interpolation error below a tolerance. The problem: DiscretizeRegion(Cuboid(),MeshRefinementFunction->mrf) ignores my mrf. In an attempt to understand, I have simplified to a toy version of the problem (2D, on a square instead of a cube, with a simple form for f). I discovered that of the following 5 mathematically equivalent forms for f, the last works and the others do not:

fDirect({x_, y_}) = Cos(2*Pi*x)*Sin(2*Pi*y)
fDelayed({x_, y_}) := Cos(2*Pi*x)*Sin(2*Pi*y)
fEmbedded1 = Function({p}, fDirect(p))
fEmbedded2 = fDirect(#1) & 
fPureFun = Function({p}, Cos(2*Pi*p((1)))*Sin(2*Pi*p((2))))

Here is what the unrefined mesh looks like:

sq = DiscretizeRegion(bm, MaxCellMeasure -> Infinity)

Coarse mesh of unit square without refinement

The resulting mesh has 4 nodes and 2 triangular elements.

Now we define a refinement function. For the toy problem I have adopted a simplified form of the error estimate. I check the error only at the center of each tetrahedron. The center is at Mean(vertices). The true value there is f(Mean(vertices)). My “interpolated value” there is just the mean of f at the individual vertices, Mean(f/@vertices). When Abs(error)>tolerance, the function returns True. A diagnostic print statement lets us see when the mesh refinement function is called.

This does not work for the first definition of f. Here is what that looks like:

 mrf = Function({vertices, area}, 
   Module({fest, ftrue, error, tolerance, test}, 
    fest = Mean(fDirect /@ vertices); 
    ftrue = fDirect(Mean(vertices)); 
    error = fest - ftrue; tolerance = 0.43; 
    test = Abs(error) > tolerance; 
    Print({vertices, area, fest, ftrue, error, tolerance, test}); 
sq = DiscretizeRegion(bm, MeshRefinementFunction -> mrf, 
  MaxCellMeasure -> Infinity)
Print("The mesh has ", Length(mc = MeshCoordinates(sq)), " nodes.")
Print("The mesh has ", 
 Length(mcells = MeshCells(sq, 2)), " triangular cells.")

Failed mesh refinement using a direct definition of f(x,y)

Notice that the mrf is called only once (there is output for only one diagnostic Print()) despite that there are two triangles. In that one call the error exceeds tolerance and the mrf returns true (i.e., do a refinement), yet there is no subsequent refinement. Definitions 2 – 4 produce the same result.

It does work for definition 5. Here is what it’s supposed to look like when it works:

mrf = Function({vertices, area}, 
   Module({fest, ftrue, error, tolerance, test},
    fest = Mean(fPureFun /@ vertices);
    ftrue = fPureFun(Mean(vertices));
    error = fest - ftrue;
    tolerance = 0.43;
    test = Abs(error) > tolerance;
    Print({vertices, area, fest, ftrue, error, tolerance, test});
sq = DiscretizeRegion(bm, MeshRefinementFunction -> mrf, 
  MaxCellMeasure -> (Infinity))
Print("The mesh has ", Length(mc = MeshCoordinates(sq)), " nodes.")
Print("The mesh has ", 
 Length(mcells = MeshCells(sq, 2)), " triangular cells.")

Working mesh refinement with f defined as a pure function

In the working case, we get a diagnostic print output for each cell of the mesh with repeats for several iterations, until all triangular elements have interpolation error estimates below tolerance.

It seems odd that the change that makes a difference here is a difference in the definition of f, which is internal to a module within a function definition. This seems a failure of encapsulation.

Definitions 3 and 4 were attempts to hide one of the apparently unacceptable forms of definition inside of the acceptable pure function definition form, but this did not work.

Unfortunately, my non-toy version of f is not easily written as a pure function (the one mode that worked above). That function is the end result of tens of pages of development within the notebook. It calls a number of functions, uses a numerical differential equation solver, an iterative root finder,… It’s not a simple function, which is why I want to tabulate and interpolate it.

Is this a bug? Is there a workaround–another way to access mesh refinement within Mathematica? Or would this work if only I did it correctly? (How does one do it correctly?)