## amazon web services – AWS CloudFront – put a custom domain before a custom domain

I work on a site builder project and put the generated sites as Single Page Application in a S3 bucket. This bucket is behind a CloudFront distribution. I’ve added a CNAME to my domain and a lambda function to route subdomains to single folders. For example:

my-site-alias.sitebuilder.xyz –> will internaly route to s3.website.url.amazon.com/my-site-alias

This works like i expected. But now i got struggeling. How can my clients put their custom domains before mine? I’ve tested with another domain like testdomain.com and added a CNAME to my custom domain. When i now visit the domain i get an 403 error.

403 ERROR

The request could not be satisfied. Bad request. We can’t
connect to the server for this app or website at this time. There
might be too much traffic or a configuration error. Try again later,
or contact the app or website owner. If you provide content to
customers through CloudFront, you can find steps to troubleshoot and
help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)

So how do i can add a custom domain before my custom domain with CloudFront and lambda@edge?

## 8 – How to put view results in an entity reference field?

So the scenario is like this:
I have to create a “node” which has an entity reference field which can hold multiple values. I am looking for a way to be able to select view results to be stored in the entity reference field and I do not know how to do that in Drupal 8.

For Drupal 7 there was this module which does what I need https://www.drupal.org/project/entityreference_view_widget

I have tried doing it the custom way by creating views and placing them on the same page as the node create and then getting the resulting values with ajax to store in the field but I do not believe that is the best way to go about it as it does not seem reliable.

## how we can put restriction on the customer reviews on the Magento

How I can put restrictions for customers in the review section. Only those customers can put review who are bought our products.

Thank you

## turing machines – Where to put the state in a two-stack push down automaton?

theoretically, the state is between the two kleene-stars of the work-alphabet

``````gamma* q gamma*
``````

where q is the current state and each `gamma*` is the content of one of both stacks. But where is “the middle” with the state? Regarding the one tape of the classical Turing Machine it is obvious.

Yours,
von Spotz

## Server not working when I put SRCGADGETS.COM in server manager

I have been using Google cloud while configuring setup for sports watch website. Its command line is ending parsing error. Can someone please help me out? Thanks

## probability – \$X\$, \$Y\$ be independent geometric random variables and let \$U\$ be the smaller of \$X\$ and \$Y\$, and put \$V = X – Y\$. Show \$U\$ and \$V\$ independent.

Let $$X$$, $$Y$$ be independent random variables with the same geometric distribution $${q^kp}$$. Now let $$U$$ be the smaller of $$X$$ and $$Y$$, and put $$V = X – Y$$. Show that $$U$$ and $$V$$ are independent.

This is what I have thus far:

