吝吻

文章 评论 浏览 30

吝吻 2025-02-11 04:19:22

要访问电子表格的特定部分,而不是整个表格,您可以使用 rangetoArray() 。然后,您可以将e4指定为起点。为了确保您获得所有行,请使用...

$endRow = $spreadsheet->getActiveSheet()->getHighestRow();

可以用来指定范围的末端以获取...

$data = $spreadsheet->getActiveSheet()->rangeToArray('E4:X' . $endRow);

(不确定X是否适合末端列的范围,您可以根据需要进行调整。 )

要注意的一件事是,由于这是从E列开始的,因此此列值将在数组的0元素中,因此您可能需要调整访问数据的方式。

作为替代方案 - 您可以在所有数据的数组中跳过前几行(您可以使用

To access specific parts of the spreadsheet rather than the whole sheet, you can use rangeToArray(). You can then specify E4 as the start point. To make sure you get all the rows, use...

$endRow = $spreadsheet->getActiveSheet()->getHighestRow();

This can be used to specify the end of the range to fetch...

$data = $spreadsheet->getActiveSheet()->rangeToArray('E4:X' . $endRow);

(Not sure if X is the right range for the end column, you can adjust this as required.)

One thing to note is that as this starts at column E, this columns value will be in the 0 element of the array, so you may need to adjust the way you access the data.

Just as an alternative - you could just skip the first couple of rows in the array of all of the data (you can use array_slice() to chop of the rows you don't want.)

当我使用php将其导入到mySQL时,不想在Excel中包含某些行

吝吻 2025-02-11 03:11:16

您必须首先总结付款,然后仅加入您的查询 -

SELECT
    country.country_name
    ,COUNT(DISTINCT app.patient_id) AS total_unique_visits
    ,ROUND(SUM(IF(pay.payment_method = 1, (payment_amount * rate), 0)),2) as cash_payments
    ,ROUND(SUM(IF(pay.payment_method = 3, (payment_amount * rate), 0)),2) as eft_payments
    ,ROUND(SUM(IF(pay.payment_method IN (2,4), (payment_amount * rate), 0)),2) as card_sales
    ,ROUND(SUM(IF(pay.payment_method = 5, (payment_amount * rate), 0)),2) as cheque_sales
    ,ROUND(SUM(IF(pay.payment_method = 6, (payment_amount * rate), 0)),2) as bond_sales
FROM 
    appointments app 
    INNER JOIN patients p ON p.id = app.patient_id
    INNER JOIN countries country ON country.id = p.p_country
    LEFT JOIN (SELECT patient_id, payment_method, SUM(payment_amount) payment_amount
                 FROM payments
                GROUP BY patient_id, payment_method) pay ON pay.patient_id = app.patient_id 
                                                        AND (pay.payment_date >= '2022-05-01' 
                                                             AND pay.payment_date <= '2022-05-31') 
                                                        AND pay.is_deleted = 0
WHERE 
    app.company_id = 111111111 AND 
    app.clinic_id = 15 AND 
    app.patient_id > 0 AND 
    app.appointment_status = 4 AND 
    (DATE(app.start_date) >= '2022-05-01' AND DATE(app.end_date) <= '2022-05-31') AND 
    app.status = 1
GROUP BY 
    1
ORDER BY 
    country.country_name

因为我没有您的表结构和数据,因此该查询未经测试,但这将为您提供一个基本的想法,可以进一步进行。

You have to sum the payments first and then only join it with your query -

SELECT
    country.country_name
    ,COUNT(DISTINCT app.patient_id) AS total_unique_visits
    ,ROUND(SUM(IF(pay.payment_method = 1, (payment_amount * rate), 0)),2) as cash_payments
    ,ROUND(SUM(IF(pay.payment_method = 3, (payment_amount * rate), 0)),2) as eft_payments
    ,ROUND(SUM(IF(pay.payment_method IN (2,4), (payment_amount * rate), 0)),2) as card_sales
    ,ROUND(SUM(IF(pay.payment_method = 5, (payment_amount * rate), 0)),2) as cheque_sales
    ,ROUND(SUM(IF(pay.payment_method = 6, (payment_amount * rate), 0)),2) as bond_sales
FROM 
    appointments app 
    INNER JOIN patients p ON p.id = app.patient_id
    INNER JOIN countries country ON country.id = p.p_country
    LEFT JOIN (SELECT patient_id, payment_method, SUM(payment_amount) payment_amount
                 FROM payments
                GROUP BY patient_id, payment_method) pay ON pay.patient_id = app.patient_id 
                                                        AND (pay.payment_date >= '2022-05-01' 
                                                             AND pay.payment_date <= '2022-05-31') 
                                                        AND pay.is_deleted = 0
WHERE 
    app.company_id = 111111111 AND 
    app.clinic_id = 15 AND 
    app.patient_id > 0 AND 
    app.appointment_status = 4 AND 
    (DATE(app.start_date) >= '2022-05-01' AND DATE(app.end_date) <= '2022-05-31') AND 
    app.status = 1
GROUP BY 
    1
ORDER BY 
    country.country_name

Since I do not have your table structure and data so this query is untested but this will give you a basic idea to proceed further.

MySQL访问和按国家和付款方式付款

吝吻 2025-02-10 18:25:57

这取决于您的“工作”的含义。

仅测试基本URL会告诉您它是否有效,从某种意义上说:“您已经安装了它并启动了它,并且整个过程都没有掉下来”。 (假设API没有运行可能单独失败的一堆微服务)。

测试每个端点,并确保返回的数据是预期的数据(因此,寻找200个OK是不足的),将告诉您它是否有效,因为“一切都正确实现,并且API可以做应该做的事情”(根据测试质量的“正确”值)。

It depends on what you mean by "working".

Testing just the base URL will tell you if it works in the sense that "You installed it, and started it, and the whole thing hasn't fallen over". (Assuming that the API isn't running of a bunch of microservices which might have individually failed).

Testing every endpoint, and making sure that the data returned is the data expected (so just looking for 200 OK is inadequate) will tell you if it works in the sense that "Everything is implemented correctly and the API does what it is supposed to do" (for a value of "correct" based on the quality of the tests).

检查我测试的API是否有效

吝吻 2025-02-10 10:09:37

您无法在表中动态计算的列。您需要创建一个视图并为每个人分配ID。然后在视图的脚本中,新列的计算将像这样起作用:

(select profit
from table t
where
month = add_months(t.month, -6)
and id = t.id) as same_month_last_year

You can not have dynamically calculated columns in a table. You need to create a view and assign IDs to each person. Then in the view's script, the calculation of the new column will work like this:

(select profit
from table t
where
month = add_months(t.month, -6)
and id = t.id) as same_month_last_year

如何获取12个月前的数据

吝吻 2025-02-10 00:30:06

您可以简单地使用异步/等待进行响应,看看这一点:

 const getCurrentLocation = async () => {
    const result = await fetch("https://ipinfo.io/json?token=$TOKEN");
    return result.json();
  };



 const handleGetLocation = async () => {
   const result = await getCurrentLocation();
   console.log(result);
  };

  useEffect(() => {
    handleGetLocation();
  }, []);

you can simply use async/await to get response, take a look at this one:

 const getCurrentLocation = async () => {
    const result = await fetch("https://ipinfo.io/json?token=$TOKEN");
    return result.json();
  };



 const handleGetLocation = async () => {
   const result = await getCurrentLocation();
   console.log(result);
  };

  useEffect(() => {
    handleGetLocation();
  }, []);

在使用效应中获得不确定的价值(react)

吝吻 2025-02-09 22:06:10

假设您的用户具有所有必需的权限,则说明中的第一件事(INIT_CONNECT命令失败)将是Master和Slave上的init_connect变量:

SHOW GLOBAL VARIABLES LIKE 'init_connect';

两个服务器上都应该是相同的。
(您的主题中的“未连接”将只是指DB - 这不是问题)。

Assuming that your user has all of the required permissions, then the first thing to check based on (init_connect command failed) in your description would be the init_connect variable on both master and slave:

SHOW GLOBAL VARIABLES LIKE 'init_connect';

It should be the same on both servers.
(The 'unconnected' in your subject will simply be referring to the db - which is not an issue).

mysql shell无法添加实例&#x27;无连接&#x27;用户

吝吻 2025-02-09 20:15:41

很抱歉发布错误的答案,但是我想我现在在 Java规范。这是我理解的方式:

我认为以下解释:

private static void addAllObj2(List<Object> list, Object[]... arr) {
    Object o = arr[0];
    Collections.addAll(list, o);
    Collections.addAll(list, arr[1]);
}

返回:

[[Ljava.lang.Integer;@75a1cd57, 4, 5, 6]

索引1的行确实有效,因为在运行时,JVM评估Arity参数输入的类型不会重写 /代码>显然是可能的。 (我想b的类型不会更改)

在使用索引0的行中,由于 type Erasure ,因为它将作为对象o存储。对象的类型oa(integer [])的类型不相同,因此进行了擦除,并将转换为对象,因此将其转换为参考名称。

显然,此过程仅在Arity参数中进行,如没有:

 public static void main(String[] args) {
    List<Object> list3 = new ArrayList<>();
    addAllObj3(list3, trePConcat(a, b));
    System.out.println(list3);

    
}

private static void addAllObj3(List<Object> list, Object[] arr) {
    Collections.addAll(list, arr[0]);
    Collections.addAll(list, arr[1]);
    {
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

private static Object[] trePConcat(Object[]... arr) {
    return arr;
}

返回

[[Ljava.lang.Integer;@75a1cd57, [Ljava.lang.Integer;@3d012ddd]

I am sorry for posting a wrong answer, but I think I found the solution now within the Java Specification. Here is how I understand it:

I think the following explains it:

private static void addAllObj2(List<Object> list, Object[]... arr) {
    Object o = arr[0];
    Collections.addAll(list, o);
    Collections.addAll(list, arr[1]);
}

returns:

[[Ljava.lang.Integer;@75a1cd57, 4, 5, 6]

The line with index 1 does work, because during runtime, the jvm evaluates the arity parameters the the type of the input will not be rewritten The conversion to Integer apparently is possible. (I guess the type of b will not be changed)

In the line with index 0, the type will be evaluated and rewritten due to Type Erasure, as it will be stored as the Object o. The Type of the Object o and a (Integer[]) is not the same, therefore erasure takes place and it will be converted to an Object, hence the reference name.

This process apparently only takes place with arity parameters, as without:

 public static void main(String[] args) {
    List<Object> list3 = new ArrayList<>();
    addAllObj3(list3, trePConcat(a, b));
    System.out.println(list3);

    
}

private static void addAllObj3(List<Object> list, Object[] arr) {
    Collections.addAll(list, arr[0]);
    Collections.addAll(list, arr[1]);
    {
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

private static Object[] trePConcat(Object[]... arr) {
    return arr;
}

returns

[[Ljava.lang.Integer;@75a1cd57, [Ljava.lang.Integer;@3d012ddd]

列表的输出在varargs上使用循环时会有所不同

吝吻 2025-02-09 16:48:30

您的代码仍然符合PCI,但 不安全 。秘密密钥必须牢固地存储在您的Web或移动应用程序的服务器端代码中(例如在环境变量或凭据管理系统中)。从DART打电话意味着您正在向全世界展示自己的凭据。它在 Stripe doc

Your code is still PCI compliant, but not secure. Secret key must be stored securely in your web or mobile app’s server-side code (such as in an environment variable or credential management system). Calling from Dart means you are exposing your credential to the whole world. It's explained in Stripe Doc

直接从我的Flutter应用程序中创建PaymintIntent是PCI是否合规?

吝吻 2025-02-09 13:08:57

createuser您需要使用 nofollow noreferrer“> firebase-admin sdk

使用node.js,使用npm安装firebase-admin安装它。然后:

const admin = require("firebase-admin");
const newId = XXXXXXXXXXXXXx;

admin.auth().createUser({
  uid: newId,
  email: data.email,
  password: data.password,
})
.then(function(userRecord) {
  // See the UserRecord reference doc for the contents of userRecord.
  console.log("Successfully created new user:", userRecord.uid);
})
.catch(function(error) {
  console.log("Error creating new user:", error);
});

请参阅 admin skd用户参考,以获取更多

To createUser you need to use firebase-admin SDK.

With node.js, install it with npm install firebase-admin. Then:

const admin = require("firebase-admin");
const newId = XXXXXXXXXXXXXx;

admin.auth().createUser({
  uid: newId,
  email: data.email,
  password: data.password,
})
.then(function(userRecord) {
  // See the UserRecord reference doc for the contents of userRecord.
  console.log("Successfully created new user:", userRecord.uid);
})
.catch(function(error) {
  console.log("Error creating new user:", error);
});

See Admin SKD user reference for more.

createuser在firebase/auth&#x2b; next.js

吝吻 2025-02-08 18:05:27

首先是,使用workdir而不是运行mkdir
为什么使用workdir

WorkDir指令为任何运行CMD,
入门点,复制并添加以下说明
Dockerfile。如果不存在WorkDir,即使
它在随后的任何Dockerfile指令中均未使用

您可以参考下面的Dockerfile-

FROM node:13-alpine

# Creates directory and sets it as current working directory
WORKDIR /home/app

# Copy everything from local current directory to docker/image current directory
COPY . .

# inside the container it runs the command node server.js
# cmd is an entry point command, whereas run as used later
CMD ["node","server.js"]

The first thing is, to use the WORKDIR instead of running mkdir.
Why use WORKDIR ?

The WORKDIR instruction sets the working directory for any RUN, CMD,
ENTRYPOINT, COPY and ADD instructions that follow it in the
Dockerfile. If the WORKDIR doesn’t exist, it will be created even if
it’s not used in any subsequent Dockerfile instruction

You can refer the below Dockerfile -

FROM node:13-alpine

# Creates directory and sets it as current working directory
WORKDIR /home/app

# Copy everything from local current directory to docker/image current directory
COPY . .

# inside the container it runs the command node server.js
# cmd is an entry point command, whereas run as used later
CMD ["node","server.js"]

运行容器错误时Docker错误:找不到模块&#x27; /home/app/server.js'

吝吻 2025-02-08 07:36:37

杰克短暂地回答了上述评论:

该文档是SGML,而不是XML(第二行:xxx.hdr.sgml

,因此,标签不是XML格式

Jack Fleeting answered in the comments above:

The document is sgml, not xml (2nd line: xxx.hdr.sgml

And consequently, the tags aren’t XML formatted

XML解析器错误缺少标签

吝吻 2025-02-08 03:42:06

问题一:

嗯,正如错误所述,您的求解器类没有称为“方法”的属性。您的属性实际上是“求解器”,因此,不用调用

self.method(self.problem)

问题

self.solver(self.problem)

二:

如果我正确理解您,您想知道如何从求解器构造函数中调用select_sch方法,而不是直接接管一种类型。为此,只需这样做:

class Solver(object):
    def __init__(self, problem, dx, solver_type=1): # choose FE scheme for tetsting
        """
        """
        self.problem, self.dx = problem, dx
        self.solver = self._choose_sch(solver_type)

    @staticmethod
    def _choose_sch(solver_type):
        methods = {1: FE, 2: RK4, 3: ABM4, 4: MLN}
        if solver_type in methods:
            return methods[solver_type]
        else:
            raise ValueError('not choose numerical scheme!')

这里的字典比这些任务的IF语句要好得多。

如果您不需要从静态上下文中调用它,而只是使其直接设置求解器,则也可以将_CHOOSE_ACH变为静态。

Question One:

Well, as the error states, your Solver class doesn't have an attribute called "method". Your attribute is actually "solver", so instead of calling

self.method(self.problem)

Try

self.solver(self.problem)

Question Two:

If I'm understanding you correctly, you want to know how you can call the choose_sch method from within the solver constructor and take in a type instead of a method directly. For that, simply do this:

class Solver(object):
    def __init__(self, problem, dx, solver_type=1): # choose FE scheme for tetsting
        """
        """
        self.problem, self.dx = problem, dx
        self.solver = self._choose_sch(solver_type)

    @staticmethod
    def _choose_sch(solver_type):
        methods = {1: FE, 2: RK4, 3: ABM4, 4: MLN}
        if solver_type in methods:
            return methods[solver_type]
        else:
            raise ValueError('not choose numerical scheme!')

The dictionary here is much better than the if statement for these kinds of tasks.

You can also alternatively not make _choose_ach a staticmethod if you don't need to call it from a static context and just make it set the solver directly.

attributeError:&#x27; solver&#x27;对象没有属性&#x27;方法&#x27;在emellimig类求解器ode

吝吻 2025-02-07 20:01:54

您可以使用将使用相同的lazycolumn parameter:

Column(
    modifier = modifier
) {
    for ((index, documentation) in documentations.withIndex()) {
        key(uniqueKey) {
            // your view
        }
    }
}

这不应该是您的index,因为删除后,将更改已删除的项目下方的所有项目,它应该是您集合中每个项目所独有的标识符。

You can use key which will work the same LazyColumn key parameter:

Column(
    modifier = modifier
) {
    for ((index, documentation) in documentations.withIndex()) {
        key(uniqueKey) {
            // your view
        }
    }
}

This should not be your index, as it will change for all items below the deleted one after deletion, it should be some identifier unique to each item in your collection.

材料滑动以用柱子而不是懒惰的货盘拆除

吝吻 2025-02-07 11:03:53

您要显示的代码使用基于迭代器的构造函数,该构造器接收begin迭代器,以及过去的end end iterator。

问题是,指针也被STL视为迭代器。 ++ ptr运算符以及ptr!= end_ptr*ptr

因此,如果您想从C风格的对象集合中构造一个STL容器,则很有可能这样做。 argv是所有args值的开始,argv [argc -1]是结束。要使指针超过末端,只需进行argv + argc

The code you're showing uses the iterator based constructor, which receives a begin iterator, and a past the end iterator.

The thing is, a pointer is also considered an iterator by the STL. The ++ptr operator works, as well as ptr != end_ptr and *ptr.

So, if you want to construct an STL container from a C-style collection of objects, it's very well possible to do so. argv is the beginning of all the args value(s), and argv[argc - 1] is the end. To get a pointer past the end, simply do argv + argc.

“ argv&#x2b; Argc&quot?

吝吻 2025-02-05 16:46:43

P5JS说createImage()期望第二个参数的整数,而是接收号码。这可以通过更改let img = createImage(w,w,h); tp来解决。 tp 让IMG = CreateImage(int(w),int(h));

我不确定这是否有帮助,因为我不知道您的难题是如何工作的(解决方法),所以请告诉我这是否不起作用,我将进一步调查。

P5JS is saying that createImage() was expecting Integer for the second parameter, received number instead. This can be solved by changing let img = createImage(w, h); tp let img = createImage(int(w), int(h));.

I'm not entirely sure if this helps, because I don't know how your puzzle works (how it's solved) so please tell me if this doesn't work and I'll investigate further.

我如何在幻灯片难题中获得获胜的照片?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文