Is this possible to set up in the dns register other than the web hosting?

My domain is hosted in a domain name registry cloudflare and the domain is hosted in the shopify. We have QR code tagged with each product selling in the shopify. If a customer scan it it will go to mydomain.com?specialCode=123456 and he/she could win a prize. Recently we’ve developed the sns application on different sub domain sns.mydomain.com. I want to know if we can set up redirect to go to sns.mydomain.com if the url has specialCode attached. Hopefully I can set up a redirect on the name on the cloudflare so we don’t need to redirect from client side since shopify doesn’t give you access to the server side. Is this possible?

Is it possible to populate field with array in Sequelize?

I am new to Sequalize. Tried to figure this out but cant wrap my head around how it works. So I need to JOIN three tables based on two others

I have my models defined by sequelize-auto. Here is my init-models file

var DataTypes = require("sequelize").DataTypes; var _lesson_students = require("./lesson_students"); var _lesson_teachers = require("./lesson_teachers"); var _lessons = require("./lessons"); var _students = require("./students"); var _teachers = require("./teachers");  function initModels(sequelize) {   var lesson_students = _lesson_students(sequelize, DataTypes);   var lesson_teachers = _lesson_teachers(sequelize, DataTypes);   var lessons = _lessons(sequelize, DataTypes);   var students = _students(sequelize, DataTypes);   var teachers = _teachers(sequelize, DataTypes);    lesson_students.belongsTo(lessons, { as: "lesson", foreignKey: "lesson_id"});   lessons.hasMany(lesson_students, { as: "lesson_students", foreignKey: "lesson_id"});   lesson_teachers.belongsTo(lessons, { as: "lesson", foreignKey: "lesson_id"});   lessons.hasMany(lesson_teachers, { as: "lesson_teachers", foreignKey: "lesson_id"});   lesson_students.belongsTo(students, { as: "student", foreignKey: "student_id"});   students.hasMany(lesson_students, { as: "lesson_students", foreignKey: "student_id"});   lesson_teachers.belongsTo(teachers, { as: "teacher", foreignKey: "teacher_id"});   teachers.hasMany(lesson_teachers, { as: "lesson_teachers", foreignKey: "teacher_id"});   // removing unused ids   lesson_students.removeAttribute('id')   lesson_teachers.removeAttribute('id')         return {     lesson_students,     lesson_teachers,     lessons,     students,     teachers,   }; } module.exports = initModels; module.exports.initModels = initModels; module.exports.default = initModels; 

Result eventually should be an object with populated fields. It should look like something like this

{    id : 9    date: ‘2019-09-01’     title: ‘Orange’,    status: 1    students: [ // populated array of students       { id: 1,          name: ‘John’          visit: true,    }],    teachers: [ // populated array of teachers       { id: 1,          name: ‘Alice’       }] } 

At the moment i figured out how to get this result

{     id: 10,     date: '2019-06-24',     title: 'Brown Color',     status: 0,     lesson_teachers: [ [lesson_teachers] ],     lesson_students: [ [lesson_students] ]   } 

by following code

resultLessons = await models.lessons.findAll({     include: [{       model: models.lesson_teachers, as: 'lesson_teachers',     }, {       model: models.lesson_students, as: 'lesson_students'      }],   })   const lessons = resultLessons.map((lesson) => (lesson.dataValues))   console.log(lessons) 

So question is how do I populate [lesson_teachers] and [lesson_students] with actual data? (like method .populate in mongoose)

Thanks a lot in advance

Is it possible for hacker to point other domain to my domain?

recently when I search my website on google, I find another domain’s description is identical to my domain. I’m terrified and try to understand the security breaches of my website as much as possible. I clicked on the link of this fake website and it turned out to be ‘Your connection is not private’. When I search this fake website’s domain through whois, it showed another company’s info.

My website is built with react, host on vm machine with docker and nginx.

I find this fake website today which is just after I try to implement google analytics and google tag manager on my website yesterday.

Can you tell me what’s going on now please? And how do I prevent all security issues?

My nginx config in default.conf file

server {     listen 80;      server_name www.mywebsite.com;      rewrite ^(.*)$   https://$  host$  1;       location / {          root   /usr/share/nginx/html;         index  index.html index.htm;         try_files $  uri $  uri/ /index.html;     }      error_page 404 /index.html;     location = / {         root /usr/share/nginx/html;         internal;     }     error_page   500 502 503 504  /50x.html;     location = /50x.html {         root   /usr/share/nginx/html;     } }  # nginx docker container, ssl config server {     listen 443 ssl;      server_name www.mywebsite.com;     root html;     index index.html index.htm;     ssl_certificate /path/to/ssl.pem;      ssl_certificate_key /path/to/ssl.key;        ssl_session_timeout 5m;     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     ssl_prefer_server_ciphers on;      location / {         root   /usr/share/nginx/html;         index  index.html index.htm;         try_files $  uri $  uri/ /index.html;     }  } 

How to find all possible paths between a collection of vertices in a DAG graph

I have a toy example "system" that is a DAG and has 16 vertices. Suppose I have a collection of vertices "collection". How can I find all paths that passes through at least all vertices present in "collection"? The functions available all seem to work with source and target vertices but not with a collection of vertices.

My only solution up to now is rather naïve and I need to know the source and target vertex. I would like to avoid that if possible.

g = Graph[{1 \[DirectedEdge] 2, 1 \[DirectedEdge] 3,       2 \[DirectedEdge] 6, 3 \[DirectedEdge] 7, 3 \[DirectedEdge] 8,       7 \[DirectedEdge] 9, 7 \[DirectedEdge] 10, 6 \[DirectedEdge] 11,       6 \[DirectedEdge] 12, 12 \[DirectedEdge] 13, 13 \[DirectedEdge] 14,       8 \[DirectedEdge] 10, 6 \[DirectedEdge] 10, 12 \[DirectedEdge] 15,       15 \[DirectedEdge] 16, 15 \[DirectedEdge] 17, 17 \[DirectedEdge] 14,      2 \[DirectedEdge] 12, 11 \[DirectedEdge] 16, 10 \[DirectedEdge] 16,      9 \[DirectedEdge] 16}, VertexLabels->Automatic]; collection = {1, 3, 10, 16}; HighlightGraph[g, collection, VertexLabels -> Automatic] 

enter image description here

Now I search for all paths between the vertices 1 and 16

allpaths = FindPath[g, 1, 16, All, All] HighlightGraph[g, allpaths, ImageSize -> 300] 

enter image description here

Now I collect the possible candidates

paths = If[ContainsAll[#, collection], #, Nothing] & /@ allpaths HighlightGraph[g, paths, ImageSize -> 300] 

enter image description here

As asked above are there other ways to do this WITHOUT knowing that I need paths between vertex 1 and 16?

Is it possible to do partial fraction expansion with specific degree of the variable?

For example, here is a rational polynomial: $ $ \frac{8 z^2}{8 z^2-6 z+1}$ $

If I using Apart directly, the result is: $ $ -\frac{1}{4 z-1}+\frac{2}{2 z-1}+1$ $ but if I want to using $ z^{-1}$ as the variable, the partial fraction expansion should be: $ $ \frac{-1}{1-\frac{1}{4}z^{-1}}+\frac{2}{1-\frac{1}{2}z^{-1}}$ $ Is this possible in Mathematica?

Is it possible to set permission to other user for the table created by current user with PostgreSQL?

In PostgreSQL, created these 2 roles and grant different permissions to them.

create user user1 with login; create role operator; grant operator to user1;  create user user2 with login; create role readwrite; grant readwrite to user2; 

When created a table by user1, such as table1, user2 can’t use this table. It got permission denied.

Is it the right feature for PostgreSQL? If it is, how to make the table also can be used for user2?

Is it possible and how to log a website internal connection activity?

For instance, I have developed a WordPress website and prepared to deploy to client’s server. Since they request the site to be scanned in their VPN server first. For some reason, the application connects to many external resources and because the VPN is blocked the site from connecting to other location than its internal address, it is very slow. The slowness is believed to be due to blocking and retrial until giving up.

Since the application consists of a lot of plugins. What connection it is trying to make is not so obvious and straightforward.

Is it possible to track/log what the connection it is trying to made? If it is possible, I could do it in local server environment level and coding level to make a list of connection that it is trying to connect. And then I could use this list to discuss with the client and ask for white listing.

eg. normal connection log /user activity utility could log user A with IP A visit > website.

But currently, if the site itself connect to

  • wordpress.org <<< possible log it down?
  • website B …
  • website C

Any hints, suggestions, insight is highly appreciated. Thanks a lot.