[ Politics ] Open Question : If movies had equal amount of racial diversity in lead roles, can this help to reduce racism or is racism causing lack of racial diversity?

Back in the day, blacks had to sit in separate seats from whites at the movies. We’ve come a long way. We still hear about the lack of racial diversity for lead roles and during the oscar so white controversy, Will Smith said to Robin Roberts that he would’ve liked to have left a legacy when he retires to see a diverse range of lead actors. He felt disappointed that wasn’t going to happen. @blu, I don’t mean just blacks but rarely we see asians, hipsanics, middle eastern actors etc etc repreresented as heroes. @I hate commerce, you’re talking about segregation, I already mentioned we already went through that. @blu, I already have but there are actors like Scarlett Johansson that insist she can portray anyone she wants and had a backlash for portraying a Japanese character and also about a transgender person in which she had to cancel due to the lgbtq complaints. Many people didn’t like Christian Bale as Moses and it was controversial with white actors for leads in a middle eastern story. @I hate commerce, you’re so lost then. @blu, I guess what I’m saying is that minority’s especially asians feel they don’t have a place in Hollywood and they’re easily made fun of. *minorities

What is the minimal degree $d$ required for a B tree with $44*10^6 $ keys so that it’s height is less than or equal to $5$

What is the minimal degree $ d$ required so a B – tree with $ 44*10^6$ keys will have a height $ h$ , such that $ h\leq 5$

My attempt was to build the tallest tree possible with minimum degree $ d$ and $ n = 44,000,000$ keys and then solve for $ d$ . That would mean any other tree with a minimal degree $ d’$ such that $ d’\geq d$ and $ n$ keys will be shorter than the one I built:

at depth 0 , we have the root and that’s $ 1$ node

at depth 1, we got exactly $ 2$ nodes

at depth 2, since we’re going for the tallest tree each node will have a minimal number of keys so $ d-1$ keys each, that means $ d$ children each so a total of $ 2d$ nodes.

at depth 3, following the same reasoning , $ 2d^2$ nodes.

at depth $ h$ , there are $ 2d^{h-1}$ nodes

total number of keys is :

$ n = 1+ (d-1)\sum_{k=0}^{h-1} {2d^k} = 1 + (d-1) \frac{2(d^h-1)}{d-1} = 2d^h-1 = 44*10^6 $


$ 2d^5-1=44,000,000 $

$ d= 29.4 $

$ d\geq 30$

is that even correct ?

Segment 3d mesh into multiple 3d meshes with equal size

Given a 3d mesh, for example the stanford bunny, how can I segment the mesh in a way that each segment has a roughly equal size between them? Assuming the target number of segments is given as an input.

To keep things simple, let’s start with assuming the vertices are uniformly distributed in the mesh, therefore the problem can be simplified to segmenting the mesh so each segment has roughly the same vertices.

I’ve seen methods like finding a bounding box of the mesh, and divide the bounding box uniformly and segment the mesh based on that. But the problem with this method is the size of each segment can be quite different if the shape of the original mesh is irregular.

I’ve also seen a method based on Shape Diameter Function, but again the size of each segment can be different depends on the original mesh.

The problem is I am not sure what’s the right keyword to look up on Google to see what’s being done in the literature. I would appreciate any pointers.

Why values can not be replaced with their extensionally equal values in an intensional system?

Thomas Streicher states in Investigations into Intensional Type Theory(Β§Introduction p.5) that:

Although in Intensional constructive set theory (Intensional Type Theory) one can do most of the things one wants to do… certain theorems simply do not hold due to the lack of extensionality. A typical example is that from $ t\in B a$ and $ p\in Id A ab$ one is not allowed t conclude that $ t\in Bb$ where $ A$ is a type and $ B$ is a family of types indexed over $ A$ .(But of course one is allowed to infer $ t\in Bb$ from $ t\in Ba$ and $ a=b\in A$ !)

An almost similar thin is mentioned in Definition of extensional and propositional equality in Martin-Lof extensional type theory :

The (Id-DefEq) means that extensional equality is baked into the type system: if you have a type constructor 𝑇:((π‘₯:π‘ˆ)→𝑉)→𝖲𝖾𝗍 then you can use a value of type 𝑇 𝑓 in a context expecting 𝑇 𝑔 if 𝑓 and 𝑔 map equal inputs to equal outputs. Again this is not true in an intensional system, where 𝑓 and 𝑔 might be incompatible if they’re syntactically different.

Why is that? Isn’t it that two functions that are producing exactly same output for their inputs, equal? So why can’t one be replaced with another in a context? What makes definitionally equal functions eligible to be replaced with each other, but not the extensionally equal ones?

Given a sequence of integers $A_1,A_2,A_3 ……A_n$ , find number triples giving equal xor?

For giving sequence $ A_1,A_2,A_3 ……A_n$ , find number of triples $ i,j,k$ such that $ 1<=i<j<=k<=N$ and $ A_i + A_{i+1} + … A_{j-1} = A_{j} + A_{j+1} ….. A_{k}$ .Where $ +$ is bitwise xor operation .

I tried to solve it using dynamic programming somewhat similar to https://www.geeksforgeeks.org/count-number-of-subsets-having-a-particular-xor-value/ , but it’s time complexity if $ O(n*m)$ , where m is maximum element in the array .Can we do better than $ O(n*n)$ or $ O(n*m)$ ?

Finding the Max Sum less than or equal a fixed number using Dynamic Programming

I have an array of category Name and it’s weight, fixed number W, I need to get the sequence of categories that gives me the Max weight <= W.

