download – Why streaming service web apps won’t implement an offline downloading of the content yet, in the browser?

Not really fully knowledgeable to web development, just curious and asking.

Why won’t Netflix (and other streaming service website, web apps like Disney+, HBO Max and Apple TV+) won’t develop an offline downloading feature on their web apps yet.

Is that currently technically infeasible right now based on the current web, DRM, platforms, browser standards & tech right now? Or can it be done?

Like storing encrypted DRM content on web app storage right on the device? For offline or later use? Password Managers can currently do this right?

Also, is it the same situation with these streaming service TV apps as well, which is mostly prepacked HTML5 / React web app on these Smart TV platforms?

So is it a technical hindrance question right now, or just a

algorithms – How to find diffrenet ways to implement merge and delete_min operation in binomial heap?

I have searched on the internet to find different ways to learn binomial heap operations. What I have found is not quite helpful for me.For example, for delete min operation the algorithm says:

  1. Search through the roots of binomial trees and find the smallest key and call it x.Remove the x from the tree.
  2. Create a new empty heap H’.
  3. Reverse the order of x’s children and set the head of H’ to point to the head of the resulting list.
  4. Merge H’ with H.

enter image description here
On paper everthing seems logical and understandable. I also use some visualization websites-like this- to see how things work yet when it comes to coding -especially with C- things start to be seen harder. I could find some codes written in C and I also used them in my projects but I am not satisfied since I couldn’t understand them fully.Writing and using these algorithms makes me feel inadequate for my future job.

Also for other algorithms I don’t know how to understand algorithms and put them in code-I don’t even know how these things will help me in 21st century’s corporate world-.

My questions is how should I approach these powerful algorithms and use them?

c# – How to implement IPC at the local machine without parent-child model?

I’m trying to exchange some small data between my two apps. This two apps located at the same PC, so all exchange happens inside this machine. At first, I thought maybe to use sockets for it, cause I had some small experience with it, but then I read some articles that said that it’s not the best practice for it, cause all exchange happens at the same local machine, so don’t need to use network solutions for such task.

And then I learned about anonymous pipes. From descriptions and examples it’s looks liked the best for my case. But then turns out that this is all about parent-child model, so one(parent) app have to open another one(child) and pass data about pipe through constructor of child app. And this is not fit for my case, cause I want that my two apps would be totally independent, like they could close anytime separately, and then reopen again any time and after that continue data exchanging.

So how do you think, what would be the best for my case? Should I back to sockets? Or maybe anonymous pipes is also not always about parent-child model and maybe I just missed something?

design and implement a hybrid crypto system that involves 3DES and RSA

  1. RSA must be used at the beginning to securely exchange the session keys of
    3DES between Alice and Bob.
  2. 3DES must be used for encryption/decryption of the exchanged data.
  3. OFB should be used as a mode of operation to transfer the blocks of data in
    3DES.
    You can use any programming language of your choice such as Java, C, Python, MATLAB,
    etc.

unity – How to Implement One-Way Slopes?

I am working on a 2D platformer in Unity and am doing my own collision detection.

I was previously using the method described in Sebastian Lague’s popular YouTube tutorial, where you break your velocity into its horizontal and vertical components, then cast a series of rays horizontally and vertically from some skin_distance within the characters bounding box, checking for collisions. The length of the raycasts is the length of the velocity component plus the skin_distance. If any of the rays collide, you curtail the ray length and continue to iterate through the remaining arrays, until you’re out of arrays, at which point you set the velocity to your final ray length (minus skin_distance).

This method works well enough, and Sebastian’s tutorials even extend the method to solid slopes.

I want one-way slopes, however. One-way slopes are slopes that you can jump up through from underneath to land on them from above.

I’ve been at it for a week now, and I can’t seem to extend Sebastian’s method to work for them.

I’ve tried several things. First, I’ve represented the slopes & my flat one-way platforms as line segments using EdgeCollider2Ds. Then, I created methods for OneWayHorizontalCollisionDetection() and OneWayVerticalCollisionDetection(). The former checks if a velocity-lengthed horizontal ray from the bottomleft or bottomright point of the character’s bounding_box intersects a slope. If it does, x-vel and y-vel are adjusted to snap the character onto the slope and move the character up the slope.

In the latter, for jumping up through the slope, if my character is ever moving down and one of its vertical rays hits the slope, I check to make sure the correct bottom corner point is also above the slope. If it is, then I’d curtail the velocity so the character landed on the slope properly (see diagram below).

