How many shortest paths are there from source to destination?

I am not sure if my question is clear or not to you. In fact this question is not clear to me. My university teacher has assigned this question to me.

Can you answer it? or need clarification like- if the graph is directed edged or not, if they are weighted or not, which algorithm will be used?

I have no such information. Only the question.

Count Unique Subsequences to Destination?

I am looking at this post:

Jamie is walking along a number line that starts at point 0 and ends at point n. She can move either one step to the left or one step to the right of her current location , with the exception that she cannot move left from point 0 or right from point n.

In other words, if Jamie is standing at point i,she can move to either i-1 or i+1 as long as her destination exists in the inclusive range [0,n]. She has a string, s, of movement instruction consisting of the letters l and r, where l is an instruction to move one step left and r is an instruction to move one step right. Jamie followed the instructions in s one by one and in order. For example if s=‘rrlr’, she performs the following sequence of moves: one step right ->one step right ->one step left -> one step right. Jamie wants to move from point x to point y following some subsequence of string s instruction and wonders how many distinct possible subsequence of string s will get her from point x to point y. Recall that a subsequence of a string is obtained by deleting zero or more characters from string.

It has four parameters

  • A String , s giving a sequence of moves using the characters l( i.e. move left one unit ) and r (i.e. move right one unit)
  • An integer n, denoting the length of the number line.
  • An integer x, denoting Jamie’s starting point on the number line
  • An integer y , denoting Jamie’s ending point on the number line.

The function must return an integer denoting the total number of distinct subsequence of strings that will lead Jamie from point x to point y as this value can be quite large.

Sample Input rrlrlr

6

1

2

output = 7

Let’s add few more constraints to simply the questions:

  • 1 <= length of s <= 10^3
  • 0 <= x, y < n <= 2500

I wonder what the runtime is for the proposed solution there:

int distinctSequences (int n, int a, int b, const std::string& actions) {     std::unordered_map<int, int> readyForR, readyForL;     auto res{0};      if (a > 0) {         readyForL.emplace(a, 1);     }      if (a < n) {         readyForR.emplace(a, 1);     }      std::unordered_map<int, int> nextReadyForR, nextReadyForL;      for (auto c: actions) {         nextReadyForR.clear();         nextReadyForL.clear();          if (c == 'r') {             for (auto [pos, count]: readyForR) {                 auto pp1{pos+1};                                  nextReadyForR.emplace(pp1, count);                 readyForL[pp1] += count;                  if (pp1 == b) res += count;             }              nextReadyForR.erase(n);             std::swap(readyForR, nextReadyForR);         } else {             for (auto [pos, count]: readyForL) {                 auto pm1{pos-1};                                  nextReadyForL.emplace(pm1, count);                 readyForR[pm1] += count;                  if (pm1 == b) res += count;             }              nextReadyForL.erase(0);             std::swap(readyForL, nextReadyForL);         }     }      return res; } 

What’s its runtime complexity?

Locate WhatsApp message destination

I’ve been interested in message tracing, so I played a bit with Cisco’s Packet Tracer and Wireshark.

Is it possible to locate the destination of a message (packages) been sent via WhatsApp? I am not trying to read data out of the packages, I just wonder if it is possible to trace the destination location of the message which has been received.

Setting up a Destination Goal in Google Analytics using Regex

I want to set up a destination goal in GA to determine when a user reaches the end of a flow, or basically has completed a process.

The problem, the URL changes depending on the activity of the user so we have a URL like this (below) which can vary.

apply/UserAccount?execution=e1s2

The S2 represents the last stage in the flow, which is the page I’m trying to capture. However the e1 could be any number depending on the other activities of the user.

Can someone help with writing a Regex to make sure GA captures the every time a user reaches the last page regardless of the execution number? Is there a way to ignore the “E1” value and simply match the rest? I am completely new to this part so I’d be embarrassed to share what I’ve tried 🙂

Is longest-path with a specific source and destination impossible in polynomial time?

The problem of finding the longest path in a graph is known to be not be possible in polynomial time, that I am aware of. I am also aware that using DFS or BFS can give the shortest distance between a given origin and destination in a graph. Is it possible to find a longest path from a source vertex to a destination vertex in polynomial time?

Source and Destination IP of TCP connection

Five Tuple Identifier of TCP connection is (TCP, local IP, local port, remote IP, remote port).

