问:
How to give AIS messages inside OpenCPN and display the course of the vessel on screen?
I am trying to provide Open CPN with !AIVDM and !AIVDO messages. I would like to also make use of the NMEA 2000 protocol if anyone has an idea how. I am doing this for a project and the information on internet is beyond scarce for this subject in terms of directions to take. I have access only to a Raspberry Pi.

I have tried searching on internet how to upload AIS messages inside OpenCPN but nothing showed up.


来源: stackexchange

问:
Queue in Kotlin
I want to add a role in the queue when the button is pressed by another user, until the liveTimer() finishes and then starts executing for the other user

For example: when a user presses the button, liveTimer() starts working, and if another user presses the button while liveTimer() is still running for the first user, the second user is put in the queue, and after liveTimer() finishes working for the first user, it moves to work for the second user automatically until the queue becomes empty

What is the best way to do this in Kotlin for Android?

```<code>cameraBt.setOnClickListener() {
        liveTimer()
    }
</code>```

this is what liveTimer() do

```<code>fun liveTimer() {
    val intent = Intent(this, HomeActivity::class.java)
    val cameraIntent = Intent(Intent.ACTION_VIEW)
    cameraIntent.data = Uri.parse("https://shielded-fortress-04099.herokuapp.com/")
    startActivity(cameraIntent)

    val timer = object : CountDownTimer(30 * 1000, 1000) {
        override fun onTick(timeLeft: Long) {

        }

        override fun onFinish() {
            startActivity(intent)
            Toast.makeText(
                this@HomeActivity,
                "the allowed time has finished",
                Toast.LENGTH_LONG
            ).show()
        }

    }.start()
}
</code>```

ContentLicense: CC BY-SA 4.0

Title: Queue in Kotlin

Body:
I want to add a role in the queue when the button is pressed by another user, until the liveTimer() finishes and then starts executing for the other user

For example: when a user presses the button, liveTimer() starts working, and if another user presses the button while liveTimer() is still running for the first user, the second user is put in the queue, and after liveTimer() finishes working for the first user, it moves to work for the second user automatically until the queue becomes empty

What is the best way to do this in Kotlin for Android?

cameraBt.setOnClickListener() {
        liveTimer()
    }

this is what liveTimer() do

fun liveTimer() {
    val intent = Intent(this, HomeActivity::class.java)
    val cameraIntent = Intent(Intent.ACTION_VIEW)
    cameraIntent.data = Uri.parse("https://shielded-fortress-04099.herokuapp.com/")
    startActivity(cameraIntent)

    val timer = object : CountDownTimer(30 * 1000, 1000) {
        override fun onTick(timeLeft: Long) {

        }

        override fun onFinish() {
            startActivity(intent)
            Toast.makeText(
                this@HomeActivity,
                "the allowed time has finished",
                Toast.LENGTH_LONG
            ).show()
        }

    }.start()
}


问:
Variance in Array vs TypedArray performance test
I am comparing the operation of reverse in Typed vs Standard Arrays i.e:

const a = new Array(1e6).fill(0).map( () => Math.random())
a.reverse()
const b = new Float64Array(1e6).map( () => Math.random())
b.reverse()
```

Certainly we expect Typed to be faster and maybe also to be narrow in variation from the mean time.

However, the standard arrays are slower (expected) but the variation around the mean is very large in comparison. In my computer this shows 3% in TypedArrays, 30% in Arrays.

Conceptually, what is the cause of this ?

See Test

Body:
I am comparing the operation of reverse in Typed vs Standard Arrays i.e:

const a = new Array(1e6).fill(0).map( () => Math.random())
a.reverse()
const b = new Float64Array(1e6).map( () => Math.random())
b.reverse()

Certainly we expect Typed to be faster and maybe also to be narrow in variation from the mean time.

However, the standard arrays are slower (expected) but the variation around the mean is very large in comparison. In my computer this shows 3% in TypedArrays, 30% in Arrays.

Conceptually, what is the cause of this ?

See Test


问:
Detect key override in python dictionary initialization
I have a large dictionary and I'd like to prevent a situation where a key can be accidentally overwritten. For example, this is valid python and doesn't raise an error, but I'd prefer to detect such a condition. I understand this is expected in python dict(), so I'm looking for ways to detect such issues:

```<code>In [6]: b = {'one': 1, 'two': 2, 'three': 3, 'three': 6}

In [7]: b
Out[7]: {'one': 1, 'three': 6, 'two': 2}
</code>```

Ideally I'd like the first value of three to be kept as the true value. I have looked at immutable dicts using MappingProxyType, but that only partially helps here. It still doesn't help with overwritten keys (at initialization, it correctly detects overwriting a key post declaration).

Body:
I have a large dictionary and I'd like to prevent a situation where a key can be accidentally overwritten. For example, this is valid python and doesn't raise an error, but I'd prefer to detect such a condition. I understand this is expected in python dict(), so I'm looking for ways to detect such issues:

In [6]: b = {'one': 1, 'two': 2, 'three': 3, 'three': 6}

In [7]: b
Out[7]: {'one': 1, 'three': 6, 'two': 2}

Ideally I'd like the first value of three to be kept as the true value. I have looked at immutable dicts using MappingProxyType, but that only partially helps here. It still doesn't help with overwritten keys (at initialization, it correctly detects overwriting a key post declaration).


问:
Nestjs TypeOrm - Entities importing 3rd party modules and async functions
I want to build an app where I have an Entity of Type A. This Entity class should have an update method which then uses 3rd party modules for example to fetch data from a 3rd party api and so on.

I am kind of lost on how to do that, if its even possible to. Basically I want the Entities to be able to perform function calls just like normal es6 classes.

Until now I always used a service that updates all entities, I prefer all Entities to handle their own updates tho.

Basically can the enities I define which also get stored to database have async functions I could then just call on the object after retrieving it from the database? Is there a constructor call once these entities get fetched via find() methods of the repositories?

I pretty much want to avoid having an Entity of type A and also a class implementation for type A just to perform stuff and use 3rd party modules. Until now I used to create the Model, fetch the Models from the database and than instantiate Objects (Classes) that represent these models which is kind of verbose to me.


问:
firebase TypeError: null is not an object (evaluating '_n7.indexOf') React Native
I am trying to set up a listener for my user document:

```<code>const userListener = onSnapshot(doc(db, "users", uid), (doc) => {
    setUser(doc.data());
    console.log(doc.data());
  });

  useEffect(() => {
    userListener();
    setLoading(false);
  }, []);
</code>```

But I keep getting this error:

TypeError: null is not an object (evaluating '_n7.indexOf')

The error redirects me to the index.rn.js file in the firestore folder from my node_modules:

null is not an object (evaluating '_n7.indexOf') file

I have also tried using collection, instead of doc and still get the same error.

Does anyone have an idea where this error is coming from?

Body:
I am trying to set up a listener for my user document:

const userListener = onSnapshot(doc(db, "users", uid), (doc) => {
    setUser(doc.data());
    console.log(doc.data());
  });

  useEffect(() => {
    userListener();
    setLoading(false);
  }, []);

But I keep getting this error:

TypeError: null is not an object (evaluating '_n7.indexOf')

The error redirects me to the index.rn.js file in the firestore folder from my node_modules:

null is not an object (evaluating '_n7.indexOf') file

I have also tried using collection, instead of doc and still get the same error.

Does anyone have an idea where this error is coming from?


问:
what is the right way to set html5 canvas tag size and why?
```<code>const canvas = document.querySelector('canvas');

canvas.style.width = 750+"px";
canvas.style.height = 250+"px";

OR

canvas.width = 750;
canvas.height = 250;
</code>```

I just want to know which is the right way to do it

Body:
const canvas = document.querySelector('canvas');

canvas.style.width = 750+"px";
canvas.style.height = 250+"px";

OR

canvas.width = 750;
canvas.height = 250;

I just want to know which is the right way to do it


问:
sql self join rearrange records for top 4
I am dealing with self join reranking problem but hard to describe it in words. Basically I have a table:

ID
rank
remove
upgrade

1
1
Ture
False

2
2
False
False

3
3
True
False

4
4
False
False

5
5
False
True

6
6
False
False

7
7
False
True

For the top 4 tows, one row A with remove=true, I want to find the below top 4 nearest row B with upgrade=true. once B is matched to row A, B will not match any rows below A. The new_id will record the id of row B.

For id=1, it needs to be removed, so we go the to below top 4 rows, then id=5 is the first upgradable row, so id=1's new_id=5
for id=3, it needs to be removed, since id=5 already go to id=1's place, the next upgradable row is id=7, so id=3's new_id=7.

So the results table is:

ID
rank
remove
upgrade
new_id

1
1
Ture
False
5

2
2
False
False
2

3
3
True
False
7

4
4
False
False
4

5
5
False
True
null

6
6
False
False
null

7
7
False
True
null

I tried self join but cannot figure out the right join condition.


问:
How to check if observed element is still visible on initial load?
I am trying to create infinite scrolling for image thumbnails. I observe a "loader" div. I get 20 thumbnails on every load.

But at the initial load, 20 images don't fill up the viewport so the infinite scrolling doesn't start working because the loader div is still in the viewport (I put only the relevant part of the code):

```<code><body>
    <div id="thumbnails_container"></div>
    <div id="loader_div">Loading more..</div>
</body>

<script>
const loader = document.getElementById("thumbnails_container");
const loader = document.getElementById("loader_div");
let imgCount = 0;

let options = {
    root: null,
    rootMargin: "0px",
    threshold: 0.1
};

let observer = new IntersectionObserver(callback, options);

function callback(entries, observer) {
    entries.forEach((entry) => {
        if (entry.isIntersecting) {
            getMoreThumbnails();
        }
    });
}