I Can solve it recursively by maximizing between (take the category or leave it) but i don’t know how to switch this approach to the Dynamic programming 2D table.

For example:

w: 50

A: [{c1,51},{c2,30},{c3,15},{c4,10},{c5,10}]

Output: [c2,c4,c5]

The total weight of (c2+c4+c5) = (30 + 10 + 10) = 50

w: 50

A: [{c1,50},{c2,30},{c3,15},{c4,10}]

Output: [c1]

The total weight of c1 = 50

w: 50

A: [{c1,30},{c2,10},{c3,15},{c5,15}]

Output: [c1,c3]

The total weight of (c1+c3) = (30 + 15) = 45

Are REST Resources and GraphQL Object Types conceptually equal?

I’m in the process of outlining the intended business logic of a web service. At this point, I’m not too concerned with implementation details. On the contrary, I’m looking for ways to abstract them away in order to describe the business logic and data exposed by the web service in an implementation-agnostic manner.

I’ve read a little about the fundamental principles behind REST and GraphQL. RESTful services expose resources. GraphQL exposes data using Object Types.

These concepts share some core characteristics:

  • they describe ‘things’ (entities) with attributes
  • ‘things’ can be related to other ‘things’
  • ‘things’ support a uniform interface to interact with them: retrieval, insertion, mutation and deletion (at least to some degree; I’m not familiar with mutations in GraphQL)

I might be mixing up some terms, but am I overall correct in thinking both are conceptually equal or at least very similar?

Is the omission of implementation details from the documentation an adequate means of ‘bridging the gap’ between the two (and possible future variations)?

Are there standards for documenting the ‘things’ and the behaviour of their supported operations in an implementation agnostic manner?

Why is the number of swaps done by bubble sort to sort the queue not equal to the number of bribes?

I was going through this challenge on HackerRank. The reason I’m asking this here is that at the heart of it, it’s basically a CS question.

It’s New Year’s Day and everyone’s in line for the Wonderland rollercoaster ride! There are a number of people queued up, and each person wears a sticker indicating their initial position in the queue. Initial positions increment $ 1$ by $ 1$ from at the front of the line to $ n$ at the back.

Any person in the queue can bribe the person directly in front of them to swap positions. If two people swap positions, they still wear the same sticker denoting their original places in line. One person can bribe at most two others. For example, if $ n=8$ and $ \text{Person 5}$ bribes $ \text{Person 4}$ , the queue will look like this: $ 1, 2, 3, 5, 4, 6, 7, 8$ .

Fascinated by this chaotic queue, you decide you must know the minimum number of bribes that took place to get the queue into its current state!

Now, my approach to this problem was to first check if the current queue is “chaotic”: we start from the end of the array $ A$ . If $ A_i$ is not equal to $ i$ , where $ 1\leq i \leq n$ , then we know that the last element must have bribed and moved towards the left since it cannot move to the right being the last element. Also, we know that it will be present either in position $ i-1$ or $ i-2$ . This is because if it is in the position left to, he must have bribed more than 2 people.

If the queue is not chaotic, I applied the bubble sort technique to count the number of swaps required to sort the list. This I thought would equal the minimum number of bribes. However, this approach does not pass all the test cases; any idea why?

How to split Aggregate Root that have equal identity?

In DDD, creating smaller aggregates is encouraged where possible, but in a system we are designing we are running into an issue regarding the identity of aggregates.

The system evolves around phyisical events, like music festivals or sports events, and within these events there are separated bounded contexts representing some business use case. For example, there can be Accreditation and Badges.

Solution One

In a first design of the system we had modeled an Event aggregate (see Figure 1), where all business logic around Accreditation, Badges, and future business use cases would live.

enter image description here

Figure 1: Event aggregate

Solution Two

However, this would result in a huge aggregate, so we decided it would be best to split these up into smaller aggregates (see Figure 2). Events itself was no longer a concept because we had split these up into separate Accreditation and Badges. However, because they all refer to the same physical event, they only identifier we could come up with was the same eventId.

Implementing this with event sourcing would also raise the issue that there are multiple event streams with the same identifier.

enter image description here

Figure 2: Split aggregates with shared identity.

Solution Three

Another solution would be the “natural” DDD approach where we would tread the different modules as Entities with their own identity (see Figure 3). This however, feels very unnatural and does not represent the actual domain logic. In the implementation we would therefor also need a lookup table of some sort to map the eventId to the required moduleId (see Figure 4).

enter image description here

Figure 3: Split aggregates with own identity.

enter image description here

Figure 4: Lookup table that maps the event to their modules.


The question in this case is which of the following solution seems the most efficient and DDD-like approach?

SharePoint REST query select items where column values are not equal

What is the REST query to obtain all items from a list where the value of two different columns for a given item are different.

Take the query: http://<site_collection>/_api/web/lists/getbytitle(<list_name>)/items?$ select=ePR_x0020_NameId,ePurchaseRequestName&$ filter=(ePR_x0020_NameId ne ePurchaseRequest)

ePR_x0020_NameId is a lookup column with the title “ePR Name”. How do I properly use the $ expand parameter to get the text of this column rather than the numeric value that is returned?

The query

http://<site_collection>/_api/web/lists/getbytitle(<list_name>)/items?$ select=ePR_x0020_NameId,ePurchaseRequestName

returns ePR_x0020_NameId as numeric value, not the string that is in the lookup column.

So when I try to add a filter parameter to this query to return only items where “ePR Name” and “ePurchaseRequestName” are not equal, I get a “The webpage cannot be found”.

What is the proper REST query to return items where the column values “ePR Name” and “ePurchaseRequestName” are not equal?