问:
jQuery.post() get global var from others php files
I have a problem. I am using forum (SMF) I am creating some script in jQuery whose job is to read information from something, processing the information and resending and replacing the tags in the forum post.

I do this because it takes time to process and the page would take longer to load.

My problem is that I have variables whose origin I don't know and some are attached to a class so they give callbacks or be function.

My question is if anyone knows what and how to be able to use variables that are already loaded by loading the forum but in the jquery.post request I don't have them anymore.

```<code>    global $txt, $modSettings, $scripturl, $user_info,$smcFunc;

    loadLanguage('xx');
</code>```

or..

```<code>        if (allowedTo('view_attachments') || $modSettings['magnet_guest'])
        {
            $request = $smcFunc['db_query']('', '
                SELECT
                    a.id_attach, a.id_msg, a.fileext, a.downloads
                FROM {db_prefix}attachments AS a
                WHERE a.id_msg = {int:message_id}
                    AND a.fileext = {string:torrent_ext}
                ORDER BY a.downloads',
                array(
                    'message_id' => $cache_msg_id,
                    'torrent_ext' => 'torrent',
                )
            );
</code>```
```<code>            $(function() {
                $('strong button#magnet_hook').each(function() {
                    const $temp_id_load = $(this).data('temp_id');

                    $.post("update.php",
                    {
                        magnet: $('a#magnet_hook[data-temp_id="'+$temp_id_load+'"]').attr('href'),
                        msg_id: $('a#magnet_hook[data-temp_id="'+$temp_id_load+'"]').data('msg_id'),
                        temp_id: $('a#magnet_hook[data-temp_id="'+$temp_id_load+'"]').data('temp_id')
                    },
                    function(data, status){
                        const $tracker_data_split = data.split("    ");
                        $('a#magnet_hook[data-temp_id="'+$tracker_data_split[0]+'"]').html($tracker_data_split[1]);
                    });
                });
            });

            $("strong button#magnet_hook").click(function() {
                const $temp_id = $(this).data('temp_id');

                $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').html('Updating trackers!');

                $.post("update.php",
                {
                    magnet: $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').attr('href'),
                    msg_id: $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').data('msg_id'),
                    temp_id: $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').data('temp_id')
                },
                function(data, status){
                    const $tracker_data_split = data.split("    ");
                    $('a#magnet_hook[data-temp_id="'+$tracker_data_split[0]+'"]').html($tracker_data_split[1]);
                });

            });
</code>```

I try say on smf forum question, AND read 50% internet in google :P

Body:
I have a problem. I am using forum (SMF) I am creating some script in jQuery whose job is to read information from something, processing the information and resending and replacing the tags in the forum post.

I do this because it takes time to process and the page would take longer to load.

My problem is that I have variables whose origin I don't know and some are attached to a class so they give callbacks or be function.

My question is if anyone knows what and how to be able to use variables that are already loaded by loading the forum but in the jquery.post request I don't have them anymore.

    global $txt, $modSettings, $scripturl, $user_info,$smcFunc;

    loadLanguage('xx');