function getMoreThumbnails() {
    setTimeout(() => {
        for (let i = imageCount; i < imageCount + 20; i++) {
            image.src = data[i].src;
            thumbnailsContainerElement.appendChild(image);
        }
        imageCount+= 20;
    }, 300)
}
</script>
</code>```

How can I call getMoreThumbnails property so that it keeps loading images as long as the observed div is still in viewport in the initial loading?

Body:
I am trying to create infinite scrolling for image thumbnails. I observe a "loader" div. I get 20 thumbnails on every load.

But at the initial load, 20 images don't fill up the viewport so the infinite scrolling doesn't start working because the loader div is still in the viewport (I put only the relevant part of the code):

Loading more..

How can I call getMoreThumbnails property so that it keeps loading images as long as the observed div is still in viewport in the initial loading?


问:
How do I set up application credentials to open a secure folder from MS Access VBA?
I am working in MS Access 2016, building a report distribution app called "Librarian".  Each report will have a unique name indicating its date, category, type, etc.  All reports will reside in a single RptLib folder.  Users will NOT have security permissions to the RptLib folder, but the Librarian app will.  Users will request a report from Librarian; Librarian will retrieve the report and save it to a user-specified folder to which the user does have security permissions.

I am asking for suggestions as to how to give the Librarian app access to the RptLib folder as a network resource.  My idea #1 was to set up Librarian as a network user in Active Directory, but I'm foggy on what to do from there.  Ideas for a fundamentally different and better approach may also exist.  Any other ideas would be appreciated.

I would appreciate input before I waste a lot of time on a potentially doomed approach.


问:
Rails 6 error message "Error: File to import not found or unreadable: bootstrap/scss/bootstrap."
Last summer, I built an app in Rails 6. Since then, I've upgraded to Rails 7.  Recently, I opened my Rails 6 app in my terminal, and got a message telling me that that I cannot run the program, because I’m missing a list of certain gems. So, I ran a bundle install and installed these old gems- all good!

Or so I thought…

When I typed rails s in my terminal to run the app on my local server, I received this error message:

```<code>   “Error: File to import not found or unreadable: bootstrap/scss/bootstrap.
          on line 7:1 of app/assets/stylesheets/application.scss
    >> @import “bootstrap/scss/bootstrap”;
</code>```

Any ideas on what could be the problem and how to fix it?

I’ve tried downgrading from Rails 7 to 6, but this doesn’t fix the problem.

Possible ideas as to why I'm getting this message:

webpacker gem?

An unknown Rails 6 gem that has been deprecated, making my computer unable to locate or read the file?

A problem with the bootstrap CDN?

Body:
Last summer, I built an app in Rails 6. Since then, I've upgraded to Rails 7.  Recently, I opened my Rails 6 app in my terminal, and got a message telling me that that I cannot run the program, because I’m missing a list of certain gems. So, I ran a bundle install and installed these old gems- all good!

Or so I thought…

When I typed rails s in my terminal to run the app on my local server, I received this error message:

   “Error: File to import not found or unreadable: bootstrap/scss/bootstrap.
          on line 7:1 of app/assets/stylesheets/application.scss
    >> @import “bootstrap/scss/bootstrap”;

Any ideas on what could be the problem and how to fix it?

I’ve tried downgrading from Rails 7 to 6, but this doesn’t fix the problem.

Possible ideas as to why I'm getting this message:

webpacker gem?

An unknown Rails 6 gem that has been deprecated, making my computer unable to locate or read the file?

A problem with the bootstrap CDN?


问:
How to use POST requests in MS Graph Batches
I am struggling to get my batch request to work and it always hangs up on the line related to my post request CreateLink(). I am struggling to understand how to do POST request in batches. MS documentation indicates POST request are handled differently in batches than GET request. My code is as follows:</p>
```<code>    public async Task<OneDriveFile> BulkFileImportAsync(string DriveID, string Path)
    {
        OneDriveFile oneDriveFile = new OneDriveFile();

        try
        {

            var fileInfoRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path)
                        .Request();
            var fileEditRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path)
                        .CreateLink("edit", "users", null, null, null, true)
                        .Request();
            var fileViewRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path)
                        .CreateLink("view", "users", null, null, null, true)
                        .Request();
            var fileThumbnailRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path).Thumbnails
                        .Request();

            // Build the batch
            var batchRequestContent = new BatchRequestContent();

            var fileInfoRequestId = batchRequestContent.AddBatchRequestStep(fileInfoRequest);
            var fileEditRequestId = batchRequestContent.AddBatchRequestStep(fileEditRequest);
            var fileViewRequestId = batchRequestContent.AddBatchRequestStep(fileViewRequest);
            var fileThumbnailRequestId = batchRequestContent.AddBatchRequestStep(fileThumbnailRequest);

            var returnedResponse = await _graphServiceClient.Batch.Request().PostAsync(batchRequestContent);

            var fileInfo = await returnedResponse
                       .GetResponseByIdAsync<DriveItem>(fileInfoRequestId);
            var fileEdit = await returnedResponse
                       .GetResponseByIdAsync<Permission>(fileEditRequestId);
            var fileView = await returnedResponse
                       .GetResponseByIdAsync<Permission>(fileViewRequestId);
            var fileThumbnail = await returnedResponse
                        .GetResponseByIdAsync<IDriveItemThumbnailsCollectionPage>(fileThumbnailRequestId);

            oneDriveFile.Path = Path;
            oneDriveFile.WebURL = fileInfo.WebUrl;
            oneDriveFile.EditURL = fileEdit.AdditionalData["webUrl"].ToString();
            oneDriveFile.ViewURL = fileEdit.AdditionalData["webUrl"].ToString();
            oneDriveFile.ThumbnailURL = fileThumbnail.CurrentPage[0].Large.Url;

        }
        catch (ServiceException ex)
        {
            Console.WriteLine($"Error doing batch update: {ex.ToString()}");
        }

        return oneDriveFile;
    }
</code>```

Body:
I am struggling to get my batch request to work and it always hangs up on the line related to my post request CreateLink(). I am struggling to understand how to do POST request in batches. MS documentation indicates POST request are handled differently in batches than GET request. My code is as follows:

    public async Task<OneDriveFile> BulkFileImportAsync(string DriveID, string Path)
    {
        OneDriveFile oneDriveFile = new OneDriveFile();

        try
        {

            var fileInfoRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path)
                        .Request();
            var fileEditRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path)
                        .CreateLink("edit", "users", null, null, null, true)
                        .Request();
            var fileViewRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path)
                        .CreateLink("view", "users", null, null, null, true)
                        .Request();
            var fileThumbnailRequest = _graphServiceClient.Me.Drives[DriveID].Root
                        .ItemWithPath(Path).Thumbnails
                        .Request();

            // Build the batch
            var batchRequestContent = new BatchRequestContent();

            var fileInfoRequestId = batchRequestContent.AddBatchRequestStep(fileInfoRequest);
            var fileEditRequestId = batchRequestContent.AddBatchRequestStep(fileEditRequest);
            var fileViewRequestId = batchRequestContent.AddBatchRequestStep(fileViewRequest);
            var fileThumbnailRequestId = batchRequestContent.AddBatchRequestStep(fileThumbnailRequest);

            var returnedResponse = await _graphServiceClient.Batch.Request().PostAsync(batchRequestContent);

            var fileInfo = await returnedResponse
                       .GetResponseByIdAsync<DriveItem>(fileInfoRequestId);
            var fileEdit = await returnedResponse
                       .GetResponseByIdAsync<Permission>(fileEditRequestId);
            var fileView = await returnedResponse
                       .GetResponseByIdAsync<Permission>(fileViewRequestId);
            var fileThumbnail = await returnedResponse
                        .GetResponseByIdAsync<IDriveItemThumbnailsCollectionPage>(fileThumbnailRequestId);

            oneDriveFile.Path = Path;
            oneDriveFile.WebURL = fileInfo.WebUrl;
            oneDriveFile.EditURL = fileEdit.AdditionalData["webUrl"].ToString();
            oneDriveFile.ViewURL = fileEdit.AdditionalData["webUrl"].ToString();
            oneDriveFile.ThumbnailURL = fileThumbnail.CurrentPage[0].Large.Url;

        }
        catch (ServiceException ex)
        {
            Console.WriteLine($"Error doing batch update: {ex.ToString()}");
        }

        return oneDriveFile;
    }


问:
The source 'IQueryable' doesn't implement 'IAsyncEnumerable<FundedLoanDto>'
We recently moved our project from netcore3. to net5.0 and all unit tests started failing with same error
The source 'IQueryable' doesn't implement 'IAsyncEnumerable<Migo.API.Dtos.FundedLoanDto>'. Only sources that implement 'IAsyncEnumerable' can be used for Entity Framework asynchronous operations.

It works fine in production. Only unit tests are failing

My actual class code -

```<code> public async Task<GridDto> GetFundedLoans(LoanFilterDto loanFilter)
        {
            var query = GetLoanCommonFilter(loanFilter);
            query = query.Where(loan => EF.Functions.Like(loan.Status, "FUNDED"));
            if (loanFilter.FromDate.HasValue)
                query = query.Where(loan => loan.Funded.HasValue && loan.Funded.Value.Date >= loanFilter.FromDate.Value.Date);

            if (loanFilter.ToDate.HasValue)
                query = query.Where(loan => loan.Funded.HasValue && loan.Funded.Value.Date <= loanFilter.ToDate.Value);

            Expression<Func<EncompassLoanStatus, dynamic>> orderByExpression = GetLoanOrderByExpression(loanFilter.SortColumn);

            if (loanFilter.SortOrder?.ToUpper() == "DESC")
                query = query.OrderByDescending(orderByExpression);
            else
                query = query.OrderBy(orderByExpression);

            int recordsCount = query.Count();
            var loans = loanFilter.PageSize > 0 ? query.Skip((loanFilter.PageNumber - 1) * loanFilter.PageSize).Take(loanFilter.PageSize) : query;
            var fundedLoans = await loans.Select(loan => new FundedLoanDto()
            {
                BorrowerName = $"{loan.FirstName} {loan.LastName}",
                FundedDate = loan.Funded,
                LoanId = loan.EncompassId,
                LoanProduct = loan.LoanProgramName,
                ReceivedDate = loan.Createddate,
                SalesRep = loan.Salesrep
            }).ToListAsync();
            return new GridDto()
            {
                Records = fundedLoans,
                RecordsCount = recordsCount
            };
        }

        private IQueryable<EncompassLoanStatus> GetLoanCommonFilter(LoanFilterDto loanFilter)
        {
            var query = _context.EncompassLoanStatus.AsQueryable();
            if (string.IsNullOrEmpty(loanFilter.BorrowerFirstName) == false)
                query = query.Where(loan => EF.Functions.Like(loan.FirstName, $"%{loanFilter.BorrowerFirstName}%"));

            if (string.IsNullOrEmpty(loanFilter.BorrowerLastName) == false)
                query = query.Where(loan => EF.Functions.Like(loan.LastName, $"%{loanFilter.BorrowerLastName}%"));

            if (string.IsNullOrEmpty(loanFilter.LoanProduct) == false)
                query = query.Where(loan => EF.Functions.Like(loan.LoanProgramName, $"%{loanFilter.LoanProduct}%"));

            if (loanFilter.DealerPhoneNumbers?.Length > 0)
                query = query.Where(loan => loanFilter.DealerPhoneNumbers.Contains(loan.Dealerphone));

            if (string.IsNullOrEmpty(loanFilter.SalesRep) == false)
                query = query.Where(loan => EF.Functions.Like(loan.Salesrep, $"%{loanFilter.SalesRep}%"));

            return query;
        }

        private Expression<Func<EncompassLoanStatus, dynamic>> GetLoanOrderByExpression(string orderByColumn)
        {
            Expression<Func<EncompassLoanStatus, dynamic>> orderByExpression;
            switch (orderByColumn?.ToUpper())
            {
                case "BORROWERNAME": orderByExpression = loan => loan.FirstName; break;
                case "LOANPRODUCT": orderByExpression = loan => loan.LoanProgramName; break;
                case "SALESREP": orderByExpression = loan => loan.Salesrep; break;
                case "CANCELLEDDATE": orderByExpression = loan => loan.Cancelled; break;
                case "FUNDEDDATE": orderByExpression = loan => loan.Funded; break;

                default: orderByExpression = loan => loan.Createddate; break;
            }
            return orderByExpression;
        }
