c++ – Calling a function once a threshold is met

I’m currently writing an API for our codebase that allows us to use an Arduino Leonardo for our tests. This code is uploaded to the Arduino, and we read through the analog for work.

As stated in the docstring, this function calls a passed function once a threshold has been met. However, I need there to be a delay between function calls, as signals read from the analog can fluctuate and cause the callback function to be called more than expected. So, I devised a solution that requires the signals to depreciate 1/10 of the threshold value in order for callback to be executed again. The secondFactor is if the user wants to define their own limit of when they want the function to be called again. For example:

NeuroBoard board;
board.setTriggerOnEvenlope(700, Serial.println("Reached!");

This executes the statement once 700 is reached. Then once 630 is reached (700 - (700 x .10)), it set a boolean flag so that once 700 is reached again, it will be called. For another example:

NeuroBoard board;
board.setTriggerOnEnvelope(700, Serial.println("Reached!"), 500);

Same as above, however the boolean flag will only be set once the signals reach 500.

I hope I’ve explained everything so that it’s easily understandable. If anything is unclear, please leave a comment and I’ll address it! Below is the code:

NeuroBoard.hpp (code omitted for brevity)

class NeuroBoard {

    private:
        bool thresholdMet = false;

    public:
        /**
         * Calls the passed function when the envelope value is greater 
         * than the passed threshold.
         * 
         * @param threshold Threshold for envelope value.
         * @param callback Function to call when threshold is reached.
         * @param secondFactor Optional parameter for the second threshold the data must pass.
         * 
         * @return void.
        **/
        void setTriggerOnEnvelope(const unsigned int& threshold, void callback(), const unsigned int& secondFactor=0);
}

NeuroBoard.cpp (code omitted for brevity)

The ISR is basically a timer that runs on the Arduino. I’ve configured it so every second I get about ~50,000 readings from the analog per second. The envelopeValue is the highest reading recorded, then subtracted by one every time a reading isn’t equal to or greater than it.

int envelopeValue;

ISR (TIMER1_COMPA_vect) {
    int reading = analogRead(channel);
    envelopeValue = (reading >= envelopeValue) ? reading : envelopeValue - 1;
}

void NeuroBoard::setTriggerOnEnvelope(const unsigned int& threshold, void callback(), const unsigned int& secondFactor=0) {

    // TODO: Call callback when passed threshold is met by envelope value.

    const int THRESHOLD_SCALE_FACTOR = threshold / 10;
    int secondThreshold = secondFactor;

    if (secondFactor == 0) {
        secondThreshold = threshold - THRESHOLD_SCALE_FACTOR;
    }

    if (envelopeValue >= threshold) {
        if (!this->thresholdMet) {
            this->thresholdMet = true;
            callback();
        }
    } else {
        if (envelopeValue <= secondThreshold) {
            this->thresholdMet = false;
        }
    }

}

Note: Because this code is for an Arduino, I cannot use any standard library functions or imports. However, because this section of our code is pure c++, I don’t think it will be an issue. But please consider that if you decide to write an answer. Thanks!

office 365 – Sharepoint online list view threshold reached on execution of a caml query

I am having a hard time understanding how a caml query fetches data from a SPO list.
Currently, i have set up a client context on an CSOM console application and i am trying to upload a csv file onto a SPOList.
The requirements of the project is that i check wether the entry has already passed, in which case i simply delete and insert the new entry, based on a FilenetID hex code.
I get the error “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.” right at the moment that a CamlQuery is initialised, loaded on the client context and executed.
Setting up a Logging action showed me that the error above started displayig once the limit 5k list items was reached and at the moment i cannot insert any more new entries.
My CamlQuery is the below:

CamlQuery query = new CamlQuery
            {
                ViewXml = String.Format("@<View><Query><Where><Eq><FieldRef Name="FilenetID" />" +
            "<Value Type="Text">{0}</Value></Eq></Where></Query><RowLimit>10</RowLimit></View>", filenetID)
            };
var existingMappings = SpList.GetItems(query);
ClientContext.Load(existingMappings);
ClientContext.ExecuteQuery();
return existingMappings.FirstOrDefault();

The entries based on the FilenetID are unique, meaning that the CamlQuery above must return only one row.
I even tried to set the RowLimit attribute but still i get the same error.
My next step will be to index the column in question, but i would like to ask a question so that the community could please clarify upon the subject so that i could grasp a better understanding.
Have you guys faced any of the above problems?

SharePoint 5000 List View Threshold Limit Issue in CSOM

I have an issue with Sharepoint CSOM when I am trying to get subfolder with the following code

public void LoadFolders(Folder folder, SharePointFolder sharePointFolder)
{
  Context.Load(folder.Folders);
  Context.ExecuteQuery();

  foreach (var subFolder in folder.Folders)
  {
    var subRootFolder = new SharePointFolder(sharePointFolder, subFolder);
    sharePointFolder.SubFolders.Add(subRootFolder);
  }
}

I get the error below when trying to load subfolders of a folder that has an itemCount of more than 5000.

Microsoft.SharePoint.Client.ServerException
  HResult=0x80131500
  Message=The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.
  Source=Microsoft.SharePoint.Client.Runtime
  StackTrace:
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
   at ..SharePointApi.SharepointSdkAccessMethod.LoadFolders(Folder folder, SharePointFolder sharePointFolder) in ....SharePointApiSharepointSdkAccessMethod.cs:line 435
   at ..SharePoint.ViewModels.SharePointFoldersViewModel.<>c__DisplayClass30_0.<GetFolderAsync>b__0() in ....ViewModelsSharePointFoldersViewModel.cs:line 183
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

Is there a way to resolve this issue or a CamlQuery that can give the same result as my function above?

2010 – List view threshold – Why is querying with key filters still possible without having an indexed field

I read a lot about the list view threshold topic, so I know, that it should not be increased, if you have large list. In short, as far as I read, it is recommended to create an index on a column and filter the view to this index.
We have currently the issue, that we are using multiple managed metadata fields and values to narrow down the list, but it is not possible to create an index on a managed metadata field, where multiple entries are allowed.
So our CAML query fails, if the list has more entries than specified in the list view threshold value (and because we are not querying a field with an index).

See these links for more info:

https://www.codeproject.com/Articles/1076854/Overcoming-the-List-View-Threshold-in-SharePoint-C

https://social.technet.microsoft.com/Forums/Lync/en-US/a4c28a29-a127-43da-8f33-23e77fbc7188/list-view-threshold-and-managed-metadata-fields-with-multiple-values?forum=sharepointgeneralprevious

But my question is now, why is it still possible to use the key filters in the library itself?
So there must be a way to query the list with managed metadata fields even when the threshold is exceeded and there is no index created.

enter image description here

Does anybody know, how the key filters work in the library?
Many thanks in advance!

linux – Multi user full disk encryption – larger than 8 user threshold. i.e. Not luks

I know Luks has a maximum of 8 I need something that does what LUKS does but allows multiple keys more than the maximum of 8.

All users will need to be able to access root.
It will be used regularly by multiple different users but not simultaneously.

I have looked at loads of different encryption tools but they do not seem to have any multi user system that does what I need, unless I’ve glossed over something.

magento2 – How to use the Out-of-Stock threshold option?

You can use a negative amount in order to have more salable items than you really have in stock.

Out-of-Stock threshold

Use a negative value for this threshold to set the maximum amount of products that can be backordered before the product is truly considered out of stock. This amount adds to the salable quantity. The value set at the product level overrides any value set at the global level.

The formula for the Salable Quantity is (Quantity – (Out-of-Stock Threshold)).

The following is an example:

Quantity: 25
Notify for Quantity Below: 10
Only X left Threshold: 5
Out of Stock Threshold: -50

The Salable Quantity for this product is 75 (25 – (-50)).

Magento 2 The Salable Quantity
Example Salable Quantity before backorders enabled

Magento 2 The Salable Quantity
Example Salable Quantity after backorders enabled

When customers purchase more than 25 products, new orders enter as backorders. As the product’s Salable Quantity reduces to 5 (70 items have been sold), the Product page will display a message Only 5 left on the storefront. When the Salable Quantity reaches 0, the product is displayed as Out of Stock in the storefront.

Reference: Magento 2 DevDocs – Out-of-Stock threshold

Can I defer levelling up after reaching the XP threshold?

As a rogue, I’ve gained enough XP to level up to level 3. However, I’m not yet ready to pick what archetype would fit best for me.

Despite having gained enough XP, can I wait until later to level up my character?

I’m looking for rules to back me up, especially if it explicitly states that I don’t need to level up immediately upon acquiring the XP threshold.

plugins – disabling big image threshold is also disabling image rotation

Recently I started getting the below error when uploading images to my media library on wordpress –

Post-processing of the image failed likely because the server is busy
or does not have enough resources. Uploading a smaller image may help.
Suggested maximum size is 2500 pixels.

As a solution I installed the plugin – Disable “BIG Image” Threshold. I use imageoptim for optimising my images on my laptop before uploading to wordpress, so I am ok with disabling the auto scaling of my images by wordpress.

Internally this plugin is doing the below –

add_filter( 'big_image_size_threshold', '__return_false' );

But I noticed that this is also disabling rotating of my images. The images that I clicked in portrait mode are not being rotated and shown in the media library. Did anyone else face the same issue and what was the solution for this?

trains – Speed and acceleration threshold for different transportation mode in urban area

I am working on machine learning and data science in relation to transportation system. Currently, I am working on transportation mode detection for people mobility in an urban area, essentially using people’s GPS traces.

So I need a scientific backing to what is acknowledged as the maximum threshold of speed, acceleration, and if possible jerk for these transportation modes: foot, bike, bus, car, metro.

I read in this papers where the authors, uses the following as the maximum values:

+--------------------+---------------+----------------------+
| transportation mode| maximum speed | maximum acceleration |
+--------------------+---------------+----------------------+
| walk               |             7 |                    3 |
| bike               |            12 |                    3 |
| bus                |            34 |                    2 |
| driving            |            50 |                   10 |
| train              |            34 |                    3 |
+--------------------+---------------+----------------------+

However, my supervisor did not agree with me using these values as a threshold in my current work because the authors did not mention explicitly the source of their reason for this decision, they just stated that

” Using several reliable online sources and the engineering justification (e.g., existing
speed limits, current vehicle and human’s power), the speed and acceleration thresholds are designated ..”

Can I have a pointer to some sources that suggest thresholds for these motion features with a city so I can back up my claim and explain it to my supervisor?

international travel – Self-isolate if my home country rises above threshold while I’m in Latvia?

The current regulations to enter Latvia from another EU country mandate that I have to self-isolate for 14 days on arrival if the country I am coming from has had more than 16 new Covid cases per 100k inhabitants in the past 14 days; the infection rates for each country are updated every Friday and are valid for the successive week.

Suppose that my country of origin is below the threshold when I enter Latvia, but gets above the threshold in the next update the following Friday, while I am already inside Latvia.

Do I have to report myself to the authorities and self-isolate? Or is that requirement only checked when I enter Latvia?