How to format or change the physically printed version of a page? In this case, it is the order summary page in the administrator

I am trying to change the appearance of the order summary page found in the administrator when it is physically printed on a printer. I've been inspecting the popup window of the print preview page in Chrome, and I have no idea how to do it.

Getting error for junit and the test case fails when I execute it

Getting error for junit and the test case fails when I run it .

Below is the code snippet.

Do I need to add an additional dependency apart from Jupiter for Junit5?

For a new payment I will have to update the junit dependency to be successful.

Please suggest any other option.

package com.baml.pt;

import static org.junit.jupiter.api.Assertions.assertEquals;

import static org.mockito.Mockito.when;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.junit.Before;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;



/**
 * Unit test for simple App.
 */


public class AppTest {

    @InjectMocks
    ReconImpl service;

    @Mock
    ReconO dao;

    @Before
    public void init() {
        MockitoAnnotations.initMocks(this);
    }
    private List returnListSrcTo= new ArrayList();

    private List returnListStg = new ArrayList();

    @BeforeEach
    public void setMockOutput() throws Exception {
        MockitoAnnotations.initMocks(this);

        Date date = new Date();
        long time = date.getTime();
        Timestamp ts = new Timestamp(time);

        SrcTec src4 = new SrcTSec();
        SrcTSec src3 = new SrctgSec();

        /* Data1 */
        src4.setSourceSystem("sourceSystem1");
        src4.setSource("source1");
        src4.setCatCd("catCd1");
        src4.setRunTimeStamp(ts);
        src4.setMetVolTol("metVolTol1");
        src4.setMetRejTol("metRejTol1");
        src4.setMetReconTol("metReconTol1");
        src4.setStatus("status1");
        src4.setAuthorizedBy("authorizedBy1");
        src4.setReconReviewerComments("reconReviewerComments1");
        src4.setGoNoGoTimeStamp("goNoGoTimeStamp1");
        src4.setSecReviewerViewed("secReviewerViewed1");
        src4.setSecReviewDoneBy("secReviewDoneBy1");
        src4.setSecReviewerComments("secReviewerComments1");
        src4.setApplicationId("applicationId1");
        src4.setStage("stage1");
        src4.setLoadId(1);
        src4.setRepYearMonth("repYearMonth1");
        src4.setYearEndInd("yearEndInd1");

        /* Data2 */
        src3.setSourceSystem("sourceSystem2");
        src3.setSource("source2");
        src3.setCatCd("catCd2");
        src3.setRunTimeStamp(ts);
        src3.setMetVolTol("metVolTol2");
        src3.setMetRejTol("metRejTol2");
        src3.setMetReconTol("metReconTol2");
        src3.setStatus("status2");
        src3.setAuthorizedBy("authorizedBy2");
        src3.setReconReviewerComments("reconReviewerComments2");
        src3.setGoNoGoTimeStamp("goNoGoTimeStamp2");
        src3.setSecReviewerViewed("secReviewerViewed2");
        src3.setSecReviewDoneBy("secReviewDoneBy2");
        src3.setSecReviewerComments("secReviewerComments2");
        src3.setApplicationId("applicationId2");
        src3.setStage("stage2");
        src3.setLoadId(2);
        src3.setRepYearMonth("repYearMonth2");
        src3.setYearEndInd("yearEndInd2");


        returnListSrcSec.add(src4);
        returnListSrcSec.add(src3);


        when(dao.getReconSecRevSData("2019", "2020")).thenReturn(returnListsrc433);
    }