</code>```

My unit test is

```<code> [Theory]
        [InlineData("BORROWERNAME")]
        public async Task GetFundedLoansSortsCorrectly(string sortColumn)
        {
            var mockEncompassLoanStatusSet = GetMockEncompassLoanStatusSet(FundedEncompassLoanStatuses);

            _mockDigitalApplicationContext.Setup(x => x.EncompassLoanStatus).Returns(mockEncompassLoanStatusSet.Object);

            var loanFilter = new LoanFilterDto
            {
                SortColumn = sortColumn,
                PageSize = 1,
                PageNumber = 1
            };

            var cancelledLoans = await _digitalApplicationRepository.GetFundedLoans(loanFilter);
            var records = ((List<FundedLoanDto>)cancelledLoans.Records).ToArray();

            Assert.Equal(3, cancelledLoans.RecordsCount);
            Assert.Equal("asdh", records[0].LoanId);
            Assert.Equal("asdg", records[1].LoanId);
            Assert.Equal("asdf", records[2].LoanId);
        }

private static Mock<DbSet<EncompassLoanStatus>> GetMockEncompassLoanStatusSet(List<EncompassLoanStatus> loanStatuses)
        {
            var mockEncompassLoanStatuses = loanStatuses.AsQueryable();

            var mockEncompassLoanStatusSet = new Mock<DbSet<EncompassLoanStatus>>();

            mockEncompassLoanStatusSet.As<IAsyncEnumerable<EncompassLoanStatus>>()
                .Setup(m => m.GetAsyncEnumerator(It.IsAny<CancellationToken>()))
                .Returns(new TestAsyncEnumerator<EncompassLoanStatus>(mockEncompassLoanStatuses.GetEnumerator()));

            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>()
                .Setup(m => m.Provider)
                .Returns(new TestAsyncQueryProvider<EncompassLoanStatus>(mockEncompassLoanStatuses.Provider));

            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>().Setup(m => m.Expression)
                .Returns(mockEncompassLoanStatuses.Expression);
            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>().Setup(m => m.ElementType)
                .Returns(mockEncompassLoanStatuses.ElementType);
            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>().Setup(m => m.GetEnumerator())
                .Returns(mockEncompassLoanStatuses.GetEnumerator());
            return mockEncompassLoanStatusSet;
        }
</code>```

It is failing in class at line

```<code>            var fundedLoans = await loans.Select(loan => new FundedLoanDto()
            {
                BorrowerName = $"{loan.FirstName} {loan.LastName}",
                FundedDate = loan.Funded,
                LoanId = loan.EncompassId,
                LoanProduct = loan.LoanProgramName,
                ReceivedDate = loan.Createddate,
                SalesRep = loan.Salesrep
            }).ToListAsync();
</code>```

Body:
We recently moved our project from netcore3. to net5.0 and all unit tests started failing with same error
The source 'IQueryable' doesn't implement 'IAsyncEnumerable<Migo.API.Dtos.FundedLoanDto>'. Only sources that implement 'IAsyncEnumerable' can be used for Entity Framework asynchronous operations.

It works fine in production. Only unit tests are failing

My actual class code -

 public async Task<GridDto> GetFundedLoans(LoanFilterDto loanFilter)
        {
            var query = GetLoanCommonFilter(loanFilter);
            query = query.Where(loan => EF.Functions.Like(loan.Status, "FUNDED"));
            if (loanFilter.FromDate.HasValue)
                query = query.Where(loan => loan.Funded.HasValue && loan.Funded.Value.Date >= loanFilter.FromDate.Value.Date);

            if (loanFilter.ToDate.HasValue)
                query = query.Where(loan => loan.Funded.HasValue && loan.Funded.Value.Date <= loanFilter.ToDate.Value);

            Expression<Func<EncompassLoanStatus, dynamic>> orderByExpression = GetLoanOrderByExpression(loanFilter.SortColumn);

            if (loanFilter.SortOrder?.ToUpper() == "DESC")
                query = query.OrderByDescending(orderByExpression);
            else
                query = query.OrderBy(orderByExpression);

            int recordsCount = query.Count();
            var loans = loanFilter.PageSize > 0 ? query.Skip((loanFilter.PageNumber - 1) * loanFilter.PageSize).Take(loanFilter.PageSize) : query;
            var fundedLoans = await loans.Select(loan => new FundedLoanDto()
            {
                BorrowerName = $"{loan.FirstName} {loan.LastName}",
                FundedDate = loan.Funded,
                LoanId = loan.EncompassId,
                LoanProduct = loan.LoanProgramName,
                ReceivedDate = loan.Createddate,
                SalesRep = loan.Salesrep
            }).ToListAsync();
            return new GridDto()
            {
                Records = fundedLoans,
                RecordsCount = recordsCount
            };
        }

        private IQueryable<EncompassLoanStatus> GetLoanCommonFilter(LoanFilterDto loanFilter)
        {
            var query = _context.EncompassLoanStatus.AsQueryable();
            if (string.IsNullOrEmpty(loanFilter.BorrowerFirstName) == false)
                query = query.Where(loan => EF.Functions.Like(loan.FirstName, $"%{loanFilter.BorrowerFirstName}%"));

            if (string.IsNullOrEmpty(loanFilter.BorrowerLastName) == false)
                query = query.Where(loan => EF.Functions.Like(loan.LastName, $"%{loanFilter.BorrowerLastName}%"));

            if (string.IsNullOrEmpty(loanFilter.LoanProduct) == false)
                query = query.Where(loan => EF.Functions.Like(loan.LoanProgramName, $"%{loanFilter.LoanProduct}%"));

            if (loanFilter.DealerPhoneNumbers?.Length > 0)
                query = query.Where(loan => loanFilter.DealerPhoneNumbers.Contains(loan.Dealerphone));

            if (string.IsNullOrEmpty(loanFilter.SalesRep) == false)
                query = query.Where(loan => EF.Functions.Like(loan.Salesrep, $"%{loanFilter.SalesRep}%"));

            return query;
        }

        private Expression<Func<EncompassLoanStatus, dynamic>> GetLoanOrderByExpression(string orderByColumn)
        {
            Expression<Func<EncompassLoanStatus, dynamic>> orderByExpression;
            switch (orderByColumn?.ToUpper())
            {
                case "BORROWERNAME": orderByExpression = loan => loan.FirstName; break;
                case "LOANPRODUCT": orderByExpression = loan => loan.LoanProgramName; break;
                case "SALESREP": orderByExpression = loan => loan.Salesrep; break;
                case "CANCELLEDDATE": orderByExpression = loan => loan.Cancelled; break;
                case "FUNDEDDATE": orderByExpression = loan => loan.Funded; break;

                default: orderByExpression = loan => loan.Createddate; break;
            }
            return orderByExpression;
        }

My unit test is

 [Theory]
        [InlineData("BORROWERNAME")]
        public async Task GetFundedLoansSortsCorrectly(string sortColumn)
        {
            var mockEncompassLoanStatusSet = GetMockEncompassLoanStatusSet(FundedEncompassLoanStatuses);

            _mockDigitalApplicationContext.Setup(x => x.EncompassLoanStatus).Returns(mockEncompassLoanStatusSet.Object);

            var loanFilter = new LoanFilterDto
            {
                SortColumn = sortColumn,
                PageSize = 1,
                PageNumber = 1
            };

            var cancelledLoans = await _digitalApplicationRepository.GetFundedLoans(loanFilter);
            var records = ((List<FundedLoanDto>)cancelledLoans.Records).ToArray();

            Assert.Equal(3, cancelledLoans.RecordsCount);
            Assert.Equal("asdh", records[0].LoanId);
            Assert.Equal("asdg", records[1].LoanId);
            Assert.Equal("asdf", records[2].LoanId);
        }

private static Mock<DbSet<EncompassLoanStatus>> GetMockEncompassLoanStatusSet(List<EncompassLoanStatus> loanStatuses)
        {
            var mockEncompassLoanStatuses = loanStatuses.AsQueryable();

            var mockEncompassLoanStatusSet = new Mock<DbSet<EncompassLoanStatus>>();

            mockEncompassLoanStatusSet.As<IAsyncEnumerable<EncompassLoanStatus>>()
                .Setup(m => m.GetAsyncEnumerator(It.IsAny<CancellationToken>()))
                .Returns(new TestAsyncEnumerator<EncompassLoanStatus>(mockEncompassLoanStatuses.GetEnumerator()));

            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>()
                .Setup(m => m.Provider)
                .Returns(new TestAsyncQueryProvider<EncompassLoanStatus>(mockEncompassLoanStatuses.Provider));

            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>().Setup(m => m.Expression)
                .Returns(mockEncompassLoanStatuses.Expression);
            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>().Setup(m => m.ElementType)
                .Returns(mockEncompassLoanStatuses.ElementType);
            mockEncompassLoanStatusSet.As<IQueryable<EncompassLoanStatus>>().Setup(m => m.GetEnumerator())
                .Returns(mockEncompassLoanStatuses.GetEnumerator());
            return mockEncompassLoanStatusSet;
        }

It is failing in class at line

            var fundedLoans = await loans.Select(loan => new FundedLoanDto()
            {
                BorrowerName = $"{loan.FirstName} {loan.LastName}",
                FundedDate = loan.Funded,
                LoanId = loan.EncompassId,
                LoanProduct = loan.LoanProgramName,
                ReceivedDate = loan.Createddate,
                SalesRep = loan.Salesrep
            }).ToListAsync();


问:
Monitor Python/Bash Scripts with Prometheus
What's the best way to monitor custom python scripts that run on a cron job with a prometheus? A couple options I came up with is:

Pushgateway

Text File Collector (Node exporter)

Script Exporter (3rd party)

Are these the only ways to do it?


问:
python modules that I can read and click on a keyboard key except pynput
I'm looking for python modules that I can read and click on a keyboard key except pynput

because I want to create a script that allows me to select a specific button and hold it until I click esc, and pynput while working will slow down the reaction of other buttons after a while of work by up to 10 seconds

I even used pygame.time.Clock().tick(1) but it didn't work


问:
How to add dragging effect frameless second window
I have main Window and when I press the button I call the open_rfid_check_window function shows window2. I add self.window2.setWindowFlags(Qt.FramelessWindowHint) for doing frameless. And I have main_title widget top of the window2. So when I click the self.rfidUi.main_title I need to move window with mouse press. But I coulnt find solution for the second window. How can I do this ?

```<code>def open_rfid_check_window(self, index):
    self.window2 = QMainWindow()
    self.rfidUi = Ui_MainWindow()
    self.rfidUi.setupUi(self.window2)
    # self.window2.setWindowFlags(Qt.FramelessWindowHint)
    self.rfidUi.minimizeBtn.clicked.connect(self.on_window_method)
    self.rfidUi.resizeBtn.clicked.connect(self.on_window_method)
    self.rfidUi.closeBtn.clicked.connect(self.on_window_method)
    self.rfidUi.lineEdit_2.textChanged.connect(partial(self.send_index_name,index))
    self.window2.show()
