问:
How to send email with attachment using ASP.NET Core?
I was trying to implement ExportAndSendPDF() action method using ASP.NET Core.

What I'm trying to do is whenExportAndSendPDF() got executed it should export and attach that PDF file to email.

But I'm not sure how to implement this action method right.

This is working example of action method ExportToPDF().

But how to implement action method ExportAndSendPDF() and what I need to do to implement this action method right?

ExportToPDF code:

```<code>public class EmployeeCategoryController : Controller
{
    private ApplicationDbContext Context { get; }

    public EmployeeCategoryController(ApplicationDbContext _context)
    {
        Context = _context;
    }

    public IActionResult Index()
    {
        return View(this.Context.EmployeeCategories.Take(6).ToList());
    }

    [HttpPost]
    public FileResult ExportToPDF()
    {
            var query = Context.EmployeeCategories.Take(6).Select(m => new EmployeeCategory
            {
              Id = m.Id,
              Name = m.Name,
              LastName = m.LastName,
              Address = m.Address,
              NetSalary = m.NetSalary,
              GrossSalary = m.GrossSalary,
            }).ToList();

            // Building an HTML string.
            StringBuilder sb = new StringBuilder();

            // Table start.
            sb.Append("<table border='1' cellpadding='5' cellspacing='0' style='border: 1px solid #ccc;font-family: Arial; font-size: 10pt;'>");

            // Building the Header row.
            sb.Append("<tr>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>Id</th>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>Name</th>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>LastName</th>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>Address</th>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>NetSalary</th>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>GrossSalary</th>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>NetSalary</th>");
            sb.Append("<th style='background-color: #B8DBFD;border: 1px solid #ccc'>GrossSalary</th>");
            sb.Append("</tr>");

            // Building the Data rows.
            query.ForEach(employee =>
            {
                sb.Append("<tr>");

                foreach (var propertyInfo in employee.GetType().GetProperties())
                {
                    sb.Append("<td style='border: 1px solid #ccc'>");
                    sb.Append(propertyInfo.GetValue(employee));
                    sb.Append("</td>");
                }

                sb.Append("</tr>");
            });

            // Table end.
            sb.Append("</table>");

            using (MemoryStream stream = new MemoryStream(Encoding.ASCII.GetBytes(sb.ToString())))
            {
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                PdfWriter writer = new PdfWriter(byteArrayOutputStream);
                PdfDocument pdfDocument = new PdfDocument(writer);
                pdfDocument.SetDefaultPageSize(PageSize.A4);
                HtmlConverter.ConvertToPdf(stream, pdfDocument);
                pdfDocument.Close();
                return File(byteArrayOutputStream.ToArray(), "application/pdf", "EmployeeList.pdf");
            }
    }

    [HttpPost]
    public IActionResult  ExportAndSendPDF()
    {
        return View();
    }
}
</code>```

Body:
I was trying to implement ExportAndSendPDF() action method using ASP.NET Core.

What I'm trying to do is whenExportAndSendPDF() got executed it should export and attach that PDF file to email.

But I'm not sure how to implement this action method right.

This is working example of action method ExportToPDF().

But how to implement action method ExportAndSendPDF() and what I need to do to implement this action method right?

ExportToPDF code:

public class EmployeeCategoryController : Controller
{
    private ApplicationDbContext Context { get; }

    public EmployeeCategoryController(ApplicationDbContext _context)
    {
        Context = _context;
    }

    public IActionResult Index()
    {
        return View(this.Context.EmployeeCategories.Take(6).ToList());
    }

