sql – How do I extract data from a main table based on this specific scenario?

I am using SQL Server 2014. I have a table (T1) which contains the list of IDs of cancelled bookings and their equivalent re-bookings.

Extract of table T1:

CancelledID       Re-bookingID
  301                754
  387                801
  400                900
  ...

Each CancelledID has a unique equivalent in the Re-bookingID column.

I have another table (T2) which contains the list of ALL BookingIDs with additional information related to each ID. An extract of this table is shown below:

BookingID     MonthOfStay      RoomNights
...
301             2019-03-01        10
387             2019-04-01         7
400             2019-03-01         5
754             2019-08-01        10
801             2019-09-01         3
900             2019-07-01         5
900             2019-08-01         4
...   

I need a t-sql query which will me the following output:

  BookingID       Cancelled_MonthOfStay     Re-booking_MonthOfStay     RoomNights
    301                2019-03-01                                           10
    387                2019-04-01                                            7
    400                2019-03-01                                            5
    754                                           2019-08-01                10
    801                                           2019-09-01                 3
    900                                           2019-07-01                 5
    900                                           2019-08-01                 4

As you can see, a re-booking can span over 2 months with additional room nights.

I am thinking about “Joins” between the 2 tables but I am stuck at the logic to be used for the “Joins” (if that is the right way of tackling the problem).

Any help would be appreciated.

published adventures – Looking for a specific Call of Cthulhu scenario

Around a month ago, I’ve read somewhere about a scenario, which right now I can’t seem to find.

All I remember, that it’s setting was either in England or in Scotland, and it has two key antagonists. If I am not mistaken, the hook is that a dilettante asks us to investigate his missing daughter, but that’s not 100% info, maybe I am mixing things up already in my head. The other things I know about it are:

that at the beginning of the scenario, one of the antagonists I think is starting to turn into a were-jaguar and kills a prostitute in the town, and at the end of the scenario if the players don’t succeed the whole town is devoured by something.

I would be really grateful if anyone could point me to the name or the book of this scenario:]

Can a use case scenario be generic

One can guess what generic means for the one who made the request for generic use cases. The best step is to come back to it and ask for examples, then try to derive the theme running through these examples (if any).

Trying to answer in a more philosophical way, I guess a use case can be generic when it describes valid interactions, but doesn't really differentiate the product from the others. Sign up, reset your password, click on links – these are not strictly universal, but they are so common and implemented in a similar way that they can be called generic.

Is a tree view or autocomplete a better user experience for the scenario below?

I'm creating a web app (web app only, no mobile functionality) and wondering if I should use a tree selection (where the user explores hierarchical categories until ; it finds its selection) or a semi-automatic entry (where the desired result is entered in and is filtered according to what has been typed, then the result can be selected. More precisely Material Angular are the versions of each that i & The links for the description and functionality of each are below

Tree

https://material.angular.io/components/tree/overview#nested-tree

https://stackblitz.com/angular/eaalmyagbxpn?file=src%2Fapp%2Ftree-nested-overview-example.ts

Autofill

https://material.angular.io/components/autocomplete/overview#adding-a-custom-filter

https://stackblitz.com/angular/yoqybbxoegl?file=src%2Fapp%2Fautocomplete-filter-example.ts

The specifics of this widget are as follows:

The user can only choose one option.

Each individual user will create these options for their own account. So the selectable options that user 1 sees will be completely different from the ones that user 2 can see, as each user will create them specifically for their own needs.

I am confident that the number of options that each user will create will be no less than 5 and no more than 50 the overwhelming majority of the time (there will be no restrictions put in place anyway, but it would be rare for someone to go above or below these figures).

They will probably use this function between 5 and 25 times a day

Let me know what everyone thinks. Would a tree selection be a better UX experience or a autocomplete better?

How an attacker could exploit an xss in a cookie in the following scenario

In one of the recent penetration tests, I encountered an xss vulnerability in a cookie.
The situation is as follows.

The web application uses the cookie to store the current URL. Once the user switches to another functionality of the application, the cookie information is placed on the website as a link.
The links created are only valid for the current session.

So, for example, by manually setting the cookie as follows Cookie: key=fooXbar results in bar where the foo part is not validated but the bar part is.

