问:
docker, interactive brokers gateway, networking and python script exectution
To give a bit of a background, I have been working on an Interactive Brokers python algo using mainly IB gateway to execute python scripts.

Recently I started doing a bit of paper trading running everything locally, without a problem. The issue is, I can not work on python algo while it's running locally.

With that said, my idea is to run the IB gateway on one docker container on the Linode cloud alongside the main algo routine on a separate container (order executions, portfolio management, etc.). The second part of the idea is to be able to connect from my local machine to the IB Gateway docker container (with a different client ID) and be able to interact with the API (of course not submitting orders, but e.g. checking the PnL).

I have managed to set up a docker container with IB Gateway locally and connect to that container with my local pc and execute scripts which encouraged me to try to do the same on the cloud, at least the first part of the idea (2 containers, one with IB gateway, and second with python algo routine)

Needless to mention, this failed miserably, I can not successfully connect to IB gateway from another container. I have tried adding all the local IPs and docker IPs such as 127.0.0.1, 172.17.0.1/16 to IB Gateway, which didn't work

I have pulled the below 2 containers:

https://hub.docker.com/r/mgvazquez/ibgateway

https://hub.docker.com/_/python

if it is helpful to see, below is the result of the docker ps command

```<code>CONTAINER ID   IMAGE                        COMMAND           CREATED          STATUS          PORTS                                         NAMES
58300d180939   mgvazquez/ibgateway:latest   "/sbin/my_init"   50 minutes ago   Up 23 minutes   0.0.0.0:4002->4002/tcp, :::4002->4002/tcp, 0.0.0.0:5900->5900/tcp, :::5900->5900/tcp, 0.0.0.0:7497->7497/tcp, :::7497->7497/tcp   dckrcmps_gateway_1
</code>```

PS this is the first time I'm dealing with docker and a combination of docker and IB Gateway topic seems to be a bit limited online and Im a bit stuck, I spend 4 days on this without success.

Body:
To give a bit of a background, I have been working on an Interactive Brokers python algo using mainly IB gateway to execute python scripts.

Recently I started doing a bit of paper trading running everything locally, without a problem. The issue is, I can not work on python algo while it's running locally.

With that said, my idea is to run the IB gateway on one docker container on the Linode cloud alongside the main algo routine on a separate container (order executions, portfolio management, etc.). The second part of the idea is to be able to connect from my local machine to the IB Gateway docker container (with a different client ID) and be able to interact with the API (of course not submitting orders, but e.g. checking the PnL).

I have managed to set up a docker container with IB Gateway locally and connect to that container with my local pc and execute scripts which encouraged me to try to do the same on the cloud, at least the first part of the idea (2 containers, one with IB gateway, and second with python algo routine)

Needless to mention, this failed miserably, I can not successfully connect to IB gateway from another container. I have tried adding all the local IPs and docker IPs such as 127.0.0.1, 172.17.0.1/16 to IB Gateway, which didn't work

I have pulled the below 2 containers:

https://hub.docker.com/r/mgvazquez/ibgateway

https://hub.docker.com/_/python

if it is helpful to see, below is the result of the docker ps command

CONTAINER ID   IMAGE                        COMMAND           CREATED          STATUS          PORTS                                         NAMES
58300d180939   mgvazquez/ibgateway:latest   "/sbin/my_init"   50 minutes ago   Up 23 minutes   0.0.0.0:4002->4002/tcp, :::4002->4002/tcp, 0.0.0.0:5900->5900/tcp, :::5900->5900/tcp, 0.0.0.0:7497->7497/tcp, :::7497->7497/tcp   dckrcmps_gateway_1

PS this is the first time I'm dealing with docker and a combination of docker and IB Gateway topic seems to be a bit limited online and Im a bit stuck, I spend 4 days on this without success.


来源: stackexchange

问:
Recovering Monthly Sales Count from Annual Sales Count up to the Month
First off, apologies that I cannot provide an example of the data I am working with, as the arrangement my organization has with Tableau has me working mostly blind. I'll try to describe the problem as best I can.

The measure being used is SUM([Sales Count]).

We have an annual trends graph of this over the past 5 years. To get this graph, for [Status Month] = {1:12} we filter to [Status Month] = 12, [Time Period] to Past 5 years anchored to today. The resultant numbers and trends are what we would expect them to be.

The issue is when we try to change our unit of time to month. It seems the measure becomes cumulative per month up to the end of each year. That is to say, if we have 50 sales up to November 2021, and we have 7 sales in December 2021, the graph indicates 57 sale in December 2021.

The corollary of this is that in January 2022, the number of sales is the number of sales in January 2022 (e.g. 5).

We tried 2 related solutions.

Attempt 1: This month's cumulative sales count minus last month's cumulative sales count

Command:
SUM([Sales Count]) - LOOKUP(ZN(SUM([Sales Count])), -1)

Result: We get the trend line we want, except for January each year. In the above example, we would get 5 - 57 = -52 instead of 5 for January 2022. This was somewhat expected.

Attempt 2: We tried to filter January out with an IF statement

Command:
IF [Status Month] <> 1 THEN SUM([Sales Count]) - LOOKUP(ZN(SUM([Sales Count])), -1) ELSE SUM([Sales Count]) END

Result: Error Message: Cannot mix aggregate and non-aggregate comparisons or results in IF expression.

Has anyone met with similar situations before or have any solutions, retrieve the Monthly Sales Count?
Would appreciate your help. Thanks!

ContentLicense: CC BY-SA 4.0


问:
Java ImageIO.read() hanging in a definite iteration structure
I am writing a program that requires me to send images over some sockets. I am writing a function to do this.

```<code>    public BufferedImage getCardImage(String card)
    {
        waitForProcess = true;
        System.out.println("ask server for card image");
        sendMessage("get card");
        sendMessage(card.replace("//", "_"));
        BufferedImage img = null;
        int count = 0;
        while(count < 5)
        {
            System.out.println("try getting card image");
            try {img = ImageIO.read(new BufferedInputStream(dataInputStream));}
            catch(IOException ex)
            {
                System.out.println("error getting image from server: " + ex);
            }
            count++;
        }

        System.out.println("got card image from server " + img);
        waitForProcess = false;
        return img;
    }
</code>```

for some reason when it enters the loop the image always comes as null on the first iteration and then the thread hangs on the second iteration.

I have tried changing this to a for loop but the same thing happened. I would expect the function to return either a null image or the image from the inputstream and instead it would hang. I have also used an indefinite iteration style

```<code>    public BufferedImage getCardImage(String card)
    {
        waitForProcess = true;
        System.out.println("ask server for card image");
        sendMessage("get card");
        sendMessage(card.replace("//", "_"));
        BufferedImage img = null;
        while(img == null)
        {
            System.out.println("try getting card image");
            try {img = ImageIO.read(new BufferedInputStream(dataInputStream));}
            catch(IOException ex)
            {
                System.out.println("error getting image from server: " + ex);
            }
            count++;
        }

        System.out.println("got card image from server " + img);
        waitForProcess = false;
        return img;
    }
</code>```

this doesnt hang and has the intended effect, however i dont want the program to keep running indefinitely and would like for it to halt after a maximum number of iterations.

I realize this code snippet may not be sufficient so below is a link to a github repo with all of the code. this snippet belongs to client.java.

WARNING: exposure to the rest of the code may cause irritation and an overwhelming sense of confusion. You have been warned!

https://github.com/mimramon/Draft-Simulator

Body:
I am writing a program that requires me to send images over some sockets. I am writing a function to do this.

    public BufferedImage getCardImage(String card)
    {
        waitForProcess = true;
        System.out.println("ask server for card image");
        sendMessage("get card");
        sendMessage(card.replace("//", "_"));
        BufferedImage img = null;
        int count = 0;
        while(count < 5)
        {
            System.out.println("try getting card image");
            try {img = ImageIO.read(new BufferedInputStream(dataInputStream));}
            catch(IOException ex)
            {
                System.out.println("error getting image from server: " + ex);
            }
            count++;
        }

        System.out.println("got card image from server " + img);
        waitForProcess = false;
        return img;
    }