or..

        if (allowedTo('view_attachments') || $modSettings['magnet_guest'])
        {
            $request = $smcFunc['db_query']('', '
                SELECT
                    a.id_attach, a.id_msg, a.fileext, a.downloads
                FROM {db_prefix}attachments AS a
                WHERE a.id_msg = {int:message_id}
                    AND a.fileext = {string:torrent_ext}
                ORDER BY a.downloads',
                array(
                    'message_id' => $cache_msg_id,
                    'torrent_ext' => 'torrent',
                )
            );

            $(function() {
                $('strong button#magnet_hook').each(function() {
                    const $temp_id_load = $(this).data('temp_id');

                    $.post("update.php",
                    {
                        magnet: $('a#magnet_hook[data-temp_id="'+$temp_id_load+'"]').attr('href'),
                        msg_id: $('a#magnet_hook[data-temp_id="'+$temp_id_load+'"]').data('msg_id'),
                        temp_id: $('a#magnet_hook[data-temp_id="'+$temp_id_load+'"]').data('temp_id')
                    },
                    function(data, status){
                        const $tracker_data_split = data.split("    ");
                        $('a#magnet_hook[data-temp_id="'+$tracker_data_split[0]+'"]').html($tracker_data_split[1]);
                    });
                });
            });

            $("strong button#magnet_hook").click(function() {
                const $temp_id = $(this).data('temp_id');

                $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').html('Updating trackers!');

                $.post("update.php",
                {
                    magnet: $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').attr('href'),
                    msg_id: $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').data('msg_id'),
                    temp_id: $('a#magnet_hook[data-temp_id="'+$temp_id+'"]').data('temp_id')
                },
                function(data, status){
                    const $tracker_data_split = data.split("    ");
                    $('a#magnet_hook[data-temp_id="'+$tracker_data_split[0]+'"]').html($tracker_data_split[1]);
                });

            });

I try say on smf forum question, AND read 50% internet in google :P


来源: stackexchange

问:
How to obtain a list of widgets in a windows form
I am trying to automate a help system. I have it set up so you right-click on any widget (Button, etc.) and one of the items is help. Selecting help causes a help file to display (PDF, HTML, or Wiki). Help positions the display to the paragraph that describes the widget. (The document is a hypertext document so the paragraph can contain cross links, etc.)

All of this is working. There is an implementation problem in that it is necessary to input the widget name manually when building the widget list for the help system. The problem is widgets can be renamed during development. New widgets can be added. Old ones deleted, etc. Maintenance becomes a problem.

So my question is, is it possible to obtain a list of widgets by form from a .net application being developed using Visual Studio? I don't mind scraping a set of files to extract the list, but I do need to automate obtaining the list so I can compare with the current list to determine any maintenance necessary to keep the help system in sync with the .net application.

Developer Studio does generate partial classes that do contain the information. Parsing these will be some effort since the parser must understand the format of the class. What would be nice is if Visual Studio had the ability to produce information about the structure of the app being developed.

ContentLicense: CC BY-SA 4.0


问:
Automatically indent clojure when hitting "o" in VS Code with vim bindings
I'm using VS Code with vim bindings. When I'm editing clojure code, if I hit "enter" (in edit mode), then the cursor is positioned on the new line at the correct indentation.

However, if I hit "o" in normal mode to start a new line instead, then the cursor starts at column 1.

How can I configure VS Code so that it will indent to the proper location when I hit "o" in normal mode?


问:
TweenMax: cancel animation if element is not in view of browser window
How to set TweenMax and ScrollTrigger compatibility so that the animation happens when the element is visible in the browser window?

demo

code

```<code><div class="box"></div>
<div class="gsap">
   <div class="gsap-item"></div>
</div>
</code>```
```<code>* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.box {
  background-color: royalblue;
  width: 100%;
  height: 150vh;
}

.gsap {
  padding: 40px;
  height: 200vh;
  background-color: greenyellow;
}

.gsap-item {
  background-color: #000;
  width: 100px;
  height: 100px;
}
</code>```
```<code>TweenMax.from(".gsap-item", 1.5, {
      opacity: 0.5,
      backgroundColor: "#f2f2f2",
      y: -40,
      ease: Power3.easeInOut,
      scrollTrigger: ".gsap-item",
    }, 0.5)

</code>```

Body:
How to set TweenMax and ScrollTrigger compatibility so that the animation happens when the element is visible in the browser window?

demo

code

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.box {
  background-color: royalblue;
  width: 100%;
  height: 150vh;
}

.gsap {
  padding: 40px;
  height: 200vh;
  background-color: greenyellow;
}

.gsap-item {
  background-color: #000;
  width: 100px;
  height: 100px;
}

TweenMax.from(".gsap-item", 1.5, {
      opacity: 0.5,
      backgroundColor: "#f2f2f2",
      y: -40,
      ease: Power3.easeInOut,
      scrollTrigger: ".gsap-item",
    }, 0.5)


问:
How to customize the style of React-native material-top-tabs
i have created a custom material top tab , but the issue with custom tab is parent box size is bigger . i want both tab should have same size . i tried giving width to screenOptions that dosen't seem to be working .

here is the code

```<code><Tab.Navigator initialRouteName="WeightData"
    sceneContainerStyle={{
        backgroundColor: '',
    }}
    screenOptions={{
        tabBarScrollEnabled: true,
        tabBarIndicatorStyle: {
            width: 0,
        },
        tabBarStyle: {
            borderWidth: 0,
            elevation: 0,
            color:"black",
            marginBottom: 20,
            borderRadius:40,
            marginLeft:30,
            marginRight:30,
            paddingRight:0,
        },
        tabBarActiveTintColor: 'black',
        tabBarLabelStyle:{
        }
    }}>
      <Tab.Screen name="WeightData" component={WeightData} options={{ tabBarLabel: 'Weight data' }} />
      <Tab.Screen name="BodyFatData" component={BodyFatData} options={{ tabBarLabel: 'Body Fat data' }} />
    </Tab.Navigator>
</code>```

Body:
i have created a custom material top tab , but the issue with custom tab is parent box size is bigger . i want both tab should have same size . i tried giving width to screenOptions that dosen't seem to be working .

here is the code

<Tab.Navigator initialRouteName="WeightData"
    sceneContainerStyle={{
        backgroundColor: '',
    }}
    screenOptions={{
        tabBarScrollEnabled: true,
        tabBarIndicatorStyle: {
            width: 0,
        },
        tabBarStyle: {
            borderWidth: 0,
            elevation: 0,
            color:"black",
            marginBottom: 20,
            borderRadius:40,
            marginLeft:30,
            marginRight:30,
            paddingRight:0,
        },
        tabBarActiveTintColor: 'black',
        tabBarLabelStyle:{
        }
    }}>
      <Tab.Screen name="WeightData" component={WeightData} options={{ tabBarLabel: 'Weight data' }} />
      <Tab.Screen name="BodyFatData" component={BodyFatData} options={{ tabBarLabel: 'Body Fat data' }} />
    </Tab.Navigator>


问:
EFI Context use entity in .UsingEntity<Dictionary<string, object>>
Greeting.
i have first aproch database project with mvc  6 net core and it have generated all the models needed exept for some that are a relation table between tow tables example:
enter image description here
enter image description here

but when vieng my context i found ProgrammeResponsableProgramme

```<code>        modelBuilder.Entity<Programme>(entity =>
        {

            entity.HasMany(d => d.ResponsableProgrammes).WithMany(p => p.Programmes)
                .UsingEntity<Dictionary<string, object>>(
                    "ProgrammeResponsableProgramme",
                    r => r.HasOne<ResponsableProgramme>().WithMany()
                        .HasForeignKey("ResponsableProgrammeId")
                        .HasConstraintName("FK_D566C424460F2D61"),
                    l => l.HasOne<Programme>().WithMany()
                        .HasForeignKey("ProgrammeId")
                        .HasConstraintName("FK_D566C42462BB7AEE"),
                    j =>
                    {
                        j.HasKey("ProgrammeId", "ResponsableProgrammeId")
                            .HasName("PRIMARY")
                            .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
                        j
                            .ToTable("programme_responsable_programme")
                            .UseCollation("utf8_unicode_ci");
                        j.HasIndex(new[] { "ResponsableProgrammeId" }, "IDX_D566C424460F2D61");
                        j.HasIndex(new[] { "ProgrammeId" }, "IDX_D566C42462BB7AEE");
                    });
        });
</code>```

i tried creating manually a model so i can insert into the table :

```<code>namespace SIP.Models
{
    public class ProgrammeResponsableProgramme
    {

        public int ProgrammeId { get; set; }
        public virtual ICollection<Programme> Programme { get; set; }

        public int ResponsableProgrammeId { get; set; }
        public virtual ICollection<ResponsableProgramme> ResponsableProgramme { get; set; }
    }
}
</code>```

this is the ResponsableProgramme

```<code>
using System;
using System.Collections.Generic;

namespace SIP.Models;

public partial class ResponsableProgramme
{
    public int Id { get; set; }

    public int MissionId { get; set; }

    public virtual User IdNavigation { get; set; } = null!;

    public virtual Mission Mission { get; set; } = null!;

    public virtual ICollection<Programme> Programmes { get; } = new List<Programme>();

}
</code>```

and i added a  in the context on create

```<code>
       modelBuilder.Entity<ProgrammeResponsableProgramme>()
        .HasKey(bc => new { bc.ProgrammeId, bc.ResponsableProgrammeId });
</code>```

when trying to execute i get this error
An unhandled exception occurred while processing the request.

so please how can i insert and update semilaire table to the one mentioned on top

Body:
Greeting.
i have first aproch database project with mvc  6 net core and it have generated all the models needed exept for some that are a relation table between tow tables example:
enter image description here
enter image description here

but when vieng my context i found ProgrammeResponsableProgramme

        modelBuilder.Entity<Programme>(entity =>
        {

            entity.HasMany(d => d.ResponsableProgrammes).WithMany(p => p.Programmes)
                .UsingEntity<Dictionary<string, object>>(
                    "ProgrammeResponsableProgramme",
                    r => r.HasOne<ResponsableProgramme>().WithMany()
                        .HasForeignKey("ResponsableProgrammeId")
                        .HasConstraintName("FK_D566C424460F2D61"),
                    l => l.HasOne<Programme>().WithMany()
                        .HasForeignKey("ProgrammeId")
                        .HasConstraintName("FK_D566C42462BB7AEE"),
                    j =>
                    {
                        j.HasKey("ProgrammeId", "ResponsableProgrammeId")
                            .HasName("PRIMARY")
                            .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
                        j
                            .ToTable("programme_responsable_programme")
                            .UseCollation("utf8_unicode_ci");
                        j.HasIndex(new[] { "ResponsableProgrammeId" }, "IDX_D566C424460F2D61");
                        j.HasIndex(new[] { "ProgrammeId" }, "IDX_D566C42462BB7AEE");
                    });
        });

i tried creating manually a model so i can insert into the table :

namespace SIP.Models
{
    public class ProgrammeResponsableProgramme
    {

        public int ProgrammeId { get; set; }
        public virtual ICollection<Programme> Programme { get; set; }

        public int ResponsableProgrammeId { get; set; }
        public virtual ICollection<ResponsableProgramme> ResponsableProgramme { get; set; }
    }
}

this is the ResponsableProgramme

using System;
using System.Collections.Generic;

namespace SIP.Models;

public partial class ResponsableProgramme
{
    public int Id { get; set; }

    public int MissionId { get; set; }

    public virtual User IdNavigation { get; set; } = null!;

    public virtual Mission Mission { get; set; } = null!;

    public virtual ICollection<Programme> Programmes { get; } = new List<Programme>();

}

and i added a  in the context on create

       modelBuilder.Entity<ProgrammeResponsableProgramme>()
        .HasKey(bc => new { bc.ProgrammeId, bc.ResponsableProgrammeId });

when trying to execute i get this error
An unhandled exception occurred while processing the request.

so please how can i insert and update semilaire table to the one mentioned on top


问:
Unable to register the user in flutter using API (nodejs)
Getting an err in user registration through API in flutter.
Using postman I can successfully add user through deployed URL.

Error:

I/flutter (22622): 500 I/flutter (22622): POST
https://ecommerce-buer........../api/v1/user/register E/flutter
(22622): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled
Exception: NoSuchMethodError: The method '[]' was called on null.
E/flutter (22622): Receiver: null E/flutter (22622): Tried calling:
[]("success") E/flutter (22622): #0

Source Code:

```<code>doRegister(String username, String email, String password, String phoneno,
    String city) async {

  var res =
      await userRegister(username, email, password, phoneno, city);
  if (res['success']) {
    Navigator.pushReplacement(
        context, MaterialPageRoute(builder: (context) => LoginPage()));
  } else {

  }
}
</code>```
```<code>Future userRegister(String username, String email, String password, String phoneno,
String city) async {
print(username);
print(email);
print(password);
print(phoneno);
print(city);

final response = await http.post(
Uri.parse(
'...url.../api/v1/user/register'),
headers: {
"Accept": "Application/json"
},
body: {
'name': username,
'email': email,
'password': password,
"phoneno": phoneno,
"city": city,

    },

);

print(response.statusCode);
print(response.request);
if (response.statusCode == 200) {
    var decodedData = jsonDecode(response.body);
    return decodedData;
}
return null;
}
</code>```

Body:
Getting an err in user registration through API in flutter.
Using postman I can successfully add user through deployed URL.

Error:

I/flutter (22622): 500 I/flutter (22622): POST
https://ecommerce-buer........../api/v1/user/register E/flutter
(22622): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled
Exception: NoSuchMethodError: The method '[]' was called on null.
E/flutter (22622): Receiver: null E/flutter (22622): Tried calling:
[]("success") E/flutter (22622): #0

Source Code:

doRegister(String username, String email, String password, String phoneno,
    String city) async {

  var res =
      await userRegister(username, email, password, phoneno, city);
  if (res['success']) {
    Navigator.pushReplacement(
        context, MaterialPageRoute(builder: (context) => LoginPage()));
  } else {

  }
}

Future userRegister(String username, String email, String password, String phoneno,
String city) async {
print(username);
print(email);
print(password);
print(phoneno);
print(city);

final response = await http.post(
Uri.parse(
'...url.../api/v1/user/register'),
headers: {
"Accept": "Application/json"
},
body: {
'name': username,
'email': email,
'password': password,
"phoneno": phoneno,
"city": city,

    },

);

print(response.statusCode);
print(response.request);
if (response.statusCode == 200) {
    var decodedData = jsonDecode(response.body);
    return decodedData;
}
return null;
}


问:
PHP 8 error_reporting no warning
Since php 8 I'm having an issue with handling what logs should save to logs.
By setting the E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED value on php 7 as error_reporting, the warnings are excluded from the log.

By setting the same value in a domain with PHP 8 the warnings are still saved inside the log file, even by changing the value of error_reporting in the php.ini file.

In PHP 8 i have try without success:

```<code>E_ALL & ~E_WARNING  & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
E_ALL & ~E_WARNING & ~E_NOTICE & ~E_CORE_WARNING & ~E_COMPILE_WARNING & ~E_USER_WARNING & ~E_USER_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED
</code>```

I tried restarting all the services but the warnings keep getting saved in the logs for the php8, does anyone have any solution?

Title: PHP 8 error_reporting no warning

Body:
Since php 8 I'm having an issue with handling what logs should save to logs.
By setting the E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED value on php 7 as error_reporting, the warnings are excluded from the log.

By setting the same value in a domain with PHP 8 the warnings are still saved inside the log file, even by changing the value of error_reporting in the php.ini file.

In PHP 8 i have try without success:

E_ALL & ~E_WARNING  & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
E_ALL & ~E_WARNING & ~E_NOTICE & ~E_CORE_WARNING & ~E_COMPILE_WARNING & ~E_USER_WARNING & ~E_USER_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED

I tried restarting all the services but the warnings keep getting saved in the logs for the php8, does anyone have any solution?


问:
Next js v13 throwing 'Error during SSR Rendering' when I use useRouter() hook
```<code>'use-client';
import { useRouter } from 'next/router';
import React from 'react';
const Icon = () => {
  const router = useRouter();
  return (
    <div className="flex cursor-pointer flex-col items-center space-y-2">
      <div className={`h-1 w-10 rounded-sm border`} />
      <div className="h-1 w-10 rounded-sm border border-white bg-white" />
      <div className="h-1 w-10 rounded-sm border border-white bg-white" />
    </div>
  );
};

export default Icon;
</code>```

This is a basic Icon Component, and I want to use useRouter() to check pathname for some conditional styles but I am getting errors from the title.  Also, I don't have any page/component that is used SSR manually.

I am using the next 13.0.2 and app directory.

Body:
'use-client';
import { useRouter } from 'next/router';
import React from 'react';
const Icon = () => {
  const router = useRouter();
  return (

      <div className={`h-1 w-10 rounded-sm border`} />

  );
};

export default Icon;

This is a basic Icon Component, and I want to use useRouter() to check pathname for some conditional styles but I am getting errors from the title.  Also, I don't have any page/component that is used SSR manually.

I am using the next 13.0.2 and app directory.


问:
OS Error: Operation not permitted, errno = 1) even with MANAGE_EXTERNAL_STORAGE
I have an application that generates some PDFs and CSV files and at the moment I am saving these files into the files folder in the application directory of the Android phone. Then the user needs to manually move the files to another folder (for example Documents or Downloads).

I would like to save the file to the Documents or Download folder (one of the two, is the same) automatically at runtime, after the files are generated by the app. The target devices has Android 11 so I have any kind of problems with managing the external storage.

Android Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.app.example">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
...
...

```
<p>Permissions requested at startup:</p>
<pre class="lang-dart prettyprint-override"><code>  requestPermissions() async {
    try {
      await [
        Permission.storage,
        Permission.manageExternalStorage,
      ].request();
    } catch (e) {
      LoggerService().error("PERMISSIONS REQUEST ERROR", e.toString());
    }
  }
</code>```

