问:
Postgres - error after execution many times the same query
I have a table fepu00 and trigger on it.
The part of code causing tha problem looks like follows:

```<code>        if (old_record.potime = NEW.putime --new AP (read in statement above)
            or old_record.pupisb::NUMERIC != NEW.pupisb::NUMERIC) then
        insert into dl356_table
        values (old_record.poid, old_record.poidma, old_record.ponmaf,
                old_record.adstr, old_record.adpsc, old_record.adcit, old_record.adidze,
                NEW.pupisb::numeric,
                case when old_record.potime = NEW.putime then '1' else '2' end,
                NEW.putime);
    end if;
</code>```

The query I'm executing is really simple:

```<code>update fepu00 set pudas = ? where puid = ?
</code>```

It works, but only for some quantity of times. Then it throws:

```<code>ERROR: type of parameter 25 (numeric) does not match that when preparing the plan (text)
Where: PL/pgSQL function dl356_trigger() line 75 at IF
</code>```

Number of updated records varies from a few to a few hundreds.
When I run the same query (with the same parameters) again, it works properly until the next fail.

Thanks for any suggestions.

Body:
I have a table fepu00 and trigger on it.
The part of code causing tha problem looks like follows:

        if (old_record.potime = NEW.putime --new AP (read in statement above)
            or old_record.pupisb::NUMERIC != NEW.pupisb::NUMERIC) then
        insert into dl356_table
        values (old_record.poid, old_record.poidma, old_record.ponmaf,
                old_record.adstr, old_record.adpsc, old_record.adcit, old_record.adidze,
                NEW.pupisb::numeric,
                case when old_record.potime = NEW.putime then '1' else '2' end,
                NEW.putime);
    end if;

The query I'm executing is really simple:

update fepu00 set pudas = ? where puid = ?

It works, but only for some quantity of times. Then it throws:

ERROR: type of parameter 25 (numeric) does not match that when preparing the plan (text)
Where: PL/pgSQL function dl356_trigger() line 75 at IF

Number of updated records varies from a few to a few hundreds.
When I run the same query (with the same parameters) again, it works properly until the next fail.

Thanks for any suggestions.


来源: stackexchange

问:
2 docker container join existing private network
I want to connect my docker container (webserver etc) to my existing private network (lets say 192.168.001.0/24.

I red the docomentation with maclan, vlan, overlay etc. but I'm a little bit los.
I know I can share same ports von different container at host IP like ports: 8080:80 , 8081:80 etc.
But I want to give my container a real IP in my private subnet.

This is waht I do:

```<code>version: '3.2'
networks:
  default:
    external:
      name: ext-priv-lan
      ipam:
      config:
      - subnet: "192.168.100.0/24"
        gateway: "192.168.100.99"

**web1-prod:**
        image: .....
        ports:
            - 80/tcp
            - 443/tcp
        networks:
            ext-priv-lan:
            ipv4_address: 192.168.100.77
        volumes:
          .......
  **web2-prod:**
        image: .....
        ports:
            - 80/tcp
            - 443/tcp
        networks:
            ext-priv-lan:
            ipv4_address: 192.168.100.88
        volumes:
          .......
</code>```

The stack is starting in Portainer. Each container "see" other container. But outside do not see docker container, nor docker container can ping outside.

Any example for that?
My gool is to have "real" private subnet IP and each webserver user ports 80 and 443.

ContentLicense: CC BY-SA 4.0

Body:
I want to connect my docker container (webserver etc) to my existing private network (lets say 192.168.001.0/24.

I red the docomentation with maclan, vlan, overlay etc. but I'm a little bit los.
I know I can share same ports von different container at host IP like ports: 8080:80 , 8081:80 etc.
But I want to give my container a real IP in my private subnet.

This is waht I do:

version: '3.2'
networks:
  default:
    external:
      name: ext-priv-lan
      ipam:
      config:
      - subnet: "192.168.100.0/24"
        gateway: "192.168.100.99"

**web1-prod:**
        image: .....
        ports:
            - 80/tcp
            - 443/tcp
        networks:
            ext-priv-lan:
            ipv4_address: 192.168.100.77
        volumes:
          .......
  **web2-prod:**
        image: .....
        ports:
            - 80/tcp
            - 443/tcp
        networks:
            ext-priv-lan:
            ipv4_address: 192.168.100.88
        volumes:
          .......

The stack is starting in Portainer. Each container "see" other container. But outside do not see docker container, nor docker container can ping outside.

Any example for that?
My gool is to have "real" private subnet IP and each webserver user ports 80 and 443.


问:
Spring boot hibernate change engine from MyISAM to InnoDB
I'm trying to create a ER Diagram from mysqldump file by reverse engineer,
everything works but relationship connections wont show in Workbench.

Note on Workbench:
Foreign keys can only be defined for certain storage engines (like InnoDB).

```<code>mysql> SELECT TABLE_NAME,
    ->        ENGINE
    -> FROM   information_schema.TABLES
    -> WHERE  TABLE_SCHEMA = 'db_example';

+--------------------+--------+
| TABLE_NAME         | ENGINE |
+--------------------+--------+
| difficulty         | MyISAM |
| durations          | MyISAM |
+--------------------+--------+
</code>```

what i've tried:

application.properties

```<code>hibernate.dialect.storage_engine=innodb
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
</code>```

So i'm trying to change the engine to InnoDB but keeps recreating the database as MyISAM

Body:
I'm trying to create a ER Diagram from mysqldump file by reverse engineer,
everything works but relationship connections wont show in Workbench.

Note on Workbench:
Foreign keys can only be defined for certain storage engines (like InnoDB).

mysql> SELECT TABLE_NAME,
    ->        ENGINE
    -> FROM   information_schema.TABLES
    -> WHERE  TABLE_SCHEMA = 'db_example';

+--------------------+--------+
| TABLE_NAME         | ENGINE |
+--------------------+--------+
| difficulty         | MyISAM |
| durations          | MyISAM |
+--------------------+--------+

what i've tried:

application.properties

hibernate.dialect.storage_engine=innodb
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

So i'm trying to change the engine to InnoDB but keeps recreating the database as MyISAM


问:
WordPress 'Ultimate Member' Plugins, 404 page problem
I installed the plugin 'Ultimate Member'
in the e-mail settings of 'Ultimate Member' , when i click save it redirects me to 404 page
enter image description here</p>


问:
Change class weights and classification threshold to deal with unbalanced dataset
i'm working on my thesis and i used a Catboost classifier to perform a binary analysis on a very unbalanced dataset:

class0 = x number of samples

class1 = 10*x number of samples

In order to optimize the performance of the model i changed the weights of the classes, giving an higher weight to the minority class, and then i performed a grid search cross validation in which it is searched the set of hyperparameters that reduces the crossentropy loss associated to the catboost model.

At this point i also changed the classificaiton threshold by maximizing the G-mean metric (sqruare root of sensitivity multiplied by specificity).

In you opinion, if you are experts or informed about ensemble methods of type boosting, is it right to procede in this way to increase the performance of the model when the dataset is unbalanced? Maybe it would be enough just to change the weights and use the grid search instead of changing also the classification threshold?

Thank you in advance!


问:
Is there a way to update headers of Chime Messaging API of aws-sdk/clients/chimesdkmessaging in ReactJs?
I am using aws-sdk/clients/chimesdkmessaging to make requests to get/delete/send channel messages.

But the issue is that the temporary credentials are expired after 1 hour and I cannot use the services without renewing the credentials. I am able to renew them, but couldn't set them in the API Request header.

I tried to set the request header as :

```<code>request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN
</code>```

But it didn't work. Also, I couldn't find anything on adding a middleware to these API's.

Here's my code

```<code> const ChimeMessaging = require("aws-sdk/clients/chimesdkmessaging");

 const chimeMessaging = new ChimeMessaging();

 async function sendChannelMessage(
      channelArn,
      messageContent,
      persistence,
      type,
      member,
      options = null
 ) {
    const chimeBearerArn = createMemberArn(member.userId);

    const params = {
     ChimeBearer: chimeBearerArn,
     ChannelArn: channelArn,
     Content: messageContent,
     Persistence: persistence, // Allowed types are PERSISTENT and NON_PERSISTENT
     Type: type,
    };
   const request = (await chimeMessagingClient()).sendChannelMessage(params)

  request.on("complete", function (err, data) {
     request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN
  });
  const response = await request.promise();
  const sentMessage = {
     response: response,
     CreatedTimestamp: new Date(),
     Sender: { Arn: createMemberArn(member.userId), Name: member.username },
   };
 return sentMessage;
}
</code>```

Body:
I am using aws-sdk/clients/chimesdkmessaging to make requests to get/delete/send channel messages.

But the issue is that the temporary credentials are expired after 1 hour and I cannot use the services without renewing the credentials. I am able to renew them, but couldn't set them in the API Request header.

I tried to set the request header as :

request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN

But it didn't work. Also, I couldn't find anything on adding a middleware to these API's.

Here's my code

 const ChimeMessaging = require("aws-sdk/clients/chimesdkmessaging");

 const chimeMessaging = new ChimeMessaging();

 async function sendChannelMessage(
      channelArn,
      messageContent,
      persistence,
      type,
      member,
      options = null
 ) {
    const chimeBearerArn = createMemberArn(member.userId);

    const params = {
     ChimeBearer: chimeBearerArn,
     ChannelArn: channelArn,
     Content: messageContent,
     Persistence: persistence, // Allowed types are PERSISTENT and NON_PERSISTENT
     Type: type,
    };
   const request = (await chimeMessagingClient()).sendChannelMessage(params)

  request.on("complete", function (err, data) {
     request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN
  });
  const response = await request.promise();
  const sentMessage = {
     response: response,
     CreatedTimestamp: new Date(),
     Sender: { Arn: createMemberArn(member.userId), Name: member.username },
   };
 return sentMessage;
}


问:
my next "section" moves with my javascript animation
I am a junior developer and I am coding my portfolio. I have a problem which is the following:

I put an animation effect typing on a keyboard on a "p" with JS and it moves a lot of my elements.

I managed to fix some with: "position absolute" and some CSS adjustments but the second problem is that I put a JS library to put a dark mode and "position: absolute" makes that the dark mode does not take disregard color changes.

Here is the HTML5 code:

```<code><section class="landing-page">
        <p>Luck, <br> web developer <span id="monSpan">html</span> </p>  **<-- animation is here**

        <div>

            <img src="/img/undraw_developer_activity_re_39tg.svg" alt="">

        </div>
    </section>
    <section class="end-landing-page">
        <div>

            <button>En savoir plus <span class="material-symbols-outlined">
                arrow_downward
                </span> </button>  **<-----the moving div is here**
        </div>
</section>
</code>```

Here is the CSS3 code:

```<code>.landing-page {
  display: flex;
  font-family: 'Poppins', sans-serif;
  font-size: 3em;
  font-weight: bold;
}

.landing-page p {
  padding-left: 10%;
  padding-right: 50%;
  font-size: 4rem;

}

.landing-page img {
  height: 10em;
  padding-left: 20%;
  padding-right: 9%;
}

.landing-page div {
  position: absolute;
  padding-left: 40%;
}

#monSpan {
  transition: all 0.5s;
  background-color: rgb(129, 129, 255);
}

.end-landing-page div {

 padding-top: 10%;
 padding-left: 8%;

}

.end-landing-page button {
  display: flex;
  align-items: center;
  background-color: rgb(129, 129, 255);
  border-radius: 30px;
  padding: 10px;

}
</code>```

as said before I tried with the "position" property and it works but the dark mode library no longer works on these elements

I also tried with the "z-index" property but without result

I am French and use google translation, and there may be bad translations do not hesitate to ask me to rephrase.

Body:
I am a junior developer and I am coding my portfolio. I have a problem which is the following:

I put an animation effect typing on a keyboard on a "p" with JS and it moves a lot of my elements.

I managed to fix some with: "position absolute" and some CSS adjustments but the second problem is that I put a JS library to put a dark mode and "position: absolute" makes that the dark mode does not take disregard color changes.

Here is the HTML5 code:

Luck,
 web developer html
  **<-- animation is here**

            <button>En savoir plus
                arrow_downward
                 </button>  **<-----the moving div is here**

Here is the CSS3 code:

.landing-page {
  display: flex;
  font-family: 'Poppins', sans-serif;
  font-size: 3em;
  font-weight: bold;
}

.landing-page p {
  padding-left: 10%;
  padding-right: 50%;
  font-size: 4rem;

}

.landing-page img {
  height: 10em;
  padding-left: 20%;
  padding-right: 9%;
}

.landing-page div {
  position: absolute;
  padding-left: 40%;
}

#monSpan {
  transition: all 0.5s;
  background-color: rgb(129, 129, 255);
}

.end-landing-page div {

 padding-top: 10%;
 padding-left: 8%;

}

.end-landing-page button {
  display: flex;
  align-items: center;
  background-color: rgb(129, 129, 255);
  border-radius: 30px;
  padding: 10px;

}

as said before I tried with the "position" property and it works but the dark mode library no longer works on these elements

I also tried with the "z-index" property but without result

I am French and use google translation, and there may be bad translations do not hesitate to ask me to rephrase.


问:
Colorbar with missing color in matplotlib
I'm ploting a map and having a problem with matplotlib colorbar. The last but one color is missing, it must representate the number 200. And the 200 and the 250 are with the same color. What I have to do?

```<code>def maps(values, lonsi, latsi, title, title_archive, nws_precip_colors = [
                '#FFFFFF',
                "#e2f4fc",
                "#81d2fa",
                '#1777ba',
                '#032677',
                '#78be21',
                '#3ca611',
                "#008e00",
                "#2c460c",
                "#f2c31b",
                "#ff7700",
                "#de3400",
                "#aa0000",
                "#600000",
                "#cd7ef5", # the missing color
                "#9611d6",
            ],
            levels = [0,1,5,10,15,20,25,30,40,50,70,90,120,150,200,250], val=16):

    fpath = 'font/Montserrat-Regular.ttf'
    prop = fm.FontProperties(fname=fpath)

    fig, ax = plt.subplots(subplot_kw={'projection': ccrs.PlateCarree()})
    fig.set_size_inches(15, 10, forward=True)
    ax.set_extent([-75.5,-30,-31,6.5])

    grid=ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,linewidth=0.05, color='gray', alpha=0.5)

    precip_colormap = colors.ListedColormap(nws_precip_colors)
    norm = colors.BoundaryNorm(levels, val)

    data_crs = ccrs.PlateCarree()
    cs = ax.contourf(lonsi, latsi, values, transform=data_crs, levels=levels, cmap=precip_colormap, add_colorbar=False, extend='both', alpha=0.8, norm=norm)

    reader_p = shpr.Reader('Countries_Shape/ne_10m_admin_0_countries.shp')
    shape_country=ShapelyFeature(reader_p.geometries(),ccrs.PlateCarree(), linewidth=1 , facecolor=(1,1,1,0), edgecolor='grey')
    ax.add_feature(shape_country)

    plt.title(title, fontsize=20, pad=30, fontweight='bold', color='grey', fontproperties=prop)
    cbar=plt.colorbar(cs)
    cbar.set_ticks(levels)
    cbytick_obj = plt.getp(cbar.ax.axes, 'yticklabels')
    plt.setp(cbytick_obj, color='grey')

    fig.show()
    fig.savefig(f'{title_archive}.png',
                bbox_inches ="tight",
                pad_inches = 0.5,
                facecolor ="#ffffff",
                orientation ='landscape',
                dpi=100)
</code>```

the result:

result

I tried put val = 17, but it didn't worked. Don't know what to do!

Body:
I'm ploting a map and having a problem with matplotlib colorbar. The last but one color is missing, it must representate the number 200. And the 200 and the 250 are with the same color. What I have to do?

def maps(values, lonsi, latsi, title, title_archive, nws_precip_colors = [
                '#FFFFFF',
                "#e2f4fc",
                "#81d2fa",
                '#1777ba',
                '#032677',
                '#78be21',
                '#3ca611',
                "#008e00",
                "#2c460c",
                "#f2c31b",
                "#ff7700",
                "#de3400",
                "#aa0000",
                "#600000",
                "#cd7ef5", # the missing color
                "#9611d6",
            ],
            levels = [0,1,5,10,15,20,25,30,40,50,70,90,120,150,200,250], val=16):

    fpath = 'font/Montserrat-Regular.ttf'
    prop = fm.FontProperties(fname=fpath)

    fig, ax = plt.subplots(subplot_kw={'projection': ccrs.PlateCarree()})
    fig.set_size_inches(15, 10, forward=True)
    ax.set_extent([-75.5,-30,-31,6.5])

    grid=ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,linewidth=0.05, color='gray', alpha=0.5)

    precip_colormap = colors.ListedColormap(nws_precip_colors)
    norm = colors.BoundaryNorm(levels, val)

    data_crs = ccrs.PlateCarree()
    cs = ax.contourf(lonsi, latsi, values, transform=data_crs, levels=levels, cmap=precip_colormap, add_colorbar=False, extend='both', alpha=0.8, norm=norm)

    reader_p = shpr.Reader('Countries_Shape/ne_10m_admin_0_countries.shp')
    shape_country=ShapelyFeature(reader_p.geometries(),ccrs.PlateCarree(), linewidth=1 , facecolor=(1,1,1,0), edgecolor='grey')
    ax.add_feature(shape_country)

    plt.title(title, fontsize=20, pad=30, fontweight='bold', color='grey', fontproperties=prop)
    cbar=plt.colorbar(cs)
    cbar.set_ticks(levels)
    cbytick_obj = plt.getp(cbar.ax.axes, 'yticklabels')
    plt.setp(cbytick_obj, color='grey')

    fig.show()
    fig.savefig(f'{title_archive}.png',
                bbox_inches ="tight",
                pad_inches = 0.5,
                facecolor ="#ffffff",
                orientation ='landscape',
                dpi=100)

