mysql – #1235 – This version of MariaDB doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’

I have a table with several “categories”, called collection (e.g. A, B, C, …).

I would like to create a SQL query to select N records by each collection.

For example:

I would like to select 2 records by each collection.

Table stac_item:

id | collection | name
1  | A          | name_01
2  | A          | name_02
3  | A          | name_03
4  | B          | name_04
5  | B          | name_05
6  | B          | name_06
7  | B          | name_07
8  | C          | name_08
9  | C          | name_09

I expect the following result:

id | collection | name
1  | A          | name_01
2  | A          | name_02
4  | B          | name_04
5  | B          | name_05
8  | C          | name_08
9  | C          | name_09

I have created the SQL query below, but MariaDB gives the following error message:

#1235 - This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

SQL query:

SELECT * 
FROM stac_item a1
WHERE a1.collection IN
(
    SELECT a2.collection 
    FROM stac_item a2 
    WHERE a1.collection = a2.collection 
    LIMIT 2
)

Would anyone know an alternative that I could use? I have searched on the internet, but I was not able to find a solution.

Thank you.

EDIT 1:

I use the following MariaDB Docker image: mariadb:10.5.3

Is there any better alternative to limit or stop order in crypto exchanges?

I have somewhat understood both limit and stop orders at some exchanges, even executed some similar order types but I am still looking a way to execute an order based on target volume of a coin (say to buy)…for eg.

I wish to buy a volume (say 100) coin B by selling coin A (both are highly volatile) now in limit order I can set to sell A at certain price so that it results in 100 B OR trigger it to sell at price point as in stop-limit (not much of a use here).

But this sometimes take time to fill the order…I wish to buy 100 B if either B goes down or A goes up so that the volume purchased remains at 100 B irrespective of ups and downs of both the coins…

Is this possible in any exchange by combining orders or by using a new order type introduced in any of the exchanges?

Transaction size limit across a single path in a Lightning Network and fee earned

Given MPP is included in the current version of lnd, an arbitrarily large transaction can be processed in the network. What is the transaction size limit across a single path? Is it still bounded to 0.0429 BTC (limited by max_concurrent_htlc)? What is the estimated fee earned (average as well as maximum) by a lightning node per day?

brownian motion – Limit of an integral / Boundary behaviour of a Gaussian convolution / single layer potential

Let $k(t,x)$ be the transition density of Brownian motion $$ k(t,x) := frac{1}{sqrt{2 pi t}} exp left{ frac{-x^2}{2t} right} , quad t geq 0, x in {mathbb R.}$$

Question
Let $0 < x < a$. Show that
$$ lim_{x nearrow a}int_0^t frac{a-x}{s} k(s,x-a)k(t-s,a)ds = k(t,a).$$
Can someone offer some intuition as to why this is true?

calculus and analysis – question on correct use of Limit for multivariable function

V 12.1 on windows.

This limit $lim_{(x rightarrow 0,yrightarrow 0)} frac{x^2-y^2}{x^2+y^2}$ depends on the direction. So the limit does not exist, or could be written as Maple does it, which is $-1dots1$, here is the help from Maple on this:

enter image description here

How can one get Mathematica to give this result? Now Mathematica says the limit is $1$. I tried the Direction option but not able to make it change its mind.

f = (x^2 - y^2)/(x^2 + y^2);
Limit(f, {x -> 0, y -> 0})
(* 1 *)

But we see the limit depends on the direction

 Limit(Limit(f, x -> 0), y -> 0)
 (* -1 *)

 Limit(Limit(f, y -> 0), x -> 0)
 (*  1 *)

Here is also Maple to confirm

restart;
f:=(x^2-y^2)/(x^2+y^2);
limit(f, (x=0,y=0));

enter image description here

Btw, this is not the only one I found, here is another

f = (x^2*y^2)/(x^4 + y^4);
Limit(f, {x -> 0, y -> 0})
(* 0 *)

Maple gives

restart;
f:=x^2*y^2/(x^4+y^4);
limit(f,(y=0,x=0))
  (* 0 .. 1/2 *)

And another one (this one is from youtube actually, so you can see they also say there the limit does not exist)

f = (x^4 - 4 y^2)/(x^2 + 2 y^2);
Limit(f, {x -> 0, y -> 0})
(* 0 *)

restart;
f:=(x^4-4*y^2)/(x^2+2*y^2);
limit(f, (x=0,y=0));
(* -2 .. 0 *)

So I have feeling I am not using Limit in Mathematica correctly, or missing something about its correct use, but do not now know how to correct it. As I said, I tried different Direction option.

Does a dark default style limit potential? | Forum Promotion