for some reason when it enters the loop the image always comes as null on the first iteration and then the thread hangs on the second iteration.

I have tried changing this to a for loop but the same thing happened. I would expect the function to return either a null image or the image from the inputstream and instead it would hang. I have also used an indefinite iteration style

    public BufferedImage getCardImage(String card)
    {
        waitForProcess = true;
        System.out.println("ask server for card image");
        sendMessage("get card");
        sendMessage(card.replace("//", "_"));
        BufferedImage img = null;
        while(img == null)
        {
            System.out.println("try getting card image");
            try {img = ImageIO.read(new BufferedInputStream(dataInputStream));}
            catch(IOException ex)
            {
                System.out.println("error getting image from server: " + ex);
            }
            count++;
        }

        System.out.println("got card image from server " + img);
        waitForProcess = false;
        return img;
    }

this doesnt hang and has the intended effect, however i dont want the program to keep running indefinitely and would like for it to halt after a maximum number of iterations.

I realize this code snippet may not be sufficient so below is a link to a github repo with all of the code. this snippet belongs to client.java.

WARNING: exposure to the rest of the code may cause irritation and an overwhelming sense of confusion. You have been warned!

https://github.com/mimramon/Draft-Simulator


问:
what is the match for this regex \g{2}(a)(b)
I am learning regex and i have a case related to backreference.

e.g. with (a)(b)\g{2} will match the result abb

however for the case \g{2}(a)(b) I haven't found a match yet.

I don't know why either. Can anyone explain to me how this backreference works. thank you very much. Sorry for my bad English

I tried replacing index 2 with 3 or less than 1, but it gives regex syntax error. It can be understood that here only two indexes are allowed, 1 and 2, corresponding to the positions of the 2 existing groups. however with \g{2}(a)(b) the results like bab or aab or ab do not match


问:
How to get id of specific object inside of deeply nested javascript object in recursive way?
I am trying to get specific ids from deeply nested object inside javascript array.

Here is the example.

