Having tasks that can be ran individually or “in trees”, and each task can be blocking or non-blocking

I’m creating a framework that needs to execute certain tasks, I’ll use building a car as an example for this. So, an individual task could be something like weld metal or screw bolt. But there are also collections of tasks, I call them jobs. Each job can have X amount of tasks, so combining these two tasks could get us a job build an engine:

build an engine +-- weld metal +-- screw bolts 

Additionally, jobs can have sub-jobs:

build a car +-- build an engine |   +-- weld metal |   +-- screw bolts +-- build a frame |   +-- weld metal |   +-- screw bolts |   +-- paint +-- combine engine and frame 

So basically each node of my tree is a job, and each leaf is a task. This is easy enough, here’s what my classes would look like:

class Task:     def do(self):         raise NotImplementedError('abstract method')  class Job(Task):     def __init__(self):         self.tasks = []      def do(self):         for task in self.tasks:             task.do() 

And now I’d just subclass WeldMetal and ScrewBolts from Task.

The problem arrives when we want to parallellise this. I need to somehow tell each task (and job) whether it should block the execution, or run in a separate thread and not block it. Sometimes my jobs also need results from other jobs, while those jobs may run in parallel to each other. For example in the above car building:

  • weld metal must block, since you can’t screw before the metal is welded.
  • build an engine and build a frame can be ran in their own threads (and within those threads the weld metal and screw bolts must block the particular thread).
  • combine engine and frame must wait for build an engine and build a frame to finish.

Honestly I’m not too sure where to start, initially I thought of using ThreadPoolExecutor in Job.do(), but I’m not sure how to block only some jobs and not others, and another issue is that sometimes a task must be ran “alone” without even being inside of any job, i.e. WeldMetal(block=False).do() must be valid.

I ended up using this at first:

class Task:     def do(self):         raise NotImplementedError('abstract method')      def run(self):         if self.block:             self.do()         else:             threading.Thread(target=self.do).start() 

And this works for most cases, but the issue comes when combine engine and frame needs to wait for both build an engine and build a frame to finish.

Having tasks that can be ran individually or “in trees”, and each task can be blocking or non-blocking

I’m creating a framework that needs to execute certain tasks, I’ll use building a car as an example for this. So, an individual task could be something like weld metal or screw bolt. But there are also collections of tasks, I call them jobs. Each job can have X amount of tasks, so combining these two tasks could get us a job build an engine:

build an engine +-- weld metal +-- screw bolts 

Additionally, jobs can have sub-jobs:

build a car +-- build an engine |   +-- weld metal |   +-- screw bolts +-- build a frame |   +-- weld metal |   +-- screw bolts |   +-- paint +-- combine engine and frame 

So basically each node of my tree is a job, and each leaf is a task. This is easy enough, here’s what my classes would look like:

class Task:     def do(self):         raise NotImplementedError('abstract method')  class Job(Task):     def __init__(self):         self.tasks = []      def do(self):         for task in self.tasks:             task.do() 

And now I’d just subclass WeldMetal and ScrewBolts from Task.

The problem arrives when we want to parallellise this. I need to somehow tell each task (and job) whether it should block the execution, or run in a separate thread and not block it. Sometimes my jobs also need results from other jobs, while those jobs may run in parallel to each other. For example in the above car building:

  • weld metal must block, since you can’t screw before the metal is welded.
  • build an engine and build a frame can be ran in their own threads (and within those threads the weld metal and screw bolts must block the particular thread).
  • combine engine and frame must wait for build an engine and build a frame to finish.

Honestly I’m not too sure where to start, initially I thought of using ThreadPoolExecutor in Job.do(), but I’m not sure how to block only some jobs and not others, and another issue is that sometimes a task must be ran “alone” without even being inside of any job, i.e. WeldMetal(block=False).do() must be valid.

I ended up using this at first:

class Task:     def do(self):         raise NotImplementedError('abstract method')      def run(self):         if self.block:             self.do()         else:             threading.Thread(target=self.do).start() 

And this works for most cases, but the issue comes when combine engine and frame needs to wait for both build an engine and build a frame to finish.

How can i recieve multiple recipients messages; in the group message, instead of downloading individually before opening in group?

I was added in group message, yet i recieve single message from each person. How can i recieve all recipients in just the group message? Why do i have to download then first before going to group message, just to read it there?. Should my character encoding be on auto or default alphabet?

Is it always true if two random variables are jointly Gaussian, then they must be individually Gaussian as well?

If I have two random variables, $ X$ and $ Y$ , such that $ f_{X,Y}(x,y)$ is jointly Gaussian, is it ALWAYS true that $ f_{X}(x)$ and $ f_{Y}(y)$ are Gaussian as well?