No matter how much I try to massage things, however, I always encounter an issue.
Part of the problem with this method, I think, concerns an asymmetry with vertical detection versus horizontal detection.

Consider the below diagram. When doing vertical collision detection, if my character is falling and the green point in the bottom right corner is above the slope, and the ray intersects, I’ll move the char down so that green point is flush with the slope. The character sits nicely on the slope and everything seems fine.

enter image description here

If I then press right to start moving up the slope, my horizontal collision detection will see the slope on the right, and snap the green point on the right side of the character to the slope. The character will then move up the slope just fine. If I then stop moving, however, because the bottom green point is now below the slope, the character will fall through the slope.

Even trying to massage by way around this problem, I’ve encountered a whole host of other issues, particularly at the point of transition from the slope to the flat platform at the top. Issues with floating point imprecision interfering with is point.y >= point2.y complicated matters even more.

I’ve come to think this “skin distance raycast” method is not the correct way to proceed if I want one-way slopes. I am simply running into too many issues.

I tried converting my system to use boxcasts of my character’s BoxCollider2D, but it didn’t pan out.

Then, I tried to move back to raycasts, but I tried casting them at the true corners of my bounding_box, rather than some skin width inside. I didn’t make much progress there either, though my gut tells me using true corners is going to be the most elegant way to implement one-way slopes. At least using true corners, you know exactly which point you want to be snug on the slope.

So, my question is, what is a viable collision detection paradigm for one-way slopes? Could anyone sketch for me what an implementation of one-way slopes would looks like?

I know there’s dozens of questions about slope collision detection, but I have yet to find a single one which specifically mentions one-way slopes (which seems to be a harder problem).

NOTE: I am open to both solutions that put the bounding box bottom corner on the slope, as well as those that put the bounding box’s midbottom point on the slope, though I would prefer the former. I am only trying to accommodate 22.5-degree slopes.

python – Inheritance vs composition: How would you implement an “unordered list”? Subclass of list, or composition?

This came up at work and left me thinking about the best way to model this:

In Python, we have the built-in list container, which is a mutable sequence. Equality between two lists is defined as equality of all items in the list, in their respective positions.

Now a colleague felt the need to define a type that’s a list for all practical purposes, except that two lists should be considered equal if they contain the same elements, in the same quantities, but in arbitrary order. Basically,

unordered_list_1 = UnorderedList((1,2,3))
unordered_list_2 = UnorderedList((3,2,1))

unordered_list_1 == unordered_list_2 # True!

The colleague solved this by inheriting from list and overriding the __eq__ special method:

class UnorderedList(list):
  def __eq__(self, other):
    if isinstance(other, UnorderedList):
      return ordered(self) == ordered(other)
    else:
      return NotImplemented

In this form it runs into a gotcha, because the builtin python types such as list take some shortcuts with their special methods; the not-equal __ne__ special method does not just fall back onto the __eq__ special method, so you get the funny scenario where two of these unordered lists can both be equal and not equal.

I suggested inheriting from UserList instead, which is meant to be subclassed, or maybe from one of the collections.abc abstract base classes. Another colleague chimed in with the familiar “Favor composition over inheritance” advice.

I feel that composition in this case would lead to a lot of boilerplate delegation code:

class UnorderedListUsingDelegation:
  def __init__(self):
    self._list = list()

  def __eq__(self, other):
    if isinstance(other, UnorderedListUsingDelegation):
      return ordered(self._list) == ordered(self.other._list)
    else:
      return NotImplemented

  def append(self, item):
    self._list.append(item)

  # Basically def every method implemented by class list and write delegation code for it:
  # pop, push, extend, __getitem__, __setitem__ and so on

So from that consideration, I feel like inheritance is exactly right here: A teeny tiny specialization of behavior.

But on the other hand: Is the UnorderedList actually substitutable for the list class? Not so sure here. If you do “normal” list operations, then you shouldn’t notice whether you are using an instance of the list class or of the UnorderedList class. Inserting and retrieving of elements works just fine. On the other hand, you might get unexpected behavior when comparing lists:

list1 = UnorderedList()
list2 = UnorderedList()

list1.append(1)
list2.append(3)

list1 == list2 # False

list1.append(2)
list2.append(2)

list1 == list2 # False

list1.append(3)
list2.append(3)

list1 == list2 # True!