    [HttpPost]
    public FileResult ExportToPDF()
    {
            var query = Context.EmployeeCategories.Take(6).Select(m => new EmployeeCategory
            {
              Id = m.Id,
              Name = m.Name,
              LastName = m.LastName,
              Address = m.Address,
              NetSalary = m.NetSalary,
              GrossSalary = m.GrossSalary,
            }).ToList();

            // Building an HTML string.
            StringBuilder sb = new StringBuilder();

            // Table start.
            sb.Append("
");

            // Building the Header row.
            sb.Append("
");
            sb.Append("Id	");
            sb.Append("Name	");
            sb.Append("LastName	");
            sb.Append("Address	");
            sb.Append("NetSalary	");
            sb.Append("GrossSalary	");
            sb.Append("NetSalary	");
            sb.Append("GrossSalary	");
            sb.Append("
");

            // Building the Data rows.
            query.ForEach(employee =>
            {
                sb.Append("
");

                foreach (var propertyInfo in employee.GetType().GetProperties())
                {
                    sb.Append("");
                    sb.Append(propertyInfo.GetValue(employee));
                    sb.Append("	");
                }

                sb.Append("
");
            });

            // Table end.
            sb.Append("
");

            using (MemoryStream stream = new MemoryStream(Encoding.ASCII.GetBytes(sb.ToString())))
            {
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                PdfWriter writer = new PdfWriter(byteArrayOutputStream);
                PdfDocument pdfDocument = new PdfDocument(writer);
                pdfDocument.SetDefaultPageSize(PageSize.A4);
                HtmlConverter.ConvertToPdf(stream, pdfDocument);
                pdfDocument.Close();
                return File(byteArrayOutputStream.ToArray(), "application/pdf", "EmployeeList.pdf");
            }
    }

    [HttpPost]
    public IActionResult  ExportAndSendPDF()
    {
        return View();
    }
}


来源: stackexchange

问:
python setup.py egg_info did not run successfully. exit code: 1
Im having trouble installing pygame.

```<code>Package    Version
ez-setup   0.9
pip        22.3.1
setuptools 65.6.3
</code>```

Here is the error message I get when I try to install it.

```<code>>pip install pygame
Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [77 lines of output]
</code>```

Using cached pygame-2.1.2.tar.gz (10.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [77 lines of output]

ContentLicense: CC BY-SA 4.0

Body:
Im having trouble installing pygame.

Package    Version
ez-setup   0.9
pip        22.3.1
setuptools 65.6.3

Here is the error message I get when I try to install it.

>pip install pygame
Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [77 lines of output]

Using cached pygame-2.1.2.tar.gz (10.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [77 lines of output]


问:
article_crawlers.items import Article results in 'article_crawlers' module not found error
I was following along the video on web scraping on linkedin learning and received the 'Unable to load 'wikipedia.py': No module named 'article_crawlers'' error. There's no error for the instructor. The following is the code:

`

```<code>import scrapy

from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from article_crawlers.items import Article

class WikipediaSpider(CrawlSpider):
    name = 'wikipedia'
    allowed_domains = ['en.wikipedia.org']
    start_urls = ['http://en.wikipedia.org/Kevin_Bacon']

    rules = [Rule(LinkExtractor(allow=r'wiki/((?!:),)*$'),callback='parse_info', follow=True)]
    def parse(self, response):
        article = Article()

        article ['title']= response.xpath('//h1/text()').get() or response.xpath('//h1/i/text()').get(),
        article['url'] = response.url
        article['last_edited'] = response.xpath('//li[@id="footer-infor-lastmod"]text()').get()
        return article
</code>```

`

the folling is the 'items' file:
`

```<code>import scrapy

class Article(scrapy.Item):

    title = scrapy.Field()
    url=scrapy.Field()
    lastUpdated=scrapy.Field()
</code>```

`

Received the 'Unable to load 'wikipedia.py': No module named 'article_crawlers'' error. I looked for similar problem and solution but couldn't get any. I have been stuck here

Body:
I was following along the video on web scraping on linkedin learning and received the 'Unable to load 'wikipedia.py': No module named 'article_crawlers'' error. There's no error for the instructor. The following is the code:

`

import scrapy

from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from article_crawlers.items import Article

class WikipediaSpider(CrawlSpider):
    name = 'wikipedia'
    allowed_domains = ['en.wikipedia.org']
    start_urls = ['http://en.wikipedia.org/Kevin_Bacon']

    rules = [Rule(LinkExtractor(allow=r'wiki/((?!:),)*$'),callback='parse_info', follow=True)]
    def parse(self, response):
        article = Article()

        article ['title']= response.xpath('//h1/text()').get() or response.xpath('//h1/i/text()').get(),
        article['url'] = response.url
        article['last_edited'] = response.xpath('//li[@id="footer-infor-lastmod"]text()').get()
        return article

`

the folling is the 'items' file:
`

import scrapy

class Article(scrapy.Item):

    title = scrapy.Field()
    url=scrapy.Field()
    lastUpdated=scrapy.Field()

`

Received the 'Unable to load 'wikipedia.py': No module named 'article_crawlers'' error. I looked for similar problem and solution but couldn't get any. I have been stuck here


问:
Codeacademy question Sum of Pairs(pyhton)
Question:
Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum.

If there are two or more pairs with the required sum, the pair whose second element has the smallest index is the solution.
My solution:

```<code>def sum_pairs(ints, s):
    lst = []
    for i in range(len(ints)):
        for j in range(len(ints)):
            if ints[i] + ints[j] == s and  i != j:
                lst.append([ints[i], ints[j], max(i, j)])
    temp = sorted(lst, key=lambda x: x[2])
    print(len(temp))
    if len(temp) == 0:
        return lst
    else:
        return [temp[0][0], temp[0][1]]
</code>```

In this code [20, -13, 40] and sum = -7 it is expected to return None but my code is returning [20, -13, 40]. Even though I didn't append any of the values. How could this happen?

Body:
Question:
Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum.

If there are two or more pairs with the required sum, the pair whose second element has the smallest index is the solution.
My solution:

def sum_pairs(ints, s):
    lst = []
    for i in range(len(ints)):
        for j in range(len(ints)):
            if ints[i] + ints[j] == s and  i != j:
                lst.append([ints[i], ints[j], max(i, j)])
    temp = sorted(lst, key=lambda x: x[2])
    print(len(temp))
    if len(temp) == 0:
        return lst
    else:
        return [temp[0][0], temp[0][1]]

In this code [20, -13, 40] and sum = -7 it is expected to return None but my code is returning [20, -13, 40]. Even though I didn't append any of the values. How could this happen?


问:
find and update XML DATA using Python
I want Write a python program to update the details of the vehicle with the registration number DE2115 as follows:<registration_no>DE2115</registration_no>Nissan Skyline  enter image description here

I want to repalse make and model only in registation no DE2115 vehicle...
Please help me

Title: find and update XML DATA using Python


问:
missing libSystem.B.dylib file on macos
When I try to run a simple executable from Cmake, I get this error.

```<code>dyld[5005]: dyld cache '(null)' not loaded: syscall to map cache into shared region failed
dyld[5005]: Library not loaded: /usr/lib/libSystem.B.dylib
  Referenced from: <7EB1C677-BB05-338C-8B29-CC2803CB8C21> /Users/pop/Desktop/Lang
Reason: tried: '/usr/lib/libSystem. " B.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libSystem.B.dylib' (no such file), '/usr/lib/libSystem.  B.dylib' (no such file, no dyld cache), '/usr/local/lib/libSystem.    B.dylib' (no such file)
</code>```

My Cmake file

```<code>cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(App)
set(programName App)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeFiles/")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
file(GLOB SRC "src/*/*.c" "src/*/*.h" "src/*.c")
add_executable(App ${SRC})
</code>```

I only have 1 file which a simple hello world function and multiple empty directories.
Also, I have tried looking for my file

```<code>sudo find / -name libSystem.B.dylib
</code>```

but not luck.

I am using an M1 chip and Ventura 13.1. Please ask for more details if you need them, as I really have no idea what to do about my problem.

Title: missing libSystem.B.dylib file on macos

Body:
When I try to run a simple executable from Cmake, I get this error.

dyld[5005]: dyld cache '(null)' not loaded: syscall to map cache into shared region failed
dyld[5005]: Library not loaded: /usr/lib/libSystem.B.dylib
  Referenced from: <7EB1C677-BB05-338C-8B29-CC2803CB8C21> /Users/pop/Desktop/Lang
Reason: tried: '/usr/lib/libSystem. " B.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libSystem.B.dylib' (no such file), '/usr/lib/libSystem.  B.dylib' (no such file, no dyld cache), '/usr/local/lib/libSystem.    B.dylib' (no such file)

My Cmake file

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(App)
set(programName App)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeFiles/")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
file(GLOB SRC "src/*/*.c" "src/*/*.h" "src/*.c")
add_executable(App ${SRC})

I only have 1 file which a simple hello world function and multiple empty directories.
Also, I have tried looking for my file

sudo find / -name libSystem.B.dylib

but not luck.

I am using an M1 chip and Ventura 13.1. Please ask for more details if you need them, as I really have no idea what to do about my problem.


问:
Angular Firebase enable persiste login for multiple apps
I'm working on a project where it's using Firebase.To login on the project users uses email/password login and what I want to do is to have the option to persiste the login. So for so good, I was able to do that.

Angular version 13

AngularFire version 7

The problem is that depending on some configs the user may need to use a different app than the one that is initialized on the Module, so I initialize it on the AuthService.

When I use the app initialized on the module, the persistence works out of the box without any other code, unles I want to remove persistence.

But when I use an app initialized on the service, the login doesn't persist, and I have no clue why it's happening. This is how I'm doing:

app.module.ts

@NgModule({
    imports: [
        BrowserModule,
        RouterModule.forRoot(appRoutes, routerConfig),
        AngularFireModule.initializeApp(environment.defaultApp, 'defaultApp'),

        //...
    ],
    // ...
})
```
<p><strong>auth.service.ts</strong></p>
```import firebase from "firebase";
import 'firebase/firestore';
import auth = firebase.auth;

@Injectable()
export class AuthService {
    private appStoreAdm;

    constructor() {
        this.appStoreAdm = firebase.initializeApp(environment.appStoreAdm, 'appStoreAdm');
        this.appStoreAdm.firestore().enablePersistence();

        // Other apps initialized here same as above
    }

    public async login(app:string, email: string, password: string, remember: boolean): Promise<auth.UserCredential> {
        console.log({ email, password, remember });

        const persist = remember
            ? firebase.auth.Auth.Persistence.LOCAL
            : firebase.auth.Auth.Persistence.SESSION;

        await this[app].auth().setPersistence(persist);
        return this[app].auth().signInWithEmailAndPassword(email, password);
    }
}
```

The login process works always as expected. I can create users on the correct app and then login correctly as well. However, using the option Remember Me ONLY works if using the default app initialized on the App Module.

Is there a way to make it work? How?

Body:
I'm working on a project where it's using Firebase.To login on the project users uses email/password login and what I want to do is to have the option to persiste the login. So for so good, I was able to do that.

Angular version 13

AngularFire version 7

The problem is that depending on some configs the user may need to use a different app than the one that is initialized on the Module, so I initialize it on the AuthService.

When I use the app initialized on the module, the persistence works out of the box without any other code, unles I want to remove persistence.

But when I use an app initialized on the service, the login doesn't persist, and I have no clue why it's happening. This is how I'm doing:

app.module.ts

@NgModule({
    imports: [
        BrowserModule,
        RouterModule.forRoot(appRoutes, routerConfig),
        AngularFireModule.initializeApp(environment.defaultApp, 'defaultApp'),

        //...
    ],
    // ...
})

auth.service.ts

import firebase from "firebase";
import 'firebase/firestore';
import auth = firebase.auth;

@Injectable()
export class AuthService {
    private appStoreAdm;

    constructor() {
        this.appStoreAdm = firebase.initializeApp(environment.appStoreAdm, 'appStoreAdm');
        this.appStoreAdm.firestore().enablePersistence();

        // Other apps initialized here same as above
    }

    public async login(app:string, email: string, password: string, remember: boolean): Promise<auth.UserCredential> {
        console.log({ email, password, remember });

        const persist = remember
            ? firebase.auth.Auth.Persistence.LOCAL
            : firebase.auth.Auth.Persistence.SESSION;

        await this[app].auth().setPersistence(persist);
        return this[app].auth().signInWithEmailAndPassword(email, password);
    }
}

The login process works always as expected. I can create users on the correct app and then login correctly as well. However, using the option Remember Me ONLY works if using the default app initialized on the App Module.

Is there a way to make it work? How?


问:
View not displaying data got from MySQL - Backbone.js
Ive created a small app that will get a list of users from my SQL database and display their user names using backbone.js

below is the implementation.
HTML ,

```<code><body>
<div class="col-md-8" id="divResult">
</body>
</code>```

Js,

```<code>//Model
var UserModel = Backbone.Model.extend({
     urlRoot: "/CW2/ASSWDCW2/cw2app/index.php/Leaderboard/leaderboard",
     defaults: {
        username: null,
        userLevel: null
     }
  });

//Collection
  var UserCollection = Backbone.Collection.extend({
     model: UserModel,
     url: "/CW2/ASSWDCW2/cw2app/index.php/Leaderboard/leaderboard",
  });

  //View
   var UserView = Backbone.View.extend({
     el:"#divResult",
     render: function() {
        this.$el.html("Please wait...");
        var htmlString ="";
        this.model.each(function(m){
           htmlString = htmlString + "<tr><td>"+m.get('username')+"</td></tr>";
        });
        this.$el.html("<table class=\"table\">"+htmlString+"</table>");
     }
  });

var comments = new UserCollection();
  comments.fetch({async:false});
  var usersView = new UserView({model: comments});
  usersView.render();
</code>```

My problem is,the view wont display the data !.In the inspector-> element the element is empty. Please help

Body:
Ive created a small app that will get a list of users from my SQL database and display their user names using backbone.js

below is the implementation.
HTML ,

Js,

//Model
var UserModel = Backbone.Model.extend({
     urlRoot: "/CW2/ASSWDCW2/cw2app/index.php/Leaderboard/leaderboard",
     defaults: {
        username: null,
        userLevel: null
     }
  });

//Collection
  var UserCollection = Backbone.Collection.extend({
     model: UserModel,
     url: "/CW2/ASSWDCW2/cw2app/index.php/Leaderboard/leaderboard",
  });

  //View
   var UserView = Backbone.View.extend({
     el:"#divResult",
     render: function() {
        this.$el.html("Please wait...");
        var htmlString ="";
        this.model.each(function(m){
           htmlString = htmlString + "
"+m.get('username')+"
";
        });
        this.$el.html("
"+htmlString+"
");
     }
  });

var comments = new UserCollection();
  comments.fetch({async:false});
  var usersView = new UserView({model: comments});
  usersView.render();

My problem is,the view wont display the data !.In the inspector-> element the element is empty. Please help


问:
How to download and install the watch face on the clock programmatically?
I found a great example that works on the phone, but this code does not work on the clock, maybe there is a problem with the paths and on the clock they are different than on the phone? When testing on the emulator, a window pops up where you need to give permission in the settings, when I click settings, the window closes and nothing happens. And when testing on a real device, it allegedly starts downloading the file, then after downloading it is not on the watch.

AndroidManifest.xml

```<code><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.WRITE_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>
</code>```

provider_paths.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
        name="external"
        path="." />
    <external-files-path
        name="external_files"
        path="." />
    <cache-path
        name="cache"
        path="." />
    <external-cache-path
        name="external_cache"
        path="." />
    <files-path
        name="files"
        path="." />
</paths>
</code>```

GenericFileProvider.java

```<code>import androidx.core.content.FileProvider;

public class GenericFileProvider extends FileProvider {
   //This file would be empty.
}
</code>```

MainActivity.java

```<code>import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;

public class MainActivity extends AppCompatActivity {

    private static final int PERMISSION_REQUEST_CODE = 200;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btn_click = findViewById(R.id.btn_click);
        btn_click.setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
            @Override
            public void onClick(View v) {
                if (checkPermission()) {
                    UpdateApp atualizaApp = new UpdateApp();
                    atualizaApp.setContext(MainActivity.this);
                    atualizaApp.execute("https://example.com/apks/my_apk.apk");
                } else {
                    requestPermission();
                }
            }
        });
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        if (requestCode == PERMISSION_REQUEST_CODE) {
            if (grantResults.length > 0) {

                boolean locationAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
                boolean cameraAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
                if (locationAccepted && cameraAccepted) {
                    UpdateApp updateApp = new UpdateApp();
                    updateApp.setContext(MainActivity.this);
                    updateApp.execute("https://example.com/apks/my_apk.apk");
                }
            }
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
    private boolean checkPermission() {
        int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
        int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);

        return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;
    }

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
    private void requestPermission() {
        ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
    }

    public class UpdateApp extends AsyncTask<String, Integer, String> {
        private ProgressDialog mPDialog;
        private Context mContext;

        void setContext(Activity context) {
            mContext = context;
            context.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    mPDialog = new ProgressDialog(mContext);
                    mPDialog.setMessage("Please wait...");
                    mPDialog.setIndeterminate(true);
                    mPDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                    mPDialog.setCancelable(false);
                    mPDialog.show();
                }
            });
        }

        @Override
        protected String doInBackground(String... arg0) {
            try {

                URL url = new URL(arg0[0]);
                HttpURLConnection c = (HttpURLConnection) url.openConnection();
                c.setRequestMethod("GET");
                c.setDoOutput(true);
                c.connect();
                int lenghtOfFile = c.getContentLength();

                String PATH = Objects.requireNonNull(mContext.getExternalFilesDir(null)).getAbsolutePath();
                File file = new File(PATH);
                boolean isCreate = file.mkdirs();
                File outputFile = new File(file, "my_apk.apk");
                if (outputFile.exists()) {
                    boolean isDelete = outputFile.delete();
                }
                FileOutputStream fos = new FileOutputStream(outputFile);

                InputStream is = c.getInputStream();

                byte[] buffer = new byte[1024];
                int len1;
                long total = 0;
                while ((len1 = is.read(buffer)) != -1) {
                    total += len1;
                    fos.write(buffer, 0, len1);
                    publishProgress((int) ((total * 100) / lenghtOfFile));
                }
                fos.close();
                is.close();
                if (mPDialog != null)
                    mPDialog.dismiss();
                installApk();
            } catch (Exception e) {
                Log.e("UpdateAPP", "Update error! " + e.getMessage());
            }
            return null;
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            if (mPDialog != null)
                mPDialog.show();

        }

        @Override
        protected void onProgressUpdate(Integer... values) {
            super.onProgressUpdate(values);
            if (mPDialog != null) {
                mPDialog.setIndeterminate(false);
                mPDialog.setMax(100);
                mPDialog.setProgress(values[0]);
            }
        }

        @Override
        protected void onPostExecute(String result) {
            if (mPDialog != null)
                mPDialog.dismiss();
            if (result != null)
                Toast.makeText(mContext, "Download error: " + result, Toast.LENGTH_LONG).show();
            else
                Toast.makeText(mContext, "File Downloaded", Toast.LENGTH_SHORT).show();
        }

        private void installApk() {
            try {
                String PATH = Objects.requireNonNull(mContext.getExternalFilesDir(null)).getAbsolutePath();
                File file = new File(PATH + "/my_apk.apk");
                Intent intent = new Intent(Intent.ACTION_VIEW);
                if (Build.VERSION.SDK_INT >= 24) {
                    Uri downloaded_apk = FileProvider.getUriForFile(mContext, mContext.getApplicationContext().getPackageName() + ".provider", file);
                    intent.setDataAndType(downloaded_apk, "application/vnd.android.package-archive");
                    List<ResolveInfo> resInfoList = mContext.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
                    for (ResolveInfo resolveInfo : resInfoList) {
                        mContext.grantUriPermission(mContext.getApplicationContext().getPackageName() + ".provider", downloaded_apk, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
                    }
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
                    startActivity(intent);
                } else {
                    intent.setAction(Intent.ACTION_VIEW);
                    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                    intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
                    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                }
                startActivity(intent);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
</code>```

When testing on the emulator, a window pops up where you need to give permission in the settings, when I click settings, the window closes and nothing happens. And when testing on a real device, it allegedly starts downloading the file, then after downloading it is not on the watch.

Body:
I found a great example that works on the phone, but this code does not work on the clock, maybe there is a problem with the paths and on the clock they are different than on the phone? When testing on the emulator, a window pops up where you need to give permission in the settings, when I click settings, the window closes and nothing happens. And when testing on a real device, it allegedly starts downloading the file, then after downloading it is not on the watch.

AndroidManifest.xml

<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.WRITE_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>

provider_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
        name="external"
        path="." />
    <external-files-path
        name="external_files"
        path="." />
    <cache-path
        name="cache"
        path="." />
    <external-cache-path
        name="external_cache"
        path="." />
    <files-path
        name="files"
        path="." />
</paths>

GenericFileProvider.java

import androidx.core.content.FileProvider;

public class GenericFileProvider extends FileProvider {
   //This file would be empty.
}

MainActivity.java

import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;

public class MainActivity extends AppCompatActivity {

    private static final int PERMISSION_REQUEST_CODE = 200;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btn_click = findViewById(R.id.btn_click);
        btn_click.setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
            @Override
            public void onClick(View v) {
                if (checkPermission()) {
                    UpdateApp atualizaApp = new UpdateApp();
                    atualizaApp.setContext(MainActivity.this);
                    atualizaApp.execute("https://example.com/apks/my_apk.apk");
                } else {
                    requestPermission();
                }
            }
        });
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        if (requestCode == PERMISSION_REQUEST_CODE) {
            if (grantResults.length > 0) {

                boolean locationAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
                boolean cameraAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
                if (locationAccepted && cameraAccepted) {
                    UpdateApp updateApp = new UpdateApp();
                    updateApp.setContext(MainActivity.this);
                    updateApp.execute("https://example.com/apks/my_apk.apk");
                }
            }
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
    private boolean checkPermission() {
        int result = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
        int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);

        return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED;
    }

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
    private void requestPermission() {
        ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
    }

    public class UpdateApp extends AsyncTask<String, Integer, String> {
        private ProgressDialog mPDialog;
        private Context mContext;

        void setContext(Activity context) {
            mContext = context;
            context.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    mPDialog = new ProgressDialog(mContext);
                    mPDialog.setMessage("Please wait...");
                    mPDialog.setIndeterminate(true);
                    mPDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                    mPDialog.setCancelable(false);
                    mPDialog.show();
                }
            });
        }

        @Override
        protected String doInBackground(String... arg0) {
            try {

                URL url = new URL(arg0[0]);
                HttpURLConnection c = (HttpURLConnection) url.openConnection();
                c.setRequestMethod("GET");
                c.setDoOutput(true);
                c.connect();
                int lenghtOfFile = c.getContentLength();

                String PATH = Objects.requireNonNull(mContext.getExternalFilesDir(null)).getAbsolutePath();
                File file = new File(PATH);
                boolean isCreate = file.mkdirs();
                File outputFile = new File(file, "my_apk.apk");
                if (outputFile.exists()) {
                    boolean isDelete = outputFile.delete();
                }
                FileOutputStream fos = new FileOutputStream(outputFile);

                InputStream is = c.getInputStream();

                byte[] buffer = new byte[1024];
                int len1;
                long total = 0;
                while ((len1 = is.read(buffer)) != -1) {
                    total += len1;
                    fos.write(buffer, 0, len1);
                    publishProgress((int) ((total * 100) / lenghtOfFile));
                }
                fos.close();
                is.close();
                if (mPDialog != null)
                    mPDialog.dismiss();
                installApk();
            } catch (Exception e) {
                Log.e("UpdateAPP", "Update error! " + e.getMessage());
            }
            return null;
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            if (mPDialog != null)
                mPDialog.show();

        }

        @Override
        protected void onProgressUpdate(Integer... values) {
            super.onProgressUpdate(values);
            if (mPDialog != null) {
                mPDialog.setIndeterminate(false);
                mPDialog.setMax(100);
                mPDialog.setProgress(values[0]);
            }
        }

        @Override
        protected void onPostExecute(String result) {
            if (mPDialog != null)
                mPDialog.dismiss();
            if (result != null)
                Toast.makeText(mContext, "Download error: " + result, Toast.LENGTH_LONG).show();
            else
                Toast.makeText(mContext, "File Downloaded", Toast.LENGTH_SHORT).show();
        }

        private void installApk() {
            try {
                String PATH = Objects.requireNonNull(mContext.getExternalFilesDir(null)).getAbsolutePath();
                File file = new File(PATH + "/my_apk.apk");
                Intent intent = new Intent(Intent.ACTION_VIEW);
                if (Build.VERSION.SDK_INT >= 24) {
                    Uri downloaded_apk = FileProvider.getUriForFile(mContext, mContext.getApplicationContext().getPackageName() + ".provider", file);
                    intent.setDataAndType(downloaded_apk, "application/vnd.android.package-archive");
                    List<ResolveInfo> resInfoList = mContext.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
                    for (ResolveInfo resolveInfo : resInfoList) {
                        mContext.grantUriPermission(mContext.getApplicationContext().getPackageName() + ".provider", downloaded_apk, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
                    }
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
                    startActivity(intent);
                } else {
                    intent.setAction(Intent.ACTION_VIEW);
                    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                    intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
                    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                }
                startActivity(intent);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}

When testing on the emulator, a window pops up where you need to give permission in the settings, when I click settings, the window closes and nothing happens. And when testing on a real device, it allegedly starts downloading the file, then after downloading it is not on the watch.


问:
How do I add a single instance of an item from a List to a Cart List that show the quantity of that particular item using riverpod?
This image show List of Added items in the CartList, pressing the "--" or "+" does not reflect on the UI This second image shows the quantity of the same Item after I manually rebuild the UI**Say I have two Lists: **
List of Products from API List A [];
Empty CartList where products from List A above can be added to CartList once and increment the quantity if it has already existed in the CartList;
Example
1: List of items from the API [productA, productB, productC....];
2. Add an element from a list in 1 above if it does not exist in CartList before:- CartList = [productA];
3. If it already exist in CartList increase the quantity only and make it Single instance in the CartList like this: CartList = [productA(1),productB(5)...];
This code works fine but it doesn't update the UI except if I leave the page and open it again which not what I want.
This is the code below:

//This Code add the product to the CartList

```<code>Consumer(
    builder: (BuildContext context, WidgetRef ref, Widget? child) {
      return DefaultButton(
        onTap: () {
          ref.read(cartProvider.notifier).addToCart(product);
          context.pushRoute(
            const MyCartScreen(),
          );
        },
        text: "Add to cart",
      );
    },
  ),
</code>```

//This increase the count quantity of the product in the CartList

```<code>AddRemoveWidget(
      count: "$productCount",
      productDecrement: () {
        ref
            .read(cartProvider.notifier)
            .removeFromCart(index);
      },
      productIncrement: () {
        ref
            .read(cartProvider.notifier)
            .addToCart(
                cartItems[index].product!);
      },
    ),
</code>```

//This the StateNotifier

```<code>class CartList extends StateNotifier<List<CartItemModel>> {
 CartList() : super([]);

//Add Product to Cart
  void addToCart(Product product) {
    // check it product is int the list
    final isInList = state
        .where((element) => element.product!.sId == product.sId).isNotEmpty;
    if (isInList) {
      final p =
          state.where((element) => element.product!.sId == product.sId).first;
      p.quantity += 1;
      // final count = state.where((element) => element.product!.sId == product.sId).length;
      // final p = state.where((element) => element.product!.sId == product.sId).first;
      // p.quantity = count;
      final index = state.indexOf(p);
      final items = state;
      items[index] = p;
      state = items;
    } else {
      state = [...state, CartItemModel(product: product)];
    }
  }

void removeFromCart(int index) {
    // check it product is int the list
    final item = state[index];
    if (item.quantity == 1) {
      // remove it from the list of cart items
      state = state
          .where((element) => element.product!.sId != item.product!.sId)
          .toList();
    } else {
      item.quantity -= 1;
      state[index] = item;
    }
  }

}

final cartProvider = StateNotifierProvider<CartList, List<CartItemModel>>(
  (ref) => CartList(),
);
</code>```

Body:
This image show List of Added items in the CartList, pressing the "--" or "+" does not reflect on the UI This second image shows the quantity of the same Item after I manually rebuild the UI**Say I have two Lists: **
List of Products from API List A [];
Empty CartList where products from List A above can be added to CartList once and increment the quantity if it has already existed in the CartList;
Example
1: List of items from the API [productA, productB, productC....];
2. Add an element from a list in 1 above if it does not exist in CartList before:- CartList = [productA];
3. If it already exist in CartList increase the quantity only and make it Single instance in the CartList like this: CartList = [productA(1),productB(5)...];
This code works fine but it doesn't update the UI except if I leave the page and open it again which not what I want.
This is the code below:

//This Code add the product to the CartList

Consumer(
    builder: (BuildContext context, WidgetRef ref, Widget? child) {
      return DefaultButton(
        onTap: () {
          ref.read(cartProvider.notifier).addToCart(product);
          context.pushRoute(
            const MyCartScreen(),
          );
        },
        text: "Add to cart",
      );
    },
  ),

//This increase the count quantity of the product in the CartList

AddRemoveWidget(
      count: "$productCount",
      productDecrement: () {
        ref
            .read(cartProvider.notifier)
            .removeFromCart(index);
      },
      productIncrement: () {
        ref
            .read(cartProvider.notifier)
            .addToCart(
                cartItems[index].product!);
      },
    ),

//This the StateNotifier

class CartList extends StateNotifier<List<CartItemModel>> {
 CartList() : super([]);

//Add Product to Cart
  void addToCart(Product product) {
    // check it product is int the list
    final isInList = state
        .where((element) => element.product!.sId == product.sId).isNotEmpty;
    if (isInList) {
      final p =
          state.where((element) => element.product!.sId == product.sId).first;
      p.quantity += 1;
      // final count = state.where((element) => element.product!.sId == product.sId).length;
      // final p = state.where((element) => element.product!.sId == product.sId).first;
      // p.quantity = count;
      final index = state.indexOf(p);
      final items = state;
      items[index] = p;
      state = items;
    } else {
      state = [...state, CartItemModel(product: product)];
    }
  }

void removeFromCart(int index) {
    // check it product is int the list
    final item = state[index];
    if (item.quantity == 1) {
      // remove it from the list of cart items
      state = state
          .where((element) => element.product!.sId != item.product!.sId)
          .toList();
    } else {
      item.quantity -= 1;
      state[index] = item;
    }
  }

}

final cartProvider = StateNotifierProvider<CartList, List<CartItemModel>>(
  (ref) => CartList(),
);


问:
How do I create a DynamicMarker in vue composition api with custom html
I am trying to implement a code editor with remote users and currently I have a basic code Editor component like this.

```<code>...
<script setup>
   import ace, { Range } from 'ace-builds'
   import "ace-builds/webpack-resolver";
   import 'ace-builds/src-noconflict/snippets/javascript'
   import { reactive, ref, onMounted } from 'vue'

   const ace_text_area = ref(null)
   const props = defineProps({ value: String })
   const state = reactive({
      aceEditor:null,
      value:""
   })

   onMounted(()=>{
     state.value = props.value
     state.aceEditor = ace.edit(ace_text_area.value, {value: state.value});
   })
</script>
</code>```

How do I add a remote user using addDynamicMarker ?

Body:
I am trying to implement a code editor with remote users and currently I have a basic code Editor component like this.

...

How do I add a remote user using addDynamicMarker ?


问:
CKEditor component HTML tags applied but not displayed
I am using ReactJS. I am trying to use CKEditor component.

I followed this tutorial.

Heading effect applied to the text.

I confirmed that the
 tag was applied to the data in console.log

However, it does not apply to the screen.

The same goes for media wrapped in
 . What is wrong?


问:
check for headers in mongodb if true update a key in data that is being created
i am trying to create a basic schema for which i am updating data from postman where in the headers field i am posting a key and its value and if i pass the value as true i want to change a key as 0 which has a certain value in body before getting saved in database or after getting saved in data base i tried this first i used updateone the i used findoneandupdate after the .create data as well that didnt work too</p>
```<code>const myOrderDetail = async function(req,res){
let head = req.headers.isfreeappuser
    if(head=="true"){
       let amount = await orderModel.create(data)
       //let newam = await orderModel.findOneAndUpdate({head:"true"},{amount: {$set:0}},{new : true})
       res.send({msg : amount})

    }
    res.send("it is false")
    console.log({msg : head})
</code>```

Body:
i am trying to create a basic schema for which i am updating data from postman where in the headers field i am posting a key and its value and if i pass the value as true i want to change a key as 0 which has a certain value in body before getting saved in database or after getting saved in data base i tried this first i used updateone the i used findoneandupdate after the .create data as well that didnt work too

const myOrderDetail = async function(req,res){
let head = req.headers.isfreeappuser
    if(head=="true"){
       let amount = await orderModel.create(data)
       //let newam = await orderModel.findOneAndUpdate({head:"true"},{amount: {$set:0}},{new : true})
       res.send({msg : amount})

    }
    res.send("it is false")
    console.log({msg : head})


问:
Make curved lines in border and rounded corners. (Flutter)
I am trying to create a border with curved lines and rounded corners in Flutter. I was able to curve the lines using shapemaker.web.app, but I was not able to round the corners.

I have already tried it with a ClipPath +  Clipper:

```<code>class NativeClipper extends CustomClipper<Path> {

  @override
  bool shouldReclip(covariant CustomClipper<Path> oldClipper) => true;

  @override
  Path getClip(Size size) {

    Path path0 = Path();
    path0.moveTo(size.width*0.0833333,size.height*0.0714286);
    path0.lineTo(size.width*0.9166667,size.height*0.0714286);
    path0.quadraticBezierTo(size.width*0.9583333,size.height*0.5000143,size.width*0.9166667,size.height*0.9285714);
    path0.cubicTo(size.width*0.7083333,size.height*0.9285714,size.width*0.2916667,size.height*0.9285714,size.width*0.0833333,size.height*0.9285714);
    path0.quadraticBezierTo(size.width*0.0416833,size.height*0.5001143,size.width*0.0833333,size.height*0.0714286);

    return path0;
  }
}
</code>```

Current Result:

Expected Result: (do not pay attention to the Colors)

Body:
I am trying to create a border with curved lines and rounded corners in Flutter. I was able to curve the lines using shapemaker.web.app, but I was not able to round the corners.

I have already tried it with a ClipPath +  Clipper:

class NativeClipper extends CustomClipper<Path> {

  @override
  bool shouldReclip(covariant CustomClipper<Path> oldClipper) => true;

  @override
  Path getClip(Size size) {

    Path path0 = Path();
    path0.moveTo(size.width*0.0833333,size.height*0.0714286);
    path0.lineTo(size.width*0.9166667,size.height*0.0714286);
    path0.quadraticBezierTo(size.width*0.9583333,size.height*0.5000143,size.width*0.9166667,size.height*0.9285714);
    path0.cubicTo(size.width*0.7083333,size.height*0.9285714,size.width*0.2916667,size.height*0.9285714,size.width*0.0833333,size.height*0.9285714);
    path0.quadraticBezierTo(size.width*0.0416833,size.height*0.5001143,size.width*0.0833333,size.height*0.0714286);

    return path0;
  }
}

Current Result:

Expected Result: (do not pay attention to the Colors)


问:
Autovivify and attribute like access
How can I make my dict autovivify when I access it like ATTRIBUTE i.e. z.ab</p>
```<code>class AttrDict(dict):
    def __init__(self, *args, **kwargs):
        super(AttrDict, self).__init__(*args, **kwargs)
        self.__dict__ = self

    def __missing__(self, key):
        value = self[key] = type(self)()
        return value

In [6]: z=AttrDict()
  #should vivify here
In [7]: z.ab
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 z.ab

AttributeError: 'AttrDict' object has no attribute 'ab'

In [8]: z['ab']
Out[8]: {}

In [9]: z.ab
Out[9]: {}
</code>```

Title: Autovivify and attribute like access

Body:
How can I make my dict autovivify when I access it like ATTRIBUTE i.e. z.ab

class AttrDict(dict):
    def __init__(self, *args, **kwargs):
        super(AttrDict, self).__init__(*args, **kwargs)
        self.__dict__ = self

    def __missing__(self, key):
        value = self[key] = type(self)()
        return value

In [6]: z=AttrDict()
  #should vivify here
In [7]: z.ab
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 z.ab

AttributeError: 'AttrDict' object has no attribute 'ab'

In [8]: z['ab']
Out[8]: {}

In [9]: z.ab
Out[9]: {}


问:
how to call typescript function on a action button in adminlte theme datatable of datatable.net library
$("#example1").DataTable({ "responsive": true, "lengthChange": true, "autoWidth": false, "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis", ],         data: this.voucherDTO,             columns: [ { data: 'voucherno'}, { data: 'accountof' }, { data: 'accountHead.accountHead.name' }, { data: 'amount' }, { data: 'narration' }, { data: 'vdate'}, { data: null, defaultContent: '<button type="button" class="btn btn-primary btn-block" ></button>', createdCell: this.doSomething() }],                                                 }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');

It is showing data table perfectly but when I click on respective row edit button the dosomething() function does not work.

i tried to add :

```<code>createdCell: function(cell: any, cellData: any, rowData: any, rowIndex: any, colIndex: any) {
            // Add click event to action button
            $(cell).find('button').click(function() {
              // Call component function on button click
              this.doSomething(rowData);
            });
          }
</code>```

above function call but it show error: 'this' implicitly has type 'any' because it does not have a type annotation.ts(2683)

I need to call a component function with rowindex to call api with the specific row data.

Body:
$("#example1").DataTable({ "responsive": true, "lengthChange": true, "autoWidth": false, "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis", ],         data: this.voucherDTO,             columns: [ { data: 'voucherno'}, { data: 'accountof' }, { data: 'accountHead.accountHead.name' }, { data: 'amount' }, { data: 'narration' }, { data: 'vdate'}, { data: null, defaultContent: '<button type="button" class="btn btn-primary btn-block" ></button>', createdCell: this.doSomething() }],                                                 }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');

It is showing data table perfectly but when I click on respective row edit button the dosomething() function does not work.

i tried to add :

createdCell: function(cell: any, cellData: any, rowData: any, rowIndex: any, colIndex: any) {
            // Add click event to action button
            $(cell).find('button').click(function() {
              // Call component function on button click
              this.doSomething(rowData);
            });
          }

above function call but it show error: 'this' implicitly has type 'any' because it does not have a type annotation.ts(2683)

I need to call a component function with rowindex to call api with the specific row data.


问:
NestJs/ClientProxy: Manual listen to events without decorators
Is there a manual way to subscribe to a event message pattern without using decorators on a function?
In a service, I send a message to a different microservice.
The call return nothing just void but asynchronously triggers an event, which i want to listen to in the service right afterwards

Example given, would maybe work like this

// An event will be triggered later, after first value
await lastValueFrom(
  this.rabbitmqClient.send(RmqPatterns.DO_STUFF, payload),
);

// Now listening for that async event
this.rabbitmqClient.listen(RmqPatterns.DID_STUFF, async msg => {
  console.log(`Received message: ${msg.content.toString()}`);
});
```


Title: Why I got huge loss validation for training model?

Body:
My loss is validation is changed suddenly by a huge amount and I don't know why?
Do you have any suggestions to fix this problem?

I used for training 9533 images and for validation 2724 images

Model: "model"

_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         [(None, 224, 224, 3)]     0
_________________________________________________________________
sequential (Sequential)      (None, 7, 7, 1024)        56487040
_________________________________________________________________
flatten (Flatten)            (None, 50176)             0
_________________________________________________________________
dense (Dense)                (None, 512)               25690624
_________________________________________________________________
batch_normalization (BatchNo (None, 512)               2048
_________________________________________________________________
dropout_2 (Dropout)          (None, 512)               0
_________________________________________________________________
batch_normalization_1 (Batch (None, 512)               2048
_________________________________________________________________
dense_2 (Dense)              (None, 1)                 513
=================================================================
Total params: 82,182,273
Trainable params: 82,180,225
Non-trainable params: 2,048

from tensorflow.keras.callbacks import EarlyStopping

es = EarlyStopping(monitor='val_acc', mode='max', verbose=1, patience=60)

model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001),
             loss = 'binary_crossentropy', metrics = ['acc'])
history =model.fit(train_set, epochs=150,steps_per_epoch=149, validation_data=test_set, validation_steps=43,callbacks=[es])

2022-12-24 09:44:53.627442: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
Epoch 1/150
2022-12-24 09:44:56.776701: I tensorflow/stream_executor/cuda/cuda_dnn.cc:369] Loaded cuDNN version 8005
149/149 [==============================] - 316s 2s/step - loss: 0.6654 - acc: 0.6526 - val_loss: 0.7226 - val_acc: 0.4596
Epoch 2/150
149/149 [==============================] - 214s 1s/step - loss: 0.5438 - acc: 0.7849 - val_loss: 0.7408 - val_acc: 0.8513
Epoch 3/150
149/149 [==============================] - 213s 1s/step - loss: 0.4704 - acc: 0.8266 - val_loss: 0.4078 - val_acc: 0.8590
Epoch 4/150
149/149 [==============================] - 212s 1s/step - loss: 0.4360 - acc: 0.8393 - val_loss: 0.7902 - val_acc: 0.8513
Epoch 5/150
149/149 [==============================] - 213s 1s/step - loss: 0.4080 - acc: 0.8526 - val_loss: 4.9581 - val_acc: 0.1858
Epoch 6/150
149/149 [==============================] - 213s 1s/step - loss: 0.4054 - acc: 0.8510 - val_loss: 0.7537 - val_acc: 0.4725
Epoch 7/150
149/149 [==============================] - 212s 1s/step - loss: 0.3959 - acc: 0.8573 - val_loss: 1.7509 - val_acc: 0.2034
Epoch 8/150
149/149 [==============================] - 212s 1s/step - loss: 0.3922 - acc: 0.8579 - val_loss: 2.4338 - val_acc: 0.5808
Epoch 9/150
149/149 [==============================] - 214s 1s/step - loss: 0.3901 - acc: 0.8621 - val_loss: 0.4251 - val_acc: 0.8656
Epoch 10/150
149/149 [==============================] - 213s 1s/step - loss: 0.4003 - acc: 0.8596 - val_loss: 323.0921 - val_acc: 0.8374
Epoch 11/150
149/149 [==============================] - 213s 1s/step - loss: 0.4406 - acc: 0.8475 - val_loss: 2.6854 - val_acc: 0.2048
Epoch 12/150
149/149 [==============================] - 213s 1s/step - loss: 0.4364 - acc: 0.8478 - val_loss: 0.4173 - val_acc: 0.8502
Epoch 13/150
149/149 [==============================] - 213s 1s/step - loss: 0.4328 - acc: 0.8465 - val_loss: 0.7263 - val_acc: 0.8513
Epoch 14/150
149/149 [==============================] - 215s 1s/step - loss: 0.4331 - acc: 0.8479 - val_loss: 0.7787 - val_acc: 0.8484
Epoch 15/150
149/149 [==============================] - 216s 1s/step - loss: 0.4294 - acc: 0.8489 - val_loss: 0.6814 - val_acc: 0.8488
Epoch 16/150
149/149 [==============================] - 214s 1s/step - loss: 0.4269 - acc: 0.8497 - val_loss: 0.5430 - val_acc: 0.8488
Epoch 17/150
149/149 [==============================] - 213s 1s/step - loss: 0.4233 - acc: 0.8495 - val_loss: 1.3373 - val_acc: 0.8484
Epoch 18/150
149/149 [==============================] - 214s 1s/step - loss: 0.4209 - acc: 0.8491 - val_loss: 0.4197 - val_acc: 0.8502
Epoch 19/150
149/149 [==============================] - 213s 1s/step - loss: 0.4127 - acc: 0.8495 - val_loss: 0.5153 - val_acc: 0.8480
Epoch 20/150
149/149 [==============================] - 214s 1s/step - loss: 0.4207 - acc: 0.8504 - val_loss: 1.9701 - val_acc: 0.1773
Epoch 21/150
149/149 [==============================] - 213s 1s/step - loss: 0.4253 - acc: 0.8479 - val_loss: 0.4600 - val_acc: 0.8488
Epoch 22/150
149/149 [==============================] - 214s 1s/step - loss: 0.4256 - acc: 0.8482 - val_loss: 0.4191 - val_acc: 0.8510
Epoch 23/150
149/149 [==============================] - 213s 1s/step - loss: 0.4227 - acc: 0.8474 - val_loss: 0.4114 - val_acc: 0.8513
Epoch 24/150
149/149 [==============================] - 212s 1s/step - loss: 0.4227 - acc: 0.8474 - val_loss: 0.4148 - val_acc: 0.8506
Epoch 25/150
149/149 [==============================] - 214s 1s/step - loss: 0.4187 - acc: 0.8484 - val_loss: 0.4060 - val_acc: 0.8513
Epoch 26/150
149/149 [==============================] - 213s 1s/step - loss: 0.4158 - acc: 0.8461 - val_loss: 11608.2793 - val_acc: 0.8513
Epoch 27/150
149/149 [==============================] - 214s 1s/step - loss: 0.4072 - acc: 0.8507 - val_loss: 0.5867 - val_acc: 0.8510
Epoch 28/150
149/149 [==============================] - 213s 1s/step - loss: 0.3938 - acc: 0.8561 - val_loss: 0.5836 - val_acc: 0.8513
Epoch 29/150
149/149 [==============================] - 213s 1s/step - loss: 0.3926 - acc: 0.8566 - val_loss: 0.4901 - val_acc: 0.8499
Epoch 30/150
149/149 [==============================] - 214s 1s/step - loss: 0.3847 - acc: 0.8581 - val_loss: 0.4888 - val_acc: 0.8528
Epoch 31/150
149/149 [==============================] - 213s 1s/step - loss: 0.4060 - acc: 0.8508 - val_loss: 0.4505 - val_acc: 0.8513
Epoch 32/150
149/149 [==============================] - 213s 1s/step - loss: 0.3811 - acc: 0.8603 - val_loss: 0.4195 - val_acc: 0.8671
Epoch 33/150
149/149 [==============================] - 214s 1s/step - loss: 0.3852 - acc: 0.8595 - val_loss: 0.5208 - val_acc: 0.7988
Epoch 34/150
149/149 [==============================] - 213s 1s/step - loss: 0.3798 - acc: 0.8607 - val_loss: 17.5676 - val_acc: 0.8634
Epoch 35/150
149/149 [==============================] - 213s 1s/step - loss: 0.3774 - acc: 0.8618 - val_loss: 0.3762 - val_acc: 0.8704
Epoch 36/150
149/149 [==============================] - 212s 1s/step - loss: 0.3773 - acc: 0.8613 - val_loss: 0.7999 - val_acc: 0.8506
Epoch 37/150
149/149 [==============================] - 213s 1s/step - loss: 0.3753 - acc: 0.8625 - val_loss: 386.2837 - val_acc: 0.8649
Epoch 38/150
149/149 [==============================] - 213s 1s/step - loss: 0.3711 - acc: 0.8675 - val_loss: 28.4553 - val_acc: 0.8330
Epoch 39/150
149/149 [==============================] - 212s 1s/step - loss: 0.3770 - acc: 0.8622 - val_loss: 1.6037 - val_acc: 0.8568
Epoch 40/150
149/149 [==============================] - 213s 1s/step - loss: 0.3690 - acc: 0.8659 - val_loss: 1.7776 - val_acc: 0.8513
Epoch 41/150
149/149 [==============================] - 213s 1s/step - loss: 0.3710 - acc: 0.8653 - val_loss: 153.6027 - val_acc: 0.8711
Epoch 42/150
149/149 [==============================] - 213s 1s/step - loss: 0.3649 - acc: 0.8667 - val_loss: 22623.5195 - val_acc: 0.8458
Epoch 43/150
149/149 [==============================] - 212s 1s/step - loss: 0.4131 - acc: 0.8556 - val_loss: 0.5640 - val_acc: 0.8502
Epoch 44/150
149/149 [==============================] - 212s 1s/step - loss: 0.4263 - acc: 0.8506 - val_loss: 1.8865 - val_acc: 0.8480
Epoch 45/150
149/149 [==============================] - 212s 1s/step - loss: 0.4274 - acc: 0.8505 - val_loss: 2032.7307 - val_acc: 0.8462
Epoch 46/150
149/149 [==============================] - 215s 1s/step - loss: 0.4274 - acc: 0.8502 - val_loss: 634.5857 - val_acc: 0.8477
Epoch 47/150
149/149 [==============================] - 212s 1s/step - loss: 0.4133 - acc: 0.8540 - val_loss: 2.7397 - val_acc: 0.1806
Epoch 48/150
149/149 [==============================] - 212s 1s/step - loss: 0.3606 - acc: 0.8697 - val_loss: 0.9382 - val_acc: 0.8550
Epoch 49/150
149/149 [==============================] - 212s 1s/step - loss: 0.3639 - acc: 0.8689 - val_loss: 17156.6055 - val_acc: 0.8623
Epoch 50/150
149/149 [==============================] - 212s 1s/step - loss: 0.3661 - acc: 0.8661 - val_loss: 2815.0986 - val_acc: 0.8554
Epoch 51/150
149/149 [==============================] - 213s 1s/step - loss: 0.3576 - acc: 0.8714 - val_loss: 0.7997 - val_acc: 0.8521
Epoch 52/150
149/149 [==============================] - 212s 1s/step - loss: 0.3673 - acc: 0.8706 - val_loss: 0.3928 - val_acc: 0.8620
Epoch 53/150
149/149 [==============================] - 212s 1s/step - loss: 0.3525 - acc: 0.8717 - val_loss: 0.4565 - val_acc: 0.8605
Epoch 54/150
149/149 [==============================] - 213s 1s/step - loss: 0.3524 - acc: 0.8750 - val_loss: 2680.2422 - val_acc: 0.8667
Epoch 55/150
149/149 [==============================] - 211s 1s/step - loss: 0.3575 - acc: 0.8735 - val_loss: 372.1012 - val_acc: 0.8535
Epoch 56/150
149/149 [==============================] - 212s 1s/step - loss: 0.3510 - acc: 0.8720 - val_loss: 6.8838 - val_acc: 0.8678
Epoch 57/150
149/149 [==============================] - 212s 1s/step - loss: 0.3489 - acc: 0.8738 - val_loss: 0.5691 - val_acc: 0.8554
Epoch 58/150
149/149 [==============================] - 212s 1s/step - loss: 0.3460 - acc: 0.8772 - val_loss: 0.3476 - val_acc: 0.8759
Epoch 59/150
149/149 [==============================] - 212s 1s/step - loss: 0.3529 - acc: 0.8716 - val_loss: 0.5015 - val_acc: 0.8557
Epoch 60/150
149/149 [==============================] - 214s 1s/step - loss: 0.3531 - acc: 0.8730 - val_loss: 0.3856 - val_acc: 0.8645
Epoch 61/150
149/149 [==============================] - 212s 1s/step - loss: 0.3405 - acc: 0.8773 - val_loss: 0.3940 - val_acc: 0.8767
Epoch 62/150
149/149 [==============================] - 212s 1s/step - loss: 0.3440 - acc: 0.8774 - val_loss: 0.3669 - val_acc: 0.8752
Epoch 63/150
149/149 [==============================] - 213s 1s/step - loss: 0.3418 - acc: 0.8776 - val_loss: 900.9280 - val_acc: 0.1935
Epoch 64/150
149/149 [==============================] - 213s 1s/step - loss: 0.3452 - acc: 0.8760 - val_loss: 175.3406 - val_acc: 0.2651
Epoch 65/150
149/149 [==============================] - 211s 1s/step - loss: 0.3447 - acc: 0.8766 - val_loss: 485.4781 - val_acc: 0.8524
Epoch 66/150
149/149 [==============================] - 212s 1s/step - loss: 0.3414 - acc: 0.8796 - val_loss: 0.5346 - val_acc: 0.8550
Epoch 67/150
149/149 [==============================] - 213s 1s/step - loss: 0.3478 - acc: 0.8745 - val_loss: 4.4924 - val_acc: 0.3025
Epoch 68/150
149/149 [==============================] - 213s 1s/step - loss: 0.3410 - acc: 0.8775 - val_loss: 0.3990 - val_acc: 0.8763
Epoch 69/150
149/149 [==============================] - 213s 1s/step - loss: 0.3417 - acc: 0.8775 - val_loss: 0.4408 - val_acc: 0.8616
Epoch 70/150
149/149 [==============================] - 212s 1s/step - loss: 0.3440 - acc: 0.8755 - val_loss: 0.7289 - val_acc: 0.8814
Epoch 71/150
149/149 [==============================] - 212s 1s/step - loss: 0.3379 - acc: 0.8787 - val_loss: 0.4772 - val_acc: 0.8660
Epoch 72/150
149/149 [==============================] - 213s 1s/step - loss: 0.3394 - acc: 0.8780 - val_loss: 26.1834 - val_acc: 0.7192
Epoch 73/150
149/149 [==============================] - 213s 1s/step - loss: 0.3356 - acc: 0.8806 - val_loss: 0.3749 - val_acc: 0.8781
Epoch 74/150
149/149 [==============================] - 212s 1s/step - loss: 0.3378 - acc: 0.8791 - val_loss: 0.4133 - val_acc: 0.8741
Epoch 75/150
149/149 [==============================] - 213s 1s/step - loss: 0.3365 - acc: 0.8775 - val_loss: 0.6339 - val_acc: 0.8517
Epoch 76/150
149/149 [==============================] - 212s 1s/step - loss: 0.3417 - acc: 0.8801 - val_loss: 1.1401 - val_acc: 0.3363
Epoch 77/150
149/149 [==============================] - 213s 1s/step - loss: 0.3395 - acc: 0.8772 - val_loss: 1.0921 - val_acc: 0.8767
Epoch 78/150
149/149 [==============================] - 216s 1s/step - loss: 0.3322 - acc: 0.8792 - val_loss: 0.3860 - val_acc: 0.8796
Epoch 79/150
149/149 [==============================] - 218s 1s/step - loss: 0.3314 - acc: 0.8797 - val_loss: 0.4313 - val_acc: 0.8634
Epoch 80/150
149/149 [==============================] - 214s 1s/step - loss: 0.3271 - acc: 0.8839 - val_loss: 0.4355 - val_acc: 0.8513
Epoch 81/150
149/149 [==============================] - 212s 1s/step - loss: 0.3341 - acc: 0.8807 - val_loss: 0.5978 - val_acc: 0.7640
Epoch 82/150
149/149 [==============================] - 213s 1s/step - loss: 0.3352 - acc: 0.8785 - val_loss: 0.3702 - val_acc: 0.8737
Epoch 83/150
149/149 [==============================] - 212s 1s/step - loss: 0.3474 - acc: 0.8766 - val_loss: 1867.5101 - val_acc: 0.8557
Epoch 84/150
149/149 [==============================] - 212s 1s/step - loss: 0.3607 - acc: 0.8706 - val_loss: 0.3549 - val_acc: 0.8756
Epoch 85/150
149/149 [==============================] - 213s 1s/step - loss: 0.3415 - acc: 0.8761 - val_loss: 0.3836 - val_acc: 0.8840
Epoch 86/150
149/149 [==============================] - 211s 1s/step - loss: 0.3442 - acc: 0.8764 - val_loss: 0.3777 - val_acc: 0.8682
Epoch 87/150
149/149 [==============================] - 212s 1s/step - loss: 0.3360 - acc: 0.8802 - val_loss: 5225.8945 - val_acc: 0.8612
Epoch 88/150
149/149 [==============================] - 211s 1s/step - loss: 0.3419 - acc: 0.8763 - val_loss: 0.4597 - val_acc: 0.8638
Epoch 89/150
149/149 [==============================] - 212s 1s/step - loss: 0.3334 - acc: 0.8814 - val_loss: 0.5231 - val_acc: 0.8627
Epoch 90/150
149/149 [==============================] - 212s 1s/step - loss: 0.3298 - acc: 0.8813 - val_loss: 0.3845 - val_acc: 0.8807
Epoch 91/150
149/149 [==============================] - 212s 1s/step - loss: 0.3310 - acc: 0.8818 - val_loss: 0.3812 - val_acc: 0.8730
Epoch 92/150
149/149 [==============================] - 212s 1s/step - loss: 0.3281 - acc: 0.8826 - val_loss: 0.3276 - val_acc: 0.8880
Epoch 93/150
149/149 [==============================] - 212s 1s/step - loss: 0.3252 - acc: 0.8857 - val_loss: 0.3554 - val_acc: 0.8833
Epoch 94/150
149/149 [==============================] - 214s 1s/step - loss: 0.3286 - acc: 0.8845 - val_loss: 0.3449 - val_acc: 0.8811
Epoch 95/150
149/149 [==============================] - 214s 1s/step - loss: 0.3224 - acc: 0.8864 - val_loss: 0.4516 - val_acc: 0.8733
Epoch 96/150
149/149 [==============================] - 213s 1s/step - loss: 0.3222 - acc: 0.8871 - val_loss: 0.3827 - val_acc: 0.8737
Epoch 97/150
149/149 [==============================] - 214s 1s/step - loss: 0.3152 - acc: 0.8893 - val_loss: 0.3400 - val_acc: 0.8807
Epoch 98/150
149/149 [==============================] - 213s 1s/step - loss: 0.3244 - acc: 0.8865 - val_loss: 0.4585 - val_acc: 0.8825
Epoch 99/150
149/149 [==============================] - 213s 1s/step - loss: 0.3189 - acc: 0.8870 - val_loss: 0.3198 - val_acc: 0.8866
Epoch 100/150
149/149 [==============================] - 214s 1s/step - loss: 0.3181 - acc: 0.8875 - val_loss: 0.4341 - val_acc: 0.8763
Epoch 101/150
149/149 [==============================] - 213s 1s/step - loss: 0.3169 - acc: 0.8887 - val_loss: 3.6571 - val_acc: 0.8807
Epoch 102/150
149/149 [==============================] - 215s 1s/step - loss: 0.3134 - acc: 0.8886 - val_loss: 0.3532 - val_acc: 0.8888
Epoch 103/150
149/149 [==============================] - 215s 1s/step - loss: 0.3130 - acc: 0.8903 - val_loss: 3.1462 - val_acc: 0.8939
Epoch 104/150
149/149 [==============================] - 213s 1s/step - loss: 0.3118 - acc: 0.8916 - val_loss: 557.1219 - val_acc: 0.8748
Epoch 105/150
149/149 [==============================] - 213s 1s/step - loss: 0.3118 - acc: 0.8910 - val_loss: 0.4914 - val_acc: 0.8822
Epoch 106/150
149/149 [==============================] - 213s 1s/step - loss: 0.3161 - acc: 0.8870 - val_loss: 0.5733 - val_acc: 0.8689
Epoch 107/150
149/149 [==============================] - 213s 1s/step - loss: 0.3112 - acc: 0.8908 - val_loss: 0.3187 - val_acc: 0.8968
Epoch 108/150
149/149 [==============================] - 214s 1s/step - loss: 0.3093 - acc: 0.8913 - val_loss: 6.7099 - val_acc: 0.8906
Epoch 109/150
149/149 [==============================] - 212s 1s/step - loss: 0.3027 - acc: 0.8957 - val_loss: 0.3419 - val_acc: 0.8910
Epoch 110/150
149/149 [==============================] - 214s 1s/step - loss: 0.3038 - acc: 0.8962 - val_loss: 0.4641 - val_acc: 0.8814
Epoch 111/150
149/149 [==============================] - 214s 1s/step - loss: 0.3020 - acc: 0.8955 - val_loss: 1886.6735 - val_acc: 0.8899
Epoch 112/150
149/149 [==============================] - 213s 1s/step - loss: 0.3024 - acc: 0.8930 - val_loss: 0.3290 - val_acc: 0.8891
Epoch 113/150
149/149 [==============================] - 213s 1s/step - loss: 0.2965 - acc: 0.8954 - val_loss: 673.0439 - val_acc: 0.8906
Epoch 114/150
149/149 [==============================] - 213s 1s/step - loss: 0.3046 - acc: 0.8939 - val_loss: 0.3333 - val_acc: 0.8895
Epoch 115/150
149/149 [==============================] - 213s 1s/step - loss: 0.2936 - acc: 0.8988 - val_loss: 918.0665 - val_acc: 0.8822
Epoch 116/150
149/149 [==============================] - 214s 1s/step - loss: 0.2975 - acc: 0.8954 - val_loss: 417.7471 - val_acc: 0.8866
Epoch 117/150
149/149 [==============================] - 213s 1s/step - loss: 0.2984 - acc: 0.8984 - val_loss: 411.4460 - val_acc: 0.8833
Epoch 118/150
149/149 [==============================] - 213s 1s/step - loss: 0.2989 - acc: 0.8965 - val_loss: 0.7020 - val_acc: 0.8851
Epoch 119/150
149/149 [==============================] - 214s 1s/step - loss: 0.2909 - acc: 0.8991 - val_loss: 0.4214 - val_acc: 0.8935
Epoch 120/150
149/149 [==============================] - 214s 1s/step - loss: 0.2950 - acc: 0.8975 - val_loss: 0.5487 - val_acc: 0.8965
Epoch 121/150
149/149 [==============================] - 214s 1s/step - loss: 0.2904 - acc: 0.8997 - val_loss: 0.5133 - val_acc: 0.8704
Epoch 122/150
149/149 [==============================] - 212s 1s/step - loss: 0.2879 - acc: 0.9027 - val_loss: 0.3872 - val_acc: 0.8987
Epoch 123/150
149/149 [==============================] - 213s 1s/step - loss: 0.2876 - acc: 0.9011 - val_loss: 0.4144 - val_acc: 0.8774
Epoch 124/150
149/149 [==============================] - 216s 1s/step - loss: 0.2908 - acc: 0.9001 - val_loss: 0.3101 - val_acc: 0.8924
Epoch 125/150
149/149 [==============================] - 214s 1s/step - loss: 0.2881 - acc: 0.9011 - val_loss: 0.3160 - val_acc: 0.9027
Epoch 126/150
149/149 [==============================] - 212s 1s/step - loss: 0.2862 - acc: 0.9016 - val_loss: 1158.0825 - val_acc: 0.5000
Epoch 127/150
149/149 [==============================] - 213s 1s/step - loss: 0.2865 - acc: 0.9002 - val_loss: 0.9562 - val_acc: 0.8979
Epoch 128/150
149/149 [==============================] - 213s 1s/step - loss: 0.2840 - acc: 0.9049 - val_loss: 0.5856 - val_acc: 0.8899
Epoch 129/150
149/149 [==============================] - 213s 1s/step - loss: 0.2839 - acc: 0.9022 - val_loss: 0.6770 - val_acc: 0.8932
Epoch 130/150
149/149 [==============================] - 212s 1s/step - loss: 0.2773 - acc: 0.9043 - val_loss: 0.2974 - val_acc: 0.8943
Epoch 131/150
149/149 [==============================] - 213s 1s/step - loss: 0.2862 - acc: 0.9019 - val_loss: 317.9427 - val_acc: 0.8774
Epoch 132/150
149/149 [==============================] - 212s 1s/step - loss: 0.2872 - acc: 0.9000 - val_loss: 0.5752 - val_acc: 0.8572
Epoch 133/150
149/149 [==============================] - 212s 1s/step - loss: 0.2857 - acc: 0.8991 - val_loss: 0.3966 - val_acc: 0.9020
Epoch 134/150
149/149 [==============================] - 213s 1s/step - loss: 0.2829 - acc: 0.9030 - val_loss: 2.7376 - val_acc: 0.8983
Epoch 135/150
149/149 [==============================] - 213s 1s/step - loss: 0.2812 - acc: 0.9044 - val_loss: 0.3372 - val_acc: 0.9101
Epoch 136/150
149/149 [==============================] - 213s 1s/step - loss: 0.2758 - acc: 0.9058 - val_loss: 0.3804 - val_acc: 0.8998
Epoch 137/150
149/149 [==============================] - 213s 1s/step - loss: 0.2752 - acc: 0.9045 - val_loss: 0.3713 - val_acc: 0.8950
Epoch 138/150
149/149 [==============================] - 214s 1s/step - loss: 0.2766 - acc: 0.9071 - val_loss: 0.3311 - val_acc: 0.9049
Epoch 139/150
149/149 [==============================] - 214s 1s/step - loss: 0.2777 - acc: 0.9045 - val_loss: 0.2921 - val_acc: 0.9068
Epoch 140/150
149/149 [==============================] - 215s 1s/step - loss: 0.2772 - acc: 0.9071 - val_loss: 10.6979 - val_acc: 0.7346
Epoch 141/150
149/149 [==============================] - 213s 1s/step - loss: 0.2786 - acc: 0.9056 - val_loss: 0.3320 - val_acc: 0.8972
Epoch 142/150
149/149 [==============================] - 214s 1s/step - loss: 0.2743 - acc: 0.9058 - val_loss: 39.9653 - val_acc: 0.8976
Epoch 143/150
149/149 [==============================] - 213s 1s/step - loss: 0.2814 - acc: 0.9042 - val_loss: 167.1936 - val_acc: 0.8726
Epoch 144/150
149/149 [==============================] - 212s 1s/step - loss: 0.2708 - acc: 0.9064 - val_loss: 5.8791 - val_acc: 0.8836
Epoch 145/150
149/149 [==============================] - 212s 1s/step - loss: 0.2785 - acc: 0.9041 - val_loss: 23.8933 - val_acc: 0.8968
Epoch 146/150
149/149 [==============================] - 213s 1s/step - loss: 0.2766 - acc: 0.9033 - val_loss: 0.3173 - val_acc: 0.9053
Epoch 147/150
149/149 [==============================] - 212s 1s/step - loss: 0.2690 - acc: 0.9095 - val_loss: 0.3940 - val_acc: 0.8814
Epoch 148/150
149/149 [==============================] - 211s 1s/step - loss: 0.2745 - acc: 0.9078 - val_loss: 1669.4307 - val_acc: 0.8968
Epoch 149/150
149/149 [==============================] - 212s 1s/step - loss: 0.2758 - acc: 0.9062 - val_loss: 0.3801 - val_acc: 0.8990
Epoch 150/150
149/149 [==============================] - 213s 1s/step - loss: 0.2725 - acc: 0.9061 - val_loss: 0.5109 - val_acc: 0.9009


问:
Flutter check location permission handler
I need to give a warning as soon as the user turns off the location permission.

Is it possible to catch the moment when he turns off the permission?


问:
How to can I stop selenium from printing logs in terminal? [Python]
I wonder if there is a way to stop selenium from printing errors in the terminal.
here is my code:

```<code>from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from msedge.selenium_tools import EdgeOptions
import requests

options = EdgeOptions()
options.add_argument("headless")
options.add_argument("disable-gpu")

driver = webdriver.Edge("msedgedriver.exe")
driver.get("https://example.com/")

class App():
    def __init__(self, username="username_here", password="password_here"):
        self.username = username
        self.password = password

    def logIn():
        app = App()

        userField = driver.find_element(By.XPATH, "//input[@id='Username']")
        userField.send_keys(app.username)

        passField = driver.find_element(By.XPATH, "//input[@id='Password']")
        passField.send_keys(app.password)

        logInBtn = driver.find_element(By.XPATH, "//button[normalize-space()='Connexion']")
        logInBtn.click()

    def getEvents():
        eventTitles = driver.find_element(By.XPATH, "//div[@class='fc-content-skeleton']").text.splitlines()
        eventDataIDSElement = driver.find_elements(By.TAG_NAME, "a")
        eventDataIDS = [eventDataIDElement.get_attribute("data-id") for eventDataIDElement in eventDataIDSElement if eventDataIDElement.get_attribute("data-id") != None]

if __name__ == "__main__":
    App.logIn()
    App.getEvents()
    print("tasks done.")
</code>```

I tried to change --log-level in the options but that didn't work.

Body:
I wonder if there is a way to stop selenium from printing errors in the terminal.
here is my code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from msedge.selenium_tools import EdgeOptions
import requests

options = EdgeOptions()
options.add_argument("headless")
options.add_argument("disable-gpu")

driver = webdriver.Edge("msedgedriver.exe")
driver.get("https://example.com/")

class App():
    def __init__(self, username="username_here", password="password_here"):
        self.username = username
        self.password = password

    def logIn():
        app = App()

        userField = driver.find_element(By.XPATH, "//input[@id='Username']")
        userField.send_keys(app.username)

        passField = driver.find_element(By.XPATH, "//input[@id='Password']")
        passField.send_keys(app.password)

        logInBtn = driver.find_element(By.XPATH, "//button[normalize-space()='Connexion']")
        logInBtn.click()

    def getEvents():
        eventTitles = driver.find_element(By.XPATH, "//div[@class='fc-content-skeleton']").text.splitlines()
        eventDataIDSElement = driver.find_elements(By.TAG_NAME, "a")
        eventDataIDS = [eventDataIDElement.get_attribute("data-id") for eventDataIDElement in eventDataIDSElement if eventDataIDElement.get_attribute("data-id") != None]

if __name__ == "__main__":
    App.logIn()
    App.getEvents()
    print("tasks done.")

I tried to change --log-level in the options but that didn't work.


问:
"message not found" error in aiogram when i try to edit the message
`I have a telegram bot that, when pressing the inline "select" button, changes the reply markup of this message (removes the "select" button so that the user does not spam it) and sends the user a new message with an inline "cancel" button. When the user clicks the "cancel" button , the markup in the previous message is changed (the "select" button is returned), and the message with the "cancel" button is deleted.

Before pressing the "Select" button
After pressing the "Select" button
After pressing the "Cancel" button`

(Keyboards)

```<code>call = InlineKeyboardMarkup(
    inline_keyboard=[
        [
            InlineKeyboardButton(text='select', callback_data='cll')
        ], [
            InlineKeyboardButton(text='back', callback_data='bl')
        ]
    ]
)

call1 = InlineKeyboardMarkup(
    inline_keyboard=[
        [
            InlineKeyboardButton(text='back', callback_data='bl')
        ]
    ]
)

cancel = InlineKeyboardMarkup(
    inline_keyboard=[
        [
            InlineKeyboardButton(text='cancel', callback_data='off')
        ]
    ]
)
</code>```

(main code)

```<code>
@dp.message_handler()
async def C(message: Message):
    await bot.edit_message_reply_markup(chat_id=message.chat.id, message_id=message.message_id, reply_markup=call1)
    await bot.send_message(chat_id=message.chat.id, text='You selected it', reply_markup=cancel)

@dp.message_handler()
async def D(message: Message):
    await bot.edit_message_reply_markup(chat_id=message.chat.id, message_id=message.message_id - 1,
                                        reply_markup=call)  # As far as I understand, the problem is in this message
    await bot.delete_message(chat_id=message.chat.id, message_id=message.message_id)

@dp.callback_query_handler()
async def reaction(callback: types.CallbackQuery):
    match callback.data:
        case 's1':
            await callback.message.edit_text('Theme1', reply_markup=call)
        case 'cll':
            await C(message=callback.message)
        case 'off':
            await D(message=callback.message)

</code>```

`When I press "cancel" for the first time, everything works. When I try to repeat this whole cycle (I press "select" and then "cancel" 2nd time) - an error occurs:

aiogram.utils.exceptions.MessageToEditNotFound: Message to edit not found

As far as I understand, the problem is in the tagged command (bot.edit_message_reply_markup) for some reason he does not see the previous message. And the 1st time it works, but the 2nd time it doesn't. Please tell me what's wrong?`

Body:
`I have a telegram bot that, when pressing the inline "select" button, changes the reply markup of this message (removes the "select" button so that the user does not spam it) and sends the user a new message with an inline "cancel" button. When the user clicks the "cancel" button , the markup in the previous message is changed (the "select" button is returned), and the message with the "cancel" button is deleted.

Before pressing the "Select" button
After pressing the "Select" button
After pressing the "Cancel" button`

(Keyboards)

call = InlineKeyboardMarkup(
    inline_keyboard=[
        [
            InlineKeyboardButton(text='select', callback_data='cll')
        ], [
            InlineKeyboardButton(text='back', callback_data='bl')
        ]
    ]
)

call1 = InlineKeyboardMarkup(
    inline_keyboard=[
        [
            InlineKeyboardButton(text='back', callback_data='bl')
        ]
    ]
)

cancel = InlineKeyboardMarkup(
    inline_keyboard=[
        [
            InlineKeyboardButton(text='cancel', callback_data='off')
        ]
    ]
)

(main code)

@dp.message_handler()
async def C(message: Message):
    await bot.edit_message_reply_markup(chat_id=message.chat.id, message_id=message.message_id, reply_markup=call1)
    await bot.send_message(chat_id=message.chat.id, text='You selected it', reply_markup=cancel)

@dp.message_handler()
async def D(message: Message):
    await bot.edit_message_reply_markup(chat_id=message.chat.id, message_id=message.message_id - 1,
                                        reply_markup=call)  # As far as I understand, the problem is in this message
    await bot.delete_message(chat_id=message.chat.id, message_id=message.message_id)

@dp.callback_query_handler()
async def reaction(callback: types.CallbackQuery):
    match callback.data:
        case 's1':
            await callback.message.edit_text('Theme1', reply_markup=call)
        case 'cll':
            await C(message=callback.message)
        case 'off':
            await D(message=callback.message)

`When I press "cancel" for the first time, everything works. When I try to repeat this whole cycle (I press "select" and then "cancel" 2nd time) - an error occurs:

aiogram.utils.exceptions.MessageToEditNotFound: Message to edit not found

As far as I understand, the problem is in the tagged command (bot.edit_message_reply_markup) for some reason he does not see the previous message. And the 1st time it works, but the 2nd time it doesn't. Please tell me what's wrong?`


问:
How to conatenate two sequentiel CNN Models on python
How can I combine two CNN sequential models? Can I have a code  example of how to combine the features after training the models separately and another one of how to  create a concatenated model and train it?</p>


问:
jquery - adding easing to a scrollbar plugin
I'm using this scrollbar plugin:

http://www.baijs.nl/tinyscrollbar/js/jquery.tinyscrollbar.js

and I want to add easing to it. I've isolated what I think is the function that calculates the movement, which is:

```<code>function drag(oEvent){
    if(!(oContent.ratio >= 1)){
        iPosition.now = Math.min((oTrack[options.axis] - oThumb[options.axis]), Math.max(0, (iPosition.start + ((sAxis ? oEvent.pageX : oEvent.pageY) - iMouse.start))));
        iScroll = iPosition.now * oScrollbar.ratio;
        oContent.obj.css(sDirection, -iScroll);
        oThumb.obj.css(sDirection, iPosition.now);
    }
    return false;
};
</code>```

How would I modify this to include a bit of easing?

ContentLicense: CC BY-SA 3.0

Body:
I'm using this scrollbar plugin:

http://www.baijs.nl/tinyscrollbar/js/jquery.tinyscrollbar.js

and I want to add easing to it. I've isolated what I think is the function that calculates the movement, which is:

function drag(oEvent){
    if(!(oContent.ratio >= 1)){
        iPosition.now = Math.min((oTrack[options.axis] - oThumb[options.axis]), Math.max(0, (iPosition.start + ((sAxis ? oEvent.pageX : oEvent.pageY) - iMouse.start))));
        iScroll = iPosition.now * oScrollbar.ratio;
        oContent.obj.css(sDirection, -iScroll);
        oThumb.obj.css(sDirection, iPosition.now);
    }
    return false;
};

How would I modify this to include a bit of easing?


问:
How do I use sharp icons in R Shiny?
How do I use alternative icon styles like fa-sharp fa-solid fa-user in R Shiny?

https://fontawesome.com/icons/user?s=solid&f=sharp

```<code>library(shiny)

ui <- fluidPage(
  actionButton("test", "Test", icon = icon("fa-sharp fa-solid fa-user")) # doesn't work
)

server <- function(input, output, session) {}

shinyApp(ui, server)
</code>```

Title: How do I use sharp icons in R Shiny?

Body:
How do I use alternative icon styles like fa-sharp fa-solid fa-user in R Shiny?

https://fontawesome.com/icons/user?s=solid&f=sharp

library(shiny)

ui <- fluidPage(
  actionButton("test", "Test", icon = icon("fa-sharp fa-solid fa-user")) # doesn't work
)

server <- function(input, output, session) {}

shinyApp(ui, server)


问:
Can't disable tabstop in WPF controls
I have three TextBoxes, one Button and a DataGrid in my WPF Window

I want the user to be able to circle between textBoxes and the Button with Tab

The problem is is seems to stop on the dataGrid as well

I've tried setting the IsTabStop property to False, KeyboardNavigation.TabNavigation="None" and even setting the Focusable property to False, but it still focuses the datagird

To be more accurate, I tried to find out which item it is focusing with tab after textbox, and wrote this:

```<code>private void MyWindow_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Tab)
        {
            System.Windows.Forms.MessageBox.Show(FocusManager.GetFocusedElement(this).ToString());
        }
    }
</code>```

And after going over textBoxes, it showed: System.Windows.Controls.DataGrid Items.Count = 13

How can I disable tabstop for my dataGrid?

Title: Can't disable tabstop in WPF controls

Body:
I have three TextBoxes, one Button and a DataGrid in my WPF Window

I want the user to be able to circle between textBoxes and the Button with Tab

The problem is is seems to stop on the dataGrid as well

I've tried setting the IsTabStop property to False, KeyboardNavigation.TabNavigation="None" and even setting the Focusable property to False, but it still focuses the datagird

To be more accurate, I tried to find out which item it is focusing with tab after textbox, and wrote this:

private void MyWindow_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Tab)
        {
            System.Windows.Forms.MessageBox.Show(FocusManager.GetFocusedElement(this).ToString());
        }
    }

And after going over textBoxes, it showed: System.Windows.Controls.DataGrid Items.Count = 13

How can I disable tabstop for my dataGrid?


问:
Adding a "REVERT" command to a C++ document/view application
In the app I'm writing under CS 2022 document/view architecture, I want to add a "REVERT" command to the main menu. I've tried adding a handler that invokes "Serialize" in the document class, but I get errors.

Also, I know Serialize needs to know if I'm loading or saving, and I don't know how to handle that.

I tried adding this:

```<code>void CMSDoc::OnRevert()
{
    Serialize(ar);
}

</code>```

...but "ar isn't recognized. Is this the right place for this function to work?

Body:
In the app I'm writing under CS 2022 document/view architecture, I want to add a "REVERT" command to the main menu. I've tried adding a handler that invokes "Serialize" in the document class, but I get errors.

Also, I know Serialize needs to know if I'm loading or saving, and I don't know how to handle that.

I tried adding this:

void CMSDoc::OnRevert()
{
    Serialize(ar);
}

...but "ar isn't recognized. Is this the right place for this function to work?


问:
Android Keyboard Hides ExitText field during input
Here is my layout:

```<code><RelativeLayout>

<LinearLayout>
<Button></Button>    <EditText layout_height=height="fill_parent"> </EditText>
</LinearLayout>
</RelativeLayout>
</code>```

However, the keyboard covers up the EditText so its not good for inputing the value.

Body:
Here is my layout:

<RelativeLayout>

<LinearLayout>
<Button></Button>    <EditText layout_height=height="fill_parent"> </EditText>
</LinearLayout>
</RelativeLayout>

However, the keyboard covers up the EditText so its not good for inputing the value.


问:
How can i get all file names in resources directory in gradle project?
Below code, i am manually write "a.json", "b.json".
But i want to get all file names in resources directory and
is it possible?

public static void loadFiles() throws IOException {
    ClassLoader classLoader = ClassLoader.getSystemClassLoader();

    List<String> fileNames = List.of("a.json", "b.json"); // Bad
    // List<String> fileNames = getFileNamesInResources(); // Good

    for (int i = 0; i < fileNames.size(); i++) {
        String fileName = fileNames.get(i);
        InputStream is = classLoader.getResourceAsStream(fileName);
        String content = new String(is.readAllBytes(), StandardCharsets.UTF_8);
        System.out.println(content);
        is.close();
    }
}
```


问:
after a user enters an input, i put return menu() but menu() doesn't work
i have this problem:

```<code>def thing():
    e = input("Are you sure you want to enter this menu?")
    if e == "yes":
        while True:
            placeholder()
    elif e == "no":
        return menu() #<-- THIS
    else:
        print("invalid response")

def menu():
    print("""
what do you want to do?
1. Enter thing
2. Don't enter thing
""")
    ans = input("Enter your response here:\n")
    if ans == "1":
        thing()
    elif ans == "2":
        pass
    else:
        print("invalid response")
</code>```

If e == no then it won't go to menu() like i expected but it just stopped and i need a way to make what happens after they input "no" to be menu() yet it will not do that. any way to fix?

Body:
i have this problem:

def thing():
    e = input("Are you sure you want to enter this menu?")
    if e == "yes":
        while True:
            placeholder()
    elif e == "no":
        return menu() #<-- THIS
    else:
        print("invalid response")

def menu():
    print("""
what do you want to do?
1. Enter thing
2. Don't enter thing
""")
    ans = input("Enter your response here:\n")
    if ans == "1":
        thing()
    elif ans == "2":
        pass
    else:
        print("invalid response")

If e == no then it won't go to menu() like i expected but it just stopped and i need a way to make what happens after they input "no" to be menu() yet it will not do that. any way to fix?