the result:

result

I tried put val = 17, but it didn't worked. Don't know what to do!


问:
Reducing Latency for GPT-J
I'm using GPT-J locally on a Nvidia RTX 3090 GPU. Currently, I'm using the model in the following way:

```<code>config = transformers.GPTJConfig.from_pretrained("EleutherAI/gpt-j-6B")
tokenizer = transformers.AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B", pad_token='<|endoftext|>', eos_token='<|endoftext|>', truncation_side='left')
model = GPTJForCausalLM.from_pretrained(
     "EleutherAI/gpt-j-6B",
      revision="float16",
      torch_dtype=torch.float16,
      low_cpu_mem_usage=True,
      use_cache=True,
      gradient_checkpointing=True,
 )
model.to('cuda')
prompt = self.tokenizer(text, return_tensors='pt', truncation=True, max_length=2048)
prompt = {key: value.to('cuda') for key, value in prompt.items()}
out = model.generate(**prompt,
     n=1,
     min_length=16,
     max_new_tokens=75,
     do_sample=True,
     top_k=35,
     top_p=0.9,
     batch_size=512,
     temperature=0.75,
     no_repeat_ngram_size=4,
     clean_up_tokenization_spaces=True,
     use_cache=True,
     pad_token_id=tokenizer.eos_token_id
 )
res = tokenizer.decode(out[0])
</code>```

As input to the model I'm using 2048 tokens and I produce 75 tokens as output. The latency is around 4-5 seconds. In the following blog post, I've read that using pipelines latency can be improved and that tokenization can be a bottleneck.

Can the tokenization be improved for my code and would using a pipeline reduce the latency? Are there any other things I can do to reduce the latency?

Title: Reducing Latency for GPT-J

Body:
I'm using GPT-J locally on a Nvidia RTX 3090 GPU. Currently, I'm using the model in the following way:

config = transformers.GPTJConfig.from_pretrained("EleutherAI/gpt-j-6B")
tokenizer = transformers.AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B", pad_token='<|endoftext|>', eos_token='<|endoftext|>', truncation_side='left')
model = GPTJForCausalLM.from_pretrained(
     "EleutherAI/gpt-j-6B",
      revision="float16",
      torch_dtype=torch.float16,
      low_cpu_mem_usage=True,
      use_cache=True,
      gradient_checkpointing=True,
 )
