Any ideas on why when I put a list of category links in a dropdown list using tags the links are going to the wrong url?

Desktop version is providing the correct url for example: http://test.local/test/category/featured/ but the mobile version is not providing the correct url: http://test.local/test/featured/ it’s dropping the /category/

Here is my desktop version of code:

<div class="category-filter full">         <span class="filter-text"><i class="far fa-filter"></i> <?php esc_html_e( 'Filter by:', 'test-wp' ); ?></span>         <ul class="category-list">             <?php              // only display "Featured" if a Featured post is present in the blog                 $  query = new WP_Query(array(                     'post_type' => 'post',                     'field' => 'slug',                     'category_name' => 'featured',                     'ignore_sticky_posts'    => 1,                 ));                 if( $  query->have_posts() ){                     echo '<li><a href="'. get_site_url() .'/category/featured/">Featured</a></li>';                 }             wp_reset_postdata(); // Restore original Post Data             ?>             <?php                  foreach ( $  terms as $  term ) {                     printf( '<li><a href="%1$  s">%2$  s</a></li>',                         esc_url( get_category_link( $  term->term_id ) ),                         esc_html( $  term->name )                     );                 }             ?>         </ul>     </div> 

And here is my mobile version of code:

<div class="category-filter mobile">         <select id="custom-select" onchange="location = this.value;" style="outline:none;border:1px solid #777;font-size:20px;height:30px;color:#777;">             <?php                  foreach ( $  terms as $  term ) {                     printf( '<option><a href="%1$  s">%2$  s</a></option>',                         esc_url( get_category_link( $  term->term_id ) ),                         esc_html( $  term->name )                     );                 }             ?>         </select>     </div> 

reload page when going back in browser

is there any way to refresh the browser page when backtracking with javascript: window.history.go (-1);?

there is the option to use document.referrer; but I can only go back one page. yes, I must go back 2 or 3 pages I can’t get it to work.

I wanted to know if there is a possibility to use some function so that when you go back the page is refreshed.


Going between assignment rules and functions

I am trying to develop a model using Mathematica, and continuously run into difficulties going between the outputs of various functions (Solve, Differentiate, etc.) and back to functions (in the colloquial sense). Often in my application the results of one function are the inputs to another.

I’ve read the relevant documentation pages, and looked for previous questions. I was able to solve some of my issues this way, mostly by defining additional variables and using ReplaceAll (/.) to replace these additional variables with the assignment rules from previous steps.

Now I’ve run into an issue that I can’t seem to ‘replace’ my out of. I’ve tried to simplify the question to get at the core of my misunderstanding. I define the following function:

Rh[a_] = Ch + Z*(A - a) Pih = x*Rh[a] - \[Gamma]*0.5*Q*x^2 + P 

I now want to differentiate Pih w.r.t. x:

RESULT = Solve[D[Pih, x] == 0, x] // Simplify 

The result is an assignment x-> (Ch+Z(A-a))/(Q\[Gamma])

Now in order to use this result I would normally do something like:

RESULT2 = Solve[x==a/.RESULT,Q] 

Where often I’d have to use multiple replacements (if, for example, a was also the result of some previous calculation.) I would play around with the location and ordering of the /., sometimes with Flatten[] until it worked.

Questions 1 – is this the correct method, or am I missing something much simpler? If there are any resources that deal with this explicitly I would highly appreciate it (I’ve read the documentation for assignment and functions, and this is the best I came up with)

Question 2 – more specifically, I have not been able to solve the following. Based on the same example as above: Suppose I want to redefine a function h[a] like this:


