performance tuning – Is it possible to interrupt a computation and give partial results?

Note: this solution here works for your second case: “Or alternatively the program starts a new computation (in my case very long lists) and the program ends after obtaining the first 1000 (or another number) of results”. For your first case (interrupting a computation) you can follow this instructions (depending if you use Windows/Mac and if you’re in a notebook).

Suppose you generate a list of integers that grows by adding an element if a random real is above 0.2. Thus, you cannot know how long will it take for your list to have 1000 elements, but you could check its length every time it is updated, and stop it there.

For instance:

(*How many elements in your computation?*)
myDesiredLength = 1000;

(*What's the intitial state/length of your computation?*)
myList = {1};

(*Update your computation according to whatever process you do, using While,
so it stops when you reach your desired length*)

i = 1;
Length(myList) <= myDesiredLength,
If(RandomReal() > 0.2, 
AppendTo(myList, myList((-1)) + 1));
i++) // AbsoluteTiming

I don’t think in general you can ask a computer beforehand how much time some computation will take, or if it will ever finish (this is the famous Halting problem). You could do some estimates, but it also depends on your particular computation (as some calculations take linear time, others exponential time, etc), what else your computer is doing, etc, etc. So, I’d better recommend giving your program some condition to stop beforehand, whether by Table, Do, While, For, etc, (and use some conditionals if needed).

differential equations – Why is DSolve returning imaginary results?