I have made 3 computers in virtual box and set BOX1 for client, BOX2 for median, and BOX3 for server. And made interfaces between them to communicate.

enter image description here

So I have executed the server program on BOX3 and client program in BOX1. The client program calls 10.0.2.2.

When I captured packets from BOX1 and BOX3, the IP Source and Destination IP address was like this.

BOX1's SYN Src : 10.0.1.2 Dest : 10.0.2.2  BOX3's SYN Src : 10.0.1.2 Dest : 10.0.2.2 

What I have thought is that in BOX1, Src must be 10.0.1.2 and Dest must be 10.0.1.1. And in BOX3, it must be 10.0.2.1 for Src and 10.0.2.2 for Dest. Because BOX1 communicates with BOX2 and BOX3 commuicates with BOX2.

Why does IP is like that?

Thanks for your help.

Why SetCookie’s SameSite directive applies the destination rather than the origin?

I understand that the SameSite directive tries to protect against cross-origin leakages and CSRFs (see OWASP), but I don’t get why (on my browser at least) it applies to the cookie’s destination rather than on the client’s origin. As a consequence of that choice, it is impossible to benefit from SameSite protection in legitimate cross-origin scenarios.

Let’s say I host some API on https://API and some front-end application on https://FRONT:

    +----------+                                                  +----------+     | FRONT    |                                                  | API      |     |----------|                                                  |----------|     |          |                                                  |          |     |        1 +---------------OPTIONS-/login--------------------->          |     |          |                                                  |          |     |          <----------200--Allow-Origin:-FRONT----------------+ 2        |     |          |                                                  |          |     |        3 ----------------POST-/login------------------------|          |     |          |                                                  |          |     |          <-------201-Set-Cookie:-AccessToken:-sk_123--------+ 4        |     |          |                       HttpOnly;Secure;           |          |     |          |                       SameSite: Strict           |          |     |          |                                                  |          |     |        5 +---------------POST-/protected-------------------->          |     |          |                                                  |          |     |          <----------------403-Forbidden---------------------+ 6        |     +----------+                                                  +----------+ 

In this scenario, my user-agent just ignores the Set-Cookie directive (4). But since the Set-Cookie directive took place while the client was on FRONT, I would have expected it to work. I thought “SameSite” cookie meant “The client was on the same site when the cookie was set and when the cross-origin request was made” which makes a lot of sense from the user’s perspective. But it rather means “The cookie was set on the same site it’s being requested from”. Consequently, in this scenario, you have to set SameSite value to None (otherwise, it’s just dropped) and fallback to the good old “manual” CSRF protection mechanism.

My question is: is there any upside of the current implementation of the SameSite directive from a security standpoint? Would a UA that had implemented the SameSite directive the way I thought it worked be vulnerable to some kind of attacks? Is there any chance that we see some kind of Strict+SameOrigin value for SameSite directive someday?

Thanks.

Why Do All Capture Packets Have 802.11 Prorocol and Broadcast Destination? [closed]

I am new to networking and packet sniffing. I have wireshark installed on my ubuntu machine. I am capturing packets but they all have 802.11 as protocol and Broadcast destination. I have enabled promiscuous mode and I set my network interface to monitor mode using airmon-ng check kill and then airmon-ng start wls1. I am listenning on wls1mon on wireshark. I don’t know what is causing this. I also tried to be on the same network as my test PC. But when I do this, I don’t capture packets even though the PC is youtube and having traffic coming over. I tried with tshark and it is the same problem. When I watched some videos on youtube about this, they all captured packets with different protocols. However, I didn’t pay attention wether they were on monitor or managed mode? Can someone please help me? What I am doing wrong?

Sptfy.com – Change your URL Destination update

Hello Everyone, i hope you have a wonderful Sunday. I have a little update for you regarding Project sptfy.com.

It's called "Change your URL Destination". Basically you can now change which playlist, artist, podcats or album all your short urls point to if you have a registered account on the website.

So, If you head over to sptfy.com, register an account. Then you make a short url while you are logged in you on the…

Sptfy.com – Change your URL Destination update

The Destination is read-only

I have dual booted my pc with Ubuntu 18.04 and Windows10. I am having trouble using one of my disk drives. Like whenever I try to used the DATA drive it shows error: The Destination is read-only.

I checked a solution for this and one says to use ntfsfix. Then another says not to use that as it may corrupt the windows file system. Please let me know how to proceed.