Thus, during the manual manipulation of the cookie, there is no validation on the foo part and all script is executed. However, to make it a successful and valid attack, the xss must be served via the actual URL as described above. But the cookie is then set via javascript using escape(document.location.query); the escape() seems to rule out the possibility of making this workable successfully. (for example. ">< bECOMES %22%3e%3c)

So, would there still be a possibility to inject xss via the url so that it is properly included and executed? (Assuming that there are no other vulnerabilities that could help exploit this.)

For now, this would be considered a low result due to the circumstances described. So any other comments or insights are greatly appreciated.
THX

Traveling to other EU countries for work when my work permit visa is pending in Sweden in the current scenario

I applied for a work permit visa in Sweden. I have completed my Masters in Sweden. My employer is registered in Sweden. For the employment requirement, I have to travel to Germany, but my current visa has expired and the work permit visa is in process. Can i travel now

algorithms – Lower limit and worst case scenario

When analyzing algorithms, it does not make sense to consider the best scenario as it is very often trivial and not very informative.

You can convince yourself that almost all algorithms can be adapted to have a complexity of $ O (n) $, or $ n $ is the size of the entry, by simply running a preliminary check that checks whether the entry instance belongs to an instance class for which the solution is trivial.

Just to give a concrete example: the best case for each sorting algorithm can be done $ O (n) $ if you have just checked whether the entered digit sequence is already sorted.

The emphasis is often placed on the complexity of the worst case. Once you've decided to compare algorithms against their most unfavorable complexity, it's also a good idea to ask how quickly a problem can be resolved.

It is usually not possible to give a clear limit to the time required to solve a problem, therefore, one seeks upper and lower limits.

An upper limit of $ O (f (n)) $ tells you that there is an algorithm that solves the problem in $ O (f (n)) $ worst time.

A lower bound of $ Omega (g (n)) $ tells you that no imaginable algorithm can take $ o (g (n)) $ time to resolve the problem.

Just to be clear: a lower bound for the time it takes to solve a problem is expressed as a function of the input size $ n $ and is the smallest amount of work required to solve all instances of size $ n $, that is to say., $ min_ {A in mathcal {A}} max_ {I in mathcal {I} _n} T (A, I) $ or $ mathcal {A} $ is the set of all possible algorithms that solve your problem, $ mathcal {I} _n $ is the set of all size instances $ n $, and $ T (A, I) $ is the time required to $ A in mathcal {A} $ to resolve the proceeding $ I in mathcal {I} _n $.

You seem to have in mind the wrong definition, namely, $ min_ {A in mathcal {A}} min_ {I in mathcal {I} _n} T (A, I) $.

This is useful for establishing the "difficulty" of a problem to be solved (problems that require more time to be solved (even with the best possible algorithm) are more difficult), and for measuring the extent to which an algorithm does not Is not optimal.
For example, sorting by merge is optimal for the sorting problem because its execution time (asymptotic) corresponds to $ Omega (n log n) $ lower bound of the sorting problem (in the comparison model).

The best coronavirus death scenario is lower now, why?

the 60k is not a scenario of any kind – it is an estimate

in simple terms – an educated guess

only time will tell if it was a good guess –

for now, they can only take into account the factors they know and give them the weighting that they think is correct, but they only miss one factor or get the weighting of ; wrong that they could have VERY badly in their estimation

even if they get it correctly, it is not impossible, they got a correct estimate but for the wrong reasons (for example, they made 2 errors in their calculation but the 2 got canceled)

c # – Managing the disconnected entity scenario in Entity Framework Core

As you may know, managing disconnected entities in EF can be a bit of a headache. After a very long weekend, I managed to get it to work for my use case and refactor the code to the best of my knowledge. However, I'm still not satisfied because every time I need to add a new entity to map, it requires a significant amount of effort + error-prone code.

The main problems I encounter with my current implementation are:

  1. There is a LOT of master code. Having to manage each property individually, specially owned types, makes the code very long.

  2. The code is VERY duplicated, specially owned types. However, even if I tried some techniques, like using reflection to make it less effective, it wouldn't work. For example, the Reference The method provided by the context entry expects real access to the property, not a value, so I can't use the method GetProperty help that I made.

  3. This is not scalable: if I add a possessed type, say the address, to one of the relationships, say BankInfo, then the code I need to write multiplies and the quantity of branches is huge. This particularly bothers me because it is something that I have to do in the end.

Without further deadline, this is a simplified version of my work code. Please keep in mind that for the sake of simplicity, I have not included ALL the POCOs, but I have their reference so that the complexity can be noticed. Let's just assume it's a POCO (BankInfo, Doctor, Medicare, etc.)

using System.Threading.Tasks;

(Owned)
public class Address
{
    public string Street { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string Zipcode { get; set; }
    public string County { get; set; }
}

// Relationship class
public class BankInfo
{
    public int ID { get; set; }

    (ForeignKey("Client"))
    public int ClientID { get; set; }
    public Client Client { get; set; }

    public string Phone { get; set; }
    public string Bank { get; set; }
    public string RoutingNumber { get; set; }
    public string AccountNumber { get; set; }

    public Address Address { get; set; }
}

public class Client
{
    public int ID { get; set; }

    public string FirstName { get; set; }
    public string MiddleName { get; set; }
    public string LastName { get; set; }

    // Owned Types
    public Address Address { get; set; }
    public Address MailingAddress { get; set; }

    // Relationships - All are POCOs. BankInfo provided as an Example.
    public BankInfo BankInfo { get; set; }
    public MedicareAccount Medicare { get; set; }
    public Doctor Doctor { get; set; }
    public List Prescriptions { get; set; }

    public Client()
    {
        Prescriptions = new List();
    }

    // In order to be able to access properties dynamically from
    // ClientService - see below for usage.
    public object this(string propertyName)
    {
        get
        {
            var property = GetType().GetProperty(propertyName);
            return property?.GetValue(this, null);
        }
        set
        {
            var property = GetType().GetProperty(propertyName);
            property?.SetValue(this, value, null);
        }
    }
}

class ClientService
{
    void Main()
    {
        private ClientContext _context;

        public async Task FindById(int id)
        {
            return await _context.Clients
                .Include(b => b.BankInfo)
                .Include(b => b.Medicare)
                .Include(b => b.Doctor)
                .Include(b => b.Prescriptions)
                .FirstOrDefaultAsync(m => m.ID == id);
        }

        private async Task HandleDisconnectedScenario(Client client)
        {
            var existingClient = await FindById(client.ID);
            _context.Entry(existingClient).CurrentValues.SetValues(client);

            // Handle simple one-to-one relationships
            HandleOneToOneRelationship(existingClient, client, GetPropertyName(() => client.BankInfo));
            HandleOneToOneRelationship(existingClient, client, GetPropertyName(() => client.Doctor));
            HandleOneToOneRelationship(existingClient, client, GetPropertyName(() => client.Medicare));

            // Handle owned types
            if (existingClient.Address == null && client.Address != null)
            {
                _context.Entry(existingClient)
                    .Reference(a => a.Address).CurrentValue = client.Address;
            }
            else if (existingClient.Address != null && client.Address != null)
            {
                _context.Entry(existingClient.Address).CurrentValues.SetValues(client.Address);
            }
            else if (existingClient.Address != null && client.Address == null)
            {
                _context.Remove(existingClient.Address);
            }

            if (existingClient.MailingAddress == null && client.MailingAddress != null)
            {
                _context.Entry(existingClient)
                    .Reference(a => a.MailingAddress).CurrentValue = client.MailingAddress;
            }
            else if (existingClient.MailingAddress != null && client.MailingAddress != null)
            {
                _context.Entry(existingClient.MailingAddress).CurrentValues.SetValues(client.MailingAddress);
            }
            else if (existingClient.MailingAddress != null && client.MailingAddress == null)
            {
                _context.Remove(existingClient.MailingAddress);
            }

            // Handle one-to-many relationships
            foreach (var prescription in existingClient.Prescriptions)
            {
                if (client.Prescriptions.All(p => p.ID != prescription.ID))
                {
                    _context.Remove(prescription);
                }
            }

            foreach (var prescription in client.Prescriptions)
            {
                var existingPrescription = existingClient.Prescriptions.FirstOrDefault(p => p.ID == prescription.ID);
                if (existingPrescription == null)
                {
                    existingClient.Prescriptions.Add(prescription);
                }
                else
                {
                    _context.Entry(existingPrescription).CurrentValues.SetValues(prescription);
                }
            }
        }

        private void HandleOneToOneRelationship(Client existingClient, Client client, string property)
        {
            var currentValue = client(property);
            var existingValue = existingClient(property);

            if (existingValue == null && currentValue != null)
            {
                _context.Add(currentValue);
            }
            else if (existingValue != null && currentValue != null)
            {
                _context.Entry(existingValue).CurrentValues.SetValues(currentValue);
            }
            else if (existingValue != null)
            {
                _context.Remove(existingValue);
            }
        }

        private static string GetPropertyName(Expression> propertyExpression) =>
            (propertyExpression.Body as MemberExpression)?.Member.Name;
    }
}
```

personas – What is the difference between the scenario and the user journey?

The creation of a user journey places a strong emphasis on the characters and also merges the creation of scenarios and user flows. However, unlike user flows, hierarchies or functional specifications (which explain the interaction between a user and the logic and processes of a system), user journeys explore the mental and lived "patterns, processes and paths" of a user and translate them into the web. experiences.

(…)

Think of user needs and associated content in a form of time progression. You need a start, a middle, and an end. All of this is quite logical; the trick is just to play a role. Put yourself in the mindset of your user and imagine how the states of need evolve as you progress through the overall process.

In other words, a scenario can be considered a singular situation and a trip can be a collection of scenarios that together form a narrative that defines the total experience of users using your site.