model.to('cuda')
prompt = self.tokenizer(text, return_tensors='pt', truncation=True, max_length=2048)
prompt = {key: value.to('cuda') for key, value in prompt.items()}
out = model.generate(**prompt,
     n=1,
     min_length=16,
     max_new_tokens=75,
     do_sample=True,
     top_k=35,
     top_p=0.9,
     batch_size=512,
     temperature=0.75,
     no_repeat_ngram_size=4,
     clean_up_tokenization_spaces=True,
     use_cache=True,
     pad_token_id=tokenizer.eos_token_id
 )
res = tokenizer.decode(out[0])

As input to the model I'm using 2048 tokens and I produce 75 tokens as output. The latency is around 4-5 seconds. In the following blog post, I've read that using pipelines latency can be improved and that tokenization can be a bottleneck.

Can the tokenization be improved for my code and would using a pipeline reduce the latency? Are there any other things I can do to reduce the latency?


问:
Control trip load in multi trip VRP in or tools
I have implemented multitrip VRP in ortools. Maximum number of trips per vehicle is limited to 2. I want to put a hard constraint that load carried in 2nd trip is always greater than 1st trip of the vehicle. How can I implement this?</p>


问:
Get previous value of observable during componentDidUpdate
I have this part of code:

```<code>export type TSomeProps = {
  entities: List<Distinct<IEntity>>
}

@observer
class SomeClass extens React.Component<TSomeProps> {
  @observable activeEntity = this.props.entities[0]
  @action componentDidUpdate(prevProps: Readonly<TSomeProps>, prevState?: Readonly<{}>) {
    this.activeEntity = // Calculated from this.activeEntity value before update
  }

}
</code>```

Component is updated because its parent component updates - is there any way I can get previous value of activeEntity observable?

Body:
I have this part of code:

export type TSomeProps = {
  entities: List<Distinct<IEntity>>
}

@observer
class SomeClass extens React.Component<TSomeProps> {
  @observable activeEntity = this.props.entities[0]
  @action componentDidUpdate(prevProps: Readonly<TSomeProps>, prevState?: Readonly<{}>) {
    this.activeEntity = // Calculated from this.activeEntity value before update
  }

}

Component is updated because its parent component updates - is there any way I can get previous value of activeEntity observable?


问:
PyQt5 GUI calling a function in a module that prints status to console. Want to pipe the status messages to PyQt5 GUI text box, how?
I have a simple PyQt5 GUI that takes input from the user.  This input is then passed as an argument to a function in another imported Python module.  This function prints status messages to the console when it is running.  I'd like to capture or pipe these console messages to the calling GUI's text box but I am not sure how to do this.  Can someone point me to some examples on how to do this?

Thanks,
mn3


问:
excel select all occurrences of highlighted text
In VScode we have the handy shortcut "ctrl+shift+l" which will select all occurrences of the current highlighted text. I'm currently working on some larger excel formulas and i was wondering if there is a way to do this in the excel formula bar too?</p>


问:
Logic for image save in database and want to accessed with c#
I am building a FYP project in which we are providing six services of daily task. I want to display a image which is save in database.
By view worker profile customer will go to the specific worker's profile and specific worker's image will be displayed. How can I do it with c#.

For six services I don't want to make six different pages and six different paths. I want that six images will be displayed by database.


问:
uri to bitmap conversion fails
I need to convert the uri to bitmap to set it as icon inside my notification.
To be sure to have a valid URI I use getdownloadurl, it works, If I print the uri it gives me the right link that works, anyway the try/catch always go inside the catch, can't really get why the try fails, I tried others conversion function and all fails, where I'm failing?

```<code>    storageReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
    @Override
    public void onSuccess(Uri uri) {
    try {
       if(Build.VERSION.SDK_INT < 28) {
          bitmap = MediaStore.Images.Media.getBitmap(getContext().getContentResolver(), uri);
       } else {
          ImageDecoder.Source source = ImageDecoder.createSource(getContext().getContentResolver(), uri);
          bitmap = ImageDecoder.decodeBitmap(source);
       }
    } catch (Exception e) {

    }
</code>```

Error:

```<code>2022-12-04 00:00:02.361 26634-26634/com.example.rememberme E/error: No content provider: https://firebasestorage.googlea... (the entire uri)
</code>```

Title: uri to bitmap conversion fails