If $ f_{X,Y}(x,y) \sim N(\mu_{XY}, \sigma_{XY}^{2})$ with correlation $ \rho$ , then $ f_{X}(x) \sim N(\mu_{X}, \sigma_{X}^{2})$ and $ f_{Y}(y) \sim N(\mu_{y}, \sigma_{y}^{2})$ .

Is there an exception?

Get all simple products of a category including not visible individually products – Magento 2

I need to get all simple products of a category. By using the following code, I’m getting only products which has visibility of Catalog, Search but not Not Visible Individually products.

$  categoryId = 12; $  categoryFactory = $  objectManager->create('Magento\Catalog\Model\CategoryFactory'); $  category = $  categoryFactory->create()     ->load($  categoryId)     ->getProductCollection()     ->addAttributeToSelect('*')     ->addAttributeToFilter('type_id', 'simple'); 

I need all simple products regardless of its visibility. How can I achieve this?

Render taxonomy type custom fields individually

I’m kind of a twig newbie so I’m hoping that someone can point me in the right direction.

I’ve added a custom field field_url to a taxonomy type called field_type_poi. How would you render that taxonomy type’s individual field in node.html.twig?
I know that I can use {{ content.field_type_poi }} to render the entire contents of the taxonomy type, but I’m looking for a way to render one field specifically.

Finder Column View “Right Size All Columns Individually” via AppleScript

I’d like to set up a keyboard shortcut to trigger the “Right Size All Columns Individually” command that Finder’s column view has when you right-click on a column divider.

Is it possible to access and trigger that command with an AppleScript? Or perhaps it’s possible to recreate the same functionality with an AppleScript? From there, I’d be able to set up a key command to trigger the script.

I am aware of Finder-enhancers that have auto-column-sizing options built in like TotalFinder and XtraFinder, but both of those have proven to make Finder unstable at times on all versions of macOS that I’ve used. Plus I’d rather not disable System Integrity Protection.

What is a secure way to encrypt critical secrets for a person likely to be individually targeted

I read several guides and Stackexchange answers, but the more I know, the more I realise how much I don’t know. What I learnt is that details of implementation matter and that most popular tools do something wrong.

I can reasonably expect to be individually targeted because of the nature and publicity of my work. I actually were targeted before (unsuccessfully) and I feel that I need to be ready, sooner or later, for more knowledgeable and crypto-sophisticated adversaries (but non-governments). I’m a freelancer, so I don’t have any big company behind me which resources I could use for security protocols.

I’ve been using aes-256-cbc via openssl enc (with default parameters) my entire life, but as my work is getting more publicity and the likelihood of me being targeted increases, I decided to upgrade to a “golden standard”.

Cryptographic Right Answers (Latacora, Ptacek) agree to recommend using “NaCl/libsodium’s default”, but these are libraries and, as far as I know, don’t provide executables. I’m fairly technical and I can program, but I’m not familiar with C language. There are 3rd party libsodium bindings for other languages, so I guess I could cook something up, but I would prefer not to reinvent the wheel and I look for the least error-prone way.

I already know several reasons to don’t use openssl cli. I’m not sure if it can be trusted with its implementation of Latacora/Ptacek’s 2nd preference ChaCha20-Poly1305 (and if yes, what additional parameters should be specified, if any). It doesn’t support their 3rd preference at all (AES-GCM). I also read that gpg has weak key stretching. This exhausts my knowledge of popular linux encryption tools.

Questions:

Is there actually any tool which does encryption “right” out of the box and provides linux shell interface?

If not, is there any tool which does it “right” when configured properly and can you provide the “right” set of parameters?

Or maybe it’s best to take node.js or Python bindings for libsodium, make a tiny wrapper and use defaults?

Side question: are there any special considerations to take when encrypting very short pieces of data? Some things which I encrypt are encryption keys or passphrases which are just dozens of bytes long (I know that my currently used AES-CBC is a block cipher, so there’s some padding which can be tricky, etc).

Am I being too paranoid wanting to switch from openssl enc aes-256-cbc (considering I can expect to be individually targeted)?

Thank you!

Is AdSense requiring sites be Individually approved now?

I have had my account for years and have manged many accounts over the years. I have a client who opened a new adsense account recently. They sent me their ad code to place on a site for them and it would not display.

They gave me account access yesterday and everything looked normal until I went to the "Sites" tab. On my account any every other account I have seen, this is an optional area that by default is enabled and only allows sites added to the list to work. The ads will still show…

Is AdSense requiring sites be Individually approved now?