Where Y is the derivative of RESULT from the previous calculation -Z/(Q\[Gamma]). However, when I apply D[RESULT,a], the result is 0->-Z/(Q\[Gamma]. I successfully used

h[a_]=h0+0*a/.D[RESULT, a] 

Which works but is terrible and I cannot believe is the right way to do this. I understand why Mathematica is doing this, but I’m lost as to what would be a better, more general alternative.

I tried using := in various places, to no avail (I usually just get the whole Solve[…] function as RESULT…)

Thanks for any help

How do I give the right amount of treasure without going overboard, like my last DM did?

I am trying to find a good model for how much treasure and money to give my players in order not to make items too difficult to buy, or too cheap to buy.

In my last game, which ran for 6 months, our DM ended up so freely giving us gold that everything was trivial for us. Our characters at level 6 were so rich, we could afford any comfort and travel as kings. This was not because we found a treasure hoard, but because our DM had accidentally been giving us too much treasure for our encounters.

For example, every time we would fight something, they would reward us with 1-2 Platinum, sometimes more. They also used in-game currency for out of game creativity. If you made them laugh, you got another Platinum or like 100 Gold.

Nearing the end of the campaign, everything was so cheap that it wasn’t fun anymore to even buy anything or save up for fancy lodgings. We could afford hundreds of potions, countless trips to the local temple, resurrections…etc. There was no threat of dying, no challenge in earning, and the game lost steam fast.

I am not good with math. I am nowhere near an economist, but when I run my campaign I don’t want to end up with the same problem.

Are there any charts or rules of thumb for making a balanced, long-term economy in D&D 5th?

How do I assign treasure in a way that doesn’t inflate to worthlessness down the line?

I am looking for charts, guides or tables ideally. I would really appreciate the help.

If an AI is sure it is going to lose, what can it do to make the game fun for the player?

For context i am contributing to a sequential turn based strategy game. I have an idea how to improve it but i feel i need some input to help me evaluate and improve it. We currently have a really dumb AI that just follows a rough set of rules each turn. I’m considering to upgrade it to a basic search based AI to not be guaranteed to win every time i play it.

There are many reason why an AI could be behind the curve. These include that is wasn’t able to grow it’s economy well due to bad luck with map generation, that it’s economy was disrupted early by an enemy raid while the defending army was out of reach, that the starter army was defeated early and resources had to be invested to replace it instead of economic upgrades or more importantly there being a big awesome deciding battle with all units involved and it lost. A search based AI will be able to know when it is obvious that it is growing slower than it should, can’t recover and it is now impossible to win due to runaway success. Such a runaway success is often boring to play especially if it happened 3 times in a row.

Assume there is no meta game where multiple players can gang up on the strongest one. I am open to nudge the game rules in the AIs favor if this happens. However rubber banding can give the player the impression that they are punished for playing well, the AI drags out a game into an almost stalemate or even wins unfairly.

The problem i’m trying to solve is not that the AI is loosing but that the AI rolling over and dying is not fun or interesting.

It is even worse. If the player is sufficiently good he will experience that every time.

In some theories of literature after the conclusion seems forgone and the tension is falling a new small conflict that is relevant enough or something else that justifies further elaboration and excitement. enter image description here

My idea is to have a library of endgame scenarios, a handful of which end up with player loosing unless he plays really well, most pose a small challenge that the player is entirely able to deal with and some are a "i role over, just kill me already, please".

Are you aware of anyone trying something like this before? If someone tried this in a strategy game or even outside of strategy games before i would like to learn from them.

Can you spot some obvious problems with this idea? I already considered the AI misjudging the impossibility of wining. However i might be to enamored with my idea to spot different problems.

How can i make sure that this still feels fair? It is easy for the AI to get some extra resources however if a player is loosing i am afraid that he would feel cheapened if he got some extra money and units.

How i help the player having fun or at-least variety when they are losing? I really have no ideas for this.

Offered equivalent .com domain to purchase, what is going on, and how to proceed?

A quick bit of background: I run a small (single person) software company, and operate under a domain that I have had for around 8 years. There has always been a .com domain of the same name, operating in an entirely different sector and country, but with not much going on on their website. I have always wanted the .com equivalent of my current domain, just because over the 8 years not only has business improved a little, but I also left Australia and, of course, a .com is just a little more desirable. With that in mind, I had the .com on backorder with my Australian registrar for quite a few years – but it never came up.

In the last few weeks, I suddenly got an influx of offers to buy this .com domain, seemingly from a number of different entities. First thoughts – scam of some sort. After checking out the WHOIS, it does seem that the .com expired last September, but my backorder had lapsed (great!). Registrant details are hidden behind PERFECT PRIVACY, LLC in Florida, and the domain status is clientTransferProhibited and the domain servers are NS1.PENDINGRENEWALDELETION.COM.

I am really curious as to what is actually going on here. Is it just a scam, because people have scraped details of an expiring domain, or do these people actually have access? If so, how? Has it been purchased? I didn’t (and don’t) know much about the murky world of domain name transfers, but SnapNames came up in my search and I looked on there. I did find the .com domain there, with a status of "Closed". Does that mean it came up in an auction and was bought? Or is another possibility that it is coming up for sale, and multiple people are trying to work out if it is worth buying and flipping to me? If it has sold, is there any way of finding out how much it went for? That might give me a bit of leverage in any future negotiations.

It is not, I don’t think, a valuable name. One of the potential sellers has offered it to me for $ 1299, which I might consider paying, but another question would be how does one go about purchasing a domain safely from an internet unknown?

Can a raging barbarian carry live rabbits to kill them, in order to keep his rage going?

One of my players, a human barbarian, came up with the idea of carrying captured rabbits, feeding them and treating them nicely, so that he can rip them apart mid-battle if he knows he will be unable to attack during the round. Does this sound balanced or does this sound like breaking the rules?

Something weird going on with my algorithm?

I wrote an algorithm for data analysis using the CERN ROOT framework. It takes in three files of sorted UNIX timestamps from a single year, and pairs them up in the closest triplets, where each file contributes a triplet, and each triplet is unique. I know there are some more "well known" algorithms for accomplishing this, however this algorithm completes the task much faster, clocking in at about 20 minutes on my machine, as compared to many, many hours for some of the other algorithms I’ve tried. When complete, the algorithm plots the triplets (of the form {a,b,c]) on a 2-dimensional histogram, where the horizontal axis is a-b, and the vertical axis is a-c.

Problem is, it seems to be acting very weird. Namely, when I feed the algorithm one file of real data (these are timestamps generated by an experiment) and two files of completely random data, I get these weird diagonal lines: When I feed the algorithm three files of real data, a single diagonal line through the middle (and two more lines, running horizontally and vertically) appears if I use enough bins. Any idea what’s going on with my algorithm?

void unbiasedAnalysis(){  TNtupleD *D  = new TNtupleD("D","D","x:y");  ROOT::RDataFrame statn1("D", "./pathtodata"); ROOT::RDataFrame statn2("D", "./pathtodata"); ROOT::RDataFrame statn3("D", "./pathtodata");  vector<double> vec_1, vec_2, vec_3; statn1.Foreach([&](double tstamp){ vec_1.push_back(tstamp); },{"UNIX"}); statn2.Foreach([&](double tstamp){ vec_2.push_back(tstamp); },{"UNIX"}); statn3.Foreach([&](double tstamp){ vec_3.push_back(tstamp); },{"UNIX"});  vector<vector<double>> pairs; for(auto tstamp : vec_1){      double first,second;      //get iterator pointing to closest element greater than or equal to     auto geq = std::lower_bound(vec_2.begin(), vec_2.end(), tstamp);     //get iterator pointing to nearest element less than     auto leq = geq - 1;      double foo = tstamp - *geq;     double bar = tstamp - *leq;      //compare iterators, save the closest      if(dabs(foo) <  dabs(bar)){ first = *geq; }     else { first = *leq; }         //repeat     geq = std::lower_bound(vec_3.begin(), vec_3.end(), tstamp);     leq = geq - 1;      foo = tstamp - *geq;     bar = tstamp - *leq;      if(dabs(foo) < dabs(bar)){ second = *geq; }     else { second = *leq; }      //add to pairs     pairs.push_back({tstamp, first, second, (tstamp-first), (tstamp-second), std::min((tstamp-first), (tstamp-second))});  }  //sort vector of vectors by size of smallest difference std::sort(pairs.begin(), pairs.end(),     [](const vector<double>& A, const vector<double>& B){         return A[5] < B[5]; });  std::set<double> cache;  ROOT::EnableImplicitMT();  for(auto pair : pairs){     //if not in cache, add to TNtuple     if(cache.find(pair[1]) == cache.end() && cache.find(pair[2]) == cache.end()){              D->Fill(pair[3],pair[4]);          //add to cache         cache.insert(pair[1]); cache.insert(pair[2]);     } }  D->Draw("x:y>>htemp(100,-0.02,0.02,100,-0.02,0.02)","","colz");