</code>```

Body:
I have main Window and when I press the button I call the open_rfid_check_window function shows window2. I add self.window2.setWindowFlags(Qt.FramelessWindowHint) for doing frameless. And I have main_title widget top of the window2. So when I click the self.rfidUi.main_title I need to move window with mouse press. But I coulnt find solution for the second window. How can I do this ?

def open_rfid_check_window(self, index):
    self.window2 = QMainWindow()
    self.rfidUi = Ui_MainWindow()
    self.rfidUi.setupUi(self.window2)
    # self.window2.setWindowFlags(Qt.FramelessWindowHint)
    self.rfidUi.minimizeBtn.clicked.connect(self.on_window_method)
    self.rfidUi.resizeBtn.clicked.connect(self.on_window_method)
    self.rfidUi.closeBtn.clicked.connect(self.on_window_method)
    self.rfidUi.lineEdit_2.textChanged.connect(partial(self.send_index_name,index))
    self.window2.show()


问:
Python Dict elements access
I am trying to extract only values from dict and place it in String array.

I have tried using dict.values(), but I'm getting below error:

```<code>Dictionary:[{'_id': 'CA'}, {'_id': 'TX'}, {'_id': 'FL'}]
</code>```

Code:

```<code>for key,value in States_dict.items():
    States.append(value)
</code>```

Error:

```<code>[{'_id': 'TX'}, {'_id': 'FL'}, {'_id': 'CA'}]
Traceback (most recent call last):
  File "/Users/karthiktvs/DB_project/hello.py", line 64, in <module>
    for key,value in States_dict.items():
AttributeError: 'list' object has no attribute 'items'
</code>```

`

Title: Python Dict elements access

Body:
I am trying to extract only values from dict and place it in String array.

I have tried using dict.values(), but I'm getting below error:

Dictionary:[{'_id': 'CA'}, {'_id': 'TX'}, {'_id': 'FL'}]

Code:

for key,value in States_dict.items():
    States.append(value)

Error:

[{'_id': 'TX'}, {'_id': 'FL'}, {'_id': 'CA'}]
Traceback (most recent call last):
  File "/Users/karthiktvs/DB_project/hello.py", line 64, in <module>
    for key,value in States_dict.items():
AttributeError: 'list' object has no attribute 'items'

`


问:
Don't wotrk withCredentials: true in vue3 + axios+ spring-security
I try use vue3 + axios+ spring-security-kerberos-client and can't pass jsession cookies

if i use last axios version, property withCredentials: true don't pass jsession cookies.
I created config

```<code>const app = axios.create({
    baseURL,
    withCredentials: true
})

app.interceptors.response.use(
  response => (response),
  error => (Promise.reject(error))
)

export default app;
</code>```

And when run, baseURL applied, but don't pass jsession cookies.

2.) If i use "axios": "^0.26.0", then spring-security-kerberos-client returned 403 forbidden(because backend
don't recieve correct login. Please help

Body:
I try use vue3 + axios+ spring-security-kerberos-client and can't pass jsession cookies

if i use last axios version, property withCredentials: true don't pass jsession cookies.
I created config

const app = axios.create({
    baseURL,
    withCredentials: true
})

app.interceptors.response.use(
  response => (response),
  error => (Promise.reject(error))
)

export default app;

And when run, baseURL applied, but don't pass jsession cookies.

2.) If i use "axios": "^0.26.0", then spring-security-kerberos-client returned 403 forbidden(because backend
don't recieve correct login. Please help


问:
Uncaught Error: Objects are not valid as a React child (found: object with keys
I didn't understand how to properly render the array of objects required by the react. I'm trying to create a set of filters with hooks to display a list. But when i try to delete an specific filter i received the error.

My filters list

```<code><div>
        <ul>
          {savedFilters.map((f) => (
            <div key={ f.filterID }>
              <li>{f.filterID}</li>
              <li>{f.column}</li>
              <li>{f.comparison}</li>
              <li>{f.number}</li>
              <button
                type="button"
                data-testid="button-remove-filters"
                onClick={ rvmFilter }
              >
                X

              </button>
            </div>
</code>```

The function to remove the specific filter:

```<code> const rvmFilter = (index) => setColumnList(
    savedFilters.filter((item, i) => i !== index),
  );
</code>```

The Components state:

The filters stack applies properly but the remove button breaks the application with the error:

Uncaught Error: Objects are not valid as a React child (found: object with keys {column, number, comparison, filterID}). If you meant to render a collection of children, use an array instead.

Body:
I didn't understand how to properly render the array of objects required by the react. I'm trying to create a set of filters with hooks to display a list. But when i try to delete an specific filter i received the error.

My filters list

          {savedFilters.map((f) => (

{f.filterID}

{f.column}

{f.comparison}

{f.number}

              <button
                type="button"
                data-testid="button-remove-filters"
                onClick={ rvmFilter }
              >
                X

              </button>

The function to remove the specific filter:

 const rvmFilter = (index) => setColumnList(
    savedFilters.filter((item, i) => i !== index),
  );

The Components state:

The filters stack applies properly but the remove button breaks the application with the error:

Uncaught Error: Objects are not valid as a React child (found: object with keys {column, number, comparison, filterID}). If you meant to render a collection of children, use an array instead.


问:
Lazy Loading For Mobile Optimization
Below is the code that I'm using on my website. It runs well over wi-fi, but the website often freezes and crashes when testing it out over a mobile network. One of the issues for this is that (I believe) all the content on the page loads at once and is difficult to load on a mobile device.

I've tried several different techniques to try and get the photos on my website to lazy load so that it could run more efficiently, but nothing seems to be working. If anyone knows how I could go about doing this it'd be much appreciated if you could share your knowledge with me.

```<code><!DOCTYPE html>
<html lang="en">

<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">

<body>

<style>html{visibility: hidden; opacity: 0;}</style>

<title>MORIKOBOSHI・</title>

<div class="page-wrap">

<div class="cp_cont">
<input id="cp_toggle03" type="checkbox"/>
<div class="cp_mobilebar">
<label for="cp_toggle03" class="cp_menuicon">
<span></span>
</label>
</div>
<label id="h-menu_black" class="cp_toggle03" for="cp_menuicon"></label>
<div id="body" class="noscroll"></div>

<header class="cp_offcm03">

<nav>
<ul style="text-align: center; margin-left: 210px; overflow: hidden;">

<li style="border-bottom: .05px solid lightgray;"><a href="#">Home</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">Blog</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">About This Website</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">Bibliography</a></li>

<div class="searchbar">

<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Custom Google Search" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="Search" style="padding-left: 5px; top: 153px; height: 25px; width: 50px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">

</form>
</div>

<script type="text/javascript">
 document.getElementById('frmSearch').onsubmit = function() {
 window.location = 'http://www.google.com/search?q=site:morikoboshi.com' + document.getElementById('txtSearch').value;
        return false;
    }

</script>

<script>
 document.getElementById('cp_toggle03').onchange = function() {
 if (document.getElementById('cp_toggle03').checked) {
 document.body.style.overflow = "hidden";
  } else {
 document.body.style.overflow = "";
  }
}

if(!!window.performance && window.performance.navigation.type == 2)
{
    window.location.reload();
}
</script>

</ul>
</nav>
</header>

<div class="setsumei">

 <br><br><h1 style="text-align: center; font-size: 40px;">◯◯◯◯</h1>
    <br><p style="text-align: justify; font-size: 16px;"></p>

 <p style="text-align: center; font-size: 13px;">Author: ◯◯◯◯</p>
 <p style="text-align: center; font-size: 13px;">Photos/Videos Taken：◯◯◯◯/◯◯/◯◯</p>

 <br><br><p style="text-align: justify; font-size: 16px;">

    #
 </p>

</div>

<br><br><div class="image">

  <a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

</div>

<br><br><footer class="site-footer" style="font-size: 12px;">MORIKOBOSHI© | <a href="#">日本語</a></footer>

</div>
</div>

<style>

html {visibility: visible;
      opacity: 1;}

.body{background-color: white;
      font-family: sans-serif;}

 .searchbar{float: right;}

 .image{text-align: center;}

 .setsumei{margin-left: 20px;
           margin-right: 20px;}

 .footer{width: 100%;
           height: 40px;
           text-align: center;
           border-top: 1px solid black;
           position: absolute;
           bottom: 0;
           padding: 10px;}

 .page-wrap {
  min-height: 100%;
  /* equal to footer height */
  margin-bottom: -40px;
}

 .page-wrap:after {
  content: "";
  display: block;
  }

 .site-footer, .page-wrap:after {
  /* .push must be the same height as footer */
  height: 20px;
}

 .site-footer {
  text-align: center;
  border-top: 1px solid black;
  padding: 10px;
}

 *, *:before, *:after {
    padding-left: 0;
    margin: 0;
    box-sizing: border-box;

}

 ol, ul {
    list-style: none;
}

 a {
    text-decoration: none;
    color: black;
}

 .cp_cont {
    height: auto;
}

/* menu */
 .cp_offcm03 {
    position: relative;
    z-index: 5000;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    width: 100%;
    height: auto;
    padding-top: 0;
    -webkit-transition: transform 0.3s ease-in;
            transition: transform 0.3s ease-in;
    text-align: center;
    color: black;
    background-color: white;
}
 .cp_offcm03 nav,
 .cp_offcm03 ul {
    height: 100%;
}

 .cp_offcm03 li {
    display: inline-block;
    margin-right: -6px;
}

 .cp_offcm03 a {
    display: block;
    padding: 15px 45px;
    margin-bottom: -5px;
    -webkit-transition: background-color .3s ease-in;
            transition: background-color .3s ease-in;
}

 .cp_offcm03 a:hover {
    background-color: lightgray;
}

/* menu toggle */
 #cp_toggle03 {
    display: none;
}

 #cp_toggle03:checked ~ .cp_offcm03 {
    -webkit-transform: translateX(0);
                    transform: translateX(0);
}

 #cp_toggle03:checked ~ .cp_container {
    -webkit-transform: translateX(0);
                    transform: translateX(0);
}

 .cp_mobilebar {
    display: none;

}