Body:
I need to convert the uri to bitmap to set it as icon inside my notification.
To be sure to have a valid URI I use getdownloadurl, it works, If I print the uri it gives me the right link that works, anyway the try/catch always go inside the catch, can't really get why the try fails, I tried others conversion function and all fails, where I'm failing?

    storageReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
    @Override
    public void onSuccess(Uri uri) {
    try {
       if(Build.VERSION.SDK_INT < 28) {
          bitmap = MediaStore.Images.Media.getBitmap(getContext().getContentResolver(), uri);
       } else {
          ImageDecoder.Source source = ImageDecoder.createSource(getContext().getContentResolver(), uri);
          bitmap = ImageDecoder.decodeBitmap(source);
       }
    } catch (Exception e) {

    }

Error:

2022-12-04 00:00:02.361 26634-26634/com.example.rememberme E/error: No content provider: https://firebasestorage.googlea... (the entire uri)


问:
What are the benefits of creating subnets in GCP
As we know the vpc firewall in GCP is a distributed firewall which means it is enforced at host/ vm level so I wanted to understand the benefits or use of creating multiple subnets in GCP.</p>


问:
Unread channels with multi tenant
I develop an mobile app with multi tenant. Like slack, the user can switch on multiple workspaces.

Is there a way to get unread channels and/or unread messages filtered by team id ? In order to get unread channels for each team ?

Title: Unread channels with multi tenant


问:
VisualStudio 2022 (devenv.exe) arguments to merge file in p4v
I had this setup in p4v and it would work

Ever since December 2022 it's not working anymore.
I checked the docs and there is no mention of the /merge anymore

https://learn.microsoft.com/en-us/visualstudio/ide/reference/devenv-command-line-switches?view=vs-2022

Is there a new way to set up p4v to use visual studio 2022 to merge?


问:
Intermittent Latency Spikes on Lambda with Async Network Calls
I've got two functions within a Node.js Lambda that execute about 50 times per second. The Lambda is using provisioned concurrency and is not spilling over.

```<code>main() {
    console.time("total");
    const [result1, result2] = await Promise.all([async1(), async2()]);
    console.timeEnd("total");
}
</code>```
```<code>async1(): Promise<any> {
    console.time("async1-time");
    const result = await axios.get();
    // do something with the result
    console.timeEnd("async1-time");
}
</code>```
```<code>async2(): Promise<any> {
    console.time("async2-time");
    const result = await axios.get();
    // do something with the result
    console.timeEnd("async2-time");
}
</code>```

What's being observed is that the total time spikes on occasion, which is not too unexpected as services have varying ranges of SLA latency.

However, what is weird is that when async1-time spikes, it almost always shows a spike in async2-time. These calls are completely disjoint, and talk to different services.

Is there any reason why two completely separate async calls talking to two completely separate services would take longer at particular time intervals?

Example of measurements:

total (or Lambda Duration - equal)

```<code>40, 40, 40, 40, 80, 40
</code>```

async1-time (call to ServiceA)

```<code>20, 20, 20, 20, 45, 20
</code>```

async2-time (call to ServiceB)

```<code>20, 20, 20, 20, 35, 20
</code>```

Body:
I've got two functions within a Node.js Lambda that execute about 50 times per second. The Lambda is using provisioned concurrency and is not spilling over.

main() {
    console.time("total");
    const [result1, result2] = await Promise.all([async1(), async2()]);
    console.timeEnd("total");
}

async1(): Promise<any> {
    console.time("async1-time");
    const result = await axios.get();
    // do something with the result
    console.timeEnd("async1-time");
}

async2(): Promise<any> {
    console.time("async2-time");
    const result = await axios.get();
    // do something with the result
    console.timeEnd("async2-time");
}

What's being observed is that the total time spikes on occasion, which is not too unexpected as services have varying ranges of SLA latency.

However, what is weird is that when async1-time spikes, it almost always shows a spike in async2-time. These calls are completely disjoint, and talk to different services.

Is there any reason why two completely separate async calls talking to two completely separate services would take longer at particular time intervals?

Example of measurements:

total (or Lambda Duration - equal)

40, 40, 40, 40, 80, 40

async1-time (call to ServiceA)

20, 20, 20, 20, 45, 20

async2-time (call to ServiceB)

20, 20, 20, 20, 35, 20


问:
OLE object () to ImageIcon using ucanacess
(I am new to java)
I'm trying to extract an OLE object (Picture) 3ºfield of a table "Pessoa"  in a MSAcess Database, and put it into an Icon of a JLabel.
But in the line:

ImageIcon ico = new ImageIcon( imagem ) ;
it returns a NullPointerException... And i dont know why...
I've already been reading some articles in here...
Could you help me, please?
Thank's in advance.

```<code>public ArrayList<Pessoa> queryPessoa(){
     try {
         res=sql.executeQuery(qry_pessoa);
         posicao=0;
         while( res.next() ){
             PessoaS.add( new Pessoa( res.getString(1), res.getDate(2).toLocalDate() , res.getBytes(3),res.getString(4),
                                                                                res.getString(5), res.getDouble(6)));
             System.out.printf("\n %s \t %s \t %f \t %s:", PessoaS.get(posicao).getNome() , PessoaS.get(posicao).getApelido(),
                                          PessoaS.get(posicao).getNumero() , PessoaS.get(posicao).getDataNasc().toString() );
             JPanel p = new JPanel();
             p.setBounds(10,10,800,800);
             p.setLayout(null);
             InputStream entrada = new ByteArrayInputStream( PessoaS.get(posicao).getFoto() );    //byte[] getFoto();
             BufferedImage imagem = ImageIO.read( entrada );
             ImageIcon ico = new ImageIcon( imagem ) ;
             JLabel r = new JLabel( ico );
             r.setBounds(20,20,100,100);
             p.add( r );
             p.repaint();
             p.setVisible(true);
             posicao++;
         }
     }
     catch (SQLException sqle){
         sqle.printStackTrace();
     }
     catch (Exception e){
         e.printStackTrace();
     }
     finally{ return PessoaS ;}
 } ```

In alternative, i tried a more direct approach:
i suppressed the Bufferedimage and the inputStream..now, it doesn't crash, but also doesn't create the Panels whith the Icon labels.

I just want to make a sample example to extract an image...

 public ArrayList<Pessoa> queryPessoa(){
     try {
         res = sql.executeQuery(qry_pessoa);
         posicao = 0;
         while( res.next() ){
             PessoaS.add( new Pessoa( res.getString(1), res.getDate(2).toLocalDate() , res.getBytes(3),res.getString(4),
                                                                                res.getString(5), res.getDouble(6)));
             System.out.printf("\n %s \t %s \t %f \t %s:", PessoaS.get(posicao).getNome() , PessoaS.get(posicao).getApelido(),
                                          PessoaS.get(posicao).getNumero() , PessoaS.get(posicao).getDataNasc().toString() );
             JPanel p = new JPanel();
             p.setBounds(10,10,800,800);
             p.setLayout(null);
             JLabel r = new JLabel( new ImageIcon( PessoaS.get(posicao).getFoto() ) );
             r.setBounds(20,20,100,100);
             p.add( r );
             p.repaint();
             p.setVisible(true);
             posicao++;
         }
     }
     catch ( SQLException sqle){
         sqle.printStackTrace();
     }
     catch ( Exception e){
         e.printStackTrace();
     }
     finally{ return PessoaS ;}
 }

```

Body:
(I am new to java)
I'm trying to extract an OLE object (Picture) 3ºfield of a table "Pessoa"  in a MSAcess Database, and put it into an Icon of a JLabel.
But in the line:

ImageIcon ico = new ImageIcon( imagem ) ;
it returns a NullPointerException... And i dont know why...
I've already been reading some articles in here...
Could you help me, please?
Thank's in advance.

public ArrayList<Pessoa> queryPessoa(){
     try {
         res=sql.executeQuery(qry_pessoa);
         posicao=0;
         while( res.next() ){
             PessoaS.add( new Pessoa( res.getString(1), res.getDate(2).toLocalDate() , res.getBytes(3),res.getString(4),
                                                                                res.getString(5), res.getDouble(6)));
             System.out.printf("\n %s \t %s \t %f \t %s:", PessoaS.get(posicao).getNome() , PessoaS.get(posicao).getApelido(),
                                          PessoaS.get(posicao).getNumero() , PessoaS.get(posicao).getDataNasc().toString() );
             JPanel p = new JPanel();
             p.setBounds(10,10,800,800);
             p.setLayout(null);
             InputStream entrada = new ByteArrayInputStream( PessoaS.get(posicao).getFoto() );    //byte[] getFoto();
             BufferedImage imagem = ImageIO.read( entrada );
             ImageIcon ico = new ImageIcon( imagem ) ;
             JLabel r = new JLabel( ico );
             r.setBounds(20,20,100,100);
             p.add( r );
             p.repaint();
             p.setVisible(true);
             posicao++;
         }
     }
     catch (SQLException sqle){
         sqle.printStackTrace();
     }
     catch (Exception e){
         e.printStackTrace();
     }
     finally{ return PessoaS ;}
 } ```

In alternative, i tried a more direct approach:
i suppressed the Bufferedimage and the inputStream..now, it doesn't crash, but also doesn't create the Panels whith the Icon labels.

I just want to make a sample example to extract an image...

 public ArrayList<Pessoa> queryPessoa(){
     try {
         res = sql.executeQuery(qry_pessoa);
         posicao = 0;
         while( res.next() ){
             PessoaS.add( new Pessoa( res.getString(1), res.getDate(2).toLocalDate() , res.getBytes(3),res.getString(4),
                                                                                res.getString(5), res.getDouble(6)));
             System.out.printf("\n %s \t %s \t %f \t %s:", PessoaS.get(posicao).getNome() , PessoaS.get(posicao).getApelido(),
                                          PessoaS.get(posicao).getNumero() , PessoaS.get(posicao).getDataNasc().toString() );
             JPanel p = new JPanel();
             p.setBounds(10,10,800,800);
             p.setLayout(null);
             JLabel r = new JLabel( new ImageIcon( PessoaS.get(posicao).getFoto() ) );
             r.setBounds(20,20,100,100);
             p.add( r );
             p.repaint();
             p.setVisible(true);
             posicao++;
         }
     }
     catch ( SQLException sqle){
         sqle.printStackTrace();
     }
     catch ( Exception e){
         e.printStackTrace();
     }
     finally{ return PessoaS ;}
 }


问:
PostgreSQL 9.6 vacuum using 100% CPU
I am running PostgreSQL 9.6 on Centos 7.
The database was migrated from a PostgreSQL 9.4 server that did not have the issue.

With autovacuum on Postgres is using 100% of one core constantly (10% of total CPU). With autovacuum off it does not use any CPU other than when executing queries.

If this expected or normal, or something bad going on? Note it is a very big database, with many schemas/tables.

I tried,

```<code>vacuumdb --all -w
</code>```

and,

```<code>ANALYZE VERBOSE;
</code>```

The "ANALYZE VERBOSE;" made the database run a lot faster, but did not change the CPU usage.

Title: PostgreSQL 9.6 vacuum using 100% CPU

Body:
I am running PostgreSQL 9.6 on Centos 7.
The database was migrated from a PostgreSQL 9.4 server that did not have the issue.

With autovacuum on Postgres is using 100% of one core constantly (10% of total CPU). With autovacuum off it does not use any CPU other than when executing queries.

If this expected or normal, or something bad going on? Note it is a very big database, with many schemas/tables.

I tried,

vacuumdb --all -w

and,

ANALYZE VERBOSE;

The "ANALYZE VERBOSE;" made the database run a lot faster, but did not change the CPU usage.


问:
How exactly does recursion interact with variable scopes?
While solving a leetcode problem (https://leetcode.com/problems/maximum-difference-between-node-and-ancestor), I stumbled upon a strange (and, to me, unexpected) behavior.

A working solution is as follows:

```<code>class Solution:
  def maxAncestorDiff(self, root: Optional[TreeNode]) -> int:
    ancestors = []
    max_diff = [0]

    def dfs(node):
        for v in ancestors:
            if abs(v-node.val) > max_diff[0]:
                max_diff[0] = abs(v-node.val)

        ancestors.append(node.val)

        if node.left:
            dfs(node.left)
        if node.right:
            dfs(node.right)

        ancestors.pop()

    dfs(root)
    return max_diff[0]
</code>```

However, simply modifying the code as follows (making max_diff an int instead of a list):

```<code>class Solution:
  def maxAncestorDiff(self, root: Optional[TreeNode]) -> int:
    ancestors = []
    max_diff = 0 # Instead of [0]

    def dfs(node):
        for v in ancestors:
            if abs(v-node.val) > max_diff:
                max_diff = abs(v-node.val)

        ancestors.append(node.val)

        if node.left:
            dfs(node.left)
        if node.right:
            dfs(node.right)

        ancestors.pop()

    dfs(root)
    return max_diff
</code>```

makes the code execution fail with error:

UnboundLocalError: local variable 'max_diff' referenced before assignment
if abs(v-node.val) > max_diff:

My understanding is that max_diff should resolve correctly by looking up 'max_diff' in the outer variable scope (the one of maxAncestorDiff), the same way it does for 'ancestors' and when "max_diff" is a list.

Of course a simple solution to make 'max_diff' an int would be to pass it as an argument to dfs, but I would like to understand why my naive solution does not work. I imagine it's related to the fact that lists are mutable while int are not, but why exactly that makes a difference for scope resolution remains a mystery.

Body:
While solving a leetcode problem (https://leetcode.com/problems/maximum-difference-between-node-and-ancestor), I stumbled upon a strange (and, to me, unexpected) behavior.

A working solution is as follows:

class Solution:
  def maxAncestorDiff(self, root: Optional[TreeNode]) -> int:
    ancestors = []
    max_diff = [0]

    def dfs(node):
        for v in ancestors:
            if abs(v-node.val) > max_diff[0]:
                max_diff[0] = abs(v-node.val)

        ancestors.append(node.val)

        if node.left:
            dfs(node.left)
        if node.right:
            dfs(node.right)

        ancestors.pop()

    dfs(root)
    return max_diff[0]

However, simply modifying the code as follows (making max_diff an int instead of a list):

class Solution:
  def maxAncestorDiff(self, root: Optional[TreeNode]) -> int:
    ancestors = []
    max_diff = 0 # Instead of [0]

    def dfs(node):
        for v in ancestors:
            if abs(v-node.val) > max_diff:
                max_diff = abs(v-node.val)

        ancestors.append(node.val)

        if node.left:
            dfs(node.left)
        if node.right:
            dfs(node.right)

        ancestors.pop()

    dfs(root)
    return max_diff

makes the code execution fail with error:

UnboundLocalError: local variable 'max_diff' referenced before assignment
if abs(v-node.val) > max_diff:

My understanding is that max_diff should resolve correctly by looking up 'max_diff' in the outer variable scope (the one of maxAncestorDiff), the same way it does for 'ancestors' and when "max_diff" is a list.

Of course a simple solution to make 'max_diff' an int would be to pass it as an argument to dfs, but I would like to understand why my naive solution does not work. I imagine it's related to the fact that lists are mutable while int are not, but why exactly that makes a difference for scope resolution remains a mystery.


问:
Classifying M multivariate time-series based on known K classes in R
I have a M multivariate time series data, by multivariate I mean that a time series is represented by more than one variable that varies in time (see example image for simulated data). All have the same size. I want to build a classifier trained on K class (eg. all time series data belongs to A, B or C class).

Is there a straightforward implementation of this in R, specifically, as the regular classification approaches (e.g random forest, SVM) will ignore the dependent data and give different predictions within the same time series. I have an intuition how this could be solved, e.g. using some ensemble classification, or concatenating time series into a univariate vector, but I have a feeling there is a better approach for this that doesn't require me to reinvent the wheel. I also know that KNN and DTW approach could in theory work, but not sure how they get around these issues above (e.g. the multivariate problem)

Appreciate any pointers and references


问:
Problem importing a library I created for Angular from NPM
I am trying to make a generic component that uses primeng inside, I would like to publish it on npm to make it available, I tried but once I import it with "npm install" it gives me error:

```<code>Cannot read property 'ecmp' of undefined in angular
</code>```

Instead if I try to import via .tar file or dist folder it works, the project can be viewed here: https://github.com/hetsrl/my-prime-table

Thanks for the help

Body:
I am trying to make a generic component that uses primeng inside, I would like to publish it on npm to make it available, I tried but once I import it with "npm install" it gives me error:

Cannot read property 'ecmp' of undefined in angular

Instead if I try to import via .tar file or dist folder it works, the project can be viewed here: https://github.com/hetsrl/my-prime-table

Thanks for the help


问:
i wrote a code that stores username and password now i want a code to log in my user that his data stored in a text file how is that possible

import re
from getpass import getpass

#Using Regex for more security for user
username_regex = re.compile(r'^[A-Za-z0-9]{4,10}$')
password_regex = re.compile(r"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$")

#check if password is valid with regex
def validate_password(password: str) -> bool:
    if re.fullmatch(password_regex, password):
        return True
    else:
        return False

#store the password to the text file
def store_username_password() -> bool:
    """function to store the username and password"""
    username = input("Enter the username: ")
    password = input("Enter the password: ")

    if not username_regex.search(username):
        print("Invalid username")
        return False

    if not validate_password(password):
        print("Invalid password")
        return False

    with open('username_password.txt', 'w') as f:
        f.write(f'Username: {username}\n')
        f.write(f'Password: {password}\n')

    print("Succesfully registered! ")
    return True

# test the function
print(store_username_password())
```

i dont know how to im a beginner oops im trying to do login page i cant understand how to load data .

Body:
import re
from getpass import getpass

#Using Regex for more security for user
username_regex = re.compile(r'^[A-Za-z0-9]{4,10}$')
password_regex = re.compile(r"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$")

#check if password is valid with regex
def validate_password(password: str) -> bool:
    if re.fullmatch(password_regex, password):
        return True
    else:
        return False

#store the password to the text file
def store_username_password() -> bool:
    """function to store the username and password"""
    username = input("Enter the username: ")
    password = input("Enter the password: ")

    if not username_regex.search(username):
        print("Invalid username")
        return False

    if not validate_password(password):
        print("Invalid password")
        return False

    with open('username_password.txt', 'w') as f:
        f.write(f'Username: {username}\n')
        f.write(f'Password: {password}\n')

    print("Succesfully registered! ")
    return True

# test the function
print(store_username_password())

i dont know how to im a beginner oops im trying to do login page i cant understand how to load data .


问:
SQL/Oracle issue, I receive this error " REPORTS.WEK_MTD_BILL_SUM_HIST_T.BILL_CYCLE: invalid identifier at line 48" , is there anyway to fix this?
enter image description here

above is the image of the code, my objective is to have 4 columns demonstrating the prices for a bill cycle, and 4 columns demonstrating the average of all bill cycles one year before the initial bill cycle.

the first inner select works by itself and adds the 4 columns to the right in the picture below, the problem starts when I want to add second inner select the 4 columns for yearly average. initially I didn't have the "select * from", but I couldn't find a better way
the base of the problem is that I can't implement 2 Where clauses on the same column.

below is the snap shot of what I get from running only the first inner select.
enter image description here

I have tried union , join, cross join ... but none seem to work, one person suggested "window function" but I haven't worked with that yet.

this is the error below:
enter image description here

RAW CODE TEXT IS BELOW:

VARIABLE START_DATE CHAR
EXEC :START_DATE :=''
VARIABLE END_DATE CHAR
EXEC :END_DATE=''

select * from
(SELECT

"REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BILL_CYCLE",
"REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT" AS NET_TOTAL,
SUM(
SUM(
CASE WHEN "REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BLI_TYPE" = 'Charges'
THEN "WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT" END))  OVER() AS TOTAL_CHARGES,
SUM(
SUM(
CASE WHEN "REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BLI_TYPE" = 'Credits'
THEN "WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT" END))  OVER() AS TOTAL_CREDIT,
SUM(
SUM(
CASE WHEN "REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BLI_TYPE" = 'Previous Weekly Billing Net Total'
THEN "WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT" END))  OVER() AS PRV_INVOICED,
SUM(
SUM(
CASE WHEN "REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BLI_TYPE" = 'Total Due / Receivable'
THEN "WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT"
ELSE 0 END))  OVER() AS Net_Due_Total
FROM "REPORTS"."WEK_MTD_BILL_SUM_HIST_T"),

(SELECT

"REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BILL_CYCLE",
"REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT" AS NET_TOTAL,
(SUM(
SUM(
CASE WHEN "REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BLI_TYPE" = 'Total Due / Receivable' AND ( "REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BILL_CYCLE" BETWEEN '1-JAN-2022 4' AND :END_DATE)
THEN "WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT" ELSE 0 END))  OVER()/COUNT(DISTINCT(BILL_CYCLE))) AS X

FROM
"REPORTS"."WEK_MTD_BILL_SUM_HIST_T"

WHERE
("REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BILL_CYCLE"  BETWEEN :START_DATE AND :END_DATE )
)
GROUP BY
"REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."MTD_TOT" ,
"REPORTS"."WEK_MTD_BILL_SUM_HIST_T"."BILL_CYCLE"
;


问:
Electron Package - asar unpack pattern not working
I need to exclude only the "package.json" from the root folder
but at the moment all "package.json" files are unpacked (from node_modules ...)
Electron v18
Electron Package v15.4.0
Windows

script in package.json

```<code>"scripts": {
    "package": "electron-packager . TestApp --out=dist/win --asar.unpack=\"{*/jar/**/*,**/jre/**/*,package.json}\"
}
</code>```

and with this pattern, no file will be unpacked

```<code>/package.json => NOK
</code>```
```<code>/{,!(node_modules)/**/}package.json => NOK
</code>```

any ideas??

Greetings
Klaus

Body:
I need to exclude only the "package.json" from the root folder
but at the moment all "package.json" files are unpacked (from node_modules ...)
Electron v18
Electron Package v15.4.0
Windows

script in package.json

"scripts": {
    "package": "electron-packager . TestApp --out=dist/win --asar.unpack=\"{*/jar/**/*,**/jre/**/*,package.json}\"
}

and with this pattern, no file will be unpacked

/package.json => NOK

/{,!(node_modules)/**/}package.json => NOK

any ideas??

Greetings
Klaus


问:
How do I update posts in real time?
I am trying to update my post array in real time and show a new results when a document is added. I know that I have to setup a snapshot listener however I have failed in my efforts to factor it into my code.

My code is below.

```<code>    func fetchPosts(completion: @escaping([Post]) -> Void) {
    Firestore.firestore().collection("posts")
        .order(by: "timestamp", descending: true)
        .getDocuments { snapshot, _ in
            guard let documents = snapshot?.documents else { return }
            let posts = documents.compactMap({ try? $0.data(as: Post.self) })
            completion(posts)
        }
}
</code>```

Observed object is already setup I just need some help putting a snapshot listener into the code above as I am also ordering the posts by their timestamp.

Many thanks :)

Title: How do I update posts in real time?

Body:
I am trying to update my post array in real time and show a new results when a document is added. I know that I have to setup a snapshot listener however I have failed in my efforts to factor it into my code.

My code is below.

    func fetchPosts(completion: @escaping([Post]) -> Void) {
    Firestore.firestore().collection("posts")
        .order(by: "timestamp", descending: true)
        .getDocuments { snapshot, _ in
            guard let documents = snapshot?.documents else { return }
            let posts = documents.compactMap({ try? $0.data(as: Post.self) })
            completion(posts)
        }
}

Observed object is already setup I just need some help putting a snapshot listener into the code above as I am also ordering the posts by their timestamp.

Many thanks :)


问:
No texture display for 3D models in Google-Earth Pro when using KMZ with networklink to other KMZ (including the model)
I face a very strange issue in Google-Earth Pro (desktop client) when I try to display a 3D model "indirectly". Let me explain a bit more.

I try to make life easier for our users by creating a KMZ (=zip of KML) containing only networklink (to other KMZ file in a S3 bucket with presigned links).

These KMZs are very simple (mostly polygons) but one is containing a 3D model, in COLLADA format from Google SketchUp 8 (compatible with GE Pro), including textures files (png) beside. The whole pack (KML + collada + textures) is zipped to a KMZ file.

If I use a KMZ pointing to local KMZ files through the networklink flag : no problem at all. But in my case where I use S3 links, all is working but the textures. The 3D model itself is fine otherwise.

Any idea about how GE Pro is parsing / caching networklinked files to solve this issue ? I guess it is a problem of local path since the content of the file is displayed.


问:
How can we include intercept in coxph() function in R?
This is the code:

```<code>coxAll_baseline <- coxph(Surv(time, status) ~
                 time
                + rec
                + ind
                + out
                + sam,
                data=cdata)
</code>```

What should I do exactly to have the intercept here?

Body:
This is the code:

coxAll_baseline <- coxph(Surv(time, status) ~
                 time
                + rec
                + ind
                + out
                + sam,
                data=cdata)

What should I do exactly to have the intercept here?


问:
Detecting anomalies between sensors and same-sensor data in R
I have a dataset like this (don't look at column 4,5 and 8)

These are temperature and humidity measurements at different days of the year (january to august), taken by different sensors (8 in total) at different timestamps of the same room.
The final df has more than 100.000 rows.
I wanted to study temperature and humidity trends for those months, trying to detect anomalies within the same sensor (maybe one of them has outlier records) and between ALL sensors (I would like to detect sensors which had wrong temperature and/or humidity entries compared to others). What would you do? Which algorithms would you use? Any suggestion would be like gold to me


问:
No speech detected in SwiftUI iOS
I am trying to implement a speech-to-text feature in my app but I am facing this error:

```<code>Recognition error:  Error Domain=kAFAssistantErrorDomain Code=1110 "No speech detected"
</code>```

I am testing it on a real device

Relevant code:

```<code>@State private var isRecording = false {
    didSet {
        if !isRecording { recognitionTask = nil }
    }
}

@State private var recognitionTask: SFSpeechRecognitionTask?

private func startRecording() {
    isRecording = true
    let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))!

    // Create an SFSpeechAudioBufferRecognitionRequest instance
    let request = SFSpeechAudioBufferRecognitionRequest()
    let audioEngine = AVAudioEngine()
    let inputNode = audioEngine.inputNode

    // Append audio samples to the request object
    inputNode.installTap(onBus: 0, bufferSize: 1024, format: inputNode.outputFormat(forBus: 0)) { (buffer, time) in
        request.append(buffer)
    }

    // Start the audio engine and start recording
    audioEngine.prepare()
    do {
        try audioEngine.start()
    } catch {
        print("Audio engine error: ",error)
        return
    }

    // Start recognizing speech from the audio samples
    recognitionTask = speechRecognizer.recognitionTask(with: request) { (result, error) in
        // Check for errors
        if let error {
            print("Recognition error: ",error)
            return
        }
        guard let result else { return }
        // Update the task variable with the transcription result
        self.task = result.bestTranscription.formattedString
    }
}

private func stopRecording() {
    recognitionTask?.cancel()
    isRecording = false
}
</code>```

and then I have 2 buttons to indicate if it's recording or not and also to trigger the stopRecording() function and the startRecording() function.
Here's the snippet:

```<code>if isRecording {
    Button {
        stopRecording()
    } label: {
        Image(systemName: "mic.circle.fill")
            .resizable()
            .frame(width: 25, height: 25)
            .foregroundColor(.red)
    }
} else {
    Button {
        startRecording()
    } label: {
        Image(systemName: "mic.circle.fill")
            .resizable()
            .frame(width: 25, height: 25)
    }
}
</code>```

Why do I get this error?

Title: No speech detected in SwiftUI iOS

Body:
I am trying to implement a speech-to-text feature in my app but I am facing this error:

Recognition error:  Error Domain=kAFAssistantErrorDomain Code=1110 "No speech detected"

I am testing it on a real device

Relevant code:

@State private var isRecording = false {
    didSet {
        if !isRecording { recognitionTask = nil }
    }
}

@State private var recognitionTask: SFSpeechRecognitionTask?

private func startRecording() {
    isRecording = true
    let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))!

    // Create an SFSpeechAudioBufferRecognitionRequest instance
    let request = SFSpeechAudioBufferRecognitionRequest()
    let audioEngine = AVAudioEngine()
    let inputNode = audioEngine.inputNode

    // Append audio samples to the request object
    inputNode.installTap(onBus: 0, bufferSize: 1024, format: inputNode.outputFormat(forBus: 0)) { (buffer, time) in
        request.append(buffer)
    }

    // Start the audio engine and start recording
    audioEngine.prepare()
    do {
        try audioEngine.start()
    } catch {
        print("Audio engine error: ",error)
        return
    }

    // Start recognizing speech from the audio samples
    recognitionTask = speechRecognizer.recognitionTask(with: request) { (result, error) in
        // Check for errors
        if let error {
            print("Recognition error: ",error)
            return
        }
        guard let result else { return }
        // Update the task variable with the transcription result
        self.task = result.bestTranscription.formattedString
    }
}

private func stopRecording() {
    recognitionTask?.cancel()
    isRecording = false
}

and then I have 2 buttons to indicate if it's recording or not and also to trigger the stopRecording() function and the startRecording() function.
Here's the snippet:

if isRecording {
    Button {
        stopRecording()
    } label: {
        Image(systemName: "mic.circle.fill")
            .resizable()
            .frame(width: 25, height: 25)
            .foregroundColor(.red)
    }
} else {
    Button {
        startRecording()
    } label: {
        Image(systemName: "mic.circle.fill")
            .resizable()
            .frame(width: 25, height: 25)
    }
}

Why do I get this error?


问:
Can you please simplify (or help me refactor) my logic
I am aggregating data in json to convert it into symfony object.

A category (otology) has a type (swimming pool, restaurant). This category has a description that is translated into several languages.

I would like to be able to simply do getXXX('fr'), to have this description in French, getXXX('en') for English.

With a repository I think I can do it, but maybe I complicate it:

My class Otolongy:

```<code>class Ontology
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 255)]
    private ?string $idOntology = null;

    #[ORM\OneToMany(mappedBy: 'ontology', targetEntity: Label::class, cascade: ['persist', 'remove'],  fetch:'EAGER')]
    private Collection $descriptions;