On my upcoming forum I plan on adding both a dark and light style but I am contemplating on which should be the default style, which raises a very good question for all webmasters.

Although more websites are adopting a dark default design, traditionally it is thought that a light default design is more user friendly than the former. First impression is crucial to a site’s growth – it ultimately decides how many one-off visitors stick around, so the question I am posing is: are you limiting your site’s potential by using a dark default design?

performance – Rate limit a method by generating particular load on demand in C#

I am working on a project where I want to generate random throughput on a particular method so that I can do some performance testing on it. This way I can test my method by generating random throughputs and see how my method works under all those scenarios.

For example: I need to call my doIOStuff method at an approximate rate of x requests per second from multiple threads where x will be less than 2000 mostly but it really doesn’t matter in this case. It doesn’t have to be accurate so there is some room for an error but the overall idea is I need to make sure that my method doIOStuff is executed no more than x times in a sliding window of y seconds.

Assuming we start n threads and want a maximum of m calls per second. We can achieve this by having each thread generate a random number between 0 and 1, k times per second and call doIOStuff method only if the generated number is less than m / n / k.

Below is the code I got which uses global variables and it does the job but I think it can be improved a lot where I can use some cancellation tokens as well and make it more efficient and clean.

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;


namespace ConsoleApp
{
    class Program
    {
        const int m_threads = 100;
        const int n_throughput = 2000;
        const int k_toss_per_second = 2000; // Note that k_toss_per_second x  m_threads >= n_throughput

        static void Main(string() args)
        {
            var tasks = new List<Task>();

            for (int i = 0; i < m_threads; i++)
                tasks.Add(Task.Factory.StartNew(() => doIOStuff()));

            Task.WaitAll(tasks.ToArray());
            Console.WriteLine("All threads complete");
        }


        static void callDoIOStuff()
        {
           int sleep_time = (int) (1000 * 1.0d / k_toss_per_second);
           double threshold = (double) n_throughput / m_threads / k_toss_per_second; 
           Random random = new Random();
           while (true) {
                Thread.Sleep(sleep_time);
                if (random.NextDouble() < threshold)
                    doIOStuff();
            }
        }

        static void doIOStuff()
        {
            // do some IO work
        }
    }
}

I wanted to see what can we do here to make it more efficient and clean so that it can used in production testing for generating random throughput load.

real analysis – Example of compact operator which has eigenvalues with 0 as limit point

I was reading Fredholm alternative which has following consequence

A compact linear mapping T of normed linear space into itself possesses a countable set of eigenvalues having no limit point except possibly 0. Each Nonzero eigenvalue has finite multiplicity

I wanted to find example of compact operator which has eigenvalues with limit 0

Any Help will be appreciated

Design of a single microservice, size limit?

I’ve been struggling for a while of what would be the “recommended” approach for a microservice itself.

There are quite of top architecture designs that are the holy sacred for a lot of craftsman devs, such as CQRS, Hexagonal, DDD, etc…

But from my point of view, depending of how “big” is the microservice, because you know the word itself it’s giving you a hint… “micro”!!

Should I consider build all the packages, interfaces, divisions between layers such as Hexagonal, or split the content of the microservice based on DDD (its supposed that 1 microservice its 1 domain??? if not… 😐 kind of WTF??)

Or just keep it on its essence like split the entrypoints(rest,queues)-core(business logic)-outpoints(DB,queues, or whatever) and let it open for a “little” extension.

If its too big, think on a split? In order to avoid “minimonolits” and what would be the limit to consider an “app”/API a microservice or a little monolit?

Maybe to be more clear.

i.e:

Microservice/API
├── Product
│   └── DDD/CQRS/Hexagonal stuff
|       └── ....
├── Sells
│   └── DDD/CQRS/Hexagonal stuff
|       └── ....
└── Customer
   └── DDD/CQRS/Hexagonal stuff
       └── ....

Microservice with basic crud -> Product-Sells-Customer(with patterns such as CQRS, Hexagonal, etc…?) -> Its a minimonolit for me.

The kind of what I look forward…

Gateway microservice
├── Product
│   └── routing stuff
|       └── ....
├── Sells
│   └── routing stuff
|       └── ....
└── Customer
   └── routing stuff
       └── ....

Product

Product Microservice
├── Product
   └── Basic separation layer(REST/SERVICE/ORM-QUEUE)
       └── ....

Sells

Sells Microservice
├── Sells
   └── Basic separation layer(REST/SERVICE/ORM-QUEUE)
       └── ....

Customer

Customer Microservice
├── Customer
   └── Basic separation layer(REST/SERVICE/ORM-QUEUE)
       └── ....

The previous ones should have patterns such as CQRS, Hexagonal, etc…???