    @DisplayName("Test Mock ReconReviewServiceImpl + ReconReviewDAO")
    @Test
    public void testApp() throws Exception {
        Date date = new Date();
        long time = date.getTime();
        Timestamp ts = new Timestamp(time);

        SrcTSec src4 = new SrcTSec();
        SrcTSec src3 = new SrcTSec();

        /* Data1 */
        src4.setSourceSystem("sourceSystem1");
        src4.setSource("source1");
        src4.setCatCd("catCd1");
        src4.setRunTimeStamp(ts);
        src4.setMetVolTol("metVolTol1");
        src4.setMetRejTol("metRejTol1");
        src4.setMetReconTol("metReconTol1");
        src4.setStatus("status1");
        src4.setAuthorizedBy("authorizedBy1");
        src4.setReconReviewerComments("reconReviewerComments1");
        src4.setGoNoGoTimeStamp("goNoGoTimeStamp1");
        src4.setSecReviewerViewed("secReviewerViewed1");
        src4.setSecReviewDoneBy("secReviewDoneBy1");
        src4.setSecReviewerComments("secReviewerComments1");
        src4.setApplicationId("applicationId1");
        src4.setStage("stage1");
        src4.setLoadId(1);
        src4.setRepYearMonth("repYearMonth1");
        src4.setYearEndInd("yearEndInd1");

        /* Data2 */
        src3.setSourceSystem("sourceSystem2");
        src3.setSource("source2");
        src3.setCatCd("catCd2");
        src3.setRunTimeStamp(ts);
        src3.setMetVolTol("metVolTol2");
        src3.setMetRejTol("metRejTol2");
        src3.setMetReconTol("metReconTol2");
        src3.setStatus("status2");
        src3.setAuthorizedBy("authorizedBy2");
        src3.setReconReviewerComments("reconReviewerComments2");
        src3.setGoNoGoTimeStamp("goNoGoTimeStamp2");
        src3.setSecReviewerViewed("secReviewerViewed2");
        src3.setSecReviewDoneBy("secReviewDoneBy2");
        src3.setSecReviewerComments("secReviewerComments2");
        src3.setApplicationId("applicationId2");
        src3.setStage("stage2");
        src3.setLoadId(2);
        src3.setRepYearMonth("repYearMonth2");
        src3.setYearEndInd("yearEndInd2");


        returnListsrc433.add(src4);
        returnListsrc433.add(src3);


        assertEquals(returnListsrc433, service.getReconSecRevSrcToStgData("2019", "2020"));

        when(dao.getReconSecRevSrcToStgData("2019", "2020")).thenReturn(returnListsrc433);

    }

    @Test
    public void testReconSrcToStgData() throws Exception{
        Date date = new Date();
        long time = date.getTime();
        Timestamp ts = new Timestamp(time);

        List goNoGoList = new ArrayList<>();

        SrcT src2 = new SrcT();
        SrcT srcT = new SrcT();


        src2.setApplicationId("applicationId1");
        src2.setAuthorizedBy("authorizedBy");
        src2.setData("data");
        src2.setDirtyFlag(true);
        src2.setDisplayFlag(true);
        src2.setGoNoGoDecision("goNoGoDecision1");
        src2.setGoNoGoList(goNoGoList);
        src2.setGoNoGoTimeStamp("ts");
        src2.setJobSubmission("jobSubmission1");
        src2.setLoadId(1);
        src2.setMetReconTol("metReconTol1");
        src2.setMetRejTol("metRejTol1");
        src2.setMetVolTol("metVolTol1");
        src2.setReconReviewerComments("reconReviewerComments");
        src2.setRepYearMonth("repYearMonth1");
        src2.setRunTimeStamp(ts);
        src2.setSource("source1");
        src2.setStage("stage1");
        src2.setStatus("status1");
        src2.setTotalStgAmt("totalStgAmt1");
        src2.setTotalStgCnt("totalStgCnt1");
        src2.setYearEndInd("yearEndInd1");


        src2.setApplicationId("applicationId2");
        src2.setAuthorizedBy("authorizedBy");
        src2.setData("data");
        src2.setDirtyFlag(true);
        src2.setDisplayFlag(true);
        src2.setGoNoGoDecision("goNoGoDecision2");
        src2.setGoNoGoList(goNoGoList);
        src2.setGoNoGoTimeStamp("ts");
        src2.setJobSubmission("jobSubmission2");
        src2.setLoadId(2);
        src2.setMetReconTol("metReconTol2");
        src2.setMetRejTol("metRejTol2");
        src2.setMetVolTol("metVolTol2");
        src2.setReconReviewerComments("reconReviewerComments");
        src2.setRepYearMonth("repYearMonth2");
        src2.setRunTimeStamp(ts);
        src2.setSource("source2");
        src2.setStage("stage2");
        src2.setStatus("status2");
        src2.setTotalStgAmt("totalStgAmt2");
        src2.setTotalStgCnt("totalStgCnt2");
        src2.setYear("year2");


        returnListSg.add(src2.);
        returnListStg.add(src2.);

        when(dao.getReData("2019", "2020")).thenReturn(returnListSrcToStg);
        assertEquals(returnListSrcToStg, service.getData("2019", "2020"));

    @DisplayName("Test Mock RecImpl + ReconReviewDAO + getRecevsrc122Data()")
    @Test
    public void testApp() throws Exception {
        assertEquals(2, service.getReconSecRevsrc122Data("2019", "2020").size());
    }

    @DisplayName("Test Mock ReImpl + ReconReviewDAO + getRecc122Data()")
    @Test
    public void testRecoc122Data() throws Exception {
        assertEquals(2, service.getRecrc122Data("2019", "2020").size());
        assertFalse(service.getRerc122Data("2019", "2020").size() == 0);
    }
    }

}