</code>```

my class label (for fields description):

```<code>#[ORM\Entity(repositoryClass: LabelRepository::class)]
class Label
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(type: Types::TEXT)]
    private ?string $label = null;

    #[ORM\ManyToOne(inversedBy: 'descriptions')]
    private ?Ontology $ontology = null;

    #[ORM\ManyToOne(inversedBy: 'labels',  fetch:'EAGER')]
    private ?Lang $lang = null;
</code>```

my class lang:

```<code>#[ORM\Entity(repositoryClass: LangRepository::class)]
class Lang
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 10)]
    private ?string $labelLang = null;

    #[ORM\OneToMany(mappedBy: 'lang', targetEntity: Label::class)]
    private Collection $labels;
</code>```

You can see that for my tests I had to put fetch:'EAGER' I'm not convinced that this is the right way to do it... well after all put 1 eager or have to make a 'complex' request in my controller it should be equivalent...

I have already done this system on java and I had made a map key, so I used this command ontology.description.get(lang) in the template, in order to use the local as an argument and java gave me the description in the good language.

if i can avoid loading the ontology in eager i think the display of twig will go faster? Namely that I must also check that the translation in the visitor's local exists, otherwise I must display by default (English or French)

So my goal is to use the visitor's locale to know which language (language of the ontology in the database) that twig should display. Is there maybe a simpler way to do it? Maybe I'm totally wrong?!

Body:
I am aggregating data in json to convert it into symfony object.

A category (otology) has a type (swimming pool, restaurant). This category has a description that is translated into several languages.

I would like to be able to simply do getXXX('fr'), to have this description in French, getXXX('en') for English.

With a repository I think I can do it, but maybe I complicate it:

My class Otolongy:

class Ontology
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 255)]
    private ?string $idOntology = null;

    #[ORM\OneToMany(mappedBy: 'ontology', targetEntity: Label::class, cascade: ['persist', 'remove'],  fetch:'EAGER')]
    private Collection $descriptions;

my class label (for fields description):

#[ORM\Entity(repositoryClass: LabelRepository::class)]
class Label
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(type: Types::TEXT)]
    private ?string $label = null;

    #[ORM\ManyToOne(inversedBy: 'descriptions')]
    private ?Ontology $ontology = null;

    #[ORM\ManyToOne(inversedBy: 'labels',  fetch:'EAGER')]
    private ?Lang $lang = null;

my class lang:

#[ORM\Entity(repositoryClass: LangRepository::class)]
class Lang
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 10)]
    private ?string $labelLang = null;

    #[ORM\OneToMany(mappedBy: 'lang', targetEntity: Label::class)]
    private Collection $labels;

You can see that for my tests I had to put fetch:'EAGER' I'm not convinced that this is the right way to do it... well after all put 1 eager or have to make a 'complex' request in my controller it should be equivalent...

I have already done this system on java and I had made a map key, so I used this command ontology.description.get(lang) in the template, in order to use the local as an argument and java gave me the description in the good language.

if i can avoid loading the ontology in eager i think the display of twig will go faster? Namely that I must also check that the translation in the visitor's local exists, otherwise I must display by default (English or French)

So my goal is to use the visitor's locale to know which language (language of the ontology in the database) that twig should display. Is there maybe a simpler way to do it? Maybe I'm totally wrong?!


问:
BigQuery: How to set IAM condition to delete table (using CEL?)
In Google BigQuery, I want to restrict an assigend role for table delete action, so that users only can delete tables they created themselves.
I assume, that it's (only?) possible with Condition Editor using CEL expressions (see https://cloud.google.com/iam/docs/conditions-overview#cel).

Since I'm not familiar with CEL, I ask for some hints how to write a condition like

resource.creator == current_user

But I have no clue about the syntax, the available CEL variables and how to reference them.

Condition Builder doesn't provide user details, does it?


问:
Getting JUnit results for android sdk 30 emulator
I have a jenkins job running tests on android emulator! When we run the tests on android sdk version 28, we are getting the junit results. But when we run on android sdk-30 emulator, we are not getting any junit results! The only change done is changing the version of the sdk. Going through the console logs, we are seeing the tests being executed, but the final result is not getting published! Anyone worked on android sdk30 on jenkins with junit?

This is the error that I see on the console

HH:mm:ss  Recording test results

HH:mm:ss  No test report files were found. Configuration error?

Thank you,
Kartik

I have tried to find any xml files on the android emulator, but I could not find any xml files on the emulator.

For most of the file system, I get permission denied when trying to list the emulator contents.


问:
how to send image and data at once in a postman
I want to send the user info with an image at once during user's registration because I want to use the url of the image sent by the user to save it as the user's profile image.
I have tried to send the image as a file in form-data while I send other user's detail as raw but I'm having internal server error in postman and when I checked my logcat, it saves that the file is not a multipart file
Here is my controller</p>
```<code>package com.elijah.onlinebankingapp.cotroller;