Method that saves the files:

  Future<String> export(Uint8List pdf, {String? fileName}) async {
    Directory dir = Directory(EnvironmentService.documentsPath);
    String path = "${dir.path}/${fileName ?? "${uuid.v4()}.pdf"}";
    File file = File(path);
    await file.writeAsBytes(pdf);
    return path;
  }
```
<p>Path where I am trying to save the files:</p>
<pre class="lang-dart prettyprint-override"><code>static const String documentsPath = "/storage/emulated/0/Documents";
</code>```

When saving the file I always get OS Error: Operation not permitted, errno = 1) error, even if I have granted the MANAGE_EXTERNAL_STORAGE permission. The application will not be published on the Play Store, and needs to be working only on Android.

Any idea of what's happening?

Body:
I have an application that generates some PDFs and CSV files and at the moment I am saving these files into the files folder in the application directory of the Android phone. Then the user needs to manually move the files to another folder (for example Documents or Downloads).

I would like to save the file to the Documents or Download folder (one of the two, is the same) automatically at runtime, after the files are generated by the app. The target devices has Android 11 so I have any kind of problems with managing the external storage.

Android Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.app.example">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
...
...

Permissions requested at startup:

  requestPermissions() async {
    try {
      await [
        Permission.storage,
        Permission.manageExternalStorage,
      ].request();
    } catch (e) {
      LoggerService().error("PERMISSIONS REQUEST ERROR", e.toString());
    }
  }

Method that saves the files:

  Future<String> export(Uint8List pdf, {String? fileName}) async {
    Directory dir = Directory(EnvironmentService.documentsPath);
    String path = "${dir.path}/${fileName ?? "${uuid.v4()}.pdf"}";
    File file = File(path);
    await file.writeAsBytes(pdf);
    return path;
  }

Path where I am trying to save the files:

static const String documentsPath = "/storage/emulated/0/Documents";

When saving the file I always get OS Error: Operation not permitted, errno = 1) error, even if I have granted the MANAGE_EXTERNAL_STORAGE permission. The application will not be published on the Play Store, and needs to be working only on Android.

Any idea of what's happening?


问:
I want to implement Paytm Login flow into a Paytm Mini which builded with react js
i already tried this code which i found it in the Paytm Documentation

```<code>  const paytmLogin = () => {
    function ready(callback) {
      if (window.JSBridge) {
        callback && callback();
      } else {
        document.addEventListener("JSBridgeReady", callback, false);
      }
    }

    ready(function () {
      window["JSBridge"].call(
        "paytmFetchAuthCode",
        {
          clientId: "+++++++++++++++++++",
        },
        function (result) {
          console.log("hello there ");
          console.log(JSON.stringify(result));
        }
      );
    });
  };
</code>```

and i call this fucntion on click

```<code>      <div className="onBoarding-login-btn" onClick={() => paytmLogin()}>
        Login
      </div>
</code>```

but this not working it like i'm not clicking on any thing

Body:
i already tried this code which i found it in the Paytm Documentation

  const paytmLogin = () => {
    function ready(callback) {
      if (window.JSBridge) {
        callback && callback();
      } else {
        document.addEventListener("JSBridgeReady", callback, false);
      }
    }

    ready(function () {
      window["JSBridge"].call(
        "paytmFetchAuthCode",
        {
          clientId: "+++++++++++++++++++",
        },
        function (result) {
          console.log("hello there ");
          console.log(JSON.stringify(result));
        }
      );
    });
  };

and i call this fucntion on click

 paytmLogin()}>
        Login

but this not working it like i'm not clicking on any thing


