Best Approach for PII and Databases

PII, or Personally Identifiable Information, involves information that may include the following, among other data:

  • First Name
  • Last Name
  • Email Address
  • Phone (any of them)
  • Billing Address
  • Shipping Address

Security researchers and legislation are recommending we encrypt the data. In my case, I’m using PHP7 and MariaDB. So, I can store encrypted PII using the latest recommended and battle-tested encryption APIs. However, now when I need an admin system, I need to be able to:

  • Sort data by PII table columns
  • Do case-insensitive partial keyword searches

Unfortunately, I’m not clear on how to do that smoothly with encrypted data stored in MariaDB (and which might also use PHP7).

Which is better approach – using subprocess vs communicating over socket?

I have been working on a python project for sometime which has been structured in following manner:

We have a function like this:

def execute_cmd(cmd):     (out, err) = subprocess.Popen(cmd).communicate()     return (out, err) 

and this function is used over and over to execute binaries of a third party library.
I did a little bit research and understood that we can connect to the third party library over sockets, and communicate by sending JSON payloads.

I am trying to understand which approach is better and why?
From what I understand, everytime we create a subprocess, underlying OS has to create a PCB for it, allocate resources and deallocate resources after completion. However, I see that it is really common practice in python programming to create subprocesses. This has left me completely confused.

It would be really helpful if anyone can point out which approach is better and why?

P.S.: Please let me know if this is not the correct forum to post questions like this.

What’s the best approach when you need to work off two branches that still have pending PR requests?

Let’s say I have branch-1 (branched off master (major update)) and branch-2 (also branched off master (minor update)).

What is the best approach to do when I need to create another branch, e.g. branch-3 and I need to continue the work from both branches while their PRs are still pending?

And what do I do once both the PRs have been approved?

Magento 2 recommended approach to applying patches

So far had to apply patches through command line. Bugs me there is not version control for this as in some cases changing vendor folder contents which is ignored. More for accountability with time and date of change instead of ability to revert. But then I came across this article.

Its hard to gauge from this article. Is this the recommended approach to applying patches? Or is there another method?

approach not overriding the template file

I wanted to override vendor/magento/module-sales/view/adminhtml/templates/items/column/name.phtml template.

And created new layout xml update as:
File: app/code/MagePsycho/CustomInvoice/view/adminhtml/layout/sales_order_invoice_view.xml

<?xml version="1.0"?> <page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">     <body>         <referenceBlock name="column_name_downloadable">             <!-- Unfortunately this is not working -->             <!--<arguments>                 <argument name="template" xsi:type="string">MagePsycho_CustomInvoice::sales/items/column/downloadable/invoice/name.phtml</argument>             </arguments>-->             <action method="setTemplate">                 <argument name="template" translate="true" xsi:type="string">MagePsycho_CustomInvoice::sales/items/column/downloadable/invoice/name.phtml</argument>             </action>         </referenceBlock>     </body> </page> 

My Question here is, why this XML code

<arguments>     <argument name="template" xsi:type="string">MagePsycho_ CustomInvoice::sales/items/column/downloadable/invoice/name.phtml</argument> </arguments> 

is not overriding the name.phtml file?
I think Magento recommends to avoid <action method="setTemplate"> approach.

Look for a clever geometric approach to solve a problem with area.

In the acute $ \triangle ABC$ , the position of each point is as shown, $ F$ is the midpoint of $ BD$ , $ G$ is the midpoint of $ CE$ , $ F$ is not on $ CE$ , and $ G$ is not on $ BD$ . It is known that $ S_{\triangle AFG} = 1$ , and the area of ​​the quadrilateral $ BCDE$ is obtained? enter image description here

An imprecise answer: Considering $ D$ , $ E$ and $ A$ coincide, it is easy to know that the area of ​​the quadrilateral $ BCDE$ is $ 4$ .

Or:Let $ \overrightarrow{AB}=\vec{a}, \overrightarrow{AC}= \vec{b}, \overrightarrow{AE}=\lambda_1 \vec{a}, \overrightarrow{AD}=\lambda_2 \vec{b}, (0 < \lambda_1, \lambda_2<1)$ , then \begin{aligned} S_{\triangle ABC} &= \frac12|\vec{a}\times\vec{b}| \ S_{\triangle AED} &=\frac12 \lambda_1 \lambda_2|\vec{a} \times \vec{b}| \ S_{BCDE} &=S_{\Delta A B C}-S_{\Delta A E D} \ &=\frac{1}{2}\left(1-\lambda_{1} \lambda_{2}\right)|\vec{a} \times \vec{b}| \end{aligned} $ \because$ $ $ \overrightarrow{AF}=\frac{\vec{a}+\lambda \vec{b}}{2} \quad \overrightarrow{A G}=\frac{\lambda_{1} \vec{a}+\vec{b}}{2}$ $

