问:
How to delete answered inline query when pressing the InlineKeyboardButton? (python-telegram-bot)
In a nutshell, I want to add "Cancel" button into InlineKeyboardMarkup. But I have problems when adding it when using inline mode.

I want to delete a message created by InlineQueryResultArticle in InlineQueryHandler's function. I'm passing reply_markup with some InlineKeyboardButtons. The last button has text='Cancel' and callback_data that is an object of my custom class CancelMessage() (I don't think the problem is related to this class).

In main function there is CallbackQueryHandler(cancel, pattern=CancelMessage) and
InlineQueryHandler(post_issue_inline)

Logger says that update.effective_chat and update.message are both None, thus, I can't use context.bot.delete_message(). Possible reason that I think I can't delete message is because

when I type @bot's_username in telegram app, the text I'm typing pops up, then I push/choose it, then the message (that I want to delete) with buttons is sent by me, not by bot

this leads to None type of update.message (and maybe update.effective_chat)

-> I can't delete this message.

I've tried a lot of variants of deleting. I was only able to edit the text of this message by update.callback_query.edit_message_text('some text')

```<code>def cancel(update: Update, context: CallbackContext) -> None:
    context.bot.delete_message(update.effective_chat.id, update.callback_query.message.message_id) # doesn't work

def post_issue_inline(update: Update, context: CallbackContext) -> None:
    query = update.inline_query.query
    if query != '':
        if '.' in query:
            summary = query[:query.find('.')].strip()
            description = query[query.find('.'):].strip()
        else:
            summary = query
            description = ''
        project = SetProjectMessage(summary, description)
        names_ids = projects_name_id(update, context, project)
        article = InlineQueryResultArticle(
            id=str(uuid4()),
            title=query,
            input_message_content=InputTextMessageContent(query),
            reply_markup=InlineKeyboardMarkup(make_keyboard(names_ids, extra_buttons=1))
        )
        update.inline_query.answer([article])
</code>```

Function projects_name_id(...) returns me a list of tuples [(to_text, to_callback_data), ...] from which I make_keyboard() with InlineKeyboardButtons

I found that I can delete message if it was sent by bot. How can I send message with reply_markup (that was in InlineQueryResultArticle) by bot in post_issue_inline?

答:
The issue here is that the bot may not be part of the chat where the message is sent. E.g. you can use @botusername … in a private chat with another person. In these cases, the bot can't possibly be allowed to delete messages of chats that it's not even a member of. This is probably the reason whay deleteMessage does not accept an inline_message_id (in contrast to edit_message_text).

Note that even in cases where the bot is a member of the chat where the message is sent, update.callback_query.message will still be None.

Body:
In a nutshell, I want to add "Cancel" button into InlineKeyboardMarkup. But I have problems when adding it when using inline mode.

I want to delete a message created by InlineQueryResultArticle in InlineQueryHandler's function. I'm passing reply_markup with some InlineKeyboardButtons. The last button has text='Cancel' and callback_data that is an object of my custom class CancelMessage() (I don't think the problem is related to this class).

In main function there is CallbackQueryHandler(cancel, pattern=CancelMessage) and
InlineQueryHandler(post_issue_inline)

Logger says that update.effective_chat and update.message are both None, thus, I can't use context.bot.delete_message(). Possible reason that I think I can't delete message is because

when I type @bot's_username in telegram app, the text I'm typing pops up, then I push/choose it, then the message (that I want to delete) with buttons is sent by me, not by bot

this leads to None type of update.message (and maybe update.effective_chat)

-> I can't delete this message.

I've tried a lot of variants of deleting. I was only able to edit the text of this message by update.callback_query.edit_message_text('some text')

def cancel(update: Update, context: CallbackContext) -> None:
    context.bot.delete_message(update.effective_chat.id, update.callback_query.message.message_id) # doesn't work

def post_issue_inline(update: Update, context: CallbackContext) -> None:
    query = update.inline_query.query
    if query != '':
        if '.' in query:
            summary = query[:query.find('.')].strip()
            description = query[query.find('.'):].strip()
        else:
            summary = query
            description = ''
        project = SetProjectMessage(summary, description)
        names_ids = projects_name_id(update, context, project)
        article = InlineQueryResultArticle(
            id=str(uuid4()),
            title=query,
            input_message_content=InputTextMessageContent(query),
            reply_markup=InlineKeyboardMarkup(make_keyboard(names_ids, extra_buttons=1))
        )
        update.inline_query.answer([article])

Function projects_name_id(...) returns me a list of tuples [(to_text, to_callback_data), ...] from which I make_keyboard() with InlineKeyboardButtons

I found that I can delete message if it was sent by bot. How can I send message with reply_markup (that was in InlineQueryResultArticle) by bot in post_issue_inline?


来源: stackexchange

问:
What determines NumPy default integer precision?
```<code>import numpy as np
from io import StringIO
data = StringIO("1 2 3\n 4 5 6")
np.genfromtxt(data, dtype=(int, float, int), names="a")

array([(1, 2.0, 3), (4, 5.0, 6)],
      dtype=[('a', '<i8'), ('f0', '<f8'), ('f1', '<i8')])
</code>```

The above code is from NumPy official documentation. https://numpy.org/doc/stable/user/basics.io.genfromtxt.html#setting-the-names

When I ran it on my local PC, the result was different.
The '<f8' in the second element was the same, but I got '<i4' at the first and the third elements instead of '<i8' as in the example.

What makes the differenct? I ran it on Windows 10 PC of i7-6700 CPU. Might it depend on the hardware?

答:
Regarding the documentation, the int type decays to the np.int_ one which is not portable between platforms. It is likely equal to np.int32 on x86-64 Windows machines and np.int64 on x86-64 Linux ones for example. Indeed, the size of default native integers is defined by the C ABI. The thing is there is no standard C ABI but many ones each related to a set of platforms. The OS, the processor architecture and the compiler are the three parameters that generally define the ABI. A part of the ABI for the target platform defines the data model. There are many of them, even for 64-bit systems, but only 2 are widely used nowadays: LLP64 and LP64. Based on this, we can conclude that the default Numpy integer size is:

```<code>32-bit on 64-bit Windows when using a standard MinGW build
64-bit on 64-bit Windows when using a non-standard Cygwin build
64-bit on most 64-bit Unix-like systems (eg. Linux, macOS, BSD)
32-bit on all 32-bit mainstream processors
</code>```

It is generally better to specify the size of the type so to avoid platform dependent issues (eg. overflows) and better control memory usage of your program on different platforms it can be executed.

ContentLicense: CC BY-SA 4.0

Body:
import numpy as np
from io import StringIO
data = StringIO("1 2 3\n 4 5 6")
np.genfromtxt(data, dtype=(int, float, int), names="a")

array([(1, 2.0, 3), (4, 5.0, 6)],
      dtype=[('a', '<i8'), ('f0', '<f8'), ('f1', '<i8')])

The above code is from NumPy official documentation. https://numpy.org/doc/stable/user/basics.io.genfromtxt.html#setting-the-names

When I ran it on my local PC, the result was different.
The '<f8' in the second element was the same, but I got '<i4' at the first and the third elements instead of '<i8' as in the example.

What makes the differenct? I ran it on Windows 10 PC of i7-6700 CPU. Might it depend on the hardware?

Body:
Regarding the documentation, the int type decays to the np.int_ one which is not portable between platforms. It is likely equal to np.int32 on x86-64 Windows machines and np.int64 on x86-64 Linux ones for example. Indeed, the size of default native integers is defined by the C ABI. The thing is there is no standard C ABI but many ones each related to a set of platforms. The OS, the processor architecture and the compiler are the three parameters that generally define the ABI. A part of the ABI for the target platform defines the data model. There are many of them, even for 64-bit systems, but only 2 are widely used nowadays: LLP64 and LP64. Based on this, we can conclude that the default Numpy integer size is:

32-bit on 64-bit Windows when using a standard MinGW build
64-bit on 64-bit Windows when using a non-standard Cygwin build
64-bit on most 64-bit Unix-like systems (eg. Linux, macOS, BSD)
32-bit on all 32-bit mainstream processors

It is generally better to specify the size of the type so to avoid platform dependent issues (eg. overflows) and better control memory usage of your program on different platforms it can be executed.


问:
Cumulative distinct count
I am working on query to get cumulative distinct count of uids on daily basis.

Example : Say there are 2 uids (100,200) appeared on  date 2016-11-01 and they also appeared on next day with new uid 300 (100,200,300) on 2016-11-02
At this point i want store cumulative count to be 3 not 5 as (user id 100 and 200 already appeared on past day ).

```<code>Input table:

    date            uid
2016-11-01          100
2016-11-01          200
2016-11-01          300
2016-11-01          400
2016-11-02          100
2016-11-02          200
2016-11-03          300
2016-11-03          400
2016-11-03          500
2016-11-03          600
2016-11-04          700

Expected query result:

date            daily_cumulative_count
2016-11-01              4
2016-11-02              4
2016-11-03              6
2016-11-04              7
</code>```

Till now i am able to get cumulative distinct count per day but it includes previous distinct uids from previous day as well.

```<code>SELECT
  date,
  SUM(count) OVER (
    ORDER BY date ASC
    ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
  )
FROM (
  SELECT
    date,
    COUNT(DISTINCT uid) AS count
  FROM sample_table
  GROUP by 1
)ORDER BY date DESC;
</code>```

Any kind of help would be greatly appreciated.

答:
A version similar to @stepan-blr but with the final result you are looking for

Version WITH:

```<code>WITH t as (
    SELECT uid
           , min(dt) fst_date
    FROM input_table
    GROUP BY uid
)
SELECT DISTINCT fst_date
                , count(uid) over (order by fst_date ) daily_cumulative_count
FROM t
</code>```

Version SELECT FROM SELECT:

```<code>SELECT DISTINCT fst_date
                , count(uid) over (order by fst_date ) daily_cumulative_count
FROM (
    SELECT uid
           , min(dt) fst_date
    FROM input_table
    GROUP BY uid
     ) t
</code>```

ContentLicense: CC BY-SA 3.0

Title: Cumulative distinct count

Body:
I am working on query to get cumulative distinct count of uids on daily basis.

Example : Say there are 2 uids (100,200) appeared on  date 2016-11-01 and they also appeared on next day with new uid 300 (100,200,300) on 2016-11-02
At this point i want store cumulative count to be 3 not 5 as (user id 100 and 200 already appeared on past day ).

Input table:

    date            uid
2016-11-01          100
2016-11-01          200
2016-11-01          300
2016-11-01          400
2016-11-02          100
2016-11-02          200
2016-11-03          300
2016-11-03          400
2016-11-03          500
2016-11-03          600
2016-11-04          700

Expected query result:

date            daily_cumulative_count
2016-11-01              4
2016-11-02              4
2016-11-03              6
2016-11-04              7

Till now i am able to get cumulative distinct count per day but it includes previous distinct uids from previous day as well.

SELECT
  date,
  SUM(count) OVER (
    ORDER BY date ASC
    ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
  )
FROM (
  SELECT
    date,
    COUNT(DISTINCT uid) AS count
  FROM sample_table
  GROUP by 1
)ORDER BY date DESC;

Any kind of help would be greatly appreciated.

Body:
A version similar to @stepan-blr but with the final result you are looking for

Version WITH:

WITH t as (
    SELECT uid
           , min(dt) fst_date
    FROM input_table
    GROUP BY uid
)
SELECT DISTINCT fst_date
                , count(uid) over (order by fst_date ) daily_cumulative_count
FROM t

Version SELECT FROM SELECT:

SELECT DISTINCT fst_date
                , count(uid) over (order by fst_date ) daily_cumulative_count
FROM (
    SELECT uid
           , min(dt) fst_date
    FROM input_table
    GROUP BY uid
     ) t


问:
Perl backticks using bash
In Perl, the default shell to execute backticks is sh. I'd like to switch to use bash for its richer syntax. So far I found that the suggested solution is

```<code>`bash -c \"echo a b\"`
</code>```

The apparent drawback is that the escaped double quotes, which means I will have difficulty to use double quotes in my bash args. For example, if I wanted to run commands requiring double quotes in bash

```<code>echo "a'b"
</code>```

The above method will be very awkward.

Perl's system() call has a solution for this problem: to use ARRAY args,

```<code>system("bash", "-c", qq(echo "a'b"));
</code>```

This keeps my original bash command unmodified, and almost always.

I'd like to use ARRAY args in backticks too. Is it possible?

答:
You can use single quotes as delimiter with qx like this:

```<code>my $out = qx'bash -c "echo a b"';
</code>```

this will according to perlop protect the command from Perl's double-quote interpolation.

Unfortunately, this does not work for single quotes. If you want to do echo "'" for example, you need the following:

```<code>my $out = `bash -c \"echo \\\"'\\\"\"`;
</code>```

Edit:

To help you managing the escaping of quotes you could use a helper function like this:

```<code>use experimental qw(signatures);
sub bash_backticks($code) {
    $code =~ s/'/'"'"'/g;
    `bash -c '$code'`
}
</code>```

Title: Perl backticks using bash

Body:
In Perl, the default shell to execute backticks is sh. I'd like to switch to use bash for its richer syntax. So far I found that the suggested solution is

`bash -c \"echo a b\"`

The apparent drawback is that the escaped double quotes, which means I will have difficulty to use double quotes in my bash args. For example, if I wanted to run commands requiring double quotes in bash

echo "a'b"

The above method will be very awkward.

Perl's system() call has a solution for this problem: to use ARRAY args,

system("bash", "-c", qq(echo "a'b"));

This keeps my original bash command unmodified, and almost always.

I'd like to use ARRAY args in backticks too. Is it possible?

Body:
You can use single quotes as delimiter with qx like this:

my $out = qx'bash -c "echo a b"';

this will according to perlop protect the command from Perl's double-quote interpolation.

Unfortunately, this does not work for single quotes. If you want to do echo "'" for example, you need the following:

my $out = `bash -c \"echo \\\"'\\\"\"`;

Edit:

To help you managing the escaping of quotes you could use a helper function like this:

use experimental qw(signatures);
sub bash_backticks($code) {
    $code =~ s/'/'"'"'/g;
    `bash -c '$code'`
}


问:
Spring RequestMapping only maps one RequestParameter
Hi i have an endpoint with multiple Request Parameters

```<code>@GetMapping(produces = {MediaType.APPLICATION_JSON_VALUE}, value = "/somepath")
SomeDTO getSomething(
@ApiParam(value = "Some filter one", required = true) @RequestParam(required = false, value = "propertyId") String propertyId,
@ApiParam(value = "Some filter two", required = false) @RequestParam(required = false, value = "otherPropertyId") String otherPropertyId){
...
}
</code>```

When i invoke endpoint with only one parameter like

```<code>wget http://localhost:8085/somepath?propertyId=3016868
</code>```

I see in the logs that propertyId is 3016868.

But when i use both parameters like

```<code>wget http://localhost:8085/somepath?propertyId=3016868&otherPropertyId=3016867
</code>```

I see in the logs that propertyId is 3016868 but otherPropertyId is null

When i switch the paramters

```<code>wget http://localhost:8085/somepath?otherPropertyId=3016868&propertyId=3016867
</code>```

I see in the logs that otherPropertyId is 3016868 but propertyId is null

So it seems to me that only first parameter is mapped. Has anyone a clue why ?

答: Problem was that you have to put the url in Qutation Marks. Then all parameters are mapped. Its not a Spring Problem</p>

Body:
Hi i have an endpoint with multiple Request Parameters

@GetMapping(produces = {MediaType.APPLICATION_JSON_VALUE}, value = "/somepath")
SomeDTO getSomething(
@ApiParam(value = "Some filter one", required = true) @RequestParam(required = false, value = "propertyId") String propertyId,
@ApiParam(value = "Some filter two", required = false) @RequestParam(required = false, value = "otherPropertyId") String otherPropertyId){
...
}

When i invoke endpoint with only one parameter like

wget http://localhost:8085/somepath?propertyId=3016868

I see in the logs that propertyId is 3016868.

But when i use both parameters like

wget http://localhost:8085/somepath?propertyId=3016868&otherPropertyId=3016867

I see in the logs that propertyId is 3016868 but otherPropertyId is null

When i switch the paramters

wget http://localhost:8085/somepath?otherPropertyId=3016868&propertyId=3016867

I see in the logs that otherPropertyId is 3016868 but propertyId is null

So it seems to me that only first parameter is mapped. Has anyone a clue why ?


问:
How to create a mongodb connection provider in Nestjs
I am trying to create a database connection provider in Nestjs for MongoDB.

I inspected the user.controller.ts and mongoDbProvider by putting breakpoints and found that the controller gets before the database connection is made. How do I make a database connection before the controllers get initialized?

Nest.js documentation says that useFactory method will run before any other module that depends on it.

src/mongo-db/mongodb.provider.ts

```<code>import { MongoClient } from "mongodb";
import { MONGODB_PROVIDER } from "../constants";

export const mongoDbProviders = [
  {
    provide: MONGODB_PROVIDER,
    useFactory: async () => {
      MongoClient.connect('mongodb://localhost:27017',
        { useUnifiedTopology: true },
        (error, client) => {
          return client.db('nestjs-sample');
        });
    }
  },

];
</code>```

src/mongo-db/mongo-db.module.ts

```<code>import { mongoDbProviders } from './mongo-db.providers';

@Module({
  providers: [...mongoDbProviders],
  exports: [...mongoDbProviders],
})
export class MongoDbModule {

}
</code>```

src/constants.ts

```<code>export const MONGODB_PROVIDER = 'MONGODB_CONNECTION';
</code>```

I imported MongoDbModule into user.module.ts

src/user/user.module.ts

```<code>import { Module } from '@nestjs/common';
import { UserController } from './user.controller';
import { UserService } from './user.service';
import { MongoDbModule } from 'src/mongo-db/mongo-db.module';

@Module({
  imports: [MongoDbModule],
  controllers: [UserController],
  providers: [UserService]
})
export class UserModule {}
</code>```

Here I injected the db from mongoDbProvider into UserController constructor. But the constructor runs before db connection.

src/user/user.controller.ts

```<code>import { Controller, Post, Req, Get, Res, Inject } from '@nestjs/common';
import { Request, Response } from "express";
import { MONGODB_PROVIDER } from 'src/constants';

@Controller('users')
export class UserController {

  constructor(@Inject(MONGODB_PROVIDER) private readonly db: any) {

  }

  @Post()
  async create(@Req() request: Request, @Res() response: Response) {
    this.db.collection('users').insertOne(request.body, (err, result) => {
      if (err) {
        response.status(500).json(err);
      } else {
        response.status(201);
        response.send(result);
      }
    });
  }

  @Get()
  get(@Req() request: Request, @Res() response: Response) {
    response.status(400).json({
      message: 'kidilam service'
    });
  }

}
</code>```

答:
// We can also use MongoClient in nestJs using DipendencyInjection
// first we have to create database connection

// fileName :- db/dbConnection.service.ts

        import { Injectable } from '@nestjs/common';
        import { MongoClient } from 'mongodb';
        import { config } from 'dotenv';
        config();

        let dbInstance;
        const url = process.env.MONGO_URL || 'mongodb://localhost:27017/SocialUserEr';

        @Injectable()
        export class DbConnection {  constructor() {
            this.connect();
          }
          connect() {
            const client = new MongoClient(url);
            client
              .connect()
              .then((connection) => {
                dbInstance = connection.db();
                console.log('Database connection Succeeded');
              })
              .catch((err) => {
                console.log(err);
              });
          }
          db() {
            if (dbInstance) return dbInstance;
          }
        }

Then we have to export it for use anywhere: ex

// fileName:- db/db.module.ts

        import { Module } from '@nestjs/common';
        import { DbConnection } from './db.service';

        @Module({
          imports: [],
          exports: [DbConnection],
          providers: [DbConnection],
        })
        export class DbModule {}

// for Using this connection inside a module you have to import DbModule : ex
// In this module we want to use db connection so we have to import db module

// fileName:- auth/auth.module.ts

import { Module } from '@nestjs/common';
import { DbModule } from 'src/db/db.module';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';

@Module({
  imports: [DbModule],
  controllers: [AuthController],
  providers: [AuthService],
})
export class AuthModule {}

// And lastly for using inside any module you have to just
// fileName :- auth.service.ts

import { Injectable } from '@nestjs/common';
import { DbConnection } from 'src/db/db.service';

@Injectable()
export class AuthService {
  constructor(private database: DbConnection) {}
  async createUser(userInfo) {
    console.log(userInfo);
    return await this.database.db().collection('user').insertOne(userInfo);
  }
}

```

Body:
I am trying to create a database connection provider in Nestjs for MongoDB.

I inspected the user.controller.ts and mongoDbProvider by putting breakpoints and found that the controller gets before the database connection is made. How do I make a database connection before the controllers get initialized?

Nest.js documentation says that useFactory method will run before any other module that depends on it.

src/mongo-db/mongodb.provider.ts

import { MongoClient } from "mongodb";
import { MONGODB_PROVIDER } from "../constants";

export const mongoDbProviders = [
  {
    provide: MONGODB_PROVIDER,
    useFactory: async () => {
      MongoClient.connect('mongodb://localhost:27017',
        { useUnifiedTopology: true },
        (error, client) => {
          return client.db('nestjs-sample');
        });
    }
  },

];

src/mongo-db/mongo-db.module.ts

import { mongoDbProviders } from './mongo-db.providers';

@Module({
  providers: [...mongoDbProviders],
  exports: [...mongoDbProviders],
})
export class MongoDbModule {

}

src/constants.ts

export const MONGODB_PROVIDER = 'MONGODB_CONNECTION';

I imported MongoDbModule into user.module.ts

src/user/user.module.ts

import { Module } from '@nestjs/common';
import { UserController } from './user.controller';
import { UserService } from './user.service';
import { MongoDbModule } from 'src/mongo-db/mongo-db.module';

@Module({
  imports: [MongoDbModule],
  controllers: [UserController],
  providers: [UserService]
})
export class UserModule {}

Here I injected the db from mongoDbProvider into UserController constructor. But the constructor runs before db connection.

src/user/user.controller.ts

import { Controller, Post, Req, Get, Res, Inject } from '@nestjs/common';
import { Request, Response } from "express";
import { MONGODB_PROVIDER } from 'src/constants';

@Controller('users')
export class UserController {

  constructor(@Inject(MONGODB_PROVIDER) private readonly db: any) {

  }

  @Post()
  async create(@Req() request: Request, @Res() response: Response) {
    this.db.collection('users').insertOne(request.body, (err, result) => {
      if (err) {
        response.status(500).json(err);
      } else {
        response.status(201);
        response.send(result);
      }
    });
  }

  @Get()
  get(@Req() request: Request, @Res() response: Response) {
    response.status(400).json({
      message: 'kidilam service'
    });
  }

}

Body:
// We can also use MongoClient in nestJs using DipendencyInjection
// first we have to create database connection

// fileName :- db/dbConnection.service.ts

        import { Injectable } from '@nestjs/common';
        import { MongoClient } from 'mongodb';
        import { config } from 'dotenv';
        config();

        let dbInstance;
        const url = process.env.MONGO_URL || 'mongodb://localhost:27017/SocialUserEr';

        @Injectable()
        export class DbConnection {  constructor() {
            this.connect();
          }
          connect() {
            const client = new MongoClient(url);
            client
              .connect()
              .then((connection) => {
                dbInstance = connection.db();
                console.log('Database connection Succeeded');
              })
              .catch((err) => {
                console.log(err);
              });
          }
          db() {
            if (dbInstance) return dbInstance;
          }
        }

Then we have to export it for use anywhere: ex

// fileName:- db/db.module.ts

        import { Module } from '@nestjs/common';
        import { DbConnection } from './db.service';

        @Module({
          imports: [],
          exports: [DbConnection],
          providers: [DbConnection],
        })
        export class DbModule {}

// for Using this connection inside a module you have to import DbModule : ex
// In this module we want to use db connection so we have to import db module

// fileName:- auth/auth.module.ts

import { Module } from '@nestjs/common';
import { DbModule } from 'src/db/db.module';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';

@Module({
  imports: [DbModule],
  controllers: [AuthController],
  providers: [AuthService],
})
export class AuthModule {}

// And lastly for using inside any module you have to just
// fileName :- auth.service.ts

import { Injectable } from '@nestjs/common';
import { DbConnection } from 'src/db/db.service';

@Injectable()
export class AuthService {
  constructor(private database: DbConnection) {}
  async createUser(userInfo) {
    console.log(userInfo);
    return await this.database.db().collection('user').insertOne(userInfo);
  }
}

<!-- begin snippet: js hide: false console: true babel: false -->


问:
How do you call an overridden MSBuild target
In MSBuild you can override a <Target /> from another file in your own. For example the AfterBuild target included in Microsoft.Common.targets file simply by defining your own Target with the same name:

```<code><Target Name="AfterBuild">
    <!-- Do something different -->
</TargetName>
</code>```

You'll see a note like this:

Overriding target "AfterBuild" in project "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets" with target "AfterBuild" from project "XXXXX".

Is there any way to call the original AfterBuild target?

I'd like to do this to instrument certain complex default Targets and then execute the  original behavior. Many targets like Build expose a BuildDependsOn property that can be used for this. Many others do not - and I'd like to override them without completely duplicating their content.

答:
I'd like to do this to instrument certain complex default Targets and then execute the original behavior. Many targets like Build expose a BuildDependsOn property that can be used for this. Many others do not - and I'd like to override them without completely duplicating their content.

If you want to first run something custom on a target and then run the original target, why not just use BeforeTargets?

So instead of

```<code><Target Name="AfterBuild">
    <!-- custom AfterBuild overriding default AfterBuild -->
</TargetName>
</code>```

just use

```<code><Target Name="JustBefore_AfterBuild" BeforeTargets="AfterBuild">
    <!-- custom AfterBuild just before default AfterBuild -->
</TargetName>
</code>```

ContentLicense: CC BY-SA 2.5

Body:
In MSBuild you can override a <Target /> from another file in your own. For example the AfterBuild target included in Microsoft.Common.targets file simply by defining your own Target with the same name:

<Target Name="AfterBuild">

</TargetName>

You'll see a note like this:

Overriding target "AfterBuild" in project "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets" with target "AfterBuild" from project "XXXXX".

Is there any way to call the original AfterBuild target?

I'd like to do this to instrument certain complex default Targets and then execute the  original behavior. Many targets like Build expose a BuildDependsOn property that can be used for this. Many others do not - and I'd like to override them without completely duplicating their content.

Body:
I'd like to do this to instrument certain complex default Targets and then execute the original behavior. Many targets like Build expose a BuildDependsOn property that can be used for this. Many others do not - and I'd like to override them without completely duplicating their content.

If you want to first run something custom on a target and then run the original target, why not just use BeforeTargets?

So instead of

<Target Name="AfterBuild">
    <!-- custom AfterBuild overriding default AfterBuild -->
</TargetName>

just use

<Target Name="JustBefore_AfterBuild" BeforeTargets="AfterBuild">
    <!-- custom AfterBuild just before default AfterBuild -->
</TargetName>


问:
Asynchronous consumption of queue to respond to frontend Requests
In my first attemps to get my head around asynchronous messaging for microservices in php.
I built a registration form, sent the data using Ajax to a php script that publishes a message to a save queue and after that starts the while loop to consume a front end queue that's supposed to send the response as an echo back to ajax.

The Problem:
starting the consumer in the same script called by ajax seems to be blocking, meaning that if any thing happens on the save service side, my server is busy, and I cann't even ^C it, and I have to kill the terminal manually!

how can I go about this?

My Ajax call:

```<code>$(document).ready(function () {
  $("form").submit(function (event) {
    var formData = {
      name: $("#fullname").val(),
      email: $("#email").val(),
      password: $("#password").val()
    };

    $.ajax({
      type: "POST",
      url: "index.php",
      data: { 'data' : JSON.stringify(formData) },
      dataType: "json",
      encode: true,
      success : function(d){
        console.log(d)
      },
      error : function(e){

        console.log('error', typeof this.data)
      }
    })

      event.preventDefault();
    });
  });
</code>```

My index.php:

```<code><?php
require_once __DIR__ . '/vendor/autoload.php';

use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();

session_start();
$corr_id = uniqid();
$_SESSION['user'] = $corr_id;

error_log($_SESSION['user']);
error_log(session_id());
$channel->exchange_declare('Planning', 'topic', false, true, false, false, false);
$channel->queue_declare('front_queue', false, true, false, false);
$channel->queue_bind('front_queue', 'Planning', $corr_id);

$payload = json_decode($_POST['data'], true);
$payload += ["id" => $corr_id];
error_log(json_encode($payload));

$con =   new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$chan = $con->channel();
$chan->exchange_declare('Planning', 'topic', false, true, false);
$new_msg = new AMQPMessage(json_encode($payload), array('correlation_id' => $corr_id));
$chan->basic_publish($new_msg, 'Planning', 'save');
$chan->close();
$con->close();
$callback = function($msg)
{
    $channel = $msg->getChannel();
    $connection = $msg->getChannel()->getConnection();
    echo json_encode($msg->body);
    $msg->ack();
    $channel->close();
    $connection->close();
};
$channel->basic_consume('front_queue', '', false, false, false, false, $callback);

while($channel->is_open()){
    $channel->wait();
}
</code>```

答:
It's a very bad Idea to have used the Php server to test this application,
Using Nginx or apache solved the Issue</p>

Body:
In my first attemps to get my head around asynchronous messaging for microservices in php.
I built a registration form, sent the data using Ajax to a php script that publishes a message to a save queue and after that starts the while loop to consume a front end queue that's supposed to send the response as an echo back to ajax.

The Problem:
starting the consumer in the same script called by ajax seems to be blocking, meaning that if any thing happens on the save service side, my server is busy, and I cann't even ^C it, and I have to kill the terminal manually!

how can I go about this?

My Ajax call:

$(document).ready(function () {
  $("form").submit(function (event) {
    var formData = {
      name: $("#fullname").val(),
      email: $("#email").val(),
      password: $("#password").val()
    };

    $.ajax({
      type: "POST",
      url: "index.php",
      data: { 'data' : JSON.stringify(formData) },
      dataType: "json",
      encode: true,
      success : function(d){
        console.log(d)
      },
      error : function(e){

        console.log('error', typeof this.data)
      }
    })

      event.preventDefault();
    });
  });

My index.php:

<?php
require_once __DIR__ . '/vendor/autoload.php';

use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();

session_start();
$corr_id = uniqid();
$_SESSION['user'] = $corr_id;

error_log($_SESSION['user']);
error_log(session_id());
$channel->exchange_declare('Planning', 'topic', false, true, false, false, false);
$channel->queue_declare('front_queue', false, true, false, false);
$channel->queue_bind('front_queue', 'Planning', $corr_id);

$payload = json_decode($_POST['data'], true);
$payload += ["id" => $corr_id];
error_log(json_encode($payload));

$con =   new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$chan = $con->channel();
$chan->exchange_declare('Planning', 'topic', false, true, false);
$new_msg = new AMQPMessage(json_encode($payload), array('correlation_id' => $corr_id));
$chan->basic_publish($new_msg, 'Planning', 'save');
$chan->close();
$con->close();
$callback = function($msg)
{
    $channel = $msg->getChannel();
    $connection = $msg->getChannel()->getConnection();
    echo json_encode($msg->body);
    $msg->ack();
    $channel->close();
    $connection->close();
};
$channel->basic_consume('front_queue', '', false, false, false, false, $callback);

while($channel->is_open()){
    $channel->wait();
}


问:
What is the recommended F# pattern for this situation?
I have a situation which resembles the following:

```<code>let mutable stopped = false

let runAsync() = async {
    while not stopped do
        let! item = fetchItemToProcessAsync
        match item with
        | Some job -> job |> runJobAsync |> Async.Start
        | None -> do! Async.Sleep(1000)
}

let run() = Async.Start runAsync
let stop() =
    stopped <- true
</code>```

Now when the stop method is called, I have to stop reading further items from the DB and also wait for the ones that are currently started to finish before returning from this function.

What is the best way to accomplish this? I was thinking of using a counter, (with interlocked APIs) and return from the stop method when the counter reaches to 0.

If there is an alternative way to accomplish this, I would appreciate the guidance. I have a feeling that I could use agents here, but I am not sure if there is any available way to accomplish this with agent or if I still have to write my custom logic to determine that the jobs have completed executing.

答:
take a look at actor-based patterns and MailboxProcessor

basically you can imagine that as a async-queue. If you use a list of running (started with Async.StartChild or Async.StartAsTask) as the parameter for your loop inside the MailboxProcessor you can gracefully handle shutdowns via wait or a CancellationToken)

Here is a quick sample I put together:

```<code>
type Commands =
    | RunJob of Async
    | JobDone of int
    | Quit of AsyncReplyChannel

type JobRunner() =
    let processor =
        MailboxProcessor.Start (fun inbox ->
            let rec loop (nextId, jobs) = async {
                let! cmd = inbox.Receive()
                match cmd with
                | Quit cb ->
                    if not (Map.isEmpty jobs)
                    then async {
                            do! Async.Sleep 100
                            inbox.Post (Quit cb)}
                        |> Async.Start
                        return! loop (nextId, jobs)
                    else
                        cb.Reply()
                        return ()
                | JobDone id ->
                    return! loop (nextId, jobs |> Map.remove id)
                | RunJob job ->
                    let runJob i = async {
                        do! job
                        inbox.Post (JobDone i)
                    }
                    let! child = Async.StartChild (runJob nextId)
                    return! loop (nextId+1, jobs |> Map.add nextId child)
            }
            loop (0, Map.empty))
    member jr.PostJob(job) = processor.Post (RunJob job)
    member jr.Quit() = processor.PostAndReply(fun cb -> Quit cb)

let postWaitJob (jobRunner : JobRunner) time =
    let job = async {
        do! Async.Sleep time
        printfn "sleept for %d ms" time }
    jobRunner.PostJob job

let testRun() =
    let jr = new JobRunner()
    printfn "starting jobs..."
    [10..-1..1] |> List.iter (fun i -> postWaitJob jr (i*1000))
    printfn "sending quit"
    jr.Quit()
    printfn "done!"
</code>```

Hmm ... got some issues with the editor here: it just kills a lot of code when I use the pipe-back operator ... grrr

Short explanation: as you can see I always provide the inner loop with the next free job-id and a Map of Id->AsyncChild jobs.
(you can of course implement other/better solutions - the Map is not neccessary in this example but you can extent with a command "Cancell JobNr" or whatever this way)
the Job done message is only used internaly to remove jobs from this map
Quit just checks if the map is empty - if it is no additional work is needed and the Mailboxprocessor quits (return ()) - if it is not empty a new Async-Child is started that just waits 100ms and then resends the Quit-Message
RunJob is rather simple to - it just chains the given job with a post of JobDone into the MessabeboxProcessor and recursivley calls loop with the updated values (nextId is one up, and a new Job is mapped to the old nextId)

Body:
I have a situation which resembles the following:

let mutable stopped = false

let runAsync() = async {
    while not stopped do
        let! item = fetchItemToProcessAsync
        match item with
        | Some job -> job |> runJobAsync |> Async.Start
        | None -> do! Async.Sleep(1000)
}

let run() = Async.Start runAsync
let stop() =
    stopped <- true

Now when the stop method is called, I have to stop reading further items from the DB and also wait for the ones that are currently started to finish before returning from this function.

What is the best way to accomplish this? I was thinking of using a counter, (with interlocked APIs) and return from the stop method when the counter reaches to 0.

If there is an alternative way to accomplish this, I would appreciate the guidance. I have a feeling that I could use agents here, but I am not sure if there is any available way to accomplish this with agent or if I still have to write my custom logic to determine that the jobs have completed executing.

Body:
take a look at actor-based patterns and MailboxProcessor

basically you can imagine that as a async-queue. If you use a list of running (started with Async.StartChild or Async.StartAsTask) as the parameter for your loop inside the MailboxProcessor you can gracefully handle shutdowns via wait or a CancellationToken)

Here is a quick sample I put together:

type Commands =
    | RunJob of Async
    | JobDone of int
    | Quit of AsyncReplyChannel

type JobRunner() =
    let processor =
        MailboxProcessor.Start (fun inbox ->
            let rec loop (nextId, jobs) = async {
                let! cmd = inbox.Receive()
                match cmd with
                | Quit cb ->
                    if not (Map.isEmpty jobs)
                    then async {
                            do! Async.Sleep 100
                            inbox.Post (Quit cb)}
                        |> Async.Start
                        return! loop (nextId, jobs)
                    else
                        cb.Reply()
                        return ()
                | JobDone id ->
                    return! loop (nextId, jobs |> Map.remove id)
                | RunJob job ->
                    let runJob i = async {
                        do! job
                        inbox.Post (JobDone i)
                    }
                    let! child = Async.StartChild (runJob nextId)
                    return! loop (nextId+1, jobs |> Map.add nextId child)
            }
            loop (0, Map.empty))
    member jr.PostJob(job) = processor.Post (RunJob job)
    member jr.Quit() = processor.PostAndReply(fun cb -> Quit cb)

let postWaitJob (jobRunner : JobRunner) time =
    let job = async {
        do! Async.Sleep time
        printfn "sleept for %d ms" time }
    jobRunner.PostJob job

let testRun() =
    let jr = new JobRunner()
    printfn "starting jobs..."
    [10..-1..1] |> List.iter (fun i -> postWaitJob jr (i*1000))
    printfn "sending quit"
    jr.Quit()
    printfn "done!"

Hmm ... got some issues with the editor here: it just kills a lot of code when I use the pipe-back operator ... grrr

Short explanation: as you can see I always provide the inner loop with the next free job-id and a Map of Id->AsyncChild jobs.
(you can of course implement other/better solutions - the Map is not neccessary in this example but you can extent with a command "Cancell JobNr" or whatever this way)
the Job done message is only used internaly to remove jobs from this map
Quit just checks if the map is empty - if it is no additional work is needed and the Mailboxprocessor quits (return ()) - if it is not empty a new Async-Child is started that just waits 100ms and then resends the Quit-Message
RunJob is rather simple to - it just chains the given job with a post of JobDone into the MessabeboxProcessor and recursivley calls loop with the updated values (nextId is one up, and a new Job is mapped to the old nextId)


问:
How to enable Client_IP in Azure Log Analytics Workspace
Earlier I had the same situation where the ClientIP in Application Insights Log records was showing as "0.0.0.0" and I learned that the following property can be set using "resources.azure.com", to enable showing the Client_IP using:

properties.DisableIpMasking

Recently we migrated the Application Insights Logs to Azure Log Analytics Workspace. Now, the Application Insights "Logs" shows the Client_IP whereas in Azure Log Analytics Workspace it doesn't.

Is there any settings available to enable the Client_IP in Azure Log Analytics Workspace - Logs records?

I want to see ClientIP in Azure Log Analytics Workspace => Logs section where we see the request details, like duration, url, path, etc.

PS: I'm able to get the ClientIP in Azure App Insights Logs.

Thanks in Advance!

答:
Is there any settings available to enable the ClientIP in Azure Log
Analytics Workspace - Logs ?

AFAIK, We don't have options for adding clientIP in Azure Log analytics Workspace. And even not available in resources.azure.comas log analytics uses default azure public IPs.

For more information please refer this GitHub discussion by @femsulu


问:
Very slow intellisense when using MUI in VS Code
I'm using MUI for a react project and intellisense is giving me problems when it comes to speed. Suggestions won't show up for up to 4-5 seconds and I'm guessing MUI's massive library has something to do with it. Is there a way to disable intellisense for MUI specifically? If not, are there any more ways I can speed up intellisense?

package.json

```<code>"dependencies": {
  "@emotion/react": "^11.5.0",
  "@emotion/styled": "^11.3.0",
  "@mui/icons-material": "^5.0.5",
  "@mui/material": "^5.0.6",
  "@testing-library/jest-dom": "^5.15.0",
  "@testing-library/react": "^11.2.7",
  "@testing-library/user-event": "^12.8.3",
  "axios": "^0.24.0",
  "chart.js": "^3.6.0",
  "react": "^17.0.2",
  "react-chartjs-2": "^3.3.0",
  "react-dom": "^17.0.2",
  "react-reveal": "^1.2.2",
  "react-router": "^6.0.1",
  "react-router-dom": "^6.0.1",
  "react-scripts": "4.0.3",
  "web-vitals": "^1.1.2"
}
</code>```

答:
You should import it like this

import Tab from '@mui/material/Tab';

instead of:

import {Tab} from '@mui/material';

They might look similar, but the second one is importing the whole library and then extracting the Tab component, instead of just getting the component at once. That should help with performance.

Body:
I'm using MUI for a react project and intellisense is giving me problems when it comes to speed. Suggestions won't show up for up to 4-5 seconds and I'm guessing MUI's massive library has something to do with it. Is there a way to disable intellisense for MUI specifically? If not, are there any more ways I can speed up intellisense?

package.json

"dependencies": {
  "@emotion/react": "^11.5.0",
  "@emotion/styled": "^11.3.0",
  "@mui/icons-material": "^5.0.5",
  "@mui/material": "^5.0.6",
  "@testing-library/jest-dom": "^5.15.0",
  "@testing-library/react": "^11.2.7",
  "@testing-library/user-event": "^12.8.3",
  "axios": "^0.24.0",
  "chart.js": "^3.6.0",
  "react": "^17.0.2",
  "react-chartjs-2": "^3.3.0",
  "react-dom": "^17.0.2",
  "react-reveal": "^1.2.2",
  "react-router": "^6.0.1",
  "react-router-dom": "^6.0.1",
  "react-scripts": "4.0.3",
  "web-vitals": "^1.1.2"
}


问:
Keyboard bounces up and down in flatlist (react native)
This issue is driving me crazy, I'm using a flatlist to render data to a list.

Each listitem has text that is editable and when I press them a keyboard comes up which allows me to edit each item. However, even though I've added keyboardavoidingview - on android, if the list is taking up the whole page, it wont let me edit the last items in the list.
When I press them the keyboard just bounces up and then down again, like it's trying to push everything up but it doesn't have enough space or something. I've tried what feels like everything, changing flex-settings, behavior and keyboardVerticalOffset to every possible value.

I won't post the whole code because it might be to messy, but my question is: has anyone encountered the same issue and knows what is messing it up?

(to emphasize, I only have this issue on android, in all kind of screen sizes)

```<code><KeyboardAvoidingView
behavior={Platform.OS === "ios" ? "padding" : "height"}
keyboardVerticalOffset={Platform.OS === "ios" ? 40 : -10}>
</code>```

答: Adding removeClippedSubviews={false} in the FlatList works for some React-Native versions

Body:
This issue is driving me crazy, I'm using a flatlist to render data to a list.

Each listitem has text that is editable and when I press them a keyboard comes up which allows me to edit each item. However, even though I've added keyboardavoidingview - on android, if the list is taking up the whole page, it wont let me edit the last items in the list.
When I press them the keyboard just bounces up and then down again, like it's trying to push everything up but it doesn't have enough space or something. I've tried what feels like everything, changing flex-settings, behavior and keyboardVerticalOffset to every possible value.

I won't post the whole code because it might be to messy, but my question is: has anyone encountered the same issue and knows what is messing it up?

(to emphasize, I only have this issue on android, in all kind of screen sizes)

<KeyboardAvoidingView
behavior={Platform.OS === "ios" ? "padding" : "height"}
keyboardVerticalOffset={Platform.OS === "ios" ? 40 : -10}>


问:
How Can I generate a file in RemoteServiceServlet and send it to a user?
Maybe I can disable RemoteServiceServlet response serialization or define RemoteService interface with method that returns ServletOutputStram? I would like not to save request in any database to file to process it in another request.</p>

答:
If you want to provide a download to the user, you can do it like this:

Write another servlet which simply writes out the file content through the ServletResponse

Make sure you have a binary header and provide the filename in there, too.

In your client, make an  (The widget class for this is Frame) and point its url to your new servlet.

Due to the binary header your browser will now provide the user with a Save as.. popup. That should be all.

Body:
If you want to provide a download to the user, you can do it like this:

Write another servlet which simply writes out the file content through the ServletResponse

Make sure you have a binary header and provide the filename in there, too.

In your client, make an <iframe ..> (The widget class for this is Frame) and point its url to your new servlet.

Due to the binary header your browser will now provide the user with a Save as.. popup. That should be all.


问:
Call an existing API using Loopback 4
I have a pre-developed API connected to my backend. I am using loopback 4 as a data provider for my react application.
I want to call the API using Loopback and get the result in my application.
I went through the loopback 4 documentation calling other API's but found it a bit confusing.
Data returned by my API is :

{ "name": "xyz", "place": "xyz", "email": "xyz" }

I want this data to be returned to my application using Loopback. I do not want to make a direct API call from my React application. I want Loopback to make all the API calls.

Any help is much appreciated.

答:
You can create a datasource via @loopback/service-proxy and use it in the Controller class to call side API.
If u use loopback4: check this link

strongloop - Calling other APIs

Title: Call an existing API using Loopback 4


问:
ENOENT: no such file or directory, lstat '/Users/Desktop/node_modules'
An unhandled exception occurred:

```<code>ENOENT: no such file or directory, lstat
'/Users/Desktop/node_modules'
See "/private/var/folders/3p/l_k1wk8n76v3cfwnxk0blx000000gn/T/ng-
DF5EZ7/angular-errors.log" for further details.
</code>```

Whenever i am doing ng serve, this error occurs,
Can anyone tell me what is the cause of error.
stuck in this since long hours.

答:
I removed the file from angular.json and added it to style.css.

```<code>@import '../node_modules/ngx-bootstrap/datepicker/bs-datepicker.css'
</code>```

Body:
An unhandled exception occurred:

ENOENT: no such file or directory, lstat
'/Users/Desktop/node_modules'
See "/private/var/folders/3p/l_k1wk8n76v3cfwnxk0blx000000gn/T/ng-
DF5EZ7/angular-errors.log" for further details.

Whenever i am doing ng serve, this error occurs,
Can anyone tell me what is the cause of error.
stuck in this since long hours.

Body:
I removed the file from angular.json and added it to style.css.

@import '../node_modules/ngx-bootstrap/datepicker/bs-datepicker.css'


问:
How to fix this error in IE regarding the from
I'm having this error:

Object doesn't support 'from' property or method

on the following line:

const ids = Array.from(cbs).map(function(cb) {cb.getAttribute("data-item-id")});```

How can I fix it?

答: Array.from is not implemented in IE11, so you'll need to use a polyfill

Body:
I'm having this error:

Object doesn't support 'from' property or method

on the following line:

const ids = Array.from(cbs).map(function(cb) {cb.getAttribute("data-item-id")});

How can I fix it?


问:
Fastlane MapBox Framework Architecture arm64 Symbol
I'm trying to upload build through GitHub action and fastlane. I'm stuck in the MapBox framework. I'm using Github LFS to upload the Mapbox framework. But in the last I'm getting error given below please check.

ld: ignoring file /Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/BuildProductsPath/Release-iphoneos/XCFrameworkIntermediates/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )

Error:-

❌ Undefined symbols for architecture arm64
Symbol: OBJC_CLASS$_MBMLayerPosition
Referenced from: objc-class-ref in Style.o
❌ ld: symbol(s) not found for architecture arm64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

▸ Linking FirebaseCoreDiagnostics
** ARCHIVE FAILED **

The following build commands failed:
Ld /Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/MapboxMaps.framework/MapboxMaps normal (in target 'MapboxMaps' from project 'Pods')
(1 failure)
[10:59:06]: Exit status: 65

Question:- Can someone please explain to me how to solve this issue.

Can someone please explain to me How to get Progress?

Any help would be greatly appreciated.

Thanks in advance.

Github LFS

答:
You're not running git lfs pull in your Github action. How do I know that? Because the error message you get says:

```<code>ld: ignoring file /Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/BuildProductsPath/Release-iphoneos/XCFrameworkIntermediates/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )
</code>```

If you convert these (0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F) to ASCII, you get a string, namely: version https://, meaning that your framework file (/Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/MapboxMaps.framework/MapboxMap) still has a string pointer inside, starting with version https:// and not the actual framework itself.

So, what you should do, is to run git lfs pull when you're pulling the repo in your github action config file.

Something like this:

```<code>- name: checkout
  uses: actions/checkout@v2
  with:
      lfs: 'true'
- name: checkoutLFS
  uses: actions/checkout@v2
- run: git lfs pull
</code>```

Body:
You're not running git lfs pull in your Github action. How do I know that? Because the error message you get says:

ld: ignoring file /Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/BuildProductsPath/Release-iphoneos/XCFrameworkIntermediates/MapboxCoreMaps/MapboxCoreMaps.framework/MapboxCoreMaps, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )

If you convert these (0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F) to ASCII, you get a string, namely: version https://, meaning that your framework file (/Users/runner/Library/Developer/Xcode/DerivedData/test-dplpvtipvtqvtobqpvumxtffttst/Build/Intermediates.noindex/ArchiveIntermediates/test/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/MapboxMaps.framework/MapboxMap) still has a string pointer inside, starting with version https:// and not the actual framework itself.

So, what you should do, is to run git lfs pull when you're pulling the repo in your github action config file.

Something like this:

- name: checkout
  uses: actions/checkout@v2
  with:
      lfs: 'true'
- name: checkoutLFS
  uses: actions/checkout@v2
- run: git lfs pull


问:
place multiple svg in one div row bootstrap5
I want to place multiple icons in a div element that should resize when the browser window change size.

My problem is, the svgs are always below one another, unless I give them fixed pixel sizes, which means they wont resize any longer. I would wish for them to have a fixed minum size, but increase size with the growing parent div:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"/>

        hello

            1

            <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
            <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>

            this one is wider

            3

            4

            <svg xmlns="http://www.w3.org/2000/svg" width="10%" height="10%" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
            <svg xmlns="http://www.w3.org/2000/svg" width="10%" height="10%" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>

            5

            6

            no resize :(

            <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
            <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>

            8

        ...

```

How can I alter my SVG settings to make at least two of them always fit next to each other in my div class="col" element?

答:
Since you're using Bootstrap, I recommend you to create another col layout inside your row, with two col-6 columns that span half of the row width.

Check out the snippet below - the additional class .svg-column is only used for minor spacing adjustments.

.svg-column {
  text-align: center;
  padding: 0.5em;
  place-self: center;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="row bg-dark text-white">
  <div class="col-sm-2  d-flex align-items-center">
    <div class="row text-center">
      <span class="text-center">hello</span>
    </div>
  </div>
  <div class="col-sm-3">
    <div class="row text-center">
      <span class="text-center">1</span>
    </div>
    <div class="row">
      <div class="col-6 svg-column">
        <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
      </div>
      <div class="col-6 svg-column">

        <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
      </div>
    </div>
  </div>

  <div class="col-sm-2 d-flex align-items-center">
    <span class="text-end">world</span>
  </div>

</div></code>```

Body:
I want to place multiple icons in a div element that should resize when the browser window change size.

My problem is, the svgs are always below one another, unless I give them fixed pixel sizes, which means they wont resize any longer. I would wish for them to have a fixed minum size, but increase size with the growing parent div:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"/>

        hello

            1

            <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
            <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>

            this one is wider

            3

            4

            <svg xmlns="http://www.w3.org/2000/svg" width="10%" height="10%" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
            <svg xmlns="http://www.w3.org/2000/svg" width="10%" height="10%" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>

            5

            6

            no resize :(

            <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
            <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>

            8

        ...

How can I alter my SVG settings to make at least two of them always fit next to each other in my div class="col" element?

Body:
Since you're using Bootstrap, I recommend you to create another col layout inside your row, with two col-6 columns that span half of the row width.

Check out the snippet below - the additional class .svg-column is only used for minor spacing adjustments.

.svg-column {
  text-align: center;
  padding: 0.5em;
  place-self: center;
}

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="row bg-dark text-white">
  <div class="col-sm-2  d-flex align-items-center">
    <div class="row text-center">
      <span class="text-center">hello</span>
    </div>
  </div>
  <div class="col-sm-3">
    <div class="row text-center">
      <span class="text-center">1</span>
    </div>
    <div class="row">
      <div class="col-6 svg-column">
        <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
      </div>
      <div class="col-6 svg-column">

        <svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>
      </div>
    </div>
  </div>

  <div class="col-sm-2 d-flex align-items-center">
    <span class="text-end">world</span>
  </div>

</div>


问:
Appium: WebDriverAgent is uninstalled from iPad and never installed again
WebDriverAgent is uninstalled from iPad and never installed again throwing xcode error:
“org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65”

Configuration:

Appium : 1.22.0/1.22.2/1.22.0/1.22.0-beta

Mac OS: macOS Monterey v12.1

Xcode: 13.0

java-client - 8.0.0-beta

Selenium - 4.1.0

Followed below tutorials:

https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md

appium server-side error: xcodebuild failed with code 65

https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/10

https://discuss.appium.io/t/wda-gets-installed-and-deleted-on-iphone-while-creating-session-using-appium-desktop/32693/1

Error Logs:

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
xcodebuild error message:

2022-01-21 11:49:21.109 xcodebuild[96868:1671553] [MT] IDETestOperationsObserverDebug: (2B376EA3-D48B-44EE-8EE5-A14AAC6B3949) Failed to make test runner session:
Error Domain=com.apple.dt.xctest.error Code=9 "Unable to connect to test manager on dfb994683be4aa90965d0836323ad4e7c0d04514" UserInfo={NSLocalizedDescription=Unable to connect to test manager on dfb994683be4aa90965d0836323ad4e7c0d04514, NSUnderlyingError=0x6000029748a0 {Error Domain=XCTMobileDeviceFramework Code=34 "The service is invalid." UserInfo={NSLocalizedDescription=The service is invalid.}}}
2022-01-21 11:49:21.340 xcodebuild[96868:1671553] [MT] DTDKRemoteDeviceConnection: Failed to start Instruments daemon on device “dfb994683be4aa90965d0836323ad4e7c0d04514”: Error Domain=com.apple.dtdevicekit Code=811 "Failed to start remote service on device." UserInfo={NSUnderlyingError=0x60000285cbd0 {Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402653150 "The service is invalid." UserInfo={MobileDeviceErrorCode=(0xE8000022), com.apple.dtdevicekit.stacktrace=(
0   DTDeviceKitBase                     0x00000001149e781a DTDKCreateNSErrorFromAMDErrorCode + 233
1   DTDeviceKitBase                     0x00000001149f9161 __63-[DTDKRemoteDeviceConnection startFirstServiceOf:unlockKeybag:]_block_invoke + 564
2   DTDeviceKitBase                     0x00000001149f8829 __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_3 + 22
3   DTDeviceKitBase                     0x00000001149e9df9 __DTDKExecuteInSession_block_invoke_2 + 35
4   DTDeviceKitBase                     0x00000001149e9209 __DTDKExecuteWithConnection_block_invoke_2 + 473
5   DTDeviceKitBase                     0x00000001149e9007 __DTDKExecuteWithConnection_block_invoke + 106
6   libdispatch.dylib                   0x00007ff806108cc9 _dispatch_client_callout + 8
7   libdispatch.dylib                   0x00007ff8061164a1 _dispatch_sync_invoke_and_complete_recurse + 65
8   libdispatch.dylib                   0x00007ff806115ffd _dispatch_sync_f_slow + 194
9   DVTFoundation                       0x0000000110bdd368 DVTDispatchBarrierSync + 208
10  DVTFoundation                       0x0000000110bb3cc3 -[DVTDispatchLock performLockedBlock:] + 64
11  DTDeviceKitBase                     0x00000001149e8f08 DTDKExecuteWithConnection + 226
12  DTDeviceKitBase                     0x00000001149e9c63 DTDKExecuteInSession + 376
13  DTDeviceKitBase                     0x00000001149f866a __48-[DTDKRemoteDeviceConnection futureWithSession:]_block_invoke_2 + 131
14  DVTFoundation                       0x0000000110bda7f4 DVT_CALLING_CLIENT_BLOCK + 7
15  DVTFoundation                       0x0000000110bdc436 __DVTDispatchAsync_block_invoke + 1194
16  libdispatch.dylib                   0x00007ff806107ad8 _dispatch_call_block_and_release + 12
17  libdispatch.dylib                   0x00007ff806108cc9 _dispatch_client_callout + 8
18  libdispatch.dylib                   0x00007ff80610ecee _dispatch_lane_serial_drain + 696
19  libdispatch.dylib                   0x00007ff80610f7fb _dispatch_lane_invoke + 417
20  libdispatch.dylib                   0x00007ff8061197e1 _dispatch_workloop_worker_thread + 758
21  libsystem_pthread.dylib             0x00007ff8062bc074 _pthread_wqthread + 326
22  libsystem_pthread.dylib             0x00007ff8062baffb start_wqthread + 15
), DVTRadarComponentKey=261622, NSLocalizedDescription=The service is invalid.}}, NSLocalizedRecoverySuggestion=Please check your connection to your device., DVTRadarComponentKey=261622, NSLocalizedDescription=Failed to start remote service on device.}
*** If you believe this error represents a bug, please attach the result bundle at /Users/rishi/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Logs/Test/Test-WebDriverAgentRunner-2022.01.21_11-49-21-+0530.xcresult
2022-01-21 11:49:21.342 xcodebuild[96868:1671553] [MT] IDETestOperationsObserverDebug: 0.294 elapsed -- Testing started completed.
2022-01-21 11:49:21.342 xcodebuild[96868:1671553] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2022-01-21 11:49:21.342 xcodebuild[96868:1671553] [MT] IDETestOperationsObserverDebug: 0.294 sec, +0.294 sec -- end
Test session results, code coverage, and logs:
/Users/rishi/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Logs/Test/Test-WebDriverAgentRunner-2022.01.21_11-49-21-+0530.xcresult
Testing failed:
WebDriverAgentRunner:
WebDriverAgentRunner-Runner.app encountered an error (Failed to establish communication with the test runner. (Underlying error: Unable to connect to test manager on dfb994683be4aa90965d0836323ad4e7c0d04514. (Underlying error: The service is invalid.)))
** TEST EXECUTE FAILED **
Testing started on 'Rishi Khanna’s iPad'. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Build info: version: '4.1.0', revision: '87802e897b'
System info: host: '192.168.1.3', ip: 'fe80:0:0:0:10e1:8403:814d:ca22%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_221'
Driver info: io.appium.java_client.ios.IOSDriver
Command: [null, newSession {capabilities=[{appium:autoAcceptAlerts=true, appium:bundleId=com.salido.ios.v2.staging.PointOfSale, appium:deviceName=iPad Pro (12.9-inch, 2nd generation) (Model A1670), appium:newCommandTimeout=500, appium:noReset=true, platformName=iOS, appium:platformVersion=15.0, appium:toggleSoftwareKeyboard=true, appium:udid=dfb994683be4aa90965d0836323ad4e7c0d04514, appium:useNewWDA=true, appium:usePrebuiltWDA=true, appium:wdaLocalPort=37001, appium:xcodeOrgId=7365A2X7SU, appium:xcodeSigningId=iPhone Developer}], desiredCapabilities=Capabilities {autoAcceptAlerts: true, bundleId: com.xxx, deviceName: iPad Pro (12.9-inch, 2nd ge..., newCommandTimeout: 500, noReset: true, platformName: iOS, platformVersion: 15.0, toggleSoftwareKeyboard: true, udid: xxx..., useNewWDA: true, usePrebuiltWDA: true, wdaLocalPort: 37001, xcodeOrgId:, xcodeSigningId: iPhone Developer}}]
Capabilities {}

答: Updating to xcode 13.2.1 resolved the issue.</p>


问:
design and analysis data with SQL or Python
After learning the basic concepts of SQL server I wonder what is the difference between (SQL server) and (libraries like Pandas, Numpy, Matplotlib, and seaborn in python) for analyzing data?
also could someone help me, what learning path should be taken first for becoming a big data architecture? (by considering the fact that my degree is not computer science)</p>

答:
The python Libraries are used for analysis of data using a python program. It is used for the analysis of data using python which is generally in the form of .CSV file.

Whereas SQL is used for database.

Inshort: when working on a database, we will use SQL. When working on a dataset which would generally in the format of .CSV file, we will use python Libraries.

You can start with a small project such as house price prediction in order to learn these concepts.