I guess what I’m after is some clarity on how broadly or narrowly the Liskov substitution principle should be applied. Or maybe the solution is something altogether different. Maybe we shouldn’t put such a “hack” into the __eq__ special method and rather be explicit about what we’re doing, by writing a function like

def sorted_equal(a, b):
  return sorted(a) == sorted(b)

I assume the colleague is working with some framework that expects to be working with list objects but wants to inject this special way of comparing lists.

How to efficiently implement a 7-segment display?

I want to construct a 7 segment display (as shown below). When you input a number, the script will read the input number and light up the respective segment
(change the spriterenderer color to red) to display the number.

But I think the code has become too long, since there is 0-9 digit to display, I need 10 if statements, 8 scripts and the function of each statement is to light up the respective segment so it displays the number correctly.

Is there any better way to make the code shorter?

using UnityEngine;

public class ClockController :  MonoBehaviour
{
    Rect1 rect1;
    Rect2 rect2;
    Rect3 rect3;
    public GameObject othergameobjectrect2;
    public GameObject othergameobjectrect3;

    void Start()
    {
        int x = 1;
        if (x == 1)
        {
            rect1 = GetComponent<Rect1>();
            rect1.Rectangle1();
           
            rect2 = othergameobjectrect2.GetComponent<Rect2>();
            rect2.Rectangle2();

            rect3 = othergameobjectrect3.GetComponent<Rect3>();
            rect3.Rectangle3();

        }
    }
}
using UnityEngine;

public class Rect3 : MonoBehaviour
{
    public void Rectangle3()
    {
        GetComponent<SpriteRenderer>().color = Color.red;
        
    }
}
using UnityEngine;

public class Rect2 : MonoBehaviour
{
    public void Rectangle2()
    {
         GetComponent<SpriteRenderer>().color = Color.red; 
    }
}
using UnityEngine;

public class Rect1 : MonoBehaviour
{   
    public void Rectangle1()
    {    
        GetComponent<SpriteRenderer>().color = Color.red;    
    }
}

enter image description here

coding standards – Does a third-party module need to implement hook_help()?

After having spent hours reading through (very old) coding standards and best practices threads on drupal.org, and even trying to revive the Contrib Development Best Practices group on groups.drupal.org which seems to having been abandoned for years, I’m still struggling to getting an answer to whether a third-party module needs to implement hook_help() to comply with the Module Documentation Guidelines or not.

Above guidelines state

All but the most trivial modules should implement hook_help().

Yet, should is not must, which sometimes leads to discussions within the Security Advisory Application Issues Queue.

I was not able to identify someone to ask, whether it is a requirement or a (strong?) suggestion.

As we’re currently reworking the PAReview (pareview.sh) tool, it would be great to know for having a distinct severity for a missing hook_help(). That’s why I’m hoping to getting a hint from the grey-bearded Drupalists here, on where to address this inquiry.

Don’t get me wrong, I don’t want to start a discussion here, nor subjective answers on whether there should be a hook_help or not. I just want to know which board is deciding such issues and where to ask when it comes to contrib module coding standards and best practices.

design patterns – Should I use ROA or SOA for a distributed application and how could I implement REST If using ROA

For my final year project I’m looking to build a distributed version of a popular benchmarking client (this has already been done using various methods involving some form of existing frameworks), I have been advised by my dissertation supervisor to consider implementing a RESTful service. Essentially what will be happening is that a program will be started from one client (provided the details of the benchmark) , which shall initiate a master program / server who will then decide how many network nodes to run and on how many clients of which to run it on. These will all perform various actions on the database, have their own individual results returned to them & subsequently the original program / server that initiated them where the results will be aggregated.

I saw a few documents online stating that SOA’s are useful where there will be many stateless processing units (the network nodes, in my head in the diagram) and said that an SOA includes a main storage (database cluster in my diagram) as well as an application that combines and composes them together (the clients on the networks nodes results will be being aggregated).

On the contrary I have read up on ROA’s and RESTful service and it looks like it could fit this design pattern also.

So my question is, which of these design patterns shall I implement:

SOA or ROA?

And if ROA, I’m struggling to wrap my head around the CRUD operations in a situation other than a web service.

So for example, my network nodes will each be running a client interacting with the database individually (not via REST).

How would I include a GET / PUT / DELETE / POST to the client?

Because all I’m imagining in my head is GET in the context of GET databaseX/1 and retrieving an individual record or something similar.

Thank you in advance.

enter image description here