```const arr = [
    {
        "type": "exception-handler",
        "action": "try-catch",
        "extra": {
            "id": "*^+qhcC`a8-Od]Ar*5.W"
        },
        "try": [
            {
                "type": "bizunit",
                "action": "create",
                "request": [
                    {
                        "type": "operator",
                        "action": "request",
                        "extra": {
                            "id": "4X*xe#m@.i:pWrK5N2pa"
                        },
                        "id": "58282ac474b71e450ede4c945b79c6bc",
                        "method": {
                            "type": "miscellaneous",
                            "action": "protocol-method",
                            "extra": {
                                "id": "o-q4R=fJ=A%p/%UgEm^3"
                            },
                            "method": "post"
                        },
                        "end-point": {
                            "type": "protocol-end-point",
                            "action": "url",
                            "extra": {
                                "id": ")YP2)%MhltkO,kjxRwB-"
                            },
                            "end-point": {
                                "type": "primitive",
                                "action": "string",
                                "extra": {
                                    "id": "!TUeFgkm/y~75lR(n3[0"
                                },
                                "value": "http://localhost:8081/plan/entrance"
                            }
                        },
                        "header": {
                            "type": "hashmap",
                            "action": "create",
                            "extra": {
                                "id": "r9UllU59/wT?[e7d!N--"
                            },
                            "values": [
                                {
                                    "type": "parameter",
                                    "action": "create",
                                    "extra": {
                                        "id": "ig=2K,XVbahdQM)Dt!]^"
                                    },
                                    "key": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": "sr=GRIAL:FHE6j#Arz=M"
                                        },
                                        "value": "Content-Type"
                                    },
                                    "value": {
                                        "type": "miscellaneous",
                                        "action": "protocol-content-type",
                                        "content-type": "application/json"
                                    },
                                    "description": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": "CeL3/P5FQE4E@+`Mg`zu"
                                        },
                                        "value": "Content-Type"
                                    },
                                    "datatype": {
                                        "type": "miscellaneous",
                                        "action": "parameter-type",
                                        "extra": {
                                            "id": "dYilby1X|FRXXyJX=$kM"
                                        },
                                        "parameter-type": "string"
                                    },
                                    "required": {
                                        "type": "primitive",
                                        "action": "boolean",
                                        "extra": {
                                            "id": ")jLx-!+L_R^-p}0pv;zx"
                                        },
                                        "value": true
                                    }
                                }
                            ]
                        },
                        "body": {
                            "type": "hashmap",
                            "action": "create",
                            "extra": {
                                "id": "jDxo[vI6`~V}E?f92!|q"
                            },
                            "values": []
                        }
                    }
                ],
                "response": [
                    {
                        "type": "operator",
                        "action": "response",
                        "extra": {
                            "id": "S8yOq43aE-|pvVMESGjt"
                        },
                        "id": "d2a26b2943c12fc9c493cb152773c1ad",
                        "context": [
                            {
                                "type": "response-context",
                                "action": "create",
                                "extra": {
                                    "id": "FA{57;dBdnf3Mc#WrlX,"
                                },
                                "status_code": {
                                    "type": "primitive",
                                    "action": "integer",
                                    "extra": {
                                        "id": "Zm2OJRRkzOu]Yz({Dqs1"
                                    },
                                    "value": 200
                                },
                                "header": {
                                    "type": "hashmap",
                                    "action": "create",
                                    "extra": {
                                        "id": "uY=9HsV6o:J]vAQ$q;uT"
                                    },
                                    "values": [
                                        {
                                            "type": "parameter",
                                            "action": "create",
                                            "extra": {
                                                "id": "fjG!dHL:03DJcX=Kmlyg"
                                            },
                                            "key": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "b^l?@*d9_aSmg(wYsYBB"
                                                },
                                                "value": "Content-Type"
                                            },
                                            "value": {
                                                "type": "miscellaneous",
                                                "action": "protocol-content-type",
                                                "content-type": "application/json"
                                            },
                                            "description": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "*-FL8DAtcIo-wk.Vw3s4"
                                                },
                                                "value": "Content-Type"
                                            },
                                            "datatype": {
                                                "type": "miscellaneous",
                                                "action": "parameter-type",
                                                "extra": {
                                                    "id": "p@ol%;BY0sk(YJ4PU@S`"
                                                },
                                                "parameter-type": "string"
                                            },
                                            "required": {
                                                "type": "primitive",
                                                "action": "boolean",
                                                "extra": {
                                                    "id": "JyHvFN*dLSA,r2=Y(mT;"
                                                },
                                                "value": true
                                            }
                                        }
                                    ]
                                },
                                "body": {
                                    "type": "hashmap",
                                    "action": "create",
                                    "extra": {
                                        "id": "_@H=q?erlMehoIEa%R,+"
                                    },
                                    "values": [
                                        {
                                            "type": "parameter",
                                            "action": "create",
                                            "extra": {
                                                "id": "o-o]dU|xU$?}Abe3chJW"
                                            },
                                            "key": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "I9MZgkGz3DHdajVSb5TG"
                                                },
                                                "value": "result"
                                            },
                                            "value": {
                                                "type": "variable",
                                                "action": "get",
                                                "extra": {
                                                    "id": "j$}iBoUJc8twt6}Y1.aY"
                                                },
                                                "name": {
                                                    "type": "primitive",
                                                    "action": "string",
                                                    "extra": {
                                                        "id": "A:SP/73?T+@^X,-xmt=K"
                                                    },
                                                    "value": "qqq1"
                                                }
                                            },
                                            "description": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "!GaJoiP493r[=s+:J2oc"
                                                },
                                                "value": "result"
                                            },
                                            "datatype": {
                                                "type": "miscellaneous",
                                                "action": "parameter-type",
                                                "extra": {
                                                    "id": "WnxuP`9*XUEH$kO=fk]("
                                                },
                                                "parameter-type": "string"
                                            },
                                            "required": {
                                                "type": "primitive",
                                                "action": "boolean",
                                                "extra": {
                                                    "id": "=b+?*LDl%+_3yvPp8H^n"
                                                },
                                                "value": false
                                            }
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                ],
                "statements": [
                    {
                        "type": "helper",
                        "action": "code-section",
                        "extra": {
                            "id": "DY08%%z}3AjI-Xs%xI@A"
                        },
                        "statements": [
                            {
                                "type": "variable",
                                "action": "set",
                                "extra": {
                                    "id": "]P1zt]-Q@wSl=0QN+S+Y"
                                },
                                "name": {
                                    "type": "primitive",
                                    "action": "string",
                                    "extra": {
                                        "id": "C.}`gU.^7_OXWTqH2V{d"
                                    },
                                    "value": "qqq2"
                                },
                                "value": {
                                    "type": "pair",
                                    "action": "create",
                                    "extra": {
                                        "id": "QA_jH1zQ(::zX5vx]x?Z"
                                    },
                                    "key": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": ":z^N7Rzzz$6^?!g:z}2U"
                                        },
                                        "value": "qqq"
                                    },
                                    "value": {
                                        "type": "pair",
                                        "action": "create",
                                        "extra": {
                                            "id": "c8$/sqb7zz2dXx;,.z}/"
                                        },
                                        "key": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": {
                                                "id": "2~UOvI-bkWvroN/E=JHS"
                                            },
                                            "value": "qqq"
                                        },
                                        "value": {
                                            "type": "custom-util",
                                            "action": "create",
                                            "extra": {
                                                "id": "f2}8BgDYqkg}c;[R#P]-"
                                            },
                                            "arguments": [
                                                {
                                                    "type": "pair",
                                                    "action": "create",
                                                    "extra": {
                                                        "id": "D@f^;wPL[]HkpCDC~ny]"
                                                    },
                                                    "key": {
                                                        "type": "primitive",
                                                        "action": "string",
                                                        "extra": {
                                                            "id": "7$tBwUm^))[7RUBR|CJ."
                                                        },
                                                        "value": "arg2"
                                                    },
                                                    "value": {
                                                        "type": "primitive",
                                                        "action": "null",
                                                        "extra": {
                                                            "id": "1Y3$Ktx_i]xBBI1RB}}:"
                                                        }
                                                    }
                                                }
                                            ],
                                            "payload": [],
                                            "return-value": {
                                                "type": "primitive",
                                                "extra": {
                                                    "id": "1rajk$Fi5mR|^n}DtrS:"
                                                },
                                                "value": "retData",
                                                "action": "string"
                                            },
                                            "property": {
                                                "id": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "83a6b92429ea68fa96de5b7c52c859b9edb1c8d2a5be97db0311f053e4835604",
                                                    "action": "string"
                                                },
                                                "name": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "test2",
                                                    "action": "string"
                                                },
                                                "type": "property",
                                                "extra": [],
                                                "action": "custom-util",
                                                "description": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "",
                                                    "action": "string"
                                                },
                                                "created-date": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "",
                                                    "action": "string"
                                                },
                                                "updated-date": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "",
                                                    "action": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "type": "helper",
                        "action": "code-section",
                        "extra": {
                            "id": "S=UB.6Q{/|kp[Am?6s-q"
                        },
                        "statements": [
                            {
                                "type": "document",
                                "action": "comment-note",
                                "extra": {
                                    "id": "ytjiQ-DGCP,%Is$qJgx+"
                                },
                                "comment": {
                                    "type": "primitive",
                                    "action": "string",
                                    "value": "code 2"
                                }
                            },
                            {
                                "type": "variable",
                                "action": "set",
                                "extra": {
                                    "id": "l9d(yM/#ME^a.+4B5R83"
                                },
                                "name": {
                                    "type": "primitive",
                                    "action": "string",
                                    "extra": {
                                        "id": "UHlQ`WsLdIN7rZij/(SM"
                                    },
                                    "value": "qqq1"
                                },
                                "value": {
                                    "type": "custom-util",
                                    "action": "create",
                                    "extra": {
                                        "id": "g~pYQ+|{;degXfBKU_0k"
                                    },
                                    "arguments": [
                                        {
                                            "type": "pair",
                                            "action": "create",
                                            "extra": {
                                                "id": "_}v}J!K`V?ckLCfC:e7{"
                                            },
                                            "key": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "YqFx^i_q_f!H19Dg$pk0"
                                                },
                                                "value": "arg1"
                                            },
                                            "value": {
                                                "type": "primitive",
                                                "action": "null",
                                                "extra": {
                                                    "id": "Me1La9?(Z)=s{4YeAmWb"
                                                }
                                            }
                                        },
                                    ],
                                    "payload": [],
                                    "return-value": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": "eodx(7Oz7)7Gw;.dF4kt"
                                        },
                                        "value": "retData"
                                    },
                                    "property": {
                                        "type": "property",
                                        "action": "custom-util",
                                        "extra": [],
                                        "id": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": "3e15892f1a8c250ecd733a2fb39a9866a1906172d0964f74978454f1edcc2a83"
                                        },
                                        "name": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": "test1"
                                        },
                                        "description": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": ""
                                        },
                                        "created-date": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": ""
                                        },
                                        "updated-date": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": ""
                                        }
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        ],
    }
]
```
<p>The object literal inside of the array contains many key and values. This could be nested deeper as well.</p>
<p>And I want to get the id of type <code>custom-util</code>.</p>
```{
    "type": "custom-util",
    "action": "create",
    "extra": {
        "id": "9lI}N-/Xm|r6OY{QzbX)"
    },
    "arguments": [{...}],
    "payload": [],
    "return-value": {...},
    "property": {
        "type": "property",
        "action": "custom-util",
        "extra": [],
        "id": {
            "type": "primitive",
            "action": "string",
            "extra": [],
             // this is the value I want to get
            "value": "3e15892f1a8c250ecd733a2fb39a9866a1906172d0964f74978454f1edcc2a83"
        },
    }
}
```
<p>As I mentioned earlier, the object that contains type <code>custom-util</code> coule be nested far deeper than the example.</p>
<p>I am managed to make a function like below and found id value <code>3e15892f1a8c250ecd733a2fb39a9866a1906172d0964f74978454f1edcc2a83</code> but could not find <code>"83a6b92429ea68fa96de5b7c52c859b9edb1c8d2a5be97db0311f053e4835604"</code> which is deeply nested.</p>
```function getCustomUtilIds(arr, accumulator = []) {
      arr.forEach((nestedObject) => {
        const customUtilId =
          nestedObject?.value?.type === 'custom-util' ? nestedObject?.value?.property?.id?.value : undefined;
        if (customUtilId !== undefined) accumulator.push(customUtilId);

        Object.getOwnPropertyNames(nestedObject).forEach((propertyName) => {
          const property = nestedObject[propertyName];
          if (Array.isArray(property))
            getCustomUtilIds(property, accumulator);
        });
      });
    }

    const result = [];
