varnishlog – how to log only certain paths?

I want to log all requests to static pages in a certain directory via varnishlog.

This is what I have tried:

varnishlog -c -q "ReqURL ~ '.*version15.*'" 

Works – but I want to limit it further.

varnishlog -c -q "ReqURL ~ '.*static.*version15.*'" 

Does not work.

varnishlog -c -q "ReqURL ~ '/static/version15/tpl/my_template.html" 

Does not work.

I have checked Filtering varnishlog v4, https://varnish-cache.org/docs/trunk/reference/vsl-query.html – but was not able to figure it out.

Enumerate all paths in a given series-parallel graph

Series parallel graph is well-known and widely used. It has a single source and a single destination. The graph can be formed by means of recursive serial or parallel composition. I have a graph dataset that is of this type, and I have to enumerate all paths in the series-parallel graphs. Are there any existed algorithms? If so, what is the time complexity of it?

Posted on Categories proxies

Dyck paths weighted by height profile

We are interested in a question concerning a weight function on Dyck paths that penalizes visits to higher heights.

Let $$\rho$$ be a parameter. Let $$D_k$$ be the set of all nearest neighbor random walk paths that connects $$(0,1)$$ to $$(2k,1)$$ and is strictly greater than $$1$$ away from the endpoints. So each $$\gamma\in D_k$$ is a translate up by one of prime Dyck path. Define the height profile $$h(\gamma) = (h_1,\cdots,h_k)$$ where $$h_i$$ is the number of times $$\gamma$$ is at height $$i$$. Let $$\omega(\gamma) = \prod_{i=1}^k (2 + i \rho)^{-h_i}$$ be the penalizing weight function. Define the values $$p_k = \sum_{\gamma \in D_k} \omega(\gamma)$$ and let $$F(\rho) = \sum_{k=1}^\infty p_k d^k.$$ Define the critical value $$\rho_c = \inf \{ \rho \colon F(\rho) < \infty \}.$$ So $$\rho_c$$ is the “balance point” at which $$p_k \approx d^{-k}$$ modulo possibly some polynomial terms. We would like to know if $$F(\rho_c) <\infty.$$ Does this seem possible to prove, or even true? It is unclear to us whether this is a common combinatorial object. Are generating functions for height profiles of Dyck paths like $$h(\gamma)$$ understood at all?

Entity Framework Core – may cause cycles or multiple cascade paths error

I was creating some models and this error appeared while i was configuring fluent API and added migration. I don’t understand why it tells me this when i set DeleteBehaviour.Restrict ?

public class Registo {     public int CelulaId { get; set; }     public Celula Celula { get; set; }      public int ReferenciaId { get; set; }     public Referencia Referencia { get; set; }      public ICollection<ComponenteArranque> Componentes { get; set; }     public ICollection<RegistoGeometria> RegistosGeometria { get; set; } }  [Table("hGeometrias")] public class Geometria {     public int Id { get; set; }     public string Referencia { get; set; }     public int MatrizCelulaReferenciaId { get; set; }     public MatrizCelulaReferencia Matriz { get; set; }      public ICollection<RegistoGeometria> RegistosGeometria { get; set; } }  [Table("hRegistosGeomtrias")] public class RegistoGeometria {     public int Id { get; set; }      public float X1 { get; set; }     public float X2 { get; set; }     public float X3 { get; set; }     public float X4 { get; set; }      public int RegistoId { get; set; }     public Registo Registo { get; set; }      public int GeometriaId { get; set; }     public Geometria Geometria { get; set; } } 

fluet api

   modelBuilder.Entity<RegistoGeometria>()             .HasOne(rg => rg.Registo)             .WithMany(r => r.RegistosGeometria)             .OnDelete(DeleteBehavior.Restrict); 

Introducing FOREIGN KEY constraint ‘FK_hRegistosGeomtrias_hRegistos_RegistoId’ on table ‘hRegistosGeomtrias’ may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint or index. See previous errors.

Posted on Categories shared proxies

count all possible paths of length n in an undirected graph with dynamic programming