$ \therefore$

\begin{aligned} S_{\Delta A F G} &=\frac{1}{2}\left|\overrightarrow{A F} \times \overrightarrow{A G}\right| \ &=\frac{1}{2}\left|\left(\vec{a}+\lambda_{2} \vec{b}\right) \times\left(\vec{a}_{1} \vec{a}+\vec{b}\right)\right| \ &=\frac{1}{8}\left(1-\lambda_{1} \lambda_{2}\right)|\vec{a} \times \vec{b}| \end{aligned}

$ \therefore$ $ $ \frac{S_{\triangle AFG}}{S_{BCDE}}=\frac{1}{4} \Longrightarrow S_{BCDE}=4$ $

Now, I need a purely geometric approach to solve this problem, but I have no clue. Could anyone help me? Thanks a lot.

An inner product approach to Hopf algebras

We fix the standard inner products on $ \mathbb{C}^n$ and $ \mathbb{C}^n\otimes \mathbb{C}^n$ .

Is there an anlgebra structure on $ \mathbb{C}^n$ with multiplication $ m$ such that the adjoint operator $ m^*: \mathbb{C}^n \otimes \mathbb{C}^n\to \mathbb{C}^n$ is a coproduct(Coalgebraic operation)?

Is there a bialgebra structure whose product and coproduct are adjoint of each other? Is there a hopf alfebra with the later property and the additional condition that the antipod map is an isometry?

Note: Note that the adjoint operatores are taken associated to the corresponding inner products

How to approach analysis of randomized algorithm

Let us suppose we have a sequence of values $ C(i)$ that represent some counter for a given $ i$ for $ i \in \lbrace 1, \cdots, n \rbrace$ . Let us assume some uniform distribution $ U$ where selecting any integer between $ 1$ and $ n$ has equal probability. A simple algorithm using this information is to loop for some fixed number of iterations $ M$ that, for ease, is a multiple of $ n$ , and do the following:

  1. Randomly obtain some constant $ k \leq n$ number of integers from $ U$ and place them into a set $ V$
  2. For $ i^* = \arg \min V$ , do update $ C(i^*) \leftarrow C(i^*) + 1$

Ultimately, I want to be able to investigate the quantity $ P\left( | C(i) – \frac{1}{n}\sum_{j=1}^n C(j) | \leq \epsilon \right)$ for any $ i$ . The question I have is if this simple algorithm allows, in probability, for the values of $ C(i)$ to remain close to their average values regardless of how many iterations we do. This probability is obviously of a form where one could take advantage of say Hoeffding’s inequality but I am not quite sure how to make use of the algorithm structure to get to that point. I am not very well versed in randomized algorithms and so any insight into how to approach the analysis of such a simple algorithm would be insightful.

Which is the best approach for Laying down the text on first scroll of the website?

enter image description hereThe wireframes are for a product website, which is a suite of online products that can be used together or as individual modules.

Option1 has a traditional HEADING-BODY COPY approach. The most common way we perceive website content in general, Where the heading is the emotional hook. While the body copy acts as a basic product descriptor.

Option2 has a straight forward approach with 1-2 line descriptor, and highlighting the key point in the product. The reason for creating this approach is

1) It is a product website which is a suite of online products that can be used together or as individual modules.Which means any user will actually end up on the website with an intention while researching rather than just random googeling.

2) Which means, he is consciously aware to some degree what sort of product he needs.

3) Which means he has gone through many websites, even if not too many at least 3-4.

4) Which means he is aware of the fancy filler content that people put up on website to make it look good.

5) So to stand apart and to grab users attention or to anchor him to the product, a straight forward approach with less content and that to in a single font style and an illustration is a better option

6) So he can just read one line and get a gist about the product, with a highlighted point and start exploring the product

Determining the best “approach” for an algorithm

I am trying to get better at algorithm design and was looking at questions on Leetcode and similar websites/textbooks. I was wondering what are some of the common phrases/semantics that could help indicate a preferred method for approaching an algorithm design problem.

For example:

For questions regarding array(s), if we know the array(s) is sorted, we would consider Binary Search.

If we are asked to find a min/max, perhaps utilizing a heap would a course of action.

And for optimization problems, where keywords such as minimized/maximized, least/most, shortest/longest, smallest/largest indicate a DP divide-and-conquer approach.

These are some of the few keywords/phrases I could think off the top of my head, and I was wondering if there were some other similar indicators common in algorithm design questions that would be helpful.

Any and all responses are appreciated!