/* content */
 .cp_container {
    position: relative;
    top: 0;
    padding: 35px auto;
    -webkit-transition: transform .3s ease-in;
            transition: transform .3s ease-in;
}

 .cp_content {
    margin: 0 auto;
    padding: 20px;
    height: 65vh;
    text-align: center;

}

@media (max-width: 1130px)and (min-width: 280px) {
/* menu */
 .cp_offcm03 {
        position: fixed;
        left: -250px;
        overflow-y: hidden;
        width: 250px;
        height: 100%;
        padding-top: 40px;
        color: black;
        background-color: white;
        z-index: 1000;
    }

 .cp_offcm03 nav {
        background: white;
        border-right: 0.5px solid lightgray;
        margin-left: -210px;
    }

 .cp_offcm03 li {
        display: block;
        margin-right: 0;}

 .cp_offcm03 a {
        padding: 20px;

    }

/* menu toggle */
 .cp_mobilebar {
        display: block;
        z-index: 2000;
        position: relative;
        top: 0;
        left: 0;
        padding: 0 25px;
        width: 100%;
        height: 40px;
        background-color: white;
        border-bottom: .05px solid lightgray;

    }

 .cp_menuicon {
        display: block;
        position: relative;
        width: 25px;
        height: 100%;
        cursor: pointer;
        -webkit-transition: transform .3s ease-in;
                transition: transform .3s ease-in;
    }
 .cp_menuicon > span {
        display: block;
        position: absolute;
        top: 55%;
        margin-top: -0.3em;
        width: 100%;
        height: 0.2em;
        border-radius: 1px;
        background-color: black;
        -webkit-transition: transform .3s ease;
                transition: transform .3s ease;
    }
 .cp_menuicon > span:before,
 .cp_menuicon > span:after {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 1px;
        background-color: black;
        -webkit-transition: transform .3s ease-in;
                transition: transform .3s ease-in;
    }

 .cp_menuicon > span:before {
        -webkit-transform: translateY(-0.6em);
                transform: translateY(-0.6em);
    }

 .cp_menuicon > span:after {
        -webkit-transform: translateY(0.6em);
                transform: translateY(0.6em);
    }

 #cp_toggle03:checked + .cp_mobilebar .cp_menuicon {
        -webkit-transform: rotate(45deg);
                transform: rotate(45deg);
    }

 #cp_toggle03:checked + .cp_mobilebar span:before,
 #cp_toggle03:checked + .cp_mobilebar span:after {
        -webkit-transform: rotate(90deg);
                transform: rotate(90deg);
    }

 #cp_toggle03:checked ~ .cp_offcm03 {
        -webkit-transform: translateX(100%);
                transform: translateX(100%);
    }

 #cp_toggle03:checked ~ .cp_container {
        -webkit-transform: translateX(250px);
                transform: translateX(250px);
    }

 input:checked ~ #h-menu_black {
    display: block;/*カバーを表示*/
    opacity: .6;
}

 #h-menu_black {
    display: none;
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    transition: .7s ease-in-out;
}

/* content */
 .cp_container {
        top: 60px;
        height: 92vh;
        text-align: center;
    }

 .noscroll{
        overflow: hidden;
        position: fixed;
    }

</style>