import com.elijah.onlinebankingapp.dto.CustomerDto;
import com.elijah.onlinebankingapp.model.customer.ImageModel;
import com.elijah.onlinebankingapp.response.ImageResponse;
import com.elijah.onlinebankingapp.response.SignUpResponse;
import com.elijah.onlinebankingapp.service.customer.CustomerService;
import com.elijah.onlinebankingapp.service.image.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

@RestController
public class CustomerController {

    private ImageService imageService;
    @Autowired
    private CustomerService customerService;

    public CustomerController(ImageService imageService) {
        this.imageService = imageService;
    }

    @PostMapping("/customer/register")
    public ResponseEntity<SignUpResponse>uploadUserInfo(@RequestParam("file")MultipartFile file,@RequestBody CustomerDto customerDto ) throws Exception {
        ImageModel imageModel = imageService.saveProfileImage(file);
        String downloadUrl = ServletUriComponentsBuilder.fromCurrentContextPath()
                .path("/download/")
                .path(imageModel.getId())
                .toUriString();
        customerService.signUpCustomer(customerDto,downloadUrl);

        return  new ResponseEntity<>(new SignUpResponse(true,downloadUrl),HttpStatus.CREATED);
    }
}
</code>```

Body:
I want to send the user info with an image at once during user's registration because I want to use the url of the image sent by the user to save it as the user's profile image.
I have tried to send the image as a file in form-data while I send other user's detail as raw but I'm having internal server error in postman and when I checked my logcat, it saves that the file is not a multipart file
Here is my controller

package com.elijah.onlinebankingapp.cotroller;

import com.elijah.onlinebankingapp.dto.CustomerDto;
import com.elijah.onlinebankingapp.model.customer.ImageModel;
import com.elijah.onlinebankingapp.response.ImageResponse;
import com.elijah.onlinebankingapp.response.SignUpResponse;
import com.elijah.onlinebankingapp.service.customer.CustomerService;
import com.elijah.onlinebankingapp.service.image.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

@RestController
public class CustomerController {

    private ImageService imageService;
    @Autowired
    private CustomerService customerService;

    public CustomerController(ImageService imageService) {
        this.imageService = imageService;
    }

    @PostMapping("/customer/register")
    public ResponseEntity<SignUpResponse>uploadUserInfo(@RequestParam("file")MultipartFile file,@RequestBody CustomerDto customerDto ) throws Exception {
        ImageModel imageModel = imageService.saveProfileImage(file);
        String downloadUrl = ServletUriComponentsBuilder.fromCurrentContextPath()
                .path("/download/")
                .path(imageModel.getId())
                .toUriString();
        customerService.signUpCustomer(customerDto,downloadUrl);

        return  new ResponseEntity<>(new SignUpResponse(true,downloadUrl),HttpStatus.CREATED);
    }
}


问:
How to make website navbar viewed in mobile correctly. No zoom out need
Website has to zoom out on mobile device. When I view it from inspect as mobile view from the browser it works fine but when I open it from my smartphone you have to unzoom to display the full navbar.

Some screenshots to understand.

Zoom out to show full navbar from mobile:
https://ibb.co/Trrq9NW

Not zoom website from mobile:
https://ibb.co/3hCkgZc

From browser mobile view: https://ibb.co/DCwt0FB

index.html (header code)

```<code><!-- ======= Header ======= -->
  <header id="header" class="fixed-top d-flex align-items-center">
    <div class="container d-flex align-items-center">
      <div class="logo me-auto">
        <h1>
          <a href="/">
            <img  src="assets/img/logo/logo.png"
                  class="img-fluid"
                  alt="">
              TITLE HERE
          </a>
        </h1>
      </div>

      <nav  id="navbar" class="navbar">
        <ul>
          <li><a class="nav-link scrollto active" href="#hero">Αρχική</a></li>
          <li><a class="nav-link scrollto" href="#about">Σχετικά με μας</a></li>
          <li><a class="nav-link scrollto" href="#services">Δραστηριότητες</a></li>
          <li><a class="nav-link scrollto" href="#portfolio">Φωτογραφίες</a></li>
          <li><a class="nav-link scrollto" href="#vivlia">Βιβλία</a></li>
          <li><a class="nav-link scrollto" href="#contact">Επικοινωνία</a></li>
        </ul>
        <i class="bi bi-list mobile-nav-toggle"></i>
      </nav><!-- .navbar -->
    </div>
  </header><!-- End #header -->