getCustomUtilIds(arr, result);
console.log(result);
```

Why this does not work as recursive to find all ids of custom-util?

Body:
I am trying to get specific ids from deeply nested object inside javascript array.

Here is the example.

const arr = [
    {
        "type": "exception-handler",
        "action": "try-catch",
        "extra": {
            "id": "*^+qhcC`a8-Od]Ar*5.W"
        },
        "try": [
            {
                "type": "bizunit",
                "action": "create",
                "request": [
                    {
                        "type": "operator",
                        "action": "request",
                        "extra": {
                            "id": "4X*xe#m@.i:pWrK5N2pa"
                        },
                        "id": "58282ac474b71e450ede4c945b79c6bc",
                        "method": {
                            "type": "miscellaneous",
                            "action": "protocol-method",
                            "extra": {
                                "id": "o-q4R=fJ=A%p/%UgEm^3"
                            },
                            "method": "post"
                        },
                        "end-point": {
                            "type": "protocol-end-point",
                            "action": "url",
                            "extra": {
                                "id": ")YP2)%MhltkO,kjxRwB-"
                            },
                            "end-point": {
                                "type": "primitive",
                                "action": "string",
                                "extra": {
                                    "id": "!TUeFgkm/y~75lR(n3[0"
                                },
                                "value": "http://localhost:8081/plan/entrance"
                            }
                        },
                        "header": {
                            "type": "hashmap",
                            "action": "create",
                            "extra": {
                                "id": "r9UllU59/wT?[e7d!N--"
                            },
                            "values": [
                                {
                                    "type": "parameter",
                                    "action": "create",
                                    "extra": {
                                        "id": "ig=2K,XVbahdQM)Dt!]^"
                                    },
                                    "key": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": "sr=GRIAL:FHE6j#Arz=M"
                                        },
                                        "value": "Content-Type"
                                    },
                                    "value": {
                                        "type": "miscellaneous",
                                        "action": "protocol-content-type",
                                        "content-type": "application/json"
                                    },
                                    "description": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": "CeL3/P5FQE4E@+`Mg`zu"
                                        },
                                        "value": "Content-Type"
                                    },
                                    "datatype": {
                                        "type": "miscellaneous",
                                        "action": "parameter-type",
                                        "extra": {
                                            "id": "dYilby1X|FRXXyJX=$kM"
                                        },
                                        "parameter-type": "string"
                                    },
                                    "required": {
                                        "type": "primitive",
                                        "action": "boolean",
                                        "extra": {
                                            "id": ")jLx-!+L_R^-p}0pv;zx"
                                        },
                                        "value": true
                                    }
                                }
                            ]
                        },
                        "body": {
                            "type": "hashmap",
                            "action": "create",
                            "extra": {
                                "id": "jDxo[vI6`~V}E?f92!|q"
                            },
                            "values": []
                        }
                    }
                ],
                "response": [
                    {
                        "type": "operator",
                        "action": "response",
                        "extra": {
                            "id": "S8yOq43aE-|pvVMESGjt"
                        },
                        "id": "d2a26b2943c12fc9c493cb152773c1ad",
                        "context": [
                            {
                                "type": "response-context",
                                "action": "create",
                                "extra": {
                                    "id": "FA{57;dBdnf3Mc#WrlX,"
                                },
                                "status_code": {
                                    "type": "primitive",
                                    "action": "integer",
                                    "extra": {
                                        "id": "Zm2OJRRkzOu]Yz({Dqs1"
                                    },
                                    "value": 200
                                },
                                "header": {
                                    "type": "hashmap",
                                    "action": "create",
                                    "extra": {
                                        "id": "uY=9HsV6o:J]vAQ$q;uT"
                                    },
                                    "values": [
                                        {
                                            "type": "parameter",
                                            "action": "create",
                                            "extra": {
                                                "id": "fjG!dHL:03DJcX=Kmlyg"
                                            },
                                            "key": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "b^l?@*d9_aSmg(wYsYBB"
                                                },
                                                "value": "Content-Type"
                                            },
                                            "value": {
                                                "type": "miscellaneous",
                                                "action": "protocol-content-type",
                                                "content-type": "application/json"
                                            },
                                            "description": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "*-FL8DAtcIo-wk.Vw3s4"
                                                },
                                                "value": "Content-Type"
                                            },
                                            "datatype": {
                                                "type": "miscellaneous",
                                                "action": "parameter-type",
                                                "extra": {
                                                    "id": "p@ol%;BY0sk(YJ4PU@S`"
                                                },
                                                "parameter-type": "string"
                                            },
                                            "required": {
                                                "type": "primitive",
                                                "action": "boolean",
                                                "extra": {
                                                    "id": "JyHvFN*dLSA,r2=Y(mT;"
                                                },
                                                "value": true
                                            }
                                        }
                                    ]
                                },
                                "body": {
                                    "type": "hashmap",
                                    "action": "create",
                                    "extra": {
                                        "id": "_@H=q?erlMehoIEa%R,+"
                                    },
                                    "values": [
                                        {
                                            "type": "parameter",
                                            "action": "create",
                                            "extra": {
                                                "id": "o-o]dU|xU$?}Abe3chJW"
                                            },
                                            "key": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "I9MZgkGz3DHdajVSb5TG"
                                                },
                                                "value": "result"
                                            },
                                            "value": {
                                                "type": "variable",
                                                "action": "get",
                                                "extra": {
                                                    "id": "j$}iBoUJc8twt6}Y1.aY"
                                                },
                                                "name": {
                                                    "type": "primitive",
                                                    "action": "string",
                                                    "extra": {
                                                        "id": "A:SP/73?T+@^X,-xmt=K"
                                                    },
                                                    "value": "qqq1"
                                                }
                                            },
                                            "description": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "!GaJoiP493r[=s+:J2oc"
                                                },
                                                "value": "result"
                                            },
                                            "datatype": {
                                                "type": "miscellaneous",
                                                "action": "parameter-type",
                                                "extra": {
                                                    "id": "WnxuP`9*XUEH$kO=fk]("
                                                },
                                                "parameter-type": "string"
                                            },
                                            "required": {
                                                "type": "primitive",
                                                "action": "boolean",
                                                "extra": {
                                                    "id": "=b+?*LDl%+_3yvPp8H^n"
                                                },
                                                "value": false
                                            }
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                ],
                "statements": [
                    {
                        "type": "helper",
                        "action": "code-section",
                        "extra": {
                            "id": "DY08%%z}3AjI-Xs%xI@A"
                        },
                        "statements": [
                            {
                                "type": "variable",
                                "action": "set",
                                "extra": {
                                    "id": "]P1zt]-Q@wSl=0QN+S+Y"
                                },
                                "name": {
                                    "type": "primitive",
                                    "action": "string",
                                    "extra": {
                                        "id": "C.}`gU.^7_OXWTqH2V{d"
                                    },
                                    "value": "qqq2"
                                },
                                "value": {
                                    "type": "pair",
                                    "action": "create",
                                    "extra": {
                                        "id": "QA_jH1zQ(::zX5vx]x?Z"
                                    },
                                    "key": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": ":z^N7Rzzz$6^?!g:z}2U"
                                        },
                                        "value": "qqq"
                                    },
                                    "value": {
                                        "type": "pair",
                                        "action": "create",
                                        "extra": {
                                            "id": "c8$/sqb7zz2dXx;,.z}/"
                                        },
                                        "key": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": {
                                                "id": "2~UOvI-bkWvroN/E=JHS"
                                            },
                                            "value": "qqq"
                                        },
                                        "value": {
                                            "type": "custom-util",
                                            "action": "create",
                                            "extra": {
                                                "id": "f2}8BgDYqkg}c;[R#P]-"
                                            },
                                            "arguments": [
                                                {
                                                    "type": "pair",
                                                    "action": "create",
                                                    "extra": {
                                                        "id": "D@f^;wPL[]HkpCDC~ny]"
                                                    },
                                                    "key": {
                                                        "type": "primitive",
                                                        "action": "string",
                                                        "extra": {
                                                            "id": "7$tBwUm^))[7RUBR|CJ."
                                                        },
                                                        "value": "arg2"
                                                    },
                                                    "value": {
                                                        "type": "primitive",
                                                        "action": "null",
                                                        "extra": {
                                                            "id": "1Y3$Ktx_i]xBBI1RB}}:"
                                                        }
                                                    }
                                                }
                                            ],
                                            "payload": [],
                                            "return-value": {
                                                "type": "primitive",
                                                "extra": {
                                                    "id": "1rajk$Fi5mR|^n}DtrS:"
                                                },
                                                "value": "retData",
                                                "action": "string"
                                            },
                                            "property": {
                                                "id": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "83a6b92429ea68fa96de5b7c52c859b9edb1c8d2a5be97db0311f053e4835604",
                                                    "action": "string"
                                                },
                                                "name": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "test2",
                                                    "action": "string"
                                                },
                                                "type": "property",
                                                "extra": [],
                                                "action": "custom-util",
                                                "description": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "",
                                                    "action": "string"
                                                },
                                                "created-date": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "",
                                                    "action": "string"
                                                },
                                                "updated-date": {
                                                    "type": "primitive",
                                                    "extra": [],
                                                    "value": "",
                                                    "action": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "type": "helper",
                        "action": "code-section",
                        "extra": {
                            "id": "S=UB.6Q{/|kp[Am?6s-q"
                        },
                        "statements": [
                            {
                                "type": "document",
                                "action": "comment-note",
                                "extra": {
                                    "id": "ytjiQ-DGCP,%Is$qJgx+"
                                },
                                "comment": {
                                    "type": "primitive",
                                    "action": "string",
                                    "value": "code 2"
                                }
                            },
                            {
                                "type": "variable",
                                "action": "set",
                                "extra": {
                                    "id": "l9d(yM/#ME^a.+4B5R83"
                                },
                                "name": {
                                    "type": "primitive",
                                    "action": "string",
                                    "extra": {
                                        "id": "UHlQ`WsLdIN7rZij/(SM"
                                    },
                                    "value": "qqq1"
                                },
                                "value": {
                                    "type": "custom-util",
                                    "action": "create",
                                    "extra": {
                                        "id": "g~pYQ+|{;degXfBKU_0k"
                                    },
                                    "arguments": [
                                        {
                                            "type": "pair",
                                            "action": "create",
                                            "extra": {
                                                "id": "_}v}J!K`V?ckLCfC:e7{"
                                            },
                                            "key": {
                                                "type": "primitive",
                                                "action": "string",
                                                "extra": {
                                                    "id": "YqFx^i_q_f!H19Dg$pk0"
                                                },
                                                "value": "arg1"
                                            },
                                            "value": {
                                                "type": "primitive",
                                                "action": "null",
                                                "extra": {
                                                    "id": "Me1La9?(Z)=s{4YeAmWb"
                                                }
                                            }
                                        },
                                    ],
                                    "payload": [],
                                    "return-value": {
                                        "type": "primitive",
                                        "action": "string",
                                        "extra": {
                                            "id": "eodx(7Oz7)7Gw;.dF4kt"
                                        },
                                        "value": "retData"
                                    },
                                    "property": {
                                        "type": "property",
                                        "action": "custom-util",
                                        "extra": [],
                                        "id": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": "3e15892f1a8c250ecd733a2fb39a9866a1906172d0964f74978454f1edcc2a83"
                                        },
                                        "name": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": "test1"
                                        },
                                        "description": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": ""
                                        },
                                        "created-date": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": ""
                                        },
                                        "updated-date": {
                                            "type": "primitive",
                                            "action": "string",
                                            "extra": [],
                                            "value": ""
                                        }
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        ],
    }
]