问:
How to recover PostgreSQL 13.5 database without backup file in Ubuntu 20.04 server?
I had 10-15 microservices databases running in production on Ubuntu server.
 Accidentally deleted everything in the /var/lib/postgresql/** folder with command sudo rm -r *. I think PGDATA is inside the /var/lib/postgresql/13/ folder.

I tried TestDisk to restore this folder but it showed everything deleted except the 13/ folder.
I only have backup files from a long time ago.

Is there any way to restore the last data?


问:
Can I set a workspace specific alias, rc, or another dotfile for the Integrated Terminal in Visual Studio Code?
I've looked at the Terminal Profiles documentation but it looks like you can only set args here, not any commands to run like source $cwd/.vscode/.customrc or alias foo='foo cmd'. Any ideas? Trying to achieve specific aliases that only make sense for a single development environment/workspace.


问:
How to perform push/pull git operations over http with git2, and actix-web?
I'm writing a git server (a better term would be i've been trying to write a git server for a long time).

I'm writing it in rust, with actix-web and git2 (libgit2 bindings for rust).

As far as I understand from the documentation, the general process is as follows

1 the git client sends a first GET request to the URI repo.git/info/refs/ with the query '?service='.

2 the server processes this request and depending on the service query, returns to the git client the necessary information to carry out the second operation.

3 the git client with the response from the server prepares a second request in this case POST. To the URI repo.git/git-receive-pack with the changes it sends as payload for push operations; or the URI repo.git/git-upload-pack with the information of the changes that it requires as payload for fetch operations (pull/clone).

4 then the server processes the request and carries out the corresponding operation, and responds to git client with the result of operation.

Understanding this process and with some more information about git-receive-pack and git-send-pack, I have come up with something like this.

A route for handle first HTTP request:

///```bash
/// # fetch operation
/// git clone locahost:8080/git/my_repo.git
///
/// # post operation
/// git push locahost:8080/git/my_repo.git
///```
#[get("/{repo_name}.git/info/refs")]
async fn handshake(
    query: web::Query<Query>,
    path: web::Path<Path>,
    storage: web::Data<Storage>,
) -> HttpResponse {
    if let Some(path) = resolve_repo_path(&path.repo_name, &storage) {
        let mut info_refs_output = Command::new(&query.service)
            .arg("--http-backend-info-refs")
            .arg(&path)
            .output()
            .unwrap();

        let service = format!("# service={}\n", &query.service);
        let service = format!("00{:x}{}", service.len() + 4, service);

        let mut body = Vec::<u8>::new();

        body.append(&mut service.as_bytes().to_vec());
        body.append(&mut b"0000".to_vec());
        body.append(&mut info_refs_output.stdout);

        HttpResponse::Ok()
            .content_type(format!("application/x-{}-advertisement", &query.service,))
            .insert_header(("Cache-Control", "no-cache"))
            .body(body)
    } else {
        HttpResponse::NotFound().finish()
    }
}

fn resolve_repo_path<'u>(repo_name: &'u str, storage: &Storage) -> Option<String> {
    // resolves the path of the repo
}
```
<p>and the routes for handle the second HTTP request</p>
<pre class="lang-rust prettyprint-override"><code>// for push
#[post("/{repo_name}.git/git-receive-pack")]
async fn upload(
    mut payload: web::Payload,
    storage: web::Data<Storage>,
    path: web::Path<Path>,
) -> HttpResponse {
    if let Some(path) = resolve_repo_path(&path.repo_name, &storage) {
        let repo = git2::Repository::open_bare(&path).unwrap();
        //I'm stucked here!
        todo!()
    } else {
        HttpResponse::InternalServerError().finish()
    }
}

// for pull
#[post("/{repo_name}.git/git-upload-pack")]
async fn download(
    mut payload: web::Payload,
    storage: web::Data<Storage>,
    path: web::Path<Path>,
) -> HttpResponse {
    if let Some(path) = resolve_repo_path(&path.repo_name, &storage) {
        let repo = git2::Repository::open_bare(&path).unwrap();
        //I'm stucked here!
        todo!()
    } else {
        HttpResponse::InternalServerError().finish()
    }
}
</code>```

And that is all. I'm stuck here I have the two routes to handle the second HTTP request, in both cases I have both the bare repository and the payload sent by the git client, but I don't know what to do with them, I don't know how to perform the push/pull operations per se.

The documentation in both git and libgit2 does not talk much about how these operations are performed. It only says that when the client invokes the service to the server both processes connect and it is as if everything happens in an opaque way.

How can I perform the operations per se, with the bare repository and the payload sent by git client?, Can anyone see what I'm missing?

The first route works fine and I can get the git client to make the second request. The problem is that I can't find the way to carry out the operations per se

Body:
I'm writing a git server (a better term would be i've been trying to write a git server for a long time).

I'm writing it in rust, with actix-web and git2 (libgit2 bindings for rust).

As far as I understand from the documentation, the general process is as follows

1 the git client sends a first GET request to the URI repo.git/info/refs/ with the query '?service='.

2 the server processes this request and depending on the service query, returns to the git client the necessary information to carry out the second operation.

3 the git client with the response from the server prepares a second request in this case POST. To the URI repo.git/git-receive-pack with the changes it sends as payload for push operations; or the URI repo.git/git-upload-pack with the information of the changes that it requires as payload for fetch operations (pull/clone).

4 then the server processes the request and carries out the corresponding operation, and responds to git client with the result of operation.

Understanding this process and with some more information about git-receive-pack and git-send-pack, I have come up with something like this.

A route for handle first HTTP request:

///```bash
/// # fetch operation
/// git clone locahost:8080/git/my_repo.git
///
/// # post operation
/// git push locahost:8080/git/my_repo.git
///```
#[get("/{repo_name}.git/info/refs")]
async fn handshake(
    query: web::Query<Query>,
    path: web::Path<Path>,
    storage: web::Data<Storage>,
) -> HttpResponse {
    if let Some(path) = resolve_repo_path(&path.repo_name, &storage) {
        let mut info_refs_output = Command::new(&query.service)
            .arg("--http-backend-info-refs")
            .arg(&path)
            .output()
            .unwrap();

        let service = format!("# service={}\n", &query.service);
        let service = format!("00{:x}{}", service.len() + 4, service);

        let mut body = Vec::<u8>::new();

        body.append(&mut service.as_bytes().to_vec());
        body.append(&mut b"0000".to_vec());
        body.append(&mut info_refs_output.stdout);

        HttpResponse::Ok()
            .content_type(format!("application/x-{}-advertisement", &query.service,))
            .insert_header(("Cache-Control", "no-cache"))
            .body(body)
    } else {
        HttpResponse::NotFound().finish()
    }
}

fn resolve_repo_path<'u>(repo_name: &'u str, storage: &Storage) -> Option<String> {
    // resolves the path of the repo
}

and the routes for handle the second HTTP request

// for push
#[post("/{repo_name}.git/git-receive-pack")]
async fn upload(
    mut payload: web::Payload,
    storage: web::Data<Storage>,
    path: web::Path<Path>,
) -> HttpResponse {
    if let Some(path) = resolve_repo_path(&path.repo_name, &storage) {
        let repo = git2::Repository::open_bare(&path).unwrap();
        //I'm stucked here!
        todo!()
    } else {
        HttpResponse::InternalServerError().finish()
    }
}

// for pull
#[post("/{repo_name}.git/git-upload-pack")]
async fn download(
    mut payload: web::Payload,
    storage: web::Data<Storage>,
    path: web::Path<Path>,
) -> HttpResponse {
    if let Some(path) = resolve_repo_path(&path.repo_name, &storage) {
        let repo = git2::Repository::open_bare(&path).unwrap();
        //I'm stucked here!
        todo!()
    } else {
        HttpResponse::InternalServerError().finish()
    }
}

And that is all. I'm stuck here I have the two routes to handle the second HTTP request, in both cases I have both the bare repository and the payload sent by the git client, but I don't know what to do with them, I don't know how to perform the push/pull operations per se.

The documentation in both git and libgit2 does not talk much about how these operations are performed. It only says that when the client invokes the service to the server both processes connect and it is as if everything happens in an opaque way.

How can I perform the operations per se, with the bare repository and the payload sent by git client?, Can anyone see what I'm missing?

The first route works fine and I can get the git client to make the second request. The problem is that I can't find the way to carry out the operations per se


问:
Dynamic css font-size on a html div
I have a text in an html div and this div I can resize. I wanted the font size of the div to shrink as I resize it. Could I do this using only css?

I've tried using VW css but this is page related and not what I would like.

```<code>font-size: 3.5vw;
</code>```

Title: Dynamic css font-size on a html div

Body:
I have a text in an html div and this div I can resize. I wanted the font size of the div to shrink as I resize it. Could I do this using only css?

I've tried using VW css but this is page related and not what I would like.

font-size: 3.5vw;


问:
dotnet convert controller route api to minimal web api
I am trying to convert a route from an old controller based api to a new dotnet7 api, however for some reason the temporary endpoint is not being hold. The basic idea is to create a temporary endpoint inside the main endpoint, and if no one calls this endpoint, then it breaks the function. This has been so far experimental but we would like to see if we could put this to work.

Can someone help me converting this code?

old code:

```<code>public class EndpointController : ControllerBase
{
    private bool endpointCalled = false;
    private HttpListener listener;

    [HttpGet]
    public IActionResult Endpoint1()
    {
        listener = new HttpListener();
        listener.Prefixes.Add("http://localhost:7195/");
        listener.Start();

        // Create a temporary POST endpoint
        listener.BeginGetContext(new AsyncCallback(Endpoint2), listener);

        // Close the endpoint after 20 seconds if it has not been called
        var timer = new Timer(20000);
        timer.Elapsed += CloseEndpoint;
        timer.Start();

        return Results.Ok(new { message = "Endpoint2 created" });
    }

    private void Endpoint2(IAsyncResult result)
    {
        var context = listener.EndGetContext(result);
        var request = context.Request;
        var response = context.Response;

        string responseString = "<HTML><BODY> Hello from Endpoint2!</BODY></HTML>";
        byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
        response.ContentLength64 = buffer.Length;
        System.IO.Stream output = response.OutputStream;
        output.Write(buffer, 0, buffer.Length);
        output.Close();

        endpointCalled = true;
    }

    private void CloseEndpoint(object sender, ElapsedEventArgs e)
    {
        if (!endpointCalled)
        {
            listener.Stop();
        }
    }
}
</code>```

new code:

```<code>app.MapPost("/supplier/listen2", () =>
{
    bool endpointCalled = false;
    HttpListener listener = new HttpListener();

    listener.Prefixes.Add("http://localhost:7195/testi2/");
    listener.Start();

    listener.BeginGetContext(new AsyncCallback(Endpoint2), listener);
    var timer = new System.Timers.Timer(20000);
    timer.Elapsed += CloseEndpoint;
    timer.Start();

    void Endpoint2(IAsyncResult result)
    {
        var listener = (HttpListener)result.AsyncState;
        var context = listener.EndGetContext(result);
        var request = context.Request;
        var response = context.Response;

        string responseString = "<HTML><BODY> Hello from Endpoint2!</BODY></HTML>";
        byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
        response.ContentLength64 = buffer.Length;
        System.IO.Stream output = response.OutputStream;
        output.Write(buffer, 0, buffer.Length);
        output.Close();

        endpointCalled = true;
    }

    void CloseEndpoint(object sender, System.Timers.ElapsedEventArgs e)
    {
        if (!endpointCalled)
        {
            listener.Stop();
        }
    }

    return Results.Ok(new { message = "Endpoint2 created" });

    // return Results.Ok(new { token = "-1" });
});
</code>```

UPDATE:

Ok, there was an error before because I wrote the wrong port. Now I get an error because the listener is calling the already open door:

System.Net.HttpListenerException (48): Address already in use

Any tips to solve this?

Body:
I am trying to convert a route from an old controller based api to a new dotnet7 api, however for some reason the temporary endpoint is not being hold. The basic idea is to create a temporary endpoint inside the main endpoint, and if no one calls this endpoint, then it breaks the function. This has been so far experimental but we would like to see if we could put this to work.

Can someone help me converting this code?

old code:

public class EndpointController : ControllerBase
{
    private bool endpointCalled = false;
    private HttpListener listener;

    [HttpGet]
    public IActionResult Endpoint1()
    {
        listener = new HttpListener();
        listener.Prefixes.Add("http://localhost:7195/");
        listener.Start();

        // Create a temporary POST endpoint
        listener.BeginGetContext(new AsyncCallback(Endpoint2), listener);

        // Close the endpoint after 20 seconds if it has not been called
        var timer = new Timer(20000);
        timer.Elapsed += CloseEndpoint;
        timer.Start();

        return Results.Ok(new { message = "Endpoint2 created" });
    }

    private void Endpoint2(IAsyncResult result)
    {
        var context = listener.EndGetContext(result);
        var request = context.Request;
        var response = context.Response;

        string responseString = " Hello from Endpoint2!";
        byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
        response.ContentLength64 = buffer.Length;
        System.IO.Stream output = response.OutputStream;
        output.Write(buffer, 0, buffer.Length);
        output.Close();

        endpointCalled = true;
    }

    private void CloseEndpoint(object sender, ElapsedEventArgs e)
    {
        if (!endpointCalled)
        {
            listener.Stop();
        }
    }
}

new code:

app.MapPost("/supplier/listen2", () =>
{
    bool endpointCalled = false;
    HttpListener listener = new HttpListener();

    listener.Prefixes.Add("http://localhost:7195/testi2/");
    listener.Start();

    listener.BeginGetContext(new AsyncCallback(Endpoint2), listener);
    var timer = new System.Timers.Timer(20000);
    timer.Elapsed += CloseEndpoint;
    timer.Start();

    void Endpoint2(IAsyncResult result)
    {
        var listener = (HttpListener)result.AsyncState;
        var context = listener.EndGetContext(result);
        var request = context.Request;
        var response = context.Response;

        string responseString = " Hello from Endpoint2!";
        byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
        response.ContentLength64 = buffer.Length;
        System.IO.Stream output = response.OutputStream;
        output.Write(buffer, 0, buffer.Length);
        output.Close();

        endpointCalled = true;
    }

    void CloseEndpoint(object sender, System.Timers.ElapsedEventArgs e)
    {
        if (!endpointCalled)
        {
            listener.Stop();
        }
    }

    return Results.Ok(new { message = "Endpoint2 created" });

    // return Results.Ok(new { token = "-1" });
});

UPDATE:

Ok, there was an error before because I wrote the wrong port. Now I get an error because the listener is calling the already open door:

System.Net.HttpListenerException (48): Address already in use

Any tips to solve this?


问:
Firebase Cloud Messaging, should I do anything for a production environment?
I am using FCM Cloud Messaging and I am preparing for launching an application. On the internet, I read things like a sandbox and production certification key (the p8 file). I can not choose between a sandbox and production key when creating a new p8 file through Apple.

I can set the environment type in Firebase, but according to the docs, that does not do anything internally different. Clients apparently can switch at runtime to determine if its a production build or not: How does Firebase Cloud Messaging (FCM) switch the environment of Apple Push Notification service (APNs)?

My question is regarding server side sending push notifications to FCM.

I have a server which sends push notifications through FCM. My question is: does everything works out of the box when going into production? I mean the clients just receive the message, how does FCM know when it receives a new push notification from my server to send it to the sandbox endpoint or production endpoint?


问:
Unity Ads working fine on Unity Editor (pc) but not in Android phone
I have made a banner ad by using Unity Ads. In my pc seems to be working fine, but when I export it to my android phone no ad is shown. Any idea how to solve this?
This is the code that I am using:
(I did not put the actual app id due to privacy)

public class AdsManager : MonoBehaviour
{
    string appId = "....";

    void Start()
    {
        Advertisement.Initialize(appId);
    }

    void Update()
    {
        ShowBanner();
    }

    void ShowBanner()
    {
        Advertisement.Banner.Show("Banner_Android");
    }
}
```

I read the documentation, whatched Youtube tutorials, tryied to use a corroutine

Body:
I have made a banner ad by using Unity Ads. In my pc seems to be working fine, but when I export it to my android phone no ad is shown. Any idea how to solve this?
This is the code that I am using:
(I did not put the actual app id due to privacy)

public class AdsManager : MonoBehaviour
{
    string appId = "....";

    void Start()
    {
        Advertisement.Initialize(appId);
    }

    void Update()
    {
        ShowBanner();
    }

    void ShowBanner()
    {
        Advertisement.Banner.Show("Banner_Android");
    }
}

I read the documentation, whatched Youtube tutorials, tryied to use a corroutine


问:
Discord.js client.on(Events.InteractionCreate) blocks after 2 commands instead of queueing them all
Why does Discord.js client.on(Events.InteractionCreate) blocks after 2 commands instead of queueing them all even though, I am using all async functions and awaiting the execution of the command every time? How do I make it so that it handles the next one as soon as the previous one is awaiting?
The commands I'm running are async and needs to wait for io tasks to finish anyways so it makes sense to batch them instead of only doing 2 at a time.

I've tried everything from making all the functions asynchronous and awaiting when necessary... still does not work

```<code>client.on(Events.InteractionCreate, async (interaction: any) => {
console.log("new interaction");
if (!interaction.isChatInputCommand()) return;

const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
  console.error(
    `No command matching ${interaction.commandName} was found.`
  );
  return;
}

try {
  // await command.execute(interaction, { addToQueue });
  await command.execute(interaction);
} catch (error) {
  console.error(error);

  try {
    await interaction.reply({
      content: "There was an error while executing this command!",
      ephemeral: true,
    });
  } catch (error) {}
}
});
</code>```

Body:
Why does Discord.js client.on(Events.InteractionCreate) blocks after 2 commands instead of queueing them all even though, I am using all async functions and awaiting the execution of the command every time? How do I make it so that it handles the next one as soon as the previous one is awaiting?
The commands I'm running are async and needs to wait for io tasks to finish anyways so it makes sense to batch them instead of only doing 2 at a time.

I've tried everything from making all the functions asynchronous and awaiting when necessary... still does not work

client.on(Events.InteractionCreate, async (interaction: any) => {
console.log("new interaction");
if (!interaction.isChatInputCommand()) return;

const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
  console.error(
    `No command matching ${interaction.commandName} was found.`
  );
  return;
}

try {
  // await command.execute(interaction, { addToQueue });
  await command.execute(interaction);
} catch (error) {
  console.error(error);

  try {
    await interaction.reply({
      content: "There was an error while executing this command!",
      ephemeral: true,
    });
  } catch (error) {}
}
});


问:
Access Form VBA to loop through query and send email to multiple recipients
I am trying to loop through a query of email address and send one email to each address. I've worked on this for several days now trying to figure out where I'm going wrong. I've tried changing this many times.

One email will send to the top recipient listed, but fails to send to other recipients. The error when debugging highlights the ".To" line. Any help is appreciated.

```<code>Private Sub SubmitRequest_Click() 'Send Email

'On Error GoTo ErrorHandler

        DoCmd.RunCommand acCmdSaveRecord

        'This is to establish the dataset that I want to evaluate
        Dim db As Database
        Dim rst As DAO.Recordset

        ' This is to set the values of the current database that I'm looping through and the dataset that I'm adding to
        Set db = CurrentDb
        Set rst = db.OpenRecordset("qryEmployeeActEmail")

        'The email uses outlook application
        Dim appOutlook As Outlook.Application
        Dim MailOutlook As Outlook.MailItem
        Dim sendto As String

        Set appOutlook = CreateObject("Outlook.Application")
        Set MailOutlook = appOutlook.CreateItem(olMailItem)

        'These are fields used in the body of email
        Dim MAINTENANCEID As Variant
        Dim REQUESTDATETIME As Variant
        Dim ORDER1 As String
        Dim INMATEREQUEST1 As String
        Dim REQUESTOR1 As String
        Dim LOCATION1 As String
        Dim SECTION1 As String
        Dim SECTIONROOM1 As String

        MAINTENANCEID = Me.MAINTENANCE_ID
        REQUESTDATETIME = Me.REQUESTDATETIME
        ORDER1 = Me.ORDER1
        LOCATION1 = Me.LOCATION1
        SECTION1 = Me.SECTION1
        SECTIONROOM1 = Me.SECTIONROOM1
        INMATEREQUEST1 = Me.INMATEREQUEST1
        REQUESTOR = Me.REQUESTOR
        sendto = rst.Fields("EMPEMAIL").Value  ' previously had this set to "rst!EMPEMAIL"

' This is to ensure that I'm starting on the first record in the dataset to evaluate
        rst.MoveLast
        rst.MoveFirst

' This do loop will run until the endo of file on the dataset that I'm evaluating

        Do Until rst.EOF

            With MailOutlook

              .To = sendto
              .Subject = "New MTS Request"

              .Body = "New MTS Request" & Chr$(10) & Chr$(10) _
                  & "Requested by: " & REQUESTOR & Chr$(10) & Chr$(10) _
                  & "System ID: " & MAINTENANCEID & Chr$(10) _
                  & "Date: " & REQUESTDATETIME & Chr$(10) _
                  & "Location: " & LOCATION1 & Chr$(10) _
                  & "Section: " & SECTION1 & Chr$(10) _
                  & "Room: " & SECTIONROOM1 & Chr$(10) _
                  & "Inmate Requesting: " & INMATEREQUEST1 & Chr$(10) & Chr$(10) _
                  & "Issue: " & Me.ORDER1 & Chr$(10) & Chr$(10) _
                  & "This is an automatic email. Do not reply."

              .Send

            End With
            'end here with things to do

        'This record has been evaluated now this code is moving to the next record in the evaluated dataset
            rst.MoveNext

        Loop

            rst.Close
            db.Close
            Set rst = Nothing
            Set db = Nothing

            Set MailOutlook = Nothing
            Set appOutlook = Nothing

            DoCmd.Requery ""
            MsgBox "Thank You, your submission was succesful!", vbOKOnly, "Successful Entry"

'ErrorHandler:
       ' DoCmd.Requery ""
       ' MsgBox "Thank You,your submission was succesful!", vbOKOnly, "Successful Entry"

End Sub

</code>```

The solution which works for my task was to loop through the query and create a string of emails, then send one email with the string in the .To line. Thanks for all of the help. Snippet of the changes below. I changed "sendto" to "strEmail"

```<code>       With rst
    Do While Not rst.EOF
        strEmail = strEmail & rst![EMPEMAIL] & ";"
        .MoveNext
    Loop
    End With

        With MailOutlook

          .To = Left$(strEmail, Len(strEmail) - 1) 'Remove Trailing ;
          .Subject = "New MTS Request"

          .Body = "New MTS Request" & Chr$(10) & Chr$(10) _
              & "Requested by: " & REQUESTOR & Chr$(10) & Chr$(10) _
              & "System ID: " & MAINTENANCEID & Chr$(10) _
              & "Date: " & REQUESTDATETIME & Chr$(10) _
              & "Location: " & LOCATION1 & Chr$(10) _
              & "Section: " & SECTION1 & Chr$(10) _
              & "Room: " & SECTIONROOM1 & Chr$(10) _
              & "Inmate Requesting: " & INMATEREQUEST1 & Chr$(10) & Chr$(10) _
              & "Issue: " & Me.ORDER1 & Chr$(10) & Chr$(10) _
              & "This is an automatic email. Do not reply."

          .Send
          '.Display

        End With
</code>```

Body:
I am trying to loop through a query of email address and send one email to each address. I've worked on this for several days now trying to figure out where I'm going wrong. I've tried changing this many times.

One email will send to the top recipient listed, but fails to send to other recipients. The error when debugging highlights the ".To" line. Any help is appreciated.

Private Sub SubmitRequest_Click() 'Send Email

'On Error GoTo ErrorHandler

        DoCmd.RunCommand acCmdSaveRecord

        'This is to establish the dataset that I want to evaluate
        Dim db As Database
        Dim rst As DAO.Recordset

        ' This is to set the values of the current database that I'm looping through and the dataset that I'm adding to
        Set db = CurrentDb
        Set rst = db.OpenRecordset("qryEmployeeActEmail")

        'The email uses outlook application
        Dim appOutlook As Outlook.Application
        Dim MailOutlook As Outlook.MailItem
        Dim sendto As String

        Set appOutlook = CreateObject("Outlook.Application")
        Set MailOutlook = appOutlook.CreateItem(olMailItem)

        'These are fields used in the body of email
        Dim MAINTENANCEID As Variant
        Dim REQUESTDATETIME As Variant
        Dim ORDER1 As String
        Dim INMATEREQUEST1 As String
        Dim REQUESTOR1 As String
        Dim LOCATION1 As String
        Dim SECTION1 As String
        Dim SECTIONROOM1 As String

        MAINTENANCEID = Me.MAINTENANCE_ID
        REQUESTDATETIME = Me.REQUESTDATETIME
        ORDER1 = Me.ORDER1
        LOCATION1 = Me.LOCATION1
        SECTION1 = Me.SECTION1
        SECTIONROOM1 = Me.SECTIONROOM1
        INMATEREQUEST1 = Me.INMATEREQUEST1
        REQUESTOR = Me.REQUESTOR
        sendto = rst.Fields("EMPEMAIL").Value  ' previously had this set to "rst!EMPEMAIL"

' This is to ensure that I'm starting on the first record in the dataset to evaluate
        rst.MoveLast
        rst.MoveFirst

' This do loop will run until the endo of file on the dataset that I'm evaluating

        Do Until rst.EOF

            With MailOutlook

              .To = sendto
              .Subject = "New MTS Request"

              .Body = "New MTS Request" & Chr$(10) & Chr$(10) _
                  & "Requested by: " & REQUESTOR & Chr$(10) & Chr$(10) _
                  & "System ID: " & MAINTENANCEID & Chr$(10) _
                  & "Date: " & REQUESTDATETIME & Chr$(10) _
                  & "Location: " & LOCATION1 & Chr$(10) _
                  & "Section: " & SECTION1 & Chr$(10) _
                  & "Room: " & SECTIONROOM1 & Chr$(10) _
                  & "Inmate Requesting: " & INMATEREQUEST1 & Chr$(10) & Chr$(10) _
                  & "Issue: " & Me.ORDER1 & Chr$(10) & Chr$(10) _
                  & "This is an automatic email. Do not reply."

              .Send

            End With
            'end here with things to do

        'This record has been evaluated now this code is moving to the next record in the evaluated dataset
            rst.MoveNext

        Loop

            rst.Close
            db.Close
            Set rst = Nothing
            Set db = Nothing

            Set MailOutlook = Nothing
            Set appOutlook = Nothing

            DoCmd.Requery ""
            MsgBox "Thank You, your submission was succesful!", vbOKOnly, "Successful Entry"

'ErrorHandler:
       ' DoCmd.Requery ""
       ' MsgBox "Thank You,your submission was succesful!", vbOKOnly, "Successful Entry"

End Sub

The solution which works for my task was to loop through the query and create a string of emails, then send one email with the string in the .To line. Thanks for all of the help. Snippet of the changes below. I changed "sendto" to "strEmail"

       With rst
    Do While Not rst.EOF
        strEmail = strEmail & rst![EMPEMAIL] & ";"
        .MoveNext
    Loop
    End With

        With MailOutlook

          .To = Left$(strEmail, Len(strEmail) - 1) 'Remove Trailing ;
          .Subject = "New MTS Request"

          .Body = "New MTS Request" & Chr$(10) & Chr$(10) _
              & "Requested by: " & REQUESTOR & Chr$(10) & Chr$(10) _
              & "System ID: " & MAINTENANCEID & Chr$(10) _
              & "Date: " & REQUESTDATETIME & Chr$(10) _
              & "Location: " & LOCATION1 & Chr$(10) _
              & "Section: " & SECTION1 & Chr$(10) _
              & "Room: " & SECTIONROOM1 & Chr$(10) _
              & "Inmate Requesting: " & INMATEREQUEST1 & Chr$(10) & Chr$(10) _
              & "Issue: " & Me.ORDER1 & Chr$(10) & Chr$(10) _
              & "This is an automatic email. Do not reply."

          .Send
          '.Display

        End With


问:
Clone websites with HTTrack that use cloudflare
Everytime I try to download websites that use Cloudflare it HTTrack is giving me an error message that says that the mirror is empty, I suppose this is the case because it tries to copy the bot protection website instead of the real one.
Is there anyway to still clone the website?

I hope there is some kind of bypass for this


问:
Update type definition
I'm using Phaser3 with typescript and came across a typescript issue when using plugins. The plugin is adding properties to an existing object, but typescript can't infer this.

this.sys.animatedTiles.init(map);
```
<p>In the example above, <code>animatedTiles</code> was added via a plugin, but it won't compile since typescript is not aware of it. To make it work, I have to do this:</p>
<pre class="lang-js prettyprint-override"><code>// @ts-ignore
this.sys.animatedTiles.init(map);
</code>```

Everything works but it's not pretty, and I won't have intellisense.

How can I update a type definition in typescript?

EDIT: my temporary(?) solution:

I created a class that extends Systems

export class Systems extends Phaser.Scenes.Systems {
    public animatedTiles: AnimatedTiles | undefined;
}
```
<p>Where <code>AnimatedTiles</code> is an interface containing properties and methods of the plugin.</p>
<p>And use it like this:</p>
<pre class="lang-js prettyprint-override"><code>private get systems(): Systems {
    return this.sys as Systems;
}

...

this.systems.animatedTiles?.init(map);
</code>```

Title: Update type definition

Body:
I'm using Phaser3 with typescript and came across a typescript issue when using plugins. The plugin is adding properties to an existing object, but typescript can't infer this.

this.sys.animatedTiles.init(map);

In the example above, animatedTiles was added via a plugin, but it won't compile since typescript is not aware of it. To make it work, I have to do this:

// @ts-ignore
this.sys.animatedTiles.init(map);

Everything works but it's not pretty, and I won't have intellisense.

How can I update a type definition in typescript?

EDIT: my temporary(?) solution:

I created a class that extends Systems

export class Systems extends Phaser.Scenes.Systems {
    public animatedTiles: AnimatedTiles | undefined;
}

Where AnimatedTiles is an interface containing properties and methods of the plugin.

And use it like this:

private get systems(): Systems {
    return this.sys as Systems;
}

...

this.systems.animatedTiles?.init(map);


问:
How to start Prometheus logging things?
Recently I've installed Grafana and Prometheus on the server to have some monitoring dashboard.

I've added some dashboards:

But there is no data for almost all of them. You can see some of the dashboards screenshot:

See? All are in No Data status. Since they are based on Prometheus, so I guess I need to make Prometheus force to start logging things. Any idea how can I do that?

Noted that, I've also added MySQL database as another data source and wrote some queries on the tables and it works well and I can see this dashboard:

Also, here is the content of current prometheus.yml file:

```<code># my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]
</code>```

Title: How to start Prometheus logging things?

Body:
Recently I've installed Grafana and Prometheus on the server to have some monitoring dashboard.

I've added some dashboards:

But there is no data for almost all of them. You can see some of the dashboards screenshot:

See? All are in No Data status. Since they are based on Prometheus, so I guess I need to make Prometheus force to start logging things. Any idea how can I do that?

Noted that, I've also added MySQL database as another data source and wrote some queries on the tables and it works well and I can see this dashboard:

Also, here is the content of current prometheus.yml file:

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]


问:
How to shift a Bootstrap form over to the right?
I am doing an inventory management page for my school project, and currently, the form whihroducts is shifted to the left.

How it looks like:

{% extends "base.html" %}
{% block title %}Adding a new product{% endblock %}

{% block content %}
{% from "includes/formHelper.html" import render_field %}

Add new product

<form method="POST" action="">

            {{ render_field(form.name, class="form-control") }}

             {{ render_fiel       {{ render_field(form.type, class="form-control") }}

d(form.stock, class="form-control") }}

        {{ render_field(form.price, class="form-control") }}

    <input type="submit" value="Submit" class="btn btn-success btn-lg float-left">
</form>
```

I tried using CSS to float-right and row-reverse the entire form to the right of the page, but it still does not work out.

Body:
I am doing an inventory management page for my school project, and currently, the form whihroducts is shifted to the left.

How it looks like:

{% extends "base.html" %}
{% block title %}Adding a new product{% endblock %}

{% block content %}
{% from "includes/formHelper.html" import render_field %}

Add new product

<form method="POST" action="">

            {{ render_field(form.name, class="form-control") }}

             {{ render_fiel       {{ render_field(form.type, class="form-control") }}

d(form.stock, class="form-control") }}

        {{ render_field(form.price, class="form-control") }}

    <input type="submit" value="Submit" class="btn btn-success btn-lg float-left">
</form>

I tried using CSS to float-right and row-reverse the entire form to the right of the page, but it still does not work out.


问:
Customize Control Template Avalonia
Simple question: how to change the standart control template in Avalonia, e.g. visual effect when Click to control.

I tried to find a standard template to change it like WPF, but I didn't find any information about it.

Title: Customize Control Template Avalonia


问:
Why does web3py transtactions not work in my code?
```<code>from web3 import Web3
import requests

*i have also connect to a node provider before this function.

def buy_coin_token():
    from_acc = str(input("Sender acc:"))
    private_key = str(input("Senders private key:"))
    to_acc = str(input("Receiver acc/contract address:"))
    amount_to_send = input("Amount to send:")
    gas = int(input("Gas:"))
    gas_price = int(input("Gas price:"))
    nonce = w3.eth.getTransactionCount(from_acc)
    tx = {
        'nonce': nonce,
        'to': to_acc,
        'value': amount_to_send,
        'gas': gas,
        'gasPrice': gas_price
    }
    signed_tx = w3.eth.account.signTransaction(tx, private_key)
    tx_hash = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
    print("Your transactions has is "+(tx_hash))
</code>```

I am trying to make a transaction on the bsc and i keep bumping into the same error:

TypeError: Transaction had invalid fields: {'value': '0.005'}

I have turning it into and int, float, and str, and I also though of doing the toWei function but I am afraid that it wont work and that it will send more that its supposed to.

I also want to test it into a bsc test network

Body:
from web3 import Web3
import requests

*i have also connect to a node provider before this function.

def buy_coin_token():
    from_acc = str(input("Sender acc:"))
    private_key = str(input("Senders private key:"))
    to_acc = str(input("Receiver acc/contract address:"))
    amount_to_send = input("Amount to send:")
    gas = int(input("Gas:"))
    gas_price = int(input("Gas price:"))
    nonce = w3.eth.getTransactionCount(from_acc)
    tx = {
        'nonce': nonce,
        'to': to_acc,
        'value': amount_to_send,
        'gas': gas,
        'gasPrice': gas_price
    }
    signed_tx = w3.eth.account.signTransaction(tx, private_key)
    tx_hash = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
    print("Your transactions has is "+(tx_hash))

I am trying to make a transaction on the bsc and i keep bumping into the same error:

TypeError: Transaction had invalid fields: {'value': '0.005'}

I have turning it into and int, float, and str, and I also though of doing the toWei function but I am afraid that it wont work and that it will send more that its supposed to.

I also want to test it into a bsc test network


问:
Docker containers can't connect to mysql container
so I'm new to docker and now I'm trying to connect my php, and adminer service to mysql service. Here is my docker-compose file.

```<code>version: '3.1'

services:
  php:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./html:/var/www/html
    ports:
      - 80:80

  db:
    image: mysql:5.7
    volumes:
      - ./mysql:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: test
      MYSQL_USER: test
      MYSQL_PASSWORD: test
    ports:
      - 3360:3306

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
</code>```

After I ran the docker-compose up -d command, I opened adminer (localhost:8080) and fill the server field with 'db', username with 'test', password with 'test', database with 'test'. Then I clicked login but I got Connection timed out message, I can't login to the mysql service. The mysql service logs showed that the 'mysqld: ready for connections' already. Any ideas where I did it wrong? thank you :)

Body:
so I'm new to docker and now I'm trying to connect my php, and adminer service to mysql service. Here is my docker-compose file.

version: '3.1'

services:
  php:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./html:/var/www/html
    ports:
      - 80:80

  db:
    image: mysql:5.7
    volumes:
      - ./mysql:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: test
      MYSQL_USER: test
      MYSQL_PASSWORD: test
    ports:
      - 3360:3306

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

After I ran the docker-compose up -d command, I opened adminer (localhost:8080) and fill the server field with 'db', username with 'test', password with 'test', database with 'test'. Then I clicked login but I got Connection timed out message, I can't login to the mysql service. The mysql service logs showed that the 'mysqld: ready for connections' already. Any ideas where I did it wrong? thank you :)


问:
Include an interactive plot (wordcloud) in a dashboard
I created an interactive dashboard using hvPlot .interactive and Panel:

```<code>template = pn.template.FastListTemplate(
title='Central Africa - Word Frequency Analysis',
sidebar=['Frequency' , yaxis],
main=[ihvplot.panel(), ipanel.panel()],
accent_base_color="#88d8b0",
header_background="#88d8b0",
sidebar_width=450,
theme='dark',
)
template.show()
</code>```

Where ivplot and ipanel are my interactive plot and table, respectively. However, I would like to put instead of the table, an interactive wordcloud which I created using ipywidgets:

```<code>list1 = ['Corbeau News','Journal de Bangui','Le Potentiel','Ndjoni Sango','RJDH','Radio
Lengo Songo','Radio Ndeke Luka']
def makingclouds(Category,frame,col,atitle):
   wordcloud_bangui = WordCloud(stopwords= stopword , width=1600 , height=800 ,
   background_color="black",
   colormap="Set2").generate(''.join(data_file_1['Content']))
plt.figure(figsize=(20,10),facecolor='k')
plt.title(atitle, fontsize=40)#,fontweight="bold")
plt.imshow(wordcloud_bangui, interpolation="bilinear")
plt.axis("off")
plt.tight_layout(pad=0)

wordcloud = interact(makingclouds, Category=list1, df=fixed(data_file_1),
col=fixed('Content'),
     atitle=fixed('Most used words media - Central Africa'),
frame=fixed(data_file_1[['Source','Content']]))
</code>```

My question is how can I do it. I've tried simply to put 'wordcloud' instead of itable in the 4th line of the first piece of code but it tells me that the object does not have a function panel.
What can I do?

Body:
I created an interactive dashboard using hvPlot .interactive and Panel:

template = pn.template.FastListTemplate(
title='Central Africa - Word Frequency Analysis',
sidebar=['Frequency' , yaxis],
main=[ihvplot.panel(), ipanel.panel()],
accent_base_color="#88d8b0",
header_background="#88d8b0",
sidebar_width=450,
theme='dark',
)
template.show()

Where ivplot and ipanel are my interactive plot and table, respectively. However, I would like to put instead of the table, an interactive wordcloud which I created using ipywidgets:

list1 = ['Corbeau News','Journal de Bangui','Le Potentiel','Ndjoni Sango','RJDH','Radio
Lengo Songo','Radio Ndeke Luka']
def makingclouds(Category,frame,col,atitle):
   wordcloud_bangui = WordCloud(stopwords= stopword , width=1600 , height=800 ,
   background_color="black",
   colormap="Set2").generate(''.join(data_file_1['Content']))
plt.figure(figsize=(20,10),facecolor='k')
plt.title(atitle, fontsize=40)#,fontweight="bold")
plt.imshow(wordcloud_bangui, interpolation="bilinear")
plt.axis("off")
plt.tight_layout(pad=0)

wordcloud = interact(makingclouds, Category=list1, df=fixed(data_file_1),
col=fixed('Content'),
     atitle=fixed('Most used words media - Central Africa'),
frame=fixed(data_file_1[['Source','Content']]))

My question is how can I do it. I've tried simply to put 'wordcloud' instead of itable in the 4th line of the first piece of code but it tells me that the object does not have a function panel.
What can I do?


问:
React google maps API how to make the marker icon fixed size
I've a google map with some markers, but when I zoom in and out the marker icon size changes, is there any way to make that size fixed?

```<code>    const [markers,setMarkers] = useState([])

 function generaMarker(elementolo,index){
      var mark = <Marker  draggable={modify===true?true:false} onDragEnd={(e)=>modify===true?handleSpostamentoMarker(e,index):null} onClick={(e)=>eliminate===true?deleteMarker(e,index):handleClickEl(elementolo)}  label={elementolo.Nome} title={elementolo.Nome} icon={{url:getIcon(elementolo),s : new window.google.maps.Size(50,50),labelOrigin: new window.google.maps.Point(25,60)
      }} position={new window.google.maps.LatLng(elementolo.Posizione.Lat,elementolo.Posizione.Lng)}/>
      var nonDarmele = markers;
      nonDarmele.push(mark);
      setMarkers(nonDarmele)
      return mark;
    }
</code>```

I use this function to render the markers and memorize them in the arrsy

if I write setMarkers((prev)=>[...prev,mark]) it crashes for the re renders even if the markers array is not rendered

I've tried also using a listener to the map zoom changes for setting new Marker icon sizes but I get that setIcon() method doesen't exists

```<code>function handleMarkerSize(map){

    var zoom = map.getZoom()
    var markerWidth = (zoom/9)*20;
    var markerHeight = (zoom/9)*34;

    //scaledSize: new window.google.maps.Size(50,50)

    markers.forEach((mark)=>{
      console.log("ooo",mark)
      mark.props.icon = {
        url: mark.props.icon.url,
        scaledSize: new window.google.maps.Size(markerWidth,markerHeight),
        labelOrigin: new window.google.maps.Point(25,60)
      }
    })
  }
</code>```

I'm using @react-google-maps/api
The map and markers visualization works fine, after rendering all the Markers there is no re render (only if in the function generaMarker() I use setMarkers with prev, and that make it crash)

Thanks for your help

Body:
I've a google map with some markers, but when I zoom in and out the marker icon size changes, is there any way to make that size fixed?

    const [markers,setMarkers] = useState([])

 function generaMarker(elementolo,index){
      var mark = <Marker  draggable={modify===true?true:false} onDragEnd={(e)=>modify===true?handleSpostamentoMarker(e,index):null} onClick={(e)=>eliminate===true?deleteMarker(e,index):handleClickEl(elementolo)}  label={elementolo.Nome} title={elementolo.Nome} icon={{url:getIcon(elementolo),s : new window.google.maps.Size(50,50),labelOrigin: new window.google.maps.Point(25,60)
      }} position={new window.google.maps.LatLng(elementolo.Posizione.Lat,elementolo.Posizione.Lng)}/>
      var nonDarmele = markers;
      nonDarmele.push(mark);
      setMarkers(nonDarmele)
      return mark;
    }

I use this function to render the markers and memorize them in the arrsy

if I write setMarkers((prev)=>[...prev,mark]) it crashes for the re renders even if the markers array is not rendered

I've tried also using a listener to the map zoom changes for setting new Marker icon sizes but I get that setIcon() method doesen't exists

function handleMarkerSize(map){

    var zoom = map.getZoom()
    var markerWidth = (zoom/9)*20;
    var markerHeight = (zoom/9)*34;

    //scaledSize: new window.google.maps.Size(50,50)

    markers.forEach((mark)=>{
      console.log("ooo",mark)
      mark.props.icon = {
        url: mark.props.icon.url,
        scaledSize: new window.google.maps.Size(markerWidth,markerHeight),
        labelOrigin: new window.google.maps.Point(25,60)
      }
    })
  }

I'm using @react-google-maps/api
The map and markers visualization works fine, after rendering all the Markers there is no re render (only if in the function generaMarker() I use setMarkers with prev, and that make it crash)

Thanks for your help


问:
Finding Selected Items in a DataGrid WPF MVVM
please tell me, I encountered such a problem, I'm trying to get a list of selectable rows in GataGrid

In general, I want to make a DataGrid.ContextMenu and when selecting rows, call the ContextMenu and throw the command, but alas, this does not work; the command works, but null comes instead of the parameter, which I just did not (
and accessed the parent element in search of Source, but everywhere got null in the end.

In theory, just pass the CommandParameter + {Binding ElementName=grd, Path=SelectedItems} and no problem, I didn’t look for answers, but some crazy colliders offer, I couldn’t understand ...

Option 1 may help someone, you can directly bind SelectedItem="{Binding Path=SelectedCustomer, Mode=TwoWay}" to the DataGrid, but there is only one element, it does not suit me (it's a pity that the list of elements is not allowed ((

Option 2

```<code>    <i:EventTrigger EventName="SelectedCellsChanged">
        <i:InvokeCommandAction Command="{Binding Command}" CommandParameter="{Binding ElementName=grd, Path=SelectedItems}" />
    </i:EventTrigger>
</i:Interaction.Triggers>

public void ResetPhoneNumberCommand(object obj)
{
    var itemList = (obj as ObservableCollection<object>)?.Cast<MyObject>();
    // then you can do anything with this list stored in a sheet or somewhere else
}
</code>```

in the second option, there are errors in the markup itself, that there is some kind of nonsense with the types, it all works, but these errors, of course...

Cannot convert Type' from type 'MyType' to type
'System.Collections.ObjectModel.ObservableCollection`1[Type]' for
'en-US' culture with default conversions; consider using Converter
property of Binding.
NotSupportedException:'System.NotSupportedException:
CollectionConverter cannot convert from Type.

And in general, the bike is fierce, can someone suggest a better solution?

```<code><DataGrid.ContextMenu >
    <ContextMenu >
        <MenuItem
            Header="Delete"
            Name="Delete"
            Command="{Binding DeleteCommand}"
            CommandParameter ="{Binding ElementName=grdCity, Path=SelectedItems}">
        </MenuItem>
    </ContextMenu>
</DataGrid.ContextMenu>

public void DeleteCommand(object obj)
{
    here comes null ??(((
}
</code>```

Body:
please tell me, I encountered such a problem, I'm trying to get a list of selectable rows in GataGrid

In general, I want to make a DataGrid.ContextMenu and when selecting rows, call the ContextMenu and throw the command, but alas, this does not work; the command works, but null comes instead of the parameter, which I just did not (
and accessed the parent element in search of Source, but everywhere got null in the end.

In theory, just pass the CommandParameter + {Binding ElementName=grd, Path=SelectedItems} and no problem, I didn’t look for answers, but some crazy colliders offer, I couldn’t understand ...

Option 1 may help someone, you can directly bind SelectedItem="{Binding Path=SelectedCustomer, Mode=TwoWay}" to the DataGrid, but there is only one element, it does not suit me (it's a pity that the list of elements is not allowed ((

Option 2

public void ResetPhoneNumberCommand(object obj)
{
    var itemList = (obj as ObservableCollection<object>)?.Cast<MyObject>();
    // then you can do anything with this list stored in a sheet or somewhere else
}

in the second option, there are errors in the markup itself, that there is some kind of nonsense with the types, it all works, but these errors, of course...

Cannot convert Type' from type 'MyType' to type
'System.Collections.ObjectModel.ObservableCollection`1[Type]' for
'en-US' culture with default conversions; consider using Converter
property of Binding.
NotSupportedException:'System.NotSupportedException:
CollectionConverter cannot convert from Type.

And in general, the bike is fierce, can someone suggest a better solution?

<DataGrid.ContextMenu >
    <ContextMenu >
        <MenuItem
            Header="Delete"
            Name="Delete"
            Command="{Binding DeleteCommand}"
            CommandParameter ="{Binding ElementName=grdCity, Path=SelectedItems}">
        </MenuItem>
    </ContextMenu>
</DataGrid.ContextMenu>

public void DeleteCommand(object obj)
{
    here comes null ??(((
}


问:
Continuous delivery and continuous integration pipeline debugging
I had created pipeline and I have a json file as test results under dat folder. I can access that file in dev environment but in hat environment i cannot see that file in the repository. Where did I miss or how should I debug my pipeline

I had created pipeline and I have a json file as test results under dat folder. I can access that file in dev environment but in hat environment i cannot see that file in the repository. Where did I miss or how should I debug my pipeline


问:
WSL2 Ubuntu 22.04 guest lagging when resolving domain name
I noticed latelty (probably after upgrading WSL kernel to 5.15.79.1) that almost every terminal command involved in domain resolution is dalayed for about 5 sec. The same behaviour is shared by ssh, telnet, ping, wget, curl, etc. What is interesting is the fact that dig and nslookup are free from that issue. The delay at resolving is easily visible with verbose versions of wget or ssh. it looks like below.

SSH example

WGET example

I must add that previously I disabled automatic resolv.conf generation with /etc/wsl.conf

I already tried changing several values for nameserver in resolv.conf (8.8.8.8, 208.67.222.222, 1.1.1.1, etc.), redirecting the DNS queries to my local dnsmasq and as a last resolve I also disabled IPv6 for Ubuntu guest with /etc/sysctl.conf

```<code>net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
</code>```

None of those seem to help. Do you have any suggestions?

Body:
I noticed latelty (probably after upgrading WSL kernel to 5.15.79.1) that almost every terminal command involved in domain resolution is dalayed for about 5 sec. The same behaviour is shared by ssh, telnet, ping, wget, curl, etc. What is interesting is the fact that dig and nslookup are free from that issue. The delay at resolving is easily visible with verbose versions of wget or ssh. it looks like below.

SSH example

WGET example

I must add that previously I disabled automatic resolv.conf generation with /etc/wsl.conf

I already tried changing several values for nameserver in resolv.conf (8.8.8.8, 208.67.222.222, 1.1.1.1, etc.), redirecting the DNS queries to my local dnsmasq and as a last resolve I also disabled IPv6 for Ubuntu guest with /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

None of those seem to help. Do you have any suggestions?


问:
Issue with impot/first in react
for some reason my log is saying this:

```<code>ERROR in [eslint]
src\questions\CompanyAddress.jsx
  Line 6:1:  Import in body of module; reorder to top  import/first
  Line 7:1:  Import in body of module; reorder to top  import/first
  Line 8:1:  Import in body of module; reorder to top  import/first
</code>```

Here is the file in question:

import React, { useState } from 'react';
import '../styles/forms.css';
import Banner from '../components/ProgressBar';
import { useNavigate } from 'react-router-dom';;
import CTA from '../components/CTA';
import { LinkWithQuery } from '../components/BackButton';
import Autocomplete from "react-google-autocomplete";

function CompanyAddress() {
...
}
```

i have looked and i have no imports other than on top, i have nothing before any imports either, i tried adding the comment eslint-disable import/first and nothing seems to work. What else can i provide to further trouble shoot this

Title: Issue with impot/first in react

Body:
for some reason my log is saying this:

ERROR in [eslint]
src\questions\CompanyAddress.jsx
  Line 6:1:  Import in body of module; reorder to top  import/first
  Line 7:1:  Import in body of module; reorder to top  import/first
  Line 8:1:  Import in body of module; reorder to top  import/first

Here is the file in question:

import React, { useState } from 'react';
import '../styles/forms.css';
import Banner from '../components/ProgressBar';
import { useNavigate } from 'react-router-dom';;
import CTA from '../components/CTA';
import { LinkWithQuery } from '../components/BackButton';
import Autocomplete from "react-google-autocomplete";

function CompanyAddress() {
...
}

i have looked and i have no imports other than on top, i have nothing before any imports either, i tried adding the comment eslint-disable import/first and nothing seems to work. What else can i provide to further trouble shoot this


问:
(mongoose-sequnce)(mongoose) + Hapijs Adding auto increment in schema field
I want to add an auto-increment field in the MongoDB schema for
Interview.round.count field i.e. whenever I will Update the interview field it will automatically increase the Count value with +1

//Here is My Schema Field

```<code>const mongoose = require('mongoose');
const mongoosePaginate = require('mongoose-paginate-v2');
const { Schema } = mongoose;

const InterviewSchema = new Schema(
  {
    name: {
      type: String,
      required: true,
      trim: true,
      maxlength: 30,
    },
    email: {
      type: String,
      required: true,
      trim: true,
    },
    gender: {
      type: String,
      required: true,
    },
    contactNumber: {
      type: Number,
      required: true,
   }

    interview: [
      {
        interviewerName: {
          type: String,
          trim: true,
        },
        round: {
          count: {
            type: Number,
            default: 0,
          },
          type: {
            type: String,
            default: 'telephonic',
          },
        },
        recommendation: {
          type: String,
          default: '',
        },
      },
    ],
  },
},
  {
    timestamps: true,
  },
);
InterviewSchema.plugin(mongoosePaginate);
const InterviewProcess = mongoose.model('interviewprocess', InterviewSchema);
module.exports = InterviewProcess;
</code>```

Interview schema is defined as an array object.
My goal is to auto-increment the Interview.round.count i.e. for the count field
Can anyone please help me?

Body:
I want to add an auto-increment field in the MongoDB schema for
Interview.round.count field i.e. whenever I will Update the interview field it will automatically increase the Count value with +1

//Here is My Schema Field

const mongoose = require('mongoose');
const mongoosePaginate = require('mongoose-paginate-v2');
const { Schema } = mongoose;

const InterviewSchema = new Schema(
  {
    name: {
      type: String,
      required: true,
      trim: true,
      maxlength: 30,
    },
    email: {
      type: String,
      required: true,
      trim: true,
    },
    gender: {
      type: String,
      required: true,
    },
    contactNumber: {
      type: Number,
      required: true,
   }

    interview: [
      {
        interviewerName: {
          type: String,
          trim: true,
        },
        round: {
          count: {
            type: Number,
            default: 0,
          },
          type: {
            type: String,
            default: 'telephonic',
          },
        },
        recommendation: {
          type: String,
          default: '',
        },
      },
    ],
  },
},
  {
    timestamps: true,
  },
);
InterviewSchema.plugin(mongoosePaginate);
const InterviewProcess = mongoose.model('interviewprocess', InterviewSchema);
module.exports = InterviewProcess;

Interview schema is defined as an array object.
My goal is to auto-increment the Interview.round.count i.e. for the count field
Can anyone please help me?


问:
Check textview and get it return as a null
I am working on my java snippet that I want to check if the TextView in the menu is exist or not. If the textview is not exist then I want to return it as a null so I could do something.

When I try this:

```<code>if (total_inbox_unread > 0) {
    @SuppressLint("ResourceType") TextView total_inbox_tv = (TextView)
    menu.getItem(0).getActionView().findViewById(R.id.total_mailbox);
}

if (total_inbox_tv == null) {
    ...do something
}
</code>```

I am getting this:

Process: com.loginpage, PID: 29159
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference

Here is the full code:

```<code>    NavigationView navigationView = (NavigationView)
    _fragment.getActivity().findViewById(R.id.nav_view);
    Menu menu = (Menu) navigationView.getMenu();
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService
         (Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.menu_items, null);

    if (total_inbox_unread > 0) {
          @SuppressLint("ResourceType") TextView total_inbox_tv = (TextView) menu.getItem(0).getActionView().findViewById(R.id.total_mailbox);
          //LinearLayout mailbox_layout = (LinearLayout) menu.getItem(0).getActionView().findViewById(R.id.mailbox_layout);

          if (total_inbox_tv == null) {
              //LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.menu_items, null);
              //TextView total_mailbox_tv = (TextView) linearLayout.findViewById(R.id.total_mailbox);
              total_inbox_tv = linearLayout.findViewById(R.id.total_mailbox);
              int total_mailbox = total_inbox_unread;
              total_inbox_tv.setText(Integer.toString(total_mailbox));
              total_inbox_tv.setTextColor(ContextCompat.getColor(mContext, R.color.black));
              menu.getItem(0).setActionView(linearLayout);
          }
          else
          {
              int total_inbox = Integer.parseInt(total_inbox_tv.getText().toString());

              if (total_inbox_unread > total_inbox) {
                  total_inbox_tv.setText(Integer.toString(total_inbox_unread));
              }
              else if (total_inbox_unread < total_inbox) {
                  total_inbox_tv.setText(Integer.toString(total_inbox_unread));
              }
          }
      }
      else if (total_inbox_unread == 0) {
           if (!(menu.getItem(0).getActionView().findViewById(R.id.total_mailbox) == null)) {
                 LinearLayout inbox_layout = (LinearLayout) menu.getItem(0).getActionView().findViewById(R.id.mailbox_layout);
                 TextView total_inbox_tv = (TextView) menu.getItem(0).getActionView().findViewById(R.id.total_mailbox);
                 int total_inbox = Integer.parseInt(total_inbox_tv.getText().toString());

                 if (total_inbox >= 1) {
                    inbox_layout.removeAllViews();
                    inbox_layout.invalidate();
                 }
             }
         }
</code>```

There is no textview in the subgroup under the menu. I can only add the submenu

How I can get the textview to return as a null when I have no textview in the menu??

Thank you.

Body:
I am working on my java snippet that I want to check if the TextView in the menu is exist or not. If the textview is not exist then I want to return it as a null so I could do something.

When I try this:

if (total_inbox_unread > 0) {
    @SuppressLint("ResourceType") TextView total_inbox_tv = (TextView)
    menu.getItem(0).getActionView().findViewById(R.id.total_mailbox);
}

if (total_inbox_tv == null) {
    ...do something
}

I am getting this:

Process: com.loginpage, PID: 29159
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference

Here is the full code:

    NavigationView navigationView = (NavigationView)
    _fragment.getActivity().findViewById(R.id.nav_view);
    Menu menu = (Menu) navigationView.getMenu();
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService
         (Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.menu_items, null);

    if (total_inbox_unread > 0) {
          @SuppressLint("ResourceType") TextView total_inbox_tv = (TextView) menu.getItem(0).getActionView().findViewById(R.id.total_mailbox);
          //LinearLayout mailbox_layout = (LinearLayout) menu.getItem(0).getActionView().findViewById(R.id.mailbox_layout);

          if (total_inbox_tv == null) {
              //LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.menu_items, null);
              //TextView total_mailbox_tv = (TextView) linearLayout.findViewById(R.id.total_mailbox);
              total_inbox_tv = linearLayout.findViewById(R.id.total_mailbox);
              int total_mailbox = total_inbox_unread;
              total_inbox_tv.setText(Integer.toString(total_mailbox));
              total_inbox_tv.setTextColor(ContextCompat.getColor(mContext, R.color.black));
              menu.getItem(0).setActionView(linearLayout);
          }
          else
          {
              int total_inbox = Integer.parseInt(total_inbox_tv.getText().toString());

              if (total_inbox_unread > total_inbox) {
                  total_inbox_tv.setText(Integer.toString(total_inbox_unread));
              }
              else if (total_inbox_unread < total_inbox) {
                  total_inbox_tv.setText(Integer.toString(total_inbox_unread));
              }
          }
      }
      else if (total_inbox_unread == 0) {
           if (!(menu.getItem(0).getActionView().findViewById(R.id.total_mailbox) == null)) {
                 LinearLayout inbox_layout = (LinearLayout) menu.getItem(0).getActionView().findViewById(R.id.mailbox_layout);
                 TextView total_inbox_tv = (TextView) menu.getItem(0).getActionView().findViewById(R.id.total_mailbox);
                 int total_inbox = Integer.parseInt(total_inbox_tv.getText().toString());

                 if (total_inbox >= 1) {
                    inbox_layout.removeAllViews();
                    inbox_layout.invalidate();
                 }
             }
         }

There is no textview in the subgroup under the menu. I can only add the submenu

How I can get the textview to return as a null when I have no textview in the menu??

Thank you.