</code>```

style.css (navbar code)

```<code>/**
* Mobile Navigation
*/
.mobile-nav-toggle {
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  display: none;
  line-height: 0;
  transition: 0.5s;
}

@media (max-width: 991px) {
  .mobile-nav-toggle {
    display: block;
  }

  .navbar ul {
    display: none;
  }
}

.navbar-mobile {
  position: fixed;
  overflow: hidden;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(7, 56, 57, 0.9);
  transition: 0.3s;
}

.navbar-mobile .mobile-nav-toggle {
  position: absolute;
  top: 15px;
  right: 15px;
}

.navbar-mobile ul {
  display: block;
  position: absolute;
  top: 55px;
  right: 15px;
  bottom: 15px;
  left: 15px;
  padding: 10px 0;
  background-color: #fff;
  overflow-y: auto;
  transition: 0.3s;
}

.navbar-mobile a,
.navbar-mobile a:focus {
  padding: 10px 20px;
  font-size: 15px;
  color: #073839;
}

.navbar-mobile a:hover,
.navbar-mobile .active,
.navbar-mobile li:hover>a {
  color: #70b9b0;
}

.navbar-mobile .getstarted,
.navbar-mobile .getstarted:focus {
  margin: 15px;
}

.navbar-mobile .dropdown ul {
  position: static;
  display: none;
  margin: 10px 20px;
  padding: 10px 0;
  z-index: 99;
  opacity: 1;
  visibility: visible;
  background: #fff;
  box-shadow: 0px 0px 30px rgba(127, 137, 161, 0.25);
}

.navbar-mobile .dropdown ul li {
  min-width: 200px;
}

.navbar-mobile .dropdown ul a {
  padding: 10px 20px;
}

.navbar-mobile .dropdown ul a i {
  font-size: 12px;
}

.navbar-mobile .dropdown ul a:hover,
.navbar-mobile .dropdown ul .active:hover,
.navbar-mobile .dropdown ul li:hover>a {
  color: #70b9b0;
}

.navbar-mobile .dropdown>.dropdown-active {
  display: block;
}
</code>```

Body:
Website has to zoom out on mobile device. When I view it from inspect as mobile view from the browser it works fine but when I open it from my smartphone you have to unzoom to display the full navbar.

Some screenshots to understand.

Zoom out to show full navbar from mobile:
https://ibb.co/Trrq9NW

Not zoom website from mobile:
https://ibb.co/3hCkgZc

From browser mobile view: https://ibb.co/DCwt0FB

index.html (header code)

              TITLE HERE

Αρχική

Σχετικά με μας

Δραστηριότητες

Φωτογραφίες

Βιβλία

Επικοινωνία

style.css (navbar code)

/**
* Mobile Navigation
*/
.mobile-nav-toggle {
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  display: none;
  line-height: 0;
  transition: 0.5s;
}

@media (max-width: 991px) {
  .mobile-nav-toggle {
    display: block;
  }

  .navbar ul {
    display: none;
  }
}

.navbar-mobile {
  position: fixed;
  overflow: hidden;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(7, 56, 57, 0.9);
  transition: 0.3s;
}

.navbar-mobile .mobile-nav-toggle {
  position: absolute;
  top: 15px;
  right: 15px;
}

.navbar-mobile ul {
  display: block;
  position: absolute;
  top: 55px;
  right: 15px;
  bottom: 15px;
  left: 15px;
  padding: 10px 0;
  background-color: #fff;
  overflow-y: auto;
  transition: 0.3s;
}

.navbar-mobile a,
.navbar-mobile a:focus {
  padding: 10px 20px;
  font-size: 15px;
  color: #073839;
}

.navbar-mobile a:hover,
.navbar-mobile .active,
.navbar-mobile li:hover>a {
  color: #70b9b0;
}

.navbar-mobile .getstarted,
.navbar-mobile .getstarted:focus {
  margin: 15px;
}

.navbar-mobile .dropdown ul {
  position: static;
  display: none;
  margin: 10px 20px;
  padding: 10px 0;
  z-index: 99;
  opacity: 1;
  visibility: visible;
  background: #fff;
  box-shadow: 0px 0px 30px rgba(127, 137, 161, 0.25);
}

.navbar-mobile .dropdown ul li {
  min-width: 200px;
}

.navbar-mobile .dropdown ul a {
  padding: 10px 20px;
}

.navbar-mobile .dropdown ul a i {
  font-size: 12px;
}

.navbar-mobile .dropdown ul a:hover,
.navbar-mobile .dropdown ul .active:hover,
.navbar-mobile .dropdown ul li:hover>a {
  color: #70b9b0;
}

.navbar-mobile .dropdown>.dropdown-active {
  display: block;
}


问:
Use Remote Database If Object Is Not Found
I am in search of a better solution, I'd like to make a database where there are some local tables/sprocs/views that should be used as the default.  As a fall back use a remote database.

The setup I have right now is to copy the schema and/or data of the tables I don't want to change in the remote database.  Then create a view for all the views and tables I want read-only access to.  The sprocs are just a copy from the remote database as well.  This cuts down on time copying all the data as well.

What I am wondering is if there is a way at a lower level to tell SQL Server to fall back on the remote database if an object is not found, then fail if the object is still not found?


问:
Going through linked scroll view content how to spot when its finished. UI automation
I am wondering what would be a stable algorithm that can determine a length of a scrollable carousel.

For example i have a view with left andright button that can go through the whole collection of items.

The items can be repetitive and non-unique. For example :

A<->B<->C<-D->A<->B<->C<->H<->G ( G is connected to A with <->)

Using a bot that can inspect the state and click,

how many times i need to go through the whole list to determine that is the final one ?

thanks


问:
Sentry Sourcemaps: bad json: invalid type: map, expected a string
I've been tasked with integrating Sentry into our front-end application and I'm having some trouble with it.

After building our source I've set the pipelines to upload our sourcemaps to sentry with:

```<code>sentry-cli releases -o "myorg" -p "myproject" files "$VERSION" upload-sourcemaps ./
</code>```

This seems to almost work:

```<code>  DEBUG   2022-12-09 15:18:39.496486472 +00:00 sentry-cli version: 2.10.0, platform: "linux", architecture: "x86_64"
  INFO    2022-12-09 15:18:39.496862713 +00:00 sentry-cli was invoked with the following command line: "sentry-cli" "releases" "-o" "uswitchcom" "-p" "my-mojo-ui" "files" "1.0.1638" "upload-sourcemaps" "./"