We just need to show that $$P(U = u)P(V = v) = P(U = u, V = v)$$. Let us first suppose that $$X = Y$$. Then, $$V = 0$$ and since it doesn’t depend on $$X$$ and $$Y$$ specifically, we conclude that $$P(U = u)P(V = v) = P(U = u, V = v)$$ holds trivially. Now let’s suppose $$X neq Y$$. We first calculate the probability that $$X$$ is the smaller one. We notice that $$P(X Y) = 1$$ and that $$P(X X)$$. Computing $$P(X = Y)$$ gives $$sum_{i = 1}^infty q^{2i – 2}p^2 = frac{p^2}{1 – q^2}$$ so that $$P(X>Y) = P(X. Thus if we suppose that $$U = X = u$$ then $$V = v$$ happens with a probability of $$q^{v – u – 1}p$$ for $$V< X$$ (since $$Y$$ takes on positive integers) and $$0$$ otherwise. Thus
$$begin{equation} P(U = u, V = v) =begin{cases} frac{1 – q^2 – p^2}{1 – q^2}q^{v – u – 1}p & text{ if } V< X\ 0 & text{ otherwise} end{cases} end{equation}$$
We now note that $$P(U= u) = 2q^{u-1}psum_{k = u+1}^infty q^{k-1}p + (q^{k-1}p)^2 = frac{2q^{2u-1}p^2}{1 – q} + q^{2k – 2}p^2$$. On the other hand, $$P(V = v) = sum_{i geq -v}^infty q^{i-1}p (q^{i-v-1}p) = frac{p^2q^{-v}}{1 – q^2}$$

I’m very confused as to what to do next since $$P(U = u)P(V = v)$$ and $$P(U = u, V = v)$$ look totally different.

## 7 – How do I programmatically put more data from an external database?

I want to add company details in a node from an external database. How do I put more data in a node body?

``````  // Set the external database as the active one.
db_set_active('db_wirdfit');
// Retrieve data from the external database.
\$result = db_query('SELECT * FROM wirdfit.wirdfit_data');
// Set the active database to the default one.
db_set_active();

foreach (\$result as \$row) {
\$node->type = "page";
\$node->title = \$row->id;

// node_object_prepare(\$node);  // Set some default values.
\$node->body(LANGUAGE_NONE)(0)('value') = \$row->post_title;
\$node->body(LANGUAGE_NONE)(0)('summary') = text_summary(\$row->post_title);
\$node->body(LANGUAGE_NONE)(0)('format') = 'full_html';
``````

I will add other data from the external database into the node body.

Can anybody help?

## navigation – I’m not sure what to put on my desktop app’s home screen

I’ll take your word you cannot predict the sections users are likely to want when the app starts (but see jgthms’ answer before settling on that). You’re correct that if you already have an efficient sidebar menu on every section, then it doesn’t make sense to make the home section the “speed dial” page. Eliminating the sidebar in favor of the home speed dial controls slows navigation, and having both adds complexity with little benefit.

As similar example, the home section could include controls to set the parameters for each section. If the user needs to filter or populate the content of each section (e.g., provide a date range for the Orders section), you can list the most recently used date ranges across from the Orders menu item on the home section. Or you can provide blanks to enter the date range on the home section so the user can get to a populated Orders section directly.

Work At Home

You already have notifications and alerts on the page, which are presumably important to see when the app starts (maybe even more important than the navigation options). Is there anything else you can put there that useful to the user? Maybe the home section can feature subset of the content of each section (again, proximal to the corresponding sidebar menu) that allows the user to do the most common and easiest tasks for that section right on the home page. Maybe some users will never have to leave the home page, making for simpler and easier-to-use app for them. If the users find they need more detail, they can “drill down” to the section, which will carry over their input from the home section.

Nothing

Your concern is there’s “not enough to fill the screen.” Why is that a problem? Blank space is a pretty good indication to the user of what they need to do next (create or retrieve something). Many office-type apps start with a blank virtual page. If users are complaining about it looking too boring, then maybe add some non-distracting wallpaper. Or make the window smaller (e.g., tall and narrow so it’s tight around the sidebar menu), and expand it only when the user selects a section to show. If adding anything else to the home section just adds useless clutter, then maybe your job is already done.

## powershell – Invoke-Command with script block put process in background

I am trying to call a command from my system to a virtual machine. When I try to run the installer silently it works, but when I try to run the install without /S(silently) the process goes in the background.

My code:

Invoke-Command -VMName name -ScriptBlock {installer.exe} -Credential \$cred
it doesn’t work

Any hints?

## Defining domain logic and finding the correct place to put it

I’ve been practicing DDD and refactoring an app to understand it’s principles and applications better. However I can’t fully grasp some of the ideas and how to implement them in my business domain.

Let me start with stating a business requirement: A user can place and order and this order would need to be verified by a sales manager who is responsible for the orders of that specific product. User can be a registered user or an anonymous user. In both cases order comes from a request form that contains all the required information for order to be placed. Users can purchase their orders with different supported payment methods.

Now this requirement only belongs to the “placing an order” context. Other parts of the app includes how to process this order after it’s verified, and then when the processing is complete, eventually deliver the order.

For this requirement I’m trying to think of my domain entities. First I think it’d be logical to have Customer aggregate, because from the original requirement it’s clear that a Customer can place an order so my code could be something like the following:

``````class Customer {
Key Id
void PlaceOrder(OrderRequest request) {...}
}
``````

However, business requirement states that this user can be an anonymous user in that case I have no “Customer” instance that I can map the incoming request to. So I change my model and come up with the following aggregate:

``````class OrderContext {
Key OrderId;
void PlaceOrder(OrderRequest request, Nullable<Customer> customer) {...}
}
``````

But then DDD examples and books state that domain entities should correspond to their use cases. In this context, it’s not very clean when you read this code and out loud state “an Order can place itself” – errm what?

How do you model your domain for a business requirement like the above? Who is actually responsible for creating this order? On top of that, an order can be placed from the sales manager’s if, for example we want to gift to a customer for compensation. In this case, a “SalesManager” entity would also have “placeOrder” method in it. I’m totally confused and lost about how to translate this kind of business logic into my domain models.

How would be the relation between orders and customers and sales managers then? I could have “orders” collection in all of those entities and then it’d be a nightmare to keep all of them in a consistent state considering this is a web app and aggregates are loaded – consumed and then destroyed per request basis.