Given is an infinitely large grid graph. Use dynamic programming to calculate the number of possible paths of a given length n from a given start node, so that fjor every path applies: a) no vertex may be visited twice within it and b) never to go down an edge I found out, that the number of possible paths corresponds to the row sums of the binomial coefficent, times 2 minus the center row, but if n is bigger than 3 other paths emerge which I struggle to include in my dynamic programming solution

Posted on Categories proxies

Count paths in an undirected tree

I have an undirected tree, suppose I am given a path in that tree from some node u to node v. Now I want the count of rest paths in the tree which share only 1 node with my first path(u to v).

For example for tree with 5 nodes connected as:

1 2

2 3

3 4

3 5

For path ( 1,5) answer will be 1 ie. path (3 ,4)

THere are about 10^5 queries so simple brute force wont work.

I tried dfs to find all the nodes that share the path and then finding all paths in tree and excluding those which have more than 1 node common. But bruteforce takes too long. I am new to graph theory. Please help me proceed with this problem.

Assign weights to the edges in a DAG so that, for all S and T, all paths from S to T have equal weight

I have a DAG, and on each edge, I have a minimum and maximum weight. I would like to assign (or determine it’s impossible to assign) exact weights to each edge so that

1. Each edge’s weight is between its min and max
2. For any two nodes $$S$$ and $$T$$ in the DAG, all paths from $$S$$ to $$T$$ have equal weight (where the weight of a path is the sum of all the weights of the edges in that path)
3. [Bonus points] The total weight of all edges in the graph is minimized

I know I can set this up as a linear program, but that feels like overkill. There has to be a simpler way to do this. I’ve tried to think of a way to reduce it to a min-cost flow problem, but I’ve had no success so far. I think that might not be the right direction. Any ideas?

Count paths of length $n$ that a player can take

I’m writing a video game, and I’m trying to find an efficient way of calculating this. The goal is to count the number of paths of length $$n$$ that a character can take, where the character can move left, right, or up. The caveat is that the character cannot go back to the same position in a path.

I’ve come up with a mediocre brute-force method the count the paths, but any ideas on an efficient way to calculate this?

how to find total paths in a graph which have only one vertex common with a given path

Assume i have a undirected graph without cycles G and i am provided with pair of nodes (a,b) .

how can i find the total number of paths in the graph that do not share any edge with the given path and have only one vertex common with the given path.

P.S -here the given is path from a to b

For example : i have following graph : and given value of (a,b) is (4,5) then paths that satisfy above condition are (1,1), (1,3), (2,2), (2,6), (4,4),(5,5) totalling to 6

Random paths from one point to another going through all the cells of a square grid

I am looking for a very specific algorithm, so I think it doesn’t exist yet. I would be satisfied if anyone was able to give me some hints to develop it.

My problem is about a square grid of size n x n, where n is an odd natural number ≥3. For instance, it can be a 5 by 5 grid:

.---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. 

The middle cell of the first column and the middle cell of the last column must be found:

.---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. | ● |   |   |   | ● | .---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. |   |   |   |   |   | .---.---.---.---.---. 

Then, and this is the hardest part of the algorithm, I want to get a path from the left-most point to the right-most one, that goes through every cell of the grid.

For example, this is one possibility:

  > > v   > > > > v   ^   v   ^       v   ^   v   ^   v < <   ^   v   ^   v       ●   v   ^   v   ●       v   ^   v   ^   v < <   ^   v   ^   v       ^   v   ^   > > > > ^   > > ^  

and this is another:

  > > > > v   > > v   ^       v   ^   v   < < <   v   ^   v       ^   v   ^   v   ● > ^   v   ^   ●           v   ^       v < < < <   ^ < <   v               ^   > > > > > > > > ^  

This implies directly some obviousnesses. Let a be the number of up displacements, b down, c left and d right, we can know that:

• a + b + c + d = n^2 - 1
• a = b
• d - c = n - 1

I also want to randomize the creation of this path, and the best would be a uniform distribution amongst all the possibilities (I don’t know their number but I am almost sure it increases as n increases).

I think it can be solved thanks to graph theory since my grid can be considered as an unoriented graph where the vertices are the cells and where two adjacent cells are linked with an edge. The problem is now equivalent to making a non-redundant graph traversal, but I have no idea where to begin.

I hope my question was clear enough, thanks in advance.

Posted on Categories proxies