</body>
</html>
</code>```

Title: Lazy Loading For Mobile Optimization

Body:
Below is the code that I'm using on my website. It runs well over wi-fi, but the website often freezes and crashes when testing it out over a mobile network. One of the issues for this is that (I believe) all the content on the page loads at once and is difficult to load on a mobile device.

I've tried several different techniques to try and get the photos on my website to lazy load so that it could run more efficiently, but nothing seems to be working. If anyone knows how I could go about doing this it'd be much appreciated if you could share your knowledge with me.

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">

<title>MORIKOBOSHI・</title>

<input id="cp_toggle03" type="checkbox"/>

Home

Blog

About This Website

Bibliography

<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Custom Google Search" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="Search" style="padding-left: 5px; top: 153px; height: 25px; width: 50px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">

</form>

◯◯◯◯

Author: ◯◯◯◯

Photos/Videos Taken：◯◯◯◯/◯◯/◯◯

    #

MORIKOBOSHI© | 日本語


问:
How to go to a new external API with ag-grid-react?
I have a table which uses external API + useEffect for its data, and I want to be able to click any date as seen below, and in doing so a new table/page is opened with data from a second external API based on the specific cell you clicked. So if I press '23' at the top of the date column, it takes the user to a new table that has different columns and rows, etc, based on that specific date that was clicked.

This is my code for the table below:

```<code>function Names() {
  const [rowData, setRowData] = useState([]);
  const [search, setSearch] = useState("");

  const columns = [
  { headerName: "Initial", field: "initial"},
  { headerName: "Date", field: "date" },
  { headerName: "Name", field: "name" }
];

useEffect(() => {
  fetch('LINK GOES HERE')
    .then(res => { return res.json();
    })
    .then (data => { setRowData(data);
    })
}, []);
</code>```

And then it is returned and displayed with this:

```<code><AgGridReact
          columnDefs={columns}
        rowData={rowData}
</code>```

and I've tried experimenting with code from the ag-grid website which includes:

```<code>const onCellClicked = (params: CellClickedEvent) => console.log('Temp debug check');

<AgGridReact onCellClicked={onCellClicked}> </AgGridReact>

const gridOptions = {

    onCellClicked: (event: CellClickedEvent) => console.log('Temp debug check'),
}

</code>```

But it's not working at all. Am I missing something here? I can't figure out how to call/get the other URL with its own table in the AgGridReact.

Body:
I have a table which uses external API + useEffect for its data, and I want to be able to click any date as seen below, and in doing so a new table/page is opened with data from a second external API based on the specific cell you clicked. So if I press '23' at the top of the date column, it takes the user to a new table that has different columns and rows, etc, based on that specific date that was clicked.

This is my code for the table below:

function Names() {
  const [rowData, setRowData] = useState([]);
  const [search, setSearch] = useState("");

  const columns = [
  { headerName: "Initial", field: "initial"},
  { headerName: "Date", field: "date" },
  { headerName: "Name", field: "name" }
];

useEffect(() => {
  fetch('LINK GOES HERE')
    .then(res => { return res.json();
    })
    .then (data => { setRowData(data);
    })
}, []);

And then it is returned and displayed with this:

<AgGridReact
          columnDefs={columns}
        rowData={rowData}

and I've tried experimenting with code from the ag-grid website which includes:

const onCellClicked = (params: CellClickedEvent) => console.log('Temp debug check');

<AgGridReact onCellClicked={onCellClicked}> </AgGridReact>

const gridOptions = {

    onCellClicked: (event: CellClickedEvent) => console.log('Temp debug check'),
}

But it's not working at all. Am I missing something here? I can't figure out how to call/get the other URL with its own table in the AgGridReact.


问:
Telethon check if can send message in group or NOT (Banned or not)
I have telethon script i send all group i have message from "saved message"
i need to check if im banned on a specific group or i have right to post
my code

`

```<code>    try:
        async for m in client.iter_messages('me', limit=1):
            message = m
            break
    except:
        print("Error getting saved message. or dont have saved message")
        sys.exit()

    async for dialog in client.iter_dialogs():
        if dialog.is_group:

            #here i need a logic to check if banned is False in every group
            if dialog.is_banned == False:
                await client.send_message(dialog.id, message)
</code>```

`

i have read all library from telethon but i dont finded solution

Body:
I have telethon script i send all group i have message from "saved message"
i need to check if im banned on a specific group or i have right to post
my code

`

    try:
        async for m in client.iter_messages('me', limit=1):
            message = m
            break
    except:
        print("Error getting saved message. or dont have saved message")
        sys.exit()

    async for dialog in client.iter_dialogs():
        if dialog.is_group:

            #here i need a logic to check if banned is False in every group
            if dialog.is_banned == False:
                await client.send_message(dialog.id, message)

`

i have read all library from telethon but i dont finded solution


问:
CSS affect container outside of parent
Im currently trying to style a div container outside a parent when an input is not empty. Here is my code so far:

CSS:

```<code>  .container input:not(:placeholder-shown) > .contaienr label {
  margin-top: -11px;
}
</code>```

HTML:

```<code>    <div class="container">
        <label id="floatingInput" class="text-white mt-[6px] ml-3 block z-0 absolute peer-focus:text-sm peer-focus:-mt-12 ease-in-out duration-150 peer-focus:z-20 peer-focus:bg-transpa after:z-20 after:content-[' '] after:absolute after:w-20 after:h-5 after:top-0 after:left-0">Enter your Password</label>
              <div class="big peer-focus:bg-blue-500 ease-in-out duration-150 overflow-visible">
                   <input placeholder=' ' type="password" id="password" class="peer z-10 relative form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-transparent outline-none" />
              </div>
    </div>
</code>```

I want to adress the label in this example here, but I can't get it to work. I tried all selectors that are shown here (https://www.w3.org/TR/selectors-3/#selectors) but no success. The problem here is that the label tag is outside the big container, which contains the input. (And yes, I'm using a mix of Tailwind and normal css because you cant really do something so complex like this in tailwind afaik, pls dont rost me)

Any help is appreciated. Thank you in advance :)

UPDATE:

Made a jsfiddle for you guys to test (Line in question is in 70): https://jsfiddle.net/bendix_en/ocqzyf2t/52

Title: CSS affect container outside of parent

Body:
Im currently trying to style a div container outside a parent when an input is not empty. Here is my code so far:

CSS:

  .container input:not(:placeholder-shown) > .contaienr label {
  margin-top: -11px;
}

HTML:

        Enter your Password

                   <input placeholder=' ' type="password" id="password" class="peer z-10 relative form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-transparent outline-none" />

I want to adress the label in this example here, but I can't get it to work. I tried all selectors that are shown here (https://www.w3.org/TR/selectors-3/#selectors) but no success. The problem here is that the label tag is outside the big container, which contains the input. (And yes, I'm using a mix of Tailwind and normal css because you cant really do something so complex like this in tailwind afaik, pls dont rost me)

Any help is appreciated. Thank you in advance :)

UPDATE:

Made a jsfiddle for you guys to test (Line in question is in 70): https://jsfiddle.net/bendix_en/ocqzyf2t/52


问:
Java for loop not stopping. what is wrong with the code
It seems like the for loop in my code is not stopping after it iterated througt the counter. it seems to restart, checked with the print function and the length of the directory list seems to be recognized but then it restarts from 0 and so on. First time coding with java and in general i do not have much experience in coding, logic experience comes from visual coding and little bit of python. if somebody can help it would be great.

here is the code,
to run it you need will need processing (https://processing.org/download) and some images in the input folder. thougth this is an easy problem, thats why i still post it here.

I know its not pretty so pls dont hate on it

```<code>int dim = 1024;
PImage img;
String inDir;
import java.util.*;
import java.text.DecimalFormat;

String outDir;
String nameSpace;
String nameSpaceOut;
PGraphics pg;

void setup() {
  size(1024, 1024);
  inDir = "C:/Users/Fynn/Desktop/processing-3.5.4/Resizematte/data/Input 1/";
  outDir = "C:/Users/Fynn/Desktop/processing-3.5.4/Resizematte/data/Output 3/";
  nameSpace = "ImageToResize";
  pg = createGraphics(dim, dim);

  nameSpaceOut = "Resized";
}

void draw () {
  background(0);

  pg.beginDraw();

  File dir = new File(inDir);
  String[] filenames = dir.list();

  for (int i = 0; i < filenames.length; i++) {
    background(255, 255, 255);
    String fName = inDir + filenames[i];

    img = loadImage(fName);
    if (img != null) {
      float w = img.width;
      float h = img.height;
      float m = w;
      float f = h;
      if (h > w) { //change to < for crop > for matte
        m = h;
        f = w;
      }
      float factor = (dim/m);
      if(h > w){
        img.resize(int(f*factor), int(m*factor));
      }
      else {
       img.resize(int(m*factor), int(f*factor));
      }

      image(img, width/2-img.width/2, height/2-img.height/2);
      String outName1 = outDir + nameSpaceOut + "_" + i +".png";
     save(outName1);
     }
   }
}

</code>```

i try to format pictures which i want to use as a data set input for a GAN machine learnign algorithm.

Body:
It seems like the for loop in my code is not stopping after it iterated througt the counter. it seems to restart, checked with the print function and the length of the directory list seems to be recognized but then it restarts from 0 and so on. First time coding with java and in general i do not have much experience in coding, logic experience comes from visual coding and little bit of python. if somebody can help it would be great.

here is the code,
to run it you need will need processing (https://processing.org/download) and some images in the input folder. thougth this is an easy problem, thats why i still post it here.

I know its not pretty so pls dont hate on it

int dim = 1024;
PImage img;
String inDir;
import java.util.*;
import java.text.DecimalFormat;

String outDir;
String nameSpace;
String nameSpaceOut;
PGraphics pg;

void setup() {
  size(1024, 1024);
  inDir = "C:/Users/Fynn/Desktop/processing-3.5.4/Resizematte/data/Input 1/";
  outDir = "C:/Users/Fynn/Desktop/processing-3.5.4/Resizematte/data/Output 3/";
  nameSpace = "ImageToResize";
  pg = createGraphics(dim, dim);

  nameSpaceOut = "Resized";
}

void draw () {
  background(0);

  pg.beginDraw();

  File dir = new File(inDir);
  String[] filenames = dir.list();

  for (int i = 0; i < filenames.length; i++) {
    background(255, 255, 255);
    String fName = inDir + filenames[i];

    img = loadImage(fName);
    if (img != null) {
      float w = img.width;
      float h = img.height;
      float m = w;
      float f = h;
      if (h > w) { //change to < for crop > for matte
        m = h;
        f = w;
      }
      float factor = (dim/m);
      if(h > w){
        img.resize(int(f*factor), int(m*factor));
      }
      else {
       img.resize(int(m*factor), int(f*factor));
      }

      image(img, width/2-img.width/2, height/2-img.height/2);
      String outName1 = outDir + nameSpaceOut + "_" + i +".png";
     save(outName1);
     }
   }
}

i try to format pictures which i want to use as a data set input for a GAN machine learnign algorithm.


问:
"too many input arguments" error in Matlab when I'm passing the input arguments as documented
I have a script which calls this Matlab function.  I'm using Matlab 2022a.

The function is erroring out at line 95, when it calls hann:

```<code>Removing Line Noise by Spectral Estimation using a 32768-point hanning window
Error using hann
Too many input arguments.

Error in removeLineNoise_SpectrumEstimation (line 95)
    window = hann(m,'periodic')';

Error in denoise_and_run_ks (line 12)
denoisedNSG.Data = removeLineNoise_SpectrumEstimation(NS6.Data, 30000);

95      window = hann(m,'periodic')';
</code>```

But according to Matlab's documentation hann takes two arguments.  Stopped in the debugger, m is 32768. The only thing I can think of is that there's some other definition of hann lurking but I don't know how to find it if so.

Body:
I have a script which calls this Matlab function.  I'm using Matlab 2022a.

The function is erroring out at line 95, when it calls hann:

Removing Line Noise by Spectral Estimation using a 32768-point hanning window
Error using hann
Too many input arguments.

Error in removeLineNoise_SpectrumEstimation (line 95)
    window = hann(m,'periodic')';

Error in denoise_and_run_ks (line 12)
denoisedNSG.Data = removeLineNoise_SpectrumEstimation(NS6.Data, 30000);

95      window = hann(m,'periodic')';

But according to Matlab's documentation hann takes two arguments.  Stopped in the debugger, m is 32768. The only thing I can think of is that there's some other definition of hann lurking but I don't know how to find it if so.


问:
Springboot 2.7.1 : RestController returning 200 Status when the request param is missing
I have the below SpringBoot Controller test which is working as expected and asserting 200 response

```<code>@GetMapping("/payment/list")
public ResponseEntity<?> getPaymentList(@RequestParam(value = "pageNum") Integer pageNum,
                                     @RequestParam(value = "pageSize") Integer pageSize,
                                     @RequestParam(value = "accountId") String accountId,
                                     @RequestParam(value = "sortParam") Integer sortParam) {
    PageableResult<PaymentDTO> paymentList = paymentService.getPaymentList(pageNum, pageSize, accountId, sortParam);
    return ResponseEntity.ok().body(paymentList);
}
</code>```

Below is my test case

```<code>@Test
public void testfindAll() throws Exception {
    //Given
    Integer pageNum = 1;
    Integer pageSize = 5;
    String accountId = "testaccountId";
    Integer sortParam = 2;
    PageableResult<PaymentDTO> result = gettestResult();

    //when
    Mockito.when(paymentService.getPaymentList(pageNum, pageSize, accountId, sortParam)).thenReturn(result);

    //Then
    mockMvc.perform(MockMvcRequestBuilders
                    .get("/payment/list")
                    .param("pageNum", pageNum.toString())
                    .param("pageSize", pageSize.toString())
                    .param("accountId", accountId)
                    .param("sortParam", sortParam.toString())
    ).andDo(print())
    .andExpect(status().isOk())
    .andReturn().getResponse().getContentAsString();
}
</code>```

But when I comment out one of the request param as below in the console log I see 500 error but the test is still passing, can someone please help me understand why the controller is returning 200 Status but the body is giving 500 error?

```<code> mockMvc.perform(MockMvcRequestBuilders
                        .get("/payment/list")
                        .param("pageNum", pageNum.toString())
                        ///.param("pageSize", pageSize.toString())
                        .param("accountId", accountId)
                        .param("sortParam", sortParam.toString())
        ).andDo(print())
        .andExpect(status().isOk())
        .andReturn().getResponse().getContentAsString();
</code>```

Console log for 500 error

```<code>2022-12-05 14:51:45.285[HW0015904][Test worker][ERROR][GlobalControllerExceptionHandler] - unexpected-error: request uri: [{E}/payment/list{/E}] exception: org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'pageSize' for method parameter type Integer is not present
    at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValueInternal(RequestParamMethodArgumentResolver.java:218)
    at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:193)
    at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:114)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:179)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:146)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Content-Type:"application/json"]
     Content type = application/json
             Body = {"status":false,"errorCode":500,"errorMessage":"Internal Error!","result":null}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []
</code>```

Body:
I have the below SpringBoot Controller test which is working as expected and asserting 200 response

@GetMapping("/payment/list")
public ResponseEntity<?> getPaymentList(@RequestParam(value = "pageNum") Integer pageNum,
                                     @RequestParam(value = "pageSize") Integer pageSize,
                                     @RequestParam(value = "accountId") String accountId,
                                     @RequestParam(value = "sortParam") Integer sortParam) {
    PageableResult<PaymentDTO> paymentList = paymentService.getPaymentList(pageNum, pageSize, accountId, sortParam);
    return ResponseEntity.ok().body(paymentList);
}

Below is my test case

@Test
public void testfindAll() throws Exception {
    //Given
    Integer pageNum = 1;
    Integer pageSize = 5;
    String accountId = "testaccountId";
    Integer sortParam = 2;
    PageableResult<PaymentDTO> result = gettestResult();

    //when
    Mockito.when(paymentService.getPaymentList(pageNum, pageSize, accountId, sortParam)).thenReturn(result);

    //Then
    mockMvc.perform(MockMvcRequestBuilders
                    .get("/payment/list")
                    .param("pageNum", pageNum.toString())
                    .param("pageSize", pageSize.toString())
                    .param("accountId", accountId)
                    .param("sortParam", sortParam.toString())
    ).andDo(print())
    .andExpect(status().isOk())
    .andReturn().getResponse().getContentAsString();
}

But when I comment out one of the request param as below in the console log I see 500 error but the test is still passing, can someone please help me understand why the controller is returning 200 Status but the body is giving 500 error?

 mockMvc.perform(MockMvcRequestBuilders
                        .get("/payment/list")
                        .param("pageNum", pageNum.toString())
                        ///.param("pageSize", pageSize.toString())
                        .param("accountId", accountId)
                        .param("sortParam", sortParam.toString())
        ).andDo(print())
        .andExpect(status().isOk())
        .andReturn().getResponse().getContentAsString();

Console log for 500 error

2022-12-05 14:51:45.285[HW0015904][Test worker][ERROR][GlobalControllerExceptionHandler] - unexpected-error: request uri: [{E}/payment/list{/E}] exception: org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'pageSize' for method parameter type Integer is not present
    at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValueInternal(RequestParamMethodArgumentResolver.java:218)
    at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:193)
    at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:114)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:179)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:146)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Content-Type:"application/json"]
     Content type = application/json
             Body = {"status":false,"errorCode":500,"errorMessage":"Internal Error!","result":null}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []


问:
Declarative relationship sqlalchemy
Trying to create relationship between tables in data models.

```<code>Class masters(Base):
    __tablename__='master'
    id = Column(Integer,primary_key=True)
    code = Column(String(128),nullable=False)
Class Payments(Base):
    __tablename__ = 'payments'

    code = Column(String(128), ForeignKey('master.code'),nullable=False, unique=True)
    source_id = Column(ForeignKey('master.id'), nullable=False)

    source = relationship('masters', primaryjoin='Payments.source_id == master.id')
    code1 = relationship('masters')
</code>```

Only the relationship between source and id has been established(while viewing relationsal schema, exported this to db visualizer).
How can I define correct relationship so that both relationships reflects in the schema?

Trying to determine the solution quickly and easily as I have not much context to sqlalchemy.

Title: Declarative relationship sqlalchemy

Body:
Trying to create relationship between tables in data models.

Class masters(Base):
    __tablename__='master'
    id = Column(Integer,primary_key=True)
    code = Column(String(128),nullable=False)
Class Payments(Base):
    __tablename__ = 'payments'

    code = Column(String(128), ForeignKey('master.code'),nullable=False, unique=True)
    source_id = Column(ForeignKey('master.id'), nullable=False)

    source = relationship('masters', primaryjoin='Payments.source_id == master.id')
    code1 = relationship('masters')

Only the relationship between source and id has been established(while viewing relationsal schema, exported this to db visualizer).
How can I define correct relationship so that both relationships reflects in the schema?

Trying to determine the solution quickly and easily as I have not much context to sqlalchemy.


问:
Using PHP to Navigate through JavaScript Pagination
I am trying to figure out a way to navigate through the pagination on this page to get to pages 2 and onwards:
https://onlineservice.oakbay.ca/WebApps/OurCity/Prospero/Search.aspx

This is the code they are using when you click on one of the pagination buttons:

```<code>var pagination = function (number) {
            var pageNumber = document.getElementById('ctl00_FeaturedContent_PageNumberHidden');
            var pageNumberButton = document.getElementById('ctl00_FeaturedContent_PageNumber');
            setWait();
            if (typeof number === 'number') {
                pageNumber.value = number;
            }
            pageNumberButton.click();
        }
</code>```

Looks like they are using JavaScript and HTTP Post but I cannot seem to figure it out. Any pointers or suggestions would be amazing. Thank you!

Tried to set up in POSTMAN

Body:
I am trying to figure out a way to navigate through the pagination on this page to get to pages 2 and onwards:
https://onlineservice.oakbay.ca/WebApps/OurCity/Prospero/Search.aspx

This is the code they are using when you click on one of the pagination buttons:

var pagination = function (number) {
            var pageNumber = document.getElementById('ctl00_FeaturedContent_PageNumberHidden');
            var pageNumberButton = document.getElementById('ctl00_FeaturedContent_PageNumber');
            setWait();
            if (typeof number === 'number') {
                pageNumber.value = number;
            }
            pageNumberButton.click();
        }

Looks like they are using JavaScript and HTTP Post but I cannot seem to figure it out. Any pointers or suggestions would be amazing. Thank you!

Tried to set up in POSTMAN


问:
Logging memory used by Entity Framework Core
Can I somehow log the size of data loaded to memory by Entity Framework?

It is easy to load a lot of data into memory by putting an AsEnumerable before the where clause.

Is the peak memory usage for each query loggable?


问:
Tab.Navigator props (tabBar) don't show the react elementa i'm passing
Component i'm passing in props

```<code>import React from 'react';
import styled from 'styled-components/native';

import HomeIcon from '../assets/home.svg';

const TabArea = styled.View`
  height: 60px;
  backgound-color: #4eadbe;
  flex-direction: row;
`;

const TabItem = styled.TouchableOpacity`
  flex: 1;
  justify-content: center;
  align-items: center;
`;

export default () => {
  return (
    <TabArea>
      <TabItem>
        <HomeIcon width="24" height="24" fill="#FFFFFF" />
      </TabItem>
    </TabArea>
  );
};

</code>```

The Maintab where i'm passing the component.

```<code>import React from 'react';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';

import CustomTabBar from '../components/CustomTabBar';

import Home from '../screens/Home';
import Search from '../screens/Search';
import Appointaments from '../screens/Appointaments';
import Favorites from '../screens/Favorites';
import Profile from '../screens/Profile';

const Tab = createBottomTabNavigator();

export default () => {
  return (
    <Tab.Navigator tabBar={props => <CustomTabBar {...props} />}>
      <Tab.Screen name="Home" component={Home} />
      <Tab.Screen name="Search" component={Search} />
      <Tab.Screen name="Appointaments" component={Appointaments} />
      <Tab.Screen name="Favorites" component={Favorites} />
      <Tab.Screen name="Profile" component={Profile} />
    </Tab.Navigator>
  );
};

</code>```

i'm following all the instructions on documentations and examples i've found until now, but when i run the code, it shows nothing on the screen.

This is not Working

```<code>  <Tab.Navigator tabBar={props => <CustomTabBar {...props} />}>
</code>```

PS: I running android studio emulator.

```<code></code>```

Body:
Component i'm passing in props

import React from 'react';
import styled from 'styled-components/native';

import HomeIcon from '../assets/home.svg';

const TabArea = styled.View`
  height: 60px;
  backgound-color: #4eadbe;
  flex-direction: row;
`;

const TabItem = styled.TouchableOpacity`
  flex: 1;
  justify-content: center;
  align-items: center;
`;

export default () => {
  return (
    <TabArea>
      <TabItem>
        <HomeIcon width="24" height="24" fill="#FFFFFF" />
      </TabItem>
    </TabArea>
  );
};

The Maintab where i'm passing the component.

import React from 'react';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';

import CustomTabBar from '../components/CustomTabBar';

import Home from '../screens/Home';
import Search from '../screens/Search';
import Appointaments from '../screens/Appointaments';
import Favorites from '../screens/Favorites';
import Profile from '../screens/Profile';

const Tab = createBottomTabNavigator();

export default () => {
  return (
    <Tab.Navigator tabBar={props => <CustomTabBar {...props} />}>
      <Tab.Screen name="Home" component={Home} />
      <Tab.Screen name="Search" component={Search} />
      <Tab.Screen name="Appointaments" component={Appointaments} />
      <Tab.Screen name="Favorites" component={Favorites} />
      <Tab.Screen name="Profile" component={Profile} />
    </Tab.Navigator>
  );
};

i'm following all the instructions on documentations and examples i've found until now, but when i run the code, it shows nothing on the screen.

This is not Working

  <Tab.Navigator tabBar={props => <CustomTabBar {...props} />}>

PS: I running android studio emulator.


问:
Handle different readers differently in a Linux Character Driver
I'm working on a Linux character driver which needs to provide different data to different readers when read. This is so that I can implement a kind of key-value store.

The interface would work something along the lines of:

# from terminal 1
echo "test" > /dev/key # tell the driver which
cat /dev/value # read the value associated with "test"
```
<pre class="lang-bash prettyprint-override"><code># from terminal 2
echo "other_key" > /dev/key
cat /dev/value
</code>```

The idea here is that, internally, the driver would keep track of which key each reader has requested, and then upon reading, return the value associated with that key.

The problem here is that I'm unsure how to check which process is reading/writing.

I'm assuming that if this data is available, it'll be in the struct file * that's passed to the read and write functions, but as far as I can tell there's no relevant field in that struct.

Is there a way to achieve this?

Body:
I'm working on a Linux character driver which needs to provide different data to different readers when read. This is so that I can implement a kind of key-value store.

The interface would work something along the lines of:

# from terminal 1
echo "test" > /dev/key # tell the driver which
cat /dev/value # read the value associated with "test"

# from terminal 2
echo "other_key" > /dev/key
cat /dev/value

The idea here is that, internally, the driver would keep track of which key each reader has requested, and then upon reading, return the value associated with that key.

The problem here is that I'm unsure how to check which process is reading/writing.

I'm assuming that if this data is available, it'll be in the struct file * that's passed to the read and write functions, but as far as I can tell there's no relevant field in that struct.

Is there a way to achieve this?


问:
How to store react native multiline TextInput in db with newlines
```<code><TextInput style={[styles.textInput, inputStyle]}
placeholder={{'About'}}
onChangeText={(text) => { onChangeText(text) }}
placeholderTextColor={Constants.COLOR_PLACEHOLDER}
multiline={isMultiline} {...this.props}/>
</code>```

I'm getting input from user as above with lines and want to store in db

Want to fetch above stored input back from db and show with newlines as provided

```<code><Text style={styles.titleText}>{about}</Text>
</code>```

But after storing into db I lose newlines, How can I keep newlines while storing in db?

Body:
<TextInput style={[styles.textInput, inputStyle]}
placeholder={{'About'}}
onChangeText={(text) => { onChangeText(text) }}
placeholderTextColor={Constants.COLOR_PLACEHOLDER}
multiline={isMultiline} {...this.props}/>

I'm getting input from user as above with lines and want to store in db

Want to fetch above stored input back from db and show with newlines as provided

<Text style={styles.titleText}>{about}</Text>

But after storing into db I lose newlines, How can I keep newlines while storing in db?


问:
private boolean checkCameraPermission()
did a project on the lessons where Fragment was used. Itam everything worked. But in my project I use a standard java file linked to a specific layout.

When copying the code, I get the inscription "getActivity()" is highlighted in red

I changed it to ****.class

but it did not help ....
what am I doing wrong ?

```<code>private boolean checkCameraPermission() {
    // check if storage permission is enabled or not
    //return true if enabled
    //return failed if not enabled
    boolean result = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA)
            == (PackageManager.PERMISSION_GRANTED);

    boolean result1 = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)
            == (PackageManager.PERMISSION_GRANTED);
    return result && result1;
}

