Determining response codes from void functions OOP

I am trying to create a Put endpoint using rest. Let’s say that under the link

/addresses/12345 

I am trying to add a new address (if that id doesn’t exist) or I’m trying to update it if it does already exist.

My application has several layers Controllers, Services, Models and Repositories. Given the fact that the business layer decides if an update or an add is required (this logic takes place in the service layer and below), how would the controllers be able to find out if an update or an add happened and return the correct status codes (201 for resource created, 204 if just an update has occured)?

My only ideas are to return some sort of result object, but that doesn’t feel particularly correct. For the cases where the service methods are not void, they usually return DTOs.

Determining total of primitive operations and running time for code [duplicate]

This question already has an answer here:

  • Is there a system behind the magic of algorithm analysis? 3 answers

i needed some help with these problem in DSA

For the given pseudo code:

for( i=0; i<n; i++ ) a[i] = 0;  for( i=0; i<n; i++ )   for( j=0; j<n; j++ )      a[i] += a[j] + i + j; 

Determine:

1. Total number of primitive operations 2. Running Time 

Questionnaire for determining usability of a system

As part of a pitch, business are determining the usability of two software products and have come up with a questionnaire to ask a set of end users.

They have asked me to feedback on the questionnaire and I said I will come up with 5-10 questions that variously test the usability of the two software systems.

The software systems are document search and markup applications.

My question is: what are the best questions to ask?

At the minute I’m seeking answers to how learnable the software is, how easy it is to perform common actions, how fast users can perform common actions etc

EDIT

As I think of it, the questionnaire should be voiced “comparing the two systems, which one did you find the easiest to learn? Why?”

Approaches to dynamically determining if concurrency needed

There is a series of procedures, each of which falls into one of two general categories.

Most of these are of category 1: it would be best to execute them one at a time – the overhead associated with threading or even using a thread pool negates any gains.

However there are a few of category 2: it would be best to move these into a concurrency scenario, like a different thread, a task, etc. These procedures, unlike the others, do justify the overhead.

The series is made up of an unknown number and unknown order of both categories, other than the fact that most will usually be of category 1.

What are the known approaches to solving this problem? Here is a stab at some approaches, but I’m curious if there are others or if there is a comprehensive survey of the problem.

  1. Start all procedures sequentially, but determine mid-process if it should be moved to a separate concurrent process.
  2. Have a ‘look-ahead’ process running simultaneously that decides what category the procedure belongs to. It is referred to when a procedure is ready to be started.

Both of these ideas have a tradeoff (as I’m sure any approach will): the added intelligence costs something that adds to the overhead.

Determining data transformation approach

An application that I’m working with is transforming IPv6 addresses into an alternative format and then storing them in a SQL table. I’d like to read the SQL table and translate the data from its current state back into the IPv6 address. I’m looking for insights into how to perform this translation. Here’s a few examples:

Example#1 Data string stored in the SQL data: JgMQtgkDAJrK_gAAAAAACA

Is actually this IP address: 2603:10b6:903:9a:cafe:0:0:8

Example#2 JgMQtgkQAIjK_gAAAAAAFA = 2603:10b6:910:88:cafe:0:0:14

Appreciate your help!

Linear Algebra – Determining a point on a plane given a normal and a vector that passes through a point

I’m really stuck on determining the constraints of this question in part 2.

Part one states:

Throughout this question P will be the plane in R^3 that passes through the origin and is normal to the vector n. Furthermore, p ∈ R ^3 will be a point that is not on P and L will be the line in R^3 that passes through the point p and is in the direction some vector v.  Draw a schematic diagram to display the above. 

The above I believe I can do

This is where I’m currently stuck:

Give a necessary and sufficient condition on n and v so that L intersects P and find a formula in terms of n, p and v for this point of intersection. 

Any help and links to further resources would be greatly appreciated.

Determining the Spell DC of a spell cast via Staff


Rule #1

Excerpt from “Using Staves” [Magic Items -> Staves -> Using Staves][1] says

Staves use the wielder’s ability score and relevant feats to set the DC for saves against their spells. Unlike with other sorts of magic items, the wielder can use his caster level when activating the power of the staff if it’s higher than the caster level of the staff.

Rule #2

Excerpt from “Magic Items” [Magic Items -> Saving Throws Against Magic Item Powers][2] says (Emphasis mine)

Staves are an exception to the rule. Treat the saving throw as if the wielder cast the spell, including caster level and all modifiers to save DCs.

Question

I find these contradictory, so how can i determine the Spell DC and / or Caster Level of a spell cast via a staff? Also, since all staves are at least 8th CL, wouldn’t these be too powerful for low-level chasters? 8 rounds of summon monster I (1 round / level), 8 hours of pass without a trace etc.

Determining the primitive order of a binary matrix

Let $ {\bf A}_n$ be an $ 2n \times 2n$ matrix that is defined as follows

$ $ {\bf A}_n=\left( \begin{array}{c} 0&0&\cdots&0&0&0&0&0&1&1\ 0&0&\cdots&0&0&0&1&0&0&0\ 0&0&\cdots&0&0&1&1&0&0&0\ 0&0&\cdots&1&0&0&0&0&0&0\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots\ \cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots&\cdots\ 1&1&\cdots&0&0&0&0&0&0&0\ 0&0&\cdots&0&0&0&0&0&1&0\ \end{array} \right). $ $

For instance, the matrix $ {\bf A}_5$ is given by

$ $ {\bf A}_5=\left( \begin{array}{cccccccccc} 0&0&0&0&0&0&0&0&1&1\ 0&0&0&0&0&0&1&0&0&0\ 0&0&0&0&0&0&1&1&0&0\ 0&0&0&0&1&0&0&0&0&0\ 0&0&0&0&1&1&0&0&0&0\ 0&0&1&0&0&0&0&0&0&0\ 0&0&1&1&0&0&0&0&0&0\ 1&0&0&0&0&0&0&0&0&0\ 1&1&0&0&0&0&0&0&0&0\ 0&0&0&0&0&0&0&0&1&0 \end{array} \right). $ $

My Question: How to show that the $ (n+2)$ th power of $ {\bf A}_n$ , denoted with $ {\bf A}_n^{n+2}$ , is a positive matrix and matrices $ {\bf A}_n^{i}$ with $ 1\leq i \leq n+1$ are not positive matrices?

For instance, it can be checked that $ {\bf A}_5^{7}$ is a positive matrix and matrices $ {\bf A}_5^{i}$ with $ 1\leq i \leq 6$ are not positive matrices.

I know this question is related with the concept of primitive matrices and may be by considering the values of the eigenvalues of $ {\bf A}_n$ we can obtain an answer. But I would like to find out a combinatoric answer. For example, we can consider $ {\bf A}_n$ as an incidence matrix of a weighted directed graph. Then we should check why there is at least a directed walk between every nod of the graph of length $ n+2$ ? The weighted directed graph of $ {\bf A}_5$ can be drawn in the following form

enter image description here

It follows from the given graph that there is at least a directed walk between every nod of the graph of length $ 7$ . Also, it can be checked that there is no directed walk between the node 4 to the node 2 of length less than seven.

Thanks for any suggestions.