I get an error for junit and the test case fails when I run it.

Below is the code snippet.

Do I need to add an additional dependency apart from Jupiter for Junit5?

For a new payment I will have to update the junit dependency to be successful.

Please suggest any other option.

SUM several CASE results – Exchange of database administrators stack

You did not specify your RDBMS (SQL Server, Oracle, etc.), but if you support common table expressions, you could encapsulate your main selection logic in a CTE and select / sum of it. Here is a solution using SQL Server.

Declare @T table (A int, B int, C int)
insert into @T(A,B,C) values(null,2,null)

;WITH _cte
AS (
    SELECT CASE 
            WHEN A IS NULL
                THEN 1
            ELSE 0
            END AS (A)
        ,CASE 
            WHEN B IS NULL
                THEN 1
            ELSE 0
            END AS (B)
        ,CASE 
            WHEN C IS NULL
                THEN 1
            ELSE 0
            END AS (C)
    FROM @T
    )
SELECT A + B + C as Results
FROM _cte

Results
2

As one comment pointed out, no need A common table expression. A derived table will also serve the purpose

Declare @T table (A int, B int, C int)
insert into @T(A,B,C) values(null,2,null)
SELECT A + B + C AS Results
FROM (
    SELECT CASE 
            WHEN A IS NULL
                THEN 1
            ELSE 0
            END AS (A)
        ,CASE 
            WHEN B IS NULL
                THEN 1
            ELSE 0
            END AS (B)
        ,CASE 
            WHEN C IS NULL
                THEN 1
            ELSE 0
            END AS (C)
    FROM @T
    ) a

python – Foo Bar – The Power Hungry challenge test case fails in unknown extreme cases

You have too much code.

First filter the zeros:

xs = filter(lambda a: a != 0, xs)

Then, filter the positive aspects to one list and the negative ones to another:

for num in xs:
    if num > 0:
        positives.append(num)
    elif num < 0:
        negatives.append(num)

So why bother with the first filtering? The zeros would not enter any of the lists in this cycle; They are naturally filtered.

You order the negatives matrix unnecessarily. You only need to do it if it contains an odd number of elements. And you don't need to protect the proof of whether it contains an odd number of items with a check if it contains any items.

Without positive values ​​and 1 negative value it seems a strange special case. If you let the code move beyond that point, the unique odd value will be removed from the negative matrix, without leaving positive values ​​or negative values, which seems a special case less "special."

Simplified code

def solution(xs):
    negatives = (num for num in xs if num < 0)
    positives = (num for num in xs if num > 0)

    if len(negatives) % 2 != 0:
        negatives.sort()
        negatives.pop()

    if positives or negatives:
        product = 1
        for x in positives + negatives:
            product *= x

        return str(product)

    return '0'

This should behave just like your original code (complete without going through some extreme cases), but it should be a little faster.


Do you really need to order the negatives training? That's a $ O (N log N) $ operation. You just need to remove the smallest magnitude number from the array, and finding and removing that can be done in $ O (N) $ time.


What is the maximum product of a non-empty subset of (-4)?

I read that if there is only one negative number in the array, it should return 0, but I also read that it should return the negative value.

It seems unreasonable to return zero in this case, because the only non-empty subset is (-4), and the maximum product is -4.

What's going on (-4, 0)? Both of them 0 > -4 Y -4 * 0 > -4, so the maximum product is no longer -4.

Modification of the code left to the student.

java – Test case for rowBoat ()

I'm writing a test case called No Farmer No Row where I would call the next method with nothing in the boat. When I call the rowBoat method, it should still be on Start, however, it will still row to end. Am I missing a logic in my method?

public void rowBoat() {
    assert (boatLocation != Location.BOAT);
    if (boatLocation == Location.START) {
        boatLocation = Location.FINISH;
    } else {
        boatLocation = Location.START;
    }
}

c # – How to design the interface method for the following case?

I am doing a Snmp agent. To pass information to this Snmp agent, I need to periodically extract data from two different sources and there may be more sources in the future. I was designing the interface for these periodic data extractors.

However, both extractors return a different set of information. In addition, in the case of an extractor, we must also pass some state to obtain the information, while the other extractor does not need any state as an argument.

Therefore, the input argument and the type of return depend on the specific extractor. Now, to have a common interface for these data extractors, I will need generics for both the input parameter and the type of return.

public interface DataExtractor {
  R GetData(T state = null) where T : DataExtractInitParam;
} 

where DataExtractInitParam it is an abstract class of marker without fields and I will inherit it to create initial state parameter types. In addition, I can have a similar hierarchy for the type of return, but all this makes me think that the interface definition has become very complex.