> Found 69899 release files
> Analyzing 69899 sources
> Rewriting sources
error: bad json: invalid type: map, expected a string at line 1 column 328
</code>```

The dist folder structure is really flat, it's being built with Parcel.

```<code>dist
├── index.0bf95743.js
├── index.0bf95743.js.map
├── index.a11de8bb.js
├── index.a11de8bb.js.map
├── index.fee677fd.css
├── index.fee677fd.css.map
├── index.html
</code>```

(I'm not sure why there's two indexes, the app works fine though)

Any ideas what's wrong? Source maps work in the browser when checking with the debug tools so I can't imagine they'd be broken.

Body:
I've been tasked with integrating Sentry into our front-end application and I'm having some trouble with it.

After building our source I've set the pipelines to upload our sourcemaps to sentry with:

sentry-cli releases -o "myorg" -p "myproject" files "$VERSION" upload-sourcemaps ./

This seems to almost work:

  DEBUG   2022-12-09 15:18:39.496486472 +00:00 sentry-cli version: 2.10.0, platform: "linux", architecture: "x86_64"
  INFO    2022-12-09 15:18:39.496862713 +00:00 sentry-cli was invoked with the following command line: "sentry-cli" "releases" "-o" "uswitchcom" "-p" "my-mojo-ui" "files" "1.0.1638" "upload-sourcemaps" "./"
> Found 69899 release files
> Analyzing 69899 sources
> Rewriting sources
error: bad json: invalid type: map, expected a string at line 1 column 328

The dist folder structure is really flat, it's being built with Parcel.

dist
├── index.0bf95743.js
├── index.0bf95743.js.map
├── index.a11de8bb.js
├── index.a11de8bb.js.map
├── index.fee677fd.css
├── index.fee677fd.css.map
├── index.html

(I'm not sure why there's two indexes, the app works fine though)

Any ideas what's wrong? Source maps work in the browser when checking with the debug tools so I can't imagine they'd be broken.


问:
What is the reason for error of exit with code 1
Launching lib\main.dart on RMX3371 in debug mode...
[Fatal Error] flutter_embedding_debug-1.0.0-8f2221fbef28b478debb78dd233f5250b220ca99.pom:14:6: An invalid XML character (Unicode: 0x0) was found in the element content of the document.
[Fatal Error] kotlin-stdlib-jdk7-1.6.10.pom:2:1: Content is not allowed in prolog.

FAILURE: Build failed with an exception.

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 39s
Running Gradle task 'assembleDebug'...                             41.6s
Exception: Gradle task assembleDebug failed with exit code 1

build.gradle file:

```<code>buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

</code>```

I tried re-installing android studio but the problem still exist..

I have tried gradlew clean and gradlew build but problem still persist so please help me find solution..

Body:
Launching lib\main.dart on RMX3371 in debug mode...
[Fatal Error] flutter_embedding_debug-1.0.0-8f2221fbef28b478debb78dd233f5250b220ca99.pom:14:6: An invalid XML character (Unicode: 0x0) was found in the element content of the document.
[Fatal Error] kotlin-stdlib-jdk7-1.6.10.pom:2:1: Content is not allowed in prolog.

FAILURE: Build failed with an exception.

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 39s
Running Gradle task 'assembleDebug'...                             41.6s
Exception: Gradle task assembleDebug failed with exit code 1

build.gradle file:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I tried re-installing android studio but the problem still exist..

I have tried gradlew clean and gradlew build but problem still persist so please help me find solution..


问:
Getting Duplicate while getting while exporting to CSV powershell
I am using PowerShell code to hit public API but there is pagination meaning there are around  400000 pages but I am exporting to csv I am getting duplicate value.

My Code :

```<code>$uri = 'https://prices.azure.com/api/retail/prices'
$Headers = @{}
$Items = @()
Do
{

    $r = Invoke-WebRequest -Method 'Get' -uri $uri -Header $Headers -UseBasicParsing # -Verbose
    $c = $r.Content | ConvertFrom-Json
    $Items += $c.Items
    $Count += $c.Count
    $uri = $c.NextPageLink
    $uri
} While ($c.NextPageLink)
$Items | Export-CSV -Path ("$(get-date -format "Retail_yyyy_mm")" +'.csv') -Force

</code>```

When I am checking the csv file there 100000 records that are duplicate. can someone guide me what I am doing wrong here.

Body:
I am using PowerShell code to hit public API but there is pagination meaning there are around  400000 pages but I am exporting to csv I am getting duplicate value.

My Code :

$uri = 'https://prices.azure.com/api/retail/prices'
$Headers = @{}
$Items = @()
Do
{

    $r = Invoke-WebRequest -Method 'Get' -uri $uri -Header $Headers -UseBasicParsing # -Verbose
    $c = $r.Content | ConvertFrom-Json
    $Items += $c.Items
    $Count += $c.Count
    $uri = $c.NextPageLink
    $uri
} While ($c.NextPageLink)
$Items | Export-CSV -Path ("$(get-date -format "Retail_yyyy_mm")" +'.csv') -Force

When I am checking the csv file there 100000 records that are duplicate. can someone guide me what I am doing wrong here.


问:
How to find or resolve the argument of then callback from the promise declaration in ast ts-morph?
In the following code, I try to resolve and find the findMe node argument from the new Promise line using ts-morph.

Is it possible to find all references but to use it to Promise?

```<code> class Foo {
    some() {
      const doWork = new Promise((res, req) => { res(true) });
      doWork.then(findMe => {

      });
    }
  }
</code>```

In my code I was able to find the Promise Identifier:

```<code>const someMethod = sourceFile.getClass("Foo")?.getMethod("some");

const promise = someMethod
  ?.getDescendantsOfKind(SyntaxKind.Identifier)
  .filter((i) => i.getText() === "Promise")[0];

</code>```

But from there, how I can find the findMe node argument using ts-morph/typescript?

codesandbox

Body:
In the following code, I try to resolve and find the findMe node argument from the new Promise line using ts-morph.

Is it possible to find all references but to use it to Promise?

 class Foo {
    some() {
      const doWork = new Promise((res, req) => { res(true) });
      doWork.then(findMe => {

      });
    }
  }

In my code I was able to find the Promise Identifier:

const someMethod = sourceFile.getClass("Foo")?.getMethod("some");

const promise = someMethod
  ?.getDescendantsOfKind(SyntaxKind.Identifier)
  .filter((i) => i.getText() === "Promise")[0];

But from there, how I can find the findMe node argument using ts-morph/typescript?

codesandbox


问:
PermissionDenied openpyxl excel file in docker container
I want to open an excel file in in a docker container but when I do, I get the following error:

PermissionError: [Errno 13] Permission denied: 'records.xlsx'

this is the code in the backend:

    def export_excel(self, lijst):
        workbook = load_workbook('records.xlsx')
        ws = workbook.active
        identificatie= id(lijst)
        inzet = [identificatie]
        for dicts in lijst:
            for key, value in dicts.items():
                inzet.append(value)

        ws.append(inzet)
        workbook.template = False
        workbook.save('records.xlsx')
        return identificatie
```

this file, along with the excel file are both in the same folder. This all works fine when running the server on localhost, but now that the server is containerised, it doesn't work anymore.

this is what happens when I exec into the container and do ls. As you can see, the app.py and records.xlsx are in the same folder as well.

How can I fix this?

EDIT: I changed the filepath to /app/records.xlsx because that's the path given to me by readlink but I still get the same error

EDIT 2: the permissions on the file are:

Body:
I want to open an excel file in in a docker container but when I do, I get the following error:

PermissionError: [Errno 13] Permission denied: 'records.xlsx'

this is the code in the backend:

    def export_excel(self, lijst):
        workbook = load_workbook('records.xlsx')
        ws = workbook.active
        identificatie= id(lijst)
        inzet = [identificatie]
        for dicts in lijst:
            for key, value in dicts.items():
                inzet.append(value)

        ws.append(inzet)
        workbook.template = False
        workbook.save('records.xlsx')
        return identificatie

this file, along with the excel file are both in the same folder. This all works fine when running the server on localhost, but now that the server is containerised, it doesn't work anymore.

this is what happens when I exec into the container and do ls. As you can see, the app.py and records.xlsx are in the same folder as well.

How can I fix this?

EDIT: I changed the filepath to /app/records.xlsx because that's the path given to me by readlink but I still get the same error

EDIT 2: the permissions on the file are:


问:
A play video symbol on the Iphone
I created a page with a video in the background. It works great on desktop, but when I check it works on iPhone through the "Live Server" visual studio code add-on, it doesn't show the video, but displays the play icon. I tried everything I found on the internet. How can I make it disappear from the page on iPhone and the video starts automatically?
<video type="video/mp4" src="background.mp4" autoplay muted loop playsinline id="vid"></video>

Iphone page test

I tried to start the video with js method video.play(). It didn't work

Title: A play video symbol on the Iphone


问:
New Facebook app creation: "Oops - Something went wrong" error
I need to create this Facebook app to access Graph API - following the usual procedure at https://developers.facebook.com/apps/create/, I start filling in the form (App name, contact email and the optional business account -- which I'm not using atm)

Then I am requested to reenter my password "for my security", and after that I get a "Something went wrong. We're working on getting it fixed as soon as we can." message, and apparently, regardless how much I try, cannot move past that.

Tried so far: disabled adblock, cleared cache and cookies, switched from Chrome to Safari, tried from a different computer and account: nothing seems to get past this "Something went wrong" error.


问:
How do I synchronize these two functions?
No1)

```<code>  const handleCheckList = (id, checked,findCost) => {
    if (checked) {
      setCheckLists([...checkLists, id]);
    } else if (!checked) {
      // checkLists에서 입력된 id랑 같은걸 찾아서 같지 않은거만 filter
      const tmp = checkLists;
      const newarr = tmp.filter((it) => it !== id);
      setCheckLists(newarr);
    }
    findCost();<< Here!!
  };
</code>```

No2)

```<code>  const findCost = () => {
    for (let i = 0; i < checkLists.length; i++) {
      const tmparr = cart;
      const findobj = tmparr.find((it) => it.id == checkLists[i]);
      console.log(findobj);
    }
  };
</code>```

I want to run the findCost function after completing the setState operation in the handelCheckList function.
However, setState is asynchronous, so the previous value is passed to findCost.
How can I run findCost after the setState runs completely?

new promise(){
if function...
}.then(findCost())

--> but the result is not good... :(

Body:
No1)

  const handleCheckList = (id, checked,findCost) => {
    if (checked) {
      setCheckLists([...checkLists, id]);
    } else if (!checked) {
      // checkLists에서 입력된 id랑 같은걸 찾아서 같지 않은거만 filter
      const tmp = checkLists;
      const newarr = tmp.filter((it) => it !== id);
      setCheckLists(newarr);
    }
    findCost();<< Here!!
  };

No2)

  const findCost = () => {
    for (let i = 0; i < checkLists.length; i++) {
      const tmparr = cart;
      const findobj = tmparr.find((it) => it.id == checkLists[i]);
      console.log(findobj);
    }
  };

I want to run the findCost function after completing the setState operation in the handelCheckList function.
However, setState is asynchronous, so the previous value is passed to findCost.
How can I run findCost after the setState runs completely?

new promise(){
if function...
}.then(findCost())

--> but the result is not good... :(