When using DSolve, I expected $y(x) = a + b x$ as the only result because $y(x)$ is real

 DSolve({y''(x)(1 + (y'(x))^2) == 0}, y(x), x)

However, it is returning three results, which include two imaginary ones

$${{y(x)to c_1-i x},{y(x)to i x+c_1},{y(x)to c_2 x+c_1}}$$

Why is it returning those imaginary results?

Note: I understand how it gets them.

matlab – Does frequent changing of the random seed reduce the randomness of results?

I wrote a Matlab program whose algorithm is like:

for epoch = 1:1000,
    rng('shuffle') %seed based on time
    for generation = 1:100,
        % solve the puzzle using the random number to shuffle values in the puzzle

rng seeds the random number generator based on the current system time. I’m using Matlab’s default random number generator, and the reason I put rng within the epoch loop, is because I wanted to make sure the puzzle got solved differently each time.

But, one of the conference reviewers wrote a review comment that said:

“One normally seeds a PRNG (pseudo random number generator” once
during initialisation. Changing the seed repeatedly REDUCES the
randomness of results!!!! Move this out of your algorithm. Low
diversity in a PRNG can actually improve results!”

Is this actually true? Would my program have produced better randomness if the seed was initialized like this?

rng('shuffle') %seed based on time
for epoch = 1:1000,
    for generation = 1:100,
        % solve the puzzle using the random number to shuffle values in the puzzle

When I thought through it, I realized he may have meant that changing the random seed within an epoch may result in one or more epochs starting from the same random seed, and that’s why it may reduce the randomness. Is there any other explanation or is the reviewer’s understanding flawed?

themes – BeTheme – improve search results

I’m using BeTheme with Muffin Builder to my create a website and I was almost done. But unfortunately when I tested the search mechanism (using the default wordpress search system) I’ve found out that all the content I have inserted with the page builder are not being indexed by the search, so the search results page shows only the page title as result.

Is there a way for me to include the content from the page builder in the search results? I do not want to copy the content for the excerpt field because the content will be duplicated and it will possibly affect my SEO results.

thanks in advance

sharepoint online – What search syntax can be used to return results where a user profile field is empty?

Working with SharePoint Modern and user profiles that have with category fields to populate with topics of interest.

I’ve set up a search results page for “pages for me” that refines results automatically, based on the value/s the user select/s for their ‘business area’, ‘product’ and other (4) categories that they’re interested in.

…AND {|Refinablestring123:{User.BusinessArea}} AND {|Refinablestring123:{User.Product}}…etc

This works fine, and returns results whether the user has selected one or a number of values in each category.

The problem arises when the user leaves the category field blank, either because they want to see all topics in that category, or that category is not relevant to them. The search results are empty due to the vacant field.

Is there a way to treat a blank category as “all values”?

posts – Search results for ACF data

Is it possible to write a query to search for data from one custom field only? I have a CPT called ‘lectures’ and I only want to search for data that is in the custom field called ‘keywords’ I have this:

        $args = array(
            'post_type' => 'lectures',
            'order' => 'ASC',
            'posts_per_page' => -1,
            'meta_key' => 'keywords'
        $query = new WP_Query($args);
        while ( $query -> have_posts()) : $query -> the_post();


but it is not working.
So if someone searches for ‘Operant Conditioning’ (one of the terms in the keywords ACF). I want any CPT with those ‘keywords’ (from the ACF) to show in results. I cannot add a specific keyword as there will be hundreds

amazon web services – My AWS VPN setup results in no traffic working when connecting

I crossposted this to stackoverflow here in the hope of finding a solution…

I have created a VPN to our VPC but when I connect to it from my machine, nothing works – neither Internet, nor can I reach VPN-internal endpoints.

I added public dns-servers and split-tunnel=enabled to the configuration.

The VPN is set to

`Client IPv4 CIDR`

An association has been added (line from AWS console):

cvpn-assoc-<id>     subnet-<id>    cvpn-endpoint-<id>      Associated     sg-<id>

There are two authorization rules (one allowing everything until I get it working)

The route table looks like this (was automatically added via the assoc):

cvpn-endpoint-<id> subnet-<id>  Nat      associate     Active      Default Route

This RT is the only thing which looks odd. In the VPC, the subnet has a definition of – but the automatic association sets it to But there’s actually no way to set it to in the routing table, doing so results in an error about the range being invalid.

I also tried creating the VPC with a client IP CIDR of but then it errored saying it must at least be /22.

dnd 3.5e – Do I lose access to a feat if ability drain results in no longer meeting the prerequisite?

Do curses or ability damage/drain cause a character to be unable to use his feats?

For example, a Ranger with 20 Dex who has two-weapon-fighting feats and is using two weapons gets cursed or ability drained and his Dex drops to 14. Does that cause the character not to be able to use his two-weapon feats (which have a requirement of at least 15 Dex)?

What about his other feats that have prerequisites of blocked feats? (As another example: a fighter with the Whirlwind Attack feat, which requires Combat Expertise gets an INT penalty that drops his INT under 13, a prerequisite of Combat Expertise). I think that he can no longer use his Combat Expertise feat (because of low INT) and also Whirlwind Attack and any other feats that require Combat Expertise. Is that right?

I guess it is better to clarify the reason I am asking.

First of all, there are so many books, and there are too many authors that create them and test them. Many bugs are uncovered due to that reason. It is quite hard to keep track of all these things. I know that.

The reason for the question is, for higher-level builds, skill, feat, class, prestige class, template and ability score choices become more important. And there are casters, whose main combat skills depend on spells (clerics, sorcerers, and wizards, especially). Maybe druids can deal with key ability score penalties, and clerics may try to survive such conditions. Wizards and sorcerers have less of a chance when their key ability score drops. A curse may cause them to be without magic (or with some weak spells) if they fail to resist it. They probably have higher Will saves, but they all have the chance.

And I am trying to be sure about the situation of a warrior-based class, because feats mean a lot to them. So what happens when they get cursed? Failure to be able to use a key feat is important, but not as much as a wizard who is unable to cast spells.

Related FAQ answer is not enough about this situation (the following part)

A feat sometimes requires you to have a certain ability
score, which is the case with Two-Weapon Fighting (it
requires Dex 15). A character has, say, Dex 13, but wears
an item, in this case gloves of Dexterity +2, and now her Dex
score is 15. Can she take the feat and have it be active only
when she wears the item?

Actually yes, she could take the feat, but she would lose the
use of the feat if, for whatever reason, she loses the bonus from
the item.

So, still looking for something more satisfactory.

UPDATE: @LitheOhm’s answer:

Players Handbook:

Two-Weapon Fighting
Prerequisite: Dex 15.

Complete Adventurer

Oversized Two-Weapon Fighting
Prerequisite: Str13, Two-Weapon Fighting

I wish to clarify that, I just wish to be sure about what to do in such situation. That is just an example and probably being able to use Oversized Two-Weapon Fighting feat will not save the character while he could not use basic Two-Weapon Fighting feats due to Lowered DEX. But I still wonder, whether he could still use Oversized Two-Weapon Fighting.

Of course there could be some other feats which fits that situation. That is just one I noticed.

rest – RESTful Response when the POST request results in the creation of different kind of resources?

I have been working on designing an API that lets client create a product (think of product as something like website domain, something that comes into existence when client makes order for it to the service). Correspondingly with every purchase results in creation of the order object. Which means creation of two resources via a single POST request.

So afaik, the RFC standards recommends sending 201 on resource creation with URI for the resource in the Location header. But in the above scenario, we are creating two resources, domains and orders and I would want response to contain information related to both the resources.

Response would look something similar to this

POST /domains/
 body: {"domain_name": ""},

 Body: {"order_id": "1234"}

But does not look very RESTful. I was wondering if there was a RESTful way to do this?