Although, semantically, the implementations of this interface are doing the same (that is, they follow a contract to extract data for Snmp), it is difficult to find a simple common interface due to the different inputs and outputs of the two extractors.

Another bad thing with this design that comes to mind is that the caller of the interface methods may somehow call the method through the interface reference, but in the end we will have to downcast The data that will be returned. Then, the caller needs to know about the type of return of the specific implementation that exceeds the purpose of having an interface for the loose coupling completely. (This makes me feel that I am surely wrong with my design).

One solution I think about is having void return the type and maintain the status returned by the methods as global class level data, but again the global status variables are not a good design.

I would appreciate help designing the interface.

What http error to return in case of validation and commercial rules in a domain-directed design API

I have a .net core API that tries to implement it according to the design principles of the domain unit.

In the domain layer there is an audience Create Method that contains all the validation and commercial rules. If one fails, it will throw an exception. Basically, you cannot create an invalid entity or an invalid value type. For example:

public class Adult
{
   private Adult(string name,int age)
   {
       this.Name = name;
       this.Age = age;
   }

   public string Name { get; }

   public int Age { get; }

   public static Adult Create(string name, int age)
   {
      if (string.IsNullOrWhiteSpace(name))
          throw new ArgumentException(nameof(name));

      if (age < 18)
         throw new ArgumentException("age should not be less that 18");

     return new Adult(name, age);
 }

}

In the web layer, my web data has the basic validation attributes. For example:

public class AdultWebDto
{
   (Required)
   public string Name {get; set; }

   public int Age {get; set; }
}

Basically, if the user tries to create an unnamed adult, it will return a 400 error, but if he tries to create a user with an age under 18, he will pass the dto validation and return a 500 error.

Of course, if the user requests an Adult with an invalid name or age, he will return an error 500 since the data coming from the repository was invalid.

Is it what I am doing well? So, for simple validation rules to verify that in the web layer and return a 400 error but in the case of more complicated business rules to return a 500 error?

Should I use regular paging or infinite scrolling in this case?

Let me respond as a user of web pages. I don't have a UX designer research to support me, just this emotion and personal experience as an end user (it's certainly unusual):

The mere idea of ​​infinite displacement invokes visceral anger as a first reaction for me (anger is omitted for brevity). When I realize that a page has infinite scrolling, my immediate thought is "Oh, great, I hope I never have to go" down "very far".

I think that infinite displacement does not have to be inherently bad, but I think it is worth asking the following questions:

  1. What are the chances that your users want to return to a specific point in the content? If so: does it have a good search function (specific to its content, for example, a search by time range for content that has a clear chronological order) that can meet such needs? Do you have a way to mark a specific place in your infinite scrolling content?

  2. How big is your content, in terms of screen space? Sometimes, I will be on a social networking site, wanting to catch up with all the new things in my feed / watches / subscriptions / whatever: if the content is large, just the simple scrolling becomes annoying, and it also makes it harder and longer to find exactly what I am looking for, I want to go back to it.

  3. How large is its content, in terms of actual consumption of computer memory? Once I wanted to check a couple of years of posts on someone's Instagram account: halfway, my reasonably high-end computer was starting to lag on that website, because when you scroll infinitely, you're probably not downloading the content at the top (Instagram was not), so my browser was accumulating gigabytes of image data in memory.

In summary: is your common use case overwhelmingly in favor of a casual reading of some datasets larger than a single page, but not substantially larger?

Disclaimer: I know I'm weird. My personal preference will almost always be pagination. The way I browse the web page is plus Nice for me to move around. I don't expect the world to align with me. I would only like an option to use pagination on pages that matter to me (unfortunately I often don't), or at least some way to return or find a specific place in infinite scrolling if that's what I have to deal with.

PD Are you interested in users who browse with limited JavaScript or without JavaScript enabled? It is worth remembering that there are people like this, and there are several good reasons (accessibility needs and computer security awareness are primary among them, although there are others) to navigate with disabled scripts by default. Infinite scrolling can only work with JavaScript enabled, while paging can be made easier to use with JavaScript, but it can be more directly degraded to simple HTTP requests as needed.

pr.probability – Girsanov in the case of reflected Brownian movement

Consider a generalized reflected Brownian movement $$ X (t) = F (t) + B (t) + L (t) $$ where $ F $ It is the control function, $ B $ it is a standard brownian movement and $ L $ It is the Skorokhod regulator. I would like to realize Girsanov's theorem to activate $ X $ in a standard Brownian movement. I have not found any reference when applying Girsanov in this case. Can you direct me to any reference?