问:
Cannot exclude assemblies when using coverlet 3.2.0 and a .runsettings file
I am trying to run unit tests using NUnit and coverlet but exclude assemblies that end with the name .Testing from the coverage report. However, whatever I do the file (for example MyProj.Testing.dll) is being added in the coverage report (other assemblies I don't want in the report, such as test assemblies, are not present).

I am using the following coverlet packages in my test assemblies:

coverlet.msbuild 3.2.0

coverlet.collector 3.2.0

I am using a .runsettings file to configure coverlet.

coverlet.runsettings file:

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <RunConfiguration>
    <ResultsDirectory>./CodeCoverage/</ResultsDirectory>
  </RunConfiguration>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat Code Coverage">
        <Configuration>
          <Format>cobertura</Format>
          <ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute,TestSDKAutoGeneratedCode</ExcludeByAttribute>
          <IncludeTestAssembly>false</IncludeTestAssembly>
          <CodeCoverage>
            <ModulePaths>
              <Include>
                <ModulePath>.*\.dll$</ModulePath>
                <ModulePath>.*\.exe$</ModulePath>
              </Include>
              <Exclude>
                <ModulePath>.*Testing\.dll$</ModulePath>
              </Exclude>
            </ModulePaths>
          </CodeCoverage>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>
```

I have looked at:

How to exclude Projects with names ending in ".Test" from my code coverage analysis in VS2012 Unit Tests

Using .runsettings to exclude assemblies from code coverage

https://learn.microsoft.com/en-gb/previous-versions/visualstudio/visual-studio-2015/test/customizing-code-coverage-analysis?view=vs-2015&redirectedfrom=MSDN&viewFallbackFrom=vs-2017

I have also tried:

Removing the Include section

Setting the Exclude/ModulePath to: .*Testing.*

Using Sources/Exclude/Source instead of ModulePath

I have been trying to do this seemingly trivial thing for hours but am now out of ideas. Any help would be appreciated.

Body:
I am trying to run unit tests using NUnit and coverlet but exclude assemblies that end with the name .Testing from the coverage report. However, whatever I do the file (for example MyProj.Testing.dll) is being added in the coverage report (other assemblies I don't want in the report, such as test assemblies, are not present).

I am using the following coverlet packages in my test assemblies:

coverlet.msbuild 3.2.0

coverlet.collector 3.2.0

I am using a .runsettings file to configure coverlet.

coverlet.runsettings file:

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <RunConfiguration>
    <ResultsDirectory>./CodeCoverage/</ResultsDirectory>
  </RunConfiguration>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat Code Coverage">
        <Configuration>
          <Format>cobertura</Format>
          <ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute,TestSDKAutoGeneratedCode</ExcludeByAttribute>
          <IncludeTestAssembly>false</IncludeTestAssembly>
          <CodeCoverage>
            <ModulePaths>
              <Include>
                <ModulePath>.*\.dll$</ModulePath>
                <ModulePath>.*\.exe$</ModulePath>
              </Include>
              <Exclude>
                <ModulePath>.*Testing\.dll$</ModulePath>
              </Exclude>
            </ModulePaths>
          </CodeCoverage>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

I have looked at:

How to exclude Projects with names ending in ".Test" from my code coverage analysis in VS2012 Unit Tests

Using .runsettings to exclude assemblies from code coverage

https://learn.microsoft.com/en-gb/previous-versions/visualstudio/visual-studio-2015/test/customizing-code-coverage-analysis?view=vs-2015&redirectedfrom=MSDN&viewFallbackFrom=vs-2017

I have also tried:

Removing the Include section

Setting the Exclude/ModulePath to: .*Testing.*

Using Sources/Exclude/Source instead of ModulePath

I have been trying to do this seemingly trivial thing for hours but am now out of ideas. Any help would be appreciated.


来源: stackexchange

问:
Python Flask RestX - file path issue in route
I am trying to get the path of a file name in my flask_restx api.
As per documentation, I should just use 'path:' to accept the file path with '/' however, it doesn't work for me.

Here is the code.

```<code>@api.route('/FTP_receive/src=<src>/dest=<path:dest>', methods=["POST"])
@api.response(200, 'FTP is good and tried.')
@api.response(404, 'FTP is not good.')
@api.response(500, 'Internal Server error. Pls contact #ABC Team.')
class FTP_receive(Resource):
    def post(self,src,dest):
        src=src.upper().strip()
        #Encode the / character in the dest parameter
        #dest=urllib.parse.quote(dest)
        dest=dest.strip()

        # Rest of my code
        # bla bla bla

        logger.info('src={}'.format(src))
        logger.info('dest={}'.format(dest))
        logger.info('reg={}'.format(reg))

        respTxt={"Status":stat,
                 "rc":rc,
                 "linux rc": lrc,
                 "Out Message": outMsg,
                 "Err Message": errMsg
                 }
        return make_response(jsonify(respTxt))
</code>```

If I do not give a path with out '/' it hits the api with out a problem.
But if there is a '/' it goes wrong.

Curl is this way

```<code>curl -X 'POST' \
  'https://ch1dr1001001.abc.com/api/v1/FTP_receive/src=TSHR/dest=%2Fopt' \
  -H 'accept: application/json' \
  -d ''
</code>```

and Request URL becoming this

```<code>https://ch1dr1001001.abc.com/api/v1/FTP_receive/src=TSHR/dest=%2Fopt
</code>```

And I get 404 not found error.

```<code>!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /api/v1/FTP_receive/src=TSHR/dest=/opt was not found on this server.</p>
</body></html>
</code>```

What could I be doing wrong here ?
Or how could I pass a linux file path to the api endpoint ?
Or will it not work with flask_restx ?

ContentLicense: CC BY-SA 4.0

Body:
I am trying to get the path of a file name in my flask_restx api.
As per documentation, I should just use 'path:' to accept the file path with '/' however, it doesn't work for me.

Here is the code.

@api.route('/FTP_receive/src=<src>/dest=<path:dest>', methods=["POST"])
@api.response(200, 'FTP is good and tried.')
@api.response(404, 'FTP is not good.')
@api.response(500, 'Internal Server error. Pls contact #ABC Team.')
class FTP_receive(Resource):
    def post(self,src,dest):
        src=src.upper().strip()
        #Encode the / character in the dest parameter
        #dest=urllib.parse.quote(dest)
        dest=dest.strip()

        # Rest of my code
        # bla bla bla

        logger.info('src={}'.format(src))
        logger.info('dest={}'.format(dest))
        logger.info('reg={}'.format(reg))

        respTxt={"Status":stat,
                 "rc":rc,
                 "linux rc": lrc,
                 "Out Message": outMsg,
                 "Err Message": errMsg
                 }
        return make_response(jsonify(respTxt))

If I do not give a path with out '/' it hits the api with out a problem.
But if there is a '/' it goes wrong.

Curl is this way

curl -X 'POST' \
  'https://ch1dr1001001.abc.com/api/v1/FTP_receive/src=TSHR/dest=%2Fopt' \
  -H 'accept: application/json' \
  -d ''

and Request URL becoming this

https://ch1dr1001001.abc.com/api/v1/FTP_receive/src=TSHR/dest=%2Fopt

And I get 404 not found error.

!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<title>404 Not Found</title>

Not Found

The requested URL /api/v1/FTP_receive/src=TSHR/dest=/opt was not found on this server.

What could I be doing wrong here ?
Or how could I pass a linux file path to the api endpoint ?
Or will it not work with flask_restx ?


问:
How can I access elements within a shadow-DOM and/or iframe?
I am currently trying to access an href-link through selenium Python. I haven't been able to access the  tag, nor the <aza-subpage-fixed-footer> to be honest. I believe that these elements are within a shadow-DOM or a iframe, but I don't know how to reach them.

HTML-code:
HTML-CODE

I have tried accessing the <aza-subpage-fixed-footer> through the normal .find_element(By.TAG_NAME, "aza-subpage-fixed-footer". It only returned the following error-code:

Exception has occurred: NoSuchElementException


问:
Cannot access interface which is a supertype of another interface error only for Java not for Kotlin
I have two libraries, one depending upon the other.

Lib 1 - Lib1.java:

```<code>package com.example.lib1;

public interface Lib1 {
}
</code>```

Lib 2 - Lib2.java with dependency implementation "com.example:lib1:1.0.0"

```<code>package com.example.lib2;

import com.example.lib1.Lib1;

public interface Lib2 extends Lib1 {
    String hello = "Hello";
}
</code>```

Then have an app using Lib 2. Here this Java class compiles fine

```<code>package com.example.libtest;

import com.example.lib2.Lib2;

public class TestJava {
    public String hello = Lib2.hello;
}
</code>```

But with the kotlin class I get an error

```<code>package com.example.libtest

import com.example.lib2.Lib2

fun test() {
    val x = Lib2.hello; <-- error here
}
</code>```

Cannot access 'com.example.lib1.Lib1' which is a supertype of 'com.example.lib2.Lib2'. Check your module classpath for missing or conflicting dependencies.

If I use api instead of implementation in lib2 gradle file, the Kotlin file compiles too.

Two questions:

I understand api exposes transitive dependencies but when implementation is used why Java class compiles fine while Kotlin errors out?

Should api be needed here at all? The library lib1 should be hidden from the app anyway?

I am using Java 11, AGP 7.3.1, Gradle 7.4. Kotlin (only used in the app - 1.7.20).

Body:
I have two libraries, one depending upon the other.

Lib 1 - Lib1.java:

package com.example.lib1;

public interface Lib1 {
}

Lib 2 - Lib2.java with dependency implementation "com.example:lib1:1.0.0"

package com.example.lib2;

import com.example.lib1.Lib1;

public interface Lib2 extends Lib1 {
    String hello = "Hello";
}

Then have an app using Lib 2. Here this Java class compiles fine

package com.example.libtest;

import com.example.lib2.Lib2;

public class TestJava {
    public String hello = Lib2.hello;
}

But with the kotlin class I get an error

package com.example.libtest

import com.example.lib2.Lib2

fun test() {
    val x = Lib2.hello; <-- error here
}

Cannot access 'com.example.lib1.Lib1' which is a supertype of 'com.example.lib2.Lib2'. Check your module classpath for missing or conflicting dependencies.

If I use api instead of implementation in lib2 gradle file, the Kotlin file compiles too.

Two questions:

I understand api exposes transitive dependencies but when implementation is used why Java class compiles fine while Kotlin errors out?

Should api be needed here at all? The library lib1 should be hidden from the app anyway?

I am using Java 11, AGP 7.3.1, Gradle 7.4. Kotlin (only used in the app - 1.7.20).


问:
py2neo run call gds.graph.drop
enter image description here

When I run cypher 'call gds.graph.drop'
it will raise py2neo.errors.ProtocolError: Cannot decode response content as JSON
Are you meet this error?

Title: py2neo run call gds.graph.drop


问:
I have a problem with sqlite3 in Centos 7

'SQLite 3.9.0 or later is required (found %s).' % Database.sqlite_version
django.core.exceptions.ImproperlyConfigured: SQLite 3.9.0 or later is required (found 3.7.17).

^C[root@localhost Backend]sqlite3 --version
3.40.0 2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318
[root@localhost Backend]#
```

I have this error with sqlite3 versions, i try to remove the sqlite package but i can't, i install the version that can be seen, but still it doesn't work.

Body:
'SQLite 3.9.0 or later is required (found %s).' % Database.sqlite_version
django.core.exceptions.ImproperlyConfigured: SQLite 3.9.0 or later is required (found 3.7.17).

^C[root@localhost Backend]sqlite3 --version
3.40.0 2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318
[root@localhost Backend]#

I have this error with sqlite3 versions, i try to remove the sqlite package but i can't, i install the version that can be seen, but still it doesn't work.


问:
How to avoid printing the null value in the search methode
I am making a method in which I compare 2 values and if they are equal I store the different results in an array, what happens is that the null values are printed, then I would like to know how I can replace those null values with blanks or directly delete them, I would like to know how I can replace those null values with blanks or directly delete them.

```<code>    public String Search(String type) {
        String[] animalTypes;
        animalTypes = new String[50];
        for (int i = 0; i < animals.length; i++) {
            if (animals[i] != null) {
                while (animals[i].getClassification().equalsIgnoreCase(type)) {
                    animalTypes[i] = animals[i].getName();
                    break;
                }
            }
        }

            String printAnimalTypes = Arrays.toString(animalTypes);
            return printAnimalTypes;
    }
</code>```

The idea would be that at the moment of storing the array it would ask if it was null and if so it would not store it so that at the moment of printing it would not print it.

Body:
I am making a method in which I compare 2 values and if they are equal I store the different results in an array, what happens is that the null values are printed, then I would like to know how I can replace those null values with blanks or directly delete them, I would like to know how I can replace those null values with blanks or directly delete them.

    public String Search(String type) {
        String[] animalTypes;
        animalTypes = new String[50];
        for (int i = 0; i < animals.length; i++) {
            if (animals[i] != null) {
                while (animals[i].getClassification().equalsIgnoreCase(type)) {
                    animalTypes[i] = animals[i].getName();
                    break;
                }
            }
        }

            String printAnimalTypes = Arrays.toString(animalTypes);
            return printAnimalTypes;
    }

The idea would be that at the moment of storing the array it would ask if it was null and if so it would not store it so that at the moment of printing it would not print it.


问:
setting all of the timezone using python
is there anyway to set pc's timezone using by python?
like tzutil /s 'timezone name' in cmd.

i'm using os module, but it only shows result but not really be executed.

```<code>import os

os.system('cd tzutil /s Central America Standard Time')
</code>```

Body:
is there anyway to set pc's timezone using by python?
like tzutil /s 'timezone name' in cmd.

i'm using os module, but it only shows result but not really be executed.

import os

os.system('cd tzutil /s Central America Standard Time')


问:
How to make search view like google docs, there click on actionBar open a new window and result showing there?
I want to make a search window, like google docs. there is click actionbar to open a new window and type something to showing result there. Please look at this image

I have room database, there lot of data it is showing in recyclerView
I want to make a search interface like google docs. if i click any button/searchButtn to show a new window for search and type something to show result from database using recyclerView


问:
How can I add an Android persistent searchView?
I'm trying to add a persistent search view to my Android app, but all I find as a solution is to use it in the action menu.
I'm not using an action menu and I want to implement it only for a searchView, is it possible?

Example from my application


问:
Close DatePicker onChange of binding but only when user has stopped interacting
I have a Custom DatePicker I created for optional dates on my App, hiding under a flag when you tap a TextField. It's supposed to dismiss the Picker when a date is selected, but currently it's dismissing after modifying any part of the date (year, month, or day).

It's supposed to dismiss after you select a date in the calendar too, but the way it's working right now it either dismisses after one event or it doesn't dismiss at all.

I'm currently trying with onChange giving it an ID every time it changes, but It's currently only dismissing the month/year part and not the calendar when selecting a new one.

This is my code (Xcode Version 14.1 (14B47b)):

```<code>    @State private var showPicker: Bool = false
    @State private var pickerId: Int = 0

    private var dateWrapper: Binding<Date> {
        Binding(
            get: {
                date ?? Date.now
            },
            set: { newValue in
                date = newValue
            }
        )
    }

        if showPicker {
            Divider()

            HStack {
                Spacer()

                DatePicker(
                    selection: dateWrapper,
                    in: (rangeStartDate ?? dateWrapper.wrappedValue)...,
                    displayedComponents: [.date],
                    label: {}
                )
                .id(pickerId)
                .labelsHidden()
                .datePickerStyle(.graphical)
                .accentColor(.theme.accent)
                .onChange(of: date) { _ in
                    pickerId += 1
                    showPicker = false // this dismisses Picker after modifying anything
                }

                Spacer()
            }
        }
</code>```

I have browsed through many answers and most of them use onChange, which is why I tried it, but the result I'm looking for is dismissing the Picker after selecting a month, a year, and a day.
The same behavior happens when trying WheelPickerStyle or CompactPickerStyle.

Is there a way to dismiss to trigger only after a certain number of conditions have been met? Say a year, a month, and a day have been selected.

I tried adding onTapGesture but the app just crashed.

Body:
I have a Custom DatePicker I created for optional dates on my App, hiding under a flag when you tap a TextField. It's supposed to dismiss the Picker when a date is selected, but currently it's dismissing after modifying any part of the date (year, month, or day).

It's supposed to dismiss after you select a date in the calendar too, but the way it's working right now it either dismisses after one event or it doesn't dismiss at all.

I'm currently trying with onChange giving it an ID every time it changes, but It's currently only dismissing the month/year part and not the calendar when selecting a new one.

This is my code (Xcode Version 14.1 (14B47b)):

    @State private var showPicker: Bool = false
    @State private var pickerId: Int = 0

    private var dateWrapper: Binding<Date> {
        Binding(
            get: {
                date ?? Date.now
            },
            set: { newValue in
                date = newValue
            }
        )
    }

        if showPicker {
            Divider()

            HStack {
                Spacer()

                DatePicker(
                    selection: dateWrapper,
                    in: (rangeStartDate ?? dateWrapper.wrappedValue)...,
                    displayedComponents: [.date],
                    label: {}
                )
                .id(pickerId)
                .labelsHidden()
                .datePickerStyle(.graphical)
                .accentColor(.theme.accent)
                .onChange(of: date) { _ in
                    pickerId += 1
                    showPicker = false // this dismisses Picker after modifying anything
                }

                Spacer()
            }
        }

I have browsed through many answers and most of them use onChange, which is why I tried it, but the result I'm looking for is dismissing the Picker after selecting a month, a year, and a day.
The same behavior happens when trying WheelPickerStyle or CompactPickerStyle.

Is there a way to dismiss to trigger only after a certain number of conditions have been met? Say a year, a month, and a day have been selected.

I tried adding onTapGesture but the app just crashed.


问:
Streaming Twitter Data with Flume - Twitter4J error
I am streaming twitter data using Flume and but getting an error regarding the twitter4j Jar File.

```<code>01:42:03.075 [Twitter Stream consumer /  [1][Establishing connection]] ERROR org.apache.flume.source.twitter.TwitterSource - Exception while streaming tweets
twitter4j.TwitterException: https://stream.twitter.com/1.1/statuses/sample.json?stall_warnings=true
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:185) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientBase.request(HttpClientBase.java:57) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientBase.get(HttpClientBase.java:75) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.TwitterStreamImpl.getSampleStream(TwitterStreamImpl.java:201) ~[twitter4j-stream-4.0.7.jar:4.0.7]
    at twitter4j.TwitterStreamImpl$4.getStream(TwitterStreamImpl.java:170) ~[twitter4j-stream-4.0.7.jar:4.0.7]
    at twitter4j.TwitterStreamImpl$TwitterStreamConsumer.run(TwitterStreamImpl.java:570) ~[twitter4j-stream-4.0.7.jar:4.0.7]
Caused by: java.io.FileNotFoundException: https://stream.twitter.com/1.1/statuses/sample.json?stall_warnings=true
    at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?]
    at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:2048) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:2043) ~[?:?]
    at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:2042) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1609) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589) ~[?:?]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224) ~[?:?]
    at twitter4j.HttpResponseImpl.<init>(HttpResponseImpl.java:50) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:149) ~[twitter4j-core-4.0.7.jar:4.0.7]
    ... 5 more
Caused by: java.io.FileNotFoundException: https://stream.twitter.com/1.1/statuses/sample.json?stall_warnings=true
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1993) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589) ~[?:?]
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529) ~[?:?]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:308) ~[?:?]
    at twitter4j.HttpResponseImpl.<init>(HttpResponseImpl.java:35) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:149) ~[twitter4j-core-4.0.7.jar:4.0.7]
    ... 5 more
</code>```

Here is my flume_project.conf

```<code># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

# The configuration file needs to define the sources,
# the channels and the sinks.
# Sources, channels and sinks are defined per agent,
# in this case called 'TwitterAgent'

TwitterAgent.sources = Twitter
TwitterAgent.channels = MemChannel
TwitterAgent.sinks = kafkasink #filesink

#TwitterAgent.sources.Twitter.type = com.apache.flume.source.twitter.TwitterSource
TwitterAgent.sources.Twitter.type = org.apache.flume.source.twitter.TwitterSource
TwitterAgent.sources.Twitter.channels = MemChannel
TwitterAgent.sources.Twitter.keywords = AWS Marketplace, GCP Marketplace, Azure Marketplace

#filesink
# TwitterAgent.sinks.filesink.type = file_roll
# TwitterAgent.sinks.filesink.channel = MemChannel
# TwitterAgent.sinks.filesink.sink.directory = /docker_share/twitter_sink
# TwitterAgent.sinks.filesink.sink.pathManager.extension = out
# TwitterAgent.sinks.filesink.sink.pathManager.prefix = project
# TwitterAgent.sinks.filesink.sink.rollInterval = 3600

#kafkasink
TwitterAgent.sinks.kafkasink.type = org.apache.flume.sink.kafka.KafkaSink
TwitterAgent.sinks.kafkasink.topic = fp_mc
TwitterAgent.sinks.kafkasink.brokerList = fp_mc-kafka-1:9092
TwitterAgent.sinks.kafkasink.channel = MemChannel
TwitterAgent.sinks.kafkasink.batchSize = 1
# add header and text to sink
# TwitterAgent.sinks.kafkasink.sink.serializer = header_and_text
# TwitterAgent.sinks.kafkasink.sink.serializer.appendNewline = true

TwitterAgent.channels.MemChannel.type = memory
TwitterAgent.channels.MemChannel.capacity = 10000
TwitterAgent.channels.MemChannel.transactionCapacity = 1000

TwitterAgent.sources.Twitter.consumerKey = xxxx
TwitterAgent.sources.Twitter.consumerSecret = xxxx
TwitterAgent.sources.Twitter.accessToken = xxxx
TwitterAgent.sources.Twitter.accessTokenSecret = xxxx
</code>```

I am using apache-flume-1.11.0

Everything is running in Docker

```<code># 2. create topic using kafka container
docker exec -i fp_mc-kafka-1 kafka-topics.sh \
    --create \
    --zookeeper zookeeper:2181 \
    --replication-factor 2 \
    --partitions 2 \
    --topic fp_mc

</code>```

including flume in a jdk container.
I use the following commands to start flume in the jdk container to collect the twitter data

```<code>docker exec -it fp_mc-jdk-1 bash

docker_share/apache-flume-1.11.0-bin/bin/flume-ng agent \
    -c /docker_share/conf \
    -f /docker_share/conf/flume_project.conf \
    -n TwitterAgent \
    -C /docker_share/apache-flume-1.11.0-bin/lib \
    -Dflume.root.logger=DEBUG,console
</code>```

Twitter_project.yaml

version: '3.5'

networks:
  twitter-demo:
    name: twitter-demo-net
    driver: bridge

services:
  zookeeper:
    image: zookeeper
    ports:
      - "2181:2181"
    networks:
      - twitter-demo

  kafka:
    image: wurstmeister/kafka
    environment:
      # KAFKA_BROKER_ID: 1
      # (Hack for Mac)use this if you want to have docker host node to be used as broadcast ip
      HOSTNAME_COMMAND: "/sbin/ip route|awk '/src/ { print $$NF }'"
      # Use below for Linux
      # HOSTNAME_COMMAND: "ip route get 1.2.3.4 | awk '{print $$7}'"
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_LISTENERS: PLAINTEXT://kafka:9092
      # KAFKA_CREATE_TOPICS: "varnish_raw_logs:10:1"
    depends_on:
      - zookeeper
    ports:
      - 9092
    networks:
      - twitter-demo

  #jdk container is used to run flume
  jdk:
    image: openjdk
    depends_on:
        - kafka
        - zookeeper
    volumes:
        - "./docker_share:/docker_share"
    command: 'tail -F anything'
    networks:
        - twitter-demo

#  elk container is used to run logstash, elasticsearch, and kibana
#  elk:
#    image: sebp/elk
#    volumes:
#      - "./docker_share:/docker_share"
#    depends_on:
#      - kafka
#      - zookeeper
#    ports:
#    - "5601:5601"
#    - "9200:9200"
#    - "5044:5044"
#    networks:
#      - twitter-demo

  elasticsearch:
    container_name: elasticsearch
    environment:
      - discovery.type=single-node
      - ELASTIC_USERNAME=elastic
      - ELASTIC_PASSWORD=elastic

    image: elasticsearch:8.5.2
    depends_on:
      - kafka
      - zookeeper
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - "./docker_share:/docker_share"
    networks:
      - twitter-demo

  logstash:
    image: logstash:8.5.2
    volumes:
      - "./docker_share:/docker_share"
    ports:
      - "5044:5044"
    networks:
      - twitter-demo
    depends_on:
      - elasticsearch
    links:
      - elasticsearch

  kibana:
    image: kibana:8.5.2
    volumes:
      - "./docker_share:/docker_share"
    ports:
      - "5601:5601"
    networks:
      - twitter-demo
    depends_on:
      - elasticsearch
    links:
      - elasticsearch
```
<p>I am trying to stream twitter data using flume. I would expect to run the following command to stat kaka consumer message viewer and see tweets</p>
```docker exec -i fp_mc-kafka-2 kafka-console-consumer.sh \
    --bootstrap-server fp_mc-kafka-1:9092 \
    --topic fp_mc
```

Instead, I receive nothing due to the twitter4j error

Body:
I am streaming twitter data using Flume and but getting an error regarding the twitter4j Jar File.

01:42:03.075 [Twitter Stream consumer /  [1][Establishing connection]] ERROR org.apache.flume.source.twitter.TwitterSource - Exception while streaming tweets
twitter4j.TwitterException: https://stream.twitter.com/1.1/statuses/sample.json?stall_warnings=true
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:185) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientBase.request(HttpClientBase.java:57) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientBase.get(HttpClientBase.java:75) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.TwitterStreamImpl.getSampleStream(TwitterStreamImpl.java:201) ~[twitter4j-stream-4.0.7.jar:4.0.7]
    at twitter4j.TwitterStreamImpl$4.getStream(TwitterStreamImpl.java:170) ~[twitter4j-stream-4.0.7.jar:4.0.7]
    at twitter4j.TwitterStreamImpl$TwitterStreamConsumer.run(TwitterStreamImpl.java:570) ~[twitter4j-stream-4.0.7.jar:4.0.7]
Caused by: java.io.FileNotFoundException: https://stream.twitter.com/1.1/statuses/sample.json?stall_warnings=true
    at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?]
    at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:2048) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:2043) ~[?:?]
    at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:2042) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1609) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589) ~[?:?]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224) ~[?:?]
    at twitter4j.HttpResponseImpl.<init>(HttpResponseImpl.java:50) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:149) ~[twitter4j-core-4.0.7.jar:4.0.7]
    ... 5 more
Caused by: java.io.FileNotFoundException: https://stream.twitter.com/1.1/statuses/sample.json?stall_warnings=true
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1993) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589) ~[?:?]
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529) ~[?:?]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:308) ~[?:?]
    at twitter4j.HttpResponseImpl.<init>(HttpResponseImpl.java:35) ~[twitter4j-core-4.0.7.jar:4.0.7]
    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:149) ~[twitter4j-core-4.0.7.jar:4.0.7]
    ... 5 more

Here is my flume_project.conf

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

# The configuration file needs to define the sources,
# the channels and the sinks.
# Sources, channels and sinks are defined per agent,
# in this case called 'TwitterAgent'

TwitterAgent.sources = Twitter
TwitterAgent.channels = MemChannel
TwitterAgent.sinks = kafkasink #filesink

#TwitterAgent.sources.Twitter.type = com.apache.flume.source.twitter.TwitterSource
TwitterAgent.sources.Twitter.type = org.apache.flume.source.twitter.TwitterSource
TwitterAgent.sources.Twitter.channels = MemChannel
TwitterAgent.sources.Twitter.keywords = AWS Marketplace, GCP Marketplace, Azure Marketplace

#filesink
# TwitterAgent.sinks.filesink.type = file_roll
# TwitterAgent.sinks.filesink.channel = MemChannel
# TwitterAgent.sinks.filesink.sink.directory = /docker_share/twitter_sink
# TwitterAgent.sinks.filesink.sink.pathManager.extension = out
# TwitterAgent.sinks.filesink.sink.pathManager.prefix = project
# TwitterAgent.sinks.filesink.sink.rollInterval = 3600

#kafkasink
TwitterAgent.sinks.kafkasink.type = org.apache.flume.sink.kafka.KafkaSink
TwitterAgent.sinks.kafkasink.topic = fp_mc
TwitterAgent.sinks.kafkasink.brokerList = fp_mc-kafka-1:9092
TwitterAgent.sinks.kafkasink.channel = MemChannel
TwitterAgent.sinks.kafkasink.batchSize = 1
# add header and text to sink
# TwitterAgent.sinks.kafkasink.sink.serializer = header_and_text
# TwitterAgent.sinks.kafkasink.sink.serializer.appendNewline = true

TwitterAgent.channels.MemChannel.type = memory
TwitterAgent.channels.MemChannel.capacity = 10000
TwitterAgent.channels.MemChannel.transactionCapacity = 1000

TwitterAgent.sources.Twitter.consumerKey = xxxx
TwitterAgent.sources.Twitter.consumerSecret = xxxx
TwitterAgent.sources.Twitter.accessToken = xxxx
TwitterAgent.sources.Twitter.accessTokenSecret = xxxx

I am using apache-flume-1.11.0

Everything is running in Docker

# 2. create topic using kafka container
docker exec -i fp_mc-kafka-1 kafka-topics.sh \
    --create \
    --zookeeper zookeeper:2181 \
    --replication-factor 2 \
    --partitions 2 \
    --topic fp_mc

including flume in a jdk container.
I use the following commands to start flume in the jdk container to collect the twitter data

docker exec -it fp_mc-jdk-1 bash

docker_share/apache-flume-1.11.0-bin/bin/flume-ng agent \
    -c /docker_share/conf \
    -f /docker_share/conf/flume_project.conf \
    -n TwitterAgent \
    -C /docker_share/apache-flume-1.11.0-bin/lib \
    -Dflume.root.logger=DEBUG,console

Twitter_project.yaml

version: '3.5'

networks:
  twitter-demo:
    name: twitter-demo-net
    driver: bridge

services:
  zookeeper:
    image: zookeeper
    ports:
      - "2181:2181"
    networks:
      - twitter-demo

  kafka:
    image: wurstmeister/kafka
    environment:
      # KAFKA_BROKER_ID: 1
      # (Hack for Mac)use this if you want to have docker host node to be used as broadcast ip
      HOSTNAME_COMMAND: "/sbin/ip route|awk '/src/ { print $$NF }'"
      # Use below for Linux
      # HOSTNAME_COMMAND: "ip route get 1.2.3.4 | awk '{print $$7}'"
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_LISTENERS: PLAINTEXT://kafka:9092
      # KAFKA_CREATE_TOPICS: "varnish_raw_logs:10:1"
    depends_on:
      - zookeeper
    ports:
      - 9092
    networks:
      - twitter-demo

  #jdk container is used to run flume
  jdk:
    image: openjdk
    depends_on:
        - kafka
        - zookeeper
    volumes:
        - "./docker_share:/docker_share"
    command: 'tail -F anything'
    networks:
        - twitter-demo

#  elk container is used to run logstash, elasticsearch, and kibana
#  elk:
#    image: sebp/elk
#    volumes:
#      - "./docker_share:/docker_share"
#    depends_on:
#      - kafka
#      - zookeeper
#    ports:
#    - "5601:5601"
#    - "9200:9200"
#    - "5044:5044"
#    networks:
#      - twitter-demo

  elasticsearch:
    container_name: elasticsearch
    environment:
      - discovery.type=single-node
      - ELASTIC_USERNAME=elastic
      - ELASTIC_PASSWORD=elastic

    image: elasticsearch:8.5.2
    depends_on:
      - kafka
      - zookeeper
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - "./docker_share:/docker_share"
    networks:
      - twitter-demo

  logstash:
    image: logstash:8.5.2
    volumes:
      - "./docker_share:/docker_share"
    ports:
      - "5044:5044"
    networks:
      - twitter-demo
    depends_on:
      - elasticsearch
    links:
      - elasticsearch

  kibana:
    image: kibana:8.5.2
    volumes:
      - "./docker_share:/docker_share"
    ports:
      - "5601:5601"
    networks:
      - twitter-demo
    depends_on:
      - elasticsearch
    links:
      - elasticsearch

I am trying to stream twitter data using flume. I would expect to run the following command to stat kaka consumer message viewer and see tweets

docker exec -i fp_mc-kafka-2 kafka-console-consumer.sh \
    --bootstrap-server fp_mc-kafka-1:9092 \
    --topic fp_mc

Instead, I receive nothing due to the twitter4j error


问:
Django: is there a way to add users to a ManyToManyField of a model each for a certain amount of time?
i have a website that has video courses for my students that they can buy and use,

```<code>title = ,,,
price = ,,,
buyer = models.ManyToManyField(User, blank=True, related_name='my_attendance_courses')
</code>```

i want this field to also have expiration date for each user it holds, so my students only have the course for 1 month after they bought it

is there a way i can to this?

Body:
i have a website that has video courses for my students that they can buy and use,

title = ,,,
price = ,,,
buyer = models.ManyToManyField(User, blank=True, related_name='my_attendance_courses')

i want this field to also have expiration date for each user it holds, so my students only have the course for 1 month after they bought it

is there a way i can to this?


问:
Scheduling of available and unavailable rooms - PHP/Mysql
I have the following question, how can I prevent a room from being scheduled if the time is already registered in the database?

Example:

Room 1 - check-in 12/20/2022 1:00 pm, check-out 12/20/2022 3:00 pm.

I need this 2 hour break not to be available for scheduling.

I have a table 'scheduling' with the following columns: id, startDate (DATE), startTime (TIME), endDate (DATE), endTime (TIME).

I can't create any logic to block this time interval, and I'm also not sure if this structure is correct in the database...


问:
SciKit Learn Random Forest Data Shape
New to this.

My data is something like each row is an hour. In each hour I have a few elements related to that hour. I want to learn/predict based on multiple hours at once and probability in 3 categorie

If I pass 3 hours, and each hour has 5 elements. Would I flatten this to (num sequences, 15) and then I have (num sequences, 3) for y/labels?

15 because 3 hours * 5 elements.

Or am I supposed to pass the data in differently?

I had something similiar going with an LSTM but was curious how random Forest would do in comparison.

Tried the usual way with the LSTM and got a dimension error. The error went away when I flattened.

Thanks.

Title: SciKit Learn Random Forest Data Shape


问:
How to create pagination with dots and pure html in webforms c#
I'm trying to create pagination but I'm unsure of how else to proceed with the dots.
I currently have something like this:

```<code>Prev | 1 2 3 4 5 ... 46 47 48 49 50 | Next
</code>```

Here's my code for that

```<code>  public string CreatePagingLinks(int currentPage, int matches, string baseURL, int rowsPerPage)
    {
        string pagingInfo= "";

        int rangeFrom = rowsPerPage * (currentPage - 1) + 1;
        int rangeTo = rangeFrom + rowsPerPage - 1;
        int maxpages = (matches / rowsPerPage) + 1;
        int pagesShown = 5;

        if (currentPage == 1)
        {
            pagingInfo += "Prev | ";
        }
        else
        {
            pagingInfo += "<a href=\"" + baseURL + "page=" + (currentPage - 1).ToString() + "\">Prev</a> | ";
        }

        if(currentPage > 3)
        {
            //pagingInfo += "<a href=\"" + baseURL + "page=" + (pagesShown + 1 ).ToString() + "\">...</a> "
            pagingInfo += "...";
        }

   for (int k = 1; k <= pagesShown+1; k++)
           {
               if(k == pagesShown + 1)
               {
                   pagingInfo += "<a href=\"" + baseURL + "page=" + (pagesShown + 1 ).ToString() + "\">...</a> ";
               }
               else
               {
                   pagingInfo += " <a href=\"" + baseURL + "page=" + k.ToString() + "\">" + k.ToString() + "</a> ";
               }

           }

        for (int k = maxpages-(pagesShown-1); k <= maxpages; k++)
        {
            pagingInfo += " <a href=\"" + baseURL + "page=" + k.ToString() + "\">" + k.ToString() + "</a> ";
        }

        if (currentPage == maxpages)
        {
            pagingInfo += " | Next";
        }
        else
        {
            pagingInfo += " | <a href=\"" + baseURL + "page=" +  (currentPage + 1).ToString() + "\">Next</a>";
        }

        return pagingInfo;
    }
</code>```

Which is something along the lines of what I want to do but I'm thinking that once the user wants page 6, it should look like this instead:

```<code>page 1: 1 2 3... 48 49 50
page 2: 1 2 3 ... 48 49 50
page 3: 1... 3 4 5... 48 49 50
</code>```

or something like that concept.

I guess what I'm struggling with is how to change the numbers when the number approaches the end of the shown numbers...

Body:
I'm trying to create pagination but I'm unsure of how else to proceed with the dots.
I currently have something like this:

Prev | 1 2 3 4 5 ... 46 47 48 49 50 | Next

Here's my code for that

  public string CreatePagingLinks(int currentPage, int matches, string baseURL, int rowsPerPage)
    {
        string pagingInfo= "";

        int rangeFrom = rowsPerPage * (currentPage - 1) + 1;
        int rangeTo = rangeFrom + rowsPerPage - 1;
        int maxpages = (matches / rowsPerPage) + 1;
        int pagesShown = 5;

        if (currentPage == 1)
        {
            pagingInfo += "Prev | ";
        }
        else
        {
            pagingInfo += "Prev | ";
        }

        if(currentPage > 3)
        {
            //pagingInfo += "... "
            pagingInfo += "...";
        }

   for (int k = 1; k <= pagesShown+1; k++)
           {
               if(k == pagesShown + 1)
               {
                   pagingInfo += "... ";
               }
               else
               {
                   pagingInfo += " " + k.ToString() + " ";
               }

           }

        for (int k = maxpages-(pagesShown-1); k <= maxpages; k++)
        {
            pagingInfo += " " + k.ToString() + " ";
        }

        if (currentPage == maxpages)
        {
            pagingInfo += " | Next";
        }
        else
        {
            pagingInfo += " | Next";
        }

        return pagingInfo;
    }

Which is something along the lines of what I want to do but I'm thinking that once the user wants page 6, it should look like this instead:

page 1: 1 2 3... 48 49 50
page 2: 1 2 3 ... 48 49 50
page 3: 1... 3 4 5... 48 49 50

or something like that concept.

I guess what I'm struggling with is how to change the numbers when the number approaches the end of the shown numbers...


问:
How to update sum during for loop in Java?
Got stuck at this exercise.
The goal is to let the user input the type and number of coins added to the program, and count the total coins and amount of money the user has.

update:
I think I'm almost there, (sorted out the amount of money!) but my problem is that the total coins adds up badly after the second loop. (the sum is incorrect)

```<code>//硬貨の種類の合計
        int kindSum = 0;
        //硬貨の枚数の合計
        int amountSum = 0;

        //質問を10回繰り返し
        for (int i = 1; i <= 10; i++) {
            //硬貨の種類の入力
            System.out.println(i + "回目。硬貨の種類を入力してください。");
            int kindInput = inputScanner.nextInt();
            //硬貨の枚数の入力
            System.out.println(i + "回目。硬貨の枚数を入力してください。");
            int amountInput = inputScanner.nextInt();

            kindSum = kindInput + myMoney.getAmount() + myMoney.addCoins(kindInput, amountInput);
            amountSum = amountInput + totalCoin + myMoney.getCount(kindInput);

            //足した合計を表示する(1回ずつ)
            System.out.println("硬貨の総枚数は" + kindSum +
                    "枚、総額は" + amountSum);
        }
</code>```

I reckon I should be using something like sum += sum + i but when I use something like kindSum += + kindInput + myMoney.getAmount(); the total just doubles up.

Would appreciate any advice, many thanks in advance.

The full code, if anyone is wondering-

```<code>class ManageCoin {

    //硬貨の種類
    int yen500 = 0;
    int yen100 = 0;
    int yen50 = 0;
    int yen10 = 0;

    //• addCoinsメソッドで硬貨を増やしたり減らしたりする
    //メソッドの引数は硬貨の種類と枚数
    public int addCoins(int kind, int count) {
        //種類を絞っていく
        switch (kind) {
        case 500:           //500出てきたら500円の数を増やす
            yen500 += count;
            break;
        case 100:
            yen100 += count;
            break;
        case 50:
            yen50 += count;
            break;
        case 10:
            yen10 += count;
            break;
        }
        return 0; //何もなかったら最初に戻る
    }

    //getCountメソッドで硬貨が何枚あるかを取得する
    //メソッドの引数は硬貨の種類
    public int getCount(int kind) {
        switch(kind) {
        case 500:           //500出たら500円の種類を特定
            return yen500;
        case 100:
            return yen100;
        case 50:
            return yen50;
        case 10:
            return yen10;
        }
        return 0;
    }

    //getAmountメソッドで硬貨の総額を取得する
    //メソッドの引数はなし
    public int getAmount() {
        return (yen500 * 500) + (yen100 * 100) +
                (yen50 * 50) + (yen10 * 10);
    }

</code>```
```<code>ManageCoin myMoney = new ManageCoin();

        //初期値の硬貨＝財布
        myMoney.yen500 = 1;
        myMoney.yen100 = 4;
        myMoney.yen50 = 1;
        myMoney.yen10 = 4;

        //硬貨の総枚数と総額を表示する
        int totalCoin = myMoney.getCount(500) +
                myMoney.getCount(100) +
                myMoney.getCount(50) +
                myMoney.getCount(10);

        //①ユーザーに硬貨の種類と枚数を入力してもらう
        System.out.println("初期化の硬貨の総枚数は" + totalCoin +
                "枚、総額は" + myMoney.getAmount() + "円です。");

        //②入力したら硬貨の枚数と総額を表示する
        //入力を受け付ける
        Scanner inputScanner = new Scanner(System.in);
        //入力の指示
        System.out.println("500円、100円、50円、10円から、");
        System.out.println("硬貨の種類と枚数を決めて数字で10回ずつ入力してください。");
        System.out.println("硬貨の枚数を増やしたり減らしたりすることもできます。");
        System.out.println();

        //硬貨の種類の合計
        int kindSum = 0;
        //硬貨の枚数の合計
        int amountSum = 0;

        //質問を10回繰り返し
        for (int count = 1; count <= 10; count++) {

            //硬貨の種類の入力
            System.out.println(count + "回目。硬貨の種類を入力してください。");
            int kindInput = inputScanner.nextInt();
            //硬貨の枚数の入力
            System.out.println(count + "回目。硬貨の枚数を入力してください。");
            int amountInput = inputScanner.nextInt();

            kindSum = kindInput + myMoney.getAmount() + myMoney.addCoins(kindInput, amountInput);
            amountSum = amountInput + totalCoin + myMoney.getCount(kindInput);

            //足した合計を表示する(1回ずつ)
            System.out.println("硬貨の総枚数は" + amountSum +
                    "枚、総額は" + kindSum);
        }

        //③①~②を10回繰り返す
        System.out.println("硬貨の総枚数は" + amountSum +
                "枚、総額は" + kindSum);
</code>```

Body:
Got stuck at this exercise.
The goal is to let the user input the type and number of coins added to the program, and count the total coins and amount of money the user has.

update:
I think I'm almost there, (sorted out the amount of money!) but my problem is that the total coins adds up badly after the second loop. (the sum is incorrect)

//硬貨の種類の合計
        int kindSum = 0;
        //硬貨の枚数の合計
        int amountSum = 0;

        //質問を10回繰り返し
        for (int i = 1; i <= 10; i++) {
            //硬貨の種類の入力
            System.out.println(i + "回目。硬貨の種類を入力してください。");
            int kindInput = inputScanner.nextInt();
            //硬貨の枚数の入力
            System.out.println(i + "回目。硬貨の枚数を入力してください。");
            int amountInput = inputScanner.nextInt();

            kindSum = kindInput + myMoney.getAmount() + myMoney.addCoins(kindInput, amountInput);
            amountSum = amountInput + totalCoin + myMoney.getCount(kindInput);

            //足した合計を表示する(1回ずつ)
            System.out.println("硬貨の総枚数は" + kindSum +
                    "枚、総額は" + amountSum);
        }

I reckon I should be using something like sum += sum + i but when I use something like kindSum += + kindInput + myMoney.getAmount(); the total just doubles up.

Would appreciate any advice, many thanks in advance.

The full code, if anyone is wondering-

class ManageCoin {

    //硬貨の種類
    int yen500 = 0;
    int yen100 = 0;
    int yen50 = 0;
    int yen10 = 0;

    //• addCoinsメソッドで硬貨を増やしたり減らしたりする
    //メソッドの引数は硬貨の種類と枚数
    public int addCoins(int kind, int count) {
        //種類を絞っていく
        switch (kind) {
        case 500:           //500出てきたら500円の数を増やす
            yen500 += count;
            break;
        case 100:
            yen100 += count;
            break;
        case 50:
            yen50 += count;
            break;
        case 10:
            yen10 += count;
            break;
        }
        return 0; //何もなかったら最初に戻る
    }

    //getCountメソッドで硬貨が何枚あるかを取得する
    //メソッドの引数は硬貨の種類
    public int getCount(int kind) {
        switch(kind) {
        case 500:           //500出たら500円の種類を特定
            return yen500;
        case 100:
            return yen100;
        case 50:
            return yen50;
        case 10:
            return yen10;
        }
        return 0;
    }

    //getAmountメソッドで硬貨の総額を取得する
    //メソッドの引数はなし
    public int getAmount() {
        return (yen500 * 500) + (yen100 * 100) +
                (yen50 * 50) + (yen10 * 10);
    }

ManageCoin myMoney = new ManageCoin();

        //初期値の硬貨＝財布
        myMoney.yen500 = 1;
        myMoney.yen100 = 4;
        myMoney.yen50 = 1;
        myMoney.yen10 = 4;

        //硬貨の総枚数と総額を表示する
        int totalCoin = myMoney.getCount(500) +
                myMoney.getCount(100) +
                myMoney.getCount(50) +
                myMoney.getCount(10);

        //①ユーザーに硬貨の種類と枚数を入力してもらう
        System.out.println("初期化の硬貨の総枚数は" + totalCoin +
                "枚、総額は" + myMoney.getAmount() + "円です。");

        //②入力したら硬貨の枚数と総額を表示する
        //入力を受け付ける
        Scanner inputScanner = new Scanner(System.in);
        //入力の指示
        System.out.println("500円、100円、50円、10円から、");
        System.out.println("硬貨の種類と枚数を決めて数字で10回ずつ入力してください。");
        System.out.println("硬貨の枚数を増やしたり減らしたりすることもできます。");
        System.out.println();

        //硬貨の種類の合計
        int kindSum = 0;
        //硬貨の枚数の合計
        int amountSum = 0;

        //質問を10回繰り返し
        for (int count = 1; count <= 10; count++) {

            //硬貨の種類の入力
            System.out.println(count + "回目。硬貨の種類を入力してください。");
            int kindInput = inputScanner.nextInt();
            //硬貨の枚数の入力
            System.out.println(count + "回目。硬貨の枚数を入力してください。");
            int amountInput = inputScanner.nextInt();

            kindSum = kindInput + myMoney.getAmount() + myMoney.addCoins(kindInput, amountInput);
            amountSum = amountInput + totalCoin + myMoney.getCount(kindInput);

            //足した合計を表示する(1回ずつ)
            System.out.println("硬貨の総枚数は" + amountSum +
                    "枚、総額は" + kindSum);
        }

        //③①~②を10回繰り返す
        System.out.println("硬貨の総枚数は" + amountSum +
                "枚、総額は" + kindSum);


问:
python Can I assess the binary message in websockets?
So websockets I'm looking for is a chat of live-streaming.

and when I click the Messages tab, I can see Binary Messages are back and forth.

Some of these are real messages, but some of are not. I don't know what those are. Maybe status checks?

What I am wondering is, am I possible to gather these binary messages using websockets?

I'm not even sure whether this is possible. Below doesn't work.

I think this should print something when someone chats.

```<code>import websockets
import asyncio

async def access_chat():
  uri = "wss://chat-af7e4856.afreecatv.com:8001/Websocket/freesias"
  async with websockets.connect(uri, subprotocols=['chat'], ping_interval=None) as websocket:
    content = await websocket.recv()
    print(content)
</code>```

Body:
So websockets I'm looking for is a chat of live-streaming.

and when I click the Messages tab, I can see Binary Messages are back and forth.

Some of these are real messages, but some of are not. I don't know what those are. Maybe status checks?

What I am wondering is, am I possible to gather these binary messages using websockets?

I'm not even sure whether this is possible. Below doesn't work.

I think this should print something when someone chats.

import websockets
import asyncio

async def access_chat():
  uri = "wss://chat-af7e4856.afreecatv.com:8001/Websocket/freesias"
  async with websockets.connect(uri, subprotocols=['chat'], ping_interval=None) as websocket:
    content = await websocket.recv()
    print(content)


问:
What is the difference between continuous ans discrete variables in an optimization problem? Natural and real numbers?
It is a rather theoretical question to better understand some definitions.

Can descision variables in descrete optimization problems be only integers?
If I have a set of real numbers which are not only natural numbers is it a continious optimization problem?

An example of a problem:

If there is a set of variables:

animal
value

frog
0.54

cat
-9.12

duck
0.001

dog
4

snake
-300.09

is that a continious or descrete problem?

From the Wiki definition: A continuous variable is a variable whose value is obtained by measuring, i.e., one which can take on an uncountable set of values. For example, a variable over a non-empty range of the real numbers is continuous, if it can take on any value in that range. The reason is that any range of real numbers between a and b with a , b ∈ R ; a ≠ b  is uncountable. A variable is a discrete variable if and only if there exists a one-to-one correspondence between this variable and N, the set of natural numbers.

Theoretically I could say that the example is a non-empty range of real numbers between -300.09 and 4 and see it is a continuous problem. From the Wikipedia definition I understand that descrete variables must belong to a set of natural numbers, so it is not my case. Or do I undestand it wrong?


问:
capture images using IDS camera (trigger mode and non trigger mode)
I am using an IDS camera as a necessity at work. I suppose to prepare a desktop application to capture images while the live stream is happening.
somehow i could able to stream the live but i cannot caoture images. This image capturing should happen when we I apply triger and non-trigger modes acording to the work related. Is there anybody who has this kind of experience before. I am trying this from pretty long time.
please help me.</p>
```<code>class ThreadOpenCV(QThread):
    changePixmap = pyqtSignal(QImage)
    def __init__(self):
        super().__init__()
        #self.source = source
        self.killed = False
        self.grayscale = False
        self.blur = False

        self.running = True
        self.hcam = ueye.HIDS(0)
        self.ret = ueye.is_InitCamera(self.hcam, None)
        print(f"initCamera returns {self.ret}")

        # set color mode
        self.ret = ueye.is_SetColorMode(self.hcam, ueye.IS_CM_BGR8_PACKED)
        print(f"SetColorMode IS_CM_BGR8_PACKED returns {self.ret}")
        #self.ret = ueye.is_SetExternalTrigger(self.hcam,ueye.IS_SET_TRIGGER_HI_LO_SYNC)

        # set region of interest
        self.width = 1280
        self.height = 1080
        self.rect_aoi = ueye.IS_RECT()
        ##########
        self.rect_aoi.s32X = ueye.int(0)
        self.rect_aoi.s32Y = ueye.int(0)
        self.rect_aoi.s32Width = ueye.int(self.width)
        self.rect_aoi.s32Height = ueye.int(self.height)
        ueye.is_AOI(self.hcam, ueye.IS_AOI_IMAGE_SET_AOI, self.rect_aoi, ueye.sizeof(self.rect_aoi))
        print(f"AOI IS_AOI_IMAGE_SET_AOI returns {self.ret}")

        # allocate memory
        self.mem_ptr = ueye.c_mem_p()
        self.mem_id = ueye.int()
        self.bitspixel = 24 # for colormode = IS_CM_BGR8_PACKED
        ######
        self.ret = ueye.is_AllocImageMem(self.hcam, self.width, self.height, self.bitspixel,
                                    self.mem_ptr, self.mem_id)
        print(f"AllocImageMem returns {self.ret}")

        # set active memory region
        self.ret = ueye.is_SetImageMem(self.hcam, self.mem_ptr, self.mem_id)
        print(f"SetImageMem returns {self.ret}")

        # continuous capture to memory
        self.ret = ueye.is_CaptureVideo(self.hcam, ueye.IS_DONT_WAIT)
        print(f"CaptureVideo returns {self.ret}")

        # get data from camera and display
        self.lineinc = self.width * int((self.bitspixel + 7) / 8)
    def run(self):

        print('start')
        try:
            print('start1')
            while self.running:
                print('start2')
            #ret, frame = cap.read()
                frame = ueye.get_data(self.mem_ptr, self.width, self.height, self.bitspixel, self.lineinc, copy=True)
                print('start3')
                frame = np.reshape(frame, (self.height, self.width, 3))
                print('start4')
                #print(frame)
                #if ret:
                self.h, self.w, self.ch = frame.shape
                bytes_per_line = self.ch * self.w   # PEP8: `lower_case_names` for variables
                image = QImage(frame.data, self.w, self.h, bytes_per_line, QImage.Format_RGB888)
                print('start5')
                self.image = image.scaled(1280, 1080, Qt.KeepAspectRatio)
                self.changePixmap.emit(self.image)
            #cap.release()
            #print('stop')
        except Exception as e:
            print('Exception: {}'.format(e))
            print('error{}'.format(sys.exc_info()[-1].tb_lineno), type(e).__name__,)

    def kill(self):
        self.running = False
</code>```

Body:
I am using an IDS camera as a necessity at work. I suppose to prepare a desktop application to capture images while the live stream is happening.
somehow i could able to stream the live but i cannot caoture images. This image capturing should happen when we I apply triger and non-trigger modes acording to the work related. Is there anybody who has this kind of experience before. I am trying this from pretty long time.
please help me.

class ThreadOpenCV(QThread):
    changePixmap = pyqtSignal(QImage)
    def __init__(self):
        super().__init__()
        #self.source = source
        self.killed = False
        self.grayscale = False
        self.blur = False

        self.running = True
        self.hcam = ueye.HIDS(0)
        self.ret = ueye.is_InitCamera(self.hcam, None)
        print(f"initCamera returns {self.ret}")

        # set color mode
        self.ret = ueye.is_SetColorMode(self.hcam, ueye.IS_CM_BGR8_PACKED)
        print(f"SetColorMode IS_CM_BGR8_PACKED returns {self.ret}")
        #self.ret = ueye.is_SetExternalTrigger(self.hcam,ueye.IS_SET_TRIGGER_HI_LO_SYNC)

        # set region of interest
        self.width = 1280
        self.height = 1080
        self.rect_aoi = ueye.IS_RECT()
        ##########
        self.rect_aoi.s32X = ueye.int(0)
        self.rect_aoi.s32Y = ueye.int(0)
        self.rect_aoi.s32Width = ueye.int(self.width)
        self.rect_aoi.s32Height = ueye.int(self.height)
        ueye.is_AOI(self.hcam, ueye.IS_AOI_IMAGE_SET_AOI, self.rect_aoi, ueye.sizeof(self.rect_aoi))
        print(f"AOI IS_AOI_IMAGE_SET_AOI returns {self.ret}")

        # allocate memory
        self.mem_ptr = ueye.c_mem_p()
        self.mem_id = ueye.int()
        self.bitspixel = 24 # for colormode = IS_CM_BGR8_PACKED
        ######
        self.ret = ueye.is_AllocImageMem(self.hcam, self.width, self.height, self.bitspixel,
                                    self.mem_ptr, self.mem_id)
        print(f"AllocImageMem returns {self.ret}")

        # set active memory region
        self.ret = ueye.is_SetImageMem(self.hcam, self.mem_ptr, self.mem_id)
        print(f"SetImageMem returns {self.ret}")

        # continuous capture to memory
        self.ret = ueye.is_CaptureVideo(self.hcam, ueye.IS_DONT_WAIT)
        print(f"CaptureVideo returns {self.ret}")

        # get data from camera and display
        self.lineinc = self.width * int((self.bitspixel + 7) / 8)
    def run(self):

        print('start')
        try:
            print('start1')
            while self.running:
                print('start2')
            #ret, frame = cap.read()
                frame = ueye.get_data(self.mem_ptr, self.width, self.height, self.bitspixel, self.lineinc, copy=True)
                print('start3')
                frame = np.reshape(frame, (self.height, self.width, 3))
                print('start4')
                #print(frame)
                #if ret:
                self.h, self.w, self.ch = frame.shape
                bytes_per_line = self.ch * self.w   # PEP8: `lower_case_names` for variables
                image = QImage(frame.data, self.w, self.h, bytes_per_line, QImage.Format_RGB888)
                print('start5')
                self.image = image.scaled(1280, 1080, Qt.KeepAspectRatio)
                self.changePixmap.emit(self.image)
            #cap.release()
            #print('stop')
        except Exception as e:
            print('Exception: {}'.format(e))
            print('error{}'.format(sys.exc_info()[-1].tb_lineno), type(e).__name__,)

    def kill(self):
        self.running = False


问:
How to remove flag secure token in cookies Laravel Inertia in Cpanel Hosting
I have a project with Laravel Inertia Vue in my cpanel hosting. But i see there is have secure flag with my token in cookies like screenshot below:

It affects the post, update, delete method in my web, and return 419 page expired. If i remove both secure flag, then its working normally.

Why i ask this, because in tutorial demo website or other Laravel website, i see that secure flag is not checked, like this screenshot below:

How to remove the secure flag? I have already setting my session.php, and run

```<code>php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
</code>```

but its still not working

My session config:

```<code><?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Session Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the default session "driver" that will be used on
    | requests. By default, we will use the lightweight native driver but
    | you may specify any of the other wonderful drivers provided here.
    |
    | Supported: "file", "cookie", "database", "apc",
    |            "memcached", "redis", "dynamodb", "array"
    |
    */

    'driver' => env('SESSION_DRIVER', 'file'),

    /*
    |--------------------------------------------------------------------------
    | Session Lifetime
    |--------------------------------------------------------------------------
    |
    | Here you may specify the number of minutes that you wish the session
    | to be allowed to remain idle before it expires. If you want them
    | to immediately expire on the browser closing, set that option.
    |
    */

    'lifetime' => env('SESSION_LIFETIME', 120),

    'expire_on_close' => false,

    /*
    |--------------------------------------------------------------------------
    | Session Encryption
    |--------------------------------------------------------------------------
    |
    | This option allows you to easily specify that all of your session data
    | should be encrypted before it is stored. All encryption will be run
    | automatically by Laravel and you can use the Session like normal.
    |
    */

    'encrypt' => false,

    /*
    |--------------------------------------------------------------------------
    | Session File Location
    |--------------------------------------------------------------------------
    |
    | When using the native session driver, we need a location where session
    | files may be stored. A default has been set for you but a different
    | location may be specified. This is only needed for file sessions.
    |
    */

    'files' => storage_path('framework/sessions'),

    /*
    |--------------------------------------------------------------------------
    | Session Database Connection
    |--------------------------------------------------------------------------
    |
    | When using the "database" or "redis" session drivers, you may specify a
    | connection that should be used to manage these sessions. This should
    | correspond to a connection in your database configuration options.
    |
    */

    'connection' => env('SESSION_CONNECTION'),

    /*
    |--------------------------------------------------------------------------
    | Session Database Table
    |--------------------------------------------------------------------------
    |
    | When using the "database" session driver, you may specify the table we
    | should use to manage the sessions. Of course, a sensible default is
    | provided for you; however, you are free to change this as needed.
    |
    */

    'table' => 'sessions',

    /*
    |--------------------------------------------------------------------------
    | Session Cache Store
    |--------------------------------------------------------------------------
    |
    | While using one of the framework's cache driven session backends you may
    | list a cache store that should be used for these sessions. This value
    | must match with one of the application's configured cache "stores".
    |
    | Affects: "apc", "dynamodb", "memcached", "redis"
    |
    */

    'store' => env('SESSION_STORE'),

    /*
    |--------------------------------------------------------------------------
    | Session Sweeping Lottery
    |--------------------------------------------------------------------------
    |
    | Some session drivers must manually sweep their storage location to get
    | rid of old sessions from storage. Here are the chances that it will
    | happen on a given request. By default, the odds are 2 out of 100.
    |
    */

    'lottery' => [2, 100],

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Name
    |--------------------------------------------------------------------------
    |
    | Here you may change the name of the cookie used to identify a session
    | instance by ID. The name specified here will get used every time a
    | new session cookie is created by the framework for every driver.
    |
    */

    'cookie' => env(
        'SESSION_COOKIE',
        Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
    ),

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Path
    |--------------------------------------------------------------------------
    |
    | The session cookie path determines the path for which the cookie will
    | be regarded as available. Typically, this will be the root path of
    | your application but you are free to change this when necessary.
    |
    */

    'path' => '/',

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Domain
    |--------------------------------------------------------------------------
    |
    | Here you may change the domain of the cookie used to identify a session
    | in your application. This will determine which domains the cookie is
    | available to in your application. A sensible default has been set.
    |
    */

    'domain' => env('SESSION_DOMAIN'),

    /*
    |--------------------------------------------------------------------------
    | HTTPS Only Cookies
    |--------------------------------------------------------------------------
    |
    | By setting this option to true, session cookies will only be sent back
    | to the server if the browser has a HTTPS connection. This will keep
    | the cookie from being sent to you when it can't be done securely.
    |
    */

    'secure' => env('SESSION_SECURE_COOKIE', false),

    /*
    |--------------------------------------------------------------------------
    | HTTP Access Only
    |--------------------------------------------------------------------------
    |
    | Setting this value to true will prevent JavaScript from accessing the
    | value of the cookie and the cookie will only be accessible through
    | the HTTP protocol. You are free to modify this option if needed.
    |
    */

    'http_only' => false,

    /*
    |--------------------------------------------------------------------------
    | Same-Site Cookies
    |--------------------------------------------------------------------------
    |
    | This option determines how your cookies behave when cross-site requests
    | take place, and can be used to mitigate CSRF attacks. By default, we
    | will set this value to "lax" since this is a secure default value.
    |
    | Supported: "lax", "strict", "none", null
    |
    */

    'same_site' => 'lax',

];
</code>```

My env:

```<code>...
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
...
</code>```

I use php 8.0 on my hosting. Please help me to solve this problem. Thanks before.

Note: I have 2 project with same stack in the hosting, and both is not working now, error 419.

Body:
I have a project with Laravel Inertia Vue in my cpanel hosting. But i see there is have secure flag with my token in cookies like screenshot below:

It affects the post, update, delete method in my web, and return 419 page expired. If i remove both secure flag, then its working normally.

Why i ask this, because in tutorial demo website or other Laravel website, i see that secure flag is not checked, like this screenshot below:

How to remove the secure flag? I have already setting my session.php, and run

php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear

but its still not working

My session config:

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Session Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the default session "driver" that will be used on
    | requests. By default, we will use the lightweight native driver but
    | you may specify any of the other wonderful drivers provided here.
    |
    | Supported: "file", "cookie", "database", "apc",
    |            "memcached", "redis", "dynamodb", "array"
    |
    */

    'driver' => env('SESSION_DRIVER', 'file'),

    /*
    |--------------------------------------------------------------------------
    | Session Lifetime
    |--------------------------------------------------------------------------
    |
    | Here you may specify the number of minutes that you wish the session
    | to be allowed to remain idle before it expires. If you want them
    | to immediately expire on the browser closing, set that option.
    |
    */

    'lifetime' => env('SESSION_LIFETIME', 120),

    'expire_on_close' => false,

    /*
    |--------------------------------------------------------------------------
    | Session Encryption
    |--------------------------------------------------------------------------
    |
    | This option allows you to easily specify that all of your session data
    | should be encrypted before it is stored. All encryption will be run
    | automatically by Laravel and you can use the Session like normal.
    |
    */

    'encrypt' => false,

    /*
    |--------------------------------------------------------------------------
    | Session File Location
    |--------------------------------------------------------------------------
    |
    | When using the native session driver, we need a location where session
    | files may be stored. A default has been set for you but a different
    | location may be specified. This is only needed for file sessions.
    |
    */

    'files' => storage_path('framework/sessions'),

    /*
    |--------------------------------------------------------------------------
    | Session Database Connection
    |--------------------------------------------------------------------------
    |
    | When using the "database" or "redis" session drivers, you may specify a
    | connection that should be used to manage these sessions. This should
    | correspond to a connection in your database configuration options.
    |
    */

    'connection' => env('SESSION_CONNECTION'),

    /*
    |--------------------------------------------------------------------------
    | Session Database Table
    |--------------------------------------------------------------------------
    |
    | When using the "database" session driver, you may specify the table we
    | should use to manage the sessions. Of course, a sensible default is
    | provided for you; however, you are free to change this as needed.
    |
    */

    'table' => 'sessions',

    /*
    |--------------------------------------------------------------------------
    | Session Cache Store
    |--------------------------------------------------------------------------
    |
    | While using one of the framework's cache driven session backends you may
    | list a cache store that should be used for these sessions. This value
    | must match with one of the application's configured cache "stores".
    |
    | Affects: "apc", "dynamodb", "memcached", "redis"
    |
    */

    'store' => env('SESSION_STORE'),

    /*
    |--------------------------------------------------------------------------
    | Session Sweeping Lottery
    |--------------------------------------------------------------------------
    |
    | Some session drivers must manually sweep their storage location to get
    | rid of old sessions from storage. Here are the chances that it will
    | happen on a given request. By default, the odds are 2 out of 100.
    |
    */

    'lottery' => [2, 100],

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Name
    |--------------------------------------------------------------------------
    |
    | Here you may change the name of the cookie used to identify a session
    | instance by ID. The name specified here will get used every time a
    | new session cookie is created by the framework for every driver.
    |
    */

    'cookie' => env(
        'SESSION_COOKIE',
        Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
    ),

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Path
    |--------------------------------------------------------------------------
    |
    | The session cookie path determines the path for which the cookie will
    | be regarded as available. Typically, this will be the root path of
    | your application but you are free to change this when necessary.
    |
    */

    'path' => '/',

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Domain
    |--------------------------------------------------------------------------
    |
    | Here you may change the domain of the cookie used to identify a session
    | in your application. This will determine which domains the cookie is
    | available to in your application. A sensible default has been set.
    |
    */

    'domain' => env('SESSION_DOMAIN'),

    /*
    |--------------------------------------------------------------------------
    | HTTPS Only Cookies
    |--------------------------------------------------------------------------
    |
    | By setting this option to true, session cookies will only be sent back
    | to the server if the browser has a HTTPS connection. This will keep
    | the cookie from being sent to you when it can't be done securely.
    |
    */

    'secure' => env('SESSION_SECURE_COOKIE', false),

    /*
    |--------------------------------------------------------------------------
    | HTTP Access Only
    |--------------------------------------------------------------------------
    |
    | Setting this value to true will prevent JavaScript from accessing the
    | value of the cookie and the cookie will only be accessible through
    | the HTTP protocol. You are free to modify this option if needed.
    |
    */

    'http_only' => false,

    /*
    |--------------------------------------------------------------------------
    | Same-Site Cookies
    |--------------------------------------------------------------------------
    |
    | This option determines how your cookies behave when cross-site requests
    | take place, and can be used to mitigate CSRF attacks. By default, we
    | will set this value to "lax" since this is a secure default value.
    |
    | Supported: "lax", "strict", "none", null
    |
    */

    'same_site' => 'lax',

];

My env:

...
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
...

I use php 8.0 on my hosting. Please help me to solve this problem. Thanks before.

Note: I have 2 project with same stack in the hosting, and both is not working now, error 419.


问:
How to use the ols().fit() function when there's way too many dependent variables to list?
I have a model that has thousands of dependent variables (due to one hot encoding) and am wondering how to list them all when trying to produce an OLS table. This is my code so far:

```<code>import statsmodels.api as sm
from statsmodels.formula.api import ols

iv = movies.loc[:, movies.columns != ["name",'year','gross']]

model = ols('gross ~ iv', data=movies).fit()
print(model.summary())
</code>```

This produces an error:

```<code>ValueError: ('Shapes must match', (7825,), (3,))
</code>```

I'm kind of new to this so how can I go about this?

Body:
I have a model that has thousands of dependent variables (due to one hot encoding) and am wondering how to list them all when trying to produce an OLS table. This is my code so far:

import statsmodels.api as sm
from statsmodels.formula.api import ols

iv = movies.loc[:, movies.columns != ["name",'year','gross']]

model = ols('gross ~ iv', data=movies).fit()
print(model.summary())

This produces an error:

ValueError: ('Shapes must match', (7825,), (3,))

I'm kind of new to this so how can I go about this?


问:
Best way to model multi-dimensional input to minimize KL divergence?
My input has a dimension of 496x2 which represents 496 different features and their parameters that are two values. The output is a distribution of these 496 features such that they sum to 1.0.

I am trying to model this with a Multi Layer Perceptron (MLP). I found that I must flatten the input after the first hidden layer to make it run. This is the working model I have:

```<code>  model.add(Dense(16, activation='relu', kernel_initializer='he_normal', input_shape=(496,2)))
  model.add(Flatten())
  model.add(Dense(128, activation='relu', kernel_initializer='he_normal'))
  model.add(Dense(128, activation='relu', kernel_initializer='he_normal'))
  model.add(Dense(496, activation='softmax'))
  model.compile(optimizer='adam', loss='kl_divergence')
</code>```

KL divergence was chosen as I am minimizing the difference between two distributions with 496 possible features.

To some extent the above model works but I would like to have a better model. The problem with the current model is that it doesn't take into account of the positional correspondence of the inputs and outputs. The flatten layer also mixes up the first parameter and the second parameter of each feature. Is there a better model for this problem? Thank you very much in advance.

Body:
My input has a dimension of 496x2 which represents 496 different features and their parameters that are two values. The output is a distribution of these 496 features such that they sum to 1.0.

I am trying to model this with a Multi Layer Perceptron (MLP). I found that I must flatten the input after the first hidden layer to make it run. This is the working model I have:

  model.add(Dense(16, activation='relu', kernel_initializer='he_normal', input_shape=(496,2)))
  model.add(Flatten())
  model.add(Dense(128, activation='relu', kernel_initializer='he_normal'))
  model.add(Dense(128, activation='relu', kernel_initializer='he_normal'))
  model.add(Dense(496, activation='softmax'))
  model.compile(optimizer='adam', loss='kl_divergence')

KL divergence was chosen as I am minimizing the difference between two distributions with 496 possible features.

To some extent the above model works but I would like to have a better model. The problem with the current model is that it doesn't take into account of the positional correspondence of the inputs and outputs. The flatten layer also mixes up the first parameter and the second parameter of each feature. Is there a better model for this problem? Thank you very much in advance.


问:
Tkinter Scrollbar porblems when using update() inside a for loop
I'm creating an entry list which works fine when I don't use the update() but when I use it the scroll bar is grayed out.

This is the code that works fine:

```<code>from tkinter import *

root = Tk()

main_frame = Frame(root)
main_frame.pack(fill=BOTH, expand=1)
canvas = Canvas(main_frame, highlightthickness=0)
canvas.pack(side=LEFT, fill=BOTH, expand=1)
scrollbar = Scrollbar(main_frame, orient=VERTICAL, command=canvas.yview)
scrollbar.pack(side=RIGHT, fill=Y)
canvas.configure(yscrollcommand=scrollbar.set)
canvas.bind('<Configure>', lambda e: canvas.configure(scrollregion = canvas.bbox("all")))
second_frame = Frame(canvas)
canvas.create_window((0,0), window=second_frame, anchor="nw")

for i in range(100):
    x = Frame(second_frame)
    x.pack(fill=BOTH, padx=20, pady=0)

    resultados_entry = Entry(x, width=73)
    resultados_entry.pack(side=LEFT, fill=BOTH, expand=1, padx=0)
    resultados_entry.insert(0, str(i))

root.mainloop()
</code>```

And this is the one that doesn´t:

```<code>from tkinter import *

root = Tk()

main_frame = Frame(root)
main_frame.pack(fill=BOTH, expand=1)
canvas = Canvas(main_frame, highlightthickness=0)
canvas.pack(side=LEFT, fill=BOTH, expand=1)
scrollbar = Scrollbar(main_frame, orient=VERTICAL, command=canvas.yview)
scrollbar.pack(side=RIGHT, fill=Y)
canvas.configure(yscrollcommand=scrollbar.set)
canvas.bind('<Configure>', lambda e: canvas.configure(scrollregion = canvas.bbox("all")))
second_frame = Frame(canvas)
canvas.create_window((0,0), window=second_frame, anchor="nw")

for i in range(100):
    x = Frame(second_frame)
    x.pack(fill=BOTH, padx=20, pady=0)

    resultados_entry = Entry(x, width=73)
    resultados_entry.pack(side=LEFT, fill=BOTH, expand=1, padx=0)
    resultados_entry.insert(0, str(i))

    root.update()

root.mainloop()
</code>```

I want to use root.update() inside of my for loop because I want to display the entries as they are created. I don't want to wait until the for loop finished to start displaying them.

Body:
I'm creating an entry list which works fine when I don't use the update() but when I use it the scroll bar is grayed out.

This is the code that works fine:

from tkinter import *

root = Tk()

main_frame = Frame(root)
main_frame.pack(fill=BOTH, expand=1)
canvas = Canvas(main_frame, highlightthickness=0)
canvas.pack(side=LEFT, fill=BOTH, expand=1)
scrollbar = Scrollbar(main_frame, orient=VERTICAL, command=canvas.yview)
scrollbar.pack(side=RIGHT, fill=Y)
canvas.configure(yscrollcommand=scrollbar.set)
canvas.bind('<Configure>', lambda e: canvas.configure(scrollregion = canvas.bbox("all")))
second_frame = Frame(canvas)
canvas.create_window((0,0), window=second_frame, anchor="nw")

for i in range(100):
    x = Frame(second_frame)
    x.pack(fill=BOTH, padx=20, pady=0)

    resultados_entry = Entry(x, width=73)
    resultados_entry.pack(side=LEFT, fill=BOTH, expand=1, padx=0)
    resultados_entry.insert(0, str(i))

root.mainloop()

And this is the one that doesn´t:

from tkinter import *

root = Tk()

main_frame = Frame(root)
main_frame.pack(fill=BOTH, expand=1)
canvas = Canvas(main_frame, highlightthickness=0)
canvas.pack(side=LEFT, fill=BOTH, expand=1)
scrollbar = Scrollbar(main_frame, orient=VERTICAL, command=canvas.yview)
scrollbar.pack(side=RIGHT, fill=Y)
canvas.configure(yscrollcommand=scrollbar.set)
canvas.bind('<Configure>', lambda e: canvas.configure(scrollregion = canvas.bbox("all")))
second_frame = Frame(canvas)
canvas.create_window((0,0), window=second_frame, anchor="nw")

for i in range(100):
    x = Frame(second_frame)
    x.pack(fill=BOTH, padx=20, pady=0)

    resultados_entry = Entry(x, width=73)
    resultados_entry.pack(side=LEFT, fill=BOTH, expand=1, padx=0)
    resultados_entry.insert(0, str(i))

    root.update()

root.mainloop()

I want to use root.update() inside of my for loop because I want to display the entries as they are created. I don't want to wait until the for loop finished to start displaying them.


问:
swiper didnt work on the Width size I decide
I want to make work swiper when the window width < 1280 for mobile.
So i copied exsample code and pasted on my web site.
It looks simple, but I really dont know why the swiper dont work on the mobile,
What I need to revise on the code?

```<code>

<style>
`    `.swiper-container{height: 60px;}
`    `.swiper-container .swiper-slide {width: 370px; border : 1px solid; text-align:center;}
</style>

<div class="swiper-container">
`   `<div class="swiper-wrapper">
`      `<div class="swiper-slide">시계 전제품 무료배송</div>
`      `<div class="swiper-slide">가입시 5% 할인쿠폰</div>
`          `<div class="swiper-slide">3시 전 주문시 당일발송</div>
`        `</div>
</div>

<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

<script>
`    `var ww = $(window).width();
`    `var mySwiper = undefined;

`    `function initSwiper() {

`    `if (ww < 1280 && mySwiper == undefined) {
`        `mySwiper = new Swiper(".swiper-container", {
`        `slidesPerView: 1,
`        `spaceBetween: 10,
`        `simulateTouch: true,
`        `loop: true,
`        `autoplay: {
`            `delay: 2000,
`            `disableOnInteraction: false,
`        `},
`    `});
`  `} else if (ww >= 1280 && mySwiper != undefined) {
`    `mySwiper.destroy();
`    `mySwiper = undefined;
`  `}
}

initSwiper();

$(window).on('resize', function () {
  ww = $(window).width();
  initSwiper();
});
    </script>

</code>```

I have changed javascript code to others, and change the slidePerView count, and so on.

Body:
I want to make work swiper when the window width < 1280 for mobile.
So i copied exsample code and pasted on my web site.
It looks simple, but I really dont know why the swiper dont work on the mobile,
What I need to revise on the code?

`   `

`      `
시계 전제품 무료배송

`      `
가입시 5% 할인쿠폰

`          `
3시 전 주문시 당일발송

`        `

I have changed javascript code to others, and change the slidePerView count, and so on.


问:
Cannot download shared folder from google drive to google colab via link because python init file needs to be scanned for viruses
I have a google drive folder and google colab notebook that both need to be shared among multiple people. I need to import the folder into the colab workspace, though I don't want them to have access to my entire google drive, just the specific folder. (Link to folder) My best code is below:

```<code>import gdown
url = 'https://drive.google.com/drive/folders/1BHpCP_P-x0jQ2ukEFktaeoD_5VkHAez_?usp=share_link'
gdown.download_folder(url, quiet=True)
</code>```

However, I get the following message:

```<code>Access denied with the following error:

    Cannot retrieve the public link of the file. You may need to change
    the permission to 'Anyone with the link', or have had many accesses.

You may still be able to access the file from the browser:

     https://drive.google.com/uc?id=1SBHBGrwPYgqeNVOfnD6yLMN15Acos7BQ
</code>```

My folder is available to anyone with the link, but I suspect it is because the file needs to be scanned for viruses. Is there any workaround? I have tried everything related, but cannot find a solution to my specific problem that fits my needs. Please help, thank you.

Body:
I have a google drive folder and google colab notebook that both need to be shared among multiple people. I need to import the folder into the colab workspace, though I don't want them to have access to my entire google drive, just the specific folder. (Link to folder) My best code is below:

import gdown
url = 'https://drive.google.com/drive/folders/1BHpCP_P-x0jQ2ukEFktaeoD_5VkHAez_?usp=share_link'
gdown.download_folder(url, quiet=True)

However, I get the following message:

Access denied with the following error:

    Cannot retrieve the public link of the file. You may need to change
    the permission to 'Anyone with the link', or have had many accesses.

You may still be able to access the file from the browser:

     https://drive.google.com/uc?id=1SBHBGrwPYgqeNVOfnD6yLMN15Acos7BQ

My folder is available to anyone with the link, but I suspect it is because the file needs to be scanned for viruses. Is there any workaround? I have tried everything related, but cannot find a solution to my specific problem that fits my needs. Please help, thank you.


问:
Android Studio Dolphin more than one devices logcat show abnormal
my Android Studio version info is

```<code>Android Studio Dolphin | 2021.3.1 Patch 1
</code>```

I have more than one devices connected to Android Studio, when I switch one device to other device, the logcat is show nothing, any body have same issue?

Body:
my Android Studio version info is

Android Studio Dolphin | 2021.3.1 Patch 1

I have more than one devices connected to Android Studio, when I switch one device to other device, the logcat is show nothing, any body have same issue?


问:
How to break for loop when it found 1 match
There is one excel file Email Info.xlsx, and there are many reports by Vendor name, both have the same column name "Vendor". This function will display all emails with identical vendors from both dataframes/excels. How to make it break in the first match? Thank you!</p>
```<code>def DisplayExample():
    # Load email info into dataframe
    try:
        now_date = datetime.today().strftime('%m-%d-%Y')  # current date
        email_info = pd.read_excel(email_file_path)
        email_info.fillna('', inplace=True)

        outlook = win32.Dispatch('outlook.application')
        for index, row in email_info.iterrows():
            mail = outlook.CreateItem(0)
            mail.To = row["Email"]
            mail.CC = row["CC"]
            mail.Subject = f"{row['Vendor']} - Report {now_date}"
            mail.Body = ''
            try:
                excel_file = f"{row['Vendor']}.xlsx"
                attached_excel_path = os.path.join(path, excel_file)
                mail.Attachments.Add(Source=attached_excel_path)
            except Exception as e:
                messagebox.showerror('Python Error', f"This vendor {row['Vendor']} doesn't match in Email Info and Report")

            mail.Display()
            # mail.Send()
            if something here...:
                break

    except Exception as e:
         messagebox.showerror('Python Error', e)
</code>```

Body:
There is one excel file Email Info.xlsx, and there are many reports by Vendor name, both have the same column name "Vendor". This function will display all emails with identical vendors from both dataframes/excels. How to make it break in the first match? Thank you!

def DisplayExample():
    # Load email info into dataframe
    try:
        now_date = datetime.today().strftime('%m-%d-%Y')  # current date
        email_info = pd.read_excel(email_file_path)
        email_info.fillna('', inplace=True)

        outlook = win32.Dispatch('outlook.application')
        for index, row in email_info.iterrows():
            mail = outlook.CreateItem(0)
            mail.To = row["Email"]
            mail.CC = row["CC"]
            mail.Subject = f"{row['Vendor']} - Report {now_date}"
            mail.Body = ''
            try:
                excel_file = f"{row['Vendor']}.xlsx"
                attached_excel_path = os.path.join(path, excel_file)
                mail.Attachments.Add(Source=attached_excel_path)
            except Exception as e:
                messagebox.showerror('Python Error', f"This vendor {row['Vendor']} doesn't match in Email Info and Report")

            mail.Display()
            # mail.Send()
            if something here...:
                break

    except Exception as e:
         messagebox.showerror('Python Error', e)


问:
Unity Scenes And Asset bundles where not loaded after compiling to APK
Hi can anyone kind enough to share some lights into my problem.
I have existing project and when i run the unity player i have no issue with the game all are working fine.

But when compile to APK i encounter some issue the scenes and assets where not loaded. So what i do is i decompile the APK and found out that the asset folder has no Assetbundle folder inside. Now im confuse how this happen i was expecting that upon building all its files suppose to be included. Please advise if anyone encounter this issue.

Below Image When UNITY PLAYER START:

Below Build Settings:

Below when installed to phone and run the game:

Below Assets folder decompile APK:


问:
Change React Dropdown background image
I want to create a functional Dropdown menu in react using react-dropdown (it doesn't have to use this, but this is what've been using so far). I want to change the background of the dropdown before and after being clicked. This is a visual example of what I want to achieve:

The left is before, the right is after. But I do not want a simple colored border, I want to use a specific image.

In the code below, I have the background image properly set for the "before being clicked" state, but I do not know how to change the background when clicked.

```<code>const options= [
    { value: '1', label: 'one' },
    { value: '2', label: 'two' },
    { value: '3', label: 'three' }
]

class ShowMenu extends React.Component {
    render() {
        return (
            <>
                <Dropdown options={options} onChange={this._onSelect} value={options[0]} className="menu" />

            </>

        )
    }
}
</code>```
```<code>.menu {
    background-image: url(../img/menu.png);
    width: 80px;
    height: 20px;
}
</code>```

Title: Change React Dropdown background image

Body:
I want to create a functional Dropdown menu in react using react-dropdown (it doesn't have to use this, but this is what've been using so far). I want to change the background of the dropdown before and after being clicked. This is a visual example of what I want to achieve:

The left is before, the right is after. But I do not want a simple colored border, I want to use a specific image.

In the code below, I have the background image properly set for the "before being clicked" state, but I do not know how to change the background when clicked.

const options= [
    { value: '1', label: 'one' },
    { value: '2', label: 'two' },
    { value: '3', label: 'three' }
]

class ShowMenu extends React.Component {
    render() {
        return (
            <>
                <Dropdown options={options} onChange={this._onSelect} value={options[0]} className="menu" />

            </>

        )
    }
}

.menu {
    background-image: url(../img/menu.png);
    width: 80px;
    height: 20px;
}