private void requestCameraPermission() {
    //request runtime storage permission
    requestPermissions(cameraPermissions, CAMERA_REQUEST_CODE);
}

</code>```

Title: private boolean checkCameraPermission()

Body:
did a project on the lessons where Fragment was used. Itam everything worked. But in my project I use a standard java file linked to a specific layout.

When copying the code, I get the inscription "getActivity()" is highlighted in red

I changed it to ****.class

but it did not help ....
what am I doing wrong ?

private boolean checkCameraPermission() {
    // check if storage permission is enabled or not
    //return true if enabled
    //return failed if not enabled
    boolean result = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA)
            == (PackageManager.PERMISSION_GRANTED);

    boolean result1 = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)
            == (PackageManager.PERMISSION_GRANTED);
    return result && result1;
}

private void requestCameraPermission() {
    //request runtime storage permission
    requestPermissions(cameraPermissions, CAMERA_REQUEST_CODE);
}


问:
How can I use svgwrite.image.Image to set an image in the background of a canvas I have other elements on?
I have an svgwrite.Drawing into which I wish to insert a JPG image as the background image. Here's the code to what I have so far. It is using computer vision for a machine learning task. The essential part to help me begin understanding how I can insert an image, is on line 147 where I create a drawing using svgwrite. The problem I'm running into is that in the documentation, if you scroll down to where the factory methods are, it says that you can use Drawing.image and set an href for an image that you want to use. I did further down notice that in the factory methods it also has Drawing.saveas in the form svg_canvas.saveas, which does end up working for me so I know that I am using this Drawing method to create an svgwrite.image.Image object correctly, but it doesn't seem to be working. For reference, I insert the following code right after this line:

```<code>svg_canvas.image(href="/home/mendel/project/bg/bg.jpg", size = src_size)
</code>```

I triple checked that my href was correctly written out and that my bg image was in fact in the folder. src_size is already defined before as well so I'm pretty sure it's all working. But I'm not sure why the above line isn't working for me at all to give me a background image for the canvas. Please let me know if I'm using it incorrectly I really appreciate it!

I already tried the above solutions using the Python API but it isn't working. I also tried looking into other stack posts, none have worked for me so far.

Body:
I have an svgwrite.Drawing into which I wish to insert a JPG image as the background image. Here's the code to what I have so far. It is using computer vision for a machine learning task. The essential part to help me begin understanding how I can insert an image, is on line 147 where I create a drawing using svgwrite. The problem I'm running into is that in the documentation, if you scroll down to where the factory methods are, it says that you can use Drawing.image and set an href for an image that you want to use. I did further down notice that in the factory methods it also has Drawing.saveas in the form svg_canvas.saveas, which does end up working for me so I know that I am using this Drawing method to create an svgwrite.image.Image object correctly, but it doesn't seem to be working. For reference, I insert the following code right after this line:

svg_canvas.image(href="/home/mendel/project/bg/bg.jpg", size = src_size)

I triple checked that my href was correctly written out and that my bg image was in fact in the folder. src_size is already defined before as well so I'm pretty sure it's all working. But I'm not sure why the above line isn't working for me at all to give me a background image for the canvas. Please let me know if I'm using it incorrectly I really appreciate it!

I already tried the above solutions using the Python API but it isn't working. I also tried looking into other stack posts, none have worked for me so far.


问:
Monolog rotating log not formatted correctly
Using monolog (3.2) with rotating logs handler.
Everything works fine BUT, the rotated logs don't use the log format I set.
The main log is fine; the dated logs use the default output format instead.

It looks like the RotatingFileHandler should inherit format from parent, but for some reason it isn't.  I'm mystified.

```<code>    $log = $dir . '/today.log';
    $outputFormat = "[%datetime%] %level_name% > %message% %context% %extra%\n";

        $dateFormat = 'Y-m-d H:i';
        $line_format = new LineFormatter($outputFormat, $dateFormat);
        $stream = new StreamHandler($log, Level::Debug);
        $stream->setFormatter($line_format);
        //  u\echor($stream,'stream',STOP);
        $logger -> pushHandler($stream);

        $fileHandler = new RotatingFileHandler($log,5);
        $logger->pushHandler($fileHandler);
...
</code>```

Body:
Using monolog (3.2) with rotating logs handler.
Everything works fine BUT, the rotated logs don't use the log format I set.
The main log is fine; the dated logs use the default output format instead.

It looks like the RotatingFileHandler should inherit format from parent, but for some reason it isn't.  I'm mystified.

    $log = $dir . '/today.log';
    $outputFormat = "[%datetime%] %level_name% > %message% %context% %extra%\n";

        $dateFormat = 'Y-m-d H:i';
        $line_format = new LineFormatter($outputFormat, $dateFormat);
        $stream = new StreamHandler($log, Level::Debug);
        $stream->setFormatter($line_format);
        //  u\echor($stream,'stream',STOP);
        $logger -> pushHandler($stream);

        $fileHandler = new RotatingFileHandler($log,5);
        $logger->pushHandler($fileHandler);
...


问:
Remove PNG Background to have multiple layers of PNG that can be hovered
So I'm making some sort of interactive map for a roleplaying game I have, where I want to be able to hover a country and it can scale up a bit and have a hover effect and so you can be able to click on it and it will give you main info of the country and stuff. Now the issue comes that I'm trying to check if there is a way to have multiple PNG layered up on HTML, CSS, JS and avoid having the transparent background of the top layer hover only that specific one. I'm trying to check if there is a way for the code to detect only the colored area of the img or if this is not possible.

I've tried layering with the z-index, but that doesn't really resolve the issue.


问:
Publish React 16 component from nx
I would like to use the nx monorepo to publish a library, which uses React 16. Would I have to use the @nrwl/react plugin, which corresponds to React 16?

I have tried different versions of the @nrwl/react plugin. I have also tried installing React 16 and using it with the latest @nrwl/react plugin.

Title: Publish React 16 component from nx


问:
Python equivalent to PHP's getCanonicalURL
In PHP, there is supposedly some code -- a function called getCanonicalUrl -- that returns the url of a file

```<code>$f = wfFindFile( 'Foo.jpg' );
$imageUrl = $f->getCanonicalUrl(); // http://mywiki.com/images/0/06/Foo.jpg
</code>```

https://stackoverflow.com/a/11205314/4262207

Does python3 have an equivalent to this method?

Body:
In PHP, there is supposedly some code -- a function called getCanonicalUrl -- that returns the url of a file

$f = wfFindFile( 'Foo.jpg' );
$imageUrl = $f->getCanonicalUrl(); // http://mywiki.com/images/0/06/Foo.jpg

https://stackoverflow.com/a/11205314/4262207

Does python3 have an equivalent to this method?


问:
Calculate hash of Client Hello message with SSL (ssl_st) struct in OpenSSL
client_early_traffic_secret and early_exporter_master_secret was defined in RFC 8446 as

```<code>client_early_traffic_secret = Derive-Secret(Early Secret, "c e traffic", ClientHello)
early_exporter_master_secret = Derive-Secret(Early Secret, "e exp master", ClientHello)
</code>```

early_exporter_master_secret is calculated and saved into the SSL (ssl_st) struct in tls13_change_cipher_state() method in tls13_enc.c in OpenSSL 1.1.1 stable versions. However, client_early_traffic_secret is also calculated but not saved anywhere. To calculate client_early_traffic_secret, both the Early Secret (which is already saved as ssl_st->early_secret) and the hash of the Client Hello message (which is not saved either) are needed.

How can I get the hash of the Client Hello message with only SSL (ssl_st) struct? Or is there another way to calculate client_early_traffic_secret with SSL (ssl_st) struct?

OwnerDisplayName: Blaise Wang

Body:
client_early_traffic_secret and early_exporter_master_secret was defined in RFC 8446 as

client_early_traffic_secret = Derive-Secret(Early Secret, "c e traffic", ClientHello)
early_exporter_master_secret = Derive-Secret(Early Secret, "e exp master", ClientHello)

early_exporter_master_secret is calculated and saved into the SSL (ssl_st) struct in tls13_change_cipher_state() method in tls13_enc.c in OpenSSL 1.1.1 stable versions. However, client_early_traffic_secret is also calculated but not saved anywhere. To calculate client_early_traffic_secret, both the Early Secret (which is already saved as ssl_st->early_secret) and the hash of the Client Hello message (which is not saved either) are needed.

How can I get the hash of the Client Hello message with only SSL (ssl_st) struct? Or is there another way to calculate client_early_traffic_secret with SSL (ssl_st) struct?