The object literal inside of the array contains many key and values. This could be nested deeper as well.

And I want to get the id of type custom-util.

{
    "type": "custom-util",
    "action": "create",
    "extra": {
        "id": "9lI}N-/Xm|r6OY{QzbX)"
    },
    "arguments": [{...}],
    "payload": [],
    "return-value": {...},
    "property": {
        "type": "property",
        "action": "custom-util",
        "extra": [],
        "id": {
            "type": "primitive",
            "action": "string",
            "extra": [],
             // this is the value I want to get
            "value": "3e15892f1a8c250ecd733a2fb39a9866a1906172d0964f74978454f1edcc2a83"
        },
    }
}

As I mentioned earlier, the object that contains type custom-util coule be nested far deeper than the example.

I am managed to make a function like below and found id value 3e15892f1a8c250ecd733a2fb39a9866a1906172d0964f74978454f1edcc2a83 but could not find "83a6b92429ea68fa96de5b7c52c859b9edb1c8d2a5be97db0311f053e4835604" which is deeply nested.

function getCustomUtilIds(arr, accumulator = []) {
      arr.forEach((nestedObject) => {
        const customUtilId =
          nestedObject?.value?.type === 'custom-util' ? nestedObject?.value?.property?.id?.value : undefined;
        if (customUtilId !== undefined) accumulator.push(customUtilId);

        Object.getOwnPropertyNames(nestedObject).forEach((propertyName) => {
          const property = nestedObject[propertyName];
          if (Array.isArray(property))
            getCustomUtilIds(property, accumulator);
        });
      });
    }

    const result = [];
getCustomUtilIds(arr, result);
console.log(result);

Why this does not work as recursive to find all ids of custom-util?


问:
Flutter Web App deeplinking when app loaded in iFrame
I have a flutter web app with GoRouter and deeplinking is working.

But we want to build some "Frame" around the app that the app is displayed as a smartphone on a website (portrait) and we have done it by embedding the flutter web app in an iFrame.
Tat breaks the deeplinking - but is it possible to "forward" the 2 last parts of the url to the iframe?

So when the page is called

```<code>www.mypage.com/flutterAppFrame/deeplink/2
</code>```

That then I embedd the iframe instead of

```<code><iframe src="https://www.mypage.com/flutterapp/" style="border: 5px solid #2767ae; overflow: hidden;" >
</code>```

with

```<code><iframe src="https://www.mypage.com/flutterapp/deeplink/2" style="border: 5px solid #2767ae; overflow: hidden;" >
</code>```

Body:
I have a flutter web app with GoRouter and deeplinking is working.

But we want to build some "Frame" around the app that the app is displayed as a smartphone on a website (portrait) and we have done it by embedding the flutter web app in an iFrame.
Tat breaks the deeplinking - but is it possible to "forward" the 2 last parts of the url to the iframe?

So when the page is called

www.mypage.com/flutterAppFrame/deeplink/2

That then I embedd the iframe instead of

with


问:
Multivariable complex integration via the package cubature
For my research, I am trying to implement the multidimensional inversion formula to compute density from a characteristic function

from the paper of Sheppard (1991). From my search, I know that the packages pracma and elliptic have functions to handle complex integrals but only up to 2 variables so it is not enough for me. There is also the package CharFunToolR that implements inversion formula, but limited to univariate function only. Another popular package that I am looking at is cubature, but the problem is that it can take a long time while the accuracy is not reliable. Plus, the package does not seem to handle complex numbers.

Here is an example that I used to test out using the multivariate normal characteristic function which I can validate the result because its density is well-known (in my research, I have a more complicated characteristic function).

```<code>p <- 6

mu <- c(-0.448, -0.48, -0.661, -0.325, -0.539, -0.297)

Sigma <- matrix(nrow = p, ncol = p, c(
   0.136, -0.013,  0.001, -0.009, -0.005, 0.004,
  -0.013,  0.123,  0.050,  0.002,  0.037, 0.040,
   0.001,  0.050,  0.095, -0.011,  0.056, 0.014,
  -0.009,  0.002, -0.011,  0.099, -0.005, 0.008,
  -0.005,  0.037,  0.056, -0.005,  0.075, 0.003,
   0.004,  0.040,  0.014,  0.008,  0.003, 0.102
))

x <- c(0.053, 0.523, -0.041, -0.589, -0.044, -0.066)
</code>```

Using the function dmvnorm() in the package mvtnorm, I obtain

```<code>mvtnorm::dmvnorm(x, mu, as.matrix(Sigma))
[1] 0.01410531

</code>```

Now, using the inversion formula approach

```<code>cf <- function(tee, x, mu, Sigma) {
  exp(-1i * crossprod(tee, x)) * exp(1i * crossprod(tee, mu) - 0.5 * t(tee) %*% Sigma %*% tee)
}

cub <- cubature::hcubature(
  f          = cf,
  lowerLimit = rep(-Inf, p),
  upperLimit = rep(Inf, p),
  tol        = 1e-4,
  maxEval    = 1000,
  x          = x,
  mu         = mu,
  Sigma      = Sigma
)

(2 * pi)^(-p) * cub$integral
[1] 0.07572407
</code>```

which is quite off. What's worse is that if I increase maxEval, I get a completely different value

```<code>cub <- cubature::hcubature(
  f          = cf,
  lowerLimit = rep(-Inf, p),
  upperLimit = rep(Inf, p),
  tol        = 1e-4,
  maxEval    = 5000,
  x          = x,
  mu         = mu,
  Sigma      = Sigma
)

(2 * pi)^(-p) * cub$integral
[1] 0.2601113
</code>```

It looks to me that with 1,000 or 5,000, the tolerance is not met, but if I don't specify maxEval, the function will take very long time, which is not practical to use. In addition, there is also a warning

```<code>There were 50 or more warnings (use warnings() to see the first 50)

Warning messages:
1: In cubature::hcubature(f = cf, lowerLimit = rep(-Inf,  ... :
  imaginary parts discarded in coercion
2: In cubature::hcubature(f = cf, lowerLimit = rep(-Inf,  ... :
  imaginary parts discarded in coercion
</code>```

which makes me think that the function does not handle complex value very well (I looked at another thread using integrate and it said that we need to separate the real and imaginary part so R can understand). I also implemented a vectorized version of the characteristic function as instructed by the package's author to speed up the process, but I still get the same values as above. I think I need help making the code work properly with realistic running time and hopefully without the warning messages. Please help me if you can. If you are aware of any packages that can do the job, please let me know as well. Thank you so much.

Body:
For my research, I am trying to implement the multidimensional inversion formula to compute density from a characteristic function

from the paper of Sheppard (1991). From my search, I know that the packages pracma and elliptic have functions to handle complex integrals but only up to 2 variables so it is not enough for me. There is also the package CharFunToolR that implements inversion formula, but limited to univariate function only. Another popular package that I am looking at is cubature, but the problem is that it can take a long time while the accuracy is not reliable. Plus, the package does not seem to handle complex numbers.

Here is an example that I used to test out using the multivariate normal characteristic function which I can validate the result because its density is well-known (in my research, I have a more complicated characteristic function).

p <- 6

mu <- c(-0.448, -0.48, -0.661, -0.325, -0.539, -0.297)

Sigma <- matrix(nrow = p, ncol = p, c(
   0.136, -0.013,  0.001, -0.009, -0.005, 0.004,
  -0.013,  0.123,  0.050,  0.002,  0.037, 0.040,
   0.001,  0.050,  0.095, -0.011,  0.056, 0.014,
  -0.009,  0.002, -0.011,  0.099, -0.005, 0.008,
  -0.005,  0.037,  0.056, -0.005,  0.075, 0.003,
   0.004,  0.040,  0.014,  0.008,  0.003, 0.102
))

x <- c(0.053, 0.523, -0.041, -0.589, -0.044, -0.066)

Using the function dmvnorm() in the package mvtnorm, I obtain

mvtnorm::dmvnorm(x, mu, as.matrix(Sigma))
[1] 0.01410531

Now, using the inversion formula approach

cf <- function(tee, x, mu, Sigma) {
  exp(-1i * crossprod(tee, x)) * exp(1i * crossprod(tee, mu) - 0.5 * t(tee) %*% Sigma %*% tee)
}

cub <- cubature::hcubature(
  f          = cf,
  lowerLimit = rep(-Inf, p),
  upperLimit = rep(Inf, p),
  tol        = 1e-4,
  maxEval    = 1000,
  x          = x,
  mu         = mu,
  Sigma      = Sigma
)

(2 * pi)^(-p) * cub$integral
[1] 0.07572407

which is quite off. What's worse is that if I increase maxEval, I get a completely different value

cub <- cubature::hcubature(
  f          = cf,
  lowerLimit = rep(-Inf, p),
  upperLimit = rep(Inf, p),
  tol        = 1e-4,
  maxEval    = 5000,
  x          = x,
  mu         = mu,
  Sigma      = Sigma
)

(2 * pi)^(-p) * cub$integral
[1] 0.2601113

It looks to me that with 1,000 or 5,000, the tolerance is not met, but if I don't specify maxEval, the function will take very long time, which is not practical to use. In addition, there is also a warning

There were 50 or more warnings (use warnings() to see the first 50)

Warning messages:
1: In cubature::hcubature(f = cf, lowerLimit = rep(-Inf,  ... :
  imaginary parts discarded in coercion
2: In cubature::hcubature(f = cf, lowerLimit = rep(-Inf,  ... :
  imaginary parts discarded in coercion

which makes me think that the function does not handle complex value very well (I looked at another thread using integrate and it said that we need to separate the real and imaginary part so R can understand). I also implemented a vectorized version of the characteristic function as instructed by the package's author to speed up the process, but I still get the same values as above. I think I need help making the code work properly with realistic running time and hopefully without the warning messages. Please help me if you can. If you are aware of any packages that can do the job, please let me know as well. Thank you so much.


问:
How to select records when table includes multiple rows for each record with multi-criteria
I have a Student table:

```<code>| **Student**   |                                    |
|-----------|------------------------------------|
| StudentID | StudentName                        |
| 1         | Alfreds Futterkiste                |
| 2         | Ana Trujillo Emparedados y helados |
| 3         | Antonio Moreno Taquería            |
| 4         | Around the Horn                    |
| 5         | Berglunds snabbköp                 |
| 6         | Blauer See Delikatessen            |
| 7         | Blondel père et fils               |
| 8         | Bólido Comidas preparadas          |
| 9         | John                               |
</code>```

I have a Student Profile table

```<code>| **StudentProfile** |                        |      |            |
|----------------|------------------------|------|------------|
| StudentID      | Profile_Category       | Flag |            |
| 1              | DOB                    | Y    | 11/19/2022 |
| 1              | DoNotContact           | Y    | 10/25/2022 |
| 3              | AddressOnFile          | Y    | 9/13/2022  |
| 4              | SubscriptionPlanHolder | Y    | 8/8/2022   |
| 5              | DOB                    | N    | 11/1/2022  |
| 5              | DoNotContact           | Y    | 10/2/2022  |
| 5              | SubscriptionPlanHolder | Y    | 5/1/2022   |
| 6              | DOB                    | Y    | 10/27/2021 |
| 6              | SubscriptionPlanHolder | Y    | 11/11/2022 |
| 6              | AddressOnFile          | N    | 10/1/2022  |
| 9              | DOB                    | Y    | 9/9/2022   |
| 9              | SubscriptionPlanHolder | N    | 8/19/2022  |
| 10             | DOB                    | Y    | 11/11/2022 |
| 10             | SubscriptionPlanHolder | Y    | 10/1/2022  |
| 10             | AddressOnFile          | Y    | 9/9/2022   |
| 10             | DoNotContact           | Y    | 8/19/2022  |
| 11             | DOB                    | Y    | 11/11/2022 |
| 11             | SubscriptionPlanHolder | Y    | 10/1/2022  |
| 11             | AddressOnFile          | Y    | 9/9/2022   |
| 11             | DoNotContact           | Y    | 8/19/2022  |
</code>```

Desired output items

Select all students who got following profile attributes
(Profile_Category = DOB and Flag = 'Y') AND (Profile_Category = SubscriptionPlanHolder and Flag = 'Y')

*In this case I should get StudentID 6, 10, 11

Select all students who got following profile attributes
(Profile_Category = DOB and Flag = 'Y') AND (Profile_Category = SubscriptionPlanHolder and Flag = 'Y') AND (Profile_Category = AddressOnFile and Flag = 'Y')

*In this case I should get StudentID 10, 11

Select all students who got following profile attributes
(Profile_Category = DOB and Flag = 'Y') AND (Profile_Category = SubscriptionPlanHolder and Flag = 'Y') AND (Profile_Category = AddressOnFile and Flag = 'Y') AND (Profile_Category = DoNotContact and Flag = 'Y')

*In this case I should get StudentID 10, 11

So far, I have tried this approach but NOT getting the desired output:

For desired output #1

```<code>Select c.StudentID
FROM Student c
INNER JOIN StudentProfile p
ON p.StudentID = c.StudentID
WHERE Profile_Category IN ('DOB','SubscriptionPlanHolder')
AND Flag = 'Y'
GROUP BY c.StudentID
    HAVING COUNT(*) = 2
</code>```

Getting: 6

For desired output #2

```<code>Select c.StudentID
FROM Student c
INNER JOIN StudentProfile p
ON p.StudentID = c.StudentID
WHERE Profile_Category IN ('DOB','SubscriptionPlanHolder','AddressOnFile')
AND Flag = 'Y'
GROUP BY c.StudentID
    HAVING COUNT(*) = 3
</code>```

Getting: 0 results

For desired output #3

```<code>Select c.StudentID
FROM Student c
INNER JOIN StudentProfile p
ON p.StudentID = c.StudentID
WHERE Profile_Category IN ('DOB','SubscriptionPlanHolder', 'DoNotContact', 'AddressOnFile')
AND Flag = 'Y'
GROUP BY c.StudentID
    HAVING COUNT(*) = 4
</code>```

Getting: 0 results

Where I am getting confused is, how to bundle the different Profile_Category together because I am NOT looking for any one Profile_Category (not looking for OR), goal is to get students who for all the desired Profile_Category (looking for AND) and corresponding flag is Y

Body:
I have a Student table:

| **Student**   |                                    |
|-----------|------------------------------------|
| StudentID | StudentName                        |
| 1         | Alfreds Futterkiste                |
| 2         | Ana Trujillo Emparedados y helados |
| 3         | Antonio Moreno Taquería            |
| 4         | Around the Horn                    |
| 5         | Berglunds snabbköp                 |
| 6         | Blauer See Delikatessen            |
| 7         | Blondel père et fils               |
| 8         | Bólido Comidas preparadas          |
| 9         | John                               |

I have a Student Profile table

| **StudentProfile** |                        |      |            |
|----------------|------------------------|------|------------|
| StudentID      | Profile_Category       | Flag |            |
| 1              | DOB                    | Y    | 11/19/2022 |
| 1              | DoNotContact           | Y    | 10/25/2022 |
| 3              | AddressOnFile          | Y    | 9/13/2022  |
| 4              | SubscriptionPlanHolder | Y    | 8/8/2022   |
| 5              | DOB                    | N    | 11/1/2022  |
| 5              | DoNotContact           | Y    | 10/2/2022  |
| 5              | SubscriptionPlanHolder | Y    | 5/1/2022   |
| 6              | DOB                    | Y    | 10/27/2021 |
| 6              | SubscriptionPlanHolder | Y    | 11/11/2022 |
| 6              | AddressOnFile          | N    | 10/1/2022  |
| 9              | DOB                    | Y    | 9/9/2022   |
| 9              | SubscriptionPlanHolder | N    | 8/19/2022  |
| 10             | DOB                    | Y    | 11/11/2022 |
| 10             | SubscriptionPlanHolder | Y    | 10/1/2022  |
| 10             | AddressOnFile          | Y    | 9/9/2022   |
| 10             | DoNotContact           | Y    | 8/19/2022  |
| 11             | DOB                    | Y    | 11/11/2022 |
| 11             | SubscriptionPlanHolder | Y    | 10/1/2022  |
| 11             | AddressOnFile          | Y    | 9/9/2022   |
| 11             | DoNotContact           | Y    | 8/19/2022  |

Desired output items

Select all students who got following profile attributes
(Profile_Category = DOB and Flag = 'Y') AND (Profile_Category = SubscriptionPlanHolder and Flag = 'Y')

*In this case I should get StudentID 6, 10, 11

Select all students who got following profile attributes
(Profile_Category = DOB and Flag = 'Y') AND (Profile_Category = SubscriptionPlanHolder and Flag = 'Y') AND (Profile_Category = AddressOnFile and Flag = 'Y')

*In this case I should get StudentID 10, 11

Select all students who got following profile attributes
(Profile_Category = DOB and Flag = 'Y') AND (Profile_Category = SubscriptionPlanHolder and Flag = 'Y') AND (Profile_Category = AddressOnFile and Flag = 'Y') AND (Profile_Category = DoNotContact and Flag = 'Y')

*In this case I should get StudentID 10, 11

So far, I have tried this approach but NOT getting the desired output:

For desired output #1

Select c.StudentID
FROM Student c
INNER JOIN StudentProfile p
ON p.StudentID = c.StudentID
WHERE Profile_Category IN ('DOB','SubscriptionPlanHolder')
AND Flag = 'Y'
GROUP BY c.StudentID
    HAVING COUNT(*) = 2

Getting: 6

For desired output #2

Select c.StudentID
FROM Student c
INNER JOIN StudentProfile p
ON p.StudentID = c.StudentID
WHERE Profile_Category IN ('DOB','SubscriptionPlanHolder','AddressOnFile')
AND Flag = 'Y'
GROUP BY c.StudentID
    HAVING COUNT(*) = 3

Getting: 0 results

For desired output #3

Select c.StudentID
FROM Student c
INNER JOIN StudentProfile p
ON p.StudentID = c.StudentID
WHERE Profile_Category IN ('DOB','SubscriptionPlanHolder', 'DoNotContact', 'AddressOnFile')
AND Flag = 'Y'
GROUP BY c.StudentID
    HAVING COUNT(*) = 4

Getting: 0 results

Where I am getting confused is, how to bundle the different Profile_Category together because I am NOT looking for any one Profile_Category (not looking for OR), goal is to get students who for all the desired Profile_Category (looking for AND) and corresponding flag is Y


问:
How to allow mobile (iOS) users to tap and hold HTML Canvas to save to Photos/Gallery?
The current user flow I'm trying to implement is

user adds text to an input field

inputted text is then overlayed on an image using Canvas + Konva

(iOS) user exports canvas by tapping and holding canvas/image > then clicks add to photos

Is there an efficient way to do this?

This doesn't seem possible with just html canvas. I did attempt to make use of toDataURL to just render the canvas as an image whenever text was inputted. This worked and enabled my desired user flow, but naturally caused lagginess as it's doing lots of processing to repeatedly export the image.


问:
Convert Rockwell ACD PLC files to L5X files (similar to xml file's structure)
Is there any way that we can convert an ACD PLC files from Rockwell to L5X PLC files automatically instead of going through the RSLogix app and convert them manually? Since the ACD files are unreadable, so I would like to change them to L5X files, which is readable and in xml structure, to parse their information. However, I'm having a list of files and can't do them manually every time. It would be great if there might be a way to do them in Python script.

I have tried looking through sources but not finding one currently


问:
Is gtest and googletest libraries the same? If so, why are there two libraries?
I see that there are two libraries - gtest and googletest.
They seem to work interchangeably.
I am interested to know if there is any difference between the two.
If so, what it is.

In a yocto project that I am currently working on, I see that some recipes has dependency on gtest.
Some have dependency on googletest.
Each recipe compiles successfully individually.
But the full image build fails due to conflict between these libraries.

I tried to replace gtest with googletest and I found no compilation issues.


问:
Monaco Editor - node_modules package entry point resolution
I'm trying to load a very basic project using Monaco Editor but I'm having issues resolving node_modules. It seems that the entry point of the project defined in package.json is ignored.

In the example here axios works fine because it has an index.d.ts file at the root of the folder, but any project that doesn't have a .d.ts, or where the main entry point/typings of the file aren't inside the root, don't get resolved. One example of this is delayed-stream where the entry point is inside /lib/delayed_stream.js.

The project has a structure such as:

```<code>- <root>
  - src
    - index.ts
  - package.json
  - node_modules
    - axios
      - ...
    - delayed-stream
      - ...
</code>```
```<code>// ./src/index.ts
import axios from 'axios'; // Resolves
import delayedStream from 'delayed-stream'; // Cannot find module 'delayed-stream' or its corresponding type declarations.(2307)
</code>```

All .d.ts files are loaded with:

```<code>monaco.languages.typescript.typescriptDefaults.addExtraLib(data, file);
monaco.languages.typescript.javascriptDefaults.addExtraLib(data, file);
monaco.editor.createModel(data, 'typescript', monaco.Uri.parse(file));
</code>```

And all .js, .ts and .json files are loaded with:

```<code>monaco.editor.createModel(data, language, monaco.Uri.parse(file));
</code>```

I am creating an editor with the same settings as my tsconfig such as:

```<code>  monaco.languages.typescript.javascriptDefaults.setEagerModelSync(true);
  monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
    noSemanticValidation: false,
    noSyntaxValidation: false,
  });
  monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
    target: monaco.languages.typescript.ScriptTarget.ESNext,
    alwaysStrict: true,
    allowNonTsExtensions: true,
    moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
    module: monaco.languages.typescript.ModuleKind.CommonJS,
    noEmit: true,
    esModuleInterop: true,
    allowJs: true,
    skipLibCheck: true,
    allowSyntheticDefaultImports: true,
    baseUrl: './'
  });
</code>```

I fear I'm missing something obvious here but I've been searching for days, help very much appreciated.

Body:
I'm trying to load a very basic project using Monaco Editor but I'm having issues resolving node_modules. It seems that the entry point of the project defined in package.json is ignored.

In the example here axios works fine because it has an index.d.ts file at the root of the folder, but any project that doesn't have a .d.ts, or where the main entry point/typings of the file aren't inside the root, don't get resolved. One example of this is delayed-stream where the entry point is inside /lib/delayed_stream.js.

The project has a structure such as:

- <root>
  - src
    - index.ts
  - package.json
  - node_modules
    - axios
      - ...
    - delayed-stream
      - ...

// ./src/index.ts
import axios from 'axios'; // Resolves
import delayedStream from 'delayed-stream'; // Cannot find module 'delayed-stream' or its corresponding type declarations.(2307)

All .d.ts files are loaded with:

monaco.languages.typescript.typescriptDefaults.addExtraLib(data, file);
monaco.languages.typescript.javascriptDefaults.addExtraLib(data, file);
monaco.editor.createModel(data, 'typescript', monaco.Uri.parse(file));

And all .js, .ts and .json files are loaded with:

monaco.editor.createModel(data, language, monaco.Uri.parse(file));

I am creating an editor with the same settings as my tsconfig such as:

  monaco.languages.typescript.javascriptDefaults.setEagerModelSync(true);
  monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
    noSemanticValidation: false,
    noSyntaxValidation: false,
  });
  monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
    target: monaco.languages.typescript.ScriptTarget.ESNext,
    alwaysStrict: true,
    allowNonTsExtensions: true,
    moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
    module: monaco.languages.typescript.ModuleKind.CommonJS,
    noEmit: true,
    esModuleInterop: true,
    allowJs: true,
    skipLibCheck: true,
    allowSyntheticDefaultImports: true,
    baseUrl: './'
  });

I fear I'm missing something obvious here but I've been searching for days, help very much appreciated.


问:
SQL - to evaluate multiple conditions, is OR faster than AND?
Just wonder how conditional statements work behind the scene.

I am checking if multiple fields are all NULL.

```<code>-- OR: if there is any NOT NULL value
CASE
    WHEN field_1 IS NOT NULL OR field_2 IS NOT NULL
    THEN 1 ELSE 0
END

-- AND: if all values are null
CASE
    WHEN field_1 IS NULL AND field_2 IS NULL
    THEN 1 ELSE 1
END
</code>```

Just wonder if it will be faster if I use OR rather than AND, because if condition 1 returns True then other conditions will not be evaluated?

Or it will be the same because all conditions are evaluated independently?

Do all SQL engines work in the same way on this matter? I'm using Teradata

Body:
Just wonder how conditional statements work behind the scene.

I am checking if multiple fields are all NULL.

-- OR: if there is any NOT NULL value
CASE
    WHEN field_1 IS NOT NULL OR field_2 IS NOT NULL
    THEN 1 ELSE 0
END

-- AND: if all values are null
CASE
    WHEN field_1 IS NULL AND field_2 IS NULL
    THEN 1 ELSE 1
END

Just wonder if it will be faster if I use OR rather than AND, because if condition 1 returns True then other conditions will not be evaluated?

Or it will be the same because all conditions are evaluated independently?

Do all SQL engines work in the same way on this matter? I'm using Teradata


问:
How can I run port-forward istio-ingressgateway in background?
I installed kubeflow manifest follow from kubeflow/manifasts.

And I checked istio-ingressgateway work for me.

```<code>$ kubectl get svc istio-ingressgateway -n istio-system
</code>```
```<code>NAME                   TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)                                                                      AGE
istio-ingressgateway   NodePort   10.96.89.178   <none>        15021:32680/TCP,80:32075/TCP,443:32334/TCP,31400:30226/TCP,15443:30276/TCP   15m
</code>```
```<code>$ kubectl port-forward svc/istio-ingressgateway -n istio-system 8080:80
</code>```
```<code>Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080
</code>```

This terminal should always be running when I connecting to 8080.

What I need help:

I want this port forwarding to run in the background.

There is no way to run  port-forward in the background??

env:

ubuntu 20.04

```<code>$ kubectl version --client && kubeadm version
</code>```
```<code>Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.13", GitCommit:"a43c0904d0de10f92aa3956c74489c45e6453d6e", GitTreeState:"clean", BuildDate:"2022-08-17T18:28:56Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
kubeadm version: &version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.13", GitCommit:"a43c0904d0de10f92aa3956c74489c45e6453d6e", GitTreeState:"clean", BuildDate:"2022-08-17T18:27:51Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
</code>```

Body:
I installed kubeflow manifest follow from kubeflow/manifasts.

And I checked istio-ingressgateway work for me.

$ kubectl get svc istio-ingressgateway -n istio-system

NAME                   TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)                                                                      AGE
istio-ingressgateway   NodePort   10.96.89.178   <none>        15021:32680/TCP,80:32075/TCP,443:32334/TCP,31400:30226/TCP,15443:30276/TCP   15m

$ kubectl port-forward svc/istio-ingressgateway -n istio-system 8080:80

Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080

This terminal should always be running when I connecting to 8080.

What I need help:

I want this port forwarding to run in the background.

There is no way to run  port-forward in the background??

env:

ubuntu 20.04

$ kubectl version --client && kubeadm version

Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.13", GitCommit:"a43c0904d0de10f92aa3956c74489c45e6453d6e", GitTreeState:"clean", BuildDate:"2022-08-17T18:28:56Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
kubeadm version: &version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.13", GitCommit:"a43c0904d0de10f92aa3956c74489c45e6453d6e", GitTreeState:"clean", BuildDate